effectful-streamly-http: HTTP requests as an Effectful effect

[ bsd3, control, library, network, web ] [ Propose Tags ] [ Report a vulnerability ]

An HTTP effect for Effectful: send a request, get the whole response. The interpreter of this package runs over streamly-http, in clear; effectful-streamly-http-tls adds https. An interpreter from a function serves tests, which then need no server.


[Skip to Readme]

Modules

  • Effectful
    • Effectful.HTTP

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.19 && <4.22), bytestring (>=0.12 && <0.13), effectful-core (>=2.7.1 && <2.8), streamly-bytestring (>=0.2.3 && <0.3), streamly-http (>=0.1 && <0.2), text (>=2.1 && <2.2) [details]
Tested with ghc ==9.8.4 || ==9.10.3 || ==9.12.4
License BSD-3-Clause
Author Xavier Dectot
Maintainer Xavier Dectot <xavier@wheredoibegin.fr>
Uploaded by GdeVolpiano at 2026-11-28T11:03:56Z
Category Network, Web, Control
Home page https://github.com/GuillaumedeVolpiano/effectful-streamly-http
Source repo head: git clone https://github.com/GuillaumedeVolpiano/effectful-streamly-http.git
Distributions
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs pending
Build status unknown [no reports yet]

Readme for effectful-streamly-http-0.1.0.0

[back to package description]

effectful-streamly-http

HTTP requests as an Effectful effect: send a request, get the whole response. The interpreter of this package runs over streamly-http, in clear; effectful-streamly-http-tls adds https.

{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}

import Effectful (runEff)
import Effectful.Error.Static (runErrorNoCallStack)
import Effectful.HTTP (HttpFailure, Response (..), Scheme (Http), defaultLimits,
                       fetch, get, runHttpClear)

main :: IO ()
main = do
  outcome <- runEff . runErrorNoCallStack @HttpFailure . runHttpClear defaultLimits $
    fetch Http (get "example.org" 80 "/")
  print (fmap (.status) outcome)

What it gives

  • Http, the effect, with one operation: fetch, for a request in clear (Http) or over TLS (Https).
  • runHttpClear: connections over plain TCP, within Limits of time and size, kept from one request to the next for each server as long as the interpreter runs. A request over TLS fails with TlsUnavailable.
  • runHttpWith: the effect answered from a function. Code written against the effect is tested without any server.
  • HttpFailure: why an exchange gave no response. A status is never a failure.

Limits of this version

  • The whole response is read into memory: set maxBodySize when the server is not trusted. There is no streaming of a body.
  • No redirect is followed.

Building

To build against a copy of streamly-http checked out next to this repository, pass --project-file=cabal.project.siblings.

Tested with GHC 9.8.4, 9.10.3 and 9.12.4, and effectful 2.7.1.