XMonad Compilation Error using Incorrect Data.Map
So I'm sitting here compiling XMonad for myself because I do not like being provided with version 0.9.1 by my package manager and like 0.9.2. The current problem is that the compilation of XMonad itself succeeds but then I get a weird error when xmonad tries to parse my config file:
xmonad.hs:254:15:
Couldn't match expected type `containers-0.3.0.0:Data.Map.Map
(ButtonMask, KeySym) (X ())'
against inferred type `M.Map (KeyMask, KeySym) (X ())'
In the `keys' field of a record
In the first argument of `xmobar', namely
`myBaseConfig
{modMask = myModMask,
workspaces = withScreens nScreens myWorkspaces,
layoutHook = myLayoutHook nScreens, manageHook = myManageHook,
borderWidth = myBorderWidth,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor, keys = myKeys,
mouseBindings = myMouseBindings, logHook = myLogHook}'
In the second argument of `(=<<)', namely
`xmobar
(myBaseConfig
{modMask = myModMask,
workspaces = withScreens nScreens myWorkspaces,
layoutHook = myLayoutHook nScreens, manageHook = myMa开发者_JS百科nageHook,
borderWidth = myBorderWidth,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor, keys = myKeys,
mouseBindings = myMouseBindings, logHook = myLogHook})'
I was able to trace the cause of the problem down and it is displayed in this ghci session below:
GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
$ :m xmonad
syntax: :module [+/-] [*]M1 ... [*]Mn
$ :m XMonad
$ :t XConfig
XConfig
:: String
-> String
-> String
-> l Window
-> ManageHook
-> (Event -> X Data.Monoid.All)
-> [String]
-> KeyMask
-> KeyMask
-> (XConfig Layout
-> containers-0.3.0.0:Data.Map.Map (ButtonMask, KeySym) (X ()))
-> (XConfig Layout
-> containers-0.3.0.0:Data.Map.Map
(ButtonMask, Button) (Window -> X ()))
-> Dimension
-> X ()
-> X ()
-> Bool
-> XConfig l
$
Leaving GHCi.
The problem seems to be this line:
-> containers-0.3.0.0:Data.Map.Map (ButtonMask, KeySym) (X ()))
I would have thought that it might have said:
-> M.Map (ButtonMask, KeySym) (X ()))
I am just wondering if I diagnosed the problem correctly and if so, what can I do to fix it?
Looks like you might have two versions of containers
installed. You can confirm this with:
$ ghc-pkg list containers
/home/dons/lib/ghc-7.0.3/package.conf.d
containers-0.4.0.0
/home/dons/.ghc/x86_64-linux-7.0.3/package.conf.d
containers-0.3.0.0
while that by itself is fine, the problems occur when you have some of your libraries compiled against one version, and some against another. When those libraries in turn are brought together, e.g. by xmonad, you get type errors of this sort -- the diamond dependency problem.
A solution is to remove one of the versions of containers
, and recompile any libs that then break, so you have a clean toolchain.
You could also hide one of those packages with:
ghc-pkg hide containers-0.3.0.0
精彩评论