Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> ...case being just another function, and the pipe operator always chaining by the first argument.

Interesting! I thought Elixir was mostly macros all the way down, like this article shows:

https://evuez.net/posts/cursed-elixir.html

Being able to pipe into def, defp, defmodule, if, etc. is fantastic! But apparently you say at least in the case of case, it's not a macro, and it's just a function which returns a monad—I guess it's the same effect afterall? Is that why people say Haskell can get away with lack of Lisp-style macros because of its type system and laziness?



I was wrong about this. Case is a macro (a special-cased macro even, defined at https://github.com/elixir-lang/elixir/blob/4def31f8abea5fba4...), not a function. It works with pipes because in the AST it's a call, unlike in Haskell where case is its own thing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: