7 ms·
Does anyone have any suggestions for beginner Haskell projects? I've read through some Haskell material before and tried following tutorials, but I always end
by munctional 17y ago
Does anyone have any suggestions for beginner Haskell projects?
I've read through some Haskell material before and tried following tutorials, but I always end up dropping it because I can't think of anything for which I would use it.
I have no problem with functional and functional-esque programming (Erlang, Common Lisp, etc.), but I just can't come up with anything to do in Haskell. :(
EDIT:
Thanks for the great suggestions, everyone! I think I'll do some crpyo-based maths work in Haskell since that is what holds my interest at the moment. :-)
- dons 17y agoSomething with lots of threads.
- smikhanov 17y ago...with STM thrown inside (an in-memory DB?)
- lg 17y agoI usually start picking up new languages by taking something I've written and translating it into the new language.
- brianobush 17y agoexactly my approach, also you can try college homework assignments found via google.
- christopherdone 17y agoThat's a good way to see if the language actually helps you do things easier, too!
- scorciapino 17y agoInstall xmonad and configure it properly
- jrockway 17y agoThat is 99% copypaste, and you don't learn how to actually write your own Haskell programs.
- eru 17y agoProbably true. At least you will see some Haskell-syntax. Writing an extension for XMonad may be worthwhile, though. Or learning about its inner workings. (There are some good introductions floating around the net. They put a lot of thought into the types in XMonad.)
- ashish01 17y agotry this (Write Yourself a Scheme in 48 hours) http://jonathan.tang.name/files/scheme_in_48/tutorial/overview.html http://jonathan.tang.name/files/scheme_in_48/tutorial/overvi...
- ricree 17y agoI'll second that. 48 hours is optimistic as heck (or I'm just that bad), but it definitely has helped me wrap my head around Haskell a little better than it was before.
- munctional 17y agoAwesome, I'll look into this, too. :D
- tphyahoo 17y agoinstall the guestbook sample app from happstack, start coding the next viaweb. profit...
- jrockway 17y agoI always end up dropping it because I can't think of anything for which I would use it. What do you normally program? Do that, but in Haskell. It's a general-purpose programming language, and there are plenty of libraries to help you in any area.
- davidw 17y agoAs someone who sympathizes with the OP's way of learning programming languages, I think what I'm interested in seeing is some commentary on where Haskell's "sweet spot" may be. There are tons of languages out there, and I don't want to learn new ones just for the sake of it. Ok, actually I do if I'm honest with myself, but I need some kind of practical justification for it:-) With Erlang it's easy to say "oh, cool, this is really, really good for this type of application". Haskell seems like it's fairly fast and perhaps good for doing calculations, but that's the only vague notion I have of what it might be useful for in the real world.
- merijnv 17y agoI've been busy learning Haskell on and off between classes since December. And the main points I noticed so far are: tl;dr version: 1) It's a pretty language. 2) It's fast. 3) Static typing (and its optional companion "formal verification") rock. 4) Higher-order functions, Algebraic Data Types, Polymorphism and currying are our friends. 5) Exceptions are evil[1], explicit error handling is safer. Finally a language that hands me more convenient way of explicit error handling then: int result = someCLibraryCall(); if (result == -1) { fprintf(stderr, "Ach, mein leben!"); exit(EXIT_FAILURE); } Long verbose version: 1) Haskell comes with lots of nice syntactic sugar: Arbitrarily changing prefix into infix functions or vice versa: elem foo list == foo `elem` list 1 + 2 == (+) 1 2 Python-like indenting for blocks instead of braces (you could also use braces, but I've gotten allergic to them since learning python) 2) For a language as high-level as Haskell, it's FAST. Most of the benchmarks show it pretty consistently in the C/Java performance regions (depending on what you're doing of course). 3) I used to hate static typing and think dynamic typing was the "end all, be all" of typing solutions until I start learning Haskell and suddenly realized I don't hate static typing, but that I hate crappy static typing implementations (Java, C, I'm looking at you). A bonus of this is that it makes program verification of Haskell programs A LOT easier. During my class on protocol validation the mu-calculus we used for verifying programs was almost trivial to translate to Haskell (and vice versa). I'm a firm believer in "formal verification" as a means to detect/prevent bugs. And while it might not be an issue for the programming world at large right now[2] (who cares if a word processor or browser crashes), it is important for mission critical software on things like cars, train, airplanes and space shuttles... As a side note, I still like and use dynamic systems like python, but only for "trivial" code. i.e. quick scripts and stuff where I don't care if it breaks. 4) I find that with Haskell I'm usually working on a much higher level of abstraction then otherwise. Which means I'm spending more time thinking and scribbling on my white board and less time writing code and fixing stupid mistakes. 5) Monads like Maybe and Either allow for various convenient ways to do explicit error handling (there's probably a gazillion more ways to do explicit error handling with monads, but I don't grok them enough yet). While Haskell still has exceptions they're far more limited and more sparsely used then in other languages. EDIT: Removed very verbose and vague description of the Maybe monad, examine the example posted by jmillikin below instead. In conclusion, what's Haskell good for? Well, I find it lends itself pretty well for high-level, abstract, meta sort of programming. The type a lot of people advertise Lisp for. And while Lisp macro's might be a tad more expressive[3], Haskell is most certainly prettier. And as behoofs any (ex-)python programmer I'm convinced readability matters. All this while still being fast, reasonably good at stopping you from writing bugs and relatively easy to debug. Sounds like good enough reasons to use it, for me. [1] - I'm not gonna argue "why" here, if you want to know I recommend Googling "Exceptions considered harmful" or "why exceptions suck" and you'll find plenty of in-depth explanations. [2] - Actually, I do think it is relevant to ALL programmers. But that's more of a personal opinion which not a lot of people seem to share. [3] - This is a hunch, learning Lisp/Scheme/Clojure is still on my todo list, so I'm not entirely sure if Lisp macro's can do things which are impossible in Haskell or not.
- colonhyphenp 17y agoI learned the basics of Haskell by doing some problems from http://projecteuler.net http://projecteuler.net. It's probably not as exciting as actually building something using the language, but it's definitely worth checking out.