From: Peng Zang <peng.zang@gmail.com>
To: caml-list@yquem.inria.fr
Cc: "blue storm" <bluestorm.dylc@gmail.com>,
"circ ular" <circularfunc@gmail.com>
Subject: Re: [Caml-list] Haskell vs OCaml
Date: Thu, 14 Aug 2008 10:01:32 -0400 [thread overview]
Message-ID: <200808141001.34705.peng.zang@gmail.com> (raw)
In-Reply-To: <200808140928.40626.peng.zang@gmail.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 14 August 2008 09:28:34 am Peng Zang wrote:
> OCaml let's you write however you think about it. Haskell makes you think
> about it in *the haskell* way. Sometimes this is good because it forces
> you to do certain things. Othertimes it just gets in your way.
>
>
> Peng
Haha, I have some free time. So, let me explain more about why sometimes it's
good that Haskell makes you do things in a certain way.
One is that Haskell forces your program into two parts. Parts that contain
side-effects (in monads) and the part that is pure. This is great because
the compiler can now do some optimizations not available when you don't know
if your code is pure. This is also good because side-effects can be
confusing and difficult to maintain over time. By putting all the side
effects in a box, you can compartmentalize it away. For lots of changes you
only have to consider the pure stuff which is easier to think about (no
worries about state, no worries about the right order of doing things,
program in a declarative fashion). The downside is you have to put all the
side-effect stuff in a corner and box it off. This can be a little odd
because it may make you organize your code in a counterintuitive way. Also
it makes side-effect creep very obvious (when you realize "oops, that needs
to be in a monad too... and that... and that ... crap"). You really have to
sit down and think about the design before you do anything. Haskell is
definitely a first-on-paper, then-in-code type of language. This can be good
because for complex stuff you probably want to think about the design ahead
of time anyways. Haskell forces this discpline on you. On the other hand,
if you like to do rapid prototyping type of approach and live on the edge a
bit, it can be a bummer.
A similar argument follows for lazy (non-strict) evaluation as well. Allows
some really cool stuff (eg. infinite lists) and optimizations (eg.
deforestation). But has significant overhead (eg. you have to make a thunk
for everything, if you're going to evaluate it anyways, all that work to make
the thunk is wasted) and it's hard to reason about speed and memory
performance (eg. it looks like a tail recursive function that uses constant
stack space but because the accumulator is thunked, you end up creating O(N)
thunks).
Anyways, I think Haskell has some really cool ideas and I like it. It
definitely expands the mind. But OCaml is my go-to-swiss-army-knife of
languages. It used to be C but that was too low level for me and library
support was crap (this was before Boost). Then it was Java but it was waay
to verbose and you couldn't even return a tuple without creating a class for
it first. Then it was Lisp, but it's dynamically typed and I got tired of
finding bugs from 3 years ago. Now days it's OCaml. Maybe one day it'll be
something else, but in the mean time, I'm enjoying it.
Peng
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
iD8DBQFIpDq+fIRcEFL/JewRAv3eAJ9L3W43Qfn2bFpLpUiyRt4Dn1dt6gCeNvew
8w6kCN5AKcGJH8WYzJPyKVM=
=6HsO
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2008-08-14 14:01 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 12:48 circ ular
2008-08-13 13:27 ` [Caml-list] " Brian Hurt
2008-08-14 0:09 ` Jon Harrop
2008-08-14 2:46 ` David Thomas
2008-08-14 2:52 ` Erik de Castro Lopo
2008-08-14 10:37 ` Paolo Donadeo
2008-08-14 12:17 ` Jon Harrop
2008-08-14 16:44 ` Erik de Castro Lopo
2008-08-14 11:50 ` blue storm
2008-08-14 12:47 ` David Mitchell
2008-08-14 13:28 ` Peng Zang
2008-08-14 14:01 ` Peng Zang [this message]
2008-08-15 2:09 ` blue storm
2008-08-14 13:57 ` Jon Harrop
2008-08-14 14:06 ` Peng Zang
2008-08-14 14:21 ` Vincent Hanquez
2008-08-14 14:44 ` Jon Harrop
2008-08-14 20:57 ` Nicolas Pouillard
2008-08-14 21:16 ` Jon Harrop
2008-08-14 21:50 ` Nicolas Pouillard
2008-08-15 0:15 ` Jon Harrop
2008-08-15 1:14 ` Stéphane Glondu
2008-08-17 1:00 ` Luca Saiu
2008-08-19 2:40 ` Paul Snively
2008-08-20 11:33 ` Dr. Thomas Fischbacher
2008-08-21 8:47 ` DooMeeR
2008-08-21 10:59 ` David Teller
2008-08-21 13:52 ` Dr. Thomas Fischbacher
2008-08-14 13:26 Damien Guichard
[not found] <fa.e3jKyg6bl9+vTkPgypQ4ZRzEoos@ifi.uio.no>
2013-03-18 9:08 ` adrian.alexander.may
2013-03-18 9:48 ` Malcolm Matalka
2013-03-18 9:59 ` Gabriel Scherer
2013-03-18 11:05 ` Adrian May
2013-03-18 11:26 ` Kakadu
2013-03-19 1:23 ` Francois Berenger
2013-03-26 10:36 ` Nicolas Braud-Santoni
2013-03-26 0:49 ` Kristopher Micinski
2013-03-26 2:37 ` Erik de Castro Lopo
2013-03-26 2:57 ` Kristopher Micinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200808141001.34705.peng.zang@gmail.com \
--to=peng.zang@gmail.com \
--cc=bluestorm.dylc@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=circularfunc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox