# Pastebin MPAt1waK #!/usr/bin/env stack -- stack --resolver lts-18.0 script {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE NamedFieldPuns #-} import Test.Hspec import Test.QuickCheck hiding (Result) data Result = One | NotOne deriving (Eq, Show) myFunc :: [Int] -> Result myFunc xs = if 1 `elem` xs then One else NotOne main :: IO () main = hspec spec spec :: Spec spec = describe "myFunc" $ do it "is 'One' when list contains 1" $ property $ \ContainsOne { unContainsOne } -> myFunc unContainsOne `shouldBe` One newtype ContainsOne = ContainsOne { unContainsOne :: [Int] } deriving newtype Show instance Arbitrary ContainsOne where arbitrary = do list <- arbitrary let xs = 1 : list pure $ ContainsOne xs