Safe Haskell | None |
---|---|
Language | Haskell2010 |
Bottom-up optimization of Comb
inators,
reexamining downward as needed after each optimization.
Synopsis
- type OptimizeGrammar = SomeComb
- optimizeGrammar :: Trans (SomeComb repr) repr => SomeComb repr a -> repr a
- data family Comb (comb :: ReprComb -> Constraint) (repr :: ReprComb) :: ReprComb
- pattern Comb :: Typeable comb => Comb comb repr a -> SomeComb repr a
- type ReprComb = Type -> Type
- data SomeComb repr a = (Trans (Comb comb repr) repr, Typeable comb) => SomeComb (Comb comb repr a)
- unSomeComb :: forall comb repr a. Typeable comb => SomeComb repr a -> Maybe (Comb comb repr a)
- pattern (:<$>:) :: TermGrammar (a -> b) -> SomeComb repr a -> Comb Applicable repr b
- pattern (:$>:) :: SomeComb repr a -> TermGrammar b -> Comb Applicable repr b
Type OptimizeGrammar
type OptimizeGrammar = SomeComb Source #
Data family Comb
data family Comb (comb :: ReprComb -> Constraint) (repr :: ReprComb) :: ReprComb infixl 4 :*>:, :<*:, :<*>:infixl 3 :<|>: Source #
Comb
inators of the Grammar
.
This is an extensible data-type.
Instances
pattern Comb :: Typeable comb => Comb comb repr a -> SomeComb repr a Source #
Convenient utility to pattern-match a SomeComb
.
Type ReprComb
Type SomeComb
Some Comb
inator existentialized over the actual combinator symantic class.
Useful to handle a list of Comb
inators
without requiring impredicative quantification.
Must be used by pattern-matching
on the SomeComb
data-constructor,
to bring the constraints in scope.
The optimizations are directly applied within it, to avoid introducing an extra newtype, this also give a more comprehensible code.
Instances
unSomeComb :: forall comb repr a. Typeable comb => SomeComb repr a -> Maybe (Comb comb repr a) Source #
pattern (:<$>:) :: TermGrammar (a -> b) -> SomeComb repr a -> Comb Applicable repr b Source #
pattern (:$>:) :: SomeComb repr a -> TermGrammar b -> Comb Applicable repr b Source #
Orphan instances
MakeLetName Name Source # | |
makeLetName :: SharingName -> IO Name Source # |