Opened 10 years ago

Closed 10 years ago

#2738 closed bug (invalid)

Regression in type checking of sections in records

Reported by: dons Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 6.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Looks like a GHC 6.10 regression.

The following code, from xmonad-contrib, fails with an error under 6.10, but not under other compilers,

[ 74 of 138] Compiling XMonad.Hooks.UrgencyHook ( XMonad/Hooks/UrgencyHook.hs, dist/build/XMonad/Hooks/UrgencyHook.o )

    The section `5 `seconds`' takes one argument,
    but its type `Int' has none
    In the `duration' field of a record
    In the expression:
        DzenUrgencyHook {duration = (5 `seconds`), args = []}
    In the definition of `dzenUrgencyHook':
        dzenUrgencyHook = DzenUrgencyHook
                            {duration = (5 `seconds`), args = []}

The relevant code is:

-- | Flashes when a window requests your attention and you can't see it.
-- Defaults to a duration of five seconds, and no extra args to dzen.
-- See 'DzenUrgencyHook'.
dzenUrgencyHook :: DzenUrgencyHook
dzenUrgencyHook = DzenUrgencyHook { duration = (5 `seconds`), args = [] }

Which looks harmless enough. In fact, rearranging the section let's it pass type checking:

dzenUrgencyHook = DzenUrgencyHook { duration = seconds 5, args = [] }

The relevant code can be found here:, line 424.

To reproduce, assuming ghc 6.10 is installed, and X11,

$ cd XMonadContrib 
$ cabal install

Change History (1)

comment:1 Changed 10 years ago by igloo

difficulty: Unknown
Resolution: invalid
Status: newclosed

Thanks for the report. I haven't tried the full program, but this:

data DzenUrgencyHook = DzenUrgencyHook { duration :: Int,
                                         args :: [String] }

dzenUrgencyHook :: DzenUrgencyHook
dzenUrgencyHook = DzenUrgencyHook { duration = (5 `seconds`), args = [] }

seconds :: Int -> Int
seconds = id

works in 6.8.2, and also works in 6.10 if you pass -XPostfixOperators. It was a bug in 6.8 that the non-Haskell98 extension to sections was accepted without a language extension being turned on, so I suspect that's what the problem is.

Note: See TracTickets for help on using tickets.