hset-2.2.0: Primitive list with elements of unique types.

Safe HaskellNone
LanguageHaskell2010

Data.HSet.SubHSet

Synopsis

Documentation

class SubHSet els els2 where Source

Takes subset of some hset, including subset of same elements in different order

>>> let x = (HSCons "hello" $ HSCons 1234 $ HSCons 12.123 HSNil) :: HSet '[String, Int, Double]
>>> subHSet x :: HSet '[Double, Int]
HSCons (12.123) (HSCons (1234) (HSNil))
>>> subHSet x :: HSet '[String, Double]
HSCons ("hello") (HSCons (12.123) (HSNil))
>>> subHSet x :: HSet '[Int, String]
HSCons (1234) (HSCons ("hello") (HSNil))

Methods

subHSet :: HSet els -> HSet els2 Source

Instances

SubHSet els ([] *) Source 
(HGettable els el, NotElem * el els2, SubHSet els els2) => SubHSet els ((:) * el els2) Source 

hnarrow :: SubHSettable els subels => proxy subels -> HSet els -> HSet subels Source

Like subHSet but with proxy for convenience

>>> let x = (HSCons "hello" $ HSCons 123 $ HSCons 345 HSNil) :: HSet '[String, Int, Integer]
>>> hnarrow (Proxy :: Proxy '[]) x
HSNil
>>> hnarrow (Proxy :: Proxy '[String]) x
HSCons ("hello") (HSNil)
>>> hnarrow (Proxy :: Proxy '[Int, Integer]) x
HSCons (123) (HSCons (345) (HSNil))
>>> hnarrow (Proxy :: Proxy '[Integer, Int]) x
HSCons (345) (HSCons (123) (HSNil))