Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data family Instr (instr :: ReprInstr -> Constraint) (repr :: ReprInstr) :: ReprInstr
- pattern Instr :: Typeable comb => Instr comb repr inp vs es a -> SomeInstr repr inp vs es a
- data SomeInstr repr inp vs es a = (Trans (Instr instr repr inp vs es) (repr inp vs es), Typeable instr) => SomeInstr (Instr instr repr inp vs es a)
- unSomeInstr :: forall instr repr inp vs es a. Typeable instr => SomeInstr repr inp vs es a -> Maybe (Instr instr repr inp vs es a)
Data family Instr
data family Instr (instr :: ReprInstr -> Constraint) (repr :: ReprInstr) :: ReprInstr Source #
Instances
(Readable tok repr, tok ~ InputToken inp) => Trans (Instr (Readable tok) repr inp vs es) (repr inp vs es) Source # | |
Joinable repr => Trans (Instr Joinable repr inp vs es) (repr inp vs es) Source # | |
Inputable repr => Trans (Instr Inputable repr inp vs es) (repr inp vs es) Source # | |
Failable repr => Trans (Instr Failable repr inp vs es) (repr inp vs es) Source # | |
Branchable repr => Trans (Instr Branchable repr inp vs es) (repr inp vs es) Source # | |
Defined in Symantic.Parser.Machine.Optimize trans :: Instr Branchable repr inp vs es a -> repr inp vs es a Source # | |
Routinable repr => Trans (Instr Routinable repr inp vs es) (repr inp vs es) Source # | |
Defined in Symantic.Parser.Machine.Optimize trans :: Instr Routinable repr inp vs es a -> repr inp vs es a Source # | |
Stackable repr => Trans (Instr Stackable repr inp vs es) (repr inp vs es) Source # | |
data Instr Joinable repr Source # | |
Defined in Symantic.Parser.Machine.Optimize data Instr Joinable repr where
| |
data Instr Inputable repr Source # | |
Defined in Symantic.Parser.Machine.Optimize data Instr Inputable repr where
| |
data Instr Failable repr Source # | |
Defined in Symantic.Parser.Machine.Optimize data Instr Failable repr where
| |
data Instr Branchable repr Source # | |
Defined in Symantic.Parser.Machine.Optimize data Instr Branchable repr where
| |
data Instr Routinable repr Source # | |
Defined in Symantic.Parser.Machine.Optimize data Instr Routinable repr where
| |
data Instr Stackable repr Source # | |
Defined in Symantic.Parser.Machine.Optimize data Instr Stackable repr where
| |
data Instr (Readable tok) repr Source # | |
Defined in Symantic.Parser.Machine.Optimize |
pattern Instr :: Typeable comb => Instr comb repr inp vs es a -> SomeInstr repr inp vs es a Source #
Convenient utility to pattern-match a SomeInstr
.
Type SomeInstr
data SomeInstr repr inp vs es a Source #
Some Instr
uction existantialized over the actual instruction symantic class.
Useful to handle a list of Instr
uctions
without requiring impredicative quantification.
Must be used by pattern-matching
on the SomeInstr
data-constructor,
to bring the constraints in scope.
As in SomeComb
, a first pass of optimizations
is directly applied in it
to avoid introducing an extra newtype,
this also give a more comprehensible code.
(Trans (Instr instr repr inp vs es) (repr inp vs es), Typeable instr) => SomeInstr (Instr instr repr inp vs es a) |
Instances
(Readable tok repr, Typeable tok) => Readable tok (SomeInstr repr) Source # | |
Joinable repr => Joinable (SomeInstr repr) Source # | |
Defined in Symantic.Parser.Machine.Optimize | |
Inputable repr => Inputable (SomeInstr repr) Source # | |
Defined in Symantic.Parser.Machine.Optimize | |
Failable repr => Failable (SomeInstr repr) Source # | |
Defined in Symantic.Parser.Machine.Optimize fail :: forall inp (vs :: [Type]) (es :: Peano) a. [ErrorItem (InputToken inp)] -> SomeInstr repr inp vs ('Succ es) a Source # popFail :: forall inp (vs :: [Type]) (es :: Peano) a. SomeInstr repr inp vs es a -> SomeInstr repr inp vs ('Succ es) a Source # catchFail :: forall inp (vs :: [Type]) (es :: Peano) a. SomeInstr repr inp vs ('Succ es) a -> SomeInstr repr inp (Cursor inp ': vs) es a -> SomeInstr repr inp vs es a Source # | |
Branchable repr => Branchable (SomeInstr repr) Source # | |
Defined in Symantic.Parser.Machine.Optimize caseI :: forall inp x (vs :: [Type]) (es :: Peano) r y. SomeInstr repr inp (x ': vs) es r -> SomeInstr repr inp (y ': vs) es r -> SomeInstr repr inp (Either x y ': vs) es r Source # choices :: forall v inp (vs :: [Type]) (es :: Peano) a. [TermInstr (v -> Bool)] -> [SomeInstr repr inp vs es a] -> SomeInstr repr inp vs es a -> SomeInstr repr inp (v ': vs) es a Source # ifI :: forall inp (vs :: [Type]) (es :: Peano) a. SomeInstr repr inp vs es a -> SomeInstr repr inp vs es a -> SomeInstr repr inp (Bool ': vs) es a Source # | |
Routinable repr => Routinable (SomeInstr repr) Source # | |
Defined in Symantic.Parser.Machine.Optimize subroutine :: forall v inp (vs :: [Type]) (es :: Peano) a. LetName v -> SomeInstr repr inp '[] ('Succ 'Zero) v -> SomeInstr repr inp vs ('Succ es) a -> SomeInstr repr inp vs ('Succ es) a Source # call :: forall v inp (vs :: [Type]) (es :: Peano) a. LetName v -> SomeInstr repr inp (v ': vs) ('Succ es) a -> SomeInstr repr inp vs ('Succ es) a Source # ret :: forall inp a (es :: Peano). SomeInstr repr inp '[a] es a Source # jump :: forall a inp (es :: Peano). LetName a -> SomeInstr repr inp '[] ('Succ es) a Source # | |
Stackable repr => Stackable (SomeInstr repr) Source # | |
Defined in Symantic.Parser.Machine.Optimize push :: forall v inp (vs :: [Type]) (es :: Peano) a. TermInstr v -> SomeInstr repr inp (v ': vs) es a -> SomeInstr repr inp vs es a Source # pop :: forall inp (vs :: [Type]) (es :: Peano) a v. SomeInstr repr inp vs es a -> SomeInstr repr inp (v ': vs) es a Source # liftI2 :: forall x y z inp (vs :: [Type]) (es :: Peano) a. TermInstr (x -> y -> z) -> SomeInstr repr inp (z ': vs) es a -> SomeInstr repr inp (y ': (x ': vs)) es a Source # swap :: forall inp x y (vs :: [Type]) (es :: Peano) a. SomeInstr repr inp (x ': (y ': vs)) es a -> SomeInstr repr inp (y ': (x ': vs)) es a Source # mapI :: forall x y inp (vs :: [Type]) (es :: Peano) a. TermInstr (x -> y) -> SomeInstr repr inp (y ': vs) es a -> SomeInstr repr inp (x ': vs) es a Source # appI :: forall inp y (vs :: [Type]) (es :: Peano) a x. SomeInstr repr inp (y ': vs) es a -> SomeInstr repr inp (x ': ((x -> y) ': vs)) es a Source # | |
Trans (SomeInstr repr inp vs es) (repr inp vs es) Source # | |
Defined in Symantic.Parser.Machine.Optimize |