{-# LANGUAGE ScopedTypeVariables #-} import Test.QuickCheck import Test.Hspec import Blessings instance Arbitrary a => Arbitrary (Blessings a) where arbitrary = oneof [ Plain <$> arbitrary , pure Empty , (<>) <$> arbitrary <*> arbitrary , SGR <$> arbitrary <*> arbitrary ] main :: IO () main = hspec $ do describe "Blessings" $ do it "obeys the Semigroup laws" $ property $ \(x :: Blessings String) y z -> (x <> y) <> z == x <> (y <> z) it "obeys the Monoid laws" $ property $ \(x :: Blessings String) -> x <> mempty == x && x == mempty <> x