I am trying to use QuickCheck (for the first time) to test a function that validates TCP port numbers:
validatePort :: Int -> Either String Int
validatePort port =
if port > 0 && port <= 65535
then Right port
else Left "Port must be between 1 and 65535 inclusive"
I wrote an instance of Arbitrary like this:
instance Arbitrary Int where
arbitrary = choose (1, 65535)
but I'm not sure how to write the test property.