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

Safe HaskellNone
LanguageHaskell2010

ADP.Fusion.Core.Multi

Contents

Synopsis

Multi-dimensional extension

data M Source #

Terminates a multi-dimensional terminal symbol stack.

Constructors

M 

Instances

Eq M Source # 

Methods

(==) :: M -> M -> Bool #

(/=) :: M -> M -> Bool #

Show M Source # 

Methods

showsPrec :: Int -> M -> ShowS #

show :: M -> String #

showList :: [M] -> ShowS #

TermStaticVar M Z Source # 
Monad m => TermStream m M s Z Source # 

Methods

termStream :: M -> Context Z -> Z -> Z -> Stream m (TermState s Z Z) -> Stream m (TermState s Z (TermArg M)) Source #

type TermArg M Source # 
type TermArg M = Z

data TermSymbol a b Source #

Terminal symbols are stacked together with a tails and b head.

Constructors

a :| b infixl 2 

Instances

(SplitIxCol uId (SameSid uId (Elm ls i)) (Elm ls i), Zconcat (SplitIxTy uId (SameSid uId (Elm ls i)) (Elm ls i)) (SplitIxTy uId (SameSid uId (TermSymbol a b)) (TermSymbol a b))) => SplitIxCol uId True (Elm ((:!:) ls (TermSymbol a b)) i) Source # 

Associated Types

type SplitIxTy (uId :: Symbol) (True :: Bool) (Elm ((:!:) ls (TermSymbol a b)) i) :: * Source #

Methods

splitIxCol :: Proxy Symbol uId -> Proxy Bool True -> Elm (ls :!: TermSymbol a b) i -> SplitIxTy uId True (Elm (ls :!: TermSymbol a b) i) Source #

(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 # 

Methods

mkStream :: (ls :!: TermSymbol a b) -> Context i -> i -> i -> Stream m (Elm (ls :!: TermSymbol a b) i) Source #

(Eq b, Eq a) => Eq (TermSymbol a b) Source # 

Methods

(==) :: TermSymbol a b -> TermSymbol a b -> Bool #

(/=) :: TermSymbol a b -> TermSymbol a b -> Bool #

(Show i, Show (RunningIndex i), Show (TermArg (TermSymbol a b)), Show (Elm ls i)) => Show (Elm ((:!:) ls (TermSymbol a b)) i) Source # 

Methods

showsPrec :: Int -> Elm (ls :!: TermSymbol a b) i -> ShowS #

show :: Elm (ls :!: TermSymbol a b) i -> String #

showList :: [Elm (ls :!: TermSymbol a b) i] -> ShowS #

(Show b, Show a) => Show (TermSymbol a b) Source # 

Methods

showsPrec :: Int -> TermSymbol a b -> ShowS #

show :: TermSymbol a b -> String #

showList :: [TermSymbol a b] -> ShowS #

Build (TermSymbol a b) Source # 

Associated Types

type Stack (TermSymbol a b) :: * Source #

Methods

build :: TermSymbol a b -> Stack (TermSymbol a b) Source #

Element ls i => Element ((:!:) ls (TermSymbol a b)) i Source # 

Associated Types

data Elm ((:!:) ls (TermSymbol a b)) i :: * Source #

type RecElm ((:!:) ls (TermSymbol a b)) i :: * Source #

type Arg ((:!:) ls (TermSymbol a b)) :: * Source #

Methods

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 #

(TermStaticVar a is, TermStaticVar b i) => TermStaticVar (TermSymbol a b) ((:.) is i) Source # 

Methods

termStaticVar :: TermSymbol a b -> Context (is :. i) -> (is :. i) -> Context (is :. i) Source #

termStreamIndex :: TermSymbol a b -> Context (is :. i) -> (is :. i) -> is :. i Source #

type SplitIxTy uId True (Elm ((:!:) ls (TermSymbol a b)) i) Source # 
type SplitIxTy uId True (Elm ((:!:) ls (TermSymbol a b)) i) = Zpp (SplitIxTy uId (SameSid uId (Elm ls i)) (Elm ls i)) (SplitIxTy uId (SameSid uId (TermSymbol a b)) (TermSymbol a b))
type Stack (TermSymbol a b) Source # 
type Stack (TermSymbol a b) = (:!:) S (TermSymbol a b)
data Elm ((:!:) ls (TermSymbol a b)) Source # 
data Elm ((:!:) ls (TermSymbol a b)) = ElmTS !(TermArg (TermSymbol a b)) !(RunningIndex i) !(Elm ls i)
type Arg ((:!:) ls (TermSymbol a b)) Source # 
type Arg ((:!:) ls (TermSymbol a b)) = (:.) (Arg ls) (TermArg (TermSymbol a b))
type TermArg (TermSymbol a b) Source # 
type TermArg (TermSymbol a b) = (:.) (TermArg a) (TermArg b)

type family TermArg x :: * Source #

Extracts the type of a multi-dimensional terminal argument.

Instances

type TermArg M Source # 
type TermArg M = Z
type TermArg Deletion Source # 
type TermArg Deletion = ()
type TermArg Edge Source # 
type TermArg Epsilon Source # 
type TermArg Epsilon = ()
type TermArg (PeekIndex i) Source # 
type TermArg (TermSymbol a b) Source # 
type TermArg (TermSymbol a b) = (:.) (TermArg a) (TermArg b)
type TermArg (Chr r x) Source # 
type TermArg (Chr r x) = r
type TermArg (Strng v x) Source # 
type TermArg (Strng v x) = v x
type TermArg (TwIRec m c i x) Source # 
type TermArg (TwIRec m c i x) = x
type TermArg (TwITbl m arr c i x) Source # 
type TermArg (TwITbl m arr c i x) = x
type TermArg (TwITblBt arr c i x mF mB r) Source # 
type TermArg (TwITblBt arr c i x mF mB r) = (x, [r])

class TermStaticVar t i where Source #

For multi-dimensional terminals we need to be able to calculate how the static/variable signal changes and if the index for the inner part needs to be modified.

Minimal complete definition

termStaticVar, termStreamIndex

Methods

termStaticVar :: t -> Context i -> i -> Context i Source #

termStreamIndex :: t -> Context i -> i -> i Source #

Instances

TermStaticVar M Z Source # 
(TermStaticVar a is, TermStaticVar b i) => TermStaticVar (TermSymbol a b) ((:.) is i) Source # 

Methods

termStaticVar :: TermSymbol a b -> Context (is :. i) -> (is :. i) -> Context (is :. i) Source #

termStreamIndex :: TermSymbol a b -> Context (is :. i) -> (is :. i) -> is :. i Source #

class TableStaticVar u c i where Source #

Minimal complete definition

tableStaticVar, tableStreamIndex

Methods

tableStaticVar :: Proxy u -> c -> Context i -> i -> Context i Source #

tableStreamIndex :: Proxy u -> c -> Context i -> i -> i Source #

Instances

TableStaticVar c u Z Source # 

Methods

tableStaticVar :: Proxy * c -> u -> Context Z -> Z -> Context Z Source #

tableStreamIndex :: Proxy * c -> u -> Context Z -> Z -> Z Source #

(TableStaticVar us cs is, TableStaticVar u c i) => TableStaticVar ((:.) us u) ((:.) cs c) ((:.) is i) Source # 

Methods

tableStaticVar :: Proxy * (us :. u) -> (cs :. c) -> Context (is :. i) -> (is :. i) -> Context (is :. i) Source #

tableStreamIndex :: Proxy * (us :. u) -> (cs :. c) -> Context (is :. i) -> (is :. i) -> is :. i Source #

data TermState s i e Source #

Constructors

TState 

Fields

  • tS :: !s

    state coming in from the left , tIx :: !(RunningIndex a) -- I/C index from sS

  • iIx :: !(RunningIndex i)

    I/C building up state to hand over to next symbol

  • eTS :: !e

    element data

class TermStream m t s i where Source #

Minimal complete definition

termStream

Methods

termStream :: t -> Context i -> i -> i -> Stream m (TermState s Z Z) -> Stream m (TermState s i (TermArg t)) Source #

Instances

Monad m => TermStream m M s Z Source # 

Methods

termStream :: M -> Context Z -> Z -> Z -> Stream m (TermState s Z Z) -> Stream m (TermState s Z (TermArg M)) Source #

addTermStream1 :: (Monad m, TermStream m (TermSymbol M t) (Elm (Term1 s) (Z :. i)) (Z :. i)) => t -> Context i -> i -> i -> Stream m s -> Stream m (s, TermArg t, RunningIndex i) Source #

TODO need t -> ElmType t type function

TODO need to actually return an ElmType t can do that instead of returning u !!!

newtype Term1 s Source #

Constructors

Term1 s 

Instances

((~) * s (Elm x0 i), Element x0 i) => Element (Term1 s) ((:.) Z i) Source # 

Associated Types

data Elm (Term1 s) ((:.) Z i) :: * Source #

type RecElm (Term1 s) ((:.) Z i) :: * Source #

type Arg (Term1 s) :: * Source #

Methods

getArg :: Elm (Term1 s) (Z :. i) -> Arg (Term1 s) Source #

getIdx :: Elm (Term1 s) (Z :. i) -> RunningIndex (Z :. i) Source #

getElm :: Elm (Term1 s) (Z :. i) -> RecElm (Term1 s) (Z :. i) Source #

data Elm (Term1 s) ((:.) Z i) Source # 
data Elm (Term1 s) ((:.) Z i) = ElmTerm1 s

elmTerm1 :: s -> i -> Elm (Term1 s) (Z :. i) Source #

type TmkCtx1 m ls t i = (Monad m, MkStream m ls i, TermStream m (TermSymbol M t) (Elm (Term1 (Elm ls i)) (Z :. i)) (Z :. i), Element ls i, TermStaticVar t i) Source #

Term MkStream context

type TstCtx m ts s x0 sixty is i = (Monad m, TermStream m ts s is, GetIndex (RunningIndex sixty) (RunningIndex (is :. i)), GetIx (RunningIndex sixty) (RunningIndex (is :. i)) ~ RunningIndex i, Element x0 sixty, s ~ Elm x0 sixty) Source #

Term TermStream context

type PRI is i = Proxy (RunningIndex (is :. i)) Source #

Shorthand for proxifying getIndex

Orphan instances

RuleContext Z Source # 

Associated Types

type Context Z :: * Source #

Monad m => MkStream m S Z Source # 

Methods

mkStream :: S -> Context Z -> Z -> Z -> Stream m (Elm S Z) Source #

(RuleContext is, RuleContext i) => RuleContext ((:.) is i) Source # 

Associated Types

type Context ((:.) is i) :: * Source #

Methods

initialContext :: (is :. i) -> Context (is :. i) Source #