Skip to content
  • Matthías Páll Gissurarson's avatar
    Add HoleFitPlugins and RawHoleFits · c311277b
    Matthías Páll Gissurarson authored
    This patch adds a new kind of plugin, Hole fit plugins. These plugins
    can change what candidates are considered when looking for valid hole
    fits, and add hole fits of their own. The type of a plugin is relatively
    simple,
    
    ```
    type FitPlugin = TypedHole -> [HoleFit] -> TcM [HoleFit]
    type CandPlugin = TypedHole -> [HoleFitCandidate] -> TcM [HoleFitCandidate]
    data HoleFitPlugin = HoleFitPlugin { candPlugin :: CandPlugin
                                       , fitPlugin :: FitPlugin }
    
    data TypedHole = TyH { 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.
                         }
    
    This allows users and plugin writers to interact with the candidates and
    fits as th...
    c311277b