Haskell Real-Time Programming

Being an insistent developer for several years, I never had a desire to learn functional programming.

A couple of months ago, I finally decided to learn Haskell. It's a pretty cool language, but I'm puzzled by how the event-driven application will be programmed in that language. Do you know a good tutorial about this?

Note: When I say "real application", I am not talking about the real world, but about the finished application. I just mean a small application for an example, just to understand it. I think something like a simplified version of the windows caculator would be great, and then maybe something more complicated.

+48
functional-programming haskell
Jul 11 '09 at 8:14
source share
7 answers

When you give examples of the “real world”, you seem to think of problems that are essentially sequences or states or do a lot of I / O, right?

So what about games?

Or, what about the X Window Manager , an extensible clone of Emacs text editor or IDE ?

Then there is a book in which even your question is already in the title: Real World Haskell and which is also available for free !

Another thing you can pay attention to is Functional reactive programming . (For example, it is used in Frag.) An interesting thing about FRP is that it allows you to look at a problem, say, graphical programming from a completely different angle. If you read the GUI chapter in the RWH book, you will see that it talks about how you can write a graphical application, like in C, only better. FRP OTOH allows you to write it in a completely different way, which is not even possible in C.

Many times (I’m not saying that this is the case in your question, but this is a repeating pattern) when someone says “but can Haskell be used in the real world”, what they actually say is “I know how to do it in C, and in Haskell I can't do it the exact same way, so it should be impossible in Haskell, so Haskell is not ready for the real world. But what they are missing out on is that there may be a completely different and much better way to solve the problem. (As if "Erlang has no threads, so it cannot be used to implement parallel systems.") And FRP is just one example.

+88
Jul 11 '09 at 9:32
source share

For lightning-fast conversations, today I put together this list of Haskell applications with a show house, intentionally excluding everything that is only intended for programmers:

  • darcs (35,000 locations since 2002): Distributed version control system with an innovative focus on state changes.
  • xmonad (since 2007, 30,000 places): A well-known window tile manager with a huge layout library and other plugins. Made it a list, despite the fact that its configuration file was a Haskell file.
  • hledger (since 2007, 9000 loc): text file based on a bi-directional accounting tool, ledger clone.
  • Raincat (since 2008, 2000 loc): A platform game with a cat that does not want to get wet.
  • arbtt (loc 2009, 2000): My rule-based automatic time tracking. Did it on the list like a shameless stub; probably not as popular. He now has a proper web page contributed by Waldir Pimenta.
  • detexify (500 places since 2010): the back of the very useful LaTeX character finder is written in Haskell.
  • git-annex (since 2010, 28,000 loc): manages your files and their location, a mix of Dropbox and git. Written by famous Joey Hess, who made a living from him through kickstarter. He is currently conducting a second round of financing !
  • Nikki and Robots (since 2010, 18,000 loc): Platform game with Nikki and, well, his robots. it was released as a commercial independent game and sold through pay, something like a scheme, but the company unfortunately closed.
  • hoodle (since 2011, 13,000 seats): A note and PDF annotation software, for example xournal .
  • Chordify (from 2012 ?? loc): Music analyzes, for example. from a YouTube video and calculates the corresponding guitar chords. Closed software, but supposedly written in Haskell.

(Also featured on my blog , and on conversation slides , with good representative photographs of each program.)

+8
Jul 16 '13 at 20:51
source share

xmonad is an event driven (literally). It has a listener loop that wakes up in events, changing the internal state that simulates the X server, which is then displayed on the screen.

http://xmonad.org

+7
Jul 11 '09 at 10:20
source share

I once found this irc bot written in haskell:

http://www.haskell.org/haskellwiki/Roll_your_own_IRC_bot

+6
Jul 11 '09 at 8:20
source share

Here are some links for your request.

This explains a lot of things that don't "make sense" to the imperative programmer about Haskell

Haskell Tutorial for C Programmers

This very nice, easy-to-use tutorial

Teach you Haskell for a great good

Raytracer written in Haskell

Haskell Raytracer

You can download the Glasgow Haskell compiler here. Ghc

+6
Jul 11 '09 at 8:37
source share

You should check out Real World Haskell . The book is freely available and shows how Haskell can be applied to real problems. I would not call this a study tool, because it is much more comprehensive.

+4
Jul 11 '09 at 9:01
source share
+2
Jul 11 '09 at 8:39
source share



All Articles