on master help sign in
remove reprime, many minor cosmetic changes
d41a656Evan Czaplicki
compiler/AST/Module.hs+4
@@ -24,6 +24,10 @@ data Module exs body = Module
24 , body :: body
24 , body :: body
25 }
25 }
26
26
27+getName :: Module exs body -> String
28+getName modul =
29+ List.intercalate "." (names modul)
30+
27data CanonicalBody = CanonicalBody
31data CanonicalBody = CanonicalBody
28 { program :: Canonical.Expr
32 { program :: Canonical.Expr
29 , types :: Types
33 , types :: Types
compiler/AST/PrettyPrint.hs+1−5
@@ -24,11 +24,7 @@ parensIf bool doc = if bool then parens doc else doc
24
24
25variable :: String -> Doc
25variable :: String -> Doc
26variable x =
26variable x =
27− if Help.isOp x then parens (text x)
27+ if Help.isOp x then parens (text x) else text x
28− else text (reprime x)
29−
30−reprime :: String -> String
31−reprime = map (\c -> if c == '$' then '\'' else c)
32
28
33eightyCharLines :: Int -> String -> String
29eightyCharLines :: Int -> String -> String
34eightyCharLines indent message = answer
30eightyCharLines indent message = answer
compiler/AST/Variable.hs+3
@@ -23,6 +23,9 @@ data Canonical = Canonical
23local :: String -> Canonical
23local :: String -> Canonical
24local x = Canonical Local x
24local x = Canonical Local x
25
25
26+builtin :: String -> Canonical
27+builtin x = Canonical BuiltIn x
28+
26class ToString a where
29class ToString a where
27 toString :: a -> String
30 toString :: a -> String
28
31
compiler/Type/Constrain/Expression.hs+1−1
@@ -210,7 +210,7 @@ constrainDef env info (Canonical.Definition pattern expr maybeTipe) =
210 , c /\ c2
210 , c /\ c2
211 , c1 )
211 , c1 )
212
212
213− _ -> error (show pattern)
213+ _ -> error ("problem in constrainDef with " ++ show pattern)
214
214
215expandPattern :: Canonical.Def -> [Canonical.Def]
215expandPattern :: Canonical.Def -> [Canonical.Def]
216expandPattern def@(Canonical.Definition pattern lexpr@(A r _) maybeType) =
216expandPattern def@(Canonical.Definition pattern lexpr@(A r _) maybeType) =
compiler/Type/PrettyPrint.hs+2−2
@@ -9,8 +9,8 @@ data ParensWhen = Fn | App | Never
9class PrettyType a where
9class PrettyType a where
10 pretty :: ParensWhen -> a -> Doc
10 pretty :: ParensWhen -> a -> Doc
11
11
12+commaSep :: [Doc] -> Doc
12commaSep docs = sep (punctuate comma docs)
13commaSep docs = sep (punctuate comma docs)
13
14
15+parensIf :: Bool -> Doc -> Doc
14parensIf bool doc = if bool then parens doc else doc
16parensIf bool doc = if bool then parens doc else doc
15−
16−reprime = Src.reprime
compiler/Type/State.hs+4−4
@@ -18,10 +18,10 @@ import Type.Type
18-- The rank of each variable is less than or equal to the pool's "maxRank"
18-- The rank of each variable is less than or equal to the pool's "maxRank"
19-- The young pool exists to make it possible to identify these vars in constant time.
19-- The young pool exists to make it possible to identify these vars in constant time.
20
20
21−data Pool = Pool {
21+data Pool = Pool
22− maxRank :: Int,
22+ { maxRank :: Int
23− inhabitants :: [Variable]
23+ , inhabitants :: [Variable]
24−} deriving Show
24+ } deriving Show
25
25
26emptyPool = Pool { maxRank = outermostRank, inhabitants = [] }
26emptyPool = Pool { maxRank = outermostRank, inhabitants = [] }
27
27