diff --git a/LanguageExt.Pipes/Client/Client.cs b/LanguageExt.Pipes/Client/Client.cs
deleted file mode 100644
index 5a7c88c3b..000000000
--- a/LanguageExt.Pipes/Client/Client.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System.Diagnostics.Contracts;
-using System.Runtime.CompilerServices;
-using LanguageExt.Traits;
-
-namespace LanguageExt.Pipes;
-
-///
-/// `Client` sends requests of type `REQ` and receives responses of type `RES`.
-///
-/// Clients only `request` and never `respond`.
-///
-///
-///
-/// Upstream | Downstream
-/// +---------+
-/// | |
-/// REQ 〈== 〈== Unit
-/// | |
-/// RES ==〉 ==〉Void
-/// | | |
-/// +----|----+
-/// |
-/// A
-///
-public class Client
-{
- ///
- /// Monad return / pure
- ///
- [Pure, MethodImpl(Proxy.mops)]
- public static Client Pure(R value)
- where M : Monad =>
- new Pure(value).ToClient();
-
- ///
- /// Send a value of type `RES` downstream and block waiting for a reply of type `REQ`
- ///
- ///
- /// `respond` is the identity of the respond category.
- ///
- [Pure, MethodImpl(Proxy.mops)]
- public static Client request(REQ value)
- where M : Monad =>
- new Request(value, r => new Pure(r)).ToClient();
-
- ///
- /// Lift am IO monad into the `Proxy` monad transformer
- ///
- [Pure, MethodImpl(Proxy.mops)]
- public static Client lift(K ma)
- where M : Monad =>
- new ProxyM(M.Map(Proxy.Pure, ma)).ToClient();
-
- ///
- /// Lift am IO monad into the `Proxy` monad transformer
- ///
- [Pure, MethodImpl(Proxy.mops)]
- public static Client liftIO(IO ma)
- where M : Monad =>
- new ProxyM(M.Map(Proxy.Pure, M.LiftIO(ma))).ToClient();
-}
diff --git a/LanguageExt.Pipes/Client/CoreTypes.cs b/LanguageExt.Pipes/Client/CoreTypes.cs
deleted file mode 100644
index 93937f49c..000000000
--- a/LanguageExt.Pipes/Client/CoreTypes.cs
+++ /dev/null
@@ -1,237 +0,0 @@
-using System;
-using System.Diagnostics.Contracts;
-using LanguageExt.Common;
-using LanguageExt.Traits;
-
-namespace LanguageExt.Pipes;
-
-///
-/// `Client` sends requests of type `REQ` and receives responses of type `RES`.
-///
-/// Clients only `request` and never `respond`.
-///
-///
-///
-/// Upstream | Downstream
-/// +---------+
-/// | |
-/// REQ 〈== 〈== Unit
-/// | |
-/// RES ==〉 ==〉Void
-/// | | |
-/// +----|----+
-/// |
-/// A
-///
-public record Client : Proxy
- where M : Monad
-{
- public readonly Proxy Value;
-
- ///
- /// Constructor
- ///
- /// Correctly shaped `Proxy` that represents a `Client`
- public Client(Proxy value) =>
- Value = value;
-
- ///
- /// Calling this will effectively cast the subtype to the base.
- ///
- /// This type wraps up a `Proxy` for convenience, and so it's a `Proxy` proxy. So calling this method
- /// isn't exactly the same as a cast operation, as it unwraps the `Proxy` from within. It has the same effect
- /// however, and removes a level of indirection
- /// A general `Proxy` type from a more specialised type
- [Pure]
- public override Proxy ToProxy() =>
- Value.ToProxy();
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public override Proxy Bind(Func> f) =>
- Value.Bind(f);
-
- ///
- /// Lifts a pure function into the `Proxy` domain, causing it to map the bound value within
- ///
- /// The map function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the map operation
- [Pure]
- public override Proxy Map(Func f) =>
- Value.Map(f);
-
- ///
- /// Map the lifted monad
- ///
- /// The map function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the map operation
- [Pure]
- public override Proxy MapM(Func, K> f) =>
- Value.MapM(f);
-
- ///
- /// Extract the lifted IO monad (if there is one)
- ///
- /// The map function
- /// A new `Proxy` that represents the innermost IO monad, if it exists.
- /// `Errors.UnliftIONotSupported` if there's no IO monad in the stack
- [Pure]
- public override Proxy> ToIO() =>
- Value.ToIO();
-
- ///
- /// Monadic bind operation, for chaining `Client` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Client Bind(Func> f) =>
- Value.Bind(f).ToClient();
-
- ///
- /// Monadic bind operation, for chaining `Client` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Client SelectMany(Func> f) =>
- Value.Bind(f).ToClient();
-
- ///
- /// Monadic bind operation, for chaining `Client` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Client SelectMany(Func> f, Func project) =>
- Value.Bind(a => f(a).Map(b => project(a, b))).ToClient();
-
- ///
- /// Lifts a pure function into the `Proxy` domain, causing it to map the bound value within
- ///
- /// The map function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the map operation
- [Pure]
- public new Client Select(Func f) =>
- Value.Map(f).ToClient();
-
- ///
- /// `For(body)` loops over the `Proxy p` replacing each `yield` with `body`
- ///
- /// Any `yield` found in the `Proxy` will be replaced with this function. It will be composed so
- /// that the value yielded will be passed to the argument of the function. That returns a `Proxy` to continue the
- /// processing of the computation
- /// A new `Proxy` that represents the composition of this `Proxy` and the function provided
- [Pure]
- public override Proxy For(Func> body) =>
- Value.For(body);
-
- ///
- /// Applicative action
- ///
- /// Invokes this `Proxy`, then the `Proxy r`
- ///
- /// `Proxy` to run after this one
- [Pure]
- public override Proxy Action(Proxy r) =>
- Value.Action(r);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- ///
- /// (f +>> p) pairs each 'request' in `this` with a 'respond' in `lhs`.
- ///
- [Pure]
- public override Proxy PairEachRequestWithRespond(Func> lhs) =>
- Value.PairEachRequestWithRespond(lhs);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- [Pure]
- public override Proxy ReplaceRequest(Func> lhs) =>
- Value.ReplaceRequest(lhs);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- [Pure]
- public override Proxy PairEachRespondWithRequest(Func> rhs) =>
- Value.PairEachRespondWithRequest(rhs);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- [Pure]
- public override Proxy ReplaceRespond(Func> rhs) =>
- Value.ReplaceRespond(rhs);
-
- ///
- /// Reverse the arrows of the `Proxy` to find its dual.
- ///
- /// The dual of `this`
- [Pure]
- public override Proxy Reflect() =>
- Value.Reflect();
-
- ///
- ///
- /// Observe(lift (Pure(r))) = Observe(Pure(r))
- /// Observe(lift (m.Bind(f))) = Observe(lift(m.Bind(x => lift(f(x)))))
- ///
- /// This correctness comes at a small cost to performance, so use this function sparingly.
- /// This function is a convenience for low-level pipes implementers. You do not need to
- /// use observe if you stick to the safe API.
- ///
- [Pure]
- public override Proxy Observe() =>
- Value.Observe();
-
- [Pure]
- public void Deconstruct(out Proxy value) =>
- value = Value;
-
- ///
- /// Compose a `Server` and a `Client` together into an `Effect`. Note the `Server` is provided as a function
- /// that takes a value of `REQ`. This is how we model the request coming into the `Server`. The resulting
- /// `Server` computation can then call `Server.respond(response)` to reply to the `Client`.
- ///
- /// The `Client` simply calls `Client.request(req)` to post a request to the `Server`, it is like an `awaiting`
- /// that also posts. It will await the response from the `Server`.
- ///
- /// `Server`
- /// `Client`
- /// `Effect`
- [Pure]
- public static Effect operator |(Func> x, Client y) =>
- y.PairEachRequestWithRespond(x).ToEffect();
-
- ///
- /// Chain one client after another
- ///
- [Pure]
- public static Client operator &(
- Client lhs,
- Client rhs) =>
- lhs.Bind(_ => rhs);
-
- [Pure]
- public override string ToString() =>
- "client";
-}
diff --git a/Samples/PipesExamples/Concurrent/Buffer.cs b/LanguageExt.Pipes/Concurrent/Buffer.cs
similarity index 97%
rename from Samples/PipesExamples/Concurrent/Buffer.cs
rename to LanguageExt.Pipes/Concurrent/Buffer.cs
index 731b83590..7d8ef078e 100644
--- a/Samples/PipesExamples/Concurrent/Buffer.cs
+++ b/LanguageExt.Pipes/Concurrent/Buffer.cs
@@ -1,4 +1,4 @@
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
///
/// Settings for `Mailbox` channels
diff --git a/Samples/PipesExamples/Concurrent/Inbox/Inbox.CoFunctor.cs b/LanguageExt.Pipes/Concurrent/Inbox/Inbox.CoFunctor.cs
similarity index 92%
rename from Samples/PipesExamples/Concurrent/Inbox/Inbox.CoFunctor.cs
rename to LanguageExt.Pipes/Concurrent/Inbox/Inbox.CoFunctor.cs
index 14b233f0f..4ba6cf859 100644
--- a/Samples/PipesExamples/Concurrent/Inbox/Inbox.CoFunctor.cs
+++ b/LanguageExt.Pipes/Concurrent/Inbox/Inbox.CoFunctor.cs
@@ -1,6 +1,7 @@
+using System;
using LanguageExt.Traits;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
public class Inbox : Decidable
{
diff --git a/Samples/PipesExamples/Concurrent/Inbox/Inbox.DSL.cs b/LanguageExt.Pipes/Concurrent/Inbox/Inbox.DSL.cs
similarity index 98%
rename from Samples/PipesExamples/Concurrent/Inbox/Inbox.DSL.cs
rename to LanguageExt.Pipes/Concurrent/Inbox/Inbox.DSL.cs
index 69f566cfa..632b3e531 100644
--- a/Samples/PipesExamples/Concurrent/Inbox/Inbox.DSL.cs
+++ b/LanguageExt.Pipes/Concurrent/Inbox/Inbox.DSL.cs
@@ -1,8 +1,9 @@
+using System;
using System.Threading.Channels;
using LanguageExt.Common;
using static LanguageExt.Prelude;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
record InboxWriter(ChannelWriter Writer) : Inbox
{
diff --git a/Samples/PipesExamples/Concurrent/Inbox/Inbox.Extensions.cs b/LanguageExt.Pipes/Concurrent/Inbox/Inbox.Extensions.cs
similarity index 83%
rename from Samples/PipesExamples/Concurrent/Inbox/Inbox.Extensions.cs
rename to LanguageExt.Pipes/Concurrent/Inbox/Inbox.Extensions.cs
index 2e5dda100..f2c7670fa 100644
--- a/Samples/PipesExamples/Concurrent/Inbox/Inbox.Extensions.cs
+++ b/LanguageExt.Pipes/Concurrent/Inbox/Inbox.Extensions.cs
@@ -1,6 +1,6 @@
using LanguageExt.Traits;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
public static class InboxExtensions
{
diff --git a/Samples/PipesExamples/Concurrent/Inbox/Inbox.cs b/LanguageExt.Pipes/Concurrent/Inbox/Inbox.cs
similarity index 98%
rename from Samples/PipesExamples/Concurrent/Inbox/Inbox.cs
rename to LanguageExt.Pipes/Concurrent/Inbox/Inbox.cs
index dfa29d54c..2ce767fa2 100644
--- a/Samples/PipesExamples/Concurrent/Inbox/Inbox.cs
+++ b/LanguageExt.Pipes/Concurrent/Inbox/Inbox.cs
@@ -1,7 +1,8 @@
+using System;
using LanguageExt.Common;
using LanguageExt.Traits;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
///
/// Entry point to a channel. Inboxes receive values and propagate them through the
diff --git a/Samples/PipesExamples/Concurrent/Mailbox/Mailbox.Module.cs b/LanguageExt.Pipes/Concurrent/Mailbox/Mailbox.Module.cs
similarity index 97%
rename from Samples/PipesExamples/Concurrent/Mailbox/Mailbox.Module.cs
rename to LanguageExt.Pipes/Concurrent/Mailbox/Mailbox.Module.cs
index 9842b9e29..9d88b2928 100644
--- a/Samples/PipesExamples/Concurrent/Mailbox/Mailbox.Module.cs
+++ b/LanguageExt.Pipes/Concurrent/Mailbox/Mailbox.Module.cs
@@ -1,5 +1,6 @@
+using System;
using Ch = System.Threading.Channels;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
public static class Mailbox
{
diff --git a/Samples/PipesExamples/Concurrent/Mailbox/Mailbox.cs b/LanguageExt.Pipes/Concurrent/Mailbox/Mailbox.cs
similarity index 99%
rename from Samples/PipesExamples/Concurrent/Mailbox/Mailbox.cs
rename to LanguageExt.Pipes/Concurrent/Mailbox/Mailbox.cs
index 61e6f2112..621b8a10f 100644
--- a/Samples/PipesExamples/Concurrent/Mailbox/Mailbox.cs
+++ b/LanguageExt.Pipes/Concurrent/Mailbox/Mailbox.cs
@@ -1,7 +1,8 @@
+using System;
using LanguageExt.Common;
using LanguageExt.Traits;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
///
/// Represents a channel. A channel has:
diff --git a/Samples/PipesExamples/Concurrent/Outbox/Outbox.DSL.cs b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.DSL.cs
similarity index 97%
rename from Samples/PipesExamples/Concurrent/Outbox/Outbox.DSL.cs
rename to LanguageExt.Pipes/Concurrent/Outbox/Outbox.DSL.cs
index ed047035f..a0a2801e2 100644
--- a/Samples/PipesExamples/Concurrent/Outbox/Outbox.DSL.cs
+++ b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.DSL.cs
@@ -1,7 +1,10 @@
+using System;
+using System.Threading;
using System.Threading.Channels;
+using System.Threading.Tasks;
using LanguageExt.Common;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
record OutboxPure(A Value) : Outbox
{
diff --git a/Samples/PipesExamples/Concurrent/Outbox/Outbox.Extensions.cs b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.Extensions.cs
similarity index 83%
rename from Samples/PipesExamples/Concurrent/Outbox/Outbox.Extensions.cs
rename to LanguageExt.Pipes/Concurrent/Outbox/Outbox.Extensions.cs
index 3aac2c4e1..7f6ce7d2e 100644
--- a/Samples/PipesExamples/Concurrent/Outbox/Outbox.Extensions.cs
+++ b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.Extensions.cs
@@ -1,6 +1,6 @@
using LanguageExt.Traits;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
public static class OutboxExtensions
{
diff --git a/Samples/PipesExamples/Concurrent/Outbox/Outbox.Internal.cs b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.Internal.cs
similarity index 97%
rename from Samples/PipesExamples/Concurrent/Outbox/Outbox.Internal.cs
rename to LanguageExt.Pipes/Concurrent/Outbox/Outbox.Internal.cs
index a2e2246e5..30932b5f2 100644
--- a/Samples/PipesExamples/Concurrent/Outbox/Outbox.Internal.cs
+++ b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.Internal.cs
@@ -1,6 +1,8 @@
+using System.Threading;
+using System.Threading.Tasks;
using LanguageExt.Common;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
internal class OutboxInternal
{
diff --git a/LanguageExt.Pipes/Concurrent/Outbox/Outbox.Module.cs b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.Module.cs
new file mode 100644
index 000000000..ab5748c1c
--- /dev/null
+++ b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.Module.cs
@@ -0,0 +1,6 @@
+namespace LanguageExt.Pipes.Concurrent;
+
+public partial class Outbox
+{
+
+}
diff --git a/Samples/PipesExamples/Concurrent/Outbox/Outbox.Monad.cs b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.Monad.cs
similarity index 94%
rename from Samples/PipesExamples/Concurrent/Outbox/Outbox.Monad.cs
rename to LanguageExt.Pipes/Concurrent/Outbox/Outbox.Monad.cs
index e2c6215d7..e2725f21c 100644
--- a/Samples/PipesExamples/Concurrent/Outbox/Outbox.Monad.cs
+++ b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.Monad.cs
@@ -1,6 +1,7 @@
+using System;
using LanguageExt.Traits;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
public partial class Outbox :
Monad,
diff --git a/Samples/PipesExamples/Concurrent/Outbox/Outbox.cs b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.cs
similarity index 97%
rename from Samples/PipesExamples/Concurrent/Outbox/Outbox.cs
rename to LanguageExt.Pipes/Concurrent/Outbox/Outbox.cs
index c0787d48d..f5d5a8718 100644
--- a/Samples/PipesExamples/Concurrent/Outbox/Outbox.cs
+++ b/LanguageExt.Pipes/Concurrent/Outbox/Outbox.cs
@@ -1,7 +1,10 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
using LanguageExt.Traits;
using static LanguageExt.Prelude;
-namespace LanguageExt.Pipes2.Concurrent;
+namespace LanguageExt.Pipes.Concurrent;
public abstract record Outbox :
K,
diff --git a/LanguageExt.Pipes/Consumer/Consumer.cs b/LanguageExt.Pipes/Consumer/Consumer.cs
deleted file mode 100644
index 16c508331..000000000
--- a/LanguageExt.Pipes/Consumer/Consumer.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System;
-using LanguageExt.Traits;
-using System.Diagnostics.Contracts;
-using System.Runtime.CompilerServices;
-using static LanguageExt.Pipes.Proxy;
-using static LanguageExt.Prelude;
-
-namespace LanguageExt.Pipes;
-
-///
-/// Consumers both can only be `awaiting`
-///
-///
-///
-/// Upstream | Downstream
-/// +---------+
-/// | |
-/// Unit〈== 〈== Unit
-/// | |
-/// IN ==〉 ==〉Void
-/// | | |
-/// +----|----+
-/// |
-/// A
-///
-public static class Consumer
-{
- ///
- /// Monad return / pure
- ///
- [Pure, MethodImpl(mops)]
- public static Consumer Pure(R value)
- where M : Monad =>
- new Pure(value).ToConsumer();
-
- ///
- /// Wait for a value from upstream (whilst in a consumer)
- ///
- [Pure, MethodImpl(mops)]
- public static Consumer awaiting()
- where M : Monad =>
- request(unit).ToConsumer();
-
- ///
- /// Lift the IO monad into the Consumer monad transformer (a specialism of the Proxy monad transformer)
- ///
- [Pure, MethodImpl(mops)]
- public static Consumer lift(K ma)
- where M : Monad =>
- lift(ma).ToConsumer();
-
- ///
- /// Lift the IO monad into the Consumer monad transformer (a specialism of the Proxy monad transformer)
- ///
- [Pure, MethodImpl(mops)]
- public static Consumer liftIO(IO ma)
- where M : Monad =>
- liftIO(ma).ToConsumer();
-
- ///
- /// Consume all values using a monadic function
- ///
- [Pure, MethodImpl(mops)]
- public static Consumer mapM(Func> f)
- where M : Monad =>
- cat().ForEach(a => lift(f(a)));
-
- ///
- /// Consume all values using a monadic function
- ///
- [Pure, MethodImpl(mops)]
- public static Consumer mapM(Func> f)
- where M : Monad =>
- cat().ForEach(a => lift(M.LiftIO(f(a))));
-
-}
diff --git a/LanguageExt.Pipes/Consumer/CoreTypes.cs b/LanguageExt.Pipes/Consumer/CoreTypes.cs
deleted file mode 100644
index 3803c09ff..000000000
--- a/LanguageExt.Pipes/Consumer/CoreTypes.cs
+++ /dev/null
@@ -1,272 +0,0 @@
-using System;
-using System.Diagnostics.Contracts;
-using LanguageExt.Common;
-using LanguageExt.Traits;
-
-namespace LanguageExt.Pipes;
-
-///
-/// Consumers both can only be `awaiting`
-///
-///
-/// Upstream | Downstream
-/// +---------+
-/// | |
-/// Unit〈== 〈== Unit
-/// | |
-/// IN ==〉 ==〉Void
-/// | | |
-/// +----|----+
-/// |
-/// A
-///
-public record Consumer : Proxy
- where M : Monad
-{
- public readonly Proxy Value;
-
- ///
- /// Constructor
- ///
- /// Correctly shaped `Proxy` that represents a `Consumer`
- public Consumer(Proxy value) =>
- Value = value;
-
- ///
- /// Calling this will effectively cast the sub-type to the base.
- ///
- /// This type wraps up a `Proxy` for convenience, and so it's a `Proxy` proxy. So calling this method
- /// isn't exactly the same as a cast operation, as it unwraps the `Proxy` from within. It has the same effect
- /// however, and removes a level of indirection
- /// A general `Proxy` type from a more specialised type
- [Pure]
- public override Proxy ToProxy() =>
- Value.ToProxy();
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public override Proxy Bind(Func> f) =>
- Value.Bind(f);
-
- ///
- /// Map the lifted monad
- ///
- /// The map function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the map operation
- [Pure]
- public override Proxy MapM(Func, K> f) =>
- Value.MapM(f);
-
- ///
- /// Extract the lifted IO monad (if there is one)
- ///
- /// The map function
- /// A new `Proxy` that represents the innermost IO monad, if it exists.
- /// `Errors.UnliftIONotSupported` if there's no IO monad in the stack
- [Pure]
- public override Proxy> ToIO() =>
- Value.ToIO();
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Consumer Bind(Func> f) =>
- Value.Bind(f).ToConsumer();
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Consumer Bind(Func> f) =>
- Value.Bind(x => Consumer.lift(f(x))).ToConsumer();
-
- ///
- /// Lifts a pure function into the `Proxy` domain, causing it to map the bound value within
- ///
- /// The map function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the map operation
- [Pure]
- public override Proxy Map(Func f) =>
- Value.Map(f);
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Consumer SelectMany(Func> f, Func project) =>
- Value.Bind(a => f(a).Map(b => project(a, b))).ToConsumer();
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Consumer SelectMany(Func> f, Func project) =>
- Value.Bind(x => Consumer.lift(M.Map(y => project(x, y), f(x)))).ToConsumer();
-
- ///
- /// Lifts a pure function into the `Proxy` domain, causing it to map the bound value within
- ///
- /// The map function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the map operation
- [Pure]
- public new Consumer Select(Func f) =>
- Value.Map(f).ToConsumer();
-
- ///
- /// `For(body)` loops over the `Proxy p` replacing each `yield` with `body`
- ///
- /// Any `yield` found in the `Proxy` will be replaced with this function. It will be composed so
- /// that the value yielded will be passed to the argument of the function. That returns a `Proxy` to continue the
- /// processing of the computation
- /// A new `Proxy` that represents the composition of this `Proxy` and the function provided
- [Pure]
- public override Proxy For(Func> body) =>
- Value.For(body);
-
- ///
- /// Applicative action
- ///
- /// Invokes this `Proxy`, then the `Proxy r`
- ///
- /// `Proxy` to run after this one
- [Pure]
- public override Proxy Action(Proxy r) =>
- Value.Action(r);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- ///
- /// (f +>> p) pairs each 'request' in `this` with a 'respond' in `lhs`.
- ///
- [Pure]
- public override Proxy PairEachRequestWithRespond(
- Func> lhs) =>
- Value.PairEachRequestWithRespond(lhs);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- [Pure]
- public override Proxy ReplaceRequest(
- Func> lhs) =>
- Value.ReplaceRequest(lhs);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- [Pure]
- public override Proxy PairEachRespondWithRequest(
- Func> rhs) =>
- Value.PairEachRespondWithRequest(rhs);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- [Pure]
- public override Proxy ReplaceRespond(
- Func> rhs) =>
- Value.ReplaceRespond(rhs);
-
- ///
- /// Reverse the arrows of the `Proxy` to find its dual.
- ///
- /// The dual of `this`
- [Pure]
- public override Proxy Reflect() =>
- Value.Reflect();
-
- ///
- ///
- /// Observe(lift (Pure(r))) = Observe(Pure(r))
- /// Observe(lift (m.Bind(f))) = Observe(lift(m.Bind(x => lift(f(x)))))
- ///
- /// This correctness comes at a small cost to performance, so use this function sparingly.
- /// This function is a convenience for low-level pipes implementers. You do not need to
- /// use observe if you stick to the safe API.
- ///
- [Pure]
- public override Proxy Observe() =>
- Value.Observe();
-
- [Pure]
- public void Deconstruct(out Proxy value) =>
- value = Value;
-
- ///
- /// Conversion operator from the _pure_ `Consumer` type, to the monad transformer version of the `Consumer`
- ///
- /// Pure `Consumer`
- /// Monad transformer version of the `Consumer`
- [Pure]
- public static implicit operator Consumer(Consumer c) =>
- c.Interpret();
-
- ///
- /// Conversion operator from the `Pure` type, to the monad transformer version of the `Consumer`
- ///
- /// `Pure` value
- /// Monad transformer version of the `Consumer`
- [Pure]
- public static implicit operator Consumer(Pure p) =>
- Consumer.Pure(p.Value);
-
- ///
- /// Compose an `IN` and a `Consumer` together into an `Effect`. This effectively creates a singleton `Producer`
- /// from the `IN` value, and composes it with the `Consumer` into an `Effect` that can be run.
- ///
- /// Single input value
- /// `Consumer`
- /// `Effect`
- [Pure]
- public static Effect operator |(IN p1, Consumer p2) =>
- Proxy.compose(Producer.yield(p1).Map(_ => default(A)), p2).ToEffect();
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Consumer SelectMany(Func> bind, Func project) =>
- Value.Bind(a => bind(a).Interpret().Map(b => project(a, b))).ToConsumer();
-
- ///
- /// Chain one consumer's set of awaits after another
- ///
- [Pure]
- public static Consumer operator &(
- Consumer lhs,
- Consumer rhs) =>
- lhs.Bind(_ => rhs);
-
- [Pure]
- public override string ToString() =>
- "consumer";
-}
diff --git a/Samples/PipesExamples/ConsumerT/ConsumerT.Extensions.cs b/LanguageExt.Pipes/ConsumerT/ConsumerT.Extensions.cs
similarity index 98%
rename from Samples/PipesExamples/ConsumerT/ConsumerT.Extensions.cs
rename to LanguageExt.Pipes/ConsumerT/ConsumerT.Extensions.cs
index 07debd41f..9c8a95e57 100644
--- a/Samples/PipesExamples/ConsumerT/ConsumerT.Extensions.cs
+++ b/LanguageExt.Pipes/ConsumerT/ConsumerT.Extensions.cs
@@ -1,6 +1,7 @@
+using System;
using LanguageExt.Traits;
-namespace LanguageExt.Pipes2;
+namespace LanguageExt.Pipes;
public static class ConsumerTExtensions
{
diff --git a/Samples/PipesExamples/ConsumerT/ConsumerT.Module.cs b/LanguageExt.Pipes/ConsumerT/ConsumerT.Module.cs
similarity index 99%
rename from Samples/PipesExamples/ConsumerT/ConsumerT.Module.cs
rename to LanguageExt.Pipes/ConsumerT/ConsumerT.Module.cs
index 7f2a4c9dc..76f97195f 100644
--- a/Samples/PipesExamples/ConsumerT/ConsumerT.Module.cs
+++ b/LanguageExt.Pipes/ConsumerT/ConsumerT.Module.cs
@@ -1,7 +1,9 @@
+using System;
+using System.Threading.Tasks;
using LanguageExt.Common;
using LanguageExt.Traits;
-namespace LanguageExt.Pipes2;
+namespace LanguageExt.Pipes;
///
/// `ConsumerT` streaming consumer monad-transformer
diff --git a/Samples/PipesExamples/ConsumerT/ConsumerT.Monad.cs b/LanguageExt.Pipes/ConsumerT/ConsumerT.Monad.cs
similarity index 95%
rename from Samples/PipesExamples/ConsumerT/ConsumerT.Monad.cs
rename to LanguageExt.Pipes/ConsumerT/ConsumerT.Monad.cs
index 357b2957f..cdf36cdfb 100644
--- a/Samples/PipesExamples/ConsumerT/ConsumerT.Monad.cs
+++ b/LanguageExt.Pipes/ConsumerT/ConsumerT.Monad.cs
@@ -1,7 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
using LanguageExt.Async.Linq;
using LanguageExt.Traits;
-namespace LanguageExt.Pipes2;
+namespace LanguageExt.Pipes;
public class ConsumerT : MonadT, M>
where M : Monad
diff --git a/Samples/PipesExamples/ConsumerT/ConsumerT.cs b/LanguageExt.Pipes/ConsumerT/ConsumerT.cs
similarity index 98%
rename from Samples/PipesExamples/ConsumerT/ConsumerT.cs
rename to LanguageExt.Pipes/ConsumerT/ConsumerT.cs
index cc231362b..ac6e1aa81 100644
--- a/Samples/PipesExamples/ConsumerT/ConsumerT.cs
+++ b/LanguageExt.Pipes/ConsumerT/ConsumerT.cs
@@ -1,7 +1,8 @@
+using System;
using System.Diagnostics.Contracts;
using LanguageExt.Traits;
-namespace LanguageExt.Pipes2;
+namespace LanguageExt.Pipes;
///
/// `ConsumerT` streaming consumer monad-transformer instance
diff --git a/LanguageExt.Pipes/Effect/CoreTypes.cs b/LanguageExt.Pipes/Effect/CoreTypes.cs
deleted file mode 100644
index a18d275f4..000000000
--- a/LanguageExt.Pipes/Effect/CoreTypes.cs
+++ /dev/null
@@ -1,238 +0,0 @@
-using System;
-using System.Diagnostics.Contracts;
-using LanguageExt.Common;
-using LanguageExt.Traits;
-
-namespace LanguageExt.Pipes;
-
-///
-/// Effects represent a 'fused' set of producer, pipes, and consumer into one type.
-///
-/// It neither can neither `yield` nor be `awaiting`, it represents an entirely closed effect system.
-///
-///
-///
-/// Upstream | Downstream
-/// +---------+
-/// | |
-/// Void〈== 〈== Unit
-/// | |
-/// Unit ==〉 ==〉Void
-/// | | |
-/// +----|----+
-/// |
-/// A
-///
-///
-public record Effect : Proxy
- where M : Monad
-{
- public readonly Proxy Value;
-
- ///
- /// Constructor
- ///
- /// Correctly shaped `Proxy` that represents an `Effect`
- public Effect(Proxy value) =>
- Value = value;
-
- ///
- /// Calling this will effectively cast the sub-type to the base.
- ///
- /// This type wraps up a `Proxy` for convenience, and so it's a `Proxy` proxy. So calling this method
- /// isn't exactly the same as a cast operation, as it unwraps the `Proxy` from within. It has the same effect
- /// however, and removes a level of indirection
- /// A general `Proxy` type from a more specialised type
- [Pure]
- public override Proxy ToProxy() =>
- Value.ToProxy();
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public override Proxy Bind(
- Func> f) =>
- Value.Bind(f);
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Effect Bind(Func> f) =>
- Value.Bind(f).ToEffect();
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Effect Bind(Func> f) =>
- Value.Bind(x => Effect.lift(f(x))).ToEffect();
-
- ///
- /// Lifts a pure function into the `Proxy` domain, causing it to map the bound value within
- ///
- /// The map function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the map operation
- [Pure]
- public override Proxy Map(Func f) =>
- Value.Map(f);
-
- ///
- /// Map the lifted monad
- ///
- /// The map function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the map operation
- [Pure]
- public override Proxy MapM(Func, K> f) =>
- Value.MapM(f);
-
- ///
- /// Extract the lifted IO monad (if there is one)
- ///
- /// The map function
- /// A new `Proxy` that represents the innermost IO monad, if it exists.
- /// `Errors.UnliftIONotSupported` if there's no IO monad in the stack
- [Pure]
- public override Proxy> ToIO() =>
- Value.ToIO();
-
- ///
- /// `For(body)` loops over the `Proxy p` replacing each `yield` with `body`
- ///
- /// Any `yield` found in the `Proxy` will be replaced with this function. It will be composed so
- /// that the value yielded will be passed to the argument of the function. That returns a `Proxy` to continue the
- /// processing of the computation
- /// A new `Proxy` that represents the composition of this `Proxy` and the function provided
- [Pure]
- public override Proxy For(Func> body) =>
- Value.For(body);
-
- ///
- /// Applicative action
- ///
- /// Invokes this `Proxy`, then the `Proxy r`
- ///
- /// `Proxy` to run after this one
- [Pure]
- public override Proxy Action(Proxy r) =>
- Value.Action(r);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- ///
- /// (f +>> p) pairs each 'request' in `this` with a 'respond' in `lhs`.
- ///
- [Pure]
- public override Proxy PairEachRequestWithRespond(
- Func> lhs) =>
- Value.PairEachRequestWithRespond(lhs);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- [Pure]
- public override Proxy ReplaceRequest(
- Func> lhs) =>
- Value.ReplaceRequest(lhs);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- [Pure]
- public override Proxy PairEachRespondWithRequest(
- Func> rhs) =>
- Value.PairEachRespondWithRequest(rhs);
-
- ///
- /// Used by the various composition functions and when composing proxies with the `|` operator. You usually
- /// wouldn't need to call this directly, instead either pipe them using `|` or call `Proxy.compose(lhs, rhs)`
- ///
- [Pure]
- public override Proxy ReplaceRespond(
- Func> rhs) =>
- Value.ReplaceRespond(rhs);
-
- ///
- /// Reverse the arrows of the `Proxy` to find its dual.
- ///
- /// The dual of `this`
- [Pure]
- public override Proxy Reflect() =>
- Value.Reflect();
-
- ///
- ///
- /// Observe(lift (Pure(r))) = Observe(Pure(r))
- /// Observe(lift (m.Bind(f))) = Observe(lift(m.Bind(x => lift(f(x)))))
- ///
- /// This correctness comes at a small cost to performance, so use this function sparingly.
- /// This function is a convenience for low-level pipes implementers. You do not need to
- /// use observe if you stick to the safe API.
- ///
- [Pure]
- public override Proxy Observe() =>
- Value.Observe();
-
- [Pure]
- public void Deconstruct(out Proxy value) =>
- value = Value;
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Effect SelectMany(Func> f, Func project) =>
- Value.Bind(x => f(x).Map(y => project(x, y))).ToEffect();
-
- ///
- /// Monadic bind operation, for chaining `Proxy` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Proxy` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public Effect SelectMany(Func> f, Func project) =>
- SelectMany(a => Effect.liftIO(f(a)), project);
-
- ///
- /// Monadic bind operation, for chaining `Effect` computations together.
- ///
- /// The bind function
- /// The mapped bound value type
- /// A new `Eff` that represents the composition of this `Proxy` and the result of the bind operation
- [Pure]
- public K SelectMany(Func> bind, Func project) =>
- M.Bind(this.RunEffect(), a => M.Map(b => project(a, b), bind(a)));
-
- ///
- /// Chain one effect after another
- ///
- [Pure]
- public static Effect operator &(
- Effect lhs,
- Effect rhs) =>
- lhs.Bind(_ => rhs).ToEffect();
-
- [Pure]
- public override string ToString() =>
- "effect";
-}
diff --git a/LanguageExt.Pipes/Effect/Effect.cs b/LanguageExt.Pipes/Effect/Effect.cs
deleted file mode 100644
index bd591fb27..000000000
--- a/LanguageExt.Pipes/Effect/Effect.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-using System;
-using System.Diagnostics.Contracts;
-using System.Linq;
-using static LanguageExt.Pipes.Proxy;
-using System.Runtime.CompilerServices;
-using LanguageExt.Async.Linq;
-using LanguageExt.Traits;
-
-namespace LanguageExt.Pipes;
-
-///
-/// Effects represent a 'fused' set of producer, pipes, and consumer into one type.
-///
-/// It neither can neither `yield` nor be `awaiting`, it represents an entirely closed effect system.
-///
-///
-/// Upstream | Downstream
-/// +---------+
-/// | |
-/// Void〈== 〈== Unit
-/// | |
-/// Unit ==〉 ==〉Void
-/// | | |
-/// +----|----+
-/// |
-/// A
-///
-public static class Effect
-{
- [Pure]
- public static K RunEffect(this K, R> ma)
- where M : Monad
- {
- return Go(ma.As());
-
- K Go(Proxy p) =>
- p.ToProxy() switch
- {
- ProxyM (var mx) => M.Bind(mx, Go),
- Pure (var r) => M.Pure(r),
- Iterator iter => runIterator(iter, Go),
- IteratorAsync iter => runAsyncIterator(iter, Go),
- Request (var v, _) => closed>(v),
- Respond (var v, _) => closed>(v),
- _ => throw new NotSupportedException()
- };
- }
-
- static K runIterator