Hacker News new | ask | show | jobs
by imoverclocked 931 days ago
Your username matches your comment!

Also, I agree but I'm not sure what I would propose as a better token. Maybe another colon?

def printAndInc(x: Int32): Int32 \ IO =

becomes:

def printAndInc(x: Int32): Int32 : IO =

Or maybe, since functions need something after the \, even for pure functions, we just drop the \ and use the last argument?

def printAndInc(x: Int32): Int32 IO =

1 comments

Why not something human readable? pure vs mut?

Other languages already have readable keywords in the function definition; extends, raises, where, having, Optional, and so on. They don’t feel unnecessarily verbose.

Because they’re working on algebraic effects so obviously IO won’t be the only effect out there. Also because “mut” is even more misleading as it doesn’t capture everything an “IO function” can do, in comparison to a pure function.
”mutates IO”? Anything is better than /{}. I don’t know, maybe one gets accustomed to it after a while? It would be rather verbose to write “returns Foo” everywhere. I’m just looking at this with fresh eyes and this aspect of the language is a token-soup. Other parts look neat though.