@@ -9,7 +9,9 @@ import qualified Type.Constrain.Expression as TcExpr
99import qualified Type.Environment as Env
1010
1111import SourceSyntax.Declaration
12−import qualified SourceSyntax.Everything as Src
12+import qualified SourceSyntax.Expression as Src
13+import qualified SourceSyntax.Location as L
14+import qualified SourceSyntax.Pattern as P
1315import qualified SourceSyntax.Type as Type
1416
1517toExpr :: [Declaration t v] -> [Src.Def t v]
@@ -25,34 +27,34 @@ toDefs decl =
2527 toDefs (ctor, tipes) =
2628 let vars = take (length tipes) arguments
2729 tbody = Type.Data name $ map Type.Var tvars
28− body = Src.none . Src.Data ctor $ map (Src.none . Src.Var) vars
30+ body = L.none . Src.Data ctor $ map (L.none . Src.Var) vars
2931 in [ Src.TypeAnnotation ctor $ foldr Type.Lambda tbody tipes
30− , Src.Def (Src.PVar ctor) $ buildFunction body vars
32+ , Src.Def (P.PVar ctor) $ buildFunction body vars
3133 ]
3234
3335 TypeAlias name tvars tipe@(Type.Record fields ext) ->
3436 [ Src.TypeAnnotation name $ foldr Type.Lambda tipe args
35− , Src.Def (Src.PVar name) $ buildFunction record vars ]
37+ , Src.Def (P.PVar name) $ buildFunction record vars ]
3638 where
3739 args = case ext of
3840 Type.EmptyRecord -> map snd fields
3941 _ -> map snd fields ++ [ext]
4042
41− var = Src.none . Src.Var
43+ var = L.none . Src.Var
4244 vars = take (length args) arguments
4345
4446 efields = zip (map fst fields) (map var vars)
4547 record = case ext of
46− Type.EmptyRecord -> Src.none $ Src.Record efields
47− _ -> foldl (\r (f,v) -> Src.none $ Src.Insert r f v) (var $ last vars) efields
48+ Type.EmptyRecord -> L.none $ Src.Record efields
49+ _ -> foldl (\r (f,v) -> L.none $ Src.Insert r f v) (var $ last vars) efields
4850
4951 -- Type aliases must be added to an extended equality dictionary,
5052 -- but they do not require any basic constraints.
5153 TypeAlias _ _ _ -> []
5254
53− ImportEvent _ expr@(Src.L s _) name tipe ->
55+ ImportEvent _ expr@(L.L s _) name tipe ->
5456 [ Src.TypeAnnotation name tipe
55− , Src.Def (Src.PVar name) (Src.L s $ Src.App (Src.L s $ Src.Var "constant") expr) ]
57+ , Src.Def (P.PVar name) (L.L s $ Src.App (L.L s $ Src.Var "constant") expr) ]
5658
5759 ExportEvent _ name tipe ->
5860 [ Src.TypeAnnotation name tipe ]
@@ -64,5 +66,5 @@ toDefs decl =
6466arguments :: [String]
6567arguments = map (:[]) ['a'..'z'] ++ map (\n -> "_" ++ show n) [1..]
6668
67−buildFunction body@(Src.L s _) vars =
68− foldr (\p e -> Src.L s (Src.Lambda p e)) body (map Src.PVar vars)
69+buildFunction body@(L.L s _) vars =
70+ foldr (\p e -> L.L s (Src.Lambda p e)) body (map P.PVar vars)