Remove unnecessary parameter on Space

This commit is contained in:
Kiana Sheibani 2021-12-20 15:28:11 -05:00
parent 2f74cb258e
commit 19f3edc49e
2 changed files with 7 additions and 8 deletions

View file

@ -11,10 +11,10 @@ import GOL.Space
type GOL f = EnvT Rule (Store f)
getNeighbors :: forall s f a. Space s f => GOL f a -> [a]
getNeighbors = experiment $ neighbors @s @f
getNeighbors :: forall f a. Space f => GOL f a -> [a]
getNeighbors = experiment $ neighbors @f
nextState :: Space s f => GOL f Bool -> Bool
nextState :: Space f => GOL f Bool -> Bool
nextState = do
selfState <- extract
neighborStates <- getNeighbors
@ -26,5 +26,5 @@ nextState = do
else birth count
tick :: Space s f => GOL f Bool -> GOL f Bool
tick :: Space f => GOL f Bool -> GOL f Bool
tick = extend nextState

View file

@ -1,14 +1,13 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
module GOL.Space where
import Data.Functor.Rep
class (Representable f, Rep f ~ s) => Space s f where
neighbors :: s -> [s]
class Representable f => Space f where
neighbors :: Rep f -> [Rep f]
class (Space (Int, Int) f) => DisplayableSpace f where
class (Space f, Rep f ~ (Int, Int)) => DisplayableSpace f where
size :: (Int, Int)