| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.PrimitiveArray.Index.Subword
Description
Index structure for context-free grammars on strings. A Subword captures
a pair (i,j) with i<=j.
- newtype Subword t = Subword {
- fromSubword :: Int :. Int
- subword :: Int -> Int -> Subword t
- subwordI :: Int -> Int -> Subword I
- subwordO :: Int -> Int -> Subword O
- subwordC :: Int -> Int -> Subword C
- streamUpMk :: Monad m => t1 -> t -> m (t, t1, t1)
- streamUpStep :: Monad m => Int -> Int -> (t1, Int, Int) -> m (Step (t1, Int, Int) ((:.) t1 (Subword t)))
- streamDownMk :: Monad m => t1 -> t2 -> t -> m (t, t1, t2)
- streamDownStep :: Monad m => Int -> (t1, Int, Int) -> m (Step (t1, Int, Int) ((:.) t1 (Subword t)))
Documentation
A subword wraps a pair of Int indices i,j with i<=j.
Subwords always yield the upper-triangular part of a rect-angular array.
This gives the quite curious effect that (0,N) points to the
`largest' index, while (0,0) ... (1,1) ... (k,k) ... (N,N) point to
the smallest. We do, however, use (0,0) as the smallest as (0,k) gives
successively smaller upper triangular parts.
Constructors
| Subword | |
Fields
| |
Instances
streamUpMk :: Monad m => t1 -> t -> m (t, t1, t1) Source #
generic mk for streamUp / streamDown
streamUpStep :: Monad m => Int -> Int -> (t1, Int, Int) -> m (Step (t1, Int, Int) ((:.) t1 (Subword t))) Source #
streamDownMk :: Monad m => t1 -> t2 -> t -> m (t, t1, t2) Source #