GHC.Tc.Errors.Hole.Plugin

ghc-9.10.0.20240413: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Tc.Errors.Hole.Plugin

Synopsis

- type CandPlugin = TypedHole -> [HoleFitCandidate] -> TcM [HoleFitCandidate]
- type FitPlugin = TypedHole -> [HoleFit] -> TcM [HoleFit]
- data HoleFitPlugin = HoleFitPlugin {
  - candPlugin :: CandPlugin
  - fitPlugin :: FitPlugin
  }
- data HoleFitPluginR = HoleFitPluginR {
  - hfPluginInit :: TcM (TcRef s)
  - hfPluginRun :: TcRef s -> HoleFitPlugin
  - hfPluginStop :: TcRef s -> TcM ()
  }

# Documentation

type CandPlugin = TypedHole -> [HoleFitCandidate] -> TcM [HoleFitCandidate] Source #

A plugin for modifying the candidate hole fits *before* they're checked.

type FitPlugin = TypedHole -> [HoleFit] -> TcM [HoleFit] Source #

A plugin for modifying hole fits *after* they've been found.

data HoleFitPlugin Source #

A HoleFitPlugin is a pair of candidate and fit plugins.

Constructors

HoleFitPlugin |
Fields candPlugin :: CandPlugin fitPlugin :: FitPlugin

data HoleFitPluginR Source #

HoleFitPluginR adds a TcRef to hole fit plugins so that plugins can track internal state. Note the existential quantification, ensuring that the state cannot be modified from outside the plugin.

Constructors

HoleFitPluginR |
Fields hfPluginInit :: TcM (TcRef s) Initializes the TcRef to be passed to the plugin hfPluginRun :: TcRef s -> HoleFitPlugin The function defining the plugin itself hfPluginStop :: TcRef s -> TcM () Cleanup of state, guaranteed to be called even on error