Proposal: require spaces around the dot operator

Ben Millwood haskell at benmachine.co.uk
Mon Feb 13 17:10:29 CET 2012


On Mon, Feb 13, 2012 at 8:41 AM, John Meacham <john at repetae.net> wrote:
> On Mon, Feb 13, 2012 at 12:07 AM, AntC <anthony_clayden at clear.net.nz> wrote:
>> So the advantage of dot from that point of view is:
>> * dot already appears tightly-bound in qualified names
>> * dot is already a reserved operator,
>>  so we won't have to search for some other candidate
>
> (.) is not a reserved op, it is defined and redefinable
> like every other operator and has no special fixity
> rules.
>
> main = do
>    let x . y = x + y
>    print (3 . 8)
>
> prints 11 like you would expect.
>
>
> Oddly enough, I have occasionally wanted (.) to bind tighter than function
> application but still be composition. map toUpper.chr xs has a nice feel to
> me :)

To that I say: let f = drop 1 . filter odd . take 30 in f xs -- :)

-- Ben



More information about the Haskell-prime mailing list