I have the following file:
module SimpleComposition where
class Domain a where
f :: a -> a
g :: a -> a
h = f . g
When trying to loading it in ghci, I get the error
src\play.hs:7:5: error:
* No instance for (Domain c0) arising from a use of `f'
* In the first argument of `(.)', namely `f'
In the expression: f . g
In an equation for `h': h = f . g
I believe the problem is that the type of both f
and g
is forall a. Domain a => a ->a
and not simply a -> a
, so these foralls are in the way. But I still want to compose them. How?