[Haskell-cafe] type constructor section for (-> Bool), _not_ ((->) Bool)
anthony_clayden at clear.net.nz
Tue Sep 3 13:33:46 CEST 2013
I'm probably being dumb, but Hoogle nor the wiki are helping me.
I want an instance and type improvement constraint of the form
instance (f ~ (-> Bool)) => C Foo (f b) where ...
The first arg to C is driving type improvement, for example:
instance (f ~ ) => C Bar (f b) where ...
(The real instances are more complex, and involve overlap, of course.)
I'm trying to write a section to get the improved type (b -> Bool),
but (-> Bool) or ((-> Bool) b) is invalid syntax.
This is valid, but wrong: ((->) Bool) b -- gives (Bool -> b).
I could do:
data FlipFun b -- abstract
instance (f ~ FlipFun) => C Foo (f b) where ...
And a type function inside the class to generate the type.
But then I'd have to apply the type function for all instances,
and in most places it'd be id.
More information about the Haskell-Cafe