on master help sign in
Improve some parser code by adding type annotations, removing unused dependencies, and using prefixed imports
commitfcbd7fd73b96494707f364716b6c92b192b5b99c authorEvan Czaplicki <info@elm-lang.org> dateMon 23 Dec 2013, 23:26 (13 years ago) parent0486c90
3 files changed+5−5
compiler/Parse/Expression.hs+2−2 compiler/Parse/Helpers.hs+1−1 compiler/Parse/Parse.hs+2−2
compiler/Parse/Expression.hs+2−2
@@ -1,4 +1,4 @@
1−module Parse.Expression (def,term,typeAnnotation) where
1+module Parse.Expression (def,term,typeAnnotation,expr) where
22
33import Control.Arrow ((***))
44import Control.Applicative ((<$>), (<*>))
@@ -16,7 +16,6 @@ import SourceSyntax.Location as Location
1616import SourceSyntax.Pattern hiding (tuple,list)
1717import qualified SourceSyntax.Literal as Literal
1818import SourceSyntax.Expression
19−import SourceSyntax.Declaration (Declaration(Definition))
2019
2120
2221-------- Basic Terms --------
@@ -191,6 +190,7 @@ caseExpr = do
191190 with = brackets (semiSep1 (case_ <?> "cases { x -> ... }"))
192191 without = block (do c <- case_ ; whitespace ; return c)
193192
193+expr :: IParser (LExpr t v)
194194expr = addLocation (choice [ ifExpr, letExpr, caseExpr ])
195195 <|> lambdaExpr
196196 <|> binaryExpr
compiler/Parse/Helpers.hs+1−1
@@ -22,7 +22,7 @@ reserveds = [ "if", "then", "else"
2222 , "module", "where"
2323 , "import", "as", "hiding", "open"
2424 , "export", "foreign"
25− , "deriving" ]
25+ , "deriving", "port" ]
2626
2727jsReserveds :: Set.Set String
2828jsReserveds = Set.fromList
compiler/Parse/Parse.hs+2−2
@@ -9,7 +9,7 @@ import Text.Parsec hiding (newline,spaces)
99import qualified Text.PrettyPrint as P
1010
1111import qualified SourceSyntax.Module as S
12−import SourceSyntax.Declaration (Declaration(Fixity))
12+import qualified SourceSyntax.Declaration as D
1313import Parse.Helpers
1414import Parse.Binop (OpTable)
1515import Parse.Expression
@@ -61,7 +61,7 @@ setupParserWithTable table p source =
6161
6262parseFixities = do
6363 decls <- onFreshLines (:) [] infixDecl
64− return $ Map.fromList [ (op,(lvl,assoc)) | Fixity assoc lvl op <- decls ]
64+ return $ Map.fromList [ (op,(lvl,assoc)) | D.Fixity assoc lvl op <- decls ]
6565
6666setupParser :: IParser a -> String -> Either [P.Doc] a
6767setupParser p source =