quickcheck-higherorder icon indicating copy to clipboard operation
quickcheck-higherorder copied to clipboard

Bad variable naming for functions with 2 arguments

Open isovector opened this issue 5 years ago • 2 comments

> quickCheck' $ property' $ \(foo :: Int -> Int -> Int) -> foo 2 1 == foo 1 2

*** Failed! Falsified (after 3 tests and 10 shrinks):    
\a0 -> case a0 :: Int of { 1 -> \a0 -> 0 ; _ -> \a0 -> 1 }

The counter example gives both arguments the name a0!

isovector avatar Jun 25 '20 07:06 isovector

Yeah that's definitely a problem.

That's hard to fix because this is currently using Show, and an instance Show a => Show (Int -> a) gives no way of telling a what names to use.

There are various non-ideal solutions (a different class, overlapping instances); I'll have to think about the trade-offs...

Suggestions welcome!

Lysxia avatar Jun 25 '20 15:06 Lysxia

An unsafePerformIO that updates a global name counter somewhere? :)

isovector avatar Jun 25 '20 15:06 isovector