Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move MonadSnap instances out into a new module
- Loading branch information
1 parent
3ac7c14
commit 9cf1a67
Showing
5 changed files
with
121 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{-# OPTIONS_GHC -fno-warn-orphans #-} | ||
{-# LANGUAGE PackageImports #-} | ||
|
||
module Snap.Internal.Instances where | ||
|
||
import Control.Applicative | ||
import "monads-fd" Control.Monad.Cont | ||
import "monads-fd" Control.Monad.Error | ||
import "monads-fd" Control.Monad.List | ||
import "monads-fd" Control.Monad.RWS.Strict hiding (pass) | ||
import qualified "monads-fd" Control.Monad.RWS.Lazy as LRWS | ||
import "monads-fd" Control.Monad.Reader | ||
import "monads-fd" Control.Monad.State.Strict | ||
import qualified "monads-fd" Control.Monad.State.Lazy as LState | ||
import "monads-fd" Control.Monad.Writer.Strict hiding (pass) | ||
import qualified "monads-fd" Control.Monad.Writer.Lazy as LWriter | ||
import Prelude hiding (catch) | ||
|
||
------------------------------------------------------------------------------ | ||
import Snap.Internal.Types | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance MonadPlus m => MonadPlus (ContT c m) where | ||
mzero = lift mzero | ||
m `mplus` n = ContT $ \ f -> runContT m f `mplus` runContT n f | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance MonadPlus m => Alternative (ContT c m) where | ||
empty = mzero | ||
(<|>) = mplus | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance MonadSnap m => MonadSnap (ContT c m) where | ||
liftSnap = lift . liftSnap | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance (MonadSnap m, Error e) => MonadSnap (ErrorT e m) where | ||
liftSnap = lift . liftSnap | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance MonadSnap m => MonadSnap (ListT m) where | ||
liftSnap = lift . liftSnap | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance (MonadSnap m, Monoid w) => MonadSnap (RWST r w s m) where | ||
liftSnap = lift . liftSnap | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance (MonadSnap m, Monoid w) => MonadSnap (LRWS.RWST r w s m) where | ||
liftSnap = lift . liftSnap | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance MonadSnap m => MonadSnap (ReaderT r m) where | ||
liftSnap = lift . liftSnap | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance MonadSnap m => MonadSnap (StateT s m) where | ||
liftSnap = lift . liftSnap | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance MonadSnap m => MonadSnap (LState.StateT s m) where | ||
liftSnap = lift . liftSnap | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance (MonadSnap m, Monoid w) => MonadSnap (WriterT w m) where | ||
liftSnap = lift . liftSnap | ||
|
||
|
||
------------------------------------------------------------------------------ | ||
instance (MonadSnap m, Monoid w) => MonadSnap (LWriter.WriterT w m) where | ||
liftSnap = lift . liftSnap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters