@@ -26,11 +26,11 @@ interface moduleName iface =
2626 , iFixities = iFixities iface -- cannot have canonicalized operators while parsing
2727 }
2828 where
29− both f g (a,b,c) = (f a, b, g c)
29+ both f g (a,b,c,d) = (f a, b, g c, d)
3030 prefix name = moduleName ++ "." ++ name
3131
3232 pair name = (name, moduleName ++ "." ++ name)
33− canon (name,_,_) = pair name
33+ canon (name,_,_,_) = pair name
3434 canons = Map.fromList $ concat
3535 [ map canon (iAdts iface), map canon (iAliases iface) ]
3636
@@ -56,8 +56,8 @@ metadataModule ifaces modul =
5656 [] -> Right ()
5757 missings -> Left [ P.text $ "The following imports were not found: " ++ List.intercalate ", " missings ]
5858 program' <- rename initialEnv (program modul)
59− aliases' <- mapM (third renameType') (aliases modul)
60− datatypes' <- mapM (third (mapM (second (mapM renameType')))) (datatypes modul)
59+ aliases' <- mapM (threeOfFour renameType') (aliases modul)
60+ datatypes' <- mapM (threeOfFour (mapM (second (mapM renameType')))) (datatypes modul)
6161 exports' <- mapM (third renameType') (foreignExports modul)
6262 imports' <- mapM (twoAndFour (rename initialEnv) renameType') (foreignImports modul)
6363 return $ modul { program = program'
@@ -68,19 +68,23 @@ metadataModule ifaces modul =
6868 where
6969 second f (a,b) = (,) a `fmap` f b
7070 third f (a,b,c) = (,,) a b `fmap` f c
71− twoAndFour f g (a,b,c,d) = do b' <- f b
72− d' <- g d
73− return (a,b',c,d')
71+ threeOfFour f (a,b,c,d) =
72+ do c' <- f c
73+ return (a,b,c',d)
74+ twoAndFour f g (a,b,c,d) =
75+ do b' <- f b
76+ d' <- g d
77+ return (a,b',c,d')
7478 renameType' =
7579 Either.either (\err -> Left [P.text err]) return . renameType (replace "type" initialEnv)
7680
77− get1 (a,_,_) = a
81+ get1 (a,_,_,_) = a
7882 canon (name, importMethod) =
7983 let pair pre var = (pre ++ drop (length name + 1) var, var)
8084 iface = ifaces Map.! name
8185 allNames = concat [ Map.keys (iTypes iface)
8286 , map get1 (iAliases iface)
83− , concat [ n : map fst ctors | (n,_,ctors) <- iAdts iface ] ]
87+ , concat [ n : map fst ctors | (n,_,ctors,_) <- iAdts iface ] ]
8488 in case importMethod of
8589 As alias -> map (pair (alias ++ ".")) allNames
8690 Hiding vars -> map (pair "") $ filter (flip Set.notMember vs) allNames