Skip to content

Instantly share code, notes, and snippets.

@paf31
Last active August 29, 2015 14:11
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paf31/292a638b3b264b145ebd to your computer and use it in GitHub Desktop.
Save paf31/292a638b3b264b145ebd to your computer and use it in GitHub Desktop.
needs a better name
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
module Main where
import Test.QuickCheck
class Arbiter f r where
arbiter :: f -> Gen r
instance Arbiter r r where
arbiter = return
instance (Arbitrary a, Arbiter f r) => Arbiter (a -> f) r where
arbiter f = do
a <- arbitrary
arbiter (f a)
data X = X Int Int Int Int Int
instance Show X where
show _ = "X"
instance Arbitrary X where
arbitrary = arbiter X
main = quickCheck $ \(X _ _ _ _ _) -> True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment