3 ms·
The "right" way for division by zero is controversial, though maybe that would be a solution. It's clearer for partial function "head :: [a] -> a", which takes
by the_af 6y ago
The "right" way for division by zero is controversial, though maybe that would be a solution.
It's clearer for partial function "head :: [a] -> a", which takes the first of a list if it exists, and explodes without dignity if the list is empty (this is what makes head partial).
A proposal is "head :: [a] -> Maybe a", so head returns Nothing when the list is empty.
- cies 6y agoIdris does well here: https://www.idris-lang.org/docs/current/prelude_doc/docs/Prelude.List.html#Prelude.List.head https://www.idris-lang.org/docs/current/prelude_doc/docs/Pre...'