{-# LANGUAGE UnicodeSyntax #-}

module Data.Set.Unicode
    {-# DEPRECATED "Use the package containers-unicode-symbols instead" #-}
    ( (∈), (∉)
    , (∅)
    , (∪), (∩)
    , (⊆), (⊇), (⊈), (⊉)
    , (⊂), (⊃), (⊄), (⊅)
    ) where

import Prelude.Unicode ( (≢), (∧) )
import Data.Set ( Set
                , member, notMember
                , empty
                , union, intersection
                , isSubsetOf, isProperSubsetOf
                )

{- |
(∈) = 'member'

U+2208, ELEMENT OF
-}
(∈) ∷ Ord α ⇒ α → Set α → Bool
(∈) = member

{- |
(∉) = 'notMember'

U+2209, NOT AN ELEMENT OF
-}
(∉) ∷ Ord α ⇒ α → Set α → Bool
(∉) = notMember

{- |
(∅) = 'empty'

U+2205, EMPTY SET
-}
(∅) ∷ Set α
(∅) = empty

{- |
(∪) = 'union'

U+222A, UNION
-}
(∪) ∷ Ord α ⇒ Set α → Set α → Set α
(∪) = union

{- |
(∩) = 'intersection'

U+2229, INTERSECTION
-}
(∩) ∷ Ord α ⇒ Set α → Set α → Set α
(∩) = intersection

{- |
(⊆) = 'isSubsetOf'

U+2286, SUBSET OF OR EQUAL TO
-}
(⊆) ∷ Ord α ⇒ Set α → Set α → Bool
(⊆) = isSubsetOf

{- |
(⊇) = 'flip' (⊆)

U+2287, SUPERSET OF OR EQUAL TO
-}
(⊇) ∷ Ord α ⇒ Set α → Set α → Bool
(⊇) = flip (⊆)

{- |
x ⊈ y = (x ≢ y) ∧ (x ⊄ y)

U+2288, NEITHER A SUBSET OF NOR EQUAL TO
-}
(⊈) ∷ Ord α ⇒ Set α → Set α → Bool
x ⊈ y = (x ≢ y) ∧ (x ⊄ y)

{- |
x ⊉ y = (x ≢ y) ∧ (x ⊅ y)

U+2289, NEITHER A SUPERSET OF NOR EQUAL TO
-}
(⊉) ∷ Ord α ⇒ Set α → Set α → Bool
x ⊉ y = (x ≢ y) ∧ (x ⊅ y)

{- |
(⊂) = 'isProperSubsetOf'

U+2282, SUBSET OF
-}
(⊂) ∷ Ord α ⇒ Set α → Set α → Bool
(⊂) = isProperSubsetOf

{- |
(⊃) = 'flip' (⊂)

U+2283, SUPERSET OF
-}
(⊃) ∷ Ord α ⇒ Set α → Set α → Bool
(⊃) = flip (⊂)

{- |
x ⊄ y = 'not' (x ⊂ y)

U+2284, NOT A SUBSET OF
-}
(⊄) ∷ Ord α ⇒ Set α → Set α → Bool
x ⊄ y = not (x ⊂ y)

{- |
x ⊅ y = 'not' (x ⊃ y)

U+2285, NOT A SUPERSET OF
-}
(⊅) ∷ Ord α ⇒ Set α → Set α → Bool
x ⊅ y = not (x ⊃ y)