GHC Language Extensions • Andrew McMiddlin • YOW! 2019

Andrew McMiddlin

Explore the latest GHC language extensions, including syntactic sugar, type variables, and more, and learn how to use them to write more concise and expressive Haskell code.

Key takeaways
  • Syntactic sugar extension: allows for nicer syntax and abstraction in code
  • Type variables: can be scoped to lexical scope using scope pragmas
  • Generalize new type deriving: can derive instances for new types based on existing types
  • Flexible instances: allows for type classes with more than one parameter
  • Multi-way if: allows for more concise if-else statements
  • Type class instances: in Haskell 2010, instance types must have a type constructor
  • Functional dependencies: can express dependent relationships between type variables
  • Record wildcards: allows for pattern matching on record fields without specifying
  • Overloaded strings: allows for using string literals as any type that can be coerced to a string
  • Tuple sections: allows for partially applied tuple constructors
  • Roles: introduced to clarify which type of equality is being used in type class instances
  • Flexible contexts: allows for ambiguous instances, but can lead to inconsistent results
  • Ghci: a way to interact with the Haskell compiler and explore code without compiling it
  • Haskell 2010: defines the standard syntax and semantics of the Haskell language
  • Language pragmas: allow for enabling or disabling language extensions in specific parts of code