-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Simple observable sharing
--
-- Simple observable sharing inspired by the paper "Observable Sharing
-- for Functional Circuit Description".
@package observable-sharing
@version 0.2.5
module Data.Ref
data Ref a
Ref :: StableName a -> a -> Ref a
[label] :: Ref a -> StableName a
[deref] :: Ref a -> a
ref :: a -> Ref a
instance GHC.Classes.Eq (Data.Ref.Ref a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Ref.Ref a)
module Data.Ref.Map
-- | A reference indexed map. Useful for associating info with a reference.
--
-- Note: this is generally unsound when f is a GADT!
data Map f
-- | Shorthand for stable names.
type Name = StableName
-- | Construct an empty map.
empty :: Map f
-- | Construct a map with a single element.
singleton :: Name a -> f a -> Map f
-- | Returns True if the map is empty, False otherwise.
null :: Map f -> Bool
-- | Returns the number of elements stored in this map.
size :: Map f -> Int
-- | Returns True if the name is present in the map, False
-- otherwise.
member :: Name a -> Map f -> Bool
-- | Unsafe lookup
(!) :: Map f -> Name a -> f a
-- | Finds the value associated with the name, or Nothing if the
-- name has no value associated to it.
lookup :: Name a -> Map f -> Maybe (f a)
-- | Associates a reference with the specified value. If the map already
-- contains a mapping for the reference, the old value is replaced.
insert :: Ref a -> f a -> Map f -> Map f
-- | Removes the associated value of a reference, if any is present in the
-- map.
delete :: forall f a. Name a -> Map f -> Map f
-- | Updates the associated value of a reference, if any is present in the
-- map.
adjust :: forall f a b. (f a -> f b) -> Name a -> Map f -> Map f
-- | Filters the map for values matching the predicate
filter :: (forall a. f a -> Bool) -> Map f -> Map f
-- | Map over the container types
hmap :: forall f h a. (f a -> h a) -> Map f -> Map h
-- | Union of two maps (left biased).
union :: Map f -> Map f -> Map f
-- | Difference of two maps.
difference :: Map f -> Map f -> Map f
-- | Intersectino of two maps.
intersection :: Map f -> Map f -> Map f
-- | Entry in map.
data Entry f
Entry :: Name a -> f a -> Entry f
-- | Fetches all the elements of a map.
toList :: Map f -> [Entry f]
-- | Constructs a map from a list of entries.
fromList :: [Entry f] -> Map f