@@ -73,8 +73,8 @@ addValue :: String -> Module.Interface -> Environment -> Var.Value
7373 -> Either [Doc] Environment
7474addValue name interface env value =
7575 let insert' x = insert x (Var.Canonical (Var.Module name) x)
76− msg x = "Import Error: Could not import value '" ++ name ++ "." ++ x ++
77− "'.\n It is not exported by module " ++ name ++ "."
76+ msg x = "Import Error: Could not import value '" ++ name ++ "." ++ x ++
77+ "'.\n It is not exported by module " ++ name ++ "."
7878 notFound x = Left [ P.text (msg x) ]
7979 in
8080 case value of
@@ -85,10 +85,14 @@ addValue name interface env value =
8585
8686 Var.Alias x ->
8787 case Map.lookup x (iAliases interface) of
88− Nothing -> notFound x
8988 Just (tvars, t) ->
9089 let v = (Var.Canonical (Var.Module name) x, tvars, t) in
9190 return $ env { _aliases = insert x v (_aliases env) }
91+ Nothing ->
92+ case Map.lookup x (iAdts interface) of
93+ Nothing -> notFound x
94+ Just (_,_) ->
95+ return $ env { _adts = insert' x (_adts env) }
9296
9397 Var.ADT x (Var.Listing xs open) ->
9498 case Map.lookup x (iAdts interface) of
@@ -188,7 +192,10 @@ delist fullList (Var.Listing partial open)
188192 go (x : list) xs ys
189193
190194 (Var.Alias x', Var.Alias y') | x' == y' ->
191− go (x : list) xs ys
195+ go (x : list) xs ys
196+
197+ (Var.ADT x' _, Var.Alias y') | x' == y' ->
198+ go (Var.ADT x' (Var.Listing [] False) : list) xs ys
192199
193200 (Var.ADT x' (Var.Listing xctors _ ),
194201 Var.ADT y' (Var.Listing yctors open)) | x' == y' ->