[ refactor ] make Data.List.Base.[_] a pattern synonym - #3095
[ refactor ] make Data.List.Base.[_] a pattern synonym#3095jamesmckinna wants to merge 3 commits into
Data.List.Base.[_] a pattern synonym#3095Conversation
|
Should we also do it in other places where it's a constructor? E.g. |
|
Yes, but doing this for |
|
Were we to do this, should it be one giant PR, or a bunch of smaller ones? I am all in favour of explicit (On naming, I left a comment / question on #3073 about that.) |
|
|
||
| [_] : A → List A | ||
| [ x ] = x ∷ [] | ||
| pure : A → List A |
There was a problem hiding this comment.
I would much prefer singleton.
As previously discussed, eg. #3073 (comment) .
The surprising thing is that I had expected this to break a lot of code, but... it doesn't, and those breakages arise from ambiguity of the name
pure, ... so one solution would be not to introduce that name for the function-associated-with-the-pattern-synonym.Another is to do a another round of more invasive weeding of
imports in favour of qualified imports, and avoidinghidingdirectives. Currently, this PR does the bare minimum necessary (actually, it might be sufficient to do even slightly less... ;-))Other similar definitions presumably falls to a corresponding analysis: (thanks to @gallais for the prompt)
Data.Vec.Base.[_]Data.List.NonEmpty.Base.[_]Data.List.Fresh.NonEmpty.[_](is this replaceable with a pattern synonym?)Data.DifferenceList.Base.[_](this probably should only be replaced by asyntaxdeclaration)