evoke-0.2023.1.26: A GHC plugin to derive instances.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Evoke

Synopsis

Documentation

plugin :: Plugin Source #

The compiler plugin. You can enable this plugin with the following pragma:

{-# OPTIONS_GHC -fplugin=Evoke #-}

This plugin accepts some options. Pass -fplugin-opt=Evoke:--help to see what they are. For example:

{-# OPTIONS_GHC -fplugin=Evoke -fplugin-opt=Evoke:--help #-}

Once this plugin is enabled, you can use it by deriving instances like this:

data Person = Person
  { name :: String
  , age :: Int
  } deriving ToJSON via "Evoke"

The GHC user's guide has more detail about compiler plugins in general: https://downloads.haskell.org/ghc/9.2.4/docs/html/users_guide/extending_ghc.html#compiler-plugins.