add code stack

This commit is contained in:
Rowan Torbitzky-Lane 2025-01-20 23:22:58 -06:00
parent 4e42c4332b
commit 2ca1f0fe94

View File

@ -1,8 +1,9 @@
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module State where module State where
import qualified Data.Map as Map
import Control.Lens import Control.Lens
import Data.Map qualified as Map
-- The exec stack must store heterogenous types, -- The exec stack must store heterogenous types,
-- and we must be able to detect that type at runtime. -- and we must be able to detect that type at runtime.
@ -47,6 +48,7 @@ instance Show Gene where
data State = State data State = State
{ _exec :: [Gene], { _exec :: [Gene],
_code :: [Gene],
_int :: [Int], _int :: [Int],
_float :: [Float], _float :: [Float],
_bool :: [Bool], _bool :: [Bool],
@ -64,6 +66,7 @@ emptyState :: State
emptyState = emptyState =
State State
{ _exec = [], { _exec = [],
_code = [],
_int = [], _int = [],
_float = [], _float = [],
_bool = [], _bool = [],
@ -78,6 +81,7 @@ exampleState :: State
exampleState = exampleState =
State State
{ _exec = [], { _exec = [],
_code = [],
_int = [32, 56], _int = [32, 56],
_float = [3.23, 9.235], _float = [3.23, 9.235],
_bool = [True, False], _bool = [True, False],