declareDatatypes function

Map<String, DatatypeInfo> declareDatatypes(
  1. Map<String, Iterable<Constructor>> datatypes
)

Declare mutually recursive datatypes given a map from their name to their constructors.

Implementation

Map<String, DatatypeInfo> declareDatatypes(
  Map<String, Iterable<Constructor>> datatypes,
) =>
    currentContext
        .declareDatatypes(datatypes.map(
          (key, value) => MapEntry(
            Sym(key),
            value.toList(),
          ),
        ))
        .map((key, value) => MapEntry((key as StringSym).value, value));