hls-tactics-plugin-1.6.2.0: Wingman plugin for Haskell Language Server
Safe HaskellNone
LanguageHaskell2010

Wingman.GHC

Synopsis

Documentation

isFunction :: Type -> Bool Source #

Is this a function type?

tacticsSplitFunTy :: Type -> ([TyVar], ThetaType, [Scaled Type], Type) Source #

Split a function, also splitting out its quantified variables and theta context.

tacticsThetaTy :: Type -> ThetaType Source #

Rip the theta context out of a regular type.

tacticsGetDataCons :: Type -> Maybe ([DataCon], [Type]) Source #

Get the data cons of a type, if it has any.

freshTyvars :: MonadState TacticState m => Type -> m Type Source #

Instantiate all of the quantified type variables in a type with fresh skolems.

getRecordFields :: ConLike -> Maybe [(OccName, CType)] Source #

Given a datacon, extract its record fields' names and types. Returns nothing if the datacon is not a record.

algebraicTyCon :: Type -> Maybe TyCon Source #

Is this an algebraic type?

eqRdrName :: RdrName -> RdrName -> Bool Source #

We can't compare RdrName for equality directly. Instead, sloppily compare them by their OccNames.

sloppyEqOccName :: OccName -> OccName -> Bool Source #

Compare two OccNames for unqualified equality.

containsHsVar :: Data a => RdrName -> a -> Bool Source #

Does this thing contain any references to HsVars with the given RdrName?

containsHole :: Data a => a -> Bool Source #

Does this thing contain any holes?

isHole :: OccName -> Bool Source #

Check if an OccName is a hole

allOccNames :: Data a => a -> Set OccName Source #

Get all of the referenced occnames.

pattern AMatch :: HsMatchContext (NameOrRdrName (IdP GhcPs)) -> [Pat GhcPs] -> HsExpr GhcPs -> Match GhcPs (LHsExpr GhcPs) Source #

Unpack the relevant parts of a Match

pattern Lambda :: [Pat GhcPs] -> HsExpr GhcPs -> HsExpr GhcPs Source #

A pattern over the otherwise (extremely) messy AST for lambdas.

pattern UnguardedRHSs :: LHsExpr p -> GRHSs p (LHsExpr p) Source #

A GRHS that caontains no guards.

pattern SinglePatMatch :: PatCompattable p => Pat p -> LHsExpr p -> Match p (LHsExpr p) Source #

A match with a single pattern. Case matches are always SinglePatMatches.

unpackMatches :: PatCompattable p => [Match p (LHsExpr p)] -> Maybe [(Pat p, LHsExpr p)] Source #

Helper function for defining the Case pattern.

pattern Case :: PatCompattable p => HsExpr p -> [(Pat p, LHsExpr p)] -> HsExpr p Source #

A pattern over the otherwise (extremely) messy AST for lambdas.

pattern LamCase :: PatCompattable p => [(Pat p, LHsExpr p)] -> HsExpr p Source #

Like Case, but for lambda cases.

lambdaCaseable :: Type -> Maybe Bool Source #

Can ths type be lambda-cased?

Return: Nothing if no Just False if it can't be homomorphic Just True if it can

type PatCompat pass = LPat pass Source #

pattern TopLevelRHS :: OccName -> [PatCompat GhcTc] -> LHsExpr GhcTc -> HsLocalBindsLR GhcTc GhcTc -> Match GhcTc (LHsExpr GhcTc) Source #

Should make sure it's a fun bind

unXPat :: Pat GhcPs -> Pat GhcPs Source #

In GHC 8.8, sometimes patterns are wrapped in XPat. The nitty gritty details are explained at https://blog.shaynefletcher.org/2020/03/ghc-haskell-pats-and-lpats.html

We need to remove these in order to succesfull find patterns.

liftMaybe :: Monad m => Maybe a -> MaybeT m a Source #

typeCheck :: HscEnv -> TcGblEnv -> HsExpr GhcTc -> IO (Maybe Type) Source #

Get the type of an HsExpr GhcTc. This is slow and you should prefer to not use it, but sometimes it can't be helped.

normalizeType :: Context -> Type -> Type Source #

Expand type and data families

expandTyFam :: Context -> Type -> Type Source #

Expand type families

tryUnifyUnivarsButNotSkolems :: Set TyVar -> CType -> CType -> Maybe TCvSubst Source #

Like tcUnifyTy, but takes a list of skolems to prevent unification of.

tryUnifyUnivarsButNotSkolemsMany :: Set TyVar -> [(Type, Type)] -> Maybe TCvSubst Source #

Like tryUnifyUnivarsButNotSkolems, but takes a list of pairs of types to unify.

methodHypothesis :: PredType -> Maybe [HyInfo CType] Source #

Get the class methods of a PredType, correctly dealing with instantiation of quantified class types.