cryptol-2.13.0: Cryptol: The Language of Cryptography
Copyright(c) 2013-2016 Galois Inc.
LicenseBSD3
Maintainercryptol@galois.com
Stabilityprovisional
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cryptol.ModuleSystem.Renamer.Monad

Description

 
Synopsis

Documentation

data NameType Source #

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

Constructors

NameBind 
NameUse 

data RenamerInfo Source #

Information needed to do some renaming.

Constructors

RenamerInfo 

Fields

newtype RenameM a Source #

Constructors

RenameM 

Fields

Instances

Instances details
Monad RenameM Source # 
Instance details

Defined in Cryptol.ModuleSystem.Renamer.Monad

Methods

(>>=) :: RenameM a -> (a -> RenameM b) -> RenameM b #

(>>) :: RenameM a -> RenameM b -> RenameM b #

return :: a -> RenameM a #

Functor RenameM Source # 
Instance details

Defined in Cryptol.ModuleSystem.Renamer.Monad

Methods

fmap :: (a -> b) -> RenameM a -> RenameM b #

(<$) :: a -> RenameM b -> RenameM a #

Applicative RenameM Source # 
Instance details

Defined in Cryptol.ModuleSystem.Renamer.Monad

Methods

pure :: a -> RenameM a #

(<*>) :: RenameM (a -> b) -> RenameM a -> RenameM b #

liftA2 :: (a -> b -> c) -> RenameM a -> RenameM b -> RenameM c #

(*>) :: RenameM a -> RenameM b -> RenameM b #

(<*) :: RenameM a -> RenameM b -> RenameM a #

FreshM RenameM Source # 
Instance details

Defined in Cryptol.ModuleSystem.Renamer.Monad

Methods

liftSupply :: (Supply -> (a, Supply)) -> RenameM a Source #

Semigroup a => Semigroup (RenameM a) Source # 
Instance details

Defined in Cryptol.ModuleSystem.Renamer.Monad

Methods

(<>) :: RenameM a -> RenameM a -> RenameM a #

sconcat :: NonEmpty (RenameM a) -> RenameM a #

stimes :: Integral b => b -> RenameM a -> RenameM a #

(Semigroup a, Monoid a) => Monoid (RenameM a) Source # 
Instance details

Defined in Cryptol.ModuleSystem.Renamer.Monad

Methods

mempty :: RenameM a #

mappend :: RenameM a -> RenameM a -> RenameM a #

mconcat :: [RenameM a] -> RenameM a #

data RO Source #

Constructors

RO 

Fields

data RW Source #

Constructors

RW 

Fields

record :: RenamerError -> RenameM () Source #

Record an error. XXX: use a better name

depsOf :: DepName -> RenameM a -> RenameM a Source #

Rename something. All name uses in the sub-computation are assumed to be dependenices of the thing.

depGroup :: RenameM a -> RenameM (a, Map DepName (Set Name)) Source #

This is used when renaming a group of things. The result contains dependencies between names defines and the group, and is intended to be used to order the group members in dependency order.

curLoc :: RenameM Range Source #

Get the source range for wahtever we are currently renaming.

located :: a -> RenameM (Located a) Source #

Annotate something with the current range.

withLoc :: HasLoc loc => loc -> RenameM a -> RenameM a Source #

Do the given computation using the source code range from loc if any.

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

Shadow the current naming environment with some more names.

data EnvCheck Source #

Constructors

CheckAll

Check for overlap and shadowing

CheckOverlap

Only check for overlap

CheckNone

Don't check the environment

Instances

Instances details
Eq EnvCheck Source # 
Instance details

Defined in Cryptol.ModuleSystem.Renamer.Monad

Show EnvCheck Source # 
Instance details

Defined in Cryptol.ModuleSystem.Renamer.Monad

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

Shadow the current naming environment with some more names.

checkEnv :: EnvCheck -> NamingEnv -> NamingEnv -> RW -> (NamingEnv, RW) Source #

Generate warnings when the left environment shadows things defined in the right. Additionally, generate errors when two names overlap in the left environment.

containsOverlap :: [Name] -> Seq RenamerError Source #

Check the RHS of a single name rewrite for conflicting sources.

addDep :: Name -> RenameM () Source #

Mark something as a dependency. This is similar but different from recordUse, in particular: * We only record use sites, not bindings * We record all namespaces, not just types * We only keep track of actual uses mentioned in the code. Otoh, recordUse also considers exported entities to be used. * If we depend on a name from a sibling submodule we add a dependency on the module in our common ancestor. Examples: - A::B::x depends on A::B::C::D::y, x depends on A::B::C - A::B::x depends on A::P::Q::y, x depends on A::P@

lookupImport :: Import -> RenameM IfaceDecls Source #

Get the exported declarations in a module