Created
May 4, 2018 05:51
-
-
Save scalolli/7ae9757ef587eefbe8274d8ec9fba55c to your computer and use it in GitHub Desktop.
Writing arbitrary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Functor for Company a b c | |
data Company a b c = DeepBlue a c | Something b deriving (Eq, Show) | |
instance Functor (Company a b) where | |
fmap f (DeepBlue a c) = DeepBlue a (f c) | |
fmap f (Something b) = Something b | |
instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (Company a b c) where | |
arbitrary = do | |
x <- arbitrary | |
y <- arbitrary | |
z <- arbitrary | |
elements [DeepBlue x z, Something y] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment