auxiliary view functions for heap lookups
This commit is contained in:
@@ -8,6 +8,8 @@ module Data.Heap
|
|||||||
, hLookupUnsafe
|
, hLookupUnsafe
|
||||||
, addresses
|
, addresses
|
||||||
, hSize
|
, hSize
|
||||||
|
, hView
|
||||||
|
, hViewUnsafe
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
||||||
@@ -67,3 +69,11 @@ addresses (Heap _ m) = M.keys m
|
|||||||
hSize :: Heap a -> Int
|
hSize :: Heap a -> Int
|
||||||
hSize (Heap _ m) = M.size m
|
hSize (Heap _ m) = M.size m
|
||||||
|
|
||||||
|
-- | Intended for use with view patterns
|
||||||
|
hView :: Heap a -> Addr -> Maybe a
|
||||||
|
hView = flip hLookup
|
||||||
|
|
||||||
|
-- | Intended for use with view patterns
|
||||||
|
hViewUnsafe :: Heap a -> Addr -> a
|
||||||
|
hViewUnsafe = flip hLookupUnsafe
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user