on master help sign in
Change module prefixes for some values
b87e45aEvan Czaplicki
compiler/Type/Constrain/Declaration.hs+14−19
@@ -5,22 +5,17 @@ import Control.Applicative ((<$>))
5
5
6import qualified Data.Map as Map
6import qualified Data.Map as Map
7
7
8−import qualified Type.Type as T
9import qualified Type.Constrain.Expression as TcExpr
8import qualified Type.Constrain.Expression as TcExpr
10import qualified Type.Environment as Env
9import qualified Type.Environment as Env
11
10
12import SourceSyntax.Declaration
11import SourceSyntax.Declaration
13−import qualified SourceSyntax.Location as SL
12+import qualified SourceSyntax.Everything as Src
14−import qualified SourceSyntax.Literal as SL
15−import qualified SourceSyntax.Pattern as SP
13+import qualified SourceSyntax.Type as Type
16−import qualified SourceSyntax.Expression as SE
17−import qualified SourceSyntax.Type as ST
18
14
19−
20−toExpr :: [Declaration t v] -> [SE.Def t v]
15+toExpr :: [Declaration t v] -> [Src.Def t v]
21toExpr = concatMap toDefs
16toExpr = concatMap toDefs
22
17
23−toDefs :: Declaration t v -> [SE.Def t v]
18+toDefs :: Declaration t v -> [Src.Def t v]
24toDefs decl =
19toDefs decl =
25 case decl of
20 case decl of
26 Definition def -> [def]
21 Definition def -> [def]
@@ -29,24 +24,24 @@ toDefs decl =
29 where
24 where
30 toDefs (ctor, tipes) =
25 toDefs (ctor, tipes) =
31 let vars = take (length tipes) $ map (\n -> "_" ++ show n) [0..]
26 let vars = take (length tipes) $ map (\n -> "_" ++ show n) [0..]
32− loc = SL.none
27+ loc = Src.none
33− body = loc . SE.Data name $ map (loc . SE.Var) vars
28+ body = loc . Src.Data name $ map (loc . Src.Var) vars
34− in [ SE.TypeAnnotation ctor $
29+ in [ Src.TypeAnnotation ctor $
35− foldr ST.Lambda (ST.Data name $ map ST.Var tvars) tipes
30+ foldr Type.Lambda (Type.Data name $ map Type.Var tvars) tipes
36− , SE.Def (SP.PVar ctor) $
31+ , Src.Def (Src.PVar ctor) $
37− foldr (\p e -> loc $ SE.Lambda p e) body (map SP.PVar vars)
32+ foldr (\p e -> loc $ Src.Lambda p e) body (map Src.PVar vars)
38 ]
33 ]
39
34
40 -- Type aliases must be added to an extended equality dictionary,
35 -- Type aliases must be added to an extended equality dictionary,
41 -- but they do not require any basic constraints.
36 -- but they do not require any basic constraints.
42 TypeAlias _ _ _ -> []
37 TypeAlias _ _ _ -> []
43
38
44− ImportEvent _ expr@(SL.L a b _) name tipe ->
39+ ImportEvent _ expr@(Src.L a b _) name tipe ->
45− [ SE.TypeAnnotation name tipe
40+ [ Src.TypeAnnotation name tipe
46− , SE.Def (SP.PVar name) (SL.L a b $ SE.App (SL.L a b $ SE.Var "constant") expr) ]
41+ , Src.Def (Src.PVar name) (Src.L a b $ Src.App (Src.L a b $ Src.Var "constant") expr) ]
47
42
48 ExportEvent _ name tipe ->
43 ExportEvent _ name tipe ->
49− [ SE.TypeAnnotation name tipe ]
44+ [ Src.TypeAnnotation name tipe ]
50
45
51 -- no constraints are needed for fixity declarations
46 -- no constraints are needed for fixity declarations
52 Fixity _ _ _ -> []
47 Fixity _ _ _ -> []