Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free monad with trampoline #437

Open
padzikm opened this issue May 2, 2021 · 3 comments
Open

Free monad with trampoline #437

padzikm opened this issue May 2, 2021 · 3 comments

Comments

@padzikm
Copy link

padzikm commented May 2, 2021

Hi, are there any plans to add trampoline to this library? free monad with trampoline would be great to use in safe stack manner - currently free monad is not stack safe

@gusty
Copy link
Member

gusty commented May 3, 2021

There are no concrete plans, but we're open, if you can add more details and draft a concrete proposals we can consider it.

@padzikm
Copy link
Author

padzikm commented May 3, 2021

I'll play around with that and maybe be able to help. Scala's cats looks like a nice source of inspiration - https://github.com/typelevel/cats/blob/main/free/src/main/scala/cats/free/Free.scala Furhermore it would be greate to be able to easily combine coproducts without manually getting into details like in https://underscore.io/blog/posts/2017/03/29/free-inject.html.
Btw why free monads are so marginal in f#? I've seen couple mentions of 'do not use them in .net' and 'they are close to be considered as antipattern'. Honestly with help from f#+ library it looks quite easy and I think we should encourage other developers to learn free and let them see if it can help and not scaring them away at the start

@voronoipotato
Copy link

I think it's that free monads are powerful enough that people will reach for the pattern when some functions and DU will do. I've seen the same critique of free monad use even within haskell blogs. You can write nearly anything in terms of a Free monad, but you probably shouldn't as they will be slower and more complex. Being said I think F#+ is the exact space where support the free monad could be valuable. I'm less worried about people using it as a "golden hammer" as the terser syntax in F#+ operators implies that users have a degree of comfort with FP patterns and it will be easier for people to use where it makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants