[xmonad] darcs patches: Support for extensible state in
daniel.schoepe at googlemail.com
Mon Oct 26 15:10:44 EDT 2009
On Mon, Oct 26, 2009 at 11:09:20AM -0700, Don Stewart wrote:
> This has been a long time coming.
> I think we first discussed this in April 2007.
> Can you characterize what changes to the core (if any) were required to
> support this?
I added a `M.Map String StateExtension' field to XState to hold the
state, where StateExtension is an existential data type which can hold
values that are members of a type class. The string representation of
the value's type is used as the key in the map. This can create
problems when multiple modules store a common data type such as an
Int. To prevent this I added instructions to create a separate data
type for that. This should not create name conflicts as long as one
automatically derives Typeable.
Another thing I had to add was a list of type witnesses in XConf that
is used to make values persistent between restarts when the type is an
instance of Read. Currently this has to be explicitly specified when
one makes a data type an instance of the type class since I didn't
find a way to distinguish between Readable and non-Readable values
automatically(not even with IncoherentInstances). I'd appreciate any
suggestions on this issue though.
Finally, I made some modifications to the restart process to make
The actual interface for using this feature is done in a contrib
module, since it does not really belong in core.
This whole thing could have been implemented by (ab)using the
layoutHook thus not needing any core changes, but this would be
somewhat crude and since the additions to core are only about ~50
lines, including comments, I think this is the better way to realize
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/xmonad/attachments/20091026/6dd18364/attachment.bin
More information about the xmonad