Week #6: Discover HaskellPrize Challenge - This week we'll draw a random person that completes the challenge for a $50 Amazon Gift Card!
Challenge submitted by Raynes.

CHALLENGE: Write a desktop calculator in Haskell. It's a scalable application that you can take as far as you like. If you want, you can add variables, and by the time you've added tail recursion, you're turing complete. You can go simple, and just write a simple command-line calculator that does as much as you want it to do. You don't need to learn much of Haskell to write this. If you don't want to write a calculator, you're welcome to write something else. Just Have Fun
INTRODUCING THE LANGUAGE/TECHNOLOGY: It is hard to really introduce Haskell in few words. Haskell is a compiled, advanced purely functional programming language that has been around for over 20 years. Haskell is of the most popular functional programming languages. In Haskell, there are no side effects. There is no 'lets modify that global variable!'. There is no global state. Haskell is pure, and does I/O via the IO monad, which you will learn about fairly early. You don't even have to understand or know what Monads are to use the IO monad, and you can do this challenge with no knowledge of monads. Haskell is strongly and statically type, and the type system actually helps you, rather than gets in your way. Because Haskell is pure, and due to the power of it's type system, it makes it easy to write large, complex, and stable code. It's impossible for there to be a type error in your code at runtime. Code written in Haskell is more likely to work correctly if it compiles than in other languages.
Haskell isn't as hard as people make it out to be. When people say that you have to forget OOP and such to learn Haskell, they mean that you cannot try to learn Haskell and assume that OOP is the only way to do things, or try to write OOP code in Haskell. Haskell is easy to learn if you open your mind, and take yourself back to the beginning. The time before you knew other languages. Your previous knowledge will help you, and as long as your OOP assumptions are left behind, it will not hinder you. Haskell is amazingly fun, and one of the most elegant languages you will ever code in. There are a lot of cool things in Haskell that will blow your mind. Even if you don't decide to use Haskell for personal projects or anything more than this challenge, just writing a little code in Haskell will benefit you. I think once you've used Haskell, you'll want to know more.
More introduction materials can be found here:
http://haskell.org/h...ki/Introduction
IDEAS:
- One you become more familiar with Haskell, turn your calculator into a turing complete language.
- Add a GUI to your calculator using WxHaskell or gtk2hs (and Glade, the GUI builder if you like that sort of thing).
- If a calculator doesn't appeal to you, write something else! Anything else! Just have fun!
My resource thread should definitely come in handy here: http://www.dreaminco...topic144577.htm
I especially recommend that you read through LYAH (Learn You A Haskell) if you're new to the language, and then if you want more, you can start reading Real World Haskell. You can find links to all of this and more in the thread I linked. There is a Functional Programming forum that Skyhawk created partially at my suggestion during my first few days on this site.
It's one of the reasons I like this site so much. It's here: http://www.dreaminco...topic144577.htm. I and a couple other people answer questions in there, though I'm probably the most frequent. If you have any questions, you can ask them there. There are also a few snippets in the Other Language snippet section, but I doubt it's enough to help anybody.
There is also a list of Haskell resources worth checking out:
http://web.cecs.pdx....skellLinks.html
(Provided by Portland State University)
Of course, it is always a good idea to check out the original developer site for tips and guides:
http://www.haskell.org/
HOW TO GET STARTED:
You're going to want to get Haskell via the Haskell Platform, a standard Haskell distribution for all systems. It comes with useful libraries, and stuff you need to install Haskell libraries from Cabal and such. Not to mention, the flagship Haskell compiler, GHC. It's insanely simple to install regardless of what system you use. There is even a Windows installer. You can find the link to the Haskell Platform to the resource thread I linked in resources.
After you've installed Haskell, you'll probably want to use Emacs or Vim to code in it. Of course, you can use any text editor, but you wont get the most out of Haskell unless you use Emacs or Vim. There is also an IDE for Haskell written in Haskell called Leksah. I hear it's pretty good at this stage. There is a bit of information about various editors, including relevant links in the resource thread.
Once you've installed Haskell, you can fire up a terminal and type 'ghci' to get the Haskell 'REPL' running. This is probably the most useful thing you will ever use. You can type in expressions and have them evaluated immediately. Once you have GHCi running, type this in:
putStrLn "Hello, DiC!"
Have fun!

New Topic/Question
Reply



MultiQuote











|