Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange error with QuickCheck property #50

Closed
marcosh opened this issue Aug 24, 2022 · 3 comments
Closed

Strange error with QuickCheck property #50

marcosh opened this issue Aug 24, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@marcosh
Copy link

marcosh commented Aug 24, 2022

If I try to copy the example property from the documentation

-- |
-- prop> \xs -> sort xs == (sort . sort) (xs :: [Int])

I get the following error message when I run stack test

Progress 1/2: haskell-training/home/marcosh/projects/tweag/haskell-training/src/Forms.hs:52: failure in expression `\xs -> sort xs == (sort . sort) (xs :: [Int])'

<interactive>:44:2: error:
    • No instance for (Show ([Int] -> [Int]))
        arising from a use of ‘Test.QuickCheck.Test.quickCheck’
        (maybe you haven't applied a function to enough arguments?)
    • In the expression: Test.QuickCheck.Test.quickCheck doctest_prop
      In an equation for ‘it’:
          it = (Test.QuickCheck.Test.quickCheck doctest_prop)
@martijnbastiaan martijnbastiaan added the bug Something isn't working label Aug 29, 2022
@martijnbastiaan
Copy link
Owner

martijnbastiaan commented Aug 29, 2022

It looks like this error is caused by sort being out of scope. Note entirely sure why this error message pops up, but adding the following setup statement works:

{- $setup
>>> import Data.List (sort)
-}

@marcosh
Copy link
Author

marcosh commented Aug 31, 2022

oh, I see! Thanks!

Probably sort, if not imported, is interpreted as a value to be generated.

It's probably enough to clarify this in the documentation

@martijnbastiaan
Copy link
Owner

Makes sense. I'll change the example to something in scope by default too, like abs.

@martijnbastiaan martijnbastiaan added the documentation Improvements or additions to documentation label Sep 15, 2022
@martijnbastiaan martijnbastiaan added enhancement New feature or request and removed bug Something isn't working labels Oct 27, 2022
martijnbastiaan added a commit that referenced this issue Dec 23, 2022
martijnbastiaan added a commit that referenced this issue Dec 23, 2022
martijnbastiaan added a commit that referenced this issue Dec 23, 2022
martijnbastiaan added a commit that referenced this issue Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants