[xmonad] darcs patch: XMonad.Config.Prime, a do-notation for config
vogt.adam at gmail.com
Wed Mar 13 05:26:47 CET 2013
On Tue, Mar 12, 2013 at 5:30 AM, <me at twifkak.com> wrote:
> Hello, folks,
> It's me again. First off, I see that you released 0.11 in Dec. Nice! Second, I
> took some time to take another crack at this config thing. (Previous thread:
> Because of the problems you guys mentioned with Template Haskell, I:
> 1. replaced the fclabels dependency with the lighter data-accessor.
> 2. replaced the StateT with a fake monad, so the type of the layoutHook can be
> changed without that existential mess.
> The upside is an even cleaner syntax. The downside is:
> 1. You have to come to terms with having RebindableSyntax in your xmonad.hs.
> 2. Error messages are uglier (thanks, in part, to the really long layout types).
> Docs at: http://twifkak.com/xmonad-junk/XMonad-Config-Prime2.html
Regarding the "TODO: Figure out how to type this without hard-coding
the defaultConfig layout type.", maybe something is possible with
xmonad :: (Read (l Window), LayoutClass l Window) => (forall l0.
(Read (l0 Window), LayoutClass l0 Window) => XConfig l0 -> IO (XConfig
l)) -> IO ()
But that only seems to work when prime includes a resetLayout, since
the `l' isn't allowed to refer to the `l0'. It's still possible to
write a type signature for XMonad.Config.Prime.xmonad, but since we
aren't likely to change the type of defaultConfig anytime soon it's
Some configs use do notation for IO in main before calling xmonad, or
possibly for sequencing multiple X actions that are supposed to happen
with a single keybinding. Enabling -XRebindableSyntax looks like it
would force people to use a qualified name like Prelude.>>=, or put
the definitions in separate modules. The second option is not
necessarily a bad thing.
Maybe it's possible to write a class with a >>= and >> that can work
with IO or Prime, but that probably will make type errors even worse.
More information about the xmonad