Here is a dummy example:
class Test a b where
witness :: a
f :: Test a b => a
f = witness
Haskell then say
Could not deduce (Test a b0) arising from a use of ‘witness’
from the context (Test a b)
bound by the type signature for f :: Test a b => a
at test.hs:8:6-18
The type variable ‘b0’ is ambiguous
Relevant bindings include f :: a (bound at test.hs:9:1)
In the expression: witness
In an equation for ‘f’: f = witness
Error comes from the fact that Haskell cannot infer type variable b0
and a solution would be to remove parameter b
from definition of the typeclass Test
. But, in reality, I cannot.
My question is : Does it exist a way to explicity identify b0
with explicit parameter b
given in line f :: Test a b => a
?
Thanks.