Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
This module contains very basic definitions for Futhark - so basic, that they can be shared between the internal and external representation.
Synopsis
- data Uniqueness
- data Commutativity
- data SrcLoc
- data Loc
- class Located a where
- srclocOf :: Located a => a -> SrcLoc
- locStr :: Located a => a -> String
- locStrRel :: (Located a, Located b) => a -> b -> String
- prettyStacktrace :: Int -> [String] -> String
- data Name
- nameToString :: Name -> String
- nameFromString :: String -> Name
- nameToText :: Name -> Text
- nameFromText :: Text -> Name
- data VName = VName !Name !Int
- baseTag :: VName -> Int
- baseName :: VName -> Name
- baseString :: VName -> String
- pretty :: Pretty a => a -> String
- quote :: String -> String
- pquote :: Doc -> Doc
- defaultEntryPoint :: Name
- data Int8
- data Int16
- data Int32
- data Int64
- data Word8
- data Word16
- data Word32
- data Word64
Documentation
data Uniqueness Source #
The uniqueness attribute of a type. This essentially indicates
whether or not in-place modifications are acceptable. With respect
to ordering, Unique
is greater than Nonunique
.
Instances
data Commutativity Source #
Whether some operator is commutative or not. The Monoid
instance returns the least commutative of its arguments.
Instances
Location utilities
Source location type. Source location are all equal, which allows AST nodes to be compared modulo location information.
Instances
Eq SrcLoc | |
Data SrcLoc | |
Defined in Data.Loc gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcLoc -> c SrcLoc # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcLoc # toConstr :: SrcLoc -> Constr # dataTypeOf :: SrcLoc -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcLoc) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcLoc) # gmapT :: (forall b. Data b => b -> b) -> SrcLoc -> SrcLoc # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r # gmapQ :: (forall d. Data d => d -> u) -> SrcLoc -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcLoc -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # | |
Ord SrcLoc | |
Read SrcLoc | |
Show SrcLoc | |
Semigroup SrcLoc | |
Monoid SrcLoc | |
IsLocation SrcLoc | |
Located SrcLoc | |
ToIdent (SrcLoc -> Id) | |
Location type, consisting of a beginning position and an end position.
Instances
Eq Loc | |
Data Loc | |
Defined in Data.Loc gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Loc -> c Loc # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Loc # dataTypeOf :: Loc -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Loc) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Loc) # gmapT :: (forall b. Data b => b -> b) -> Loc -> Loc # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Loc -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Loc -> r # gmapQ :: (forall d. Data d => d -> u) -> Loc -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Loc -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Loc -> m Loc # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Loc -> m Loc # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Loc -> m Loc # | |
Read Loc | |
Show Loc | |
Semigroup Loc | |
Monoid Loc | |
Pretty Loc | |
IsLocation Loc | |
Located Loc | |
Located values have a location.
Instances
locStr :: Located a => a -> String Source #
A human-readable location string, of the form
filename:lineno:columnno
. This follows the GNU coding standards
for error messages:
https://www.gnu.org/prep/standards/html_node/Errors.html
This function assumes that both start and end position is in the same file (it is not clear what the alternative would even mean).
locStrRel :: (Located a, Located b) => a -> b -> String Source #
Like locStr
, but locStrRel prev now
prints the location now
with the file name left out if the same as prev
. This is useful
when printing messages that are all in the context of some
initially printed location (e.g. the first mention contains the
file name; the rest just line and column name).
prettyStacktrace :: Int -> [String] -> String Source #
Given a list of strings representing entries in the stack trace and the index of the frame to highlight, produce a final newline-terminated string for showing to the user. This string should also be preceded by a newline. The most recent stack frame must come first in the list.
Name handling
The abstract (not really) type representing names in the Futhark
compiler. String
s, being lists of characters, are very slow,
while Text
s are based on byte-arrays.
Instances
nameToString :: Name -> String Source #
Convert a name to the corresponding list of characters.
nameFromString :: String -> Name Source #
Convert a list of characters to the corresponding name.
A name tagged with some integer. Only the integer is used in
comparisons, no matter the type of vn
.
Instances
quote :: String -> String Source #
Enclose a string in the prefered quotes used in error messages. These are picked to not collide with characters permitted in identifiers.
Special identifiers
defaultEntryPoint :: Name Source #
The name of the default program entry point (main).
Integer re-export
8-bit signed integer type
Instances
16-bit signed integer type
Instances
32-bit signed integer type
Instances
64-bit signed integer type
Instances
8-bit unsigned integer type
Instances
16-bit unsigned integer type
Instances
32-bit unsigned integer type
Instances
64-bit unsigned integer type