{-# language DeriveGeneric #-}
import Test.LeanCheck
import Test.LeanCheck.Generic
import GHC.Generics

data HR = N | O | S | W
     deriving (Eq, Generic, Show)

instance Listable HR where
--	 list = [ N , O , S , W]
	 tiers = genericTiers

rechts, links, um :: HR -> HR
rechts N = O
rechts O = S
rechts S = W
rechts W = N

links x = case x of
      N -> W
      O -> N
      S -> O
      W -> S

um x = case x of
      N -> S
      O -> W
      S -> N
      W -> O

t1 = check $ rechts N == O
t2 = check $ um (um N) == N
t3 = check $ \ x -> um (um x) == x
t4 = check $ \ x -> rechts (links x) == x

isN :: HR -> Bool
isN x = case x of
   N -> True
   _ -> False
