Robert Dockins <[EMAIL PROTECTED]> wrote:

Consistency. Almost all the other API functions take the data structure argument last. This seems to be a kind of de facto standard and deviations from it are likely to cause confusion.

I'd always assumed that the reason that data structure functions take the data 
structure last is because of the commonest case of partial application, where you 
want a function of the form Struct -> Struct.

For instance suppose you had:

  type MyState = State (Sequence Int)

  myStateFunc1:: MyState ()
  myStateFunc1 = do
     x <- someThing
     modify $ lcons x

Now you want the equivalent for rcons:

  myStateFunc2 :: MyState ()
  myStateFunc2 = do
     x <- someThing
     modify $ (flip rcons) x

The extra "flip" is confusing and distracting.  It gets worse for functions of 
more than two arguments: you wind up needing a lambda.

(BTW I haven't checked the code against the reference manual, so sorry if I've 
got it a bit wrong).

Paul.


_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to