<br><div class="gmail_quote">On Fri, Feb 1, 2008 at 5:04 PM, Nicolas Pouillard <<a href="mailto:nicolas.pouillard@gmail.com">nicolas.pouillard@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Excerpts from Brent Yorgey's message of Fri Feb 01 22:53:20 +0100 2008:<br>
<div><div></div><div class="Wj3C7c">> On Thu, Jan 31, 2008 at 2:42 PM, Spencer Janssen <<a href="mailto:sjanssen@cse.unl.edu">sjanssen@cse.unl.edu</a>><br>
> wrote:<br>
><br>
> > On Wed, Jan 30, 2008 at 07:29:58PM -0500, Brent Yorgey wrote:<br>
> > > 1. PerWorkspace is an inelegant hack with several icky problems:<br>
> ><br>
> > Agreed. It is approaching the limits of xmonad's layout design. However,<br>
> > I<br>
> > think we can accomplish PerWorkspace behavior without changing too much.<br>
> ><br>
> > \begin{code}<br>
> > data PerWS = PerWS { selected :: Maybe Layout<br>
> > , choices :: Map WorkspaceId Layout<br>
> > , default :: Layout }<br>
> > \end{code}<br>
> ><br>
><br>
> So, I took a crack at implementing (something like) this today. The problem<br>
> I ran into is that (Layout a) is not an instance of Read, so PerWorkspace<br>
> cannot derive Read either. Is there any way around this? Or do I have to<br>
> go back to caching a (Maybe Bool) and using that to decide on which of two<br>
> layouts to use, instead of directly caching a (Maybe (Layout a))?<br>
><br>
> Ideas?<br>
<br>
</div></div>What about "instance Read a => Read (Layout a)"?<br>
<font color="#888888"></font></blockquote><br>Well, since Layout is an existential wrapper, that's not possible -- it hides the type of the wrapped layout. I know that lots of work has already gone into the xmonad core getting around this issue. =)<br>
<br>
Hmm, just thinking out loud here... note that I don't actually care
about being able to read the (Layout a) value back in, since after
serialization/restart the startupHook will get run again anyway, and
the correct workspace will get re-cached. So perhaps I can just write my own explicit Read instance for PerWorkspace that somehow ignores that element and just initializes the read value to Nothing. Sounds scary. =)<br>
<br>-Brent<br><br></div>