Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The monad that the renamer runs in and related infrastructure.
Synopsis
- newtype RenameT ren m a = RenameT {}
- type ScopedRenameT = RenameT ScopedRenaming
- newtype Renaming unique = Renaming {
- unRenaming :: UniqueMap unique unique
- type TypeRenaming = Renaming TypeUnique
- data ScopedRenaming = ScopedRenaming {}
- class Coercible unique Unique => HasRenaming ren unique where
- scopedRenamingTypes :: Lens' ScopedRenaming (Renaming TypeUnique)
- scopedRenamingTerms :: Lens' ScopedRenaming (Renaming TermUnique)
- runRenameT :: Monoid ren => RenameT ren m a -> m a
- lookupNameM :: (HasUnique name unique, HasRenaming ren unique, MonadReader ren m) => name -> m (Maybe unique)
- renameNameM :: (HasRenaming ren unique, HasUnique name unique, MonadReader ren m) => name -> m name
- withFreshenedName :: (HasRenaming ren unique, HasUnique name unique, MonadQuote m, MonadReader ren m) => name -> (name -> m c) -> m c
- withRenamedName :: (HasRenaming ren unique, HasUnique name unique, MonadReader ren m) => name -> name -> m c -> m c
Documentation
newtype RenameT ren m a Source #
The monad the renamer runs in.
Instances
Monad m => MonadReader ren (RenameT ren m) Source # | |
Alternative m => Alternative (RenameT ren m) Source # | |
Applicative m => Applicative (RenameT ren m) Source # | |
Defined in PlutusCore.Rename.Monad pure :: a -> RenameT ren m a Source # (<*>) :: RenameT ren m (a -> b) -> RenameT ren m a -> RenameT ren m b Source # liftA2 :: (a -> b -> c) -> RenameT ren m a -> RenameT ren m b -> RenameT ren m c Source # (*>) :: RenameT ren m a -> RenameT ren m b -> RenameT ren m b Source # (<*) :: RenameT ren m a -> RenameT ren m b -> RenameT ren m a Source # | |
Functor m => Functor (RenameT ren m) Source # | |
Monad m => Monad (RenameT ren m) Source # | |
MonadQuote m => MonadQuote (RenameT ren m) Source # | |
type ScopedRenameT = RenameT ScopedRenaming Source #
newtype Renaming unique Source #
A renaming is a mapping from old uniques to new ones.
Renaming | |
|
type TypeRenaming = Renaming TypeUnique Source #
A type-level renaming.
Needed for instantiating functions running over types in generic RenameT ren m
to
a particular type of renaming.
data ScopedRenaming Source #
Scoping-aware mapping from locally unique uniques to globally unique uniques.
Instances
Monoid ScopedRenaming Source # | |
Defined in PlutusCore.Rename.Monad mempty :: ScopedRenaming Source # mappend :: ScopedRenaming -> ScopedRenaming -> ScopedRenaming Source # mconcat :: [ScopedRenaming] -> ScopedRenaming Source # | |
Semigroup ScopedRenaming Source # | |
Defined in PlutusCore.Rename.Monad (<>) :: ScopedRenaming -> ScopedRenaming -> ScopedRenaming Source # sconcat :: NonEmpty ScopedRenaming -> ScopedRenaming Source # stimes :: Integral b => b -> ScopedRenaming -> ScopedRenaming Source # | |
HasRenaming ScopedRenaming TermUnique Source # | |
Defined in PlutusCore.Rename.Monad | |
HasRenaming ScopedRenaming TypeUnique Source # | |
Defined in PlutusCore.Rename.Monad |
class Coercible unique Unique => HasRenaming ren unique where Source #
A class that specifies which Renaming
a ren
has inside.
A ren
can contain several Renaming
s (like Scoped
, for example).
Instances
HasRenaming ScopedRenaming TermUnique Source # | |
Defined in PlutusCore.Rename.Monad | |
HasRenaming ScopedRenaming TypeUnique Source # | |
Defined in PlutusCore.Rename.Monad | |
(Coercible unique1 Unique, unique1 ~ unique2) => HasRenaming (Renaming unique1) unique2 Source # | |
runRenameT :: Monoid ren => RenameT ren m a -> m a Source #
Run a RenameT
computation with an empty renaming.
lookupNameM :: (HasUnique name unique, HasRenaming ren unique, MonadReader ren m) => name -> m (Maybe unique) Source #
Look up the new unique a name got mapped to.
renameNameM :: (HasRenaming ren unique, HasUnique name unique, MonadReader ren m) => name -> m name Source #
Rename a name that has a unique inside.
withFreshenedName :: (HasRenaming ren unique, HasUnique name unique, MonadQuote m, MonadReader ren m) => name -> (name -> m c) -> m c Source #
Replace the unique in a name by a new unique, save the mapping from the old unique to the new one and supply the updated value to a continuation.
withRenamedName :: (HasRenaming ren unique, HasUnique name unique, MonadReader ren m) => name -> name -> m c -> m c Source #
Run a RenameT
computation in the environment extended by the mapping from an old name
to a new one.