Copyright | Matthew Harm Bekkema 2016 |
---|---|
License | GPL-2 |
Maintainer | mbekkema97@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
- type OptionalConfig = Map String String
- lookup :: Read a => String -> OptionalConfig -> Maybe a
- empty :: OptionalConfig
- insert :: Show a => String -> a -> OptionalConfig -> OptionalConfig
- delete :: String -> OptionalConfig -> OptionalConfig
- adjust :: (Show a, Read a) => (a -> a) -> String -> OptionalConfig -> OptionalConfig
- update :: (Show a, Read a) => (a -> Maybe a) -> String -> OptionalConfig -> OptionalConfig
- alter :: (Show a, Read a) => (Maybe a -> Maybe a) -> String -> OptionalConfig -> OptionalConfig
OptionalConfig type
type OptionalConfig = Map String String Source
The optional configuration of the password manager
Query
lookup :: Read a => String -> OptionalConfig -> Maybe a Source
Lookup the value of a key in the config. Returns Nothing
if key not
found, or if value can not be parsed as the desired type.
Construction
empty :: OptionalConfig Source
Contains no configuration values
Insertion
insert :: Show a => String -> a -> OptionalConfig -> OptionalConfig Source
Insert a new key and value in the config. If the key is already present, the associated value is replaced with the supplied value.
Delete/Update
delete :: String -> OptionalConfig -> OptionalConfig Source
Delete a key and its value from the config.
adjust :: (Show a, Read a) => (a -> a) -> String -> OptionalConfig -> OptionalConfig Source
Update a value at a specific key with the result of the provided function. The value is left unchanged if it could not be parsed as the desired type.
update :: (Show a, Read a) => (a -> Maybe a) -> String -> OptionalConfig -> OptionalConfig Source
The expression (update f k config) updates the value x at k (if it is in the config). If (f x) is Nothing, the element is deleted. If it is (Just y), the key k is bound to the new value y. The value is left unchanged if it could not be parsed as the desired type.
alter :: (Show a, Read a) => (Maybe a -> Maybe a) -> String -> OptionalConfig -> OptionalConfig Source
The expression (alter f k config) alters the value x at k, or absence thereof. The value is left unchanged if it could not be parsed as the desired type.