packages feed

dynamic 0.0.6 → 0.0.7

raw patch · 3 files changed

+13/−7 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Dynamic: del :: Dynamic -> Dynamic -> Dynamic

Files

README.md view
@@ -247,9 +247,9 @@  Load up the JSON output: -``` haskell-> monzo <- fromJsonFile "monzo.json" ```haskell+> monzo <- fromJsonFile "monzo.json"+```  Preview what's in it: @@ -285,9 +285,6 @@ of my last 5 transactions?  ```haskell-> (/100) $ (!"amount") $ head $ toList $ monzo!"transactions"-100-> map ((/100) . (!"amount")) $ toList $ monzo!"transactions" > sum $ map ((/100) . (!"amount")) $ take 5 $ toList $ monzo!"transactions" 468.65 ```@@ -299,7 +296,8 @@ ["general","entertainment","groceries","eating_out","shopping","expenses","bills","personal_care","cash"] ``` -How many transactions did I do in each category?+How many transactions did I do in each category? Let's use Data.Map to+histogram that.  ```haskell > fromDict $ M.toList $ foldl (\cats cat -> M.insertWith (+) cat 1 cats) mempty $ map (!"category") $ toList $ monzo!"transactions"
dynamic.cabal view
@@ -1,5 +1,5 @@ name:                dynamic-version:             0.0.6+version:             0.0.7 synopsis:            A dynamic type for Haskell description:         Want to do dynamically typed programming in Haskell sometimes? Here you go! homepage:            https://github.com/chrisdone/dynamic#readme
src/Dynamic.hs view
@@ -13,6 +13,7 @@   , (!)   , set   , modify+  , del   -- * Input   , fromJson   , fromCsv@@ -242,6 +243,13 @@ modify k f obj =   case obj of     Dictionary mp -> Dictionary (HM.adjust f (toText k) mp)+    _ -> throw (DynamicTypeError "Not an object!")++-- | @del k obj@ -- delete the key k in obj.+del :: Dynamic -> Dynamic -> Dynamic+del k obj =+  case obj of+    Dictionary mp -> Dictionary (HM.delete (toText k) mp)     _ -> throw (DynamicTypeError "Not an object!")  --------------------------------------------------------------------------------