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

Luke Palmer lrpalmer at gmail.com
Fri Dec 7 08:46:07 EST 2007

On Dec 7, 2007 6:27 AM, Victor Nazarov <asviraspossible at gmail.com> wrote:
> 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

Sometimes it helps to write type signatures for functions.  As in this
case, where you'll find you won't be able to...  :-)


More information about the Haskell-Cafe mailing list