packages feed

named-records 0.4 → 0.5

raw patch · 2 files changed

+21/−7 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.NamedRecord: record' :: String -> Record

Files

named-records.cabal view
@@ -1,5 +1,5 @@ Name:           named-records-Version:        0.4+Version:        0.5 Synopsis:       Flexible records with named fields. Description:    Flexible records with named fields.                 .@@ -29,6 +29,7 @@                 [@v0.4@] Records can now be serialized by means of                     the @binary@ package. Added @upd@ function.                 .+                [@v0.5@] Added @record'@.                  License:        MIT License-File:   LICENSE@@ -52,7 +53,7 @@ Source-Repository head     type: darcs     location: hub.darcs.net:names-    tag: v0.4+    tag: v0.5   Library
src/Data/NamedRecord.hs view
@@ -157,6 +157,9 @@     -- See the examples.     record, +    -- | As 'record', but also generated the accessor names.+    record',+     extends,      -- | Declares a field of a record. Use as infix operators.@@ -327,7 +330,7 @@ instance RecordTemplate         Record [(String, Q Type, Maybe (Q Exp))] (Q [Dec]) where -    Record name xs ~> fs = do+    Record name xs opts ~> fs = do         let typeD typ = TySynD (mkName name) [] typ              noValue = VarE '_value@@ -377,7 +380,14 @@                                       (ConE '(:=))                                       (Just x) -        return [typeD syn, sigD, funcD, reflD]+            declaration = [typeD syn, sigD, funcD, reflD]+        +        if opts+          then do+                names <- mapM Data.Name.name (map fst nFields)+                return (declaration ++ concat names)+          else do+                return declaration   _type = error $ "NamedRecord field type unwrapped!"@@ -397,7 +407,7 @@     (<:) :: Record -> a -> Record  instance RecordExtends [(String, (Type, Exp))] where-    Record name xs <: x = Record name (x:xs)+    Record name xs opts <: x = Record name (x:xs) opts  extends :: RecordExtends a => Record -> a -> Record extends = (<:)@@ -406,10 +416,13 @@ infixl 2 `extends`  -data Record = Record String [[(String, (Type, Exp))]]+data Record = Record String [[(String, (Type, Exp))]] Bool  record :: String -> Record-record name = Record name []+record name = Record name [] False++record' :: String -> Record+record' name = Record name [] True   -- Playground below