Related: https://www.haskellforall.com/2021/02/folds-are-constructor-substitution.html
I don’t see why to disallow // on NonEmpty. Sure it will never return the default case, but that’s fine.
//
There might be no mathematical reason to exclude it, but using (// dfault) instead of head for a NonEmpty would make me stop and question whether I or the author misunderstood what it would do.
(// dfault)
head
If they know they have a NonEmpty, sure, but since it’s a polymorphic operator I would expect it to sometimes be used in a polymorphic context.
Related: https://www.haskellforall.com/2021/02/folds-are-constructor-substitution.html
I don’t see why to disallow
//
on NonEmpty. Sure it will never return the default case, but that’s fine.There might be no mathematical reason to exclude it, but using
(// dfault)
instead ofhead
for a NonEmpty would make me stop and question whether I or the author misunderstood what it would do.If they know they have a NonEmpty, sure, but since it’s a polymorphic operator I would expect it to sometimes be used in a polymorphic context.