Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data OStatic s
- data ORightOf s
- data OFirstLeft s
- data OLeftOf s
- data IStatic s
- data IVariable s
- data Complement
- data ExtComplementContext s
- type family InitialContext ix :: *
- data family RunningIndex i :: *
- class Element (x :: *) i where
- class Monad m => MkStream m pos sym ix where
- type family LeftPosTy (pos :: *) sym ix :: *
- 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
- staticCheck# :: Monad m => Int# -> Stream m a -> Stream m a
- data SLR z
- data EmptyOk = EmptyOk
- data NonEmpty = NonEmpty
- class MinSize c where
- class ModifyConstraint t where
Documentation
Instances
data OFirstLeft s Source #
Instances
(Monad m, MkStream m ps S is, KnownNat d) => MkStream m (ps :. OFirstLeft d :: Type) S (is :. PointL O) Source # | |
(Monad m, KnownNat d) => MkStream m (OFirstLeft d :: Type) S (PointL O) Source # | |
type LeftPosTy (OFirstLeft d) (TwITbl b s m arr EmptyOk (PointL O) x) (PointL O) Source # | |
type LeftPosTy (OFirstLeft d) (TwITblBt b s arr EmptyOk (PointL O) x mB mF r) (PointL O) Source # | |
Instances
Instances
data Complement Source #
Instances
data ExtComplementContext s Source #
Needed for structures that have long-range interactions and "expand",
like sets around edge boundaries: set edge set
. requires the sets to
be connected.
type family InitialContext ix :: * Source #
For each index type ix
, initialContext (Proxy ∷ ix)
yields the initial
context from which to start up rules.
TODO turn into type family and make initialContext
a global function.
Instances
type InitialContext Z Source # | |
Defined in ADP.Fusion.Core.Multi | |
type InitialContext (Unit I) Source # | |
Defined in ADP.Fusion.Unit.Core | |
type InitialContext (Unit O) Source # | |
Defined in ADP.Fusion.Unit.Core | |
type InitialContext (Unit C) Source # | |
Defined in ADP.Fusion.Unit.Core | |
type InitialContext (PointR I) Source # | |
Defined in ADP.Fusion.PointR.Core | |
type InitialContext (PointR O) Source # | |
Defined in ADP.Fusion.PointR.Core | |
type InitialContext (PointR C) Source # | |
Defined in ADP.Fusion.PointR.Core | |
type InitialContext (PointL I) Source # | |
Defined in ADP.Fusion.PointL.Core | |
type InitialContext (PointL O) Source # | |
Defined in ADP.Fusion.PointL.Core | |
type InitialContext (PointL C) Source # | |
Defined in ADP.Fusion.PointL.Core | |
type InitialContext (is :. i) Source # | |
Defined in ADP.Fusion.Core.Multi |
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 Subword
s, we do
not need both element of j:.k
but only k
.
Also, inside grammars do need fewer moving indices than outside
grammars.
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 # | |
Defined in ADP.Fusion.Core.Multi data Elm (ls :!: TermSymbol a b) i :: Type Source # getArg :: Elm (ls :!: TermSymbol a b) i -> Arg (ls :!: TermSymbol a b) Source # getIdx :: Elm (ls :!: TermSymbol a b) i -> RunningIndex i Source # getElm :: Elm (ls :!: TermSymbol a b) i -> RecElm (ls :!: TermSymbol a b) i Source # | |
Element ls i => Element (ls :!: Test v x) i Source # | |
Element ls i => Element (ls :!: Switch) i Source # | |
(Element ls i, Vector v x) => Element (ls :!: Str linked minSz maxSz v x) i Source # | |
Element ls i => Element (ls :!: PeekIndex i) i Source # | |
Element ls i => Element (ls :!: MultiChr c v x) i Source # | |
Element ls i => Element (ls :!: Epsilon lg) i Source # | |
Element ls i => Element (ls :!: Edge) i Source # | |
Element ls i => Element (ls :!: Deletion) i Source # | |
Element ls i => Element (ls :!: Chr r x) i Source # | |
Element ls i => Element (ls :!: TwIRecBt c u x mF mB r) i Source # | |
Element ls i => Element (ls :!: TwIRec m c u x) i Source # | |
Element ls i => Element (ls :!: TwITblBt b s arr c j x mF mB r) i Source # | |
Defined in ADP.Fusion.Core.SynVar.Array.Type data Elm (ls :!: TwITblBt b s arr c j x mF mB r) i :: Type Source # type RecElm (ls :!: TwITblBt b s arr c j x mF mB r) i :: Type Source # type Arg (ls :!: TwITblBt b s arr c j x mF mB r) :: Type Source # getArg :: Elm (ls :!: TwITblBt b s arr c j x mF mB r) i -> Arg (ls :!: TwITblBt b s arr c j x mF mB r) Source # getIdx :: Elm (ls :!: TwITblBt b s arr c j x mF mB r) i -> RunningIndex i Source # getElm :: Elm (ls :!: TwITblBt b s arr c j x mF mB r) i -> RecElm (ls :!: TwITblBt b s arr c j x mF mB r) i Source # | |
Element ls i => Element (ls :!: TwITbl b s m arr c j x) i Source # | |
Element ls i => Element (ls :!: Split uId splitType (TwITblBt b s arr c j x mF mB r)) i Source # | |
Defined in ADP.Fusion.Core.SynVar.Split.Type data Elm (ls :!: Split uId splitType (TwITblBt b s arr c j x mF mB r)) i :: Type Source # type RecElm (ls :!: Split uId splitType (TwITblBt b s arr c j x mF mB r)) i :: Type Source # type Arg (ls :!: Split uId splitType (TwITblBt b s arr c j x mF mB r)) :: Type Source # getArg :: Elm (ls :!: Split uId splitType (TwITblBt b s arr c j x mF mB r)) i -> Arg (ls :!: Split uId splitType (TwITblBt b s arr c j x mF mB r)) Source # getIdx :: Elm (ls :!: Split uId splitType (TwITblBt b s arr c j x mF mB r)) i -> RunningIndex i Source # getElm :: Elm (ls :!: Split uId splitType (TwITblBt b s arr c j x mF mB r)) i -> RecElm (ls :!: Split uId splitType (TwITblBt b s arr c j x mF mB r)) i Source # | |
Element ls i => Element (ls :!: Split uId splitType (TwITbl b s m arr c j x)) i Source # | |
Defined in ADP.Fusion.Core.SynVar.Split.Type data Elm (ls :!: Split uId splitType (TwITbl b s m arr c j x)) i :: Type Source # type RecElm (ls :!: Split uId splitType (TwITbl b s m arr c j x)) i :: Type Source # type Arg (ls :!: Split uId splitType (TwITbl b s m arr c j x)) :: Type Source # getArg :: Elm (ls :!: Split uId splitType (TwITbl b s m arr c j x)) i -> Arg (ls :!: Split uId splitType (TwITbl b s m arr c j x)) Source # getIdx :: Elm (ls :!: Split uId splitType (TwITbl b s m arr c j x)) i -> RunningIndex i Source # getElm :: Elm (ls :!: Split uId splitType (TwITbl b s m arr c j x)) i -> RecElm (ls :!: Split uId splitType (TwITbl b s m arr c j x)) i Source # |
class Monad m => MkStream m pos sym ix 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
.
:: Proxy pos | Fix staticvariable... depending on position in r.h.s. of rule. |
-> sym | the symbol type (syntactic variable with or with memoization, terminal types like char, string, etc) |
-> Int# | guard system for stopping execution of rule |
-> LimitType ix | upper limit of index |
-> ix | the current index |
-> Stream m (Elm sym ix) | resulting stream of elements |
Instances
Monad m => MkStream m Z S Z Source # | |
Monad m => MkStream m Complement S (PointL C) Source # | |
Monad m => MkStream m Complement S (Unit C) Source # | |
(Monad m, MkStream m posLeft ls i, Element ls i, TermStaticVar pos (TermSymbol a b) i, TermStream m pos (TermSymbol a b) (Elm ls i) i, posLeft ~ LeftPosTy pos (TermSymbol a b) i) => MkStream m (pos :: Type) (ls :!: TermSymbol a b) i Source # | |
Defined in ADP.Fusion.Core.Multi | |
(Monad mB, ITblCx mB pos ls arr x u c (i O), MkStream mB (LeftPosTy pos (TwITblBt b s arr c u x mF mB r) (i O)) ls (i O)) => MkStream mB (pos :: Type) (ls :!: TwITblBt b s arr c u x mF mB r) (i O) Source # | |
(Monad m, ITblCx m pos ls arr x u c (i O), MkStream m (LeftPosTy pos (TwITbl b s m arr c u x) (i O)) ls (i O)) => MkStream m (pos :: Type) (ls :!: TwITbl b s m arr c u x) (i O) Source # | |
(Monad mB, ITblCx mB pos ls arr x u c (i I), MkStream mB (LeftPosTy pos (TwITblBt b s arr c u x mF mB r) (i I)) ls (i I)) => MkStream mB (pos :: Type) (ls :!: TwITblBt b s arr c u x mF mB r) (i I) Source # | |
(Monad m, ITblCx m pos ls arr x u c (i I), MkStream m (LeftPosTy pos (TwITbl b s m arr c u x) (i I)) ls (i I)) => MkStream m (pos :: Type) (ls :!: TwITbl b s m arr c u x) (i I) Source # | |
(TermStream m (Z :. pos) (TermSymbol M (Chr r x)) (Elm (Term1 (Elm ls (PointL i))) (Z :. PointL i)) (Z :. PointL i), posLeft ~ LeftPosTy pos (Chr r x) (PointL i), TermStaticVar pos (Chr r x) (PointL i), MkStream m posLeft ls (PointL i)) => MkStream m (pos :: Type) (ls :!: Chr r x) (PointL i) Source # | First try in getting this right with a TODO use TODO it might even be possible to auto-generate this code via TH. |
(TermStream m (Z :. pos) (TermSymbol M Deletion) (Elm (Term1 (Elm ls (PointL i))) (Z :. PointL i)) (Z :. PointL i), posLeft ~ LeftPosTy pos Deletion (PointL i), TermStaticVar pos Deletion (PointL i), MkStream m posLeft ls (PointL i)) => MkStream m (pos :: Type) (ls :!: Deletion) (PointL i) Source # | |
(TermStream m (Z :. pos) (TermSymbol M (Epsilon lg)) (Elm (Term1 (Elm ls (PointL i))) (Z :. PointL i)) (Z :. PointL i), posLeft ~ LeftPosTy pos (Epsilon lg) (PointL i), TermStaticVar pos (Epsilon lg) (PointL i), MkStream m posLeft ls (PointL i)) => MkStream m (pos :: Type) (ls :!: Epsilon lg) (PointL i) Source # | |
(TermStream m (Z :. pos) (TermSymbol M (MultiChr c v x)) (Elm (Term1 (Elm ls (PointL i))) (Z :. PointL i)) (Z :. PointL i), posLeft ~ LeftPosTy pos (MultiChr c v x) (PointL i), TermStaticVar pos (MultiChr c v x) (PointL i), MkStream m posLeft ls (PointL i)) => MkStream m (pos :: Type) (ls :!: MultiChr c v x) (PointL i) Source # | First try in getting this right with a TODO use TODO it might even be possible to auto-generate this code via TH. |
(TermStream m (Z :. pos) (TermSymbol M (Str linked minSz maxSz v x)) (Elm (Term1 (Elm ls (PointL i))) (Z :. PointL i)) (Z :. PointL i), posLeft ~ LeftPosTy pos (Str linked minSz maxSz v x) (PointL i), TermStaticVar pos (Str linked minSz maxSz v x) (PointL i), MkStream m posLeft ls (PointL i)) => MkStream m (pos :: Type) (ls :!: Str linked minSz maxSz v x) (PointL i) Source # | |
(TermStream m (Z :. pos) (TermSymbol M Switch) (Elm (Term1 (Elm ls (PointL i))) (Z :. PointL i)) (Z :. PointL i), posLeft ~ LeftPosTy pos Switch (PointL i), TermStaticVar pos Switch (PointL i), MkStream m posLeft ls (PointL i)) => MkStream m (pos :: Type) (ls :!: Switch) (PointL i) Source # | |
(TermStream m (Z :. pos) (TermSymbol M (Chr r x)) (Elm (Term1 (Elm ls (PointR i))) (Z :. PointR i)) (Z :. PointR i), posLeft ~ LeftPosTy pos (Chr r x) (PointR i), TermStaticVar pos (Chr r x) (PointR i), MkStream m posLeft ls (PointR i)) => MkStream m (pos :: Type) (ls :!: Chr r x) (PointR i) Source # | |
(TermStream m (Z :. pos) (TermSymbol M Deletion) (Elm (Term1 (Elm ls (PointR i))) (Z :. PointR i)) (Z :. PointR i), posLeft ~ LeftPosTy pos Deletion (PointR i), TermStaticVar pos Deletion (PointR i), MkStream m posLeft ls (PointR i)) => MkStream m (pos :: Type) (ls :!: Deletion) (PointR i) Source # | |
(TermStream m (Z :. pos) (TermSymbol M (Epsilon lg)) (Elm (Term1 (Elm ls (PointR i))) (Z :. PointR i)) (Z :. PointR i), posLeft ~ LeftPosTy pos (Epsilon lg) (PointR i), TermStaticVar pos (Epsilon lg) (PointR i), MkStream m posLeft ls (PointR i)) => MkStream m (pos :: Type) (ls :!: Epsilon lg) (PointR i) Source # | |
(TermStream m (Z :. pos) (TermSymbol M (MultiChr c v x)) (Elm (Term1 (Elm ls (PointR i))) (Z :. PointR i)) (Z :. PointR i), posLeft ~ LeftPosTy pos (MultiChr c v x) (PointR i), TermStaticVar pos (MultiChr c v x) (PointR i), MkStream m posLeft ls (PointR i)) => MkStream m (pos :: Type) (ls :!: MultiChr c v x) (PointR i) Source # | |
(TermStream m (Z :. pos) (TermSymbol M Deletion) (Elm (Term1 (Elm ls (Unit i))) (Z :. Unit i)) (Z :. Unit i), posLeft ~ LeftPosTy pos Deletion (Unit i), TermStaticVar pos Deletion (Unit i), MkStream m posLeft ls (Unit i)) => MkStream m (pos :: Type) (ls :!: Deletion) (Unit i) Source # | |
(TermStream m (Z :. pos) (TermSymbol M (Epsilon lg)) (Elm (Term1 (Elm ls (Unit i))) (Z :. Unit i)) (Z :. Unit i), posLeft ~ LeftPosTy pos (Epsilon lg) (Unit i), TermStaticVar pos (Epsilon lg) (Unit i), MkStream m posLeft ls (Unit i)) => MkStream m (pos :: Type) (ls :!: Epsilon lg) (Unit i) Source # | |
(Monad m, MkStream m ps S is) => MkStream m (ps :. Complement :: Type) S (is :. PointL C) Source # | |
(Monad m, MkStream m ps S is, KnownNat d) => MkStream m (ps :. OFirstLeft d :: Type) S (is :. PointL O) Source # | |
(Monad m, MkStream m ps S is, KnownNat d) => MkStream m (ps :. OStatic d :: Type) S (is :. PointL O) Source # | |
(Monad m, KnownNat d) => MkStream m (OFirstLeft d :: Type) S (PointL O) Source # | |
(Monad m, KnownNat d) => MkStream m (OStatic d :: Type) S (PointL O) Source # | |
(Monad m, MkStream m ps S is, KnownNat d) => MkStream m (ps :. IVariable d :: Type) S (is :. PointL I) Source # | |
(Monad m, MkStream m ps S is, KnownNat d) => MkStream m (ps :. IStatic d :: Type) S (is :. PointL I) Source # | |
(Monad m, KnownNat d) => MkStream m (IVariable d :: Type) S (PointL I) Source # | |
(Monad m, KnownNat d) => MkStream m (IStatic d :: Type) S (PointL I) Source # | |
(Monad m, MkStream m ps S is, KnownNat d) => MkStream m (ps :. IVariable d :: Type) S (is :. PointR I) Source # | |
(Monad m, MkStream m ps S is, KnownNat d) => MkStream m (ps :. IStatic d :: Type) S (is :. PointR I) Source # | |
(Monad m, KnownNat d) => MkStream m (IVariable d :: Type) S (PointR I) Source # | |
(Monad m, KnownNat d) => MkStream m (IStatic d :: Type) S (PointR I) Source # | |
Monad m => MkStream m (OStatic d :: Type) S (Unit O) Source # | |
Monad m => MkStream m (IVariable d :: Type) S (Unit I) Source # | |
Monad m => MkStream m (IStatic d :: Type) S (Unit I) Source # | |
(Monad mB, pos ~ (ps :. p), posLeft ~ LeftPosTy pos (TwITblBt b s arr (cs :. c) (us :. u) x mF mB r) (is :. i), Element ls (is :. i), TableStaticVar (ps :. p) (cs :. c) (us :. u) (is :. i), AddIndexDense pos (Elm ls (is :. i)) (cs :. c) (us :. u) (is :. i), MkStream mB posLeft ls (is :. i), PrimArrayOps arr (us :. u) x) => MkStream mB (ps :. p :: Type) (ls :!: TwITblBt b s arr (cs :. c) (us :. u) x mF mB r) (is :. i) Source # | |
(Monad m, pos ~ (ps :. p), posLeft ~ LeftPosTy pos (TwITbl b s m arr (cs :. c) (us :. u) x) (is :. i), Element ls (is :. i), TableStaticVar (ps :. p) (cs :. c) (us :. u) (is :. i), AddIndexDense pos (Elm ls (is :. i)) (cs :. c) (us :. u) (is :. i), MkStream m posLeft ls (is :. i), PrimArrayOps arr (us :. u) x) => MkStream m (ps :. p :: Type) (ls :!: TwITbl b s m arr (cs :. c) (us :. u) x) (is :. i) Source # | |
(Applicative mB, Monad mB, pos ~ (ps :. p), posLeft ~ LeftPosTy pos (TwIRecBt (cs :. c) (us :. u) x mF mB r) (is :. i), Element ls (is :. i), TableStaticVar (ps :. p) (cs :. c) (us :. u) (is :. i), AddIndexDense pos (Elm ls (is :. i)) (cs :. c) (us :. u) (is :. i), MkStream mB posLeft ls (is :. i)) => MkStream mB (ps :. p :: Type :. Type) (ls :!: TwIRecBt (cs :. c) (us :. u) x mF mB r) (is :. i) Source # | |
(Functor m, Monad m, pos ~ (ps :. p), posLeft ~ LeftPosTy pos (TwIRec m (cs :. c) (us :. u) x) (is :. i), Element ls (is :. i), TableStaticVar (ps :. p) (cs :. c) (us :. u) (is :. i), AddIndexDense pos (Elm ls (is :. i)) (cs :. c) (us :. u) (is :. i), MkStream m posLeft ls (is :. i)) => MkStream m (ps :. p :: Type :. Type) (ls :!: TwIRec m (cs :. c) (us :. u) x) (is :. i) Source # | |
type family LeftPosTy (pos :: *) sym ix :: * Source #
This type family yields for a given positional type posty ∷ k
, the
current symbol type symty
and index type ix
the next-left positional
type within the same kind k
Keeping within the same kind should prevent
accidental switching from Inside to Outside or similar bugs.
Instances
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.
Nothing
Instances
Build Switch Source # | |
Build Edge Source # | |
Build Deletion Source # | |
Build (Epsilon lg) Source # | |
Build x => Build (x :!: y) Source # | |
Build (TermSymbol a b) Source # | |
Defined in ADP.Fusion.Core.Multi type Stack (TermSymbol a b) :: Type Source # build :: TermSymbol a b -> Stack (TermSymbol a b) Source # | |
Build (Test v x) Source # | |
Build (PeekIndex i) Source # | |
Build (Chr r x) Source # | |
Build (MultiChr c v x) Source # | |
Build (Split uId splitType synVar) Source # | |
Build (TwIRec m c i x) Source # | |
Build (Str linked minSz maxSz v x) Source # | |
Build (TwIRecBt c i x mF mB r) Source # | |
Build (TwITbl b s m arr c i x) Source # | |
Build (TwITblBt b s arr c i x mF mB r) Source # | |
Similar to Z
, but terminates an argument stack.
Instances
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 #
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.