“Requires” in that the compiler rejects functions that don’t handle all constructors of their input types. For example this doesn’t compile:
f [x] = x
…it leads to the compilation error This pattern does not cover all possible inputs.
Haskell, on the other hand, would be okay with this (though it would give a warning). And PureScript would compile it but annotate its type as Partial.
“Elm requires functions to be total”
“Requires” in the sense that it’s culturally encouraged? Or did Elm get a totality checker since I last looked?
“Requires” in that the compiler rejects functions that don’t handle all constructors of their input types. For example this doesn’t compile:
…it leads to the compilation error
This pattern does not cover all possible inputs.Haskell, on the other hand, would be okay with this (though it would give a warning). And PureScript would compile it but annotate its type as
Partial.