Fl4m3Ph03n1x

Fl4m3Ph03n1x

Elixir Witchcraft IO monad?

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?

3 680 1

Marked As Solved

Fl4m3Ph03n1x

Fl4m3Ph03n1x

There has been quite a lengthy discussion in Elixir’s original forum. To summarize:

  • Using witchcraft I would have to create the monad myself, and then use it.
  • Because of the way said Monad would have to be implemented, Dialyzer would not play well.

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.

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.

Popular Backend topics Top

ohm
Does anybody have good learning resources with regards to going into Event Driven Design, Architecture or Sourcing? I got recommended Er...
23 1979 8
New
Fl4m3Ph03n1x
Background I am trying to up my Functional Programming (FP) skills and one of the things that newcomers first learn in FP is the Option T...
12 1139 4
New
JimmyCarterSon
I am confused about the Schema setup, I am setting up a new application and I want to seed files in it as well. I tried to mix to create...
18 1031 7
New
conradwt
Hi, I’m building an application that will have support for both the web and mobile. At this time, I’m using PhxGenAuth for authenticatio...
6 948 1
New
GermaVinsmoke
Does anyone know beginner friendly Elixir/Phoenix Open source projects? For learning purpose :slightly_smiling_face:
4 665 2
New
Manish_bose
Can anyone help me how to convert a long data to wide data in SQL without using hard coding? Regards Manish
7 576 2
New
sona11
If isReachable throws an IOException in Java, what is the right step to do and why? The application, I believe, should halt the process ...
1 560 0
New
Fl4m3Ph03n1x
Background I have a release file inside a tarball. However I want the final release to have some additional files and to move things aro...
2 376 1
New
ogoldberg
Any recommendations on good resources for learning Elixir, Phoenix, and Ash?
29 1155 11
New
jaeyson
Hi! I have clarifications (please correct me, as I mostly mix/confuse this details) with the following: The term RAG here where it read...
1 43 0
New

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
54 3372 17
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
245 5137 101
New
AstonJ
Or looking forward to? :nerd_face:
480 9185 251
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
82 6680 31
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
110 3730 43
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
78 3589 24
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
37 2550 14
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
52 4631 22
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
4 3526 1
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
0 2512 0
New