haskell - QuickCheck prop to tasty prop -


im trying go from _prop example write same thing in tasty. (example http://primitive-automaton.logdown.com/posts/142511/tdd-with-quickcheck)

game9_prop :: game9 -> bool game9_prop = (9==) . length . ungame . ungame9 

this i'm trying in tasty:

qctestgengame9 :: testtree qctestgengame9 = qc.testproperty "better gen rate" $     \ (g :: game9) -> length . ungame . ungame9 g == 9 --error line 

this conversion gives me following error:

test/tasty.hs:53:11: illegal type signature: `game9' perhaps intended use -xscopedtypevariables in pattern type-signature 

this type game9:

-- make generation rate better newtype game9 = game9 { ungame9 :: game }    deriving (eq, show)  instance arbitrary game9    arbitrary = (game9 . game) `liftm` replicatem 9 arbitrary 

to fix immediate error, remove type annotation, i.e., use

qctestgengame9 :: testtree qctestgengame9 = qc.testproperty "better gen rate" $     \ g -> (length . ungame . ungame9) g == 9 

the expression ungame9 g ensures g :: game9.

but it's simpler: game9_prop defined, can use

qctestgengame9 :: testtree qctestgengame9 = qc.testproperty "better gen rate" game9_prop 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -