巫术io monad?
背景
我最近深入研究了更多功能代码。我现在的目标是获得类似于IO Monad(在Haskell,Scala等)的东西,但在长生不老药中。
在这个程度上,我理解 witchcraft 理论上应该是能够做到这一点的。
然而,疑问
,在阅读了他们的文档后,我有一些问题:
- 我无法找到IO Monad的明确示例。我有一个想法,我必须使用其中一个子图书馆来创建单调,但我并不100%确定这一点。
- 我不确定Dialzyer是否对巫术效果很好,并且是否可以检测到我的代码不正确的问题(如Scala编译器一样)。
有人可以帮我回答这些问题吗?
Background
I have recently been delving into more functional code. My objective right now is to get something similar to the IO Monad (in Haskell, Scala, etc) but in Elixir.
To this extent, I understand Witchcraft should be in theory capable of doing it.
Doubts
However, after reading through their documentation I have some questions:
- I was not able to find a clear-cut example of the IO Monad. I have the idea what I have to create Monads myself using one of the sub-libraries, but I am not 100% sure of this.
- I am not sure if Dialzyer plays nice with Witchcraft and if it can detect issues if my code is incorrect (like Scala compiler does).
Could someone help me answer these questions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Elixir的原始论坛上进行了很长时间的讨论。总结:
https://elixirforum.com/t/witchcraft-to-get-get-get-something-similar-the-io-the-io-monad-in-haskell-scala-scala-scala-scala-etc-etc-tc-but-in-elixir/ 48710/12
但是还有更多要说的。 io monad(我们所知和爱)更多的是 haskell的工作原理。其主要目的是获得正确的动作顺序,以默认情况下懒惰地评估的语言。
另一侧的长生不老药是默认情况下热切地评估的。 Because of this, 与IO Monad相比,代数效应可能更有意义,更有用户友好。
最后但并非最不重要的一点是,在撰写本文时,我等待了将近20天的人,让一个人在巫术的Github存储库中回复。不幸的是,没有人回答,这使我相信该项目处于困境,仅获得最少的支持。
https://github.com/witchcrafters/witchcrafters/witchcrafters/witchcraft/witchcraft/issues/issues/121 我必须努力将巫术整合到我的任何项目中,我个人觉得这不是一个明智的决定。这不是“如果我最终需要使用图书馆的帮助”,而是“何时”的问题。
问题得到了回答,我希望提供的其他见解可以对某人使用。
There has been quite a lengthy discussion in Elixir's original forum. To summarize:
https://elixirforum.com/t/witchcraft-to-get-something-similar-to-the-io-monad-in-haskell-scala-etc-but-in-elixir/48710/12
However there is more to be said. The IO Monad (as we know and love) is more of a consequence of how Haskell works. Its main purpose is to get the correct sequence of actions to perform on a language that is lazily evaluated by default.
Elixir, on the other side, is eagerly evaluated by default. Because of this, algebraic effects could potentially make more sense and be more user friendly in comparison to IO Monads.
Last but not least, at the time of this writing, I waited almost 20 days for a human to reply in the Witchcraft's GitHub repository. Unfortunately, no one replied, which leads me to believe the project is in a limbo, receiving minimal support only.
https://github.com/witchcrafters/witchcraft/issues/121
Given the huge effort I would have to undergo to integrate Witchcraft into any of my projects, I personally feel like this would not be a wise decision. It's not a matter of "if I will eventually need help using the library", it is a matter of "when".
The questions are answered, and I hope the additional insight provided can be of use to someone.