Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
Given a sum type data A = X | Y, how do you qualify the constructor X in relation to a value y = Y? uninhabited?
data A = X | Y
X
y = Y
"different tag"? :D
never thought about how to refer to X in this situation :thinking:
you're doing too little type level magic!
maybe something like chosen and not chosen
for A + (B + (C + ..., inl would always refer to an inhabited constructor, but the last element would be an inr, so that doesn' work either :oh_no:
A + (B + (C + ...
inl
inr
inhabited is confusing to me because it usually refers to types, not terms
maybe "(un)reachable"?
I guess it's like asking about "foo" in relation to bar = "bar" - maybe it's simply "different value" or "unequal"?
"foo"
bar = "bar"
Georgi Lyubenov // googleson78 said:
you could think of the sum type as a universe and the constructors as its types :sweat_smile:
so my use case is that I do an iteration over the constructors with Generic with a value at hand, executing different operations based on whether the value is of the given constructor.
Generic
Given a sum type
data A = X | Y
, how do you qualify the constructorX
in relation to a valuey = Y
? uninhabited?"different tag"? :D
never thought about how to refer to X in this situation :thinking:
you're doing too little type level magic!
maybe something like chosen and not chosen
for
A + (B + (C + ...
,inl
would always refer to an inhabited constructor, but the last element would be aninr
, so that doesn' work either :oh_no:inhabited is confusing to me because it usually refers to types, not terms
maybe "(un)reachable"?
I guess it's like asking about
"foo"
in relation tobar = "bar"
- maybe it's simply "different value" or "unequal"?Georgi Lyubenov // googleson78 said:
you could think of the sum type as a universe and the constructors as its types :sweat_smile:
so my use case is that I do an iteration over the constructors with
Generic
with a value at hand, executing different operations based on whether the value is of the given constructor.