Safe Haskell | None |
---|
a Boomerang
library for working with '[Text]'
- type TextsError = ParserError MajorMinorPos
- (</>) :: Boomerang TextsError [Text] b c -> Boomerang TextsError [Text] a b -> Boomerang TextsError [Text] a c
- alpha :: Boomerang TextsError [Text] r (Char :- r)
- anyChar :: Boomerang TextsError [Text] r (Char :- r)
- anyText :: Boomerang TextsError [Text] r (Text :- r)
- char :: Char -> Boomerang TextsError [Text] r (Char :- r)
- digit :: Boomerang TextsError [Text] r (Char :- r)
- digits :: Boomerang TextsError [Text] r (Text :- r)
- signed :: Boomerang TextsError [Text] a (Text :- r) -> Boomerang TextsError [Text] a (Text :- r)
- eos :: Boomerang TextsError [Text] r r
- integral :: (Integral a, Show a) => Boomerang TextsError [Text] r (a :- r)
- int :: Boomerang TextsError [Text] r (Int :- r)
- integer :: Boomerang TextsError [Text] r (Integer :- r)
- lit :: Text -> Boomerang TextsError [Text] r r
- readshow :: (Read a, Show a) => Boomerang TextsError [Text] r (a :- r)
- satisfy :: (Char -> Bool) -> Boomerang TextsError [Text] r (Char :- r)
- satisfyStr :: (Text -> Bool) -> Boomerang TextsError [Text] r (Text :- r)
- space :: Boomerang TextsError [Text] r (Char :- r)
- rTextCons :: Boomerang e tok (Char :- (Text :- r)) (Text :- r)
- rEmpty :: Boomerang e [Text] r (Text :- r)
- rText :: Boomerang e [Text] r (Char :- r) -> Boomerang e [Text] r (Text :- r)
- rText1 :: Boomerang e [Text] r (Char :- r) -> Boomerang e [Text] r (Text :- r)
- isComplete :: [Text] -> Bool
- parseTexts :: Boomerang TextsError [Text] () (r :- ()) -> [Text] -> Either TextsError r
- unparseTexts :: Boomerang e [Text] () (r :- ()) -> r -> Maybe [Text]
Types
Combinators
(</>) :: Boomerang TextsError [Text] b c -> Boomerang TextsError [Text] a b -> Boomerang TextsError [Text] a cSource
equivalent to f . eos . g
alpha :: Boomerang TextsError [Text] r (Char :- r)Source
matches alphabetic Unicode characters (lower-case, upper-case and title-case letters,
plus letters of caseless scripts and modifiers letters). (Uses isAlpha
)
signed :: Boomerang TextsError [Text] a (Text :- r) -> Boomerang TextsError [Text] a (Text :- r)Source
eos :: Boomerang TextsError [Text] r rSource
end of string
integral :: (Integral a, Show a) => Boomerang TextsError [Text] r (a :- r)Source
matches an Integral
value
Note that the combinator (rPair . integral . integral)
is ill-defined because the parse canwell. not tell where it is supposed to split the sequence of digits to produced two ints.
int :: Boomerang TextsError [Text] r (Int :- r)Source
matches an Int
Note that the combinator (rPair . int . int)
is ill-defined because the parse canwell. not tell where it is supposed to split the sequence of digits to produced two ints.
integer :: Boomerang TextsError [Text] r (Integer :- r)Source
matches an Integer
Note that the combinator (rPair . integer . integer)
is ill-defined because the parse can not tell where it is supposed to split the sequence of digits to produced two ints.
readshow :: (Read a, Show a) => Boomerang TextsError [Text] r (a :- r)Source
lift 'Read'/'Show' to a Boomerang
There are a few restrictions here:
satisfy :: (Char -> Bool) -> Boomerang TextsError [Text] r (Char :- r)Source
statisfy a Char
predicate
satisfyStr :: (Text -> Bool) -> Boomerang TextsError [Text] r (Text :- r)Source
space :: Boomerang TextsError [Text] r (Char :- r)Source
matches white-space characters in the Latin-1 range. (Uses isSpace
)
Running the Boomerang
isComplete :: [Text] -> BoolSource
Predicate to test if we have parsed all the Texts.
Typically used as argument to parse1
see also: parseTexts
parseTexts :: Boomerang TextsError [Text] () (r :- ()) -> [Text] -> Either TextsError rSource
run the parser
Returns the first complete parse or a parse error.
parseTexts (rUnit . lit "foo") ["foo"]