我有一个旧的xmonad配置,我从其他配置中复制块。我对Haskell的了解不多,所以直到当时我都尽我所能。事物是较旧的编译器并没有抱怨所讨论的这一行,但现在显示了一个歧义的类型变量错误。
我已经检查了其他有关类似问题的线程,但仍然无法弄清楚如何解决我的问题
在此表达式之后显示第一个歧义类型变量:
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 }
错误是:
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.
第二个错误是通过以下表达式抛出的:
onWorkspaces ["7:media"] mediaLayout $
,错误代码基本相同。
完整的配置文件是:https://paste.pound-python.org/show/bxd7gxetxq14c5hqhwyk/
和编译器中显示的错误如下:
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.
问题是mediaLayout
定义,您将noBorders Full
应用于某些东西,但这是一个布局!您是否希望下面像这样的东西?
mediaLayout = noBorders Full |||
( withIM 0.11 (Role "gimp-toolbox") $ reflectHoriz
$ withIM 0.15 (Role "gimp-dock") (trackFloating simpleTabbed)
)