cryptol-3.0.0: Cryptol: The Language of Cryptography

Copyright | (c) 2013-2016 Galois Inc.
License | BSD3
Maintainer | cryptol@galois.com
Stability | provisional
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Cryptol.ModuleSystem.Renamer

Description

Synopsis

- data NamingEnv
- shadowing :: NamingEnv -> NamingEnv -> NamingEnv
- class BindsNames a
- data InModule a = InModule (Maybe ModPath) a
- shadowNames :: BindsNames env => env -> RenameM a -> RenameM a
- class Rename f where
  - rename :: f PName -> RenameM (f Name)
- runRenamer :: RenamerInfo -> RenameM a -> (Either [RenamerError] (a, Supply), [RenamerWarning])
- data RenameM a
- data RenamerError
  - = MultipleSyms (Located PName) [Name]
  - | UnboundName Namespace (Located PName)
  - | OverlappingSyms [Name]
  - | WrongNamespace Namespace Namespace (Located PName)
  - | FixityError (Located Name) Fixity (Located Name) Fixity
  - | OverlappingRecordUpdate (Located [Selector]) (Located [Selector])
  - | InvalidDependency [DepName]
  - | MultipleModParams Ident [Range]
  - | InvalidFunctorImport (ImpName Name)
  - | UnexpectedNest Range PName
  - | ModuleKindMismatch Range (ImpName Name) ModKind ModKind
- data RenamerWarning
  - = SymbolShadowed PName Name [Name]
  - | UnusedName Name
  - | PrefixAssocChanged PrefixOp (Expr Name) (Located Name) Fixity (Expr Name)
- renameVar :: NameType -> PName -> RenameM Name
- renameType :: NameType -> PName -> RenameM Name
- renameModule :: Module PName -> RenameM RenamedModule
- renameTopDecls :: ModName -> [TopDecl PName] -> RenameM (NamingEnv, [TopDecl Name])
- data RenamerInfo = RenamerInfo {
  - renSupply :: Supply
  - renContext :: ModPath
  - renEnv :: NamingEnv
  - renIfaces :: Map ModName (Either ModParamNames Iface)
  }
- data NameType
  - = NameBind
  - | NameUse
- data RenamedModule = RenamedModule {
  - rmModule :: Module Name
  - rmDefines :: NamingEnv
  - rmInScope :: NamingEnv
  - rmImported :: IfaceDecls
  }

# Documentation

data NamingEnv Source #

The `NamingEnv` is used by the renamer to determine what identifiers refer to.

#### Instances

Instances details

Monoid NamingEnv Source # |
Instance details Defined in Cryptol.ModuleSystem.NamingEnv Methods mempty :: NamingEnv Source # mappend :: NamingEnv -> NamingEnv -> NamingEnv Source # mconcat :: [NamingEnv] -> NamingEnv Source #
Semigroup NamingEnv Source # |
Instance details Defined in Cryptol.ModuleSystem.NamingEnv Methods (<>) :: NamingEnv -> NamingEnv -> NamingEnv Source # sconcat :: NonEmpty NamingEnv -> NamingEnv Source # stimes :: Integral b => b -> NamingEnv -> NamingEnv Source #
Generic NamingEnv Source # |
Instance details Defined in Cryptol.ModuleSystem.NamingEnv Associated Types type Rep NamingEnv :: Type -> Type Source # Methods from :: NamingEnv -> Rep NamingEnv x Source # to :: Rep NamingEnv x -> NamingEnv Source #
Show NamingEnv Source # |
Instance details Defined in Cryptol.ModuleSystem.NamingEnv Methods showsPrec :: Int -> NamingEnv -> ShowS Source # show :: NamingEnv -> String Source # showList :: [NamingEnv] -> ShowS Source #
BindsNames NamingEnv Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: NamingEnv -> BuildNamingEnv
PP NamingEnv Source # |
Instance details Defined in Cryptol.ModuleSystem.NamingEnv Methods ppPrec :: Int -> NamingEnv -> Doc Source #
NFData NamingEnv Source # |
Instance details Defined in Cryptol.ModuleSystem.NamingEnv Methods rnf :: NamingEnv -> () Source #
type Rep NamingEnv Source # |
Instance details Defined in Cryptol.ModuleSystem.NamingEnv type Rep NamingEnv = D1 ('MetaData "NamingEnv" "Cryptol.ModuleSystem.NamingEnv" "cryptol-3.0.0-DBVDUAjB1JeD0WzkHH4ckn" 'True) (C1 ('MetaCons "NamingEnv" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Namespace (Map PName Names)))))

shadowing :: NamingEnv -> NamingEnv -> NamingEnv Source #

Like mappend, but when merging, prefer values on the lhs.

class BindsNames a Source #

Things that define exported names.

Minimal complete definition

namingEnv

#### Instances

Instances details

BindsNames NamingEnv Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: NamingEnv -> BuildNamingEnv
BindsNames (InModule (Bind PName)) Source # | Introduce the name
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (Bind PName) -> BuildNamingEnv
BindsNames (InModule (Decl PName)) Source # | The naming environment for a single declaration.
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (Decl PName) -> BuildNamingEnv
BindsNames (InModule (NestedModule PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (NestedModule PName) -> BuildNamingEnv
BindsNames (InModule (Newtype PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (Newtype PName) -> BuildNamingEnv
BindsNames (InModule (ParameterFun PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (ParameterFun PName) -> BuildNamingEnv
BindsNames (InModule (ParameterType PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (ParameterType PName) -> BuildNamingEnv
BindsNames (InModule (PrimType PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (PrimType PName) -> BuildNamingEnv
BindsNames (InModule (SigDecl PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (SigDecl PName) -> BuildNamingEnv
BindsNames (InModule (TopDecl PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (TopDecl PName) -> BuildNamingEnv
BindsNames (Schema PName) Source # | Generate a type renaming environment from the parameters that are bound by this schema.
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: Schema PName -> BuildNamingEnv
BindsNames (TParam PName) Source # | Generate the naming environment for a type parameter.
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: TParam PName -> BuildNamingEnv
BindsNames a => BindsNames (Maybe a) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: Maybe a -> BuildNamingEnv
BindsNames a => BindsNames [a] Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: [a] -> BuildNamingEnv

data InModule a Source #

Do something in the context of a module. If `Nothing` than we are working with a local declaration. Otherwise we are at the top-level of the given module.

By wrapping types with this, we can pass the module path to methods that need the extra information.

Constructors

InModule (Maybe ModPath) a |

#### Instances

Instances details

Foldable InModule Source # |

Instance details

Defined in Cryptol.ModuleSystem.Binds

Methods

fold :: Monoid m => InModule m -> m Source #

foldMap :: Monoid m => (a -> m) -> InModule a -> m Source #

foldMap' :: Monoid m => (a -> m) -> InModule a -> m Source #

foldr :: (a -> b -> b) -> b -> InModule a -> b Source #

foldr' :: (a -> b -> b) -> b -> InModule a -> b Source #

foldl :: (b -> a -> b) -> b -> InModule a -> b Source #

foldl' :: (b -> a -> b) -> b -> InModule a -> b Source #

foldr1 :: (a -> a -> a) -> InModule a -> a Source #

foldl1 :: (a -> a -> a) -> InModule a -> a Source #

toList :: InModule a -> [a] Source #

null :: InModule a -> Bool Source #

length :: InModule a -> Int Source #

elem :: Eq a => a -> InModule a -> Bool Source #

maximum :: Ord a => InModule a -> a Source #

minimum :: Ord a => InModule a -> a Source #

sum :: Num a => InModule a -> a Source #

product :: Num a => InModule a -> a Source #

Traversable InModule Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods traverse :: Applicative f => (a -> f b) -> InModule a -> f (InModule b) Source # sequenceA :: Applicative f => InModule (f a) -> f (InModule a) Source # mapM :: Monad m => (a -> m b) -> InModule a -> m (InModule b) Source # sequence :: Monad m => InModule (m a) -> m (InModule a) Source #
Functor InModule Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods fmap :: (a -> b) -> InModule a -> InModule b Source # (<$) :: a -> InModule b -> InModule a Source #
Show a => Show (InModule a) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods showsPrec :: Int -> InModule a -> ShowS Source # show :: InModule a -> String Source # showList :: [InModule a] -> ShowS Source #
BindsNames (InModule (Bind PName)) Source # | Introduce the name
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (Bind PName) -> BuildNamingEnv
BindsNames (InModule (Decl PName)) Source # | The naming environment for a single declaration.
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (Decl PName) -> BuildNamingEnv
BindsNames (InModule (NestedModule PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (NestedModule PName) -> BuildNamingEnv
BindsNames (InModule (Newtype PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (Newtype PName) -> BuildNamingEnv
BindsNames (InModule (ParameterFun PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (ParameterFun PName) -> BuildNamingEnv
BindsNames (InModule (ParameterType PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (ParameterType PName) -> BuildNamingEnv
BindsNames (InModule (PrimType PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (PrimType PName) -> BuildNamingEnv
BindsNames (InModule (SigDecl PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (SigDecl PName) -> BuildNamingEnv
BindsNames (InModule (TopDecl PName)) Source # |
Instance details Defined in Cryptol.ModuleSystem.Binds Methods namingEnv :: InModule (TopDecl PName) -> BuildNamingEnv

shadowNames :: BindsNames env => env -> RenameM a -> RenameM a Source #

Shadow the current naming environment with some more names.

class Rename f where Source #

Methods

rename :: f PName -> RenameM (f Name) Source #

#### Instances

Instances details

Rename Bind Source # | Rename a binding.
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: Bind PName -> RenameM (Bind Name) Source #
Rename BindDef Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: BindDef PName -> RenameM (BindDef Name) Source #
Rename Decl Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: Decl PName -> RenameM (Decl Name) Source #
Rename Expr Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: Expr PName -> RenameM (Expr Name) Source #
Rename FunDesc Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: FunDesc PName -> RenameM (FunDesc Name) Source #
Rename ImpName Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: ImpName PName -> RenameM (ImpName Name) Source #
Rename Match Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: Match PName -> RenameM (Match Name) Source #
Rename ModParam Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: ModParam PName -> RenameM (ModParam Name) Source #
Rename ModuleInstanceArg Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: ModuleInstanceArg PName -> RenameM (ModuleInstanceArg Name) Source #
Rename ModuleInstanceArgs Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: ModuleInstanceArgs PName -> RenameM (ModuleInstanceArgs Name) Source #
Rename ModuleInstanceNamedArg Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: ModuleInstanceNamedArg PName -> RenameM (ModuleInstanceNamedArg Name) Source #
Rename NestedModule Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: NestedModule PName -> RenameM (NestedModule Name) Source #
Rename Newtype Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: Newtype PName -> RenameM (Newtype Name) Source #
Rename ParameterFun Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: ParameterFun PName -> RenameM (ParameterFun Name) Source #
Rename ParameterType Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: ParameterType PName -> RenameM (ParameterType Name) Source #
Rename Pattern Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: Pattern PName -> RenameM (Pattern Name) Source #
Rename PrimType Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: PrimType PName -> RenameM (PrimType Name) Source #
Rename Prop Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: Prop PName -> RenameM (Prop Name) Source #
Rename PropGuardCase Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: PropGuardCase PName -> RenameM (PropGuardCase Name) Source #
Rename PropSyn Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: PropSyn PName -> RenameM (PropSyn Name) Source #
Rename Schema Source # | Rename a schema, assuming that none of its type variables are already in scope.
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: Schema PName -> RenameM (Schema Name) Source #
Rename SigDecl Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: SigDecl PName -> RenameM (SigDecl Name) Source #
Rename TParam Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: TParam PName -> RenameM (TParam Name) Source #
Rename TopDecl Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: TopDecl PName -> RenameM (TopDecl Name) Source #
Rename TySyn Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: TySyn PName -> RenameM (TySyn Name) Source #
Rename Type Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: Type PName -> RenameM (Type Name) Source #
Rename TypeInst Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: TypeInst PName -> RenameM (TypeInst Name) Source #
Rename UpdField Source # | Note that after this point the `->` updates have an explicit function and there are no more nested updates.
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods rename :: UpdField PName -> RenameM (UpdField Name) Source #

runRenamer :: RenamerInfo -> RenameM a -> (Either [RenamerError] (a, Supply), [RenamerWarning]) Source #

data RenameM a Source #

#### Instances

Instances details

Applicative RenameM Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Monad Methods pure :: a -> RenameM a Source # (<*>) :: RenameM (a -> b) -> RenameM a -> RenameM b Source # liftA2 :: (a -> b -> c) -> RenameM a -> RenameM b -> RenameM c Source # (*>) :: RenameM a -> RenameM b -> RenameM b Source # (<*) :: RenameM a -> RenameM b -> RenameM a Source #
Functor RenameM Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Monad Methods fmap :: (a -> b) -> RenameM a -> RenameM b Source # (<$) :: a -> RenameM b -> RenameM a Source #
Monad RenameM Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Monad Methods (>>=) :: RenameM a -> (a -> RenameM b) -> RenameM b Source # (>>) :: RenameM a -> RenameM b -> RenameM b Source # return :: a -> RenameM a Source #
FreshM RenameM Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Monad Methods liftSupply :: (Supply -> (a, Supply)) -> RenameM a Source #
(Semigroup a, Monoid a) => Monoid (RenameM a) Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Monad Methods mempty :: RenameM a Source # mappend :: RenameM a -> RenameM a -> RenameM a Source # mconcat :: [RenameM a] -> RenameM a Source #
Semigroup a => Semigroup (RenameM a) Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Monad Methods (<>) :: RenameM a -> RenameM a -> RenameM a Source # sconcat :: NonEmpty (RenameM a) -> RenameM a Source # stimes :: Integral b => b -> RenameM a -> RenameM a Source #

data RenamerError Source #

Constructors

MultipleSyms (Located PName) [Name] | Multiple imported symbols contain this name
UnboundName Namespace (Located PName) | Some name not bound to any definition
OverlappingSyms [Name] | An environment has produced multiple overlapping symbols
WrongNamespace Namespace Namespace (Located PName) | expected, actual. When a name is missing from the expected namespace, but exists in another
FixityError (Located Name) Fixity (Located Name) Fixity | When the fixity of two operators conflict
OverlappingRecordUpdate (Located [Selector]) (Located [Selector]) | When record updates overlap (e.g., `{ r | x = e1, x.y = e2 }`)
InvalidDependency [DepName] | Things that can't depend on each other
MultipleModParams Ident [Range] | Module parameters with the same name
InvalidFunctorImport (ImpName Name) | Can't import functors directly
UnexpectedNest Range PName | Nested modules were not supposed to appear here
ModuleKindMismatch Range (ImpName Name) ModKind ModKind | Exepcted one kind (first one) but found the other (second one)

#### Instances

Instances details

Generic RenamerError Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Error Associated Types type Rep RenamerError :: Type -> Type Source # Methods from :: RenamerError -> Rep RenamerError x Source # to :: Rep RenamerError x -> RenamerError Source #
Show RenamerError Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Error Methods showsPrec :: Int -> RenamerError -> ShowS Source # show :: RenamerError -> String Source # showList :: [RenamerError] -> ShowS Source #
PP RenamerError Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Error Methods ppPrec :: Int -> RenamerError -> Doc Source #
NFData RenamerError Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Error Methods rnf :: RenamerError -> () Source #
Eq RenamerError Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Error Methods (==) :: RenamerError -> RenamerError -> Bool Source # (/=) :: RenamerError -> RenamerError -> Bool Source #
Ord RenamerError Source # |

Instance details

Defined in Cryptol.ModuleSystem.Renamer.Error

Methods

compare :: RenamerError -> RenamerError -> Ordering Source #

(<) :: RenamerError -> RenamerError -> Bool Source #

(<=) :: RenamerError -> RenamerError -> Bool Source #

(>) :: RenamerError -> RenamerError -> Bool Source #

(>=) :: RenamerError -> RenamerError -> Bool Source #

max :: RenamerError -> RenamerError -> RenamerError Source #

min :: RenamerError -> RenamerError -> RenamerError Source #

type Rep RenamerError Source # |

Instance details

Defined in Cryptol.ModuleSystem.Renamer.Error

type Rep RenamerError = D1 ('MetaData "RenamerError" "Cryptol.ModuleSystem.Renamer.Error" "cryptol-3.0.0-DBVDUAjB1JeD0WzkHH4ckn" 'False) (((C1 ('MetaCons "MultipleSyms" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located PName)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Name])) :+: C1 ('MetaCons "UnboundName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Namespace) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located PName)))) :+: (C1 ('MetaCons "OverlappingSyms" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Name])) :+: (C1 ('MetaCons "WrongNamespace" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Namespace) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Namespace) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located PName)))) :+: C1 ('MetaCons "FixityError" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located Name)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Fixity)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located Name)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Fixity)))))) :+: ((C1 ('MetaCons "OverlappingRecordUpdate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located [Selector])) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located [Selector]))) :+: (C1 ('MetaCons "InvalidDependency" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [DepName])) :+: C1 ('MetaCons "MultipleModParams" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Range])))) :+: (C1 ('MetaCons "InvalidFunctorImport" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ImpName Name))) :+: (C1 ('MetaCons "UnexpectedNest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Range) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PName)) :+: C1 ('MetaCons "ModuleKindMismatch" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Range) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ImpName Name))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModKind) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModKind)))))))

data RenamerWarning Source #

Constructors

SymbolShadowed PName Name [Name] |
UnusedName Name |
PrefixAssocChanged PrefixOp (Expr Name) (Located Name) Fixity (Expr Name) |

#### Instances

Instances details

Generic RenamerWarning Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Error Associated Types type Rep RenamerWarning :: Type -> Type Source # Methods from :: RenamerWarning -> Rep RenamerWarning x Source # to :: Rep RenamerWarning x -> RenamerWarning Source #
Show RenamerWarning Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Error Methods showsPrec :: Int -> RenamerWarning -> ShowS Source # show :: RenamerWarning -> String Source # showList :: [RenamerWarning] -> ShowS Source #
PP RenamerWarning Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Error Methods ppPrec :: Int -> RenamerWarning -> Doc Source #
NFData RenamerWarning Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Error Methods rnf :: RenamerWarning -> () Source #
Eq RenamerWarning Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer.Error Methods (==) :: RenamerWarning -> RenamerWarning -> Bool Source # (/=) :: RenamerWarning -> RenamerWarning -> Bool Source #
Ord RenamerWarning Source # |

Instance details

Defined in Cryptol.ModuleSystem.Renamer.Error

Methods

compare :: RenamerWarning -> RenamerWarning -> Ordering Source #

(<) :: RenamerWarning -> RenamerWarning -> Bool Source #

(<=) :: RenamerWarning -> RenamerWarning -> Bool Source #

(>) :: RenamerWarning -> RenamerWarning -> Bool Source #

(>=) :: RenamerWarning -> RenamerWarning -> Bool Source #

max :: RenamerWarning -> RenamerWarning -> RenamerWarning Source #

min :: RenamerWarning -> RenamerWarning -> RenamerWarning Source #

type Rep RenamerWarning Source # |

Instance details

Defined in Cryptol.ModuleSystem.Renamer.Error

type Rep RenamerWarning = D1 ('MetaData "RenamerWarning" "Cryptol.ModuleSystem.Renamer.Error" "cryptol-3.0.0-DBVDUAjB1JeD0WzkHH4ckn" 'False) (C1 ('MetaCons "SymbolShadowed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PName) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Name]))) :+: (C1 ('MetaCons "UnusedName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name)) :+: C1 ('MetaCons "PrefixAssocChanged" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PrefixOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr Name))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Located Name)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Fixity) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr Name)))))))

renameVar :: NameType -> PName -> RenameM Name Source #

renameType :: NameType -> PName -> RenameM Name Source #

renameModule :: Module PName -> RenameM RenamedModule Source #

Entry point. This is used for renaming a top-level module.

renameTopDecls :: ModName -> [TopDecl PName] -> RenameM (NamingEnv, [TopDecl Name]) Source #

Entry point. Rename a list of top-level declarations. This is used for declaration that don't live in a module (e.g., define on the command line.)

We assume that these declarations do not contain any nested modules.

data RenamerInfo Source #

Information needed to do some renaming.

Constructors

RenamerInfo |

Fields

- renSupply :: Supply

  Use to make new names

- renContext :: ModPath

  We are renaming things in here

- renEnv :: NamingEnv

  This is what's in scope

- renIfaces :: Map ModName (Either ModParamNames Iface)

  External modules

data NameType Source #

Indicates if a name is in a binding poisition or a use site

Constructors

NameBind |
NameUse |

data RenamedModule Source #

The result of renaming a module

Constructors

RenamedModule |

Fields

- rmModule :: Module Name

  The renamed module

- rmDefines :: NamingEnv

  What this module defines

- rmInScope :: NamingEnv

  What's in scope in this module

- rmImported :: IfaceDecls

  Imported declarations. This provides the types for external names (used by the type-checker).

#### Instances

Instances details

PP RenamedModule Source # |
Instance details Defined in Cryptol.ModuleSystem.Renamer Methods ppPrec :: Int -> RenamedModule -> Doc Source #