
7 Dec
2007
7 Dec
'07
8:27 a.m.
On Dec 7, 2007 2:52 PM,
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).
Cool solution and not so complicated and ad-hoc. But I'd like to ask isn't the following definition is more natural and simple? nary 0 x [] = x nary n f (x:xs) | n > 0 = nary (n-1) (f $ read x) xs -- vir http://vir.comtv.ru/