Remix.run Logo
▲ tliltocatl a day ago

Not an expert, but doesn't HCC (and pure functional programming in general) have an issue of being insensitive to time/space complexity? Space complexity is basically hopeless because functional programming doesn't really have a notion of "memory space" (see also: haskell infamous "quicksort" example). Time isn't as bad in general (well, list access is O(n) but you can make it O(log(n)) with a trivial transformation) but still irrelevant for HCC. Since you don't have to execute a proof to check it, a galactic algorithm is still a valid proof. And a complexity-sensitive type system is still and open problem. So proofs and algorithms are isomorphic, proofs and practical algorithms aren't necessarily so.

▲nagaiaida a day ago | parent | next [-]

the practical ones are equally as related to proofs as the impractical ones are, so you probably meant to phrase your last sentence differently at the very least

▲seeknotfind a day ago | parent | prev [-]

No, they don't have this issue. Space and time complexity apply to functional programming exactly the same as normal programming.

▲tliltocatl 21 hours ago | parent [-]

Then why does Haskell needs ST monad?

▲seeknotfind 12 hours ago | parent [-]

The short answer is because the runtime is not clever enough. The ability to do asymptotic complexity analysis and specific complexity classes are mathematical properties of code, with properties you can study such as what reductions are possible between algorithms or methods of computation. None of these have to do with runtime performance gains for specific algorithms, which is what ST monad gives you. On von neumonn architecture computers, ST monad is just more performant and convenient than writing the same code with the State monad equivalent. The asymptotic complexity can be studied as the same, perhaps within a reduction factor on any model of computation.