[Haskell-cafe] Embarrassed Haskeller -- why is Read so bad? What are alternatives?

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Wed Oct 16 12:04:55 UTC 2013


Ryan Newton <rrnewton <at> gmail.com> writes:

> Hmm, currently trying to learn how to incorporate DriFT into a cabal
package.  Polyparse doesn't support any other deriving mechanisms does it? 

Here is some TH magic by Bertram Felgenhauer for deriving Parsers
(that do what you'd expect from "deriving Read"). It allows to write

data Foo = ...
$(derives [makeToDoc, makeReader] [''Foo])

I find this incredibly useful, and use it heavily. 
As it stands, it creates code for Parsec, 
but certainly it could be adapted to a different backend.

View source:
http://autolat.imn.htwk-leipzig.de/gitweb/?p=autolib;a=tree;f=derive

Get source (this is a larger repo):
git clone git://autolat.imn.htwk-leipzig.de/git/autolib

- J.W. 




More information about the Haskell-Cafe mailing list