diff options
Diffstat (limited to 'src/Xanthous/Data.hs')
-rw-r--r-- | src/Xanthous/Data.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Xanthous/Data.hs b/src/Xanthous/Data.hs index 704b3c6e74c4..afba273005f8 100644 --- a/src/Xanthous/Data.hs +++ b/src/Xanthous/Data.hs @@ -135,6 +135,7 @@ data Direction where UpRight :: Direction DownLeft :: Direction DownRight :: Direction + Here :: Direction deriving stock (Show, Eq, Generic) instance Arbitrary Direction where @@ -150,6 +151,7 @@ opposite UpLeft = DownRight opposite UpRight = DownLeft opposite DownLeft = UpRight opposite DownRight = UpLeft +opposite Here = Here move :: Direction -> Position -> Position move Up = y -~ 1 @@ -160,6 +162,7 @@ move UpLeft = move Up . move Left move UpRight = move Up . move Right move DownLeft = move Down . move Left move DownRight = move Down . move Right +move Here = id asPosition :: Direction -> Position asPosition dir = move dir mempty |