[Haskell-cafe] Object Oriented programming for Functional Programmers
Eric Rasmussen
ericrasmussen at gmail.com
Mon Dec 31 04:41:18 CET 2012
Since no one's mentioned it yet, you might consider learning Scala. A good
starting point is http://www.artima.com/pins1ed/index.html (note that the
free edition is outdated but still a good introduction).
Scala has a mix of functional and OO programming styles, though (having
come first from Haskell) I'd say it favors the OO side. If you approach it
as OO with some nice functional touches (higher level list operations,
immutability, recursively defined data structures, and pattern matching),
it can be very fun to work with.
Scala's type system is also more expressive than the other OO languages
I've worked with, which is a big plus if you're coming from Haskell.
Learning about subtyping and variance annotations via Scala gives you tools
for reasoning about objects that you won't get from dynamically typed OO
languages.
On Sun, Dec 30, 2012 at 6:12 PM, Jay Sulzberger <jays at panix.com> wrote:
>
>
> On Mon, 31 Dec 2012, MigMit <miguelimo38 at yandex.ru> wrote:
>
> Well, "functional programmer" is a relatively broad term. If
>> you're coming from academia, so that for you Haskell is some
>> sort of lambda-calculus, spoiled by practical aspects, then I'd
>> suggest Luca Cardelli's book "Theory of Objects".
>>
>> Also, as Daniel told you already, don't start from C++, it
>>
>
> Name typo, should be "Jay", noted.
>
>
> really has very little to do with OOP. It's primary merit is a
>> very powerful system of macros (called "templates" in C++
>> world), not objects. If you want something mainstream, Java
>> would be a good choice, and C# even better one (although it
>> would be more convenient for you if you use Windows).
>>
>> Or you can try OCaml, which is functional enough for you not to
>> feel lost, and object-oriented as well.
>>
>> Отправлено с iPad
>>
>
> For systems to look at I recommend Simula, some early version,
> Smalltalk, Common Lisp, and Erlang. My guess is that Haskell's
> type classes are a mechanism for creating something like Common
> Lisp's "generic functions". I know too little about Haskell to
> say whether type classes immediately give you "single dispatch"
> things, or "multiple dispatch" things.
>
> These two Wikipedia articles are useful, I think:
>
> http://en.wikipedia.org/wiki/**Generic_function<http://en.wikipedia.org/wiki/Generic_function>
> [page was last modified on 15 November 2012 at 03:50]
>
> http://en.wikipedia.org/wiki/**Common_Lisp_Object_System<http://en.wikipedia.org/wiki/Common_Lisp_Object_System>
> [page was last modified on 15 December 2012 at 23:57]
>
> The Diamond Problem and its cousin(s) are worth looking at:
>
> http://en.wikipedia.org/wiki/**Diamond_problem#The_diamond_**problem<http://en.wikipedia.org/wiki/Diamond_problem#The_diamond_problem>
> [page was last modified on 27 December 2012 at 04:53]
>
> http://www.ibm.com/**developerworks/java/library/j-**clojure-protocols/<http://www.ibm.com/developerworks/java/library/j-clojure-protocols/>
>
> http://stackoverflow.com/**questions/4509782/simple-**
> explanation-of-clojure-**protocols<http://stackoverflow.com/questions/4509782/simple-explanation-of-clojure-protocols>
>
> oo--JS.
>
>
>
>
> 30.12.2012, в 23:58, Daniel Díaz Casanueva <dhelta.diaz at gmail.com>
> написал(а):
>
> Hello, Haskell Cafe folks.
>>
>> My programming life (which has started about 3-4 years ago) has always
>> been in the functional paradigm. Eventually, I had to program in Pascal and
>> Prolog for my University (where I learned Haskell). I also did some PHP,
>> SQL and HTML while building some web sites, languages that I taught to
>> myself. I have never had any contact with JavaScript though.
>> But all these languages were in my life as secondary languages, being
>> Haskell my predominant preference. Haskell was the first programming
>> language I learned, and subsequent languages never seemed so natural and
>> worthwhile to me. In fact, every time I had to use another language, I
>> created a combinator library in Haskell to write it (this was the reason
>> that brought me to start with the HaTeX library). Of course, this practice
>> wasn't always the best approach.
>>
>> But, why I am writing this to you, haskellers?
>>
>> Well, my curiosity is bringing me to learn a new general purpose
>> programming language. Haskellers are frequently comparing Object-Oriented
>> languages with Haskell itself, but I have never programmed in any
>> OO-language! (perhaps this is an uncommon case) I thought it could be good
>> to me (as a programmer) to learn C/C++. Many interesting courses (most of
>> them) use these languages and I feel like limited for being a Haskell
>> programmer. It looks like I have to learn imperative programming (with side
>> effects all over around) in some point of my programming life.
>>
>> So my questions for you all are:
>>
>> * Is it really worthwhile for me to learn OO-programming?
>>
>> * If so, where should I start? There are plenty of "functional
>> programming for OO programmers" but I have never seen "OO programming for
>> functional programmers".
>>
>> * Is it true that learning other programming languages leads to a better
>> use of your favorite programming language?
>>
>> * Will I learn new programming strategies that I can use back in the
>> Haskell world?
>>
>> Thanks in advance for your kind responses,
>> Daniel Díaz.
>> ______________________________**_________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/**mailman/listinfo/haskell-cafe<http://www.haskell.org/mailman/listinfo/haskell-cafe>
>>
>
> ______________________________**_________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/**mailman/listinfo/haskell-cafe<http://www.haskell.org/mailman/listinfo/haskell-cafe>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121230/640e5141/attachment.htm>
More information about the Haskell-Cafe
mailing list