DEV Community

Yufan Lou
Yufan Lou

Posted on

Template Haskell vs GHC.Generic

WARNING: This is not from experience, all hearsay.

Template Haskell

Pros

  • Relatively fast compile time
  • Guaranteed no runtime overhead

Cons

  • Source order dependent
  • Weakly typed (AST to AST)

GHC.Generic

Pros

  • Source order independent like all other Haskell source
  • Strongly typed

Cons

  • Slow compile time
  • May not be fully optimized away

Discussion (0)