License | BSD-3-Clause |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Swarm.Game.World.Compile
Description
Compiling abstracted combinator expressions (BTerm
) to native
Haskell terms. This can supposedly be more efficient than directly
interpreting BTerm
s, but some benchmarking is probably needed to
decide whether we want this or not.
For more info, see:
https://byorgey.wordpress.com/2023/07/13/compiling-to-intrinsically-typed-combinators/
Synopsis
- data CTerm a where
- compile :: Seed -> BTerm a -> CTerm a
- compileConst :: Seed -> Const a -> CTerm a
- unary :: (NotFun a, NotFun b) => (a -> b) -> CTerm (a -> b)
- binary :: (NotFun a, NotFun b, NotFun c) => (a -> b -> c) -> CTerm (a -> b -> c)
- compileMask :: (NotFun a, Empty a) => CTerm (World Bool -> World a -> World a)
- compileHash :: CTerm (Coords -> Integer)
- compilePerlin :: CTerm (Integer -> Integer -> Double -> Double -> World Double)
- compileReflect :: Axis -> CTerm (World a -> World a)
- compileRot :: Rot -> CTerm (World a -> World a)
- type family NoFunParams a :: Constraint where ...
- runCTerm :: NoFunParams a => CTerm a -> a
Documentation
type family NoFunParams a :: Constraint where ... Source #
Equations
NoFunParams (a -> b) = (NotFun a, NoFunParams b) | |
NoFunParams _ = () |
runCTerm :: NoFunParams a => CTerm a -> a Source #
Interpret a compiled term into the host language.