Getting Help from Type Holes
Throughout this chapter, we’ve put types and type annotations at the forefront of our examples. Adding explicit type annotations to all our let and where has been helpful as a learning exercise, but it’s not a common style in real-world applications. Most Haskell code you’ll see in the wild will include explicit type-level annotations for top-level bindings, but it’s common to leave off the annotations inside of a function body and instead rely on type inference.
Omitting the type annotations inside of a function offers some substantial benefits. First, it means that we don’t have to spend time updating type annotations when we’re refactoring our code. In a larger code base this can be a substantial win for refactoring ...
Get Effective Haskell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.