Maybe we need a MonadState s m => MonadReader s m instance some day ?

This commit is contained in:
Tissevert 2020-03-03 18:16:49 +01:00
parent 2c02e44adf
commit 3b3eeef218

View file

@ -17,10 +17,22 @@ module PDF.Box (
import Control.Monad.Except (ExceptT(..), runExceptT) import Control.Monad.Except (ExceptT(..), runExceptT)
import Control.Monad.Fail (MonadFail(..)) import Control.Monad.Fail (MonadFail(..))
import Control.Monad.State (MonadState(..)) import Control.Monad.State (MonadState(..))
--import Control.Monad.Reader (MonadReader(..))
import Data.Map (Map) import Data.Map (Map)
import qualified Data.Map as Map (insert, lookup, member) import qualified Data.Map as Map (insert, lookup, member)
import Prelude hiding (fail) import Prelude hiding (fail)
{-
instance (Monad m, MonadState s m) => MonadReader s m where
ask = get
local f m = do
backup <- get
put $ f backup
result <- m
put backup
return result
-}
newtype Index = Index Int newtype Index = Index Int
newtype Maybe_ x = Maybe_ x newtype Maybe_ x = Maybe_ x
newtype Either_ b x = Either_ x newtype Either_ b x = Either_ x