Skip to content

Higher-Kinded Types in Algebraic Free Monads with language-ext? #1332

Answered by louthy
kikkoi asked this question in Q&A
Discussion options

You must be logged in to vote

They're not written up yet because I haven't done the full release. But the documentation is coming soon as well as a blog article on my blog. The API for the Free monad is also quite minimal right now, it may well expand to make it easier to use. However, it's not really high up my list right now.

But, here's a quick example...

Obviously, the point of free monads is to give you a monad for free from a Functor and so first I'll define an ADT and make a functor for it.

public abstract record Op<A> : K<Op, A>;
public record ReadLinesOp<A>(string Path, Func<Seq<string>, A> Next): Op<A>;
public record WriteLinesOp<A>(string Path, Seq<string> Lines, Func<Unit, A> Next) : Op<A>;

The ADT is a si…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kikkoi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #1331 on May 24, 2024 10:21.