packages feed

either 0.2.3.1 → 0.3

raw patch · 2 files changed

+15/−34 lines, 2 filesdep −data-defaultdep ~semigroupoidsdep ~transformersPVP ok

version bump matches the API change (PVP)

Dependencies removed: data-default

Dependency ranges changed: semigroupoids, transformers

API changes (from Hackage documentation)

- Control.Monad.Trans.Either: instance (Functor m, Monad m, Default e) => Alternative (EitherT e m)
- Control.Monad.Trans.Either: instance (Functor m, Monad m, Default e) => Plus (EitherT e m)
- Control.Monad.Trans.Either: instance (Monad m, Default e) => MonadPlus (EitherT e m)
- Control.Monad.Trans.Either: instance (Monad m, Default e) => Monoid (EitherT e m a)

Files

Control/Monad/Trans/Either.hs view
@@ -1,12 +1,11 @@ {-# LANGUAGE FlexibleInstances, FlexibleContexts, UndecidableInstances #-}-module Control.Monad.Trans.Either +module Control.Monad.Trans.Either   ( EitherT(..)   , eitherT   , hoistEither   ) where  import Control.Applicative-import Data.Default import Data.Functor.Bind import Data.Functor.Plus import Data.Foldable@@ -17,7 +16,7 @@ -- import Control.Monad.Error.Class import Control.Monad.IO.Class import Control.Monad.Fix-import Control.Monad (MonadPlus(..), liftM)+import Control.Monad (liftM)  newtype EitherT e m a = EitherT { runEitherT :: m (Either e a) } -- TODO: Data, Typeable@@ -27,8 +26,8 @@     showString "EitherT " . showsPrec 11 m  instance Read (m (Either e a)) => Read (EitherT e m a) where-  readsPrec d r = readParen (d > 10) -    (\r' -> [ (EitherT m, t) +  readsPrec d r = readParen (d > 10)+    (\r' -> [ (EitherT m, t)             | ("EitherT", s) <- lex r'             , (m, t) <- readsPrec 11 s]) r @@ -47,12 +46,12 @@ hoistEither = EitherT . return  instance Functor m => Functor (EitherT e m) where-  fmap f = EitherT . fmap (fmap f) . runEitherT +  fmap f = EitherT . fmap (fmap f) . runEitherT  instance (Functor m, Monad m) => Apply (EitherT e m) where   EitherT f <.> EitherT v = EitherT $ f >>= \mf -> case mf of     Left  e -> return (Left e)-    Right k -> v >>= \mv -> case mv of +    Right k -> v >>= \mv -> case mv of       Left  e -> return (Left e)       Right x -> return (Right (k x)) @@ -60,29 +59,18 @@   pure a  = EitherT $ return (Right a)   EitherT f <*> EitherT v = EitherT $ f >>= \mf -> case mf of     Left  e -> return (Left e)-    Right k -> v >>= \mv -> case mv of +    Right k -> v >>= \mv -> case mv of       Left  e -> return (Left e)       Right x -> return (Right (k x))  instance Monad m => Semigroup (EitherT e m a) where   EitherT m <> EitherT n = EitherT $ m >>= \a -> case a of-    Left _ -> n +    Left _ -> n     Right r -> return (Right r) -instance (Monad m, Default e) => Monoid (EitherT e m a) where-  mappend = (<>)-  mempty = EitherT $ return $ Left def- instance (Functor m, Monad m) => Alt (EitherT e m) where   (<!>) = (<>) -instance (Functor m, Monad m, Default e) => Plus (EitherT e m) where-  zero = EitherT $ return $ Left def--instance (Functor m, Monad m, Default e) => Alternative (EitherT e m) where-  empty = zero-  (<|>) = (<!>)- instance (Functor m, Monad m) => Bind (EitherT e m) where   (>>-) = (>>=) @@ -102,12 +90,6 @@     Right r -> return (Right r) -} -instance (Monad m, Default e) => MonadPlus (EitherT e m) where-  mzero = EitherT $ return $ Left def-  EitherT m `mplus` EitherT n = EitherT $ m >>= \a -> case a of-    Left  _ -> n-    Right r -> return (Right r)- instance MonadFix m => MonadFix (EitherT e m) where   mfix f = EitherT $ mfix $ \a -> runEitherT $ f $ case a of     Right r -> r@@ -122,6 +104,6 @@ instance Foldable m => Foldable (EitherT e m) where   foldMap f = foldMap (either mempty f) . runEitherT -instance (Traversable f) => Traversable (EitherT e f) where -  traverse f (EitherT a) = -    EitherT <$> traverse (either (pure . Left) (fmap Right . f)) a +instance (Traversable f) => Traversable (EitherT e f) where+  traverse f (EitherT a) =+    EitherT <$> traverse (either (pure . Left) (fmap Right . f)) a
either.cabal view
@@ -1,6 +1,6 @@ name:          either category:      Control, Monads-version:       0.2.3.1+version:       0.3 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE@@ -8,7 +8,7 @@ maintainer:    Edward A. Kmett <ekmett@gmail.com> stability:     provisional homepage:      http://github.com/ekmett/either/-copyright:     Copyright (C) 2008-2011 Edward A. Kmett+copyright:     Copyright (C) 2008-2012 Edward A. Kmett synopsis:      Haskell 98 either monad transformer description:   Haskell 98 either monad transformer build-type:    Simple@@ -20,10 +20,9 @@ library   build-depends:      base          >= 4       && < 5,-    data-default  >= 0.2.0.1 && < 0.3,     semigroups    >= 0.8     && < 0.9,-    semigroupoids >= 1.2.6.1 && < 1.3,-    transformers  >= 0.2.0   && <= 0.3+    semigroupoids >= 1.2.6.1 && < 1.4,+    transformers  >= 0.2     && < 0.4    extensions: CPP