Copyright | (c) Daan Leijen 1999-2001, Bryan O'Sullivan 2007-2014, Paweł Nowak 2014 |
---|---|
License | MIT |
Maintainer | Paweł Nowak <pawel834@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Combinators that work with any sequence type.
- optional :: SIArrow cat => cat () a -> cat () (Maybe a)
- opt :: SIArrow cat => cat () () -> cat () ()
- opt_ :: SIArrow cat => cat () () -> cat () ()
- choice :: SIArrow cat => [cat () a] -> cat () a
- eitherOf :: SIArrow cat => cat () a -> cat () b -> cat () (Either a b)
- manyTill :: SIArrow cat => cat () a -> cat () () -> cat () [a]
- sepBy :: SIArrow cat => cat () a -> cat () () -> cat () [a]
- sepBy1 :: SIArrow cat => cat () a -> cat () () -> cat () [a]
- takeArr :: Syntax syn => syn Int (Seq syn)
- vecNSepBy :: Syntax syn => Int -> syn () a -> syn () () -> syn () (Vector a)
- ivecNSepBy :: Syntax syn => Int -> syn Int (Int, a) -> syn () () -> syn () (Vector a)
- vec :: Syntax syn => syn () a -> syn Int (Vector a)
- vecSepBy :: Syntax syn => syn () a -> syn () () -> syn Int (Vector a)
- ivec :: Syntax syn => syn Int (Int, a) -> syn Int (Vector a)
- ivecSepBy :: Syntax syn => syn Int (Int, a) -> syn () () -> syn Int (Vector a)
- uvecNSepBy :: (Syntax syn, Unbox a) => Int -> syn () a -> syn () () -> syn () (Vector a)
- uivecNSepBy :: (Syntax syn, Unbox a) => Int -> syn Int (Int, a) -> syn () () -> syn () (Vector a)
- uvec :: (Syntax syn, Unbox a) => syn () a -> syn Int (Vector a)
- uvecSepBy :: (Syntax syn, Unbox a) => syn () a -> syn () () -> syn Int (Vector a)
- uivec :: (Syntax syn, Unbox a) => syn Int (Int, a) -> syn Int (Vector a)
- uivecSepBy :: (Syntax syn, Unbox a) => syn Int (Int, a) -> syn () () -> syn Int (Vector a)
Combinators.
opt_ :: SIArrow cat => cat () () -> cat () () Source
Parser one or zero occurences of f
, but prints nothing.
choice :: SIArrow cat => [cat () a] -> cat () a Source
Tries to apply the actions in the list in order, until one of them succeeds. Returns the value of the succeeding action.
eitherOf :: SIArrow cat => cat () a -> cat () b -> cat () (Either a b) Source
Combine two alternatives.
Lists.
manyTill :: SIArrow cat => cat () a -> cat () () -> cat () [a] Source
manyTill p end
applies action p zero or more times until action
end succeeds, and returns the list of values returned by p.
sepBy :: SIArrow cat => cat () a -> cat () () -> cat () [a] Source
Zero or more occurences of v
separated by s
.
sepBy1 :: SIArrow cat => cat () a -> cat () () -> cat () [a] Source
One or more occurences of v
separated by s
.
Arrowized combinators.
Vectors.
vecNSepBy :: Syntax syn => Int -> syn () a -> syn () () -> syn () (Vector a) Source
Constant size vector with separators.
vecNSepBy n e sep
describes a size n
vector with elements e
separated by sep
.
ivecNSepBy :: Syntax syn => Int -> syn Int (Int, a) -> syn () () -> syn () (Vector a) Source
Constant size vector with separators and index-aware elements.
ivecNSepBy n e sep
describes a size n
vector with elements e
separated by sep
.
Each element gets its index and should output a value and the index unchanged.
vec :: Syntax syn => syn () a -> syn Int (Vector a) Source
Runtime sized vector. The size can depend on the result of some computation.
vec e
describes a vector with elements e
.
vecSepBy :: Syntax syn => syn () a -> syn () () -> syn Int (Vector a) Source
Runtime sized vector with separators. The size can depend on the result of some computation.
vecSepBy e sep
describes a vector with elements e
separated by sep
.
ivec :: Syntax syn => syn Int (Int, a) -> syn Int (Vector a) Source
Runtime sized vector with index-aware elements. The size can depend on the result of some computation.
ivec e
describes a vector with elements e
.
ivecSepBy :: Syntax syn => syn Int (Int, a) -> syn () () -> syn Int (Vector a) Source
Runtime sized vector with index-aware elements and separators. The size can depend on the result of some computation.
ivecSepBy e sep
describes a vector with elements e
separated by sep
.
Unboxed vectors.
uvecNSepBy :: (Syntax syn, Unbox a) => Int -> syn () a -> syn () () -> syn () (Vector a) Source
Constant size unboxed vector with separators.
uvecNSepBy n e sep
describes a size n
vector with elements e
separated by sep
.
uivecNSepBy :: (Syntax syn, Unbox a) => Int -> syn Int (Int, a) -> syn () () -> syn () (Vector a) Source
Constant size unboxed vector with separators and index-aware elements.
uivecNSepBy n e sep
describes a size n
vector with elements e
separated by sep
.
Each element gets its index and should output a value and the index unchanged.
uvec :: (Syntax syn, Unbox a) => syn () a -> syn Int (Vector a) Source
Runtime sized unboxed vector. The size can depend on the result of some computation.
uvec e
describes a vector with elements e
.
uvecSepBy :: (Syntax syn, Unbox a) => syn () a -> syn () () -> syn Int (Vector a) Source
Runtime sized unboxed vector with separators. The size can depend on the result of some computation.
uvecSepBy e sep
describes a vector with elements e
separated by sep
.