Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.HSet.SubHSet
- class SubHSet els els2 where
- type SubHSettable = SubHSet
- hnarrow :: SubHSettable els subels => proxy subels -> HSet els -> HSet subels
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))
type SubHSettable = SubHSet 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))