module Control.Spoon (spoon) where

import Prelude hiding (catch)
import System.IO.Unsafe (unsafePerformIO)
import Control.Exception (catch, SomeException)

catchAll :: IO a -> (SomeException -> IO a) -> IO a
catchAll = catch

spoon :: a -> Maybe a
spoon a = unsafePerformIO (catchAll (Just `fmap` (return $! a)) (return . const Nothing))