Created
May 11, 2021 18:45
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
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) |
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
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