Re: How to user-define a type equality constraint?
Richard Eisenberg <[email protected]> Tue, 6 Apr 2021 13:24:01 +0000
| Newsgroups | gmane.comp.lang.haskell.glasgow.user |
|---|---|
| Message-ID | <010f0178a75ab0dd-4c206cc7-830e-428e-95eb-3447a03cfc29-000000@us-east-2.amazonses.com> |
> On Apr 6, 2021, at 7:44 AM, Anthony Clayden <[email protected]> wrote: > > > But why does this matter? > > Because I want the semantics of that equality constraint, without switching on any of these, which I don't otherwise use: > > GADTs > TypeFamilies > TypeOperators > > And if that means I can't use infix `~` in my constraints, I'll put up with that. (I'd user-define a conventional class, say `TypeCast`. Could be that has to be defined in terms of `~`, in which case I'd put that in a shim module as the only place with those extensions.) > A shim module would work for you here, indeed. Individuals' opinions of extensions will differ, but TypeOperators is much less powerful than either of the others: it affects only parsing, and in a fully backward-compatible way. Richard _______________________________________________ Glasgow-haskell-users mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users