Module
Text.Parsing.Combinators
- Package
- purescript-simple-parser
- Repository
- Thimoteus/purescript-simple-parser
#option Source
option :: forall a m. Alternative m => a -> m a -> m a
Attempt a parse, with a default value in case of failure.
#bracket Source
bracket :: forall a r l m. Applicative m => m l -> m a -> m r -> m a
Parse something surrounded by given arguments.
#exactly Source
exactly :: forall a m. Applicative m => Int -> m a -> m (List a)
exactly n p
fails iff many p
would produce a list of length < n.
However, exactly n p
will never produce a list of larger length.
Example in PSCI:
> parse (exactly 3 $ char '6') "6666666"
Just (Cons ('6') (Cons ('6') (Cons ('6'))))
> parse (exactly 3 $ string "Bye) "ByeBye"
Nothing