Add lens for access to underlying Ini value
Getty Ritter
6 years ago
144 | 144 | Ini |
145 | 145 | , ini |
146 | 146 | , getIniValue |
147 | , iniValueL | |
147 | 148 | , getRawIni |
148 | 149 | -- ** Parsing INI files |
149 | 150 | , parseIni |
278 | 279 | -- | Get the underlying Haskell value associated with the 'Ini'. |
279 | 280 | getIniValue :: Ini s -> s |
280 | 281 | getIniValue = iniCurr |
282 | ||
283 | mkLens :: (a -> b) -> (b -> a -> a) -> Lens a a b b | |
284 | mkLens get' set' f a = (`set'` a) `fmap` f (get' a) | |
285 | ||
286 | -- | The lens equivalent of 'getIniValue' | |
287 | iniValueL :: Lens (Ini s) (Ini s) s s | |
288 | iniValueL = mkLens iniCurr (\ i v -> v { iniCurr = i }) | |
281 | 289 | |
282 | 290 | -- | Get the textual representation of an 'Ini' value. If this 'Ini' |
283 | 291 | -- value is the result of 'parseIni', then it will attempt to retain |