File: fib.hs

package info (click to toggle)
haskell-fdo-notify 0.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 84 kB
  • sloc: haskell: 197; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 603 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import DBus.Notify

main = do
         client <- connectSession
         let startNote = appNote { summary="Starting"
                                 , body=(Just $ Text "Calculating fib(33).") }
         notification <- notify client startNote
         let endNote = appNote { summary="Finished"
                               , body=(Just . Text . show $ fib33) }
         fib33 `seq` replace client notification endNote
     where
         appNote = blankNote { appName="Fibonacci Demonstration" }
         fib 0 = 0
         fib 1 = 1
         fib n = fib (n-1) + fib (n-2)
         fib33 = fib 33