packages feed

gnutls 0.1.5 → 0.1.6

raw patch · 3 files changed

+22/−4 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Network.Protocol.TLS.GNU: instance Applicative TLS

Files

gnutls.cabal view
@@ -1,5 +1,5 @@ name: gnutls-version: 0.1.5+version: 0.1.6 license: GPL-3 license-file: license.txt author: John Millikin <jmillikin@gmail.com>@@ -26,7 +26,7 @@ source-repository this   type: git   location: https://john-millikin.com/code/haskell-gnutls/-  tag: haskell-gnutls_0.1.5+  tag: haskell-gnutls_0.1.6  library   hs-source-dirs: lib
lib/Network/Protocol/TLS/GNU.hs view
@@ -42,8 +42,9 @@ 	, CertificateType (..) 	) where +import           Control.Applicative (Applicative, pure, (<*>)) import qualified Control.Concurrent.MVar as M-import           Control.Monad (when, foldM, foldM_)+import           Control.Monad (ap, when, foldM, foldM_) import qualified Control.Monad.Error as E import           Control.Monad.Error (ErrorType) import qualified Control.Monad.Reader as R@@ -94,6 +95,10 @@  instance Functor TLS where 	fmap f = TLS . fmap f . unTLS++instance Applicative TLS where+	pure = TLS . return+	(<*>) = ap  instance Monad TLS where 	return = TLS . return
lib/Network/Protocol/TLS/GNU/ErrorT.hs view
@@ -20,7 +20,8 @@ 	, mapErrorT 	) where -import           Control.Monad (liftM)+import           Control.Applicative (Applicative, pure, (<*>))+import           Control.Monad (ap,liftM) import           Control.Monad.Trans (MonadIO, liftIO) import           Control.Monad.Trans.Class (MonadTrans, lift) import qualified Control.Monad.Error as E@@ -34,6 +35,18 @@  instance Functor m => Functor (ErrorT e m) where 	fmap f = ErrorT . fmap (fmap f) . runErrorT++instance (Functor m, Monad m) => Applicative (ErrorT e m) where+	pure a  = ErrorT $ return (Right a)+	f <*> v = ErrorT $ do+		mf <- runErrorT f+		case mf of+			Left  e -> return (Left e)+			Right k -> do+				mv <- runErrorT v+				case mv of+					Left  e -> return (Left e)+					Right x -> return (Right (k x))  instance Monad m => Monad (ErrorT e m) where 	return = ErrorT . return . Right