@@ -73,8 +73,8 @@ addValue :: String -> Module.Interface -> Environment -> Var.Value
73 -> Either [Doc] Environment
73 -> Either [Doc] Environment
74addValue name interface env value =
74addValue name interface env value =
75 let insert' x = insert x (Var.Canonical (Var.Module name) x)
75 let insert' x = insert x (Var.Canonical (Var.Module name) x)
76− msg x = "Import Error: Could not import value '" ++ name ++ "." ++ x ++
76+ msg x = "Import Error: Could not import value '" ++ name ++ "." ++ x ++
77− "'.\n It is not exported by module " ++ name ++ "."
77+ "'.\n It is not exported by module " ++ name ++ "."
78 notFound x = Left [ P.text (msg x) ]
78 notFound x = Left [ P.text (msg x) ]
80 case value of
80 case value of
@@ -85,10 +85,14 @@ addValue name interface env value =
86 Var.Alias x ->
86 Var.Alias x ->
87 case Map.lookup x (iAliases interface) of
87 case Map.lookup x (iAliases interface) of
88− Nothing -> notFound x
89 Just (tvars, t) ->
88 Just (tvars, t) ->
90 let v = (Var.Canonical (Var.Module name) x, tvars, t) in
89 let v = (Var.Canonical (Var.Module name) x, tvars, t) in
91 return $ env { _aliases = insert x v (_aliases env) }
90 return $ env { _aliases = insert x v (_aliases env) }
92+ case Map.lookup x (iAdts interface) of
93+ Nothing -> notFound x
95+ return $ env { _adts = insert' x (_adts env) }
93 Var.ADT x (Var.Listing xs open) ->
97 Var.ADT x (Var.Listing xs open) ->
94 case Map.lookup x (iAdts interface) of
98 case Map.lookup x (iAdts interface) of
@@ -188,7 +192,10 @@ delist fullList (Var.Listing partial open)
188 go (x : list) xs ys
192 go (x : list) xs ys
190 (Var.Alias x', Var.Alias y') | x' == y' ->
194 (Var.Alias x', Var.Alias y') | x' == y' ->
197+ (Var.ADT x' _, Var.Alias y') | x' == y' ->
191− go (x : list) xs ys
198+ go (Var.ADT x' (Var.Listing [] False) : list) xs ys
193 (Var.ADT x' (Var.Listing xctors _ ),
200 (Var.ADT x' (Var.Listing xctors _ ),
194 Var.ADT y' (Var.Listing yctors open)) | x' == y' ->
201 Var.ADT y' (Var.Listing yctors open)) | x' == y' ->