[Haskell-beginners] (no subject)

Daniel Trstenjak daniel.trstenjak at gmail.com
Fri Mar 29 10:20:26 CET 2013


Hi Jamie,

On Thu, Mar 28, 2013 at 10:34:26PM +0000, Jamie F Olson wrote:
> Thank you! I think the two strange things as an outsider particularly from more 
> OO languages are that types aren't objects, and then the strangeness of the 
> naming convention.

In C++ you could have something like:

class JSObject {
   public:
      typedef std::map<std::string, JSValue> Map_t;
      static JSObject JSONObject(const Map_t& m);
      ...
};

class JSValue {
   public:
      static JSValue JSNull();
      static JSValue JSBool(bool b);
      static JSValue JSObject(const JSObject& obj);
      ...
};


The data constructors of Haskell have some similarity to these constructor functions.


Greetings,
Daniel



More information about the Beginners mailing list