| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Unison.DeclNameLookup
Synopsis
- data DeclNameLookup = DeclNameLookup {
- constructorToDecl :: !(Map Name Name)
- declToConstructors :: !(Map Name [Name])
- empty :: DeclNameLookup
- expectDeclName :: HasCallStack => DeclNameLookup -> Name -> Name
- expectConstructorNames :: HasCallStack => DeclNameLookup -> Name -> [Name]
Documentation
data DeclNameLookup Source #
A lookup from decl-to-constructor name and vice-versa.
For example, a type decl like
unique type Foo = Bar Int | Baz.Qux Nat Nat
is represented as
DeclNameLookup
{ constructorToDecl = Map.fromList [(Foo.Bar, Foo), (Foo.Baz.Qux, Foo)]
, declToConstructors = Map.fromList [(Foo, [Foo.Bar, Foo.Baz.Qux])]
}
Note that:
- Constructor names are given "in full", though they will all necessarily begin with the decl's name.
- In
declToConstructors, the constructor names are given in their canonical ordering.
Constructors
| DeclNameLookup | |
Fields
| |
Instances
expectDeclName :: HasCallStack => DeclNameLookup -> Name -> Name Source #
expectConstructorNames :: HasCallStack => DeclNameLookup -> Name -> [Name] Source #