Add getSpace utility function
This commit is contained in:
parent
64fd7d3afc
commit
42ec44a6f8
|
@ -24,9 +24,10 @@ gol r p s = EnvT r $ StoreT (Identity s) p
|
||||||
-- | Construct a 'GOL' value on a displayable space,
|
-- | Construct a 'GOL' value on a displayable space,
|
||||||
-- defaulting to an initial position of @(0, 0)@.
|
-- defaulting to an initial position of @(0, 0)@.
|
||||||
gol' :: DisplayableSpace f => Rule -> f a -> GOL f a
|
gol' :: DisplayableSpace f => Rule -> f a -> GOL f a
|
||||||
gol' r = gol r (0,0)
|
gol' r = gol r (0, 0)
|
||||||
|
|
||||||
|
|
||||||
|
getSpace :: GOL f a -> f a
|
||||||
|
getSpace (EnvT _ (StoreT (Identity s) _)) = s
|
||||||
|
|
||||||
getNeighbors :: forall f a. Space f => GOL f a -> [a]
|
getNeighbors :: forall f a. Space f => GOL f a -> [a]
|
||||||
getNeighbors = experiment $ neighbors @f
|
getNeighbors = experiment $ neighbors @f
|
||||||
|
|
Loading…
Reference in a new issue