Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Stack-based VM as a category, enabling compilation from Haskell.
Synopsis
- newtype StackFun a b = SF (forall z. (a :* z) -> b :* z)
- unSF :: StackFun a b -> forall z. (a :* z) -> b :* z
- inSF :: ((forall z. (a :* z) -> b :* z) -> forall z. (c :* z) -> d :* z) -> StackFun a b -> StackFun c d
- inSF2 :: ((forall z. (a :* z) -> b :* z) -> (forall z. (c :* z) -> d :* z) -> forall z. (p :* z) -> q :* z) -> StackFun a b -> StackFun c d -> StackFun p q
- stackFun :: (a -> b) -> StackFun a b
- evalStackFun :: StackFun a b -> a -> b
- data Prim :: * -> * -> * where
- Swap :: Prim (a :* b) (b :* a)
- Exl :: Prim (a :* b) a
- Exr :: Prim (a :* b) b
- Dup :: Prim a (a :* a)
- Const :: Show b => b -> Prim a b
- Negate :: Num a => Prim a a
- Add, Sub, Mul :: Num a => Prim (a :* a) a
- PowI :: Num a => Prim (a :* Int) a
- (:+++) :: StackOps a c -> StackOps b d -> Prim (a :+ b) (c :+ d)
- Apply :: Prim ((a -> b) :* a) b
- Curry :: StackProg (a :* b) c -> Prim a (b -> c)
- evalPrim :: Prim a b -> a -> b
- data StackOp :: * -> * -> * where
- evalStackOp :: StackOp u v -> u -> v
- data StackOps :: * -> * -> * where
- toList :: forall z a b. (forall u v. StackOp u v -> z) -> StackOps a b -> [z]
- evalStackOps :: StackOps a b -> a -> b
- (++*) :: StackOps a b -> StackOps b c -> StackOps a c
- data StackProg a b = SP {}
- primProg :: Prim a b -> StackProg a b
- progFun :: StackProg a b -> StackFun a b
- evalProg :: StackProg a b -> a -> b
- data Exists2 k = forall a b. Exists2 (a `k` b)
- t1 :: StackProg (Int :* Int) Int
- t2 :: StackProg Int Int
Documentation
Instances
inSF :: ((forall z. (a :* z) -> b :* z) -> forall z. (c :* z) -> d :* z) -> StackFun a b -> StackFun c d Source #
inSF2 :: ((forall z. (a :* z) -> b :* z) -> (forall z. (c :* z) -> d :* z) -> forall z. (p :* z) -> q :* z) -> StackFun a b -> StackFun c d -> StackFun p q Source #
evalStackFun :: StackFun a b -> a -> b Source #
data Prim :: * -> * -> * where Source #
Swap :: Prim (a :* b) (b :* a) | |
Exl :: Prim (a :* b) a | |
Exr :: Prim (a :* b) b | |
Dup :: Prim a (a :* a) | |
Const :: Show b => b -> Prim a b | |
Negate :: Num a => Prim a a | |
Add, Sub, Mul :: Num a => Prim (a :* a) a | |
PowI :: Num a => Prim (a :* Int) a | |
(:+++) :: StackOps a c -> StackOps b d -> Prim (a :+ b) (c :+ d) | |
Apply :: Prim ((a -> b) :* a) b | |
Curry :: StackProg (a :* b) c -> Prim a (b -> c) |
data StackOp :: * -> * -> * where Source #
Pure :: Prim a b -> StackOp (a :* z) (b :* z) | |
Push :: StackOp ((a :* b) :* z) (a :* (b :* z)) | |
Pop :: StackOp (a :* (b :* z)) ((a :* b) :* z) |
evalStackOp :: StackOp u v -> u -> v Source #
evalStackOps :: StackOps a b -> a -> b Source #
Instances
forall a b. Exists2 (a `k` b) |