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)
|
type GOL f = EnvT Rule (Store f)
|
||||||
|
|
||||||
getNeighbors :: forall s f a. Space s f => GOL f a -> [a]
|
getNeighbors :: forall f a. Space f => GOL f a -> [a]
|
||||||
getNeighbors = experiment $ neighbors @s @f
|
getNeighbors = experiment $ neighbors @f
|
||||||
|
|
||||||
nextState :: Space s f => GOL f Bool -> Bool
|
nextState :: Space f => GOL f Bool -> Bool
|
||||||
nextState = do
|
nextState = do
|
||||||
selfState <- extract
|
selfState <- extract
|
||||||
neighborStates <- getNeighbors
|
neighborStates <- getNeighbors
|
||||||
|
@ -26,5 +26,5 @@ nextState = do
|
||||||
else birth count
|
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
|
tick = extend nextState
|
|
@ -1,14 +1,13 @@
|
||||||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
|
|
||||||
module GOL.Space where
|
module GOL.Space where
|
||||||
|
|
||||||
import Data.Functor.Rep
|
import Data.Functor.Rep
|
||||||
|
|
||||||
class (Representable f, Rep f ~ s) => Space s f where
|
class Representable f => Space f where
|
||||||
neighbors :: s -> [s]
|
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)
|
size :: (Int, Int)
|
Loading…
Reference in a new issue