containers: intersections for Set, along with Semigroup newtype

Sven Panne svenpanne at gmail.com
Sun Dec 6 18:50:13 UTC 2020


Am So., 6. Dez. 2020 um 07:20 Uhr schrieb Reed Mullanix <
reedmullanix at gmail.com>:

> [...]
>   intersections :: Ord a => NonEmpty (Set a) -> Set a
>   intersections (s :| ss) = Foldable.foldl' intersection s ss
> [...]
>

Why NonEmpty? I would expect "intersections [] = Set.empty", because the
result contains all the elements which are in all sets, i.e. none. That's
at least my intuition, is there some law which this would violate?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20201206/aa1a6433/attachment.html>


More information about the Libraries mailing list