
Intersection is a lattice operation, whose identity element is the "whole universe" not the empty set. Imagine if we had an intersections :: [Set a] -> Set a we would expect it have the law intersections (a ++ b) = (intersections a) `intersect` (intersections b) now let b be [] and aa == intersections a, and we get aa == aa `intersect` (intersections []) and this must hold for all aa, which is impossible unless we have some kind of universe set. David -- David Casperson, PhD, R.P., | David.Casperson@unbc.ca Associate Professor and Chair, | (250) 960-6672 Fax 960-5544 Computer Science | 3333 University Way University of Northern British Columbia | Prince George, BC V2N 4Z9 | CANADA Sven Panne, on 2020-12-06, you wrote:
From: Sven Panne
To: Reed Mullanix Date: Sun, 6 Dec 2020 10:50:13 Cc: Haskell Libraries Subject: Re: containers: intersections for Set, along with Semigroup newtype Message-ID: CAUTION: This email is not from UNBC. Avoid links and attachments. Don't buy gift cards.
Am So., 6. Dez. 2020 um 07:20 Uhr schrieb Reed Mullanix
: [...] 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?
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries