[xmonad] How to organize myLayoutHook?
Daniel Trstenjak
daniel.trstenjak at gmail.com
Thu Oct 18 10:21:41 CEST 2012
On Wed, Oct 17, 2012 at 09:13:25AM -0700, Jeffrey David Johnson wrote:
> xmonad.hs:43:40:
> Couldn't match type `XMonad.Layout.LayoutModifier.ModifiedLayout
> XMonad.Layout.Renamed.Rename FixedColumn'
> with `Full'
> Expected type: Full a0
> Actual type: XMonad.Layout.LayoutModifier.ModifiedLayout
> XMonad.Layout.Renamed.Rename FixedColumn a0
> In the first argument of `(|||)', namely `tall'
> In the expression: tall ||| wide
> In the expression: ("notes", "~/notes", tall ||| wide)
>
I think that's the case, because you can't put different layout types - regardless if
they all have an instance of the same type class (LayoutClass) - in the same list,
without the usage of existential quantification.
I tried this:
data AnyLayout a = forall l. (LayoutClass l a) => AnyLayout (l a)
test = format [("admin", "~/dotfiles", AnyLayout $ Tall 1 (3/100) (2/3)),
("notes", "~/notes" , AnyLayout $ Full)]
where
defaultWorkspace = dragPane Vertical 0.1 0.5
format (w:[]) = workspace w $ defaultWorkspace
format (w:ws) = workspace w $ format ws
workspace (name, dir, AnyLayout l) = onWorkspace name l $ modWorkspace name (workspaceDir dir)
But this still results in some compile error, and I don't even know, if
it's possible to use existential quantification here.
xmonad.hs:79:8:
No instance for (LayoutClass
((->) (l0 a0))
(PerWorkspace
(XMonad.Layout.LayoutModifier.ModifiedLayout WorkspaceDir l0)
l0
a0))
arising from a use of `format'
Possible fix:
add an instance declaration for
(LayoutClass
((->) (l0 a0))
(PerWorkspace
(XMonad.Layout.LayoutModifier.ModifiedLayout WorkspaceDir l0)
l0
a0))
In the expression:
format
[("admin", "~/dotfiles", AnyLayout $ Tall 1 (3 / 100) (2 / 3)),
("notes", "~/notes", AnyLayout $ Full)]
In an equation for `test':
test
= format
[("admin", "~/dotfiles", AnyLayout $ Tall 1 (3 / 100) (2 / 3)),
("notes", "~/notes", AnyLayout $ Full)]
where
defaultWorkspace = dragPane Vertical 0.1 0.5
format (w : []) = workspace w $ defaultWorkspace
format (w : ws) = workspace w $ format ws
workspace (name, dir, AnyLayout l)
= onWorkspace name l $ modWorkspace name (workspaceDir dir)
xmonad.hs:87:44:
Could not deduce (t1
~ PerWorkspace
l1
((->) (l a))
(PerWorkspace
(XMonad.Layout.LayoutModifier.ModifiedLayout WorkspaceDir l) l a))
from the context (LayoutClass l a,
LayoutClass
((->) (l a))
(PerWorkspace
(XMonad.Layout.LayoutModifier.ModifiedLayout WorkspaceDir l) l a))
bound by the inferred type of
workspace :: (LayoutClass l a,
LayoutClass
((->) (l a))
(PerWorkspace
(XMonad.Layout.LayoutModifier.ModifiedLayout WorkspaceDir l)
l
a)) =>
([Char],
[Char],
AnyLayout
(PerWorkspace
(XMonad.Layout.LayoutModifier.ModifiedLayout WorkspaceDir l) l a))
-> t1
at xmonad.hs:87:7-100
or from (LayoutClass
l1
(PerWorkspace
(XMonad.Layout.LayoutModifier.ModifiedLayout WorkspaceDir l) l a))
bound by a pattern with constructor
AnyLayout :: forall a (l :: * -> *).
LayoutClass l a =>
l a -> AnyLayout a,
in an equation for `workspace'
at xmonad.hs:87:29-39
`t1' is a rigid type variable bound by
the inferred type of
workspace :: (LayoutClass l a,
LayoutClass
((->) (l a))
(PerWorkspace
(XMonad.Layout.LayoutModifier.ModifiedLayout WorkspaceDir l)
l
a)) =>
([Char],
[Char],
AnyLayout
(PerWorkspace
(XMonad.Layout.LayoutModifier.ModifiedLayout WorkspaceDir l) l a))
-> t1
at xmonad.hs:87:7
In the expression:
onWorkspace name l $ modWorkspace name (workspaceDir dir)
In an equation for `workspace':
workspace (name, dir, AnyLayout l)
= onWorkspace name l $ modWorkspace name (workspaceDir dir)
In an equation for `test':
test
= format
[("admin", "~/dotfiles", AnyLayout $ Tall 1 (3 / 100) (2 / 3)),
("notes", "~/notes", AnyLayout $ Full)]
where
defaultWorkspace = dragPane Vertical 0.1 0.5
format (w : []) = workspace w $ defaultWorkspace
format (w : ws) = workspace w $ format ws
workspace (name, dir, AnyLayout l)
= onWorkspace name l $ modWorkspace name (workspaceDir dir)
Greetings,
Daniel
More information about the xmonad
mailing list