{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} module System.FilePath.FilePather.ReadFilePath( ReadFilePathT(..) , ReadFilePath , ReadFilePathT1 , ReadFilePath1 , readFilePath , hoistReadFilePath , liftReadFilePath ) where import Control.Applicative ( Applicative(liftA2, (<*>), pure), Alternative((<|>), empty) ) import Control.Category((.)) import Control.Lens ( iso, Iso, Rewrapped, Wrapped(Unwrapped, _Wrapped'), view, _Wrapped, ( # ) ) import Control.Monad ( Monad((>>=), return), Functor(fmap), MonadPlus(mplus, mzero) ) import Control.Monad.Cont.Class ( MonadCont(callCC) ) import Control.Monad.Error.Class ( MonadError(throwError, catchError) ) import Control.Monad.Fail ( MonadFail(fail) ) import Control.Monad.Fix ( MonadFix(mfix) ) import Control.Monad.IO.Class ( MonadIO(liftIO) ) import Control.Monad.Morph ( MFunctor(hoist), MMonad(embed) ) import Control.Monad.Reader.Class ( MonadReader(reader, local, ask) ) import Control.Monad.State.Class ( MonadState(state, get, put) ) import Control.Monad.Trans.Class(MonadTrans(lift)) import Control.Monad.Writer.Class ( MonadWriter(pass, tell, writer, listen) ) import Control.Monad.Zip ( MonadZip(mzipWith) ) import Data.Functor.Apply ( Apply(liftF2, (<.>)) ) import Data.Functor.Alt ( Alt((<!>)) ) import Data.Functor.Bind ( Bind((>>-)) ) import Data.Functor.Identity(Identity(Identity, runIdentity)) import Data.Monoid(Monoid(mappend, mempty)) import Data.Semigroup(Semigroup((<>))) import System.FilePath(FilePath) newtype ReadFilePathT f a = ReadFilePathT (FilePath -> f a) instance ReadFilePathT f a ~ t => Rewrapped (ReadFilePathT f' a') t instance Wrapped (ReadFilePathT f a) where type Unwrapped (ReadFilePathT f a) = FilePath -> f a _Wrapped' :: p (Unwrapped (ReadFilePathT f a)) (f (Unwrapped (ReadFilePathT f a))) -> p (ReadFilePathT f a) (f (ReadFilePathT f a)) _Wrapped' = (ReadFilePathT f a -> FilePath -> f a) -> ((FilePath -> f a) -> ReadFilePathT f a) -> Iso (ReadFilePathT f a) (ReadFilePathT f a) (FilePath -> f a) (FilePath -> f a) forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b iso (\(ReadFilePathT FilePath -> f a x) -> FilePath -> f a x) (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT {-# INLINE _Wrapped' #-} type ReadFilePath a = ReadFilePathT Identity a type ReadFilePathT1 f = ReadFilePathT f () type ReadFilePath1 f = ReadFilePath () readFilePath :: Iso (ReadFilePath a) (ReadFilePath a') (FilePath -> a) (FilePath -> a') readFilePath :: p (FilePath -> a) (f (FilePath -> a')) -> p (ReadFilePath a) (f (ReadFilePath a')) readFilePath = (ReadFilePath a -> FilePath -> a) -> ((FilePath -> a') -> ReadFilePath a') -> Iso (ReadFilePath a) (ReadFilePath a') (FilePath -> a) (FilePath -> a') forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b iso (\(ReadFilePathT FilePath -> Identity a x) -> Identity a -> a forall a. Identity a -> a runIdentity (Identity a -> a) -> (FilePath -> Identity a) -> FilePath -> a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . FilePath -> Identity a x) (\FilePath -> a' p -> (FilePath -> Identity a') -> ReadFilePath a' forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (a' -> Identity a' forall a. a -> Identity a Identity (a' -> Identity a') -> (FilePath -> a') -> FilePath -> Identity a' forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . FilePath -> a' p)) {-# INLINE readFilePath #-} instance (Apply f, Semigroup a) => Semigroup (ReadFilePathT f a) where ReadFilePathT FilePath -> f a a <> :: ReadFilePathT f a -> ReadFilePathT f a -> ReadFilePathT f a <> ReadFilePathT FilePath -> f a b = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath p -> (a -> a -> a) -> f a -> f a -> f a forall (f :: * -> *) a b c. Apply f => (a -> b -> c) -> f a -> f b -> f c liftF2 a -> a -> a forall a. Semigroup a => a -> a -> a (<>) (FilePath -> f a a FilePath p) (FilePath -> f a b FilePath p)) {-# INLINE (<>) #-} instance (Apply f, Applicative f, Monoid a) => Monoid (ReadFilePathT f a) where ReadFilePathT FilePath -> f a a mappend :: ReadFilePathT f a -> ReadFilePathT f a -> ReadFilePathT f a `mappend` ReadFilePathT FilePath -> f a b = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath p -> (a -> a -> a) -> f a -> f a -> f a forall (f :: * -> *) a b c. Applicative f => (a -> b -> c) -> f a -> f b -> f c liftA2 a -> a -> a forall a. Monoid a => a -> a -> a mappend (FilePath -> f a a FilePath p) (FilePath -> f a b FilePath p)) {-# INLINE mappend #-} mempty :: ReadFilePathT f a mempty = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (f a -> FilePath -> f a forall (f :: * -> *) a. Applicative f => a -> f a pure (a -> f a forall (f :: * -> *) a. Applicative f => a -> f a pure a forall a. Monoid a => a mempty)) {-# INLINE mempty #-} instance Functor f => Functor (ReadFilePathT f) where fmap :: (a -> b) -> ReadFilePathT f a -> ReadFilePathT f b fmap a -> b f (ReadFilePathT FilePath -> f a x) = (FilePath -> f b) -> ReadFilePathT f b forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT ((f a -> f b) -> (FilePath -> f a) -> FilePath -> f b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap ((a -> b) -> f a -> f b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap a -> b f) FilePath -> f a x) {-# INLINE fmap #-} instance Apply f => Apply (ReadFilePathT f) where ReadFilePathT FilePath -> f (a -> b) f <.> :: ReadFilePathT f (a -> b) -> ReadFilePathT f a -> ReadFilePathT f b <.> ReadFilePathT FilePath -> f a a = (FilePath -> f b) -> ReadFilePathT f b forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath p -> FilePath -> f (a -> b) f FilePath p f (a -> b) -> f a -> f b forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b <.> FilePath -> f a a FilePath p) {-# INLINE (<.>) #-} instance Bind f => Bind (ReadFilePathT f) where ReadFilePathT FilePath -> f a f >>- :: ReadFilePathT f a -> (a -> ReadFilePathT f b) -> ReadFilePathT f b >>- a -> ReadFilePathT f b g = (FilePath -> f b) -> ReadFilePathT f b forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath p -> FilePath -> f a f FilePath p f a -> (a -> f b) -> f b forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b >>- \a a -> Getting (FilePath -> f b) (ReadFilePathT f b) (FilePath -> f b) -> ReadFilePathT f b -> FilePath -> f b forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a view Getting (FilePath -> f b) (ReadFilePathT f b) (FilePath -> f b) forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t) _Wrapped (a -> ReadFilePathT f b g a a) FilePath p) {-# INLINE (>>-) #-} instance Applicative f => Applicative (ReadFilePathT f) where ReadFilePathT FilePath -> f (a -> b) f <*> :: ReadFilePathT f (a -> b) -> ReadFilePathT f a -> ReadFilePathT f b <*> ReadFilePathT FilePath -> f a a = (FilePath -> f b) -> ReadFilePathT f b forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath p -> FilePath -> f (a -> b) f FilePath p f (a -> b) -> f a -> f b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> FilePath -> f a a FilePath p) {-# INLINE (<*>) #-} pure :: a -> ReadFilePathT f a pure = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT ((FilePath -> f a) -> ReadFilePathT f a) -> (a -> FilePath -> f a) -> a -> ReadFilePathT f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . f a -> FilePath -> f a forall (f :: * -> *) a. Applicative f => a -> f a pure (f a -> FilePath -> f a) -> (a -> f a) -> a -> FilePath -> f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . a -> f a forall (f :: * -> *) a. Applicative f => a -> f a pure {-# INLINE pure #-} instance Alt f => Alt (ReadFilePathT f) where ReadFilePathT FilePath -> f a a <!> :: ReadFilePathT f a -> ReadFilePathT f a -> ReadFilePathT f a <!> ReadFilePathT FilePath -> f a b = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath p -> FilePath -> f a a FilePath p f a -> f a -> f a forall (f :: * -> *) a. Alt f => f a -> f a -> f a <!> FilePath -> f a b FilePath p) {-# INLINE (<!>) #-} instance Alternative f => Alternative (ReadFilePathT f) where ReadFilePathT FilePath -> f a a <|> :: ReadFilePathT f a -> ReadFilePathT f a -> ReadFilePathT f a <|> ReadFilePathT FilePath -> f a b = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath p -> FilePath -> f a a FilePath p f a -> f a -> f a forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> FilePath -> f a b FilePath p) {-# INLINE (<|>) #-} empty :: ReadFilePathT f a empty = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (f a -> FilePath -> f a forall (f :: * -> *) a. Applicative f => a -> f a pure f a forall (f :: * -> *) a. Alternative f => f a empty) {-# INLINE empty #-} instance Monad f => Monad (ReadFilePathT f) where ReadFilePathT FilePath -> f a f >>= :: ReadFilePathT f a -> (a -> ReadFilePathT f b) -> ReadFilePathT f b >>= a -> ReadFilePathT f b g = (FilePath -> f b) -> ReadFilePathT f b forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath p -> FilePath -> f a f FilePath p f a -> (a -> f b) -> f b forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b >>= \a a -> Getting (FilePath -> f b) (ReadFilePathT f b) (FilePath -> f b) -> ReadFilePathT f b -> FilePath -> f b forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a view Getting (FilePath -> f b) (ReadFilePathT f b) (FilePath -> f b) forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t) _Wrapped (a -> ReadFilePathT f b g a a) FilePath p) {-# INLINE (>>=) #-} return :: a -> ReadFilePathT f a return = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT ((FilePath -> f a) -> ReadFilePathT f a) -> (a -> FilePath -> f a) -> a -> ReadFilePathT f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . f a -> FilePath -> f a forall (m :: * -> *) a. Monad m => a -> m a return (f a -> FilePath -> f a) -> (a -> f a) -> a -> FilePath -> f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . a -> f a forall (m :: * -> *) a. Monad m => a -> m a return {-# INLINE return #-} instance MonadTrans ReadFilePathT where lift :: m a -> ReadFilePathT m a lift = (FilePath -> m a) -> ReadFilePathT m a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT ((FilePath -> m a) -> ReadFilePathT m a) -> (m a -> FilePath -> m a) -> m a -> ReadFilePathT m a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . m a -> FilePath -> m a forall (f :: * -> *) a. Applicative f => a -> f a pure {-# INLINE lift #-} instance MonadIO f => MonadIO (ReadFilePathT f) where liftIO :: IO a -> ReadFilePathT f a liftIO = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT ((FilePath -> f a) -> ReadFilePathT f a) -> (IO a -> FilePath -> f a) -> IO a -> ReadFilePathT f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . f a -> FilePath -> f a forall (f :: * -> *) a. Applicative f => a -> f a pure (f a -> FilePath -> f a) -> (IO a -> f a) -> IO a -> FilePath -> f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . IO a -> f a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO {-# INLINE liftIO #-} instance MFunctor ReadFilePathT where hoist :: (forall a. m a -> n a) -> ReadFilePathT m b -> ReadFilePathT n b hoist forall a. m a -> n a k (ReadFilePathT FilePath -> m b f) = (FilePath -> n b) -> ReadFilePathT n b forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (m b -> n b forall a. m a -> n a k (m b -> n b) -> (FilePath -> m b) -> FilePath -> n b forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c .FilePath -> m b f) {-# INLINE hoist #-} instance MMonad ReadFilePathT where embed :: (forall a. m a -> ReadFilePathT n a) -> ReadFilePathT m b -> ReadFilePathT n b embed forall a. m a -> ReadFilePathT n a k (ReadFilePathT FilePath -> m b f) = (FilePath -> n b) -> ReadFilePathT n b forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath p -> Getting (FilePath -> n b) (ReadFilePathT n b) (FilePath -> n b) -> ReadFilePathT n b -> FilePath -> n b forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a view Getting (FilePath -> n b) (ReadFilePathT n b) (FilePath -> n b) forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t) _Wrapped (m b -> ReadFilePathT n b forall a. m a -> ReadFilePathT n a k (FilePath -> m b f FilePath p)) FilePath p) {-# INLINE embed #-} instance Monad f => MonadReader FilePath (ReadFilePathT f) where ask :: ReadFilePathT f FilePath ask = (FilePath -> f FilePath) -> ReadFilePathT f FilePath forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT FilePath -> f FilePath forall (f :: * -> *) a. Applicative f => a -> f a pure {-# INLINE ask #-} local :: (FilePath -> FilePath) -> ReadFilePathT f a -> ReadFilePathT f a local FilePath -> FilePath k (ReadFilePathT FilePath -> f a f) = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (FilePath -> f a f (FilePath -> f a) -> (FilePath -> FilePath) -> FilePath -> f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . FilePath -> FilePath k) {-# INLINE local #-} reader :: (FilePath -> a) -> ReadFilePathT f a reader FilePath -> a k = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (a -> f a forall (f :: * -> *) a. Applicative f => a -> f a pure (a -> f a) -> (FilePath -> a) -> FilePath -> f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . FilePath -> a k) {-# INLINE reader #-} instance MonadState FilePath f => MonadState FilePath (ReadFilePathT f) where state :: (FilePath -> (a, FilePath)) -> ReadFilePathT f a state = f a -> ReadFilePathT f a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (f a -> ReadFilePathT f a) -> ((FilePath -> (a, FilePath)) -> f a) -> (FilePath -> (a, FilePath)) -> ReadFilePathT f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . (FilePath -> (a, FilePath)) -> f a forall s (m :: * -> *) a. MonadState s m => (s -> (a, s)) -> m a state {-# INLINE state #-} get :: ReadFilePathT f FilePath get = f FilePath -> ReadFilePathT f FilePath forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift f FilePath forall s (m :: * -> *). MonadState s m => m s get {-# INLINE get #-} put :: FilePath -> ReadFilePathT f () put = f () -> ReadFilePathT f () forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (f () -> ReadFilePathT f ()) -> (FilePath -> f ()) -> FilePath -> ReadFilePathT f () forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . FilePath -> f () forall s (m :: * -> *). MonadState s m => s -> m () put {-# INLINE put #-} instance MonadWriter FilePath f => MonadWriter FilePath (ReadFilePathT f) where writer :: (a, FilePath) -> ReadFilePathT f a writer = f a -> ReadFilePathT f a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (f a -> ReadFilePathT f a) -> ((a, FilePath) -> f a) -> (a, FilePath) -> ReadFilePathT f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . (a, FilePath) -> f a forall w (m :: * -> *) a. MonadWriter w m => (a, w) -> m a writer {-# INLINE writer #-} tell :: FilePath -> ReadFilePathT f () tell = f () -> ReadFilePathT f () forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (f () -> ReadFilePathT f ()) -> (FilePath -> f ()) -> FilePath -> ReadFilePathT f () forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . FilePath -> f () forall w (m :: * -> *). MonadWriter w m => w -> m () tell {-# INLINE tell #-} listen :: ReadFilePathT f a -> ReadFilePathT f (a, FilePath) listen (ReadFilePathT FilePath -> f a f) = (FilePath -> f (a, FilePath)) -> ReadFilePathT f (a, FilePath) forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (f a -> f (a, FilePath) forall w (m :: * -> *) a. MonadWriter w m => m a -> m (a, w) listen (f a -> f (a, FilePath)) -> (FilePath -> f a) -> FilePath -> f (a, FilePath) forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . FilePath -> f a f) {-# INLINE listen #-} pass :: ReadFilePathT f (a, FilePath -> FilePath) -> ReadFilePathT f a pass (ReadFilePathT FilePath -> f (a, FilePath -> FilePath) f) = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (f (a, FilePath -> FilePath) -> f a forall w (m :: * -> *) a. MonadWriter w m => m (a, w -> w) -> m a pass (f (a, FilePath -> FilePath) -> f a) -> (FilePath -> f (a, FilePath -> FilePath)) -> FilePath -> f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . FilePath -> f (a, FilePath -> FilePath) f) {-# INLINE pass #-} instance MonadFail f => MonadFail (ReadFilePathT f) where fail :: FilePath -> ReadFilePathT f a fail = f a -> ReadFilePathT f a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (f a -> ReadFilePathT f a) -> (FilePath -> f a) -> FilePath -> ReadFilePathT f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . FilePath -> f a forall (m :: * -> *) a. MonadFail m => FilePath -> m a fail {-# INLINE fail #-} instance MonadFix f => MonadFix (ReadFilePathT f) where mfix :: (a -> ReadFilePathT f a) -> ReadFilePathT f a mfix a -> ReadFilePathT f a f = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath p -> (a -> f a) -> f a forall (m :: * -> *) a. MonadFix m => (a -> m a) -> m a mfix (\a a -> Getting (FilePath -> f a) (ReadFilePathT f a) (FilePath -> f a) -> ReadFilePathT f a -> FilePath -> f a forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a view Getting (FilePath -> f a) (ReadFilePathT f a) (FilePath -> f a) forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t) _Wrapped (a -> ReadFilePathT f a f a a) FilePath p)) {-# INLINE mfix #-} instance MonadZip f => MonadZip (ReadFilePathT f) where mzipWith :: (a -> b -> c) -> ReadFilePathT f a -> ReadFilePathT f b -> ReadFilePathT f c mzipWith a -> b -> c f (ReadFilePathT FilePath -> f a m) (ReadFilePathT FilePath -> f b n) = (FilePath -> f c) -> ReadFilePathT f c forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath a -> (a -> b -> c) -> f a -> f b -> f c forall (m :: * -> *) a b c. MonadZip m => (a -> b -> c) -> m a -> m b -> m c mzipWith a -> b -> c f (FilePath -> f a m FilePath a) (FilePath -> f b n FilePath a)) {-# INLINE mzipWith #-} instance MonadCont f => MonadCont (ReadFilePathT f) where callCC :: ((a -> ReadFilePathT f b) -> ReadFilePathT f a) -> ReadFilePathT f a callCC (a -> ReadFilePathT f b) -> ReadFilePathT f a p = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\FilePath r -> ((a -> f b) -> f a) -> f a forall (m :: * -> *) a b. MonadCont m => ((a -> m b) -> m a) -> m a callCC (\a -> f b c -> Getting (FilePath -> f a) (ReadFilePathT f a) (FilePath -> f a) -> ReadFilePathT f a -> FilePath -> f a forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a view Getting (FilePath -> f a) (ReadFilePathT f a) (FilePath -> f a) forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t) _Wrapped ((a -> ReadFilePathT f b) -> ReadFilePathT f a p ((FilePath -> f b) -> ReadFilePathT f b forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT ((FilePath -> f b) -> ReadFilePathT f b) -> (a -> FilePath -> f b) -> a -> ReadFilePathT f b forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . f b -> FilePath -> f b forall (f :: * -> *) a. Applicative f => a -> f a pure (f b -> FilePath -> f b) -> (a -> f b) -> a -> FilePath -> f b forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . a -> f b c)) FilePath r)) {-# INLINE callCC #-} instance MonadError e f => MonadError e (ReadFilePathT f) where throwError :: e -> ReadFilePathT f a throwError = f a -> ReadFilePathT f a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift (f a -> ReadFilePathT f a) -> (e -> f a) -> e -> ReadFilePathT f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . e -> f a forall e (m :: * -> *) a. MonadError e m => e -> m a throwError {-# INLINE throwError #-} catchError :: ReadFilePathT f a -> (e -> ReadFilePathT f a) -> ReadFilePathT f a catchError (ReadFilePathT FilePath -> f a f) e -> ReadFilePathT f a g = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\ FilePath r -> f a -> (e -> f a) -> f a forall e (m :: * -> *) a. MonadError e m => m a -> (e -> m a) -> m a catchError (FilePath -> f a f FilePath r) (\ e e -> Getting (FilePath -> f a) (ReadFilePathT f a) (FilePath -> f a) -> ReadFilePathT f a -> FilePath -> f a forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a view Getting (FilePath -> f a) (ReadFilePathT f a) (FilePath -> f a) forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t) _Wrapped (e -> ReadFilePathT f a g e e) FilePath r)) {-# INLINE catchError #-} instance MonadPlus f => MonadPlus (ReadFilePathT f) where mzero :: ReadFilePathT f a mzero = f a -> ReadFilePathT f a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift f a forall (m :: * -> *) a. MonadPlus m => m a mzero {-# INLINE mzero #-} ReadFilePathT FilePath -> f a a mplus :: ReadFilePathT f a -> ReadFilePathT f a -> ReadFilePathT f a `mplus` ReadFilePathT FilePath -> f a b = (FilePath -> f a) -> ReadFilePathT f a forall (f :: * -> *) a. (FilePath -> f a) -> ReadFilePathT f a ReadFilePathT (\ FilePath r -> FilePath -> f a a FilePath r f a -> f a -> f a forall (m :: * -> *) a. MonadPlus m => m a -> m a -> m a `mplus` FilePath -> f a b FilePath r) {-# INLINE mplus #-} hoistReadFilePath :: Applicative f => ReadFilePath a -> ReadFilePathT f a hoistReadFilePath :: ReadFilePath a -> ReadFilePathT f a hoistReadFilePath = (forall a. Identity a -> f a) -> ReadFilePath a -> ReadFilePathT f a forall k (t :: (* -> *) -> k -> *) (m :: * -> *) (n :: * -> *) (b :: k). (MFunctor t, Monad m) => (forall a. m a -> n a) -> t m b -> t n b hoist (a -> f a forall (f :: * -> *) a. Applicative f => a -> f a pure (a -> f a) -> (Identity a -> a) -> Identity a -> f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . Identity a -> a forall a. Identity a -> a runIdentity) liftReadFilePath :: Applicative f => (FilePath -> a) -> ReadFilePathT f a liftReadFilePath :: (FilePath -> a) -> ReadFilePathT f a liftReadFilePath = ReadFilePath a -> ReadFilePathT f a forall (f :: * -> *) a. Applicative f => ReadFilePath a -> ReadFilePathT f a hoistReadFilePath (ReadFilePath a -> ReadFilePathT f a) -> ((FilePath -> a) -> ReadFilePath a) -> (FilePath -> a) -> ReadFilePathT f a forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . (Tagged (FilePath -> a) (Identity (FilePath -> a)) -> Tagged (ReadFilePath a) (Identity (ReadFilePath a)) forall a a'. Iso (ReadFilePath a) (ReadFilePath a') (FilePath -> a) (FilePath -> a') readFilePath (Tagged (FilePath -> a) (Identity (FilePath -> a)) -> Tagged (ReadFilePath a) (Identity (ReadFilePath a))) -> (FilePath -> a) -> ReadFilePath a forall t b. AReview t b -> b -> t #)