3 ms·
That's all well and good with a trivial function like foo :: (a,b) -> a, but for most non-trivial functions it won't be so obvious, and that's exactly when it's
by jlarocco 13y ago
That's all well and good with a trivial function like foo :: (a,b) -> a, but for most non-trivial functions it won't be so obvious, and that's exactly when it's most helpful to know what's going on.
- nightski 13y agoa.) Many functions in Haskell are this trivial. map, fold, etc... b.) Functions that are non-trivial will have additional constraints often hinting exactly at what the function does. Most important is not the fact that you can write poor Haskell code which does not exibit this self-documenting behavior, but rather that if you choose to exploit the type system it has the expressiveness to allow you to do so! (and enforce it) If you are working with a Haskell library and see a function with the signature (IO Int) you may start to question your choice of library :) The only problem is, once you get a taste of this power it is easy to yearn for even more such as dependent types (i.e. Agda, Idris...)