News for hackers. Stuff that matters.
Re:Haskell: The Bad Parts, part 2 (2020) by masklinn on Tuesday February 09, 2021 @11:20AM (#26079289)
> I'm not sure I understand the relationship between partial function and exception handling. Aren't partial functions just curried?

You're thinking "partially applied function", which uses very similar terms but means something completely unrelated.

A partially applied function is a function which is applied to a subset of its formal arguments, yielding a function taking the leftover arguments.

A partial function is contrasted with a total function and the term is about the relation between inputs and outputs, namely does every possible input value yield an output. The example of `first` used in the essay is pretty common because it's quite clear: given `first :: [a] -> a`, what happens if you call `first` with an empty list? Well it can't succeed, it can't just give you an `a` out of nowhere because it doesn't have anything to do that. So despite an empty array being a possible input value, there is no output for it: it is a partial function, it only partially maps its inputs to its outputs.

`first :: [a] -> Maybe a` would be total: in the case of an empty input it returns `None`, otherwise it returns `Some a`.

Re:Haskell: The Bad Parts, part 2 (2020) by Serow225 on Tuesday February 09, 2021 @01:01PM (#26080580)
Ah thanks, I'm used to this being called a "complete function".
Re:Haskell: The Bad Parts, part 2 (2020) by yjh0502 on Tuesday February 09, 2021 @12:25PM (#26080165)
`Just a` / `Nothing` in case of Haskell :)