[Haskell-cafe] Comment Syntax
Malcolm Wallace
malcolm.wallace at me.com
Fri Jun 3 11:01:23 CEST 2011
>> -- followed by a symbol does not start a comment, thus for example, haddock
>> declarations must begin with -- |, and not --|.
>>
>> What might --| mean, if not a comment? It doesn't seem possible to define it
>> as an operator.
>
> GHCi, at least, allows it.
>
> Prelude> let (--|) = (+)
> Prelude> 1 --| 2
> 3
I believe the motivating example that persuaded the Language Committee to allow these symbols was
-->
which is not of course used anywhere in the standard libraries, but is an extremely nice symbol to have available in user code.
Regards,
Malcolm
More information about the Haskell-Cafe
mailing list