1-----------------------------------------------------------------------------
3-- Module : PureScript.Parser.Declarations
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
13-----------------------------------------------------------------------------
15module PureScript.Parser.Declarations (
20import PureScript.Values
21import PureScript.Types
22import PureScript.Parser.Common
23import Control.Applicative
24import qualified Text.Parsec as P
25import Control.Arrow (Arrow(..))
26import PureScript.Declarations
27import PureScript.Parser.Values
28import PureScript.Parser.Types
30parseDataDeclaration :: P.Parsec String () Declaration
31parseDataDeclaration = do
34 tyArgs <- many identifier
36 ctors <- P.sepBy1 ((,) <$> properName <*> parseType) (lexeme $ P.char '|')
37 return $ DataDeclaration $ DataConstructors name tyArgs ctors
39parseValueDeclaration :: P.Parsec String () Declaration
40parseValueDeclaration = ValueDeclaration <$> identifier <*> (lexeme (P.char '=') *> parseValue)
42parseDeclaration :: P.Parsec String () Declaration
43parseDeclaration = parseDataDeclaration
44 P.<|> parseValueDeclaration
46parseDeclarations :: P.Parsec String () [Declaration]
47parseDeclarations = whiteSpace *> P.sepEndBy parseDeclaration semi <* P.eof
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list