[Haskell-cafe] Argument order of expNat (Was: map (-2) [1..5])

Henning Thielemann lemming at henning-thielemann.de
Mon Sep 11 10:14:21 EDT 2006


On Sat, 9 Sep 2006, Brian Hulley wrote:

> > >     negate (expNat 4 2)
> > > 
> > > because this would free the ^ symbol for some more widely
> > > applicable use, and would also make the particular choice of
> > > exponentiation operator more explicit
> > 
> > Agreed, though I'd want expt to be part of a typeclass
> > (possibly multi-parameter to get exp:: Integral a => a ->
> > Natural -> a as an instance?).
> 
> Yes, a typeclass for exp would be ideal (and a newtype for Natural).


What about (expNat exponent basis) ? This argument order is more
convenient for partial application.

Cf.
 http://www.haskell.org/pipermail/haskell-cafe/2006-April/015329.html


More information about the Haskell-Cafe mailing list