Skip to content

Instantly share code, notes, and snippets.

@tonymorris
Created July 31, 2012 12:27
Show Gist options
  • Save tonymorris/3216690 to your computer and use it in GitHub Desktop.
Save tonymorris/3216690 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