HSX patch: Monad* instances for XMLGenT

2 views
Skip to first unread message

Jeremy Shaw

unread,
May 17, 2010, 8:39:39 PM5/17/10
to haskell-se...@googlegroups.com
Hello,


I have attached a patch which derives MonadReader, MonadWriter,
MonadState, MonadRWS, MonadCont, and MonadError for XMLGenT.

Now if you wrap XMLGenT around a monad that supports MonadWriter, for
example, you can just do, tell "foo" instead of lift $ tell "foo".
Which makes things cleaner in my experience.

I am not sure what the drawbacks would be. HSX already depends on mtl,
and this patch does not require that the transformed monads support
any of those classes. It just allows you to get at them directly when
the transformed monad does. I believe that is the point of having
those classes in the first place?

- jeremy


hsx-mtl-monad-instances.dpatch

Niklas Broberg

unread,
May 18, 2010, 5:00:56 AM5/18/10
to haskell-se...@googlegroups.com
> I have attached a patch which derives MonadReader, MonadWriter, MonadState,
> MonadRWS, MonadCont, and MonadError for XMLGenT.
>
> Now if you wrap XMLGenT around a monad that supports MonadWriter, for
> example, you can just do, tell "foo" instead of lift $ tell "foo". Which
> makes things cleaner in my experience.

I agree, this is definitely a very useful thing.

> I am not sure what the drawbacks would be. HSX already depends on mtl, and
> this patch does not require that the transformed monads support any of those
> classes. It just allows you to get at them directly when the transformed
> monad does. I believe that is the point of having those classes in the first
> place?

I don't perceive any drawbacks either, rather this falls under the
category of things that should have been there all along. Thanks!

/Niklas

--
You received this message because you are subscribed to the Google Groups "Haskell Server Pages" group.
To post to this group, send email to haskell-se...@googlegroups.com.
To unsubscribe from this group, send email to haskell-server-p...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haskell-server-pages?hl=en.

Niklas Broberg

unread,
May 18, 2010, 5:03:26 AM5/18/10
to haskell-se...@googlegroups.com
> I have attached a patch which derives MonadReader, MonadWriter, MonadState,
> MonadRWS, MonadCont, and MonadError for XMLGenT.

$ darcs apply hsx-mtl-monad-instances.dpatch
darcs.exe: Cannot apply this patch bundle, since we're missing:
Mon Feb 15 21:32:55 Võsteuropa, normaltid 2010 David Fox <d...@seereason.com>
* Add a rule to add trhsx executable to the trhsx package

Jeremy Shaw

unread,
May 18, 2010, 10:52:11 AM5/18/10
to haskell-se...@googlegroups.com
ugh. code.haskell.org was down last night so I tried using a local
copy we had. But I guess our local copy had other patches too. I have
attached a fresh version.

It also includes a bonus patch to update the homepage from http://code.google.com/hsp
to http://code.haskell.org/HSP.

- jeremy

hsx-mtl-monad-instances-2.dpatch
Reply all
Reply to author
Forward
0 new messages