rlopez1j / xmonad

Automatically exported from code.google.com/p/xmonad
0 stars 0 forks source link

XMonad.Util.Run documentation is incorrect #487

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The documentation for XMonad.Util.Run.seconds includes this code as an example 
[1]:

    -- Use like:
    --
    -- > (5.5 `seconds`)

However, using the example gives this error in GHC 7.0.3:

    The operator `seconds' takes two arguments,
    but its type `Rational -> Int' has only one

This is because the Haskell Report [2] explicitly defines operator sections to 
only work with two argument functions. The corrected documentation (although 
less pretty) should be:

    -- Use like:
    --
    -- > seconds 5.5

[1] http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Util-Run.html#v:seconds
[2] http://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-300003.5

Original issue reported on code.google.com by chris...@gmail.com on 10 Dec 2011 at 2:51

GoogleCodeExporter commented 9 years ago
Actually this is because ghc has become more pedantic of late, and no longer 
allows the postfix section extension by default.  (It used to be lax about 
requiring, or even providing, LANGUAGE pragmas for extensions that couldn't 
break standard-compliant programs.)

You now need {-# LANGUAGE PostfixOperators #-} to enable it, whereas in earlier 
ghc versions it quietly worked by default.

Original comment by allber...@gmail.com on 10 Dec 2011 at 4:26

GoogleCodeExporter commented 9 years ago
It's probably worth mentioning this gotcha in the docs anyway. I pushed a patch 
that does this.

Original comment by daniel.w...@gmail.com on 10 Dec 2011 at 11:49

GoogleCodeExporter commented 9 years ago
Certainly it's worth mentioning; I'm just explaining why it *used* to be 
perfectly valid.

ghc is in the business of breaking lots of formerly working stuff of late, it 
seems.  (Control.Exception; base vs. H'98; ...)

Original comment by allber...@gmail.com on 10 Dec 2011 at 11:57