{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax #-}
module Data.Set.Unicode
( (∈), (∋), (∉), (∌)
, (∅)
, (∪), (∖), (∆), (∩)
, (⊆), (⊇), (⊈), (⊉)
, (⊂), (⊃), (⊄), (⊅)
) where
import Data.Bool ( Bool, not )
import Data.Function ( flip )
import Data.Ord ( Ord )
import Data.Eq.Unicode ( (≢) )
import Data.Bool.Unicode ( (∧) )
import Data.Set ( Set
, member, notMember
, empty
, union, difference, intersection
, isSubsetOf, isProperSubsetOf
)
infix 4 ∈
infix 4 ∋
infix 4 ∉
infix 4 ∌
infix 4 ⊆
infix 4 ⊇
infix 4 ⊈
infix 4 ⊉
infix 4 ⊂
infix 4 ⊃
infix 4 ⊄
infix 4 ⊅
infixl 6 ∪
infixr 6 ∩
infixl 9 ∖
infixl 9 ∆
(∈) ∷ Ord α ⇒ α → Set α → Bool
∈ :: α -> Set α -> Bool
(∈) = α -> Set α -> Bool
forall a. Ord a => a -> Set a -> Bool
member
{-# INLINE (∈) #-}
(∋) ∷ Ord α ⇒ Set α → α → Bool
∋ :: Set α -> α -> Bool
(∋) = (α -> Set α -> Bool) -> Set α -> α -> Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip α -> Set α -> Bool
forall a. Ord a => a -> Set a -> Bool
(∈)
{-# INLINE (∋) #-}
(∉) ∷ Ord α ⇒ α → Set α → Bool
∉ :: α -> Set α -> Bool
(∉) = α -> Set α -> Bool
forall a. Ord a => a -> Set a -> Bool
notMember
{-# INLINE (∉) #-}
(∌) ∷ Ord α ⇒ Set α → α → Bool
∌ :: Set α -> α -> Bool
(∌) = (α -> Set α -> Bool) -> Set α -> α -> Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip α -> Set α -> Bool
forall a. Ord a => a -> Set a -> Bool
(∉)
{-# INLINE (∌) #-}
(∅) ∷ Set α
∅ :: Set α
(∅) = Set α
forall a. Set a
empty
{-# INLINE (∅) #-}
(∪) ∷ Ord α ⇒ Set α → Set α → Set α
∪ :: Set α -> Set α -> Set α
(∪) = Set α -> Set α -> Set α
forall a. Ord a => Set a -> Set a -> Set a
union
{-# INLINE (∪) #-}
(∖) ∷ Ord α ⇒ Set α → Set α → Set α
∖ :: Set α -> Set α -> Set α
(∖) = Set α -> Set α -> Set α
forall a. Ord a => Set a -> Set a -> Set a
difference
{-# INLINE (∖) #-}
(∆) ∷ Ord α ⇒ Set α → Set α → Set α
Set α
a ∆ :: Set α -> Set α -> Set α
∆ Set α
b = (Set α
a Set α -> Set α -> Set α
forall a. Ord a => Set a -> Set a -> Set a
∖ Set α
b) Set α -> Set α -> Set α
forall a. Ord a => Set a -> Set a -> Set a
∪ (Set α
b Set α -> Set α -> Set α
forall a. Ord a => Set a -> Set a -> Set a
∖ Set α
a)
{-# INLINE (∆) #-}
(∩) ∷ Ord α ⇒ Set α → Set α → Set α
∩ :: Set α -> Set α -> Set α
(∩) = Set α -> Set α -> Set α
forall a. Ord a => Set a -> Set a -> Set a
intersection
{-# INLINE (∩) #-}
(⊆) ∷ Ord α ⇒ Set α → Set α → Bool
⊆ :: Set α -> Set α -> Bool
(⊆) = Set α -> Set α -> Bool
forall a. Ord a => Set a -> Set a -> Bool
isSubsetOf
{-# INLINE (⊆) #-}
(⊇) ∷ Ord α ⇒ Set α → Set α → Bool
⊇ :: Set α -> Set α -> Bool
(⊇) = (Set α -> Set α -> Bool) -> Set α -> Set α -> Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip Set α -> Set α -> Bool
forall a. Ord a => Set a -> Set a -> Bool
(⊆)
{-# INLINE (⊇) #-}
(⊈) ∷ Ord α ⇒ Set α → Set α → Bool
Set α
a ⊈ :: Set α -> Set α -> Bool
⊈ Set α
b = (Set α
a Set α -> Set α -> Bool
forall α. Eq α => α -> α -> Bool
≢ Set α
b) Bool -> Bool -> Bool
∧ (Set α
a Set α -> Set α -> Bool
forall a. Ord a => Set a -> Set a -> Bool
⊄ Set α
b)
{-# INLINE (⊈) #-}
(⊉) ∷ Ord α ⇒ Set α → Set α → Bool
Set α
a ⊉ :: Set α -> Set α -> Bool
⊉ Set α
b = (Set α
a Set α -> Set α -> Bool
forall α. Eq α => α -> α -> Bool
≢ Set α
b) Bool -> Bool -> Bool
∧ (Set α
a Set α -> Set α -> Bool
forall a. Ord a => Set a -> Set a -> Bool
⊅ Set α
b)
{-# INLINE (⊉) #-}
(⊂) ∷ Ord α ⇒ Set α → Set α → Bool
⊂ :: Set α -> Set α -> Bool
(⊂) = Set α -> Set α -> Bool
forall a. Ord a => Set a -> Set a -> Bool
isProperSubsetOf
{-# INLINE (⊂) #-}
(⊃) ∷ Ord α ⇒ Set α → Set α → Bool
⊃ :: Set α -> Set α -> Bool
(⊃) = (Set α -> Set α -> Bool) -> Set α -> Set α -> Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip Set α -> Set α -> Bool
forall a. Ord a => Set a -> Set a -> Bool
(⊂)
{-# INLINE (⊃) #-}
(⊄) ∷ Ord α ⇒ Set α → Set α → Bool
Set α
a ⊄ :: Set α -> Set α -> Bool
⊄ Set α
b = Bool -> Bool
not (Set α
a Set α -> Set α -> Bool
forall a. Ord a => Set a -> Set a -> Bool
⊂ Set α
b)
{-# INLINE (⊄) #-}
(⊅) ∷ Ord α ⇒ Set α → Set α → Bool
Set α
a ⊅ :: Set α -> Set α -> Bool
⊅ Set α
b = Bool -> Bool
not (Set α
a Set α -> Set α -> Bool
forall a. Ord a => Set a -> Set a -> Bool
⊃ Set α
b)
{-# INLINE (⊅) #-}