Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Haskell.Tools.Refactor.Utils.TypeLookup
Contents
Synopsis
- type ClosedTyFam = CoAxiom Branched
- hasConstraintKind :: Type -> Bool
- lookupTypeFromId :: (HasIdInfo' id, GhcMonad m) => id -> MaybeT m Type
- typeOrKindFromId :: HasIdInfo' id => id -> Type
- typeFromTyThing :: TyThing -> Maybe Type
- lookupTypeFromGlobalName :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m Type
- lookupTypeSynRhs :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m Type
- lookupSynDef :: TyThing -> Maybe TyCon
- tyconFromTyThing :: TyThing -> Maybe TyCon
- tyconFromGHCType :: Type -> Maybe TyCon
- isNewtype :: GhcMonad m => Type -> m Bool
- lookupType :: GhcMonad m => Type -> MaybeT m TyThing
- lookupClassWith :: GhcMonad m => (a -> MaybeT m Name) -> a -> MaybeT m Class
- lookupClass :: (GhcMonad m, HasNameInfo' n) => n -> MaybeT m Class
- lookupClassFromInstance :: GhcMonad m => InstanceHead -> MaybeT m Class
- lookupClassFromDeclHead :: GhcMonad m => DeclHead -> MaybeT m Class
- semanticsTypeSynRhs :: GhcMonad m => Type -> MaybeT m Type
- semanticsType :: GhcMonad m => Type -> MaybeT m Type
- isNewtypeTyCon :: TyThing -> Bool
- satisfies :: (HasNameInfo' n, GhcMonad m) => (TyThing -> Maybe a) -> (a -> Bool) -> n -> MaybeT m Bool
- isClassTyConNameM :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m Bool
- isVanillaDataConNameM :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m Bool
- lookupClosedTyFam :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m ClosedTyFam
- coAxiomFromTyThing :: TyThing -> Maybe (CoAxiom Branched)
- hasTyVarHead :: Type -> Bool
Documentation
type ClosedTyFam = CoAxiom Branched Source #
hasConstraintKind :: Type -> Bool Source #
lookupTypeFromId :: (HasIdInfo' id, GhcMonad m) => id -> MaybeT m Type Source #
Looks up the Type of an entity with an Id of any locality. If the entity being scrutinised is a type variable, it fails.
typeOrKindFromId :: HasIdInfo' id => id -> Type Source #
Looks up the Type or the Kind of an entity that has an Id. Note: In some cases we only get the Kind of the Id (e.g. for type constructors)
lookupTypeFromGlobalName :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m Type Source #
Looks up a GHC Type from a Haskell Tools Name (given the name is global) For an identifier, it returns its type. For a data constructor, it returns its type. For a pattern synonym, it returns its builder's type. For a type synonym constructor, it returns its right-hand side. For a coaxiom, it fails.
lookupTypeSynRhs :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m Type Source #
Looks up the right-hand side (GHC representation) of a Haskell Tools Name corresponding to a type synonym
lookupClassWith :: GhcMonad m => (a -> MaybeT m Name) -> a -> MaybeT m Class Source #
Looks up a GHC.Class from something that has a type class constructor in it Fails if the argument does not contain a class type constructor
lookupClass :: (GhcMonad m, HasNameInfo' n) => n -> MaybeT m Class Source #
lookupClassFromInstance :: GhcMonad m => InstanceHead -> MaybeT m Class Source #
semanticsTypeSynRhs :: GhcMonad m => Type -> MaybeT m Type Source #
Looks up the right-hand side (GHC representation) of a Haskell Tools Type corresponding to a type synonym
semanticsType :: GhcMonad m => Type -> MaybeT m Type Source #
Converts a global Haskell Tools type to a GHC type
isNewtypeTyCon :: TyThing -> Bool Source #
satisfies :: (HasNameInfo' n, GhcMonad m) => (TyThing -> Maybe a) -> (a -> Bool) -> n -> MaybeT m Bool Source #
Looks up the given name, extracts something out of it. If the extraction is not succesful, it returns False, if it is successful, then checks the result against the predicate. The reasoning behind this, is that the predicate can only be satisfied by a proper name.
isClassTyConNameM :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m Bool Source #
Decides whether a given name is a type family constructor. Fails if the lookup is not successful.
isVanillaDataConNameM :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m Bool Source #
Decides whether a given name is a standard Haskell98 data constructor. Fails if the lookup is not successful.
lookupClosedTyFam :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m ClosedTyFam Source #
Looks up a closed type family from a name.
coAxiomFromTyThing :: TyThing -> Maybe (CoAxiom Branched) Source #
Extract the CoAxioms from a TyThing representing a closed type family.
hasTyVarHead :: Type -> Bool Source #
Determines whether a Type itself has a type variable head.