Reputation: 325
I want to check functor laws for instance:
instance Functor Stream where
fmap f (x :> xs) = (f x) :> fmap f xs
where Stream is
data Stream a = a :> Stream a
I use QuickCheck.Classes (http://hackage.haskell.org/package/quickcheck-classes) to check the laws but I have some problem. When I try to run
lawsCheck (functorLaws (Proxy :: Proxy (Stream Int)))
I get the following:
* Couldn't match kind `*' with `* -> *'
When matching types
proxy0 :: (* -> *) -> *
Proxy :: * -> *
Expected: proxy0 f0
Actual: Proxy (Stream Int)
* In the first argument of `functorLaws', namely
`(Proxy :: Proxy (Stream Int))'
In the first argument of `lawsCheck', namely
`(functorLaws (Proxy :: Proxy (Stream Int)))'
In the expression:
lawsCheck (functorLaws (Proxy :: Proxy (Stream Int)))
What is "proxy0 f0"? Is there any way to fix this error? I can't understand why this code is not being executed.
Upvotes: 0
Views: 245
Reputation: 2515
As @leftaroundabout commented, functorLaws
takes the unapplied functor, with kind * -> *
. The correct version of your code would be:
lawsCheck (functorLaws (Proxy :: Proxy Stream))
Upvotes: 0