| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.HSet.Get
Documentation
class (i ~ Index e els) => HGet els e i | els i -> e where Source
Heterogeneous read arbitrarily element from hset
>>>let x = HSCons (10 :: Int) $ HSCons (20 :: Double) HSNil>>>xHSCons (10) (HSCons (20.0) (HSNil))
>>>hget x :: Int10
>>>hget x :: Double20.0
Note that hget takes specific element from list of uniquely typed
elements depending on what type is required to be returned (return
type polymorphism)
type HGettable els e = HGet els e (Index e els) Source
Enables deriving of the fact that e is contained within els and it's
safe to say that hget can be performed on this particular pair.
hgetTagged :: forall proxy label e els. HGettable els (Tagged label e) => proxy label -> HSet els -> e Source
>>>let y = HSCons (Tagged 10 :: Tagged "x" Int) $ HSCons (Tagged 20 :: Tagged "y" Int) HSNil>>>yHSCons (Tagged 10) (HSCons (Tagged 20) (HSNil))
>>>hgetTagged (Proxy :: Proxy "x") y :: Int10
>>>hgetTagged (Proxy :: Proxy "y") y :: Int20