| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
ADP.Fusion.Base.Classes
- data OutsideContext s
- = OStatic s
- | ORightOf s
- | OFirstLeft s
- | OLeftOf s
- data InsideContext s
- data ComplementContext = Complemented
- class RuleContext i where
- type Context i :: *
- initialContext :: i -> Context i
- data family RunningIndex i :: *
- class Element x i where
- class Monad m => MkStream m x i where
- class Build x where
- data S = S
- staticCheck :: Monad m => Bool -> Stream m a -> Stream m a
- data StaticCheck a b
- = CheckLeft Bool a
- | CheckRight b
- data EmptyOk = EmptyOk
- data NonEmpty = NonEmpty
- class MinSize c where
- class ModifyConstraint t where
Documentation
data OutsideContext s Source
Constructors
| OStatic s | |
| ORightOf s | |
| OFirstLeft s | |
| OLeftOf s |
Instances
| Show s => Show (OutsideContext s) Source |
data InsideContext s Source
Instances
| Show s => Show (InsideContext s) Source |
class RuleContext i where Source
Methods
initialContext :: i -> Context i Source
data family RunningIndex i :: * Source
While we ostensibly use an index of type i we typically do not need
every element of an i. For example, when looking at Subwords, we do
not need both element of j:.k but only k.
Also, inside grammars do need fewer moving indices than outside
grammars.
TODO Sometimes, the actual RunningIndex ctors are not erased. This could
be due to https://ghc.haskell.org/trac/ghc/ticket/2289. To test, we
should transform RunningIndex into a type class to give us access to the
left and right member, also we should create instances a la
RunningIndex (is :. Subword I) = RiSwI !(RunningIndex is) !Int.
Hopefully, these are completely erased.
Instances
class Element x i where Source
During construction of the stream, we need to extract individual elements
from symbols in production rules. An element in a stream is fixed by both,
the type x of the actual argument we want to grab (say individual
characters we parse from an input) and the type of indices i we use.
Elm data constructors are all eradicated during fusion and should never
show up in CORE.
Instances
| Element S i Source | |
| ((~) * s (Elm x0 i), Element x0 i) => Element (Term1 s) ((:.) Z i) Source | |
| ((~) * s (Elm x0 i), Element x0 i) => Element (SynVar1 s) ((:.) Z i) Source | |
| Element ls i => Element ((:!:) ls (TermSymbol a b)) i Source | |
| Element ls i => Element ((:!:) ls (Backtrack (ITbl mF arr c j x) mF mB r)) i Source | |
| Element ls i => Element ((:!:) ls (ITbl m arr c j x)) i Source | |
| Element ls i => Element ((:!:) ls (Backtrack (IRec mF c u x) mF mB r)) i Source | |
| Element ls i => Element ((:!:) ls (IRec m c u x)) i Source | |
| Element ls i => Element ((:!:) ls (Split uId splitType (Backtrack (ITbl mF arr c j x) mF mB r))) i Source | |
| Element ls i => Element ((:!:) ls (Split uId splitType (ITbl m arr c j x))) i Source | |
| Element ls i => Element ((:!:) ls (Chr r x)) i Source | |
| Element ls i => Element ((:!:) ls Deletion) i Source | |
| Element ls i => Element ((:!:) ls (Edge e)) i Source | |
| Element ls i => Element ((:!:) ls Epsilon) i Source | |
| Element ls i => Element ((:!:) ls (PeekIndex i)) i Source | |
| Element ls i => Element ((:!:) ls (Strng v x)) i Source |
class Monad m => MkStream m x i where Source
mkStream creates the actual stream of elements (Elm) that will be fed
to functions on the left of the (<<<) operator. Streams work over all
monads and are specialized for each combination of arguments x and indices
i.
Instances
| (Monad m, MkStream m ls i, Element ls i, TermStaticVar (TermSymbol a b) i, TermStream m (TermSymbol a b) (Elm ls i) i) => MkStream m ((:!:) ls (TermSymbol a b)) i Source | |
| (Monad mB, Element ls ((:.) is i), TableStaticVar ((:.) us u) ((:.) cs c) ((:.) is i), AddIndexDense (Elm ls ((:.) is i)) ((:.) us u) ((:.) cs c) ((:.) is i), MkStream mB ls ((:.) is i), PrimArrayOps arr ((:.) us u) x) => MkStream mB ((:!:) ls (Backtrack (ITbl mF arr ((:.) cs c) ((:.) us u) x) mF mB r)) ((:.) is i) Source | |
| (Monad m, Element ls ((:.) is i), TableStaticVar ((:.) us u) ((:.) cs c) ((:.) is i), AddIndexDense (Elm ls ((:.) is i)) ((:.) us u) ((:.) cs c) ((:.) is i), MkStream m ls ((:.) is i), PrimArrayOps arr ((:.) us u) x) => MkStream m ((:!:) ls (ITbl m arr ((:.) cs c) ((:.) us u) x)) ((:.) is i) Source | |
| (Monad mB, Element ls ((:.) is i), TableStaticVar ((:.) us u) ((:.) cs c) ((:.) is i), AddIndexDense (Elm ls ((:.) is i)) ((:.) us u) ((:.) cs c) ((:.) is i), MkStream mB ls ((:.) is i)) => MkStream mB ((:!:) ls (Backtrack (IRec mF ((:.) cs c) ((:.) us u) x) mF mB r)) ((:.) is i) Source | |
| (Monad m, Element ls ((:.) is i), TableStaticVar ((:.) us u) ((:.) cs c) ((:.) is i), AddIndexDense (Elm ls ((:.) is i)) ((:.) us u) ((:.) cs c) ((:.) is i), MkStream m ls ((:.) is i)) => MkStream m ((:!:) ls (IRec m ((:.) cs c) ((:.) us u) x)) ((:.) is i) Source |
Finally, we need to be able to correctly build together symbols on the
right-hand side of the (<<<) operator.
The default makes sure that the last (or only) argument left over is
correctly assigned a Z to terminate the symbol stack.
Minimal complete definition
Nothing
Instances
| Build Deletion Source | |
| Build Epsilon Source | |
| Build (Edge e) Source | |
| Build (PeekIndex i) Source | |
| Build x => Build ((:!:) x y) Source | |
| Build (TermSymbol a b) Source | |
| Build (Chr r x) Source | |
| Build (Strng v x) Source | |
| Build (Split uId splitType synVar) Source | |
| Build (Backtrack t mF mB r) Source | |
| Build (IRec m c i x) Source | |
| Build (ITbl m arr c i x) Source |
staticCheck :: Monad m => Bool -> Stream m a -> Stream m a Source
staticCheck acts as a static filter. If b is true, we keep all stream
elements. If b is false, we discard all stream elements.
data StaticCheck a b Source
Constructors
| CheckLeft Bool a | |
| CheckRight b |
Constrains the behaviour of the memoizing tables. They may be EmptyOk if
i==j is allowed (empty subwords or similar); or they may need NonEmpty
indices, or finally they can be OnlyZero (only i==j allowed) which is
useful in multi-dimensional casese.
Constructors
| EmptyOk |
Instances
| MinSize EmptyOk Source | |
| type TNE (Backtrack (ITbl mF arr EmptyOk i x) mF mB r) = Backtrack (ITbl mF arr NonEmpty i x) mF mB r Source | |
| type TE (Backtrack (ITbl mF arr EmptyOk i x) mF mB r) = Backtrack (ITbl mF arr EmptyOk i x) mF mB r Source | |
| type TNE (ITbl m arr EmptyOk i x) = ITbl m arr NonEmpty i x Source | |
| type TE (ITbl m arr EmptyOk i x) = ITbl m arr EmptyOk i x Source |