packages feed

wai-effectful 1.0.0 → 1.0.1

raw patch · 3 files changed

+29/−14 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -5,7 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to the [Haskell Package Versioning Policy](https://pvp.haskell.org/). -## [Unreleased]+## [1.0.1] - 2026-10-01++### Changed++- Optimised response lifting to preserve original response types. This enables Warp's fast path for builder and file responses.++## [1.0.0] - 2026-07-27  ### Added 
src/Effectful/Wai.hs view
@@ -241,19 +241,28 @@     | ResponseStream Status ResponseHeaders (StreamingBody es)     | ResponseRaw (Eff es ByteString -> (ByteString -> Eff es ()) -> Eff es ()) (Response es) -liftResponse :: (IOE :> es) => Wai.Response -> Response es-liftResponse res = ResponseStream status headers streamingBody+liftResponse :: forall es. (IOE :> es) => Wai.Response -> Response es+liftResponse (Wai.ResponseFile s h fp part) = ResponseFile s h fp part+liftResponse (Wai.ResponseBuilder s h b) = ResponseBuilder s h b+liftResponse (Wai.ResponseStream s h body) = ResponseStream s h (liftStreamingBody body)+liftResponse (Wai.ResponseRaw raw res) = ResponseRaw liftRaw (liftResponse res)   where-    (status, headers, withStream) = Wai.responseToStream res-    streamingBody send flush = liftStream withStream \body -> body send flush+    liftRaw :: Eff es ByteString -> (ByteString -> Eff es ()) -> Eff es ()+    liftRaw recv send = withRunInIO \unlift -> raw (unlift recv) (unlift . send) -unliftResponse :: (IOE :> es) => (forall r. Eff es r -> IO r) -> Response es -> Wai.Response-unliftResponse unlift res =-    Wai.responseStream status headers $-        unliftStreamingBody unlift \send flush ->-            withStream \body -> body send flush+unliftResponse+    :: forall es+     . (IOE :> es)+    => (forall r. Eff es r -> IO r)+    -> Response es+    -> Wai.Response+unliftResponse _ (ResponseFile s h fp part) = Wai.ResponseFile s h fp part+unliftResponse _ (ResponseBuilder s h b) = Wai.ResponseBuilder s h b+unliftResponse unlift (ResponseStream s h body) = Wai.ResponseStream s h (unliftStreamingBody unlift body)+unliftResponse unlift (ResponseRaw raw res) = Wai.ResponseRaw unliftRaw (unliftResponse unlift res)   where-    (status, headers, withStream) = responseToStream res+    unliftRaw :: IO ByteString -> (ByteString -> IO ()) -> IO ()+    unliftRaw recv send = unlift $ raw (liftIO recv) (liftIO . send)  -- | Lifted 'Wai.StreamingBody'. type StreamingBody es = (Builder -> Eff es ()) -> Eff es () -> Eff es ()
wai-effectful.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: wai-effectful-version: 1.0.0+version: 1.0.1 synopsis: Effectful bindings for the wai library description:   Adaptation of the @<https://hackage.haskell.org/package/wai wai>@ library for the @<https://hackage.haskell.org/package/effectful effectful>@ ecosystem.@@ -13,7 +13,7 @@ bug-reports: https://issues.digital-autonomy.institute category: Network build-type: Simple-extra-source-files:+extra-doc-files:   CHANGELOG.md  common common@@ -50,7 +50,7 @@   build-depends:     base >=4.10 && <5,     bytestring >=0.12 && <0.13,-    effectful >=2.6 && <2.7,+    effectful >=2.6 && <2.8,  library   import: common