[Haskell-cafe] Doctest, quickcheck and typeclass

Gautier DI FOLCO gautier.difolco at gmail.com
Mon Jul 14 16:39:22 UTC 2014


Hi all,

Is there a way, with doctest and quickcheck, to declare test at typeclass
level (such as laws) and play them automatically at instance level?
For example:

-- | Convert from/to a List to/from an arbitrary data structure
--
-- >>> prop > fromList . toList == id
class Listable d where
  fromList :: [a] -> d a
  toList :: d a -> [a]

And this test will be played for each instance.

Thanks in advance for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140714/d92e367c/attachment.html>


More information about the Haskell-Cafe mailing list