On Tue, Sep 03, 2013 at 11:33:46AM +0000, AntC wrote: > 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.
There is no operator section syntax for types. Moreover, this is not just an issue of syntax: it is impossible to partially apply a type constructor to anything other than its first argument, because there is no type-level lambda. > 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. That's the only way to do it that I know of. -Brent _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe