swarm-0.7.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellNone
LanguageHaskell2010

Swarm.Game.World.Compile

Description

Compiling abstracted combinator expressions (BTerm) to native Haskell terms. This can supposedly be more efficient than directly interpreting BTerms, 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

Documentation

data CTerm a where Source #

Constructors

CFun :: forall a1 b. (CTerm a1 -> CTerm b) -> CTerm (a1 -> b) 
CConst :: forall a. NotFun a => a -> CTerm a 

Instances

Instances details
Applicable CTerm Source # 
Instance details

Defined in Swarm.Game.World.Compile

Methods

($$) :: CTerm (a -> b) -> CTerm a -> CTerm b Source #

unary :: (NotFun a, NotFun b) => (a -> b) -> CTerm (a -> b) Source #

binary :: (NotFun a, NotFun b, NotFun c) => (a -> b -> c) -> CTerm (a -> b -> c) Source #

compileHash :: Seed -> CTerm (Coords -> Integer) Source #

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.