[Haskell-cafe] H98, OOHaskell - getting started with objects in Haskell
Erik de Castro Lopo
mle+hs at mega-nerd.com
Wed Jan 12 23:23:15 CET 2011
gutti wrote:
> I wanted to check whether Haskell offers reasonably easy object oriented
> programming -- I already had a look into "Haskell's overlooked object
> system" und "A Gentle Introduction to Haskell 98" [H98]
Its probably a bad idea to try and write Java style OO code in
Haskell. Trying to do this with be playing against Haskell's
strengths (type safe functional programming) and you will
likely find a whole bunch of weakness that regular Haskell
programmers never bump into.
> 2. is OOHaskell the right way to go - is it standardised (H98) or is it
> extension and is it widely used and recommended ?
It is not widely used, the topic of OOHaskell rarely comes
up in this mailing list or on the #haskell IRC channel.
Since its not widely used, I would also think its not really
recommended.
> 3. Haskell 98 offers datatypes and some sort of monadic classes -- is it
> possible to build simple objects without OOHaskell ?
Haskell is not an OO langauge. Trying to write Java style OO
code in Haskell will be painful.
> 4. When I want object properties to change, when should I use IORef when
> STRef ?
Thats a really, really bad idea. Haskell is designed to be a pure
functional language where mutable data is only used in limited
circumstances when there is no other way.
HTH,
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
More information about the Haskell-Cafe
mailing list