packages feed

stripe-http-streams 2.0.2 → 2.0.3

raw patch · 2 files changed

+48/−16 lines, 2 filesdep +freedep +hspecdep +stripe-http-streamsdep ~HsOpenSSLdep ~aeson

Dependencies added: free, hspec, stripe-http-streams, stripe-tests

Dependency ranges changed: HsOpenSSL, aeson

Files

stripe-http-streams.cabal view
@@ -1,5 +1,5 @@ name:                stripe-http-streams-version:             2.0.2+version:             2.0.3 license:             MIT license-file:        LICENSE author:              David Johnson, Jeremy Shaw@@ -22,7 +22,7 @@   exposed-modules:     Web.Stripe.Client.HttpStreams   other-extensions:    OverloadedStrings, RecordWildCards   build-depends:         base         >= 4.7  && < 5-                       , aeson        >= 0.8  && < 0.10+                       , aeson        >= 0.8  && < 0.10 || == 0.11.*                        , bytestring   >= 0.10 && < 0.11                        , HsOpenSSL    >= 0.11 && < 0.12                        , http-streams >= 0.7  && < 0.9@@ -31,20 +31,20 @@                        , text         >= 1.1  && < 1.3   ghc-options:         -Wall --- Test-Suite tests---     type:             exitcode-stdio-1.0---     main-is:          Main.hs---     hs-source-dirs:   tests---     build-depends:    HsOpenSSL---                     , base                >= 4.7  && < 5---                     , free                >= 4.10 && < 4.13---                     , hspec               >= 2.1.0 && < 2.3---                     , http-streams        >= 0.7  && < 0.9---                     , stripe-core         >= 2.0  && < 2.1---                     , stripe-http-streams >= 2.0  && < 2.1---                     , stripe-tests        >= 2.0  && < 2.1---     default-language: Haskell2010---     ghc-options:      -Wall -threaded -rtsopts+Test-Suite tests+    type:             exitcode-stdio-1.0+    main-is:          Main.hs+    hs-source-dirs:   tests+    build-depends:    HsOpenSSL+                    , base                >= 4.7  && < 5+                    , free                >= 4.10 && < 4.13+                    , hspec               >= 2.1.0 && < 2.3+                    , http-streams        >= 0.7  && < 0.9+                    , stripe-core         >= 2.0  && < 2.1+                    , stripe-http-streams >= 2.0  && < 2.1+                    , stripe-tests        >= 2.0  && < 2.1+    default-language: Haskell2010+    ghc-options:      -Wall -threaded -rtsopts  source-repository head   type:     git
+ tests/Main.hs view
@@ -0,0 +1,32 @@+module Main where++import           Control.Monad.Trans.Free       (FreeF(..), FreeT(..))+import           Network.Http.Client            (Connection)+import           Web.Stripe.Client              (StripeConfig(..), StripeError(..))+import           Web.Stripe.Client.HttpStreams  (withConnection, callAPI)+import           Web.Stripe.Test.AllTests       (allTests)+import           Web.Stripe.Test.Prelude        (Stripe, StripeRequestF(..))++main :: IO ()+main = allTests runStripe++runStripe :: StripeConfig+          -> Stripe a+          -> IO (Either StripeError a)+runStripe config stripe =+  withConnection $ \conn ->+    runStripe' conn config stripe++runStripe' :: Connection+           -> StripeConfig+           -> Stripe a+           -> IO (Either StripeError a)+runStripe' conn config (FreeT m) =+  do f <- m+     case f of+       (Pure a) -> return (Right a)+       (Free (StripeRequestF req decode')) ->+         do r <- callAPI conn decode' config req+            case r of+              (Left e) ->  return (Left e)+              (Right next) -> runStripe' conn config next