
25 Jun
2007
25 Jun
'07
7:04 a.m.
Hi Hugh,
2007/6/25, Donald Bruce Stewart
hughperkins:
Just noticed that all my responses have been going only to Neil, not to the group. 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?
Anyway there was a thread on this last week.
That thread starting here: http://www.haskell.org/pipermail/haskell-cafe/2007-June/026777.html The takeaway was Stefan O'Rear's suggestion that if you don't want to create a table of datatypes manually, you can use hs-plugins -- something along the lines of data Foo = forall a. MyClass a => Foo a read' typeName s = eval ("Foo (gread \"" ++ s ++ "\" :: " ++ typeName ++ ")") :: Foo - Benja