Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-02 Thread Brent Yorgey
2008/5/1 Galchin, Vasili [EMAIL PROTECTED]: Sorry .. my example was bad. I want to use x .. in then branch where it occur ... e.g. bonzo :: Maybe Bozo - IO () bonzo maybe_bozo = do case maybe_bozo of Just (Bozo x) - x _

[Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Galchin, Vasili
data Bozo = Bozo { id :: Int } bonzo :: Maybe Bozo - IO () bonzo maybe_bozo = do if maybe_bozo == (Just (Bozo x)) then return () else return () ~ I want x to be a pattern that matches id ?? Kind regards, Vasili

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Claude Heiland-Allen
Galchin, Vasili wrote: data Bozo = Bozo { id :: Int } bonzo :: Maybe Bozo - IO () bonzo maybe_bozo = do if maybe_bozo == (Just (Bozo x)) then return () else return () ~ I want x to be a pattern that matches id ?? Try: bonzo (Just

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Luke Palmer
2008/5/2 Galchin, Vasili [EMAIL PROTECTED]: data Bozo = Bozo { id :: Int } bonzo :: Maybe Bozo - IO () bonzo maybe_bozo = do if maybe_bozo == (Just (Bozo x)) then return () else return () bonzo maybe_bozo = case maybe_bozo of

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Galchin, Vasili
Sorry .. my example was bad. I want to use x .. in then branch where it occur ... e.g. bonzo :: Maybe Bozo - IO () bonzo maybe_bozo = do case maybe_bozo of Just (Bozo x) - x _- . ?? Thanks, V. On Thu,

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Galchin, Vasili
Here is a simpler case of what I want to do .. 1) To function1 pass in (Maybe Int). 2) If Nothing then pass nullPtr to C function. 3) If Just 1, then pass a pointer to a 1 to teh same C function. Thanks, Vasili On Thu, May 1, 2008 at 8:18 PM, Galchin, Vasili [EMAIL PROTECTED] wrote: Sorry

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Evan Laforge
2008/5/1 Galchin, Vasili [EMAIL PROTECTED]: Here is a simpler case of what I want to do .. 1) To function1 pass in (Maybe Int). 2) If Nothing then pass nullPtr to C function. 3) If Just 1, then pass a pointer to a 1 to teh same C function. Check out Foreign.maybeWith.