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

>The set of all possible assembly instructions is bigger than the set of all possible assembly instructions that haskell can compile to.

No it's not. The Haskell compiler is free to use whatever assembly instructions that it sees fit to compile the Haskell program.

Maybe you mean that effectively, the set of assembly programs (i.e. sequences of assembly instructions) which existing Haskell compilers happen to produce is limited. This is true. But it is also true that you can find an equivalent Haskell program for every possible assembly program, where equivalent means they exhibit the same behavior with respect to inputs and outputs. This is because both are Turing equivalent.

Now, it's also true that the way two equivalent programs get to their results may differ. For example, the assembly program might be faster. However, these are non-functional properties of the programs. And you were talking explicitly about functionality, so this point doesn't count towards your argument.



My mistake, I shouldn't have used the word "functionality" so I concede. And yes, I meant sets of assembly instructions, thanks for the correction.

But this is the basic idea I was trying to convey: that you lose "expressiveness" as you get higher and higher in levels of abstraction.


you are mistaking the meaning of expressiveness I'll provide a short example in assembler vs haskell expressive power. I'll use hello world as an example. This is considers an amd64 compatible processor, because I have to know the names of the registers.

```asm section .data str: db 'Hello world!', 0Ah str_len: equ $ - str

section .text global _start

_start: mov eax, 4 mov ebx, 1 mov ecx, str mov edx, str_len int 80h mov eax, 1 mov ebx, 0 int 80h ```

In Haskell I don't have to consider any processor.

```hs main = putStr "Hello World" ```

expressiveness is about how much code you need for a certain behavior. It's not about how many (possible fucked up) source files my compiler accepts.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: