blob: 17d480157bb2577c44d1828fddc0891c1e3e08ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
module Or where
import Data.Semigroup
import Test.QuickCheck
data Or a b =
Fst a
| Snd b
deriving (Eq, Show)
instance Semigroup (Or a b) where
(Snd x) <> _ = Snd x
_ <> x = x
instance (Arbitrary a, Arbitrary b) => Arbitrary (Or a b) where
arbitrary = do
x <- arbitrary
y <- arbitrary
frequency [ (1, return $ Fst x), (1, return $ Snd y) ]
|