[Haskell-beginners] Re: Some beginning questions for Haskell
Ertugrul Soeylemez
es at ertes.de
Wed Jul 7 10:08:29 EDT 2010
Liu shuping <lsp.lhh at gmail.com> wrote:
> I am new to Haskell, currently I am doing .Net development on windows
> platform. I began to know about Haskell for the reason when I knew
> some C# lambda features come from functional language. I am interested
> in Haskell from the very beginning when I saw it.
Hello there and welcome to the Haskell world. First of all, Haskell is
a general purpose language, so you can write any kind of problem. But
of course this is only half of the story.
> For I am really a very beginner, I get some basic questions:
> 1. Can you have some very general information to explain why use
> Haskell or functional language.
There are lots of pages on the WWW explaining "why functional
programming (FP) matters" (this is the name of one of them). To give a
short summary: FP gives you less programming errors, less code to type
and more readable code (to FP programmers, of course). Also modern FP
languages give you sophisticated type systems. Languages like C#, D and
Java approach this, but are far from comparable.
> 2. Is it a right choice of Haskell if I want to develop some geology
> software which mainly doing some huge numerical computation which
> takes long long time?
Probably yes. There are a few libraries for fast numerical
calculations, including bindings to well known number crunching
packages. If your favorite package is not among those, you can easily
make a binding on your own using the foreign function interface. This
is very easy.
Regarding performance: If you used to develop in C#, don't worry too
much. Your Haskell programs will probably be faster.
> 3. How about user interface, is Haskell capable to build application
> with complex user interface? or should I just use Haskell to build the
> core engine and user other language to build the user interface?
There are two major library bindings: Gtk2hs and wxHaskell. You can
use them to build any type of graphical user interface portably.
> 4. Is Haskell cross-platform? I mean if the Haskell source code is
> "code once and build everywhere?"
Much more than C#. In general, unless you use OS-specific functions,
you won't have any portability issues.
> 5. Are there any successful applications built with Haskell? they can
> give me a direct scene of what Haskell can do.
Nothing very big yet. Darcs is an excellent version control system.
GHC is the most mature Haskell compiler. Xmonad is a simple window
manager for X. There is also Frag, a small 3D shooter (essentially a
tech demo). Finally I would mention Happstack, a complete framework for
rapid and safe web development.
Now as I've noted above, this is only half of the story. The Haskell
user base is much smaller than the user bases of the most popular
languages, so there are less libraries and less applications.
One reason for this is that Haskell has a steep learning curve. Many
Haskell programmers find that in the first few days or even weeks they
do much more learning than actual programming. Not that they couldn't
get applications done, but Haskell is all about safety and correctness,
so you want to learn to do it properly instead of just doing it, like
you would in, say, PHP. This is why we say Haskell is valuable to know,
even if you don't use it.
Note that other languages are slowly adopting Haskell concepts. This
can be seen most clearly in Microsoft's F# language. It's nowhere near
Haskell, but you can see a lot of inspiration. It has very similar
syntax, algebraic types, currying and it even employs monadic
computations (they call them computation expressions).
Conclusion: Go ahead and learn Haskell. Then decide for yourself,
whether it's suitable for your project. Don't worry, learning Haskell
will always pay off, even if you don't use it. Also don't fear to use
languages, which are not widely used. Paul Graham has written a nice
anecdote about this [1]. You should definitely read it, it's a true
story.
[1] http://www.paulgraham.com/avg.html
Greets,
Ertugrul
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
More information about the Beginners
mailing list