[Haskell-cafe] Desugaring of infix operators is (always?) the
wrong way round
Sam Hughes
hughes at rpi.edu
Tue Sep 25 20:46:56 EDT 2007
Brian Hulley wrote:
> Dan Piponi wrote:
>> On 9/25/07, Brian Hulley <brianh at metamilk.com> wrote:
>>> ..
> I don't understand what you mean. For example, with the prefix
> definition of a function with multiple clauses, the function name at the
> start of each clause is already lined up since it must appear at the
> margin of the current layout block (especially if you follow the simple
> rule of always following a layout starter token by a newline rather than
> starting a new multi-line layout block in the middle of a line), whereas
> with the postfix notation you'd need to manually line up the function
> names if you wanted the same neat look.
Or you could have everything be backwards, and use an editor that right
aligns things.
>>> It's not so clear to me what the syntax for types should be in a
>>> postfix language.
>>>
>>
>> Postfix, of course! So you'd write
>>
>> data a Tree = Leaf | a a Tree
data
a a Tree |
Leaf = a Tree
> A postfix version could be:
>
> map :: (a -> b) -> a List -> b List
> Empty _ map = Empty
> (h t PushF) f map = (h f) (t f map) PushF
(a -> b) -> [a] -> [b] :: map
[] = [] _ map
x f : xs f map = (x:xs) f map
- Sam
More information about the Haskell-Cafe
mailing list