[英]Haskell Ambiguous type variable in xmonad configuration
I have an old xmonad config done by me copying blocks from other configs. 我有一个旧的xmonad配置,是通过复制其他配置中的块来完成的。 I haven't much knowledge in Haskell so I have done my best till the moment. 我对Haskell的了解不多,所以到目前为止我已经尽力了。 The thing is older compiler didn't complain about the this line in question but now shows an Ambigous type variable error. 问题是较老的编译器没有抱怨这一行,但是现在显示出模糊类型变量错误。
I've checked other thread about similar problems but still cant figure how to solve my issue so if anyone could enlight me with any kind of answer I would be enormously thankfull. 我已经检查了有关类似问题的其他话题,但仍然无法弄清楚如何解决我的问题,因此,如果有人能以任何形式的回答启发我,我将非常感激。
The first Ambiguous type variable is shown after this expression: 此表达式后显示第一个模糊类型变量:
xmonad $ defaultConfig
{ terminal = myTerminal
, workspaces = myWorkspaces
, keys = myKeys
, modMask = mymodMask
, layoutHook = myLayoutHook
, manageHook = manageSpawn <+> myManageHook
, logHook = myLogHook dzenLeftBar
, normalBorderColor = colorNormalBorder
, focusedBorderColor = colorFocusedBorder
, borderWidth = 0
, startupHook = myStartupHook }
And the error is: 错误是:
xmonad.hs:86:5: error:
* Ambiguous type variable `l10` arising from a use of `xmonad`
prevents the constraint `(LayoutClass
l10 GHC.Word.Word64)` from being solved.
Probable fix: use a type annotation to specify what `l10` should be.
The second error is thrown by the following expression: 下面的表达式引发第二个错误:
onWorkspaces ["7:media"] mediaLayout $
And the error code is basically the same. 和错误代码基本相同。
The full config file is this: https://paste.pound-python.org/show/BXD7gxeTXq14c5hQHwyK/ 完整的配置文件是这样的: https : //paste.pound-python.org/show/BXD7gxeTXq14c5hQHwyK/
And the errors showed in the compiler are the following: 并且在编译器中显示的错误如下:
xmonad.hs:86:5: error:
* Ambiguous type variable `l10` arising from a use of `xmonad`
prevents the constraint `(LayoutClass
l10 GHC.Word.Word64)` from being solved.
Probable fix: use a type annotation to specify what `l10` should be.
These potential instances exist:
instance (LayoutClass l a, LayoutClass r a) =>
LayoutClass (Choose l r) a
-- Defined in `XMonad.Layout`
instance LayoutClass Full a -- Defined in `XMonad.Layout`
instance LayoutClass l a => LayoutClass (Mirror l) a
-- Defined in `XMonad.Layout`
...plus four others
...plus five instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
* In a stmt of a 'do' block:
xmonad
$ defaultConfig
{terminal = myTerminal, workspaces = myWorkspaces, keys = myKeys,
modMask = mymodMask, layoutHook = myLayoutHook,
manageHook = manageSpawn <+> myManageHook,
logHook = myLogHook dzenLeftBar,
normalBorderColor = colorNormalBorder,
focusedBorderColor = colorFocusedBorder, borderWidth = 0,
startupHook = myStartupHook}
In the expression:
do { dzenLeftBar <- spawnPipe myXmonadBar;
dzenStatusBar <- spawnPipe myStatusBar;
dzenTrayBar <- spawnPipe myTrayBar;
dzenMpdBar <- spawnPipe myMpdBar;
.... }
In an equation for `main`:
main
= do { dzenLeftBar <- spawnPipe myXmonadBar;
dzenStatusBar <- spawnPipe myStatusBar;
dzenTrayBar <- spawnPipe myTrayBar;
.... }
xmonad.hs:180:17: error:
* Ambiguous type variable `l10` arising from a use of `onWorkspaces`
prevents the constraint `(LayoutClass
l10 Window)` from being solved.
Relevant bindings include
myLayoutHook :: XMonad.Layout.PerWorkspace.PerWorkspace
(ModifiedLayout
AvoidStruts
(Choose
(ModifiedLayout Spacing ResizableTall)
(Choose
(Mirror (ModifiedLayout Spacing ResizableTall))
(Choose
(ModifiedLayout XMonad.Layout.NoBorders.WithBorder Full)
(ModifiedLayout
(XMonad.Layout.Decoration.Decoration
SimpleDecoration
XMonad.Layout.Decoration.DefaultShrinker)
(ModifiedLayout
XMonad.Actions.MouseResize.MouseResize
(ModifiedLayout
XMonad.Layout.WindowArranger.WindowArranger
SimpleFloat)))))))
(XMonad.Layout.PerWorkspace.PerWorkspace
(ModifiedLayout
AvoidStruts
(Choose
(ModifiedLayout
XMonad.Layout.NoBorders.WithBorder
(ModifiedLayout Spacing ResizableTall))
(Choose
(Mirror (ModifiedLayout Spacing ResizableTall))
(Choose
(ModifiedLayout XMonad.Layout.NoBorders.WithBorder Full)
(ModifiedLayout
(XMonad.Layout.Decoration.Decoration
SimpleDecoration
XMonad.Layout.Decoration.DefaultShrinker)
(ModifiedLayout
XMonad.Actions.MouseResize.MouseResize
(ModifiedLayout
XMonad.Layout.WindowArranger.WindowArranger
SimpleFloat)))))))
(XMonad.Layout.PerWorkspace.PerWorkspace
(ModifiedLayout
AvoidStruts
(Choose
(ModifiedLayout XMonad.Layout.NoBorders.WithBorder Full)
(Choose
(ModifiedLayout Spacing ResizableTall)
(Choose
(Mirror (ModifiedLayout Spacing ResizableTall))
(ModifiedLayout
(XMonad.Layout.Decoration.Decoration
SimpleDecoration
XMonad.Layout.Decoration.DefaultShrinker)
(ModifiedLayout
XMonad.Actions.MouseResize.MouseResize
(ModifiedLayout
XMonad.Layout.WindowArranger.WindowArranger
SimpleFloat)))))))
(XMonad.Layout.PerWorkspace.PerWorkspace
(ModifiedLayout
AvoidStruts
(Choose
(ModifiedLayout
XMonad.Layout.NoBorders.WithBorder
(ModifiedLayout Spacing ResizableTall))
(Choose
(Mirror (ModifiedLayout Spacing ResizableTall))
(Choose
(ModifiedLayout
XMonad.Layout.NoBorders.WithBorder Full)
(ModifiedLayout
(XMonad.Layout.Decoration.Decoration
SimpleDecoration
XMonad.Layout.Decoration.DefaultShrinker)
(ModifiedLayout
XMonad.Actions.MouseResize.MouseResize
(ModifiedLayout
XMonad.Layout.WindowArranger.WindowArranger
SimpleFloat)))))))
(XMonad.Layout.PerWorkspace.PerWorkspace
(ModifiedLayout
AvoidStruts
(ModifiedLayout
XMonad.Layout.NoBorders.WithBorder
(ModifiedLayout
(XMonad.Layout.Decoration.Decoration
SimpleDecoration
XMonad.Layout.Decoration.DefaultShrinker)
(ModifiedLayout
XMonad.Actions.MouseResize.MouseResize
(ModifiedLayout
XMonad.Layout.WindowArranger.WindowArranger
SimpleFloat)))))
(XMonad.Layout.PerWorkspace.PerWorkspace
l10
(XMonad.Layout.PerWorkspace.PerWorkspace
(ModifiedLayout
AvoidStruts
(ModifiedLayout
AddRoster
(ModifiedLayout
(XMonad.Layout.Decoration.Decoration
SimpleDecoration
XMonad.Layout.Decoration.DefaultShrinker)
(ModifiedLayout
XMonad.Actions.MouseResize.MouseResize
(ModifiedLayout
XMonad.Layout.WindowArranger.WindowArranger
SimpleFloat)))))
(ModifiedLayout
AvoidStruts
(Choose
(ModifiedLayout
XMonad.Layout.NoBorders.WithBorder Full)
(Choose
(ModifiedLayout Spacing ResizableTall)
(Choose
(Mirror
(ModifiedLayout Spacing ResizableTall))
(ModifiedLayout
(XMonad.Layout.Decoration.Decoration
SimpleDecoration
XMonad.Layout.Decoration.DefaultShrinker)
(ModifiedLayout
XMonad.Actions.MouseResize.MouseResize
(ModifiedLayout
XMonad.Layout.WindowArranger.WindowArranger
SimpleFloat)))))))))))))
Window
(bound at xmonad.hs:174:1)
Probable fix: use a type annotation to specify what `l10` should be.
These potential instances exist:
instance (LayoutClass l a, LayoutClass r a) =>
LayoutClass (Choose l r) a
-- Defined in `XMonad.Layout`
instance LayoutClass Full a -- Defined in `XMonad.Layout`
instance LayoutClass l a => LayoutClass (Mirror l) a
-- Defined in `XMonad.Layout`
...plus four others
...plus five instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
* In the expression: onWorkspaces ["7:media"] mediaLayout
In the second argument of `($)`, namely
`onWorkspaces ["7:media"] mediaLayout
$ onWorkspaces ["8:com"] chatLayout $ simpLayout`
In the second argument of `($)`, namely
`onWorkspaces ["5:virt"] vBoxLayout
$ onWorkspaces ["7:media"] mediaLayout
$ onWorkspaces ["8:com"] chatLayout $ simpLayout`
xmonad.hs:202:15: error:
* Couldn't match expected type `ModifiedLayout
AddRoster
(ModifiedLayout
XMonad.Layout.Reflect.Reflect
(ModifiedLayout
AddRoster
(ModifiedLayout
TrackFloating
(ModifiedLayout
(XMonad.Layout.Decoration.Decoration
TabbedDecoration
XMonad.Layout.Decoration.DefaultShrinker)
XMonad.Layout.Simplest.Simplest))))
Window
-> t`
with actual type `ModifiedLayout
XMonad.Layout.NoBorders.WithBorder Full Window`
* The first argument of ($) takes one argument,
but its type `ModifiedLayout
XMonad.Layout.NoBorders.WithBorder Full Window`
has none
In the expression:
noBorders Full
$ withIM 0.11 (Role "gimp-toolbox")
$ reflectHoriz
$ withIM 0.15 (Role "gimp-dock") (trackFloating simpleTabbed)
In an equation for `mediaLayout`:
mediaLayout
= noBorders Full
$ withIM 0.11 (Role "gimp-toolbox")
$ reflectHoriz
$ withIM 0.15 (Role "gimp-dock") (trackFloating simpleTabbed)
* Relevant bindings include
mediaLayout :: t (bound at xmonad.hs:202:1)
Please check the file for errors.
The problem is the mediaLayout
definition, you're applying noBorders Full
to something but it is a layout! 问题是mediaLayout
定义,您要将noBorders Full
应用于某物,但这是一种布局! Did you want it to be something like this below? 您是否希望它像下面这样?
mediaLayout = noBorders Full |||
( withIM 0.11 (Role "gimp-toolbox") $ reflectHoriz
$ withIM 0.15 (Role "gimp-dock") (trackFloating simpleTabbed)
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.