| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Language.Futhark.Query
Description
Facilities for answering queries about a program, such as "what appears at this source location", or "where is this name bound". The intent is that this is used as a building block for IDE-like functionality.
Synopsis
- data BoundTo
- boundLoc :: BoundTo -> Loc
- data AtPos = AtName (QualName VName) (Maybe BoundTo) Loc
- atPos :: Imports -> Pos -> Maybe AtPos
- data Pos = Pos !FilePath !Int !Int !Int
- allBindings :: Imports -> Map VName BoundTo
- termBindingType :: TermBinding -> TypeBase Size NoMode
- data TermBinding
- = TermSize
- | TermVar TermBindSrc StructType (Maybe TypeAscription)
- | TermFun TermFunData
- data TermBindSrc
- data TermFunData = TermFunData {
- termFunType :: StructType
- termFunRetType :: ResRetType
- termFunAscription :: Maybe TypeAscription
- termFunArgEnd :: Maybe Pos
- termFunTypeArgEnd :: Maybe Pos
- termFunNameEnd :: Maybe Pos
- termFunTypeParams :: [TypeParamBase VName]
Documentation
What a name is bound to.
Constructors
| BoundTerm TermBinding Loc | inferred type, optional ascription from source |
| BoundModule Loc | |
| BoundModuleType Loc | |
| BoundType Loc |
boundLoc :: BoundTo -> Loc Source #
Where was a bound variable actually bound? That is, what is the location of its definition?
Information about what is at the given source location.
atPos :: Imports -> Pos -> Maybe AtPos Source #
Information about what's at the given source position. Returns
Nothing if there is nothing there, including if the source
position is invalid.
Position type.
Constructors
| Pos !FilePath !Int !Int !Int | Source file name, line, column, and character offset. Line numbering starts at 1, column offset starts at 1, and character offset starts at 0. |
Instances
| Data Pos # | |
Defined in Data.Loc Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Pos -> c Pos # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Pos # dataTypeOf :: Pos -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Pos) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pos) # gmapT :: (forall b. Data b => b -> b) -> Pos -> Pos # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pos -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pos -> r # gmapQ :: (forall d. Data d => d -> u) -> Pos -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Pos -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pos -> m Pos # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pos -> m Pos # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pos -> m Pos # | |
| Read Pos # | |
| Show Pos # | |
| Eq Pos # | |
| Ord Pos # | |
| Pretty Pos # | |
| Located Pos # | |
data TermBinding Source #
Constructors
| TermSize | The bound term is a size type |
| TermVar TermBindSrc StructType (Maybe TypeAscription) | Inferred Type, Ascripted type |
| TermFun TermFunData | The bound term is a function |
Instances
| Show TermBinding Source # | |
Defined in Language.Futhark.Query Methods showsPrec :: Int -> TermBinding -> ShowS # show :: TermBinding -> String # showList :: [TermBinding] -> ShowS # | |
| Eq TermBinding Source # | |
Defined in Language.Futhark.Query | |
data TermBindSrc Source #
Constructors
| TermBindPat | Term was bound where a pattern is allowed |
| TermBindLet | Term was bound with a let |
| TermBindId | term was bound where only an identifier is allowed |
| TermBindNested | term was bound inside another pattern |
Instances
| Show TermBindSrc Source # | |
Defined in Language.Futhark.Query Methods showsPrec :: Int -> TermBindSrc -> ShowS # show :: TermBindSrc -> String # showList :: [TermBindSrc] -> ShowS # | |
| Eq TermBindSrc Source # | |
Defined in Language.Futhark.Query | |
data TermFunData Source #
Constructors
| TermFunData | |
Fields
| |
Instances
| Show TermFunData Source # | |
Defined in Language.Futhark.Query Methods showsPrec :: Int -> TermFunData -> ShowS # show :: TermFunData -> String # showList :: [TermFunData] -> ShowS # | |
| Eq TermFunData Source # | |
Defined in Language.Futhark.Query | |