Re: [Haskell-cafe] Full strict functor by abusing Haskell exceptions

2010-09-14 Thread Neil Brown
On 13/09/10 17:25, Maciej Piechotka wrote: import Control.Exception import Foreign import Prelude hiding (catch) data StrictMonad a = StrictMonad a deriving Show instance Monad StrictMonad where return x = unsafePerformIO $ do (return $! x) `catch` \(SomeException _) - return x

Re: [Haskell-cafe] Full strict functor by abusing Haskell exceptions

2010-09-14 Thread Maciej Piechotka
On Tue, 2010-09-14 at 11:27 +0100, Neil Brown wrote: On 13/09/10 17:25, Maciej Piechotka wrote: import Control.Exception import Foreign import Prelude hiding (catch) data StrictMonad a = StrictMonad a deriving Show instance Monad StrictMonad where return x = unsafePerformIO $

[Haskell-cafe] Full strict functor by abusing Haskell exceptions

2010-09-13 Thread Maciej Piechotka
I started experiment with strict functors. I come to: import Control.Exception import Foreign import Prelude hiding (catch) data StrictMonad a = StrictMonad a deriving Show instance Functor StrictMonad where f `fmap` StrictMonad v = return $ f v instance Applicative StrictMonad