diff options
| author | aarne <aarne@cs.chalmers.se> | 2008-06-25 16:43:48 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2008-06-25 16:43:48 +0000 |
| commit | b96b36f43de3e2f8b58d5f539daa6f6d47f25870 (patch) | |
| tree | 0992334be13cec6538a1dea22fbbf26ad6bdf224 /src/GF/Data/Compos.hs | |
| parent | fe367412e0aeb4ad5c02de68e6eca382e0f96984 (diff) | |
removed src for 2.9
Diffstat (limited to 'src/GF/Data/Compos.hs')
| -rw-r--r-- | src/GF/Data/Compos.hs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/GF/Data/Compos.hs b/src/GF/Data/Compos.hs deleted file mode 100644 index 7d46fc5a2..000000000 --- a/src/GF/Data/Compos.hs +++ /dev/null @@ -1,37 +0,0 @@ -{-# OPTIONS_GHC -fglasgow-exts #-} -module GF.Data.Compos (Compos(..),composOp,composM,composM_,composFold) where - -import Control.Applicative (Applicative(..), Const(..), WrappedMonad(..)) -import Data.Monoid (Monoid(..)) - -class Compos t where - compos :: Applicative f => (forall a. t a -> f (t a)) -> t c -> f (t c) - -composOp :: Compos t => (forall a. t a -> t a) -> t c -> t c -composOp f = runIdentity . compos (Identity . f) - -composFold :: (Monoid o, Compos t) => (forall a. t a -> o) -> t c -> o -composFold f = getConst . compos (Const . f) - -composM :: (Compos t, Monad m) => (forall a. t a -> m (t a)) -> t c -> m (t c) -composM f = unwrapMonad . compos (WrapMonad . f) - -composM_ :: (Compos t, Monad m) => (forall a. t a -> m ()) -> t c -> m () -composM_ f = unwrapMonad_ . composFold (WrapMonad_ . f) - - -newtype Identity a = Identity { runIdentity :: a } - -instance Functor Identity where - fmap f (Identity x) = Identity (f x) - -instance Applicative Identity where - pure = Identity - Identity f <*> Identity x = Identity (f x) - - -newtype WrappedMonad_ m = WrapMonad_ { unwrapMonad_ :: m () } - -instance Monad m => Monoid (WrappedMonad_ m) where - mempty = WrapMonad_ (return ()) - WrapMonad_ x `mappend` WrapMonad_ y = WrapMonad_ (x >> y) |
