{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax #-} {-| Module : Data.IntSet.Unicode Copyright : 2009–2012 Roel van Dijk License : BSD3 (see the file LICENSE) Maintainer : Roel van Dijk <vandijk.roel@gmail.com> -} module Data.IntSet.Unicode ( (∈), (∋), (∉), (∌) , (∅) , (∪), (∖), (∆), (∩) , (⊆), (⊇), (⊈), (⊉) , (⊂), (⊃), (⊄), (⊅) ) where ------------------------------------------------------------------------------- -- Imports ------------------------------------------------------------------------------- -- from base: import Data.Bool ( Bool, not ) import Data.Function ( flip ) import Data.Int ( Int ) -- from base-unicode-symbols: import Data.Eq.Unicode ( (≢) ) import Data.Bool.Unicode ( (∧) ) -- from containers: import Data.IntSet ( IntSet , member, notMember , empty , union, difference, intersection , isSubsetOf, isProperSubsetOf ) ------------------------------------------------------------------------------- -- Fixities ------------------------------------------------------------------------------- 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 ∆ ------------------------------------------------------------------------------- -- Symbols ------------------------------------------------------------------------------- {-| (∈) = 'member' U+2208, ELEMENT OF -} (∈) ∷ Int → IntSet → Bool (∈) = member {-# INLINE (∈) #-} {-| (∋) = 'flip' (∈) U+220B, CONTAINS AS MEMBER -} (∋) ∷ IntSet → Int → Bool (∋) = flip (∈) {-# INLINE (∋) #-} {-| (∉) = 'notMember' U+2209, NOT AN ELEMENT OF -} (∉) ∷ Int → IntSet → Bool (∉) = notMember {-# INLINE (∉) #-} {-| (∌) = 'flip' (∉) U+220C, DOES NOT CONTAIN AS MEMBER -} (∌) ∷ IntSet → Int → Bool (∌) = flip (∉) {-# INLINE (∌) #-} {-| (∅) = 'empty' U+2205, EMPTY SET -} (∅) ∷ IntSet (∅) = empty {-# INLINE (∅) #-} {-| (∪) = 'union' U+222A, UNION -} (∪) ∷ IntSet → IntSet → IntSet (∪) = union {-# INLINE (∪) #-} {-| (∖) = 'difference' U+2216, SET MINUS -} (∖) ∷ IntSet → IntSet → IntSet (∖) = difference {-# INLINE (∖) #-} {-| Symmetric difference a ∆ b = (a ∖ b) ∪ (b ∖ a) U+2206, INCREMENT -} (∆) ∷ IntSet → IntSet → IntSet a ∆ b = (a ∖ b) ∪ (b ∖ a) {-# INLINE (∆) #-} {-| (∩) = 'intersection' U+2229, INTERSECTION -} (∩) ∷ IntSet → IntSet → IntSet (∩) = intersection {-# INLINE (∩) #-} {-| (⊆) = 'isSubsetOf' U+2286, SUBSET OF OR EQUAL TO -} (⊆) ∷ IntSet → IntSet → Bool (⊆) = isSubsetOf {-# INLINE (⊆) #-} {-| (⊇) = 'flip' (⊆) U+2287, SUPERSET OF OR EQUAL TO -} (⊇) ∷ IntSet → IntSet → Bool (⊇) = flip (⊆) {-# INLINE (⊇) #-} {-| a ⊈ b = (a ≢ b) ∧ (a ⊄ b) U+2288, NEITHER A SUBSET OF NOR EQUAL TO -} (⊈) ∷ IntSet → IntSet → Bool a ⊈ b = (a ≢ b) ∧ (a ⊄ b) {-# INLINE (⊈) #-} {-| a ⊉ b = (a ≢ b) ∧ (a ⊅ b) U+2289, NEITHER A SUPERSET OF NOR EQUAL TO -} (⊉) ∷ IntSet → IntSet → Bool a ⊉ b = (a ≢ b) ∧ (a ⊅ b) {-# INLINE (⊉) #-} {-| (⊂) = 'isProperSubsetOf' U+2282, SUBSET OF -} (⊂) ∷ IntSet → IntSet → Bool (⊂) = isProperSubsetOf {-# INLINE (⊂) #-} {-| (⊃) = 'flip' (⊂) U+2283, SUPERSET OF -} (⊃) ∷ IntSet → IntSet → Bool (⊃) = flip (⊂) {-# INLINE (⊃) #-} {-| a ⊄ b = 'not' (a ⊂ b) U+2284, NOT A SUBSET OF -} (⊄) ∷ IntSet → IntSet → Bool a ⊄ b = not (a ⊂ b) {-# INLINE (⊄) #-} {-| a ⊅ b = 'not' (a ⊃ b) U+2285, NOT A SUPERSET OF -} (⊅) ∷ IntSet → IntSet → Bool a ⊅ b = not (a ⊃ b) {-# INLINE (⊅) #-}