[Haskell-beginners] Defining ExtensionClass (Maybe a) instance in xmonad.

Brandon Allbery allbery.b at gmail.com
Mon Jan 19 14:55:40 UTC 2015

On Mon, Jan 19, 2015 at 8:01 AM, Dmitriy Matrosov <sgf.dma at gmail.com> wrote:

> I've tried to define (Maybe a) instance for ExtensionClass from
> XMonad/Core.hs
> in such way, that extensionType value would use the same data constructor
> as
> was used for the type a itself. But the code below typechecks only, if i
> add
> (Show a) and (Read a) constraints to (Maybe a) instance definition, what
> makes
> such definition useless for types, which do not have these instances and do
> not want to use PersistentExtension .

ExtensionClass data is stored in the layout and therefore requires those
constraints. No, there is no magic to cause non-persistent ExtensionClass
data to be stored in some other place different from where the rest of it
is stored.

I'm also wondering how much trouble you can get into by conflicting with
some other ExtensionClass that already uses Maybe.

brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20150119/70cacd1b/attachment.html>

More information about the Beginners mailing list