Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- tcTyVar_maybe :: Type -> Maybe Var
- instantiateType :: Type -> ([TyVar], Type)
- cloneTyVar :: TyVar -> TyVar
- isFunction :: Type -> Bool
- tacticsSplitFunTy :: Type -> ([TyVar], ThetaType, [Scaled Type], Type)
- tacticsThetaTy :: Type -> ThetaType
- tacticsGetDataCons :: Type -> Maybe ([DataCon], [Type])
- freshTyvars :: MonadState TacticState m => Type -> m Type
- getRecordFields :: ConLike -> Maybe [(OccName, CType)]
- algebraicTyCon :: Type -> Maybe TyCon
- eqRdrName :: RdrName -> RdrName -> Bool
- sloppyEqOccName :: OccName -> OccName -> Bool
- containsHsVar :: Data a => RdrName -> a -> Bool
- containsHole :: Data a => a -> Bool
- isHole :: OccName -> Bool
- allOccNames :: Data a => a -> Set OccName
- pattern AMatch :: HsMatchContext (NameOrRdrName (IdP GhcPs)) -> [Pat GhcPs] -> HsExpr GhcPs -> Match GhcPs (LHsExpr GhcPs)
- pattern SingleLet :: IdP GhcPs -> [Pat GhcPs] -> HsExpr GhcPs -> HsExpr GhcPs -> HsExpr GhcPs
- pattern Lambda :: [Pat GhcPs] -> HsExpr GhcPs -> HsExpr GhcPs
- pattern UnguardedRHSs :: LHsExpr p -> GRHSs p (LHsExpr p)
- pattern SinglePatMatch :: PatCompattable p => Pat p -> LHsExpr p -> Match p (LHsExpr p)
- unpackMatches :: PatCompattable p => [Match p (LHsExpr p)] -> Maybe [(Pat p, LHsExpr p)]
- pattern Case :: PatCompattable p => HsExpr p -> [(Pat p, LHsExpr p)] -> HsExpr p
- pattern LamCase :: PatCompattable p => [(Pat p, LHsExpr p)] -> HsExpr p
- lambdaCaseable :: Type -> Maybe Bool
- class PatCompattable p where
- fromPatCompat :: PatCompat p -> Pat p
- toPatCompat :: Pat p -> PatCompat p
- type PatCompat pass = LPat pass
- pattern TopLevelRHS :: OccName -> [PatCompat GhcTc] -> LHsExpr GhcTc -> HsLocalBindsLR GhcTc GhcTc -> Match GhcTc (LHsExpr GhcTc)
- unXPat :: Pat GhcPs -> Pat GhcPs
- liftMaybe :: Monad m => Maybe a -> MaybeT m a
- typeCheck :: HscEnv -> TcGblEnv -> HsExpr GhcTc -> IO (Maybe Type)
- normalizeType :: Context -> Type -> Type
- expandTyFam :: Context -> Type -> Type
- tryUnifyUnivarsButNotSkolems :: Set TyVar -> CType -> CType -> Maybe TCvSubst
- tryUnifyUnivarsButNotSkolemsMany :: Set TyVar -> [(Type, Type)] -> Maybe TCvSubst
- updateSubst :: TCvSubst -> TacticState -> TacticState
- methodHypothesis :: PredType -> Maybe [HyInfo CType]
Documentation
cloneTyVar :: TyVar -> TyVar Source #
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.
sloppyEqOccName :: OccName -> OccName -> Bool Source #
Compare two OccName
s for unqualified equality.
containsHole :: Data a => a -> Bool Source #
Does this thing contain any holes?
pattern AMatch :: HsMatchContext (NameOrRdrName (IdP GhcPs)) -> [Pat GhcPs] -> HsExpr GhcPs -> Match GhcPs (LHsExpr GhcPs) Source #
Unpack the relevant parts of a Match
pattern SingleLet :: IdP GhcPs -> [Pat GhcPs] -> HsExpr GhcPs -> HsExpr GhcPs -> HsExpr GhcPs Source #
pattern Lambda :: [Pat GhcPs] -> HsExpr GhcPs -> HsExpr GhcPs Source #
A pattern over the otherwise (extremely) messy AST for lambdas.
pattern SinglePatMatch :: PatCompattable p => Pat p -> LHsExpr p -> Match p (LHsExpr p) Source #
A match with a single pattern. Case matches are always SinglePatMatch
es.
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
class PatCompattable p where Source #
fromPatCompat :: PatCompat p -> Pat p Source #
toPatCompat :: Pat p -> PatCompat p Source #
Instances
PatCompattable GhcPs Source # | |
Defined in Wingman.GHC | |
PatCompattable GhcTc Source # | |
Defined in Wingman.GHC |
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.
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.
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.
updateSubst :: TCvSubst -> TacticState -> TacticState Source #