I'm new to Haskell and I'm having some trouble with this error. I'm using ghci on Windows. This is the code:
data Direction = North | South | East | West
deriving (Eq, Show)
type Point = (Int, Int)
origin = (0,0)
type Road = [Direction]
movement :: Point -> Road -> Point
{- ... }
test :: Road -> Road -> Bool
test road1 road2 = movement origin road1 == movement origin road2
-- i check if two roads lead to the same destination starting from
-- the origin point in a grid
This is what happens when I try to run the test:
*Main> quickCheck test
<interactive>:8:1: error:
* No instance for (Arbitrary Direction)
arising from a use of `quickCheck'
* In the expression: quickCheck test
In an equation for `it': it = quickCheck test
My teacher told me my code is correct, but had no explanation why this happens on Windows, thus provided no solution. Neither I found anything helpful on the web. I'd really appreciate an explanation.
instance Arbitrary Direction
. See the docs for the quickcheck library - jberryman