License | BSD-3-Clause |
---|---|
Safe Haskell | None |
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 :: Seed -> CTerm (Coords -> Integer)
- compilePerlin :: CTerm (Integer -> Integer -> Double -> Double -> World Double)
- compileIMap :: NotFun a => CTerm (World Integer -> World Integer -> World a -> World a)
- type family NoFunParams a where ...
- runCTerm :: NoFunParams a => CTerm a -> a
Documentation
type family NoFunParams a where ... Source #
Equations
NoFunParams (a -> b) = (NotFun a, NoFunParams b) | |
NoFunParams _1 = () |
runCTerm :: NoFunParams a => CTerm a -> a Source #
Interpret a compiled term into the host language.