Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data DeclNameLookup = DeclNameLookup {
- constructorToDecl :: !(Map Name Name)
- declToConstructors :: !(Map Name [Name])
- 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.
DeclNameLookup | |
|
Instances
Semigroup DeclNameLookup Source # | |
Defined in Unison.DeclNameLookup (<>) :: DeclNameLookup -> DeclNameLookup -> DeclNameLookup # sconcat :: NonEmpty DeclNameLookup -> DeclNameLookup # stimes :: Integral b => b -> DeclNameLookup -> DeclNameLookup # | |
Generic DeclNameLookup Source # | |
Defined in Unison.DeclNameLookup type Rep DeclNameLookup :: Type -> Type # from :: DeclNameLookup -> Rep DeclNameLookup x # to :: Rep DeclNameLookup x -> DeclNameLookup # | |
type Rep DeclNameLookup Source # | |
Defined in Unison.DeclNameLookup type Rep DeclNameLookup = D1 ('MetaData "DeclNameLookup" "Unison.DeclNameLookup" "unison-core1-0.0.0-6SyLKzwOxrt37WukuFZrYQ" 'False) (C1 ('MetaCons "DeclNameLookup" 'PrefixI 'True) (S1 ('MetaSel ('Just "constructorToDecl") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map Name Name)) :*: S1 ('MetaSel ('Just "declToConstructors") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map Name [Name])))) |
expectDeclName :: HasCallStack => DeclNameLookup -> Name -> Name Source #
expectConstructorNames :: HasCallStack => DeclNameLookup -> Name -> [Name] Source #