[Haskell-cafe] Constructing a datatype given just its constructor as a string?

Tomasz Zielonka tomasz.zielonka at gmail.com
Mon Jun 25 01:42:46 EDT 2007


On Sun, Jun 24, 2007 at 10:55:40PM +0200, Hugh Perkins wrote:
> Anyway, the jist of our conversation was that it's not possible to create
> arbitrary datatypes/constructors from strings in Haskell.  Can anyone
> deny/confirm?

If you want a function like fromConstr, where the 'a' depends on the
input string, you can write it in CPS or wrap the result in an
existential datatype. But I guess the problem is with "arbitrary",
right?

Best regards
Tomek


More information about the Haskell-Cafe mailing list