Safe Haskell | None |
---|---|
Language | Haskell2010 |
A simple NonEmpty dict wrapper to protect us from writing invalid empty Dicts to Redis Hashes.
Synopsis
- data NonEmptyDict k v
- fromDict :: Ord k => Dict k v -> Maybe (NonEmptyDict k v)
- toDict :: Ord k => NonEmptyDict k v -> Dict k v
- toNonEmptyList :: NonEmptyDict k v -> NonEmpty (k, v)
- init :: Ord k => k -> v -> Dict k v -> NonEmptyDict k v
- keys :: Dict k v -> List k
Documentation
data NonEmptyDict k v Source #
A Dict with at least one entry. For use in writing to redis, where it's an error when writing nothing
Instances
(Show k, Show v) => Show (NonEmptyDict k v) Source # | |
Defined in NonEmptyDict showsPrec :: Int -> NonEmptyDict k v -> ShowS # show :: NonEmptyDict k v -> String # showList :: [NonEmptyDict k v] -> ShowS # |
fromDict :: Ord k => Dict k v -> Maybe (NonEmptyDict k v) Source #
tries to create a NonEmptyDict
from a Dict
toDict :: Ord k => NonEmptyDict k v -> Dict k v Source #
creates a Dict
from a NonEmptyDict
toNonEmptyList :: NonEmptyDict k v -> NonEmpty (k, v) Source #
creates a Dict
from a NonEmptyDict
init :: Ord k => k -> v -> Dict k v -> NonEmptyDict k v Source #
creates a Dict
from a key, value, and dict