The trouble:
module A
data ABC = A { a :: String }
         | B { a :: String }
         | C { a :: String }

module B
data ABC = A { a :: String }
         | B { a :: String }
         | C { a :: String }

is valid haskell.
so how should you know having the serialized String { a : "abc" }
wether to use the constructor A,B,C ? or wether to use ABC from module A
or from B?
There are many ways to solve this:
One is to serialize it this way: { "datatype": "A.ABC", constructor : "C"
                                 , a :"text" }
or such..
Maybe also read about Data.Typable, have a look at derive or DrIft (or
the lib itself, I'm not sure wethere there is one which has choosen one
way to do this)..

Basically JavaScript doesn't have real typing (such as classes). But
there exist some libraries to emulate it such as mootools or
scriptaculous..

I hope you'll find a solution which works for you.

Sincerly
Marc Weber
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to