Ref the DependentHaskell proposals to collapse together types and terms, consider …
data Labelled a = Label{unLabel :: a } deriving (Show, Eq)
xl = Label "xl"
foo unLabel = xl{unLabel = unLabel}
In the binding for foo, the unLabel to the right of = is a common-or-garden term variable. The unLabel to the left of embraced { ... = ... }:
- is distinct from the term variable: there’s no confusion.
- is distinct from the automatically-created accessor function
unLabel :: Labelled a -> a– which is in termspace, and gets shadowed by the formal parameter tofooof the same name. - is declared in (brought into scope by)
Label{unLabel :: a}.
So:
- Which namespace is
unLabel = ...in? - Is it a variable or a constant? (I suspect it’s a constant, but then why does it start lower case?) [
] [
] - The Dependentistas want every name to have a unique quantification point. Then: where is that quantifier, and which quantifier is it?
[
] To show that it’s a constant, and is distinct from the accessor function (which as of 9.2 can be suppressed), could we spell it Upper case?, with the field selector still lower case.
[
] For comparison, Type Families/functions are not constants/constructors, but do start Upper case. So this is presumably to be consistently inconsistent (or do I mean inconsistently consistent?).