packages feed

phooey-0.3: src/MonadExamples.hs

{-# OPTIONS #-}

----------------------------------------------------------------------
-- |
-- Module      :  MonadExamples
-- Copyright   :  (c) Conal Elliott 2007
-- License     :  LGPL
-- 
-- Maintainer  :  conal@conal.net
-- Stability   :  experimental
-- Portability :  portable
-- 
-- Monadic UI examples
----------------------------------------------------------------------

module MonadExamples where

import Control.Monad (liftM2)

import Graphics.UI.Phooey.Imperative (Source)
import Graphics.UI.Phooey.MonadUI

ui1  ::  UI (Source ())
ui1  =   title "Shopping List" $
         do  a  <- title "apples"   (islider 3  (return (0,10)))
             b  <- title "bananas"  (islider 7  (return (0,10)))
             title "total" (showDisplay (liftM2 (+) a b))