Which Haskell (GHC) extensions should users use/avoid?

后端 未结 1 1144
半阙折子戏
半阙折子戏 2020-12-04 06:17

I have had the experience a few times now of having GHC tell me to use an extension, only to discover that when in using that extension I have made code far more complex whe

相关标签:
1条回答
  • 2020-12-04 06:49

    An ad hoc list of morally "good" extensions, and morally "bad" ones - this is an aesthetic judgement!

    The Good

    • GADTs
    • Parallel list comprehensions
    • Pattern guards
    • Monad comprehensions
    • Tuple sections
    • Record wild cards
    • Empty data decls
    • Existential types
    • Generalized new type deriving
    • MPTCs + FDs
    • Type families
    • Explicit quantification
    • Higher rank polymorphism
    • Lexically scoped tyvars
    • Bang Patterns

    The Bad

    • SQL comprehensions
    • Implicit parameters

    The Ugly (but necessary)

    • Template Haskell
    • Unboxed types and tuples
    • Undecidable, overlapping and incoherent instances -- usually means you have a misdesign.

    Not sure

    • Arrow notation
    • View patterns
    0 讨论(0)
提交回复
热议问题