Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data NameShape = NameShape {
- ns_mod_name :: ModuleName
- ns_exports :: [AvailInfo]
- ns_map :: OccEnv Name
- emptyNameShape :: ModuleName -> NameShape
- mkNameShape :: ModuleName -> [AvailInfo] -> NameShape
- extendNameShape :: HscEnv -> NameShape -> [AvailInfo] -> IO (Either SDoc NameShape)
- nameShapeExports :: NameShape -> [AvailInfo]
- substNameShape :: NameShape -> Name -> Name
- maybeSubstNameShape :: NameShape -> Name -> Maybe Name
Documentation
NameShape | |
|
emptyNameShape :: ModuleName -> NameShape Source #
Create an empty NameShape
(i.e., the renaming that
would occur with an implementing module with no exports)
for a specific hole mod_name
.
mkNameShape :: ModuleName -> [AvailInfo] -> NameShape Source #
Create a NameShape
corresponding to an implementing
module for the hole mod_name
that exports a list of AvailInfo
s.
extendNameShape :: HscEnv -> NameShape -> [AvailInfo] -> IO (Either SDoc NameShape) Source #
Given an existing NameShape
, merge it with a list of AvailInfo
s
with Backpack style mix-in linking. This is used solely when merging
signatures together: we successively merge the exports of each
signature until we have the final, full exports of the merged signature.
What makes this operation nontrivial is what we are supposed to do when
we want to merge in an export for M.T when we already have an existing
export {H.T}. What should happen in this case is that {H.T} should be
unified with M.T
: we've determined a more *precise* identity for the
export at OccName
T
.
Note that we don't do unrestricted unification: only name holes from
ns_mod_name ns
are flexible. This is because we have a much more
restricted notion of shaping than in Backpack'14: we do shaping
*as* we do type-checking. Thus, once we shape a signature, its
exports are *final* and we're not allowed to refine them further,
nameShapeExports :: NameShape -> [AvailInfo] Source #
maybeSubstNameShape :: NameShape -> Name -> Maybe Name Source #
Like substNameShape
, but returns Nothing
if no substitution
works.