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
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 $
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