@@ -26,8 +26,7 @@ module Task
2626 )
2727where
2828
29−import Data.Char
30−import Data.List
29+import Data.List (intersperse)
3130
3231-- ____ _____ _ _ _
3332-- | __ )| ___| (_)_ __ | |_ ___ _ __ _ __ _ __ ___| |_ ___ _ __
@@ -70,7 +69,7 @@ data Tape a
7069 tapeValue :: a,
7170 rightTape :: [a]
7271 }
73− deriving (Eq, Ord)
72+ deriving stock (Eq, Ord)
7473
7574-- We need a special instance to handle infinite tapes. The derived
7675-- implementation would go into an infinite loop.
@@ -84,6 +83,7 @@ instance Show a => Show (Tape a) where
8483 <> tapeify (take 5 right)
8584 <> "]"
8685 where
86+ tapeify :: Show x => [x] -> String
8787 tapeify = mconcat . intersperse " " . fmap show
8888
8989-- | Creates a tape from a list.
@@ -186,7 +186,7 @@ data BFState
186186 -- | The output stream of the BF interpreter.
187187 bfOutput :: [Int]
188188 }
189− deriving (Eq, Show)
189+ deriving stock (Eq, Show)
190190
191191-- | This represents the errors that can occur while executing a BF program.
192192data BFError
@@ -194,7 +194,7 @@ data BFError
194194 NotEnoughInput
195195 | -- | Tried going past the end of the data tape (if it was finite).
196196 DataTapeExhausted
197− deriving (Show, Eq)
197+ deriving stock (Show, Eq)
198198
199199-- | The monad in which we will interpreting the BF commands.
200200type BFMonad a = ErrorState BFError BFState a
@@ -259,7 +259,7 @@ data BFCommand
259259 ReadInput
260260 | -- | The `.` command.
261261 WriteOutput
262− deriving (Eq, Show)
262+ deriving stock (Eq, Show)
263263
264264type BFProgram = [BFCommand]
265265