[Haskell-beginners] QuickCheck help

Felipe Lessa felipe.lessa at gmail.com
Mon Jul 20 10:33:44 EDT 2009


On Mon, Jul 20, 2009 at 10:01:54AM -0400, Patrick LeBoutillier wrote:
> prop_host_read_show :: Int -> Bool
> prop_host_read_show i =
>   let w = fromIntegral i
>       h = IPv4Host w
>   in read . show $ h == h

The last line is equivalent to "in read (show (h == h))", so you
are testing if your Eq instance is an Eq instance and if "read
(show True)" really is True. :)

You probably want "(read $ show h) == h".

--
Felipe.


More information about the Beginners mailing list