lookupAttrType :: [Struct] -> String -> String -> TypeM Type
lookupAttrType types attr struct =
    let isStruct  = (== struct) . structName
        mbStruct  = find isStruct types
        getAttr   = lookupName attr . declsToMap . structDecls
    in maybe (noStructErr struct) getAttr mbStruct
lookupAttrType :: [Struct] -> String -> String -> TypeM Type
lookupAttrType types attr struct =
    let isStruct  = (== struct) . structName
        mbStruct  = find isStruct types
        getAttr   = lookupName attr . declsToMap . structDecls
    in maybe (noStructErr struct) getAttr mbStruct
lookupAttrType types attr struct =
    let isStruct  = (== struct) . structName
        mbStruct  = find isStruct types
        getAttr   = lookupName attr . declsToMap . structDecls
    in maybe (noStructErr struct) getAttr mbStruct