Provides useful anaphoric and monadic versions of if-else and when, as
well as infix operators for the actions to allow things like this:

-- Allow the clause to be in m a
whenM (Gtk.widgetIsFocus win) $ do
  this
  that

-- anaphoric if.  If the condition is nonempty, pass the conditional
value to the "then" clause, otherwise do an action that requires no
parameter.
aif (lookup name list)
  (\file -> Right `liftM` hGetLine file)
  (do f <- openFile name
       l <- hGetLine file
       return $ Right (f,l))

-- infix version of Control.Monad.When
(x>5) >>? putStrLn x

-- infix version of anaphoric when
lookup name list >>=? \value -> putStrLn value

-- infix version of anaphoric whenM
Gtk.widgetIntersect win rect >>=>>? \intersectingRectangle' ->
Gtk.invalidate intersectingRectangle'
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to