Switch name of qualified import
This commit is contained in:
parent
9ff26223d8
commit
863d31b38f
1 changed files with 11 additions and 11 deletions
|
@ -2,15 +2,15 @@
|
|||
module Type.Constrain.Declaration where
|
||||
|
||||
import SourceSyntax.Declaration
|
||||
import qualified SourceSyntax.Expression as Src
|
||||
import qualified SourceSyntax.Expression as E
|
||||
import qualified SourceSyntax.Location as L
|
||||
import qualified SourceSyntax.Pattern as P
|
||||
import qualified SourceSyntax.Type as Type
|
||||
|
||||
toExpr :: [Declaration] -> [Src.Def]
|
||||
toExpr :: [Declaration] -> [E.Def]
|
||||
toExpr = concatMap toDefs
|
||||
|
||||
toDefs :: Declaration -> [Src.Def]
|
||||
toDefs :: Declaration -> [E.Def]
|
||||
toDefs decl =
|
||||
case decl of
|
||||
Definition def -> [def]
|
||||
|
@ -20,7 +20,7 @@ toDefs decl =
|
|||
toDefs' (ctor, tipes) =
|
||||
let vars = take (length tipes) arguments
|
||||
tbody = Type.Data name $ map Type.Var tvars
|
||||
body = L.none . Src.Data ctor $ map (L.none . Src.Var) vars
|
||||
body = L.none . E.Data ctor $ map (L.none . E.Var) vars
|
||||
in [ definition ctor (buildFunction body vars) (foldr Type.Lambda tbody tipes) ]
|
||||
|
||||
TypeAlias name _ tipe@(Type.Record fields ext) _ ->
|
||||
|
@ -30,13 +30,13 @@ toDefs decl =
|
|||
Type.EmptyRecord -> map snd fields
|
||||
_ -> map snd fields ++ [ext]
|
||||
|
||||
var = L.none . Src.Var
|
||||
var = L.none . E.Var
|
||||
vars = take (length args) arguments
|
||||
|
||||
efields = zip (map fst fields) (map var vars)
|
||||
record = case ext of
|
||||
Type.EmptyRecord -> L.none $ Src.Record efields
|
||||
_ -> foldl (\r (f,v) -> L.none $ Src.Insert r f v) (var $ last vars) efields
|
||||
Type.EmptyRecord -> L.none $ E.Record efields
|
||||
_ -> foldl (\r (f,v) -> L.none $ E.Insert r f v) (var $ last vars) efields
|
||||
|
||||
-- Type aliases must be added to an extended equality dictionary,
|
||||
-- but they do not require any basic constraints.
|
||||
|
@ -56,9 +56,9 @@ toDefs decl =
|
|||
arguments :: [String]
|
||||
arguments = map (:[]) ['a'..'z'] ++ map (\n -> "_" ++ show (n :: Int)) [1..]
|
||||
|
||||
buildFunction :: Src.LExpr -> [String] -> Src.LExpr
|
||||
buildFunction :: E.LExpr -> [String] -> E.LExpr
|
||||
buildFunction body@(L.L s _) vars =
|
||||
foldr (\p e -> L.L s (Src.Lambda p e)) body (map P.PVar vars)
|
||||
foldr (\p e -> L.L s (E.Lambda p e)) body (map P.PVar vars)
|
||||
|
||||
definition :: String -> Src.LExpr -> Type.Type -> Src.Def
|
||||
definition name expr tipe = Src.Definition (P.PVar name) expr (Just tipe)
|
||||
definition :: String -> E.LExpr -> Type.Type -> E.Def
|
||||
definition name expr tipe = E.Definition (P.PVar name) expr (Just tipe)
|
Loading…
Reference in a new issue