meep- A silly container

Safe HaskellNone



A Map-like structure that contains up to one key-value pair

A Meep is strict in the key.

Meep k a is isomorphic to Maybe (k, a) with maybeing witnessing the isomorphism



data Meep k a Source

A Meep from key k to value a


Typeable2 Meep 
FunctorWithIndex k (Meep k) 
FoldableWithIndex k (Meep k) 
TraversableWithIndex k (Meep k) 
Functor (Meep k) 
Foldable (Meep k) 
Traversable (Meep k) 
(Eq k, Eq a) => Eq (Meep k a) 
(Data k, Data a) => Data (Meep k a) 
(Ord k, Ord a) => Ord (Meep k a) 
(Show k, Show a) => Show (Meep k a) 
Generic (Meep k a) 
(Eq k, Semigroup a) => Semigroup (Meep k a)

Meeps intersection

Eq k => Ixed (Meep k a) 
Eq k => At (Meep k a) 
AsEmpty (Meep k a) 

empty :: Meep k aSource

O(1). An empty Meep

singleton :: k -> a -> Meep k aSource

O(1). A Meep with a single key-value pair

size :: Num b => Meep k a -> bSource

O(1). The size of the Meep

>>> size empty
>>> size (singleton 4 "foo")

null :: Meep k a -> BoolSource

O(1). The emptiness check for the Meep

>>> null empty
>>> null (singleton 4 "foo")

fromMaybe :: Maybe (k, a) -> Meep k aSource

O(1). Build the Meep

 fromMaybe ≡ view (from maybeing)

toMaybe :: Meep k a -> Maybe (k, a)Source

O(1). Destroy the Meep

 toMaybe ≡ view maybeing

maybeing :: Iso (Meep k v) (Meep k' v') (Maybe (k, v)) (Maybe (k', v'))Source

O(1). A witness to

 Meep k v ≅ Maybe (k, v)
>>> singleton 4 "foo" ^. maybeing
Just (4,"foo")
>>> Nothing ^. from maybeing
fromMaybe Nothing

keys :: Meep k a -> Maybe kSource

O(1). Return all keys from the Meep

>>> keys (singleton 4 "foo")
Just 4
>>> keys empty

elems :: Meep k a -> Maybe aSource

O(1). Return all values from the Meep

>>> elems (singleton 4 "foo")
Just "foo"
>>> elems empty