LanguageExt.Net.Http
0.1.0-alpha-2
This is not used and shouldn't be prefixed with "LanguageExt" anyway
dotnet add package LanguageExt.Net.Http --version 0.1.0-alpha-2
NuGet\Install-Package LanguageExt.Net.Http -Version 0.1.0-alpha-2
<PackageReference Include="LanguageExt.Net.Http" Version="0.1.0-alpha-2" />
<PackageVersion Include="LanguageExt.Net.Http" Version="0.1.0-alpha-2" />
<PackageReference Include="LanguageExt.Net.Http" />
paket add LanguageExt.Net.Http --version 0.1.0-alpha-2
#r "nuget: LanguageExt.Net.Http, 0.1.0-alpha-2"
#:package LanguageExt.Net.Http@0.1.0-alpha-2
#addin nuget:?package=LanguageExt.Net.Http&version=0.1.0-alpha-2&prerelease
#tool nuget:?package=LanguageExt.Net.Http&version=0.1.0-alpha-2&prerelease
LanguageExt HTTP
A functional wrapper around HttpClient intended to integrate into LangagueExt V5 based workflows.
Provides the expected methods (get, post, delete, etc.) returning Http<HttpResponseMessage>, an "Http Monad"
Rationale
If you're already convinced of the general preferability of the functional approach, you probably don't need this Rationale section.
If you're not convinced but curious, check out the code cleanup project, noting the differences between the functional and imperative approaches, not just in total lines of code, but also the greater simplicity[^1] of nearly every part of the functional approach.
I may create a more dedicated "literate coding" style writeup of the above in the future (as of 10/23/2025), but for now hopefully the code can speak for iself.
[^1] Simplicity in the Rich Hickey sense of the word, it may not be easy at first if you're not familiar with the concepts!
Usage
// add to GlobalUsings as appropriate
using LanguageExt.Net;
using static LanguageExt.Net.Http;
The Http monad implements and thus gives us
Monad, for basic sequencing and composition,Bind(with LINQ syntax) andTraversebeing the bread and butter of most of what you'll doFallible, for generalizable and modular error handlingMonadUnliftIOfor not only lifting arbitrary IO operations (such as debuggings), but also access toRetry,Fork,Repeatand related goodesReadable, to enable threading of anHttpClientthroughout the application- If you need to thread
CancellationTokenas well, you can utilizeIO's built-inEnvIO
- If you need to thread
You can refer to the examples to see most of the above in action.
However, since a concrete Http type is an obstacle to composition in large applications, nearly every method in this library has both an Http-based and generalized version, for exmaple
- "The basics" (
get,post,delete, etc.), can be generalized to anyMonadIOthat implementsReadablefor anEnvthat implements this library'sHasHttpClientinterface parseUrican be generalized to anyFallibleApplicative- Response parsing methods such as
readContentAsStreamcan be generalized to anyMonadIO
Testing
Mocking HttpClients is a thorn in many peoples sides, so this library provides a Http.client method that, given a Func<HttpResponseMessage, HttpResponseMessage> ( or other overload ) handles all of the nasty business of dealing with an HttpMessageHandler for you.
client combined with the natural structure of the "reader monad pattern" this follows should enable much smoother mocking of http functionality in general.
Copyright 2025 Michael Marsh
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- LanguageExt.Core (>= 5.0.0-beta-54)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 0.1.0-alpha-2 | 166 | 10/23/2025 |