Skip to content

Commit

Permalink
Add example for Haskell.
Browse files Browse the repository at this point in the history
  • Loading branch information
FranklinChen committed Feb 17, 2015
1 parent fac70db commit 809b3e7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/haskell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Haskell examples

### Count

Start the server with

```
$ websocketd --port=8080 --devconsole --passenv PATH ./count.hs
```

The passing of `PATH` was required for me because a typical Haskell installation of `runhaskell` does not go into `/usr/bin` but more like `/usr/local/bin`.
10 changes: 10 additions & 0 deletions examples/haskell/count.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env runhaskell

import Control.Monad (forM_)
import Control.Concurrent (threadDelay)

-- | Count from 1 to 10 with a sleep
main :: IO ()
main = forM_ [1 :: Int .. 10] $ \count -> do
print count
threadDelay 500000

0 comments on commit 809b3e7

Please sign in to comment.