[Haskell-cafe] distinguish functions from non-functions in a class/instances

Philipp N. philipp.neubeck at web.de
Fri Dec 7 16:07:47 EST 2007



oleg-7 wrote:
> 
> 
> In fact, that distinction is possible. The following article
> 
> 	How to write an instance for not-a-function
> 	http://okmij.org/ftp/Haskell/typecast.html#is-function-type
> 
> specifically describes a method of writing an instance which is
> selected only when the type in question is NOT a function. The method
> is quite general and has been extensively used (for example, to
> implement deep monadic join).
> 
> 

That's really incredible, and yet I don't quite understand how IsFunction
works.
Here is my very short but powerful solution (nary is renamed to wrap).
http://www.nabble.com/file/p14220591/wrap.hs wrap.hs 

-- 
View this message in context: http://www.nabble.com/distinguish-functions-from-non-functions-in-a-class-instances-tf4952209.html#a14220591
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list