on master help sign in
remove reprime, many minor cosmetic changes
commitd41a656269eaab8bdf40aee6cc8792634bcc9880 authorEvan Czaplicki <info@elm-lang.org> dateWed 30 Apr 2014, 19:42 (13 years ago) parent20086fa
6 files changed+15−12
compiler/AST/Module.hs+4 compiler/AST/PrettyPrint.hs+1−5 compiler/AST/Variable.hs+3 compiler/Type/Constrain/Expression.hs+1−1 compiler/Type/PrettyPrint.hs+2−2 compiler/Type/State.hs+4−4
compiler/AST/Module.hs+4
@@ -24,6 +24,10 @@ data Module exs body = Module
2424 , body :: body
2525 }
2626
27+getName :: Module exs body -> String
28+getName modul =
29+ List.intercalate "." (names modul)
30+
2731data CanonicalBody = CanonicalBody
2832 { program :: Canonical.Expr
2933 , types :: Types
compiler/AST/PrettyPrint.hs+1−5
@@ -24,11 +24,7 @@ parensIf bool doc = if bool then parens doc else doc
2424
2525variable :: String -> Doc
2626variable x =
27− if Help.isOp x then parens (text x)
28− else text (reprime x)
29−
30−reprime :: String -> String
31−reprime = map (\c -> if c == '$' then '\'' else c)
27+ if Help.isOp x then parens (text x) else text x
3228
3329eightyCharLines :: Int -> String -> String
3430eightyCharLines indent message = answer
compiler/AST/Variable.hs+3
@@ -23,6 +23,9 @@ data Canonical = Canonical
2323local :: String -> Canonical
2424local x = Canonical Local x
2525
26+builtin :: String -> Canonical
27+builtin x = Canonical BuiltIn x
28+
2629class ToString a where
2730 toString :: a -> String
2831
compiler/Type/Constrain/Expression.hs+1−1
@@ -210,7 +210,7 @@ constrainDef env info (Canonical.Definition pattern expr maybeTipe) =
210210 , c /\ c2
211211 , c1 )
212212
213− _ -> error (show pattern)
213+ _ -> error ("problem in constrainDef with " ++ show pattern)
214214
215215expandPattern :: Canonical.Def -> [Canonical.Def]
216216expandPattern def@(Canonical.Definition pattern lexpr@(A r _) maybeType) =
compiler/Type/PrettyPrint.hs+2−2
@@ -9,8 +9,8 @@ data ParensWhen = Fn | App | Never
99class PrettyType a where
1010 pretty :: ParensWhen -> a -> Doc
1111
12+commaSep :: [Doc] -> Doc
1213commaSep docs = sep (punctuate comma docs)
1314
15+parensIf :: Bool -> Doc -> Doc
1416parensIf 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
1818-- The rank of each variable is less than or equal to the pool's "maxRank"
1919-- The young pool exists to make it possible to identify these vars in constant time.
2020
21−data Pool = Pool {
22− maxRank :: Int,
23− inhabitants :: [Variable]
24−} deriving Show
21+data Pool = Pool
22+ { maxRank :: Int
23+ , inhabitants :: [Variable]
24+ } deriving Show
2525
2626emptyPool = Pool { maxRank = outermostRank, inhabitants = [] }
2727