5 ms·
Monads in Elixir
- kaeluka 11y agoThis is an example where you'd really want static types for ergonomics. Having to name the monad explicitly does not allow to write generic code (i.e, instead of saying `Maybe.return` to just say `return).
- LesZedCB 11y agoYes, in writing ruby during my day job, I often have conflicting feelings about dynamic typing. The other advantage would be being able to do real static analysis, I would love that.
- rozap 11y agoIn Elixir you can annotate functions with type signatures and then use a tool like Dialyzer(1) to perform static analysis on the compiled bytecode. There is tooling that integrates with mix in Elixir called which makes this easy(2) 1) http://www.erlang.org/doc/apps/dialyzer/dialyzer_chapter.html http://www.erlang.org/doc/apps/dialyzer/dialyzer_chapter.htm... 2) https://github.com/jeremyjh/dialyxir https://github.com/jeremyjh/dialyxir
- deleted 11y ago[deleted]
- pbowyer 11y ago> This post is not about what monads are, I expect that you already know about them. And a good resource if you don't would be..? I enjoyed watching [1] last week so I suspect I have seen the concept, even if I don't grasp what's meant by a monad. 1. https://vimeo.com/113707214 https://vimeo.com/113707214
- jameskilton 11y agoThis talk is so far the best at explaining what Monads are for me: https://www.youtube.com/watch?v=J1jYlPtkrqQ https://www.youtube.com/watch?v=J1jYlPtkrqQ (Tom Stuart: Refactoring Ruby with Monads)
- smosher_ 11y agoPhilip Wadler's paper Monads for functional programming is the first thing I read that made any sense. FYI this is the horse's mouth.
- zabi_rauf 11y agoI've seen the same video before i knew what a monad was, it helped me in understanding the use case of monad and ultimately monad. Monad is just a generalization of that particular use case. Some resources that helped me in understanding monads 1. Brian Beckman: Don't fear the Monad - https://www.youtube.com/watch?v=ZhuHCtR3xq8&feature=share https://www.youtube.com/watch?v=ZhuHCtR3xq8&feature=share 2. Functors, Applicatives, And Monads In Pictures - http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html http://adit.io/posts/2013-04-17-functors,_applicatives,_and_... 3. Three Useful Monads - http://adit.io/posts/2013-06-10-three-useful-monads.html http://adit.io/posts/2013-06-10-three-useful-monads.html So its been not just one resource but multiple resource before it hit me that it was such a simple concept. So i would suggest to go over them (in order) and also look at other resources (mentioned by others).
- MCRed 11y agoOMG, the famous Abbot and Costello "Who's on First" skit is replayed in that vimeo talk (from NDC) about Monads. Love it. But it's a good video, thanks.