1{-# language RoleAnnotations #-}
2{-# language MultiParamTypeClasses #-}
3{-# language FlexibleInstances #-}
5module Control.Monad.ReaderIO
11import Control.Monad.Fix
12#if MIN_VERSION_base(4,10,0)
13import Control.Applicative
16import Control.Monad.Reader.Class
17import Control.Monad.IO.Class
19-- | An approximate clone of @RIO@ from the @rio@ package, but not based on
20-- @ReaderT@. The trouble with @ReaderT@ is that its third type argument has a
21-- @nominal@ role, so we can't coerce through it when it's wrapped in some
22-- other @data@ type. Ugh.
23newtype ReaderIO e a = ReaderIO { runReaderIO :: e -> IO a }
24type role ReaderIO representational representational
26instance Functor (ReaderIO e) where
32instance Applicative (ReaderIO e) where
33 pure a = ReaderIO $ \_ -> pure a
37#if MIN_VERSION_base(4,10,0)
44instance Monad (ReaderIO e) where
45 ReaderIO q >>= f = ReaderIO $ \e -> q e >>= \a -> runReaderIO (f a) e
48instance MonadFix (ReaderIO e) where
49 mfix f = ReaderIO $ \e -> mfix $ \r -> runReaderIO (f r) e
52instance MonadIO (ReaderIO e) where
53 liftIO m = ReaderIO $ \_ -> m
56instance MonadReader e (ReaderIO e) where
59 local f (ReaderIO m) = ReaderIO (m . f)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list