git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Only allow type declarations and value declarations in let bindings
c34d947Phil Freeman
src/Language/PureScript/Parser/Declarations.hs+9−2
@@ -166,7 +166,14 @@ parseDeclaration = P.choice
166 , parseFixityDeclaration
166 , parseFixityDeclaration
167 , parseImportDeclaration
167 , parseImportDeclaration
168 , parseTypeClassDeclaration
168 , parseTypeClassDeclaration
169− , parseTypeInstanceDeclaration ] P.<?> "declaration"
169+ , parseTypeInstanceDeclaration
170+ ] P.<?> "declaration"
171+
172+parseLocalDeclaration :: P.Parsec String ParseState Declaration
173+parseLocalDeclaration = P.choice
174+ [ parseTypeDeclaration
175+ , parseValueDeclaration
176+ ] P.<?> "local declaration"
170
177
171-- |
178-- |
172-- Parse a module header and a collection of declarations
179-- Parse a module header and a collection of declarations
@@ -245,7 +252,7 @@ parseLet :: P.Parsec String ParseState Value
245parseLet = do
252parseLet = do
246 C.reserved "let"
253 C.reserved "let"
247 C.indented
254 C.indented
248− ds <- C.mark $ P.many1 (C.same *> parseDeclaration)
255+ ds <- C.mark $ P.many1 (C.same *> parseLocalDeclaration)
249 C.indented
256 C.indented
250 C.reserved "in"
257 C.reserved "in"
251 result <- parseValue
258 result <- parseValue