I have definitions:
newtype SelState a = SelState
{ persistent :: a
, transient :: a
}
data π = None | Primary | Secondary
If I define a function by (perhaps unidiomatic) pattern-matching as follows:
selClass :: SelState π -> String
selClass (SelState { persistent: Primary }) = css.sel.selected
selClass (SelState { transient: Primary }) = spy "selClass: " identity css.sel.selected_transient
selClass (SelState { persistent: Secondary }) = css.sel.selected_secondary
selClass (SelState { transient: Secondary }) = css.sel.selected_secondary_transient
selClass _ = ""
then the esbuild
backend (v. 0.15.1) generates the following JavaScript:
var selClass = (v) => {
if (v.persistent.tag === "Primary") {
return css.sel.selected;
}
if (v.persistent.tag === "Secondary") {
return css.sel.selected_secondary;
}
return "";
};
which doesnβt deal with the transient
case. Is this a bug, and if so is it in the back end or front end? (So I know where to file a bug report if necessary.)
thanks,
Roly