-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parser combinators statically optimized and staged via typed meta-programming -- -- This is a work-in-progress experimental library to generate parsers, -- leveraging Tagless-Final interpreters and Typed Template Haskell -- staging. . This is an alternative but less powerful/reviewed -- implementation of ParsleyHaskell. See the paper by Jamie -- Willis, Nicolas Wu, and Matthew Pickering, admirably well presented at -- ICFP-2020: Staged Selective Parser Combinators. @package symantic-parser @version 0.2.0.20210703 module Parsers.Brainfuck.Types data Instruction Forward :: Instruction Backward :: Instruction Increment :: Instruction Decrement :: Instruction Input :: Instruction Output :: Instruction Loop :: [Instruction] -> Instruction instance Control.DeepSeq.NFData Parsers.Brainfuck.Types.Instruction instance GHC.Generics.Generic Parsers.Brainfuck.Types.Instruction instance Language.Haskell.TH.Syntax.Lift Parsers.Brainfuck.Types.Instruction instance GHC.Classes.Ord Parsers.Brainfuck.Types.Instruction instance GHC.Classes.Eq Parsers.Brainfuck.Types.Instruction instance GHC.Show.Show Parsers.Brainfuck.Types.Instruction module Parsers.Nandlang type Parser a = Parser Text a nandIdentStart :: Char -> Bool nandIdentLetter :: Char -> Bool nandUnreservedName :: String -> Bool nandStringLetter :: Char -> Bool grammar :: forall repr. Grammarable Char repr => repr () module Parsers.Playground boom :: CombApplicable repr => repr () module Parsers.Utils -- | Convenient helper to write generic grammars consuming either -- Word8 or Char. class CoerceEnum a b coerceEnum :: CoerceEnum a b => a -> b coerceEnum :: (CoerceEnum a b, Enum a) => Enum b => a -> b -- | Conversion between Word8 and Char. Should compile to a -- no-op. w2c :: Word8 -> Char instance Parsers.Utils.CoerceEnum GHC.Word.Word8 GHC.Types.Char instance Parsers.Utils.CoerceEnum GHC.Types.Char GHC.Word.Word8 instance Parsers.Utils.CoerceEnum GHC.Types.Char GHC.Types.Char module Parsers.Brainfuck.SymanticParser.Grammar -- | Use with $$(runParser Text grammar)@, but in another Haskell -- module to avoid GHC stage restriction on such top-level splice. grammar :: forall tok repr. CoerceEnum Char tok => CoerceEnum tok Char => Grammarable tok repr => repr [Instruction] module Parsers.Brainfuck.SymanticParser parserByteString :: ByteString -> Either (ParsingError ByteString) [Instruction] parserByteStringLazy :: ByteString -> Either (ParsingError ByteString) [Instruction] parserString :: String -> Either (ParsingError String) [Instruction] parserText :: Text -> Either (ParsingError Text) [Instruction] -- | Use with $$(runParser Text grammar)@, but in another Haskell -- module to avoid GHC stage restriction on such top-level splice. grammar :: forall tok repr. CoerceEnum Char tok => CoerceEnum tok Char => Grammarable tok repr => repr [Instruction] module Parsers.Utils.Attoparsec class Chunk inp => Inputable inp where { type family Token inp; } null :: Inputable inp => inp -> Bool empty :: Inputable inp => inp uncons :: Inputable inp => inp -> Maybe (Token inp, inp) satisfy :: Inputable inp => (Token inp -> Bool) -> Parser inp (Token inp) char :: Inputable inp => Char -> Parser inp Char notInClass :: Inputable inp => String -> Token inp -> Bool between :: Applicative f => f a -> f b -> f c -> f c match :: (Monad m, Eq a) => [a] -> m a -> (a -> m b) -> m b -> m b skipSome :: Alternative p => p a -> p () some :: Alternative p => p a -> p [a] maybeP :: Alternative p => p a -> p (Maybe a) fromMaybeP :: Monad m => m (Maybe a) -> m a -> m a (<+>) :: Alternative p => p a -> p b -> p (Either a b) (<:>) :: Applicative p => p a -> p [a] -> p [a] (<~>) :: Applicative p => p a -> p b -> p (a, b) pfoldl1 :: Alternative p => (b -> a -> b) -> b -> p a -> p b (>?>) :: MonadPlus m => m a -> (a -> Bool) -> m a chainPre :: Alternative p => p (a -> a) -> p a -> p a chainPost :: Alternative p => p a -> p (a -> a) -> p a chainl1 :: Alternative p => p a -> p (a -> a -> a) -> p a chainr1 :: Alternative p => p a -> p (a -> a -> a) -> p a data Level p s a InfixL :: [p (a -> a -> a)] -> Level p s a InfixR :: [p (a -> a -> a)] -> Level p s a Prefix :: [p (a -> a)] -> Level p s a Postfix :: [p (a -> a)] -> Level p s a precedence :: Alternative p => [Level p s a] -> p a -> p a instance Parsers.Utils.Attoparsec.Inputable Data.Text.Internal.Text instance Parsers.Utils.Attoparsec.Inputable Data.ByteString.Internal.ByteString module Parsers.Brainfuck.Attoparsec parser :: forall inp. Inputable inp => Parser inp [Instruction] module Parsers.Utils.Attoparsec.Text token :: Text -> Parser Text oneOf :: [Char] -> Parser Char noneOf :: [Char] -> Parser Char module Parsers.Utils.Handrolled class Inputable inp where { type family Token inp; } null :: Inputable inp => inp -> Bool empty :: Inputable inp => inp uncons :: Inputable inp => inp -> Maybe (Token inp, inp) instance Parsers.Utils.Handrolled.Inputable Data.Text.Internal.Text instance Parsers.Utils.Handrolled.Inputable Data.ByteString.Internal.ByteString module Parsers.Brainfuck.Handrolled parser :: forall inp. CoerceEnum (Token inp) Char => Inputable inp => inp -> Maybe [Instruction]