Safe Haskell | None |
---|---|
Language | Haskell2010 |
Haskell terms which are interesting to pattern-match when optimizing.
Synopsis
- class Termable repr where
- (.@) :: repr (a -> b) -> repr a -> repr b
- lam :: (repr a -> repr b) -> repr (a -> b)
- lam1 :: (repr a -> repr b) -> repr (a -> b)
- bool :: Bool -> repr Bool
- char :: (Lift tok, Show tok) => tok -> repr tok
- cons :: repr (a -> [a] -> [a])
- nil :: repr [a]
- eq :: Eq a => repr (a -> a -> Bool)
- unit :: repr ()
- left :: repr (l -> Either l r)
- right :: repr (r -> Either l r)
- nothing :: repr (Maybe a)
- just :: repr (a -> Maybe a)
- const :: repr (a -> b -> a)
- flip :: repr ((a -> b -> c) -> b -> a -> c)
- id :: repr (a -> a)
- (.) :: repr ((b -> c) -> (a -> b) -> a -> c)
- ($) :: repr ((a -> b) -> a -> b)
- data ValueCode a = ValueCode {}
Class Termable
class Termable repr where Source #
Single-out some Haskell terms in order to
Nothing
(.@) :: repr (a -> b) -> repr a -> repr b infixl 9 Source #
Application, aka. unabstract.
lam :: (repr a -> repr b) -> repr (a -> b) Source #
Lambda term abstraction, in HOAS (Higher-Order Abstract Syntax) style.
lam1 :: (repr a -> repr b) -> repr (a -> b) Source #
Like lam
but whose argument is used only once,
hence safe to beta-reduce (inline) without duplicating work.
bool :: Bool -> repr Bool Source #
char :: (Lift tok, Show tok) => tok -> repr tok Source #
cons :: repr (a -> [a] -> [a]) Source #
eq :: Eq a => repr (a -> a -> Bool) Source #
left :: repr (l -> Either l r) Source #
right :: repr (r -> Either l r) Source #
nothing :: repr (Maybe a) Source #
just :: repr (a -> Maybe a) Source #
const :: repr (a -> b -> a) Source #
flip :: repr ((a -> b -> c) -> b -> a -> c) Source #
(.) :: repr ((b -> c) -> (a -> b) -> a -> c) infixr 9 Source #
($) :: repr ((a -> b) -> a -> b) infixr 0 Source #
(.@) :: Liftable2 repr => Termable (Output repr) => repr (a -> b) -> repr a -> repr b infixl 9 Source #
Application, aka. unabstract.
lam :: Liftable repr => Unliftable repr => Termable (Output repr) => (repr a -> repr b) -> repr (a -> b) Source #
Lambda term abstraction, in HOAS (Higher-Order Abstract Syntax) style.
lam1 :: Liftable repr => Unliftable repr => Termable (Output repr) => (repr a -> repr b) -> repr (a -> b) Source #
Like lam
but whose argument is used only once,
hence safe to beta-reduce (inline) without duplicating work.
bool :: Liftable repr => Termable (Output repr) => Bool -> repr Bool Source #
char :: Liftable repr => Termable (Output repr) => Lift tok => Show tok => tok -> repr tok Source #
cons :: Liftable repr => Termable (Output repr) => repr (a -> [a] -> [a]) Source #
nil :: Liftable repr => Termable (Output repr) => repr [a] Source #
eq :: Liftable repr => Termable (Output repr) => Eq a => repr (a -> a -> Bool) Source #
unit :: Liftable repr => Termable (Output repr) => repr () Source #
left :: Liftable repr => Termable (Output repr) => repr (l -> Either l r) Source #
right :: Liftable repr => Termable (Output repr) => repr (r -> Either l r) Source #
nothing :: Liftable repr => Termable (Output repr) => repr (Maybe a) Source #
just :: Liftable repr => Termable (Output repr) => repr (a -> Maybe a) Source #
const :: Liftable repr => Termable (Output repr) => repr (a -> b -> a) Source #
flip :: Liftable repr => Termable (Output repr) => repr ((a -> b -> c) -> b -> a -> c) Source #
id :: Liftable repr => Termable (Output repr) => repr (a -> a) Source #
(.) :: Liftable repr => Termable (Output repr) => repr ((b -> c) -> (a -> b) -> a -> c) infixr 9 Source #
($) :: Liftable repr => Termable (Output repr) => repr ((a -> b) -> a -> b) infixr 0 Source #
Instances
Type ValueCode
Instances
Termable ValueCode Source # | |
Defined in Symantic.Parser.Haskell.Term (.@) :: ValueCode (a -> b) -> ValueCode a -> ValueCode b Source # lam :: (ValueCode a -> ValueCode b) -> ValueCode (a -> b) Source # lam1 :: (ValueCode a -> ValueCode b) -> ValueCode (a -> b) Source # bool :: Bool -> ValueCode Bool Source # char :: (Lift tok, Show tok) => tok -> ValueCode tok Source # cons :: ValueCode (a -> [a] -> [a]) Source # eq :: Eq a => ValueCode (a -> a -> Bool) Source # left :: ValueCode (l -> Either l r) Source # right :: ValueCode (r -> Either l r) Source # nothing :: ValueCode (Maybe a) Source # just :: ValueCode (a -> Maybe a) Source # const :: ValueCode (a -> b -> a) Source # flip :: ValueCode ((a -> b -> c) -> b -> a -> c) Source # id :: ValueCode (a -> a) Source # | |
Trans (Term ValueCode) ValueCode Source # | |
Trans (Term (CodeQ :: Type -> Type)) (Term ValueCode) Source # | |
Trans (Term ValueCode) (Term (CodeQ :: Type -> Type)) Source # | |