Skip to content

Instantly share code, notes, and snippets.

@xe-4
Created May 11, 2021 18:45
import qualified Data.List.NonEmpty as NE
import Test.QuickCheck
main :: IO ()
main = do
quickCheck prop_biggest
prop_biggest :: NE.NonEmpty Int -> Bool
prop_biggest xs =
biggest xs == (NE.last . NE.sort $ xs)
biggest :: NE.NonEmpty Int -> Int
biggest = NE.head . (NE.sortWith id)
test/Main.hs:6:3: error:
• No instance for (Arbitrary (NE.NonEmpty Int))
arising from a use of ‘quickCheck’
• In a stmt of a 'do' block: quickCheck prop_biggest
In the expression: do quickCheck prop_biggest
In an equation for ‘main’: main = do quickCheck prop_biggest
|
6 | quickCheck prop_biggest
| ^^^^^^^^^^^^^^^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment