Commit e836b931 authored by Sven Bartscher's avatar Sven Bartscher

hoauth: Added instance for (Monad m) => Applicative (OAuthMonadT m),

to satisfy Monad superclass.
Use defaultTimeLocale from time, rather than old-time.
Depend on ghc >= 7.10, because defaultLocalTime was added to time in
ghc 7.10.
parent 41841da6
hoauth (0.3.5-4) UNRELEASED; urgency=medium
* Depend on old-{locale,time}
* Patch support for ghc-7.10
-- Joachim Breitner <nomeata@debian.org> Sat, 15 Aug 2015 23:06:16 +0200
-- Sven Bartscher <sven.bartscher@weltraumschlangen.de> Tue, 18 Aug 2015 00:38:06 +0200
hoauth (0.3.5-3) unstable; urgency=low
......
......@@ -6,7 +6,7 @@ Section: haskell
Build-Depends: debhelper (>= 9),
haskell-devscripts (>= 0.9),
cdbs,
ghc,
ghc (>= 7.10),
ghc-prof,
libghc-rsa-dev (>= 1.2.0.1),
libghc-rsa-prof,
......@@ -22,8 +22,6 @@ Build-Depends: debhelper (>= 9),
libghc-entropy-prof,
libghc-mtl-dev (>= 1.1.0.2),
libghc-mtl-prof,
libghc-old-locale-dev (>= 1.0.0.2),
libghc-old-locale-prof,
libghc-random-dev (>= 1.0.0.2),
libghc-random-prof,
libghc-utf8-string-dev (>= 0.3.4),
......@@ -36,7 +34,6 @@ Build-Depends-Indep: ghc-doc,
libghc-dataenc-doc,
libghc-entropy-doc,
libghc-mtl-doc,
libghc-old-locale-doc,
libghc-random-doc,
libghc-utf8-string-doc,
Standards-Version: 3.9.4
......
--- a/src/main/haskell/Network/OAuth/Consumer.hs
+++ b/src/main/haskell/Network/OAuth/Consumer.hs
@@ -89,8 +89,8 @@
import Control.Monad.Trans
import System.IO
import System.Entropy (getEntropy)
-import System.Locale (defaultTimeLocale)
import Data.Time (getCurrentTime,formatTime)
+import Data.Time.Format (defaultTimeLocale)
import Data.Char (chr,ord)
import Data.List (intercalate,sort)
import Data.Word (Word8)
@@ -390,6 +390,19 @@
right (t1,a) = let OAuthMonadT mb = f a
in mb t1
+instance (Monad m) => Applicative (OAuthMonadT m) where
+ pure = return
+ (OAuthMonadT af) <*> (OAuthMonadT ax) =
+ OAuthMonadT $ \t -> do
+ ef <- af t
+ case ef of
+ Left s -> return $ Left s
+ Right (nt, f) -> do
+ ex <- ax nt
+ case ex of
+ Left s -> return $ Left s
+ Right (ft, x) -> return $ Right (ft, f x)
+
instance MonadTrans OAuthMonadT where
lift ma = OAuthMonadT $ \t -> do { a <- ma
; return $ Right (t,a)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment