You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In working on purescript-elm, I've come across two cases in which pattern synonyms would be nice (if I'm understanding correctly what pattern synonyms would be -- here's a reference to an older issue, called "Constructor alias" #1438).
Ordinarily, I'd want to implement Result as an alias for Either, and then write whatever functions are needed to wrap the API differences. However, it's not really possible to alias the constructors. (I know I can now have operator aliases for the constructors, and even use them in pattern matching (#1890), which is neat, but doesn't allow for Ok and Err). So, I end up re-implementing the whole thing (basically copying the code for Either and renaming the constructors).
The other case is Elm's Date type. Like Data.Date, it has an type for enumerating the days of the week. Now, they are named differently -- Day in Elm vs. DayOfWeek in Purescript. Of course, I can alias Day to mean DayOfWeek easily enough. However, the Elm constructors are abbreviated ... i.e. Mon, Tue, Wed vs. Monday, Tuesday, Wednesday in Data.Date. Without pattern synonyms (or constructor aliases), I don't think there's anything I can do about that.
So, those are cases in which I would have found pattern synonyms (or constructor aliases) to be helpful.
No description provided.
The text was updated successfully, but these errors were encountered: