Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# LANGUAGE TemplateHaskell #-}
- {-# LANGUAGE ConstraintKinds #-}
- {-# LANGUAGE FlexibleInstances #-}
- module Experiment where
- import Control.Lens
- import Control.Lens.TH (makeClassyPrisms)
- import Control.Monad.Error.Class
- data BaseError = BaseFoo | BaseGoo deriving (Eq, Show)
- makeClassyPrisms ''BaseError
- data TopError = Base BaseError | TopGoo deriving (Eq, Show)
- makeClassyPrisms ''TopError
- instance AsBaseError TopError where
- _BaseError = _Base
- type BaseContext e m = (MonadError e m, AsBaseError e)
- type TopContext e m = (MonadError e m, AsTopError e)
- doBaseThing :: (BaseContext e m) => Int -> m e
- doBaseThing _ = undefined
- doTopThing :: (TopContext e m) => Int -> m e
- doTopThing i = undefined
Add Comment
Please, Sign In to add comment