generic-accessors 0.4.1.1 → 0.4.2.0
raw patch · 2 files changed
+6/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Accessors: GetString :: (a -> String) -> Getter a
+ Accessors: SetString :: (String -> a -> a) -> Setter a
+ Accessors: instance Lookup String
Files
- generic-accessors.cabal +1/−1
- src/Accessors.hs +5/−0
generic-accessors.cabal view
@@ -1,5 +1,5 @@ name: generic-accessors-version: 0.4.1.1+version: 0.4.2.0 synopsis: stringly-named getters for generic data license: BSD3 license-file: LICENSE
src/Accessors.hs view
@@ -50,6 +50,7 @@ | GetDouble (a -> Double) | GetFloat (a -> Float) | GetInt (a -> Int)+ | GetString (a -> String) | GetSorry -- ^ not yet implemented data Setter a =@@ -57,6 +58,7 @@ | SetDouble (Double -> a -> a) | SetFloat (Float -> a -> a) | SetInt (Int -> a -> a)+ | SetString (String -> a -> a) | SetSorry -- ^ not yet implemented accessors :: Lookup a => a -> AccessorTree a@@ -229,6 +231,8 @@ toAccessorTree _ get set = ATGetter (GetDouble get, SetDouble set) instance Lookup Bool where toAccessorTree _ get set = ATGetter (GetBool get, SetBool set)+instance Lookup String where+ toAccessorTree _ get set = ATGetter (GetString get, SetString set) -- Word types instance Lookup Word where@@ -322,6 +326,7 @@ showVal (GetInt get) _ x = show (get x) showVal (GetDouble get) show' x = show' (get x) showVal (GetFloat get) show' x = show' (realToFrac (get x))+showVal (GetString get) _ x = get x showVal GetSorry _ _ = "" showRecordField :: (Double -> String) -> a -> String -> (String, AccessorTree a) -> String -> [String]