packages feed

wreq-effectful 0.1.0.1 → 0.1.1.1

raw patch · 5 files changed

+234/−69 lines, 5 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Effectful.Wreq.Session: customHistoriedMethodWith :: forall (es :: [Effect]). Wreq :> es => String -> Options -> Session -> String -> Eff es (HistoriedResponse ByteString)
+ Effectful.Wreq.Session: customHistoriedPayloadMethodWith :: forall (es :: [Effect]) a. (Wreq :> es, Postable a) => String -> Options -> Session -> String -> a -> Eff es (HistoriedResponse ByteString)
+ Effectful.Wreq.Session: customMethod :: forall (es :: [Effect]). Wreq :> es => String -> Session -> String -> Eff es (Response ByteString)
+ Effectful.Wreq.Session: customMethodWith :: forall (es :: [Effect]). Wreq :> es => String -> Options -> Session -> String -> Eff es (Response ByteString)
+ Effectful.Wreq.Session: customPayloadMethodWith :: forall (es :: [Effect]) a. (Wreq :> es, Postable a) => String -> Options -> Session -> String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq.Session: data Session
+ Effectful.Wreq.Session: delete :: forall (es :: [Effect]). Wreq :> es => Session -> String -> Eff es (Response ByteString)
+ Effectful.Wreq.Session: deleteWith :: forall (es :: [Effect]). Wreq :> es => Options -> Session -> String -> Eff es (Response ByteString)
+ Effectful.Wreq.Session: get :: forall (es :: [Effect]). Wreq :> es => Session -> String -> Eff es (Response ByteString)
+ Effectful.Wreq.Session: getSessionCookieJar :: forall (es :: [Effect]). Wreq :> es => Session -> Eff es (Maybe CookieJar)
+ Effectful.Wreq.Session: getWith :: forall (es :: [Effect]). Wreq :> es => Options -> Session -> String -> Eff es (Response ByteString)
+ Effectful.Wreq.Session: headWith :: forall (es :: [Effect]). Wreq :> es => Options -> Session -> String -> Eff es (Response ())
+ Effectful.Wreq.Session: head_ :: forall (es :: [Effect]). Wreq :> es => Session -> String -> Eff es (Response ())
+ Effectful.Wreq.Session: newAPISession :: forall (es :: [Effect]). Wreq :> es => Eff es Session
+ Effectful.Wreq.Session: newSession :: forall (es :: [Effect]). Wreq :> es => Eff es Session
+ Effectful.Wreq.Session: newSessionControl :: forall (es :: [Effect]). Wreq :> es => Maybe CookieJar -> ManagerSettings -> Eff es Session
+ Effectful.Wreq.Session: options :: forall (es :: [Effect]). Wreq :> es => Session -> String -> Eff es (Response ())
+ Effectful.Wreq.Session: optionsWith :: forall (es :: [Effect]). Wreq :> es => Options -> Session -> String -> Eff es (Response ())
+ Effectful.Wreq.Session: post :: forall (es :: [Effect]) a. (Wreq :> es, Postable a) => Session -> String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq.Session: postWith :: forall (es :: [Effect]) a. (Wreq :> es, Postable a) => Options -> Session -> String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq.Session: put :: forall (es :: [Effect]) a. (Wreq :> es, Putable a) => Session -> String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq.Session: putWith :: forall (es :: [Effect]) a. (Wreq :> es, Putable a) => Options -> Session -> String -> a -> Eff es (Response ByteString)
- Effectful.Wreq: class () => FormValue a
+ Effectful.Wreq: class FormValue a
- Effectful.Wreq: customHistoriedMethod :: Wreq :> es => String -> String -> Eff es (HistoriedResponse ByteString)
+ Effectful.Wreq: customHistoriedMethod :: forall (es :: [Effect]). Wreq :> es => String -> String -> Eff es (HistoriedResponse ByteString)
- Effectful.Wreq: customHistoriedMethodWith :: Wreq :> es => String -> Options -> String -> Eff es (HistoriedResponse ByteString)
+ Effectful.Wreq: customHistoriedMethodWith :: forall (es :: [Effect]). Wreq :> es => String -> Options -> String -> Eff es (HistoriedResponse ByteString)
- Effectful.Wreq: customHistoriedPayloadMethod :: Wreq :> es => Postable a => String -> String -> a -> Eff es (HistoriedResponse ByteString)
+ Effectful.Wreq: customHistoriedPayloadMethod :: forall (es :: [Effect]) a. (Wreq :> es, Postable a) => String -> String -> a -> Eff es (HistoriedResponse ByteString)
- Effectful.Wreq: customHistoriedPayloadMethodWith :: Wreq :> es => Postable a => String -> Options -> String -> a -> Eff es (HistoriedResponse ByteString)
+ Effectful.Wreq: customHistoriedPayloadMethodWith :: forall (es :: [Effect]) a. (Wreq :> es, Postable a) => String -> Options -> String -> a -> Eff es (HistoriedResponse ByteString)
- Effectful.Wreq: customMethod :: Wreq :> es => String -> String -> Eff es (Response ByteString)
+ Effectful.Wreq: customMethod :: forall (es :: [Effect]). Wreq :> es => String -> String -> Eff es (Response ByteString)
- Effectful.Wreq: customMethodWith :: Wreq :> es => String -> Options -> String -> Eff es (Response ByteString)
+ Effectful.Wreq: customMethodWith :: forall (es :: [Effect]). Wreq :> es => String -> Options -> String -> Eff es (Response ByteString)
- Effectful.Wreq: customPayloadMethod :: Wreq :> es => Postable a => String -> String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq: customPayloadMethod :: forall (es :: [Effect]) a. (Wreq :> es, Postable a) => String -> String -> a -> Eff es (Response ByteString)
- Effectful.Wreq: customPayloadMethodWith :: Wreq :> es => Postable a => String -> Options -> String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq: customPayloadMethodWith :: forall (es :: [Effect]) a. (Wreq :> es, Postable a) => String -> Options -> String -> a -> Eff es (Response ByteString)
- Effectful.Wreq: data () => AWSAuthVersion
+ Effectful.Wreq: data AWSAuthVersion
- Effectful.Wreq: data () => Auth
+ Effectful.Wreq: data Auth
- Effectful.Wreq: data () => Cookie
+ Effectful.Wreq: data Cookie
- Effectful.Wreq: data () => FormParam
+ Effectful.Wreq: data FormParam
- Effectful.Wreq: data () => HistoriedResponse body
+ Effectful.Wreq: data HistoriedResponse body
- Effectful.Wreq: data () => JSONError
+ Effectful.Wreq: data JSONError
- Effectful.Wreq: data () => Link
+ Effectful.Wreq: data Link
- Effectful.Wreq: data () => Options
+ Effectful.Wreq: data Options
- Effectful.Wreq: data () => Payload
+ Effectful.Wreq: data Payload
- Effectful.Wreq: data () => Proxy
+ Effectful.Wreq: data Proxy
- Effectful.Wreq: data () => Response body
+ Effectful.Wreq: data Response body
- Effectful.Wreq: data () => Status
+ Effectful.Wreq: data Status
- Effectful.Wreq: data Wreq :: Effect
+ Effectful.Wreq: data Wreq (a :: Type -> Type) b
- Effectful.Wreq: delete :: Wreq :> es => String -> Eff es (Response ByteString)
+ Effectful.Wreq: delete :: forall (es :: [Effect]). Wreq :> es => String -> Eff es (Response ByteString)
- Effectful.Wreq: deleteWith :: Wreq :> es => Options -> String -> Eff es (Response ByteString)
+ Effectful.Wreq: deleteWith :: forall (es :: [Effect]). Wreq :> es => Options -> String -> Eff es (Response ByteString)
- Effectful.Wreq: get :: Wreq :> es => String -> Eff es (Response ByteString)
+ Effectful.Wreq: get :: forall (es :: [Effect]). Wreq :> es => String -> Eff es (Response ByteString)
- Effectful.Wreq: getWith :: Wreq :> es => Options -> String -> Eff es (Response ByteString)
+ Effectful.Wreq: getWith :: forall (es :: [Effect]). Wreq :> es => Options -> String -> Eff es (Response ByteString)
- Effectful.Wreq: headWith :: Wreq :> es => Options -> String -> Eff es (Response ())
+ Effectful.Wreq: headWith :: forall (es :: [Effect]). Wreq :> es => Options -> String -> Eff es (Response ())
- Effectful.Wreq: head_ :: Wreq :> es => String -> Eff es (Response ())
+ Effectful.Wreq: head_ :: forall (es :: [Effect]). Wreq :> es => String -> Eff es (Response ())
- Effectful.Wreq: options :: Wreq :> es => String -> Eff es (Response ())
+ Effectful.Wreq: options :: forall (es :: [Effect]). Wreq :> es => String -> Eff es (Response ())
- Effectful.Wreq: optionsWith :: Wreq :> es => Options -> String -> Eff es (Response ())
+ Effectful.Wreq: optionsWith :: forall (es :: [Effect]). Wreq :> es => Options -> String -> Eff es (Response ())
- Effectful.Wreq: patch :: Wreq :> es => Patchable a => String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq: patch :: forall (es :: [Effect]) a. (Wreq :> es, Patchable a) => String -> a -> Eff es (Response ByteString)
- Effectful.Wreq: patchWith :: Wreq :> es => Patchable a => Options -> String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq: patchWith :: forall (es :: [Effect]) a. (Wreq :> es, Patchable a) => Options -> String -> a -> Eff es (Response ByteString)
- Effectful.Wreq: post :: Wreq :> es => Postable a => String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq: post :: forall (es :: [Effect]) a. (Wreq :> es, Postable a) => String -> a -> Eff es (Response ByteString)
- Effectful.Wreq: postWith :: Wreq :> es => Postable a => Options -> String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq: postWith :: forall (es :: [Effect]) a. (Wreq :> es, Postable a) => Options -> String -> a -> Eff es (Response ByteString)
- Effectful.Wreq: put :: Wreq :> es => Putable a => String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq: put :: forall (es :: [Effect]) a. (Wreq :> es, Putable a) => String -> a -> Eff es (Response ByteString)
- Effectful.Wreq: putWith :: Wreq :> es => Putable a => Options -> String -> a -> Eff es (Response ByteString)
+ Effectful.Wreq: putWith :: forall (es :: [Effect]) a. (Wreq :> es, Putable a) => Options -> String -> a -> Eff es (Response ByteString)
- Effectful.Wreq: runWreq :: (HasCallStack, IOE :> es) => Eff (Wreq : es) a -> Eff es a
+ Effectful.Wreq: runWreq :: forall (es :: [Effect]) a. (HasCallStack, IOE :> es) => Eff (Wreq ': es) a -> Eff es a

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for wreq-effectful +## 0.1.1.1 -- 2025-08-31++* Added sessions from wreq+ ## 0.1.0.0 -- YYYY-mm-dd  * First version. Released on an unsuspecting world.
+ README.md view
@@ -0,0 +1,23 @@+# wreq-effectful++Adaptation of the [wreq](https://hackage.haskell.org/package/wreq)+library for the effectful ecosystem.++## Example++A sample usage for logging to both standard output and Elasticsearch:++```haskell+{-# LANGUAGE OverloadedStrings #-}+module Main where++import Effectful+import Effectful.Wreq+import Control.Lens++main :: IO ()+main = runEff . runWreq $+    getWith (defaults & header "Accept" .~ ["application/json"]) "https://hackage.haskell.org/users/" >>=+    asValue >>=+    liftIO . print . (^. responseBody)+```
src/Effectful/Wreq.hs view
@@ -134,7 +134,6 @@  import Effectful import Effectful.Dispatch.Static-import Data.ByteString      qualified as S import Data.ByteString.Lazy qualified as L import Network.HTTP.Client.MultipartFormData qualified as HF import Network.Wreq         qualified as W@@ -238,4 +237,3 @@ customHistoriedPayloadMethodWith :: Wreq :> es => WT.Postable a => String -> W.Options -> String -> a -> Eff es (W.HistoriedResponse L.ByteString) customHistoriedPayloadMethodWith method opts url = unsafeEff_ . W.customHistoriedPayloadMethodWith method opts url --- TODO: FoldGet and FoldGetWith
+ src/Effectful/Wreq/Session.hs view
@@ -0,0 +1,128 @@+module Effectful.Wreq.Session+  (+  -- * Session creation+  Session+  , newSession+  , newAPISession++  -- ** More control-oriented session creation+  , newSessionControl++  -- * Get information about session state+  , getSessionCookieJar++  -- * HTTP verbs+  , get+  , post+  , head_+  , options+  , put+  , delete+  , customMethod++  -- * Configurable verbs+  , getWith+  , postWith+  , headWith+  , optionsWith+  , putWith+  , deleteWith+  , customMethodWith+  , customPayloadMethodWith+  , customHistoriedMethodWith+  , customHistoriedPayloadMethodWith+  )+    where++import Data.ByteString.Lazy                 (ByteString)+import Effectful+import Effectful.Dispatch.Static+import Effectful.Wreq                       (Wreq)+import Network.HTTP.Client+import Network.Wreq.Session                 (Session)+import Network.Wreq.Session qualified as S+import           Network.Wreq.Types++-- | Lifted `S.newSession`+newSession :: Wreq :> es => Eff es Session+newSession = unsafeEff_ S.newSession++-- | Lifted `S.newAPISession`+newAPISession :: Wreq :> es => Eff es Session+newAPISession = unsafeEff_ S.newAPISession++-- | Lifted `S.newSessionControl`+newSessionControl :: Wreq :> es => Maybe CookieJar -> ManagerSettings -> Eff es Session+newSessionControl cj = unsafeEff_ . S.newSessionControl cj++-- | Lifted `S.getSessionCookieJar`+getSessionCookieJar :: Wreq :> es => Session -> Eff es (Maybe CookieJar)+getSessionCookieJar = unsafeEff_ . S.getSessionCookieJar++-- | Lifted `S.get`+get :: Wreq :> es => Session -> String -> Eff es (Response ByteString)+get session = unsafeEff_ . S.get session++-- | Lifted `S.post`+post :: (Wreq :> es, Postable a) => Session -> String -> a -> Eff es (Response ByteString)+post session url = unsafeEff_ . S.post session url++-- | Lifted `S.head_`+head_ :: Wreq :> es => Session -> String -> Eff es (Response ())+head_ session = unsafeEff_ . S.head_ session++-- | Lifted `S.options`+options :: Wreq :> es => Session -> String -> Eff es (Response ())+options session = unsafeEff_ . S.options session++-- | Lifted `S.put`+put :: (Wreq :> es, Putable a) => Session -> String -> a -> Eff es (Response ByteString)+put session url = unsafeEff_ . S.put session url++-- | Lifted `S.delete`+delete :: Wreq :> es => Session -> String -> Eff es (Response ByteString)+delete session = unsafeEff_ . S.delete session++-- | Lifted `S.customMethod`+customMethod :: Wreq :> es => String -> Session -> String -> Eff es (Response ByteString)+customMethod method session = unsafeEff_ . S.customMethod method session++-- | Lifted `S.getWith`+getWith :: Wreq :> es => Options -> Session -> String -> Eff es (Response ByteString)+getWith opts session = unsafeEff_ . S.getWith opts session++-- | Lifted `S.postWith`+postWith :: (Wreq :> es, Postable a) => Options -> Session -> String -> a -> Eff es (Response ByteString)+postWith opts session url = unsafeEff_ . S.postWith opts session url++-- | Lifted `S.headWith`+headWith :: Wreq :> es => Options -> Session -> String -> Eff es (Response ())+headWith opts session = unsafeEff_ . S.headWith opts session++-- | Lifted `S.optionsWith`+optionsWith :: Wreq :> es => Options -> Session -> String -> Eff es (Response ())+optionsWith opts session = unsafeEff_ . S.optionsWith opts session++-- | Lifted `S.putWith`+putWith :: (Wreq :> es, Putable a) => Options -> Session -> String -> a -> Eff es (Response ByteString)+putWith opts session url = unsafeEff_ . S.putWith opts session url++-- | Lifted `S.deleteWith`+deleteWith :: Wreq :> es => Options -> Session -> String -> Eff es (Response ByteString)+deleteWith opts session = unsafeEff_ . S.deleteWith opts session++-- | Lifted `S.customMethodWith`+customMethodWith :: Wreq :> es => String -> Options -> Session -> String -> Eff es (Response ByteString)+customMethodWith method opts session = unsafeEff_ . S.customMethodWith method opts session++-- | Lifted `S.customPayloadMethodWith`+customPayloadMethodWith :: (Wreq :> es, Postable a) => String -> Options -> Session -> String -> a -> Eff es (Response ByteString)+customPayloadMethodWith method opts session url = unsafeEff_ . S.customPayloadMethodWith method opts session url++-- | Lifted `S.customHistoriedMethodWith`+customHistoriedMethodWith :: Wreq :> es => String -> Options -> Session -> String -> Eff es (HistoriedResponse ByteString)+customHistoriedMethodWith method opts session = unsafeEff_ . S.customHistoriedMethodWith method opts session++-- | Lifted `S.customHistoriedPayloadMethodWith`+customHistoriedPayloadMethodWith :: (Wreq :> es, Postable a) => String -> Options -> Session -> String -> a -> Eff es (HistoriedResponse ByteString)+customHistoriedPayloadMethodWith method opts session url = unsafeEff_ . S.customHistoriedPayloadMethodWith method opts session url
wreq-effectful.cabal view
@@ -1,4 +1,5 @@ cabal-version:      3.4+ -- The cabal-version field refers to the version of the .cabal specification, -- and can be different from the cabal-install (the tool) version and the -- Cabal (the library) version you are using. As such, the Cabal (the library)@@ -20,13 +21,14 @@ -- PVP summary:     +-+------- breaking API changes --                  | | +----- non-breaking API additions --                  | | | +--- code changes with no API change-version:            0.1.0.1+version:            0.1.1.1  -- A short (one-line) description of the package. synopsis:           Adaptation of the wreq library for the effectful ecosystem.  -- A longer description of the package.--- description:+description:+  Adaptation of the @<https://hackage.haskell.org/package/wreq wreq>@ library for the @<https://hackage.haskell.org/package/effectful effectful>@ ecosystem.  -- The license under which the package is released. license:            MIT@@ -41,7 +43,7 @@ maintainer:         nor@acorneroftheweb.com  -- Category of the project-category:            Web+category:           Web  -- A copyright notice. -- copyright:@@ -51,87 +53,97 @@ extra-doc-files:    CHANGELOG.md  -- Extra source files to be distributed with the package, such as examples, or a tutorial module.--- extra-source-files:+extra-source-files:+  CHANGELOG.md+  README.md +bug-reports:        https://github.com/The1Penguin/wreq-effectful/issues++source-repository head+  type:     git+  location: https://github.com/The1Penguin/wreq-effectful+ common main-    ghc-options:        -Wall-                        -Wcompat-                        -Wno-unticked-promoted-constructors-                        -Wmissing-deriving-strategies-                        -Werror=prepositive-qualified-module+  ghc-options:+    -Wall -Wcompat -Wno-unticked-promoted-constructors+    -Wmissing-deriving-strategies -Werror=prepositive-qualified-module -    default-extensions: BangPatterns-                        ConstraintKinds-                        DataKinds-                        DeriveFunctor-                        DeriveGeneric-                        DerivingStrategies-                        FlexibleContexts-                        FlexibleInstances-                        GADTs-                        GeneralizedNewtypeDeriving-                        ImportQualifiedPost-                        LambdaCase-                        MultiParamTypeClasses-                        NoStarIsType-                        PolyKinds-                        RankNTypes-                        RecordWildCards-                        RoleAnnotations-                        ScopedTypeVariables-                        StandaloneDeriving-                        TupleSections-                        TypeApplications-                        TypeFamilies-                        TypeOperators+  default-extensions:+    BangPatterns+    ConstraintKinds+    DataKinds+    DeriveFunctor+    DeriveGeneric+    DerivingStrategies+    FlexibleContexts+    FlexibleInstances+    GADTs+    GeneralizedNewtypeDeriving+    ImportQualifiedPost+    LambdaCase+    MultiParamTypeClasses+    NoStarIsType+    PolyKinds+    RankNTypes+    RecordWildCards+    RoleAnnotations+    ScopedTypeVariables+    StandaloneDeriving+    TupleSections+    TypeApplications+    TypeFamilies+    TypeOperators  library-    import:           main+  import:           main -    -- Modules exported by the library.-    exposed-modules:  Effectful.Wreq+  -- Modules exported by the library.+  exposed-modules:+    Effectful.Wreq+    Effectful.Wreq.Session -    -- Modules included in this library but not exported.-    -- other-modules:+  -- Modules included in this library but not exported.+  -- other-modules: -    -- LANGUAGE extensions used by modules in this package.-    -- other-extensions:+  -- LANGUAGE extensions used by modules in this package.+  -- other-extensions: -    -- Other library packages from which modules are imported.-    build-depends:    base ^>=4.18.1.0-                    , bytestring >= 0.11.5 && < 0.13-                    , effectful-core >= 2.3.1 && < 3.0-                    , http-client >= 0.7.17 && < 0.9-                    , wreq >= 0.5.4 && < 0.7+  -- Other library packages from which modules are imported.+  build-depends:+    , base            >=4.18.1.0 && <5+    , bytestring      >=0.11.5   && <0.13+    , effectful-core  >=2.3.1    && <3.0+    , http-client     >=0.7.17   && <0.9+    , wreq            >=0.5.4    && <0.7 -    -- Directories containing source files.-    hs-source-dirs:   src+  -- Directories containing source files.+  hs-source-dirs:   src -    -- Base language which the package is written in.-    default-language: GHC2021+  -- Base language which the package is written in.+  default-language: GHC2021  test-suite wreq-effectful-test-    import:           main+  import:           main -    -- Base language which the package is written in.-    default-language: GHC2021+  -- Base language which the package is written in.+  default-language: GHC2021 -    -- Modules included in this executable, other than Main.-    -- other-modules:+  -- Modules included in this executable, other than Main.+  -- other-modules: -    -- LANGUAGE extensions used by modules in this package.-    -- other-extensions:+  -- LANGUAGE extensions used by modules in this package.+  -- other-extensions: -    -- The interface type and version of the test suite.-    type:             exitcode-stdio-1.0+  -- The interface type and version of the test suite.+  type:             exitcode-stdio-1.0 -    -- Directories containing source files.-    hs-source-dirs:   test+  -- Directories containing source files.+  hs-source-dirs:   test -    -- The entrypoint to the test suite.-    main-is:          Main.hs+  -- The entrypoint to the test suite.+  main-is:          Main.hs -    -- Test dependencies.-    build-depends:-        base ^>=4.18.2.1,-        wreq-effectful+  -- Test dependencies.+  build-depends:+    , base            ^>=4.18.2.1+    , wreq-effectful