Copyright | (c) 2015-2016 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Synopsis
- data Name
- data NameInfo
- data NameSource
- nameUnique :: Name -> Int
- nameIdent :: Name -> Ident
- nameInfo :: Name -> NameInfo
- nameLoc :: Name -> Range
- nameFixity :: Name -> Maybe Fixity
- nameNamespace :: Name -> Namespace
- asPrim :: Name -> Maybe PrimIdent
- asOrigName :: Name -> Maybe OrigName
- ppLocName :: Name -> Doc
- data Namespace
- data ModPath
- cmpNameDisplay :: NameDisp -> Name -> Name -> Ordering
- mkDeclared :: Namespace -> ModPath -> NameSource -> Ident -> Maybe Fixity -> Range -> Supply -> (Name, Supply)
- mkParameter :: Namespace -> Ident -> Range -> Supply -> (Name, Supply)
- toParamInstName :: Name -> Name
- asParamName :: Name -> Name
- paramModRecParam :: Name
- class Monad m => FreshM m where
- liftSupply :: (Supply -> (a, Supply)) -> m a
- nextUniqueM :: FreshM m => m Int
- data SupplyT m a
- runSupplyT :: Monad m => Supply -> SupplyT m a -> m (a, Supply)
- data Supply
- emptySupply :: Supply
- nextUnique :: Supply -> (Int, Supply)
- data PrimMap = PrimMap {}
- lookupPrimDecl :: PrimIdent -> PrimMap -> Name
- lookupPrimType :: PrimIdent -> PrimMap -> Name
Names
Instances
Information about the binding site of the name.
Declared !ModPath !NameSource | This name refers to a declaration from this module |
Parameter | This name is a parameter (function or type) |
Instances
Eq NameInfo Source # | |
Show NameInfo Source # | |
Generic NameInfo Source # | |
NFData NameInfo Source # | |
Defined in Cryptol.ModuleSystem.Name | |
type Rep NameInfo Source # | |
Defined in Cryptol.ModuleSystem.Name type Rep NameInfo = D1 ('MetaData "NameInfo" "Cryptol.ModuleSystem.Name" "cryptol-2.13.0-BA7OuzmYZ3M9j8JsJfXs6b" 'False) (C1 ('MetaCons "Declared" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ModPath) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 NameSource)) :+: C1 ('MetaCons "Parameter" 'PrefixI 'False) (U1 :: Type -> Type)) |
data NameSource Source #
Instances
Eq NameSource Source # | |
Defined in Cryptol.ModuleSystem.Name (==) :: NameSource -> NameSource -> Bool # (/=) :: NameSource -> NameSource -> Bool # | |
Show NameSource Source # | |
Defined in Cryptol.ModuleSystem.Name showsPrec :: Int -> NameSource -> ShowS # show :: NameSource -> String # showList :: [NameSource] -> ShowS # | |
Generic NameSource Source # | |
Defined in Cryptol.ModuleSystem.Name type Rep NameSource :: Type -> Type # from :: NameSource -> Rep NameSource x # to :: Rep NameSource x -> NameSource # | |
NFData NameSource Source # | |
Defined in Cryptol.ModuleSystem.Name rnf :: NameSource -> () # | |
type Rep NameSource Source # | |
nameUnique :: Name -> Int Source #
nameNamespace :: Name -> Namespace Source #
asPrim :: Name -> Maybe PrimIdent Source #
Primtiives must be in a top level module, at least for now.
Namespaces for names
Instances
Bounded Namespace Source # | |
Enum Namespace Source # | |
Defined in Cryptol.Utils.Ident succ :: Namespace -> Namespace # pred :: Namespace -> Namespace # fromEnum :: Namespace -> Int # enumFrom :: Namespace -> [Namespace] # enumFromThen :: Namespace -> Namespace -> [Namespace] # enumFromTo :: Namespace -> Namespace -> [Namespace] # enumFromThenTo :: Namespace -> Namespace -> Namespace -> [Namespace] # | |
Eq Namespace Source # | |
Ord Namespace Source # | |
Defined in Cryptol.Utils.Ident | |
Show Namespace Source # | |
Generic Namespace Source # | |
NFData Namespace Source # | |
Defined in Cryptol.Utils.Ident | |
PP Namespace Source # | |
type Rep Namespace Source # | |
Defined in Cryptol.Utils.Ident type Rep Namespace = D1 ('MetaData "Namespace" "Cryptol.Utils.Ident" "cryptol-2.13.0-BA7OuzmYZ3M9j8JsJfXs6b" 'False) (C1 ('MetaCons "NSValue" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NSType" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NSModule" 'PrefixI 'False) (U1 :: Type -> Type))) |
Idnetifies a possibly nested module
Instances
Eq ModPath Source # | |
Ord ModPath Source # | |
Show ModPath Source # | |
Generic ModPath Source # | |
NFData ModPath Source # | |
Defined in Cryptol.Utils.Ident | |
PP ModPath Source # | |
type Rep ModPath Source # | |
Defined in Cryptol.Utils.Ident type Rep ModPath = D1 ('MetaData "ModPath" "Cryptol.Utils.Ident" "cryptol-2.13.0-BA7OuzmYZ3M9j8JsJfXs6b" 'False) (C1 ('MetaCons "TopModule" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModName)) :+: C1 ('MetaCons "Nested" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModPath) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident))) |
cmpNameDisplay :: NameDisp -> Name -> Name -> Ordering Source #
Compare two names by the way they would be displayed. This is used to order names nicely when showing what's in scope
Creation
mkDeclared :: Namespace -> ModPath -> NameSource -> Ident -> Maybe Fixity -> Range -> Supply -> (Name, Supply) Source #
Make a new name for a declaration.
mkParameter :: Namespace -> Ident -> Range -> Supply -> (Name, Supply) Source #
Make a new parameter name.
toParamInstName :: Name -> Name Source #
asParamName :: Name -> Name Source #
Unique Supply
class Monad m => FreshM m where Source #
liftSupply :: (Supply -> (a, Supply)) -> m a Source #
Instances
FreshM InferM Source # | |
Defined in Cryptol.TypeCheck.Monad | |
FreshM RenameM Source # | |
Defined in Cryptol.ModuleSystem.Renamer.Monad | |
FreshM REPL Source # | |
Defined in Cryptol.REPL.Monad | |
Monad m => FreshM (SupplyT m) Source # | |
Defined in Cryptol.ModuleSystem.Name | |
Monad m => FreshM (ModuleT m) Source # | |
Defined in Cryptol.ModuleSystem.Monad | |
FreshM m => FreshM (ReaderT i m) Source # | |
Defined in Cryptol.ModuleSystem.Name | |
(Monoid i, FreshM m) => FreshM (WriterT i m) Source # | |
Defined in Cryptol.ModuleSystem.Name | |
FreshM m => FreshM (StateT i m) Source # | |
Defined in Cryptol.ModuleSystem.Name | |
FreshM m => FreshM (ExceptionT i m) Source # | |
Defined in Cryptol.ModuleSystem.Name liftSupply :: (Supply -> (a, Supply)) -> ExceptionT i m a Source # |
nextUniqueM :: FreshM m => m Int Source #
Retrieve the next unique from the supply.
A monad for easing the use of the supply.
Instances
MonadT SupplyT Source # | |
Defined in Cryptol.ModuleSystem.Name | |
Monad m => Monad (SupplyT m) Source # | |
Monad m => Functor (SupplyT m) Source # | |
Monad m => Applicative (SupplyT m) Source # | |
Monad m => FreshM (SupplyT m) Source # | |
Defined in Cryptol.ModuleSystem.Name | |
BaseM m n => BaseM (SupplyT m) n Source # | |
Defined in Cryptol.ModuleSystem.Name | |
RunM m (a, Supply) r => RunM (SupplyT m) a (Supply -> r) Source # | |
Defined in Cryptol.ModuleSystem.Name |
emptySupply :: Supply Source #
This should only be used once at library initialization, and threaded through the rest of the session. The supply is started at 0x1000 to leave us plenty of room for names that the compiler needs to know about (wired-in constants).
PrimMap
A mapping from an identifier defined in some module to its real name.
Instances
Show PrimMap Source # | |
Generic PrimMap Source # | |
Semigroup PrimMap Source # | |
NFData PrimMap Source # | |
Defined in Cryptol.ModuleSystem.Name | |
type Rep PrimMap Source # | |
Defined in Cryptol.ModuleSystem.Name type Rep PrimMap = D1 ('MetaData "PrimMap" "Cryptol.ModuleSystem.Name" "cryptol-2.13.0-BA7OuzmYZ3M9j8JsJfXs6b" 'False) (C1 ('MetaCons "PrimMap" 'PrefixI 'True) (S1 ('MetaSel ('Just "primDecls") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map PrimIdent Name)) :*: S1 ('MetaSel ('Just "primTypes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map PrimIdent Name)))) |