Hacker News new | ask | show | jobs
by yjgyhj 3307 days ago
After being Clojure-only for a long time, I decided to write the front end to my last project in Elm, just to see what the fuzz was about.

While I miss code-is-data very much, there is no turning back from the type system and how there are no unpure functions. It is just so mind-blowingly easy to catch almost every bug I would usually write.

I'm afraid this is the point where I should try Haskell, and be unsatisfied for the rest of my professional life.

3 comments

You should definitely try, even if you end up being somewhat unsatisfied every time you have to use something else.

When I write code in Haskell, it feels right, just like when I discovered Lisp. Only better. And oh, the purity! Not only in the mathematical sense, even the code is completely deprived of clutter.

But at what cost!? Every time I write Haskell code it reads like a mathematical proof that's beyond my ability to comprehend! Whereas my Ruby, Python, and Clojure programs read like a poem I might have written in third grade.
I don't think Haskell code looks like this. You don't have to use all the guru syntactic sugar; the library functions usually have pretty explicit names, and yours should have to.
I'm a ruby developer by day and, to me, OCaml-like languages like Elm and F# are better rubies. The language remains as concise and crisp as ruby, the algebraic data types help me more precisely formulate the logic for the app, and the static types remove a whole class of errors and makes refactoring much easier.

As an aside, I have a theory that Elm is a gateway drug to Haskell. Next stop, purescript?

> While I miss code-is-data very much

FWIW, Elixir has this (and is possibly the only non-homoiconic language to implement "true" macros)

Opt-in typing, though.

Regarding Elm, I love that runtime errors are considered compiler bugs.

Nim and Scala are not homoiconic, yet they both have true macros
Nim's macros look harder to use, with a fairly custom DSL in the AST (instead of, say, a simple datastructure like a nested map). I don't think you can pattern-match on AST fragments, either, like you can in Elixir.

Scala macros cannot change its syntax, Elixir macros can I believe (to some extent).

The AST of Nim is a simple tree, the only thing is that the nodes of this tree are tagged with a kind that represents the kind of syntactic element, since the language is not homoiconic
Dylan?
After reviewing Dylan's, it doesn't seem as powerful. And it's unclear how it handles runtime variables passed within code snippets to macros (Elixir has "unquote" for this)