Skip to content

Respect the identity of variables #1545

@ttuegel

Description

@ttuegel

In Kore.Syntax.Variable, we have this definition of a variable:

data Variable = Variable
    { variableName :: !Id
    , variableCounter :: !(Maybe (Sup Natural))
    , variableSort :: !Sort
    }

Eq and Ord are defined as if this is a value type (in domain-driven design terminology). In fact, if the variableName and variableCounter of two variables are the same, they are regarded as the same variable; then if their variableSort differs, they are not different, but inconsistent. That is, Variable should be an entity type (domain-driven design terminology again) whose unique identifier is the combination of variableName and variableCounter.

If we move variableSort out of Variable, then FreshPartialOrd (introduced in #1539) becomes a simple upper semilattice. Alternatively, we might combine variableName and variableCounter into a VariableName type, and define an upper semilattice on this type only (instead of a class) and provide optics for renaming other variable types.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions