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

I've heard this called "unit typed" (see the Wikipedia page of this name), I think unitype may be incorrect.

i.e. Haskell includes the unit type ()



Haskell's unit type is what other languages call "void", the type with exactly one value (not counting 'undefined', Haskell's dirty little not-secret). That's different from Unitype/Any, the type that contains all values.

Bob Harper uses "unitype" which is a pretty strong argument for the name's validity


> not counting 'undefined', Haskell's dirty little not-secret

There is no "undefined" value in pure Haskell. There are expressions that have no value, due to a runtime exception (error, undefined, division by zero, memory allocation failure) or non-termination (unbounded recursion). Either way, evaluating the expression does not produce a value for the remainder of the program to operate on—you can't write a (pure) program like `if isUndefined expr then x else y` since—assuming isUndefined is a pure function and doesn't ignore its argument—the whole program is undefined if expr is undefined.




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

Search: