TcHoleFitTypes

ghc-8.10.4: The GHC API

Safe Haskell | None
Language | Haskell2010

TcHoleFitTypes

Synopsis

- data TypedHole = TyH {
  - tyHRelevantCts :: Cts
  - tyHImplics :: [Implication]
  - tyHCt :: Maybe Ct
  }
- data HoleFit
  - = HoleFit {
    - hfId :: Id
    - hfCand :: HoleFitCandidate
    - hfType :: TcType
    - hfRefLvl :: Int
    - hfWrap :: [TcType]
    - hfMatches :: [TcType]
    - hfDoc :: Maybe HsDocString
    }
  - | RawHoleFit SDoc
- data HoleFitCandidate
  - = IdHFCand Id
  - | NameHFCand Name
  - | GreHFCand GlobalRdrElt
- type CandPlugin = TypedHole -> [HoleFitCandidate] -> TcM [HoleFitCandidate]
- type FitPlugin = TypedHole -> [HoleFit] -> TcM [HoleFit]
- data HoleFitPlugin = HoleFitPlugin {
  - candPlugin :: CandPlugin
  - fitPlugin :: FitPlugin
  }
- data HoleFitPluginR = forall s. HoleFitPluginR {
  - hfPluginInit :: TcM (TcRef s)
  - hfPluginRun :: TcRef s -> HoleFitPlugin
  - hfPluginStop :: TcRef s -> TcM ()
  }
- hfIsLcl :: HoleFit -> Bool
- pprHoleFitCand :: HoleFitCandidate -> SDoc

# Documentation

data TypedHole Source #

Constructors

TyH |
Fields tyHRelevantCts :: Cts Any relevant Cts to the hole tyHImplics :: [Implication] The nested implications of the hole with the innermost implication first. tyHCt :: Maybe Ct The hole constraint itself, if available.

#### Instances

Instances details

Outputable TypedHole # |
Instance details Defined in TcHoleFitTypes Methods ppr :: TypedHole -> SDoc Source # pprPrec :: Rational -> TypedHole -> SDoc Source #

data HoleFit Source #

HoleFit is the type we use for valid hole fits. It contains the element that was checked, the Id of that element as found by `tcLookup`, and the refinement level of the fit, which is the number of extra argument holes that this fit uses (e.g. if hfRefLvl is 2, the fit is for `Id _ _`).

Constructors

HoleFit |
Fields hfId :: Id The elements id in the TcM hfCand :: HoleFitCandidate The candidate that was checked. hfType :: TcType The type of the id, possibly zonked. hfRefLvl :: Int The number of holes in this fit. hfWrap :: [TcType] The wrapper for the match. hfMatches :: [TcType] What the refinement variables got matched with, if anything hfDoc :: Maybe HsDocString Documentation of this HoleFit, if available.
RawHoleFit SDoc | A fit that is just displayed as is. Here so thatHoleFitPlugins can inject any fit they want.

#### Instances

Instances details

Eq HoleFit # |
Instance details Defined in TcHoleFitTypes Methods (==) :: HoleFit -> HoleFit -> Bool # (/=) :: HoleFit -> HoleFit -> Bool #
Ord HoleFit # |
Instance details Defined in TcHoleFitTypes Methods compare :: HoleFit -> HoleFit -> Ordering # (<) :: HoleFit -> HoleFit -> Bool # (<=) :: HoleFit -> HoleFit -> Bool # (>) :: HoleFit -> HoleFit -> Bool # (>=) :: HoleFit -> HoleFit -> Bool # max :: HoleFit -> HoleFit -> HoleFit # min :: HoleFit -> HoleFit -> HoleFit #
Outputable HoleFit # |
Instance details Defined in TcHoleFitTypes Methods ppr :: HoleFit -> SDoc Source # pprPrec :: Rational -> HoleFit -> SDoc Source #

data HoleFitCandidate Source #

HoleFitCandidates are passed to hole fit plugins and then checked whether they fit a given typed-hole.

Constructors

IdHFCand Id |
NameHFCand Name |
GreHFCand GlobalRdrElt |

#### Instances

Instances details

Eq HoleFitCandidate # |
Instance details Defined in TcHoleFitTypes Methods (==) :: HoleFitCandidate -> HoleFitCandidate -> Bool # (/=) :: HoleFitCandidate -> HoleFitCandidate -> Bool #
Ord HoleFitCandidate # |
Instance details Defined in TcHoleFitTypes Methods compare :: HoleFitCandidate -> HoleFitCandidate -> Ordering # (<) :: HoleFitCandidate -> HoleFitCandidate -> Bool # (<=) :: HoleFitCandidate -> HoleFitCandidate -> Bool # (>) :: HoleFitCandidate -> HoleFitCandidate -> Bool # (>=) :: HoleFitCandidate -> HoleFitCandidate -> Bool # max :: HoleFitCandidate -> HoleFitCandidate -> HoleFitCandidate # min :: HoleFitCandidate -> HoleFitCandidate -> HoleFitCandidate #
Outputable HoleFitCandidate # |
Instance details Defined in TcHoleFitTypes Methods ppr :: HoleFitCandidate -> SDoc Source # pprPrec :: Rational -> HoleFitCandidate -> SDoc Source #
HasOccName HoleFitCandidate # |
Instance details Defined in TcHoleFitTypes Methods occName :: HoleFitCandidate -> OccName Source #
NamedThing HoleFitCandidate # |
Instance details Defined in TcHoleFitTypes Methods getOccName :: HoleFitCandidate -> OccName Source # getName :: HoleFitCandidate -> Name Source #

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

forall s. 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

hfIsLcl :: HoleFit -> Bool Source #

pprHoleFitCand :: HoleFitCandidate -> SDoc Source #