Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Utility functions and definitions used in the Happy-generated
parser. They are defined here because the .y
file is opaque to
linters and other tools. In particular, we cannot enable warnings
for that file, because Happy-generated code is very dirty by GHC's
standards.
Synopsis
- type ParserMonad = ExceptT String (StateT ParserEnv (StateT ([L Token], Pos) ReadLineMonad))
- data ParserEnv
- data ReadLineMonad a
- = Value a
- | GetLine (Maybe Text -> ReadLineMonad a)
- parseInMonad :: ParserMonad a -> FilePath -> Text -> ReadLineMonad (Either ParseError a)
- parse :: ParserMonad a -> FilePath -> Text -> Either ParseError a
- getLinesFromM :: Monad m => m Text -> ReadLineMonad a -> m a
- lexer :: (L Token -> ParserMonad a) -> ParserMonad a
- mustBeEmpty :: SrcLoc -> ValueType -> ParserMonad ()
- arrayFromList :: [a] -> Array Int a
- combArrayElements :: Value -> [Value] -> Either String Value
- binOp :: UncheckedExp -> L Token -> UncheckedExp -> UncheckedExp
- binOpName :: L Token -> (QualName Name, SrcLoc)
- mustBe :: L Token -> String -> ParserMonad ()
- floatNegate :: FloatValue -> FloatValue
- intNegate :: IntValue -> IntValue
- primNegate :: PrimValue -> PrimValue
- primTypeFromName :: SrcLoc -> Name -> ParserMonad PrimType
- applyExp :: [UncheckedExp] -> ParserMonad UncheckedExp
- patternExp :: UncheckedPat -> ParserMonad UncheckedExp
- addDocSpec :: DocComment -> SpecBase NoInfo Name -> SpecBase NoInfo Name
- addAttrSpec :: AttrInfo Name -> UncheckedSpec -> UncheckedSpec
- addDoc :: DocComment -> UncheckedDec -> UncheckedDec
- addAttr :: AttrInfo Name -> UncheckedDec -> UncheckedDec
- twoDotsRange :: SrcLoc -> ParserMonad a
- newtype ParseError = ParseError String
- emptyArrayError :: SrcLoc -> ParserMonad a
- parseError :: (L Token, [String]) -> ParserMonad a
- parseErrorAt :: SrcLoc -> Maybe String -> ParserMonad a
- data L a
- data Token
Documentation
type ParserMonad = ExceptT String (StateT ParserEnv (StateT ([L Token], Pos) ReadLineMonad)) Source #
data ReadLineMonad a Source #
Value a | |
GetLine (Maybe Text -> ReadLineMonad a) |
Instances
Monad ReadLineMonad Source # | |
Defined in Language.Futhark.Parser.Monad (>>=) :: ReadLineMonad a -> (a -> ReadLineMonad b) -> ReadLineMonad b # (>>) :: ReadLineMonad a -> ReadLineMonad b -> ReadLineMonad b # return :: a -> ReadLineMonad a # | |
Functor ReadLineMonad Source # | |
Defined in Language.Futhark.Parser.Monad fmap :: (a -> b) -> ReadLineMonad a -> ReadLineMonad b # (<$) :: a -> ReadLineMonad b -> ReadLineMonad a # | |
Applicative ReadLineMonad Source # | |
Defined in Language.Futhark.Parser.Monad pure :: a -> ReadLineMonad a # (<*>) :: ReadLineMonad (a -> b) -> ReadLineMonad a -> ReadLineMonad b # liftA2 :: (a -> b -> c) -> ReadLineMonad a -> ReadLineMonad b -> ReadLineMonad c # (*>) :: ReadLineMonad a -> ReadLineMonad b -> ReadLineMonad b # (<*) :: ReadLineMonad a -> ReadLineMonad b -> ReadLineMonad a # |
parseInMonad :: ParserMonad a -> FilePath -> Text -> ReadLineMonad (Either ParseError a) Source #
parse :: ParserMonad a -> FilePath -> Text -> Either ParseError a Source #
getLinesFromM :: Monad m => m Text -> ReadLineMonad a -> m a Source #
lexer :: (L Token -> ParserMonad a) -> ParserMonad a Source #
mustBeEmpty :: SrcLoc -> ValueType -> ParserMonad () Source #
arrayFromList :: [a] -> Array Int a Source #
binOp :: UncheckedExp -> L Token -> UncheckedExp -> UncheckedExp Source #
floatNegate :: FloatValue -> FloatValue Source #
primNegate :: PrimValue -> PrimValue Source #
primTypeFromName :: SrcLoc -> Name -> ParserMonad PrimType Source #
applyExp :: [UncheckedExp] -> ParserMonad UncheckedExp Source #
addDocSpec :: DocComment -> SpecBase NoInfo Name -> SpecBase NoInfo Name Source #
addAttrSpec :: AttrInfo Name -> UncheckedSpec -> UncheckedSpec Source #
addDoc :: DocComment -> UncheckedDec -> UncheckedDec Source #
addAttr :: AttrInfo Name -> UncheckedDec -> UncheckedDec Source #
twoDotsRange :: SrcLoc -> ParserMonad a Source #
newtype ParseError Source #
A parse error. Use show
to get a human-readable description.
Instances
Show ParseError Source # | |
Defined in Language.Futhark.Parser.Monad showsPrec :: Int -> ParseError -> ShowS # show :: ParseError -> String # showList :: [ParseError] -> ShowS # |
emptyArrayError :: SrcLoc -> ParserMonad a Source #
parseError :: (L Token, [String]) -> ParserMonad a Source #
parseErrorAt :: SrcLoc -> Maybe String -> ParserMonad a Source #
Reexports
A value tagged with a source location.