Skip to content

Instantly share code, notes, and snippets.

@markhibberd
Forked from tonymorris/gist:3216690
Created July 31, 2012 12:37
Show Gist options
  • Save markhibberd/3216737 to your computer and use it in GitHub Desktop.
Save markhibberd/3216737 to your computer and use it in GitHub Desktop.
import Data.Text
import Control.Monad.Reader
data ZResult a =
ZVal a
| ZNotFound
| ZFail Text
| ZUnauth Text
newtype ZResultT m a = ZResultT {
runZResultT :: m (ZResult a)
}
instance Monad m => Monad (ZResultT m) where
newtype Mth m a =
Mth (ReaderT String m a)
instance MonadTrans Mth where
type MthX =
Mth (ZResultT IO)
mth ::
(MonadTrans t, Monad m) =>
ZResult a
-> t (ZResultT m) a
mth a =
lift . ZResultT . return $ a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment