ADPfusion-0.5.2.2: Efficient, high-level dynamic programming.

Safe HaskellNone
LanguageHaskell2010

ADP.Fusion.SynVar.Recursive.Type

Synopsis

Documentation

data IRec c i x where Source #

A syntactic variable that does not memoize but simplify recurses. One needs to be somewhat careful when using this one. ITbl performs memoization to perform DP in polynomial time (roughly speaking). If the rules for an IRec are of a particular type, they will exponential running time. Things like X -> X X are, for example, rather bad. Rules of the type X -> Y, Y -> Z are ok, if Y is an IRec since we just continue on. The same holds for Y -> a Y. Basically, things are safe if there is only a (small) constant number of parses of an IRec synvar.

Constructors

IRec :: {..} -> IRec c i x 

Fields

Instances

MutateCell CFG ts im i => MutateCell CFG ((:.) ts (TwIRec im c i x)) im i Source # 

Methods

mutateCell :: (Monad om, PrimMonad om) => Proxy * CFG -> Int -> Int -> (forall a. im a -> om a) -> (ts :. TwIRec im c i x) -> i -> i -> om () Source #

(Applicative mB, 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 (TwIRecBt ((:.) cs c) ((:.) us u) x mF mB r)) ((:.) is i) Source # 

Methods

mkStream :: (ls :!: TwIRecBt (cs :. c) (us :. u) x mF mB r) -> Context (is :. i) -> (is :. i) -> (is :. i) -> Stream mB (Elm (ls :!: TwIRecBt (cs :. c) (us :. u) x mF mB r) (is :. i)) Source #

(Functor m, 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 (TwIRec m ((:.) cs c) ((:.) us u) x)) ((:.) is i) Source # 

Methods

mkStream :: (ls :!: TwIRec m (cs :. c) (us :. u) x) -> Context (is :. i) -> (is :. i) -> (is :. i) -> Stream m (Elm (ls :!: TwIRec m (cs :. c) (us :. u) x) (is :. i)) Source #

(Monad mB, IndexStream i, (~) * i j, (~) (* -> *) m mB) => Axiom (TW (Backtrack (TwIRec mF c i x) mF mB) (j -> j -> m [r])) Source # 

Associated Types

type AxiomStream (TW (Backtrack (TwIRec mF c i x) mF mB) (j -> j -> m [r])) :: * Source #

Methods

axiom :: TW (Backtrack (TwIRec mF c i x) mF mB) (j -> j -> m [r]) -> AxiomStream (TW (Backtrack (TwIRec mF c i x) mF mB) (j -> j -> m [r])) Source #

TSBO ts => TSBO ((:.) ts (TwIRec Id c i x)) Source # 

Methods

asDyn :: (ts :. TwIRec Id c i x) -> [Q] Source #

fillWithDyn :: (Monad m, PrimMonad m) => [Q] -> (ts :. TwIRec Id c i x) -> m [Q] Source #

TableOrder ts => TableOrder ((:.) ts (TwIRec im c i x)) Source #

IRecs do not need an order, given that they do not memoize.

Methods

tableLittleOrder :: (ts :. TwIRec im c i x) -> [Int] Source #

tableBigOrder :: (ts :. TwIRec im c i x) -> [Int] Source #

Element ls i => Element ((:!:) ls (TwIRecBt c u x mF mB r)) i Source # 

Associated Types

data Elm ((:!:) ls (TwIRecBt c u x mF mB r)) i :: * Source #

type RecElm ((:!:) ls (TwIRecBt c u x mF mB r)) i :: * Source #

type Arg ((:!:) ls (TwIRecBt c u x mF mB r)) :: * Source #

Methods

getArg :: Elm (ls :!: TwIRecBt c u x mF mB r) i -> Arg (ls :!: TwIRecBt c u x mF mB r) Source #

getIdx :: Elm (ls :!: TwIRecBt c u x mF mB r) i -> RunningIndex i Source #

getElm :: Elm (ls :!: TwIRecBt c u x mF mB r) i -> RecElm (ls :!: TwIRecBt c u x mF mB r) i Source #

Element ls i => Element ((:!:) ls (TwIRec m c u x)) i Source # 

Associated Types

data Elm ((:!:) ls (TwIRec m c u x)) i :: * Source #

type RecElm ((:!:) ls (TwIRec m c u x)) i :: * Source #

type Arg ((:!:) ls (TwIRec m c u x)) :: * Source #

Methods

getArg :: Elm (ls :!: TwIRec m c u x) i -> Arg (ls :!: TwIRec m c u x) Source #

getIdx :: Elm (ls :!: TwIRec m c u x) i -> RunningIndex i Source #

getElm :: Elm (ls :!: TwIRec m c u x) i -> RecElm (ls :!: TwIRec m c u x) i Source #

(Monad m, IndexStream i) => Axiom (TwIRec m c i x) Source # 

Associated Types

type AxiomStream (TwIRec m c i x) :: * Source #

Methods

axiom :: TwIRec m c i x -> AxiomStream (TwIRec m c i x) Source #

Build (TwIRec m c i x) Source # 

Associated Types

type Stack (TwIRec m c i x) :: * Source #

Methods

build :: TwIRec m c i x -> Stack (TwIRec m c i x) Source #

GenBacktrackTable (TwIRec mF c i x) mF mB Source # 

Associated Types

data Backtrack (TwIRec mF c i x) (mF :: * -> *) (mB :: * -> *) :: * Source #

type BacktrackIndex (TwIRec mF c i x) :: * Source #

Methods

toBacktrack :: TwIRec mF c i x -> (forall a. mF a -> mB a) -> Backtrack (TwIRec mF c i x) mF mB Source #

Build (TwIRecBt c i x mF mB r) Source # 

Associated Types

type Stack (TwIRecBt c i x mF mB r) :: * Source #

Methods

build :: TwIRecBt c i x mF mB r -> Stack (TwIRecBt c i x mF mB r) Source #

type AxiomStream (TW (Backtrack (TwIRec mF c i x) mF mB) (j -> j -> m [r])) Source # 
type AxiomStream (TW (Backtrack (TwIRec mF c i x) mF mB) (j -> j -> m [r])) = mB [r]
data Elm ((:!:) ls (TwIRecBt c u x mF mB r)) Source # 
data Elm ((:!:) ls (TwIRecBt c u x mF mB r)) = ElmBtIRec !x [r] !(RunningIndex i) !(Elm ls i)
data Elm ((:!:) ls (TwIRec m c u x)) Source # 
data Elm ((:!:) ls (TwIRec m c u x)) = ElmIRec !x !(RunningIndex i) !(Elm ls i)
type Arg ((:!:) ls (TwIRecBt c u x mF mB r)) Source # 
type Arg ((:!:) ls (TwIRecBt c u x mF mB r)) = (:.) (Arg ls) (x, [r])
type Arg ((:!:) ls (TwIRec m c u x)) Source # 
type Arg ((:!:) ls (TwIRec m c u x)) = (:.) (Arg ls) x
type BacktrackIndex (TwIRec mF c i x) Source # 
type BacktrackIndex (TwIRec mF c i x) = i
type AxiomStream (TwIRec m c i x) Source # 
type AxiomStream (TwIRec m c i x) = m x
type Stack (TwIRec m c i x) Source # 
type Stack (TwIRec m c i x) = (:!:) S (TwIRec m c i x)
type TermArg (TwIRec m c i x) Source # 
type TermArg (TwIRec m c i x) = x
data Backtrack (TwIRec mF c i x) mF Source # 
data Backtrack (TwIRec mF c i x) mF = BtIRec !c !i !i !(i -> i -> mB x)
type Stack (TwIRecBt c i x mF mB r) Source # 
type Stack (TwIRecBt c i x mF mB r) = (:!:) S (TwIRecBt c i x mF mB r)

type TwIRec m c i x = TW (IRec c i x) (i -> i -> m x) Source #

type TwIRecBt c i x mF mB r = TW (Backtrack (TwIRec mF c i x) mF mB) (i -> i -> mB [r]) Source #