[Haskell-cafe] It's not a monad - what is it? looking for nice syntactic sugar, customizable do notation?

Marc Weber marco-oweber at gmx.de
Tue Sep 2 00:39:44 EDT 2008


> I still think that (3) would be superiour..
> Is there a way to define my own >>= and >> functions such as:
> 
>   {-# define custom do doX; 
>     (>>=) : mybind , >> : "my>>" #-}
>   body $ doX
>     args <- lift $ getArgs
> This would be terrific.
> 
> Sincerly
> Marc Weber

dons has told me about 
  06:27 < dons> http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#rebindable-syntax
  06:27 < lambdabot> Title: 8.3.�Syntactic extensions,

example :

  module Main where
  import Prelude
  import Debug.Trace
  import System.IO

  main = do
    let (>>=) a b = trace (show "woah") $ (Prelude.>>=) a b
    getLine >>= print

so actually this can be done? I'll try it.

Marc Weber


More information about the Haskell-Cafe mailing list