-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Heterogenous Sets -- -- HtsSet is a Heterogenous Set wich can provide storing values with -- different type. @package htssets @version 0.2.0.0 -- | HtsCSet is a Heterogenous Set wich can provide storing values with -- different and constrained type. -- -- These modules are intended to be imported qualified, to avoid name -- clashes with Prelude functions, e.g. -- --
-- import qualified Data.HtsCSet as HCSet --module Data.HtsCSet data HtsCSet c -- | The empty HtsCSet empty :: HtsCSet c -- | The empty HtsCSet with proxy emptyP :: proxy c -> HtsCSet c -- | A HtsCSet with an element singleton :: forall c a. (Typeable a, c a) => a -> HtsCSet c -- | A HtsCSet with an element with proxy singletonP :: forall proxy c a. (Typeable a, c a) => proxy c -> a -> HtsCSet c -- | Is the HtsCSet is empty? -- --
-- null empty == True -- null (singleton "a") == False --null :: HtsCSet c -> Bool -- | The number of elements in the HtsSet -- --
-- size empty == 0 -- size (singleton "a") == 1 --size :: HtsCSet c -> Int -- | The HtsSet is contain an element? -- --
-- member (Proxy :: Proxy String) empty == False -- member (Proxy :: Proxy String) (singleton "a") == True --member :: forall proxy c a. (Typeable a, Eq a, c a) => a -> HtsCSet c -> Bool -- | The HtsSet is not contain an element? notMember :: forall proxy c a. (Typeable a, Eq a, c a) => a -> HtsCSet c -> Bool -- | The HtsCSet is contain a same type of element? -- --
-- let hs = insert "a" $ insert (2 :: Int) $ insert 'c' $ empty -- existTypeOf "string" hs == True --existTypeOf :: forall c a. (Typeable a, c a) => a -> HtsCSet c -> Bool -- | The HtsCSet is contain a same type of element? (by proxy) existTypeOfP :: forall proxy c a. (Typeable a, c a) => proxy a -> HtsCSet c -> Bool -- | The HtsCSet is contain a same type of element? (by fixed proxy) existTypeOfP' :: forall c a. (Typeable a, c a) => Proxy a -> HtsCSet c -> Bool -- | Apply a function to an element with a default value -- --
-- appl "no ABC" (:"BC") $ singleton 'A' == "ABC" -- appl "no ABC" (:"BC") $ singleton "s" == "no ABC" --appl :: forall a b c. (Typeable a, c a) => b -> (a -> b) -> HtsCSet c -> b -- | appl specialization compliance :: forall a c. (Typeable a, c a) => Bool -> (a -> Bool) -> HtsCSet c -> Bool -- | Insert a new value in the HtsCSet. If the a elem is already present in -- the HtsCSet with type, the associated value is replaced with the -- supplied value -- --
-- insert "a" $ insert (2 :: Int) $ insert 'c' $ empty --insert :: forall c a. (Typeable a, c a) => a -> HtsCSet c -> HtsCSet c -- | Lookup a value from in the HtsCSet -- --
-- let hs = insert "a" $ insert (2 :: Int) $ insert 'c' $ empty -- lookup hs == Just "a" -- lookup hs == Just (2 :: Int) -- but -- lookup hs == Just 2 -- is False! Because the type of 2 is Num t => t not Int --lookup :: forall c a. (Typeable a, c a) => HtsCSet c -> Maybe a -- | Lookup a value from in the HtsCSet with a default value lookupWithDefault :: forall c a. (Typeable a, c a) => a -> HtsCSet c -> a -- | Update a value in HtsCSet -- --
-- let hs = insert "a" $ insert (2 :: Int) $ insert 'c' $ empty -- let hs' = update (++"b") hs -- lookup hs' == Just "ab" --update :: forall c a. (Typeable a, c a) => (a -> a) -> HtsCSet c -> HtsCSet c -- | Delete an element by type -- --
-- (member 'c' $ deleteByType 'b' $ singleton 'c') == False --deleteByType :: forall a c. (Typeable a, c a) => a -> HtsCSet c -> HtsCSet c -- | Delete an element by type (by proxy) -- --
-- (member 'c' $ deleteByTypeP (Proxy :: Proxy Char) $ singleton 'c') == False --deleteByTypeP :: forall proxy c a. (Typeable a, c a) => proxy a -> HtsCSet c -> HtsCSet c -- | Delete an element by type (by fixed proxy) deleteByTypeP' :: forall a c. (Typeable a, c a) => Proxy a -> HtsCSet c -> HtsCSet c -- | Delete an element by condition deleteWhen :: forall a c. (Typeable a, c a) => (a -> Bool) -> HtsCSet c -> HtsCSet c -- | Helper heterogeneous list for comfortable HtsSet building (with append -- and fill) -- --
-- let hs = fill ("a" :+ 'c' :+ True :+ ())
-- lookup (hs :: HtsCSet Show) == Just 'c'
-- use () to close the list
-- lookup (hs :: HtsCSet Show) == Just () -- is False!
-- let hs' = fill ("a" :+ 'c' :+ True :+ () :+ ())
-- lookup (hs' :: HtsCSet Show) == Just () -- is Ok
--
data a :+ b
(:+) :: a -> b -> (:+) a b
infixr 5 :+
infixr 5 :+
class Append c a
append :: Append c a => a -> HtsCSet c -> HtsCSet c
fill :: Append c a => a -> HtsCSet c
-- | Proxy is a type that holds no data, but has a phantom parameter
-- of arbitrary type (or even kind). Its use is to provide type
-- information, even though there is no value available of that type (or
-- it may be too costly to create one).
--
-- Historically, Proxy :: Proxy a is a safer
-- alternative to the 'undefined :: a' idiom.
--
-- -- >>> Proxy :: Proxy (Void, Int -> Int) -- Proxy ---- -- Proxy can even hold types of higher kinds, -- --
-- >>> Proxy :: Proxy Either -- Proxy ---- --
-- >>> Proxy :: Proxy Functor -- Proxy ---- --
-- >>> Proxy :: Proxy complicatedStructure -- Proxy --data Proxy (t :: k) :: forall k. () => k -> Type Proxy :: Proxy instance (Data.Typeable.Internal.Typeable a, c a, Data.HtsCSet.Append c b) => Data.HtsCSet.Append c (a Data.HtsCSet.:+ b) instance Data.HtsCSet.Append c () -- | HtsSet is a Heterogenous Set wich can provide storing values with -- different type. -- -- These modules are intended to be imported qualified, to avoid name -- clashes with Prelude functions, e.g. -- --
-- import qualified Data.HtsSet as HSet --module Data.HtsSet data HtsSet -- | The empty HtsSet empty :: HtsSet -- | A HtsSet with an element singleton :: forall a. Typeable a => a -> HtsSet -- | Is the HtsSet is empty? -- --
-- null empty == True -- null (singleton "a") == False --null :: HtsSet -> Bool -- | The number of elements in the HtsSet -- --
-- size empty == 0 -- size (singleton "a") == 1 --size :: HtsSet -> Int -- | The HtsSet is contain an element? -- --
-- member (Proxy :: Proxy String) empty == False -- member (Proxy :: Proxy String) (singleton "a") == True --member :: forall proxy a. (Typeable a, Eq a) => a -> HtsSet -> Bool -- | The HtsSet is not contain an element? notMember :: forall proxy a. (Typeable a, Eq a) => a -> HtsSet -> Bool -- | The HtsSet is contain a same type of element? -- --
-- let hs = insert "a" $ insert (2 :: Int) $ insert 'c' $ empty -- existTypeOf "string" hs == True --existTypeOf :: forall a. Typeable a => a -> HtsSet -> Bool -- | The HtsSet is contain a same type of element? (by proxy) existTypeOfP :: forall proxy a. Typeable a => proxy a -> HtsSet -> Bool -- | The HtsSet is contain a same type of element? (by fixed proxy) existTypeOfP' :: forall a. Typeable a => Proxy a -> HtsSet -> Bool -- | Apply a function to an element with a default value -- --
-- appl "no ABC" (:"BC") $ singleton 'A' == "ABC" -- appl "no ABC" (:"BC") $ singleton "s" == "no ABC" --appl :: forall a b. Typeable a => b -> (a -> b) -> HtsSet -> b -- | appl specialization compliance :: forall a. Typeable a => Bool -> (a -> Bool) -> HtsSet -> Bool -- | Insert a new value in the HtsSet. If the a elem is already present in -- the HtsSet with type, the associated value is replaced with the -- supplied value -- --
-- insert "a" $ insert (2 :: Int) $ insert 'c' $ empty --insert :: forall a. Typeable a => a -> HtsSet -> HtsSet -- | Lookup a value from in the HtsSet -- --
-- let hs = insert "a" $ insert (2 :: Int) $ insert 'c' $ empty -- lookup hs == Just "a" -- lookup hs == Just (2 :: Int) -- but -- lookup hs == Just 2 -- is False! Because the type of 2 is Num t => t not Int --lookup :: forall a. Typeable a => HtsSet -> Maybe a -- | Lookup a value from in the HtsSet with a default value lookupWithDefault :: forall a. Typeable a => a -> HtsSet -> a -- | Update a value in HtsSet -- --
-- let hs = insert "a" $ insert (2 :: Int) $ insert 'c' $ empty -- let hs' = update (++"b") hs -- lookup hs' == Just "ab" --update :: forall a. Typeable a => (a -> a) -> HtsSet -> HtsSet -- | Delete an element by type -- --
-- (member 'c' $ deleteByType 'b' $ singleton 'c') == False --deleteByType :: forall a. Typeable a => a -> HtsSet -> HtsSet -- | Delete an element by type (by proxy) -- --
-- (member 'c' $ deleteByTypeP (Proxy :: Proxy Char) $ singleton 'c') == False --deleteByTypeP :: forall proxy a. Typeable a => proxy a -> HtsSet -> HtsSet -- | Delete an element by type (by fixed proxy) deleteByTypeP' :: forall a. Typeable a => Proxy a -> HtsSet -> HtsSet -- | Delete an element by condition deleteWhen :: forall a. Typeable a => (a -> Bool) -> HtsSet -> HtsSet -- | Helper heterogeneous list for comfortable HtsSet building (with append -- and fill) -- --
-- let hs = fill ("a" :+ 'c' :+ True :+ ())
-- lookup hs == Just 'c'
-- use () to close the list
-- lookup hs == Just () -- is False!
-- let hs' = fill ("a" :+ 'c' :+ True :+ () :+ ())
-- lookup hs' == Just () -- is Ok
--
data a :+ b
(:+) :: a -> b -> (:+) a b
infixr 5 :+
infixr 5 :+
class Append a
append :: Append a => a -> HtsSet -> HtsSet
fill :: Append a => a -> HtsSet
-- | Proxy is a type that holds no data, but has a phantom parameter
-- of arbitrary type (or even kind). Its use is to provide type
-- information, even though there is no value available of that type (or
-- it may be too costly to create one).
--
-- Historically, Proxy :: Proxy a is a safer
-- alternative to the 'undefined :: a' idiom.
--
-- -- >>> Proxy :: Proxy (Void, Int -> Int) -- Proxy ---- -- Proxy can even hold types of higher kinds, -- --
-- >>> Proxy :: Proxy Either -- Proxy ---- --
-- >>> Proxy :: Proxy Functor -- Proxy ---- --
-- >>> Proxy :: Proxy complicatedStructure -- Proxy --data Proxy (t :: k) :: forall k. () => k -> Type Proxy :: Proxy instance (Data.Typeable.Internal.Typeable a, Data.HtsSet.Append b) => Data.HtsSet.Append (a Data.HtsSet.:+ b) instance Data.HtsSet.Append ()