[Haskell-beginners] (no subject)

Jamie F Olson jamie.f.olson at gmail.com
Thu Mar 28 20:22:09 CET 2013


Daniel Trstenjak <daniel.trstenjak <at> gmail.com> writes:

> Ups, sorry, the data constructor to get a JSValue from a JSObject is
> named - well - also JSObject.
> 
> So it's:
> 
> getJSObj $ JSObject a
> 
> There's a data type named JSObject:
> 
> newtype JSObject e = JSONObject { fromJSObject :: [(String, e)] }
>     deriving (Eq, Ord, Show, Read, Typeable )
> 
> And there's a data constructor with the name JSObject for the data type 
JSValue:
> 
> data JSValue
>     = ...
>     | JSObject   (JSObject JSValue)
>     deriving (Show, Read, Eq, Ord, Typeable)
> 
> Greetings,
> Daniel
> 
> 

Thanks.  I'd seen that mentioned above, but I'm a bit new to Haskell and didn't 
really understand what that meant.  In fact, I still don't.  Do you have any 
good resources on that?  None of the tutorials/manuals were entirely clear to 
me, nor was the wiki(http://www.haskell.org/haskellwiki/Constructor), which uses 
the same statement as the example of both type and data constructors.





More information about the Beginners mailing list