futhark-0.25.27: An optimising compiler for a functional, array-oriented language.

Safe Haskell | Safe-Inferred
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
  - = BoundTerm StructType Loc
  - | BoundModule Loc
  - | BoundModuleType Loc
  - | BoundType Loc
- boundLoc :: BoundTo -> Loc
- data AtPos = AtName (QualName VName) (Maybe BoundTo) Loc
- atPos :: Imports -> Pos -> Maybe AtPos
- data Pos = Pos !FilePath !Int !Int !Int

# Documentation

data BoundTo Source #

What a name is bound to.

Constructors

BoundTerm StructType Loc |
BoundModule Loc |
BoundModuleType Loc |
BoundType Loc |

#### Instances

Instances details

Show BoundTo Source # |
Instance details Defined in Language.Futhark.Query Methods showsPrec :: Int -> BoundTo -> ShowS Source # show :: BoundTo -> String Source # showList :: [BoundTo] -> ShowS Source #
Eq BoundTo Source # |
Instance details Defined in Language.Futhark.Query Methods (==) :: BoundTo -> BoundTo -> Bool Source # (/=) :: BoundTo -> BoundTo -> Bool Source #

boundLoc :: BoundTo -> Loc Source #

Where was a bound variable actually bound? That is, what is the location of its definition?

data AtPos Source #

Information about what is at the given source location.

Constructors

AtName (QualName VName) (Maybe BoundTo) Loc |

#### Instances

Instances details

Show AtPos Source # |
Instance details Defined in Language.Futhark.Query Methods showsPrec :: Int -> AtPos -> ShowS Source # show :: AtPos -> String Source # showList :: [AtPos] -> ShowS Source #
Eq AtPos Source # |
Instance details Defined in Language.Futhark.Query Methods (==) :: AtPos -> AtPos -> Bool Source # (/=) :: AtPos -> AtPos -> Bool Source #

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.

data Pos Source #

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

Instances details

Data Pos |

Instance details

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 Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Pos Source #

toConstr :: Pos -> Constr Source #

dataTypeOf :: Pos -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Pos) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pos) Source #

gmapT :: (forall b. Data b => b -> b) -> Pos -> Pos Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pos -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pos -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Pos -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Pos -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pos -> m Pos Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pos -> m Pos Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pos -> m Pos Source #

Read Pos |
Instance details Defined in Data.Loc Methods readsPrec :: Int -> ReadS Pos Source # readList :: ReadS [Pos] Source # readPrec :: ReadPrec Pos Source # readListPrec :: ReadPrec [Pos] Source #
Show Pos |
Instance details Defined in Data.Loc Methods showsPrec :: Int -> Pos -> ShowS Source # show :: Pos -> String Source # showList :: [Pos] -> ShowS Source #
Eq Pos |
Instance details Defined in Data.Loc Methods (==) :: Pos -> Pos -> Bool Source # (/=) :: Pos -> Pos -> Bool Source #
Ord Pos |
Instance details Defined in Data.Loc Methods compare :: Pos -> Pos -> Ordering Source # (<) :: Pos -> Pos -> Bool Source # (<=) :: Pos -> Pos -> Bool Source # (>) :: Pos -> Pos -> Bool Source # (>=) :: Pos -> Pos -> Bool Source # max :: Pos -> Pos -> Pos Source # min :: Pos -> Pos -> Pos Source #
Pretty Pos |
Instance details Defined in Text.PrettyPrint.Mainland.Class Methods ppr :: Pos -> Doc Source # pprPrec :: Int -> Pos -> Doc Source # pprList :: [Pos] -> Doc Source #
Located Pos |
Instance details Defined in Data.Loc Methods locOf :: Pos -> Loc Source # locOfList :: [Pos] -> Loc Source #