Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Applicable repr where
- (<$>) :: Haskell (a -> b) -> repr a -> repr b
- (<&>) :: repr a -> Haskell (a -> b) -> repr b
- (<$) :: Haskell a -> repr b -> repr a
- ($>) :: repr a -> Haskell b -> repr b
- pure :: Haskell a -> repr a
- (<*>) :: repr (a -> b) -> repr a -> repr b
- liftA2 :: Haskell (a -> b -> c) -> repr a -> repr b -> repr c
- (<*) :: repr a -> repr b -> repr a
- (*>) :: repr a -> repr b -> repr b
- (<**>) :: repr a -> repr (a -> b) -> repr b
- class Alternable repr where
- (<|>) :: repr a -> repr a -> repr a
- empty :: repr a
- try :: repr a -> repr a
- (<+>) :: Applicable repr => Alternable repr => repr a -> repr b -> repr (Either a b)
- optionally :: Applicable repr => Alternable repr => repr a -> Haskell b -> repr b
- optional :: Applicable repr => Alternable repr => repr a -> repr ()
- option :: Applicable repr => Alternable repr => Haskell a -> repr a -> repr a
- choice :: Alternable repr => [repr a] -> repr a
- maybeP :: Applicable repr => Alternable repr => repr a -> repr (Maybe a)
- manyTill :: Applicable repr => Alternable repr => repr a -> repr b -> repr [a]
- class Selectable repr where
- class Matchable repr where
- class Foldable repr where
- class Satisfiable repr tok where
- data ErrorItem tok
- class Lookable repr where
- (<:>) :: Applicable repr => repr a -> repr [a] -> repr [a]
- sequence :: Applicable repr => [repr a] -> repr [a]
- traverse :: Applicable repr => (a -> repr b) -> [a] -> repr [b]
- repeat :: Applicable repr => Int -> repr a -> repr [a]
- between :: Applicable repr => repr o -> repr c -> repr a -> repr a
- string :: Applicable repr => Satisfiable repr Char => [Char] -> repr [Char]
- noneOf :: Lift tok => Eq tok => Satisfiable repr tok => [tok] -> repr tok
- ofChars :: Lift tok => Eq tok => [tok] -> CodeQ tok -> CodeQ Bool
- more :: Applicable repr => Satisfiable repr Char => Lookable repr => repr ()
- char :: Applicable repr => Satisfiable repr Char => Char -> repr Char
- anyChar :: Satisfiable repr Char => repr Char
- token :: Lift tok => Eq tok => Applicable repr => Satisfiable repr tok => tok -> repr tok
- tokens :: Lift tok => Eq tok => Applicable repr => Alternable repr => Satisfiable repr tok => [tok] -> repr [tok]
- item :: Satisfiable repr tok => repr tok
- void :: Applicable repr => repr a -> repr ()
- unit :: Applicable repr => repr ()
- pfoldr :: Applicable repr => Foldable repr => Haskell (a -> b -> b) -> Haskell b -> repr a -> repr b
- pfoldr1 :: Applicable repr => Foldable repr => Haskell (a -> b -> b) -> Haskell b -> repr a -> repr b
- pfoldl :: Applicable repr => Foldable repr => Haskell (b -> a -> b) -> Haskell b -> repr a -> repr b
- pfoldl1 :: Applicable repr => Foldable repr => Haskell (b -> a -> b) -> Haskell b -> repr a -> repr b
- chainl1' :: Applicable repr => Foldable repr => Haskell (a -> b) -> repr a -> repr (b -> a -> b) -> repr b
- chainl1 :: Applicable repr => Foldable repr => repr a -> repr (a -> a -> a) -> repr a
- chainl :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr (a -> a -> a) -> Haskell a -> repr a
- many :: Applicable repr => Foldable repr => repr a -> repr [a]
- manyN :: Applicable repr => Foldable repr => Int -> repr a -> repr [a]
- some :: Applicable repr => Foldable repr => repr a -> repr [a]
- skipMany :: Applicable repr => Foldable repr => repr a -> repr ()
- skipManyN :: Applicable repr => Foldable repr => Int -> repr a -> repr ()
- skipSome :: Applicable repr => Foldable repr => repr a -> repr ()
- sepBy :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- sepBy1 :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- endBy :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- endBy1 :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- sepEndBy :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- sepEndBy1 :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
Class Applicable
class Applicable repr where Source #
This is like the usual Functor
and Applicative
type classes
from the base
package, but using (
instead of just Haskell
a)(a)
to be able to use and pattern match on some usual terms of type (a)
(like
id
) and thus apply some optimizations.
(repr)
, for "representation", is the usual tagless-final abstraction
over the many semantics that this syntax (formed by the methods
of type class like this one) will be interpreted.
Nothing
(<$>) :: Haskell (a -> b) -> repr a -> repr b infixl 4 Source #
(a2b
parses like <$>
ra)(ra)
but maps its returned value with (a2b)
.
(<&>) :: repr a -> Haskell (a -> b) -> repr b infixl 4 Source #
(<$) :: Haskell a -> repr b -> repr a infixl 4 Source #
(a
parses like <$
rb)(rb)
but discards its returned value by replacing it with (a)
.
($>) :: repr a -> Haskell b -> repr b infixl 4 Source #
(ra
parses like $>
b)(ra)
but discards its returned value by replacing it with (b)
.
pure :: Haskell a -> repr a Source #
(
parses the empty string, always succeeding in returning pure
a)(a)
.
pure :: Liftable repr => Applicable (Output repr) => Haskell a -> repr a Source #
(
parses the empty string, always succeeding in returning pure
a)(a)
.
(<*>) :: repr (a -> b) -> repr a -> repr b infixl 4 Source #
(ra2b
parses sequentially <*>
ra)(ra2b)
and then (ra)
,
and returns the application of the function returned by (ra2b)
to the value returned by (ra)
.
(<*>) :: Liftable2 repr => Applicable (Output repr) => repr (a -> b) -> repr a -> repr b infixl 4 Source #
(ra2b
parses sequentially <*>
ra)(ra2b)
and then (ra)
,
and returns the application of the function returned by (ra2b)
to the value returned by (ra)
.
liftA2 :: Haskell (a -> b -> c) -> repr a -> repr b -> repr c Source #
(
parses sequentially liftA2
a2b2c ra rb)(ra)
and then (rb)
,
and returns the application of (a2b2c)
to the values returned by those parsers.
(<*) :: repr a -> repr b -> repr a infixl 4 Source #
(ra
parses sequentially <*
rb)(ra)
and then (rb)
,
and returns like (ra)
, discarding the return value of (rb)
.
(*>) :: repr a -> repr b -> repr b infixl 4 Source #
(ra
parses sequentially *>
rb)(ra)
and then (rb)
,
and returns like (rb)
, discarding the return value of (ra)
.
(<**>) :: repr a -> repr (a -> b) -> repr b infixl 4 Source #
Instances
Class Alternable
class Alternable repr where Source #
Nothing
(<|>) :: repr a -> repr a -> repr a infixl 3 Source #
(rl
parses <|>
rr)(rl)
and return its return value or,
if it fails, parses (rr)
from where (rl)
has left the input stream,
and returns its return value.
(empty)
parses nothing, always failing to return a value.
try :: repr a -> repr a Source #
(
records the input stream position,
then parses like try
ra)(ra)
and either returns its value it it succeeds or fails
if it fails but with a reset of the input stream to the recorded position.
Generally used on the first alternative: (
.try
rl <|>
rr)
(<|>) :: Liftable2 repr => Alternable (Output repr) => repr a -> repr a -> repr a infixl 3 Source #
(rl
parses <|>
rr)(rl)
and return its return value or,
if it fails, parses (rr)
from where (rl)
has left the input stream,
and returns its return value.
empty :: Liftable repr => Alternable (Output repr) => repr a Source #
(empty)
parses nothing, always failing to return a value.
try :: Liftable1 repr => Alternable (Output repr) => repr a -> repr a Source #
(
records the input stream position,
then parses like try
ra)(ra)
and either returns its value it it succeeds or fails
if it fails but with a reset of the input stream to the recorded position.
Generally used on the first alternative: (
.try
rl <|>
rr)
(<+>) :: Applicable repr => Alternable repr => repr a -> repr b -> repr (Either a b) infixl 3 Source #
Instances
optionally :: Applicable repr => Alternable repr => repr a -> Haskell b -> repr b Source #
optional :: Applicable repr => Alternable repr => repr a -> repr () Source #
option :: Applicable repr => Alternable repr => Haskell a -> repr a -> repr a Source #
choice :: Alternable repr => [repr a] -> repr a Source #
maybeP :: Applicable repr => Alternable repr => repr a -> repr (Maybe a) Source #
manyTill :: Applicable repr => Alternable repr => repr a -> repr b -> repr [a] Source #
Class Selectable
class Selectable repr where Source #
Nothing
branch :: repr (Either a b) -> repr (a -> c) -> repr (b -> c) -> repr c Source #
branch :: Liftable3 repr => Selectable (Output repr) => repr (Either a b) -> repr (a -> c) -> repr (b -> c) -> repr c Source #
Instances
Selectable WriteComb Source # | |
Selectable DumpComb Source # | |
Selectable (Comb repr) Source # | |
Selectable (Machine inp) Source # | |
Selectable repr => Selectable (CleanDefs letName repr) Source # | |
(Letable letName repr, MakeLetName letName, Eq letName, Hashable letName, Selectable repr) => Selectable (ObserveSharing letName repr) Source # | |
Defined in Symantic.Parser.Grammar.ObserveSharing branch :: ObserveSharing letName repr (Either a b) -> ObserveSharing letName repr (a -> c) -> ObserveSharing letName repr (b -> c) -> ObserveSharing letName repr c Source # | |
Selectable (OptimizeComb letName repr) Source # | |
Defined in Symantic.Parser.Grammar.Optimize branch :: OptimizeComb letName repr (Either a b) -> OptimizeComb letName repr (a -> c) -> OptimizeComb letName repr (b -> c) -> OptimizeComb letName repr c Source # |
Class Matchable
class Matchable repr where Source #
Nothing
conditional :: Eq a => [Haskell (a -> Bool)] -> [repr b] -> repr a -> repr b -> repr b Source #
conditional :: Unliftable repr => Liftable2 repr => Matchable (Output repr) => Eq a => [Haskell (a -> Bool)] -> [repr b] -> repr a -> repr b -> repr b Source #
match :: Eq a => [Haskell a] -> repr a -> (Haskell a -> repr b) -> repr b -> repr b Source #
Instances
Matchable WriteComb Source # | |
Matchable DumpComb Source # | |
Matchable (Comb repr) Source # | |
Matchable (Machine inp) Source # | |
Matchable repr => Matchable (CleanDefs letName repr) Source # | |
Defined in Symantic.Parser.Grammar.ObserveSharing conditional :: Eq a => [Haskell (a -> Bool)] -> [CleanDefs letName repr b] -> CleanDefs letName repr a -> CleanDefs letName repr b -> CleanDefs letName repr b Source # match :: Eq a => [Haskell a] -> CleanDefs letName repr a -> (Haskell a -> CleanDefs letName repr b) -> CleanDefs letName repr b -> CleanDefs letName repr b Source # | |
(Letable letName repr, MakeLetName letName, Eq letName, Hashable letName, Matchable repr) => Matchable (ObserveSharing letName repr) Source # | |
Defined in Symantic.Parser.Grammar.ObserveSharing conditional :: Eq a => [Haskell (a -> Bool)] -> [ObserveSharing letName repr b] -> ObserveSharing letName repr a -> ObserveSharing letName repr b -> ObserveSharing letName repr b Source # match :: Eq a => [Haskell a] -> ObserveSharing letName repr a -> (Haskell a -> ObserveSharing letName repr b) -> ObserveSharing letName repr b -> ObserveSharing letName repr b Source # | |
Matchable (OptimizeComb letName repr) Source # | |
Defined in Symantic.Parser.Grammar.Optimize conditional :: Eq a => [Haskell (a -> Bool)] -> [OptimizeComb letName repr b] -> OptimizeComb letName repr a -> OptimizeComb letName repr b -> OptimizeComb letName repr b Source # match :: Eq a => [Haskell a] -> OptimizeComb letName repr a -> (Haskell a -> OptimizeComb letName repr b) -> OptimizeComb letName repr b -> OptimizeComb letName repr b Source # |
Class Foldable
class Foldable repr where Source #
Nothing
chainPre :: repr (a -> a) -> repr a -> repr a Source #
chainPost :: repr a -> repr (a -> a) -> repr a Source #
chainPre :: Applicable repr => Alternable repr => repr (a -> a) -> repr a -> repr a Source #
chainPost :: Applicable repr => Alternable repr => repr a -> repr (a -> a) -> repr a Source #
Instances
Class Satisfiable
class Satisfiable repr tok where Source #
Nothing
satisfy :: [ErrorItem tok] -> Haskell (tok -> Bool) -> repr tok Source #
satisfy :: Liftable repr => Satisfiable (Output repr) tok => [ErrorItem tok] -> Haskell (tok -> Bool) -> repr tok Source #
Instances
Satisfiable WriteComb tok Source # | |
Satisfiable DumpComb tok Source # | |
Satisfiable repr tok => Satisfiable (Comb repr) tok Source # | |
tok ~ InputToken inp => Satisfiable (Machine inp) tok Source # | |
Satisfiable repr tok => Satisfiable (CleanDefs letName repr) tok Source # | |
(Letable letName repr, MakeLetName letName, Eq letName, Hashable letName, Satisfiable repr tok) => Satisfiable (ObserveSharing letName repr) tok Source # | |
Defined in Symantic.Parser.Grammar.ObserveSharing | |
Satisfiable repr tok => Satisfiable (OptimizeComb letName repr) tok Source # | |
Defined in Symantic.Parser.Grammar.Optimize |
Type ErrorItem
Instances
Lift tok => Lift (ErrorItem tok :: Type) Source # | |
Eq tok => Eq (ErrorItem tok) Source # | |
Ord tok => Ord (ErrorItem tok) Source # | |
Defined in Symantic.Parser.Grammar.Combinators compare :: ErrorItem tok -> ErrorItem tok -> Ordering # (<) :: ErrorItem tok -> ErrorItem tok -> Bool # (<=) :: ErrorItem tok -> ErrorItem tok -> Bool # (>) :: ErrorItem tok -> ErrorItem tok -> Bool # (>=) :: ErrorItem tok -> ErrorItem tok -> Bool # | |
Show tok => Show (ErrorItem tok) Source # | |
Class Lookable
class Lookable repr where Source #
Nothing
look :: repr a -> repr a Source #
negLook :: repr a -> repr () Source #
look :: Liftable1 repr => Lookable (Output repr) => repr a -> repr a Source #
negLook :: Liftable1 repr => Lookable (Output repr) => repr a -> repr () Source #
eof :: Liftable repr => Lookable (Output repr) => repr () Source #
Instances
Lookable WriteComb Source # | |
Lookable DumpComb Source # | |
Lookable (Comb repr) Source # | |
(Ord (InputToken inp), Cursorable (Cursor inp)) => Lookable (Machine inp) Source # | |
Lookable repr => Lookable (CleanDefs letName repr) Source # | |
(Letable letName repr, MakeLetName letName, Eq letName, Hashable letName, Lookable repr) => Lookable (ObserveSharing letName repr) Source # | |
Defined in Symantic.Parser.Grammar.ObserveSharing look :: ObserveSharing letName repr a -> ObserveSharing letName repr a Source # negLook :: ObserveSharing letName repr a -> ObserveSharing letName repr () Source # eof :: ObserveSharing letName repr () Source # | |
Lookable (OptimizeComb letName repr) Source # | |
Defined in Symantic.Parser.Grammar.Optimize look :: OptimizeComb letName repr a -> OptimizeComb letName repr a Source # negLook :: OptimizeComb letName repr a -> OptimizeComb letName repr () Source # eof :: OptimizeComb letName repr () Source # |
(<:>) :: Applicable repr => repr a -> repr [a] -> repr [a] infixl 4 Source #
sequence :: Applicable repr => [repr a] -> repr [a] Source #
traverse :: Applicable repr => (a -> repr b) -> [a] -> repr [b] Source #
repeat :: Applicable repr => Int -> repr a -> repr [a] Source #
between :: Applicable repr => repr o -> repr c -> repr a -> repr a Source #
string :: Applicable repr => Satisfiable repr Char => [Char] -> repr [Char] Source #
more :: Applicable repr => Satisfiable repr Char => Lookable repr => repr () Source #
char :: Applicable repr => Satisfiable repr Char => Char -> repr Char Source #
token :: Lift tok => Eq tok => Applicable repr => Satisfiable repr tok => tok -> repr tok Source #
tokens :: Lift tok => Eq tok => Applicable repr => Alternable repr => Satisfiable repr tok => [tok] -> repr [tok] Source #
item :: Satisfiable repr tok => repr tok Source #
void :: Applicable repr => repr a -> repr () Source #
unit :: Applicable repr => repr () Source #
pfoldr :: Applicable repr => Foldable repr => Haskell (a -> b -> b) -> Haskell b -> repr a -> repr b Source #
pfoldr1 :: Applicable repr => Foldable repr => Haskell (a -> b -> b) -> Haskell b -> repr a -> repr b Source #
pfoldl :: Applicable repr => Foldable repr => Haskell (b -> a -> b) -> Haskell b -> repr a -> repr b Source #
pfoldl1 :: Applicable repr => Foldable repr => Haskell (b -> a -> b) -> Haskell b -> repr a -> repr b Source #
chainl1' :: Applicable repr => Foldable repr => Haskell (a -> b) -> repr a -> repr (b -> a -> b) -> repr b Source #
chainl1 :: Applicable repr => Foldable repr => repr a -> repr (a -> a -> a) -> repr a Source #
chainl :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr (a -> a -> a) -> Haskell a -> repr a Source #
many :: Applicable repr => Foldable repr => repr a -> repr [a] Source #
some :: Applicable repr => Foldable repr => repr a -> repr [a] Source #
skipMany :: Applicable repr => Foldable repr => repr a -> repr () Source #
skipSome :: Applicable repr => Foldable repr => repr a -> repr () Source #
sepBy :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a] Source #
sepBy1 :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a] Source #
endBy :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a] Source #
endBy1 :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a] Source #
sepEndBy :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a] Source #
sepEndBy1 :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a] Source #