haskell-tools-refactor-1.0.1.2: Refactoring Tool for Haskell

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.Refactor.Utils.TypeLookup

Synopsis

Documentation

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)

typeFromTyThing :: TyThing -> Maybe Type Source #

Extracts a Type from a TyThing when possible.

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

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

nameFromType :: Type -> Maybe Name Source #

Extracts the name of a type In case of a type application, it finds the type being applied

isVanillaDataConNameM :: (HasNameInfo' n, GhcMonad m) => n -> MaybeT m Bool Source #

Decides whether a given name is a standard Haskell98 data constructor. Fails if not given a proper name.