It could be argued that programs and ideas built up through the machinery of mathematics are unpatentable, whereas programs and ideas built through the machinery of engineering are.
The law may ignore the actual content in favor of looking at the mechanism of discovery and/or usage.
There is a profound philosophical disconnect between the (well-meaning) author of the Haskell and the way the law works.
There is a whole body of thought regarding dealing with humans that plays out in the law: mathematical approaches to law do not regard that and tend to fail.
It could be argued that programs and ideas built up through the machinery of mathematics are unpatentable, whereas programs and ideas built through the machinery of engineering are.
The law may ignore the actual content in favor of looking at the mechanism of discovery and/or usage.