Ryan Ingram wrote:
My comments inlined below...

On 9/25/07, Brian Hulley <[EMAIL PROTECTED]> wrote:
  let
       shiftLeftByThree = shiftL' 3
  in
      map shiftLeftByThree  [10, 78, 99, 102]

let shiftLeftByThree = (`shiftL` 3) in ...

Aha! but this is using section syntax which is yet another complication. Hypothesis: section syntax would not be needed if the desugaring order was reversed.
Can anyone think of an example where the current desugaring of infix
arguments gives the correct order when the function is used in a postfix
application? (apart from commutative functions of course!)

A couple off the top of my head:

(:) :: a -> [a] -> [a]

Yes that's one that had totally slipped my mind ;-)
<|> :: MonadPlus m => m a -> m a -> m a
(how do you define "correct" in this case, anyways?)

I'm not so sure about this one eg:

    first <|> second
    (trychoice second) first

because (trychoice second) encapsulates what to do when its argument action fails.
Even for "shift" I can think of several reasons to want to use it both
ways; for example, unpacking a bitfield from a Word16:

unpack v = (getM 0 255, getM 8 1, getM 9 31, getM 14 3)
    where getM = (.&.) . (shiftR v)

I suppose with some ops perhaps there is no "most common" way of wanting to use them and hence no "one-true-way" argument order for those ops.

Thanks for the examples,
Brian.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to