purescript-0.15.15: PureScript Programming Language Compiler

Safe Haskell | None
Language | Haskell2010

Language.PureScript.CST

Synopsis

- parseFromFile :: FilePath -> Text -> ([ParserWarning], Either (NonEmpty ParserError) Module)
- parseFromFiles :: MonadError MultipleErrors m => (k -> FilePath) -> [(k, Text)] -> m [(k, ([ParserWarning], Module))]
- parseModuleFromFile :: FilePath -> Text -> Either (NonEmpty ParserError) (PartialResult Module)
- parseModulesFromFiles :: MonadError MultipleErrors m => (k -> FilePath) -> [(k, Text)] -> m [(k, PartialResult Module)]
- unwrapParserError :: MonadError MultipleErrors m => FilePath -> Either (NonEmpty ParserError) a -> m a
- toMultipleErrors :: FilePath -> NonEmpty ParserError -> MultipleErrors
- toMultipleWarnings :: FilePath -> [ParserWarning] -> MultipleErrors
- toPositionedError :: FilePath -> ParserError -> ErrorMessage
- toPositionedWarning :: FilePath -> ParserWarning -> ErrorMessage
- pureResult :: a -> PartialResult a
- module Language.PureScript.CST.Convert
- module Language.PureScript.CST.Errors
- module Language.PureScript.CST.Lexer
- type LexResult = Either (LexState, ParserError) SourceToken
- type Parser = ParserM ParserError ParserState
- newtype ParserM e s a = Parser (forall r. s -> (s -> e -> r) -> (s -> a -> r) -> r)
- runParser :: ParserState -> Parser a -> (ParserState, Either (NonEmpty ParserError) a)
- data ParserState = ParserState {
  - parserBuff :: [LexResult]
  - parserErrors :: [ParserError]
  - parserWarnings :: [ParserWarning]
  }
- runTokenParser :: Parser a -> [LexResult] -> Either (NonEmpty ParserError) ([ParserWarning], a)
- module Language.PureScript.CST.Parser
- module Language.PureScript.CST.Print
- module Language.PureScript.CST.Types

# Documentation

parseFromFile :: FilePath -> Text -> ([ParserWarning], Either (NonEmpty ParserError) Module) #

parseFromFiles :: MonadError MultipleErrors m => (k -> FilePath) -> [(k, Text)] -> m [(k, ([ParserWarning], Module))] #

parseModuleFromFile :: FilePath -> Text -> Either (NonEmpty ParserError) (PartialResult Module) #

parseModulesFromFiles :: MonadError MultipleErrors m => (k -> FilePath) -> [(k, Text)] -> m [(k, PartialResult Module)] #

unwrapParserError :: MonadError MultipleErrors m => FilePath -> Either (NonEmpty ParserError) a -> m a #

toMultipleErrors :: FilePath -> NonEmpty ParserError -> MultipleErrors #

toMultipleWarnings :: FilePath -> [ParserWarning] -> MultipleErrors #

toPositionedError :: FilePath -> ParserError -> ErrorMessage #

toPositionedWarning :: FilePath -> ParserWarning -> ErrorMessage #

pureResult :: a -> PartialResult a #

module Language.PureScript.CST.Convert

module Language.PureScript.CST.Errors

module Language.PureScript.CST.Lexer

type LexResult = Either (LexState, ParserError) SourceToken #

type Parser = ParserM ParserError ParserState #

newtype ParserM e s a #

A bare bones, CPS'ed `StateT s (Except e) a`.

Constructors

Parser (forall r. s -> (s -> e -> r) -> (s -> a -> r) -> r) |

#### Instances

Instances details

Applicative (ParserM e s) # |
Instance details Defined in Language.PureScript.CST.Monad Methods pure :: a -> ParserM e s a # (<*>) :: ParserM e s (a -> b) -> ParserM e s a -> ParserM e s b # liftA2 :: (a -> b -> c) -> ParserM e s a -> ParserM e s b -> ParserM e s c # (*>) :: ParserM e s a -> ParserM e s b -> ParserM e s b # (<*) :: ParserM e s a -> ParserM e s b -> ParserM e s a #
Functor (ParserM e s) # |
Instance details Defined in Language.PureScript.CST.Monad Methods fmap :: (a -> b) -> ParserM e s a -> ParserM e s b # (<$) :: a -> ParserM e s b -> ParserM e s a #
Monad (ParserM e s) # |
Instance details Defined in Language.PureScript.CST.Monad Methods (>>=) :: ParserM e s a -> (a -> ParserM e s b) -> ParserM e s b # (>>) :: ParserM e s a -> ParserM e s b -> ParserM e s b # return :: a -> ParserM e s a #

runParser :: ParserState -> Parser a -> (ParserState, Either (NonEmpty ParserError) a) #

data ParserState #

Constructors

ParserState |

Fields

- parserBuff :: [LexResult]
- parserErrors :: [ParserError]
- parserWarnings :: [ParserWarning]

#### Instances

Instances details

Show ParserState # |
Instance details Defined in Language.PureScript.CST.Monad Methods showsPrec :: Int -> ParserState -> ShowS # show :: ParserState -> String # showList :: [ParserState] -> ShowS #

runTokenParser :: Parser a -> [LexResult] -> Either (NonEmpty ParserError) ([ParserWarning], a) #

module Language.PureScript.CST.Parser

module Language.PureScript.CST.Print

module Language.PureScript.CST.Types