From 19f3edc49e61ac7f6773554f955666e29b943656 Mon Sep 17 00:00:00 2001 From: kiana-S Date: Mon, 20 Dec 2021 15:28:11 -0500 Subject: [PATCH] Remove unnecessary parameter on Space --- GOL/Engine.hs | 8 ++++---- GOL/Space.hs | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/GOL/Engine.hs b/GOL/Engine.hs index 46fdbb2..77cabaa 100644 --- a/GOL/Engine.hs +++ b/GOL/Engine.hs @@ -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 \ No newline at end of file diff --git a/GOL/Space.hs b/GOL/Space.hs index 303aef0..6bc231d 100644 --- a/GOL/Space.hs +++ b/GOL/Space.hs @@ -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) \ No newline at end of file