From 0ada5a1833d263689d2f29eabf203a1eb163f84d Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Mon, 17 Sep 2018 18:47:15 +0100 Subject: [PATCH] Tweaked comments --- src/task1/task1-mpc.hs | 6 +++++- src/task1/task1.hs | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/task1/task1-mpc.hs b/src/task1/task1-mpc.hs index a8a3ccb..e2127b6 100644 --- a/src/task1/task1-mpc.hs +++ b/src/task1/task1-mpc.hs @@ -16,13 +16,15 @@ import qualified Control.Applicative as CA -- number of steps type Distance = Int + +-- easting, northing type Position = (Int, Int) -- the directions. See below for functions for turning data Direction = North | East | South | West deriving (Enum, Show, Bounded, Eq) --- direction, easting, northing +-- The currenct state of a Mowmaster data Mowmaster = Mowmaster { direction :: Direction , position :: Position } deriving (Show, Eq) @@ -99,6 +101,8 @@ symb = L.symbol sc -- instructions is some optional space followed by many instructions instrsP = optional sc *> many instrP + +-- an instruction is either F, C, or A instrP = forwardP <|> cwP <|> acwP -- parse each instruction diff --git a/src/task1/task1.hs b/src/task1/task1.hs index 071fe68..e7a4f4b 100644 --- a/src/task1/task1.hs +++ b/src/task1/task1.hs @@ -2,13 +2,15 @@ import Data.List (foldl') -- import the strict fold -- number of steps type Distance = Int + +-- easting, northing type Position = (Int, Int) -- the directions. See below for functions for turning data Direction = North | East | South | West deriving (Enum, Show, Bounded, Eq) --- direction, easting, northing +-- the currenct state of a Mowmaster data Mowmaster = Mowmaster { direction :: Direction , position :: Position } deriving (Show, Eq) -- 2.34.1