3 ms·
What about when writing a function with polymorphic recursion, rank-N types, or the monomorphism restriction? There are plenty of examples where a type declara
by reikonomusha 3y ago
What about when writing a function with polymorphic recursion, rank-N types, or the monomorphism restriction?
There are plenty of examples where a type declaration is required to get functionality, especially when we consider what GHC offers as being "Haskell".
I agree the author could be more clear about this—that Haskell and GHC only sometimes require type annotations in certain circumstances.
- light_hue_1 3y agoTo be clear these are extremely rare circumstances. You virtually never need type annotations. And even in some cases where you used to need them a simple type application is often enough now. You can go an entire career without writing a single type annotation. It depends heavily on what style of Haskell you write.