Remove unnecessary parameter on Space
This commit is contained in:
parent
2f74cb258e
commit
19f3edc49e
|
@ -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
|
|
@ -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)
|
Loading…
Reference in a new issue