Hacker News new | past | comments | ask | show | jobs | submit login

> I think compiler implementation is a particular sweetspot for functional languages.

Compilers often use graphs as intermediate representation, and functional languages often are not a good fit for dealing with them.




Modern compilers seem to work with trees more often than graphs. Trees would certainly be easier to work with in any language.

That said, functional languages can and do work with graphs when needed, but yes it is much more awkward than trees.


Not down in the lower levels of IR and IL, the trees have mostly disappeared by then. If you are just interpreting or doing unoptimized compiling, you can get by with just trees.


GHC Haskell does nearly all its optimisation using trees and a high-level functional IR, so I think you are understating trees.


Yes, but I don't think they require a low-level IR in that case (purity, no re-assignment, no loops). LLVM does not use trees at that level, for example, because they really need to use stuff like SSA, basic blocks, and so on.


Tree is also a form of graph


> Compilers often use graphs as intermediate representation, and functional languages often are not a good fit for dealing with them.

Why is that?




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

Search: