Beginners Guide to Haskell? [closed] - haskell

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've been looking for a decent guide to Haskell for some time, but haven't been able to find one that seems interesting enough to read through and/or makes sense.
I've had prior exposure to Haskell a few years back, but I can't remember much about it. I remember the "Aha!"-feeling was incredible when I finally got it, and it was actually fun to play with, so I'm looking to rediscover the lost art of Haskell.
I'm familiar with Ruby and its functional programming tricks, so I think I'm not completely in the dark. Any links?

This looks like it fits the bill in the style of Why's Poignant Guide to Ruby.
Learn You a Haskell for Great Good!

Some good places to start are:
The Gentle Introduction To Haskell
Problem Solving in Haskell
Happy Learn Haskell Tutorial
Other resources:
Interesting blog entry on a Study plan for Haskell via the Wayback Machine
HaskellWiki
Generic Haskell User Guide (PDF)

If you're like me, and like videos of presentations, than this is a good tutorial:
A Taste of Haskell
Part 1
Part 2
Slides
It's a three-hour tutorial, that uses xmonad as a running example to explain Haskell to experienced (imperative) programmers.
The presentation is given by Simon Peyton-Jones who, besides being one of the top Haskell designers, is also a great speaker.

Once you get past the beginning stages, I would highly recommend reading Real World Haskell.

The Haskell wikibook which includes the text from the great tutorial Yet Another Haskell Tutorial.
(The "Generic Haskell User Guide" paper is a fine paper, but I think it is a particularly bad recommendation for a beginning Haskell programmer, as it is more of an academic paper presenting extensions to Haskell and basically a different language "Generic Haskell" (i.e. Haskell with an old version of Generics) instead of standard Haskell 98. <irony>If you were looking for dense reading about Haskell, start with the Haskell 98 report.</irony>)

Real World Haskell is a really good book.

Yet Another Haskell Tutorial (PDF) worked for me.
Edit: Updike points out that the text of YAHT has been folded into the Haksell Wikibooks. The PDF is still useful if you (like me) prefer to print out and read on paper.
BTW I have also read A Gentle Introduction To Haskell (also available as PDF). I will definitely not recommend this for beginners. It is only gentle compared to the Haskell Report. However it is a good reference when you have a solid understanding of the language.

A rather late response but I thoroughly enjoyed reading from Learn You A Haskell available online as well as a book.

I've been told to look at
Programming in Haskell, from Graham Hutton

In addition to "Real World Haskell", find a copy of "Haskell: The Craft of Functional Programming". Great textbook.

I like Haskell Tutorial for C Programmers. Especially if you are coming from an imperative language background as I do.

I have downloaded 10 slides from this page http://www.cs.nott.ac.uk/~gmh/book.html and going through it for many times. It workz ;)

Strange that nobody suggested Real World Haskell. That's IMHO the best Haskell book you currently can get you can get it for on or offline reading.

One thing that is really unique about Haskell is that there is a mailing list exactly for beginners. Go to Haskell-Beginners.
Reading books is good, but having some humans to ask is always a great resource, too. Together, I think there is absolutely no reason to say "Haskell is hard to learn because there's no material on it."
You might also want to visit #haskell at irc.freenode.net.

There is also a nice lecture series from the RWTH Achen.
here you will find exams and exercises (possibly in German)
and here are the recordings of the solutions
I got all of this info from the Haskell Wiki's Video presentations page.

This is where I started.
haskell.org

Related

Good Haskell source to read and learn from [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What are some open source programs that use Haskell and can be considered to be good quality modern Haskell? The larger the code base, the better.
I want to learn from their source code. I feel I'm past the point of learning from small code examples, which are often to esoteric and small-world. I want to see how code is structured, how monads interact when you have a lot of things going on (logging, I/O, configuration, etc.).
What I recommend.
Read code by people from different grad schools in the 1990s
Oxford style
Glasgow style or (this)
Chalmers style (or this)
York style
Portland style or OGI style (or this)
Utrecht style
Yale style
Special case: CMU/Elliott
Read code by the old masters certain people (incomplete list)
Marlow; Paterson; Peyton Jones; Gill; Launchbury; Hughes; Wadler; Bird; Claessen; Jones; Tolmach; Sheard; Swiestra; Augustsson; Runciman; Wallace; Thompson; Hinze; Gibbons; Leijen; Hudak; Elliott; Finne; Chakravarty; and
Anyone who has written a functional pearl.
Note that people like me, Coutts, Mitchell, O'Sullivan, Lynagh, etc. learned our Haskell style from these guys.
Read some applications
Read the GHC base library source
Read the xmonad source
XMonad is an open source tiling window manager, originally loosely modeled on dwm. There are a lot of extensions, of varying quality, but the core is compact and well organized.
Haskell: Functional Programming with Types
Joeri van Eekelen, et al. | Wikibooks
Published in 2007, 290 pages
Learn You a Haskell for Great Good!
Miran Lipovaca | LearnYouaHaskell.com
Published in 2010, 176 pages
Real World Haskell
B. O'Sullivan, J. Goerzen, D. Stewart | O'Reilly Media, Inc.
Published in 2008, 710 pages
The Haskell Road to Logic, Maths and Programming
Kees Doets, Jan van Eijck | College Publications
Published in 2004, 449 pages
Darcs is an open source, source code management system. It should give you a nice idea for Haskell.
The source code to the Yesod Web Platform is fairly complex, well thought out, and well written. You will learn a lot from the persistence library that comes with it as well.
If you care about Web-programming I would recommend Chris Done's lpaste project.
GHC is probably the biggest or one of the biggest projects written in Haskell that is open source. When I say biggest, I do not just mean in terms of source size, but also impact, use, innovation, robustness. GHC can teach you a lot about writing Haskell.

LISP or Haskell [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
LISP or Haskell, I need to learn functional programming, but I heard that lisp is very old, any advice between those two languages ?
Just to echo the others, I'd learn both Scheme (a more functional Lisp dialect) and Haskell. Scheme / Lisp have some useful tricks to teach you about 'code is data / data is code' and macros. Scheme encourages a good functional style and I would recommend the 'The Little Schemer' series of books to get you started on this. SICP is also a fantastic text http://mitpress.mit.edu/sicp/full-text/book/book.html and possibly one of the best books ever written on programming. Scheme is more accessible as a first functional language.
Once you've got the hang of Scheme you'll probably find yourself becoming frustrated with the lack of libraries, lack of parallelism and the small, although excellent, community. This is where I was when I decided to learn Haskell. Haskell is very mature, very useful and very functional and it is quite a challenge to learn once you move off the basics and so having a grounding in another functional language will help enormously. You won't regret learning either (or both).
Why not both? LISP is very easy to learn (I'd go for the Scheme dialect - see http://racket-lang.org) so I'd start with that. If you like it, stick with it, but I'd also give Haskell a go, although it is (in my experience) considerably harder to wrap your head around.
The great thing about computing these days is that you can try all these languages for free, apart from your time. When I started programming LISP was only available on mainframes, which put a bit of a crimp on trying to learn it.
Haskell, because once you've learned Haskell, you will love it. And then, you will be able to learn Common LISP. However, if your editor is Emacs, then go start with Lisp.
If you want to learn functional programming through implementing a compiler or interpreter of a language, then Lisp or ML should be a better first choice as they're much simpler to implement than a lazy language. Otherwise you'd better learn both.
Choosing based on age is silly, Haskell has been around much longer than say C# and its history extends back a lot further. Anyway I'd recommend learning both eventually, for learning functional programming, Haskell is specifically about purely functional programming (in a number of senses of the meaning). Scheme is a functional orientated descendant of lisp.

How and why are languages formed / Are there any developing languages showing promise? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Question 1: How exactly do modern computer language come into being and why? How do they get their start and who is behind them?
Question 2: If any, what languages currently in their infancy are showing promise?
How exactly do modern computer language come into being and why? How do they get their start and who is behind them?
It's a multistage process:
Pointy-headed type theorists and other professionals are continually proposing new language features. You can read about them in places like the Proceedings of the ACM Symposium on Principles of Programming Languages (POPL), which has been held annually since 1973.
Many of these proposals are actually implemented in some research language; some research languages I personally find promising include Coq and Agda. Haskell is a former research language that made it big. A research language that gets 10 users is often considered a success by its designers. Many research languages never get that far.
From research to deployment I know of two models:
Model A: A talented amateur comes along and synthesizes a whole bunch of existing features, maybe including some new ideas, into a new language. The amateur has talent, charisma, and maybe a killer app. Thus C, Perl, Python, Ruby, and Tcl are born.
Model P: A talented professional make career sacrifices in order to build and promulgate a new language. The professional has talent, a deep knowledge of the field, and maybe a killer app. Thus Haskell, Lua, ML, Pascal, Scala, and Scheme are born.
My definition of a professional is someone who is paid to know about programming languages, to pass on that knowledge, and to develop new knowledge in programming languages. Unfortunately this is not the same as designing and implementing new languages, and it is not the same as making implementations that many people can use. This is why most successful programming languages are designed and built by amateurs, not professionals.
There have been quite a few interesting research languages that have had hundreds or even thousands of users but yet never quite made it big. Of these one of my favorites is probably Icon. I have argued elsewhere that nobody really knows why languages become popular.
Summary: Languages come into being because people want to make programming better, and they have new ideas. Languages get their start when somebody takes a whole bunch of ideas, some new and some proven, and synthesizes them into a coherent whole. It's a big job. The person behind a new language might be a programming-language professional, but historically, most languages that become widely used seem to have been created by talented amateurs.
Answer 2: Fortran 2008 looks very promising.
Come on, bring on the downvotes you humourless Java-teenies, Pythonettes, Rubes and Haskellites !
1) Most development environments these days are built to abstract a lot of low-level/inner workings of an platform to speed up development and cater for new user-interfaces and plaform technologies. There are a both open-source projects and corporates behind these changes... For instance an example would be jQuery is a newish Library that just wraps a lot of javascript making things easier and cross-platform...
Bjarne Stroustrup wrote a book on the history of C++, called "The Design and Evolution of C++".
The genesis of a programming language is always a different story. I'm currently reading "Masterming of programming", which is a series of interview with authors of popular languages. They explain what problems they tackled and how the language was born -- a really cool book.
The TIOBE index can give somehow a trend amongst the programming languages, including the emerging ones. I bet that the future lies in language that will run on top of the JVM or CLR (Notably due to the effort invested in the VMs which are now really great). Concurrency seems to be one of the hot problem of today; so I guess we will see some interesting moves in this area (e.g. Clojure).

What is a better language-introduction preview than "Hello World"? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Many programming languages introduce themselves with a simple "Hello World" program.
As a programmer, I must admit that this does not give very good insight into the strenghts and capabilities of the language.
What kind of problem would you suggest to use when providing a demo of a programming language?
I think the "Hello World" program has its uses. It says a lot if you can run that program:
You have your IDE/Tools setup correctly
You can write a class and or main method in that language
You can call a function in that language to print
You can edit a file and format it correctly for that language
Your compiler is working and you know how to use it.
So, for those reasons I don't find any better alternative to "Hello World."
However, in terms of a good intro to languages in general, I'm a big fan of coding challenges like Python Challenge. You are given a set of challenges/puzzles you have to complete with the language. They start out extremely basic (the first one is easier than writing a hello world).
They quickly progress into more difficult and advanced tasks, and usually are tasks that are intended to show off a particular aspect of the language.
I only wish every language had such a fun programming challenge. I think a LISP, Haskell, C++, C, Java, etc Challenge would be a fun introduction to the languages for people. They could be tailored to the languages.
The C++ challenge could quickly start having challenges involving pointers and other commonly misunderstood aspects to help drive home those difficult bits while the LISP/Haskell challenges could start to ask some questions that are more tailored to functional languages.
If you are worried about the scope of a "hello world" program, you can always upgrade to "hello universe"
IMHO, the purpose of the hello world program is to show a very simple program in that language, not to show the strengths and capabilities.
It would be hard as each language has its own strengths. Comparing a standard set of functions for each language might be asking for trouble, especially for an intro book.
Larry O'Brian wrote three very good blog posts on exercises to familiarize yourself with a programming language.
Part 1: Basics
Part 2: Data Structures
Part 3: Libraries, Frameworks and Mashups
"99 bottles of beer" is a slightly more involved example than "Hello world", so it can show the things that differentiate one language from the others.
Check out http://99-bottles-of-beer.net/ .
Depends on what core feature of the language sets it apart from other languages out there. The Haskell quicksort comes to mind.
With that said, hello world does show how to immediately produce some sort of output.
Personally when I start out in a new programming language I attempt to re-write a piece of code that I have already written in a different language so that I can get a feel for the language and see how it relates back to what I have already learned in my previous programming experiences.
People suggest programming simple stuff like binary search trees, and other data structures along with a simple way to test that it works. The other thing is to not give up on the programming language when things start to get complicated or do not fit in with your previous experience.
As for looking for the strengths in programming languages? Well, start out by writing a small application and then once you have a feel for the language look at open source projects written in this language. See what it does very well, look at mailing lists found out where the difficult parts were for that project, where they had to work around some idiosyncrasy in the language that caused them issues.
Certain languages you know right off the bat that they were meant for a certain task and using them outside of that task is not recommended. For example, PHP is a web programming language, the fact that you can write big programs in it and run them on the command line does not mean it is a language that should be used for those tasks.
I was very favorably impressed by Bjarne Stroustrup's choice to make a quite powerful calculator, including parsing. I expected that it would be too difficult as a first project, but he does an excellent job step by step. And the final application is not a toy.
All in his new book, Programming Principles and Practice in C++.
I some cases "Hello world" may be non-trivial.
See for example Struts 2 "Hello world". To have it working you'd need to have server set up, environment set up, your app deployed, etc.
Well a "blinky" is a good alternative, but that is more in the embedded world that this is relevant...
For you who have misses out on blinky, it is just to get a LED to blink on/off at steady pace. Kind of shows how to work with gpio.
/Johan

What are good starting points for someone interested in natural language processing? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Question
So I've recently came up with some new possible projects that would have to deal with deriving 'meaning' from text submitted and generated by users.
Natural language processing is the field that deals with these kinds of issues, and after some initial research I found the OpenNLP Hub and university collaborations like the attempto project. And stackoverflow has this.
If anyone could link me to some good resources, from reseach papers and introductionary texts to apis, I'd be happier than a 6 year-old kid opening his christmas presents!
Update
Through one of your recommendations I've found opencyc ('the world's largest and most complete general knowledge base and commonsense reasoning engine'). Even more amazing still, there's a project that is a distilled version of opencyc called UMBEL. It features semantic data in rdf/owl/skos n3 syntax.
I've also stumbled upon antlr, a parser generator for 'constructing recognizers, interpreters, compilers, and translators from grammatical descriptions'.
And there's a question on here by me, that lists tons of free and open data.
Thanks stackoverflow community!
Tough call, NLP is a much wider field than most people think it is. Basically, language can be split up into several categories, which will require you to learn totally different things.
Before I start, let me tell you that I doubt you'll have any notable success (as a professional, at least) without having a degree in some (closely related) field. There is a lot of theory involved, most of it is dry stuff and hard to learn. You'll need a lot of endurance and most of all: time.
If you're interested in the meaning of text, well, that's the Next Big Thing. Semantic search engines are predicted as initiating Web 3.0, but we're far from 'there' yet. Extracting logic from a text is dependant on several steps:
Tokenization, Chunking
Disambiguation on a lexical level (Time flies like an arrow, but fruit flies like a banana.)
Syntactic Parsing
Morphological analysis (tense, aspect, case, number, whatnot)
A small list, off the top of my head. There's more :-), and many more details to each point. For example, when I say "parsing", what is this? There are many different parsing algorithms, and there are just as many parsing formalisms. Among the most powerful are Tree-adjoining grammar and Head-driven phrase structure grammar. But both of them are hardly used in the field (for now). Usually, you'll be dealing with some half-baked generative approach, and will have to conduct morphological analysis yourself.
Going from there to semantics is a big step. A Syntax/Semantics interface is dependant both, on the syntactic and semantic framework employed, and there is no single working solution yet. On the semantic side, there's classic generative semantics, then there is Discourse Representation Theory, dynamic semantics, and many more. Even the logical formalism everything is based on is still not well-defined. Some say one should use first-order logic, but that hardly seems sufficient; then there is intensional logic, as used by Montague, but that seems overly complex, and computationally unfeasible. There also is dynamic logic (Groenendijk and Stokhof have pioneered this stuff. Great stuff!) and very recently, this summer actually, Jeroen Groenendijk presented a new formalism, Inquisitive Semantics, also very interesting.
If you want to get started on a very simple level, read Blackburn and Bos (2005), it's great stuff, and the de-facto introduction to Computational Semantics! I recently extended their system to cover the partition-theory of questions (question answering is a beast!), as proposed by Groenendijk and Stokhof (1982), but unfortunately, the theory has a complexity of O(n²) over the domain of individuals. While doing so, I found B&B's implementation to be a bit, erhm… hackish, at places. Still, it is going to really, really help you dive into computational semantics, and it is still a very impressive showcase of what can be done. Also, they deserve extra cool-points for implementing a grammar that is settled in Pulp Fiction (the movie).
And while I'm at it, pick up Prolog. A lot of research in computational semantics is based on Prolog. Learn Prolog Now! is a good intro. I can also recommend "The Art of Prolog" and Covington's "Prolog Programming in Depth" and "Natural Language Processing for Prolog Programmers", the former of which is available for free online.
Chomsky is totally the wrong source to look to for NLP (and he'd say as much himself, emphatically)--see: "Statistical Methods and Linguistics" by Abney.
Jurafsky and Martin, mentioned above, is a standard reference, but I myself prefer Manning and Schütze. If you're serious about NLP you'll probably want to read both. There are videos of one of Manning's courses available online.
If you get through Prolog until the DCG chapter in Learn Prolog Now! mentioned by Mr. Dimitrov above, you'll have a good beginning at getting some semantics into your system, since Prolog gives you a very simple way of maintaining a database of knowledge and belief, which can be updated through question-answering.
As regards the literature, I have one major recommendation for you: run out and buy Speech and Language Processing by Jurafsky & Martin. It is pretty much the book on NLP (the first chapter is available online); used in a frillion university courses but also very readable for the non-linguist and practically oriented, while at the same time going fairly deep into the linguistics problems. I really cannot recommend it enough. Chapters 17, 18 and 21 seem to be what you're looking for (14, 15 and 18 in the first edition); they show you simple lambda notation which translates pretty well to Prolog DCG's with features.
Oh, btw, on getting the masters in linguistics; if NL semantics is what you're into, I'd rather recommend taking all the AI-related courses you can find (although any courses on "plain" linguistic semantics, logic, logical semantics, DRT, LFG/HPSG/CCG, NL parsing, formal linguistic theory, etc. wouldn't hurt...)
Reading Chomsky's original literature is not really useful; as far as I know there are no current implementations that directly correspond to his theories, all the useful stuff of his is pretty much subsumed by other theories (and anyone who stays near linguists for any matter of time will absorb knowledge of Chomsky by osmosis).
I'd highly recommend playing around with the NLTK and reading the NLTK Book. The NLTK is very powerful and easy to get into.
You could try reading up a bit on phrase structured grammers, which is basically the mathematics behind much language processessing. It's actually not that heavy, being largely based on set and graph theory. I studied it many moons ago as part of a discrete math course, and I guess there are many good references available at this stage.
Edit:Not as much as I expected on google, although this one looks like a good learning source.
One of the early explorers into NLP is Noam Chomsky; he wrote small books on the subject in the 50s through the 70s. You may find that engaging reading.
Cycorp have a short description of how their Cyc knowledge base derives meaning from sentences.
By utilising a massive knowledge base of common facts, the system can determine the most logical parse of a sentence.
A simpler place to begin with the building blocks is the look at the documentation for a package that attempts to do it. I'd recommend the Python [Natural Language Toolkit (NLTK)1, particularly because of their well-written, free book, which is filled with examples. It won't get you all the way to what you want (which is an AI-hard problem), but it will give you a good footing. NLTK has parsers, chunkers, context-free grammars, and more.
This is really hard stuff. I'd start off by getting at least a Masters in Linguistics, and then work towards my PhD in computer science, concentrating on NLP.
The problem is that most of us don't have the understanding of what language is. And without that understanding, it's bloody tough to implement a solution.
Other comments give some readings, which are probably fine if you want to get started playing around with a small subset of the problem, but in order to come up with a really robust solution, then there are no shortcuts. You need the academic background in both disciplines.
A very enjoyable readable introduction is The Language Instinct by Steven Pinker. It goes into the Chomsky stuff and also tells interesting stories from the evolutionary biology angle. Might be worth starting with something like that before diving into Chomsky's papers and related work, if you're new to the subject.

Resources