packages feed

named-records 0.3.1 → 0.3.2

raw patch · 3 files changed

+25/−11 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.NamedRecord: class New o
+ Data.NamedRecord: instance [overlap ok] (New a, New b) => New (a :+ b)
+ Data.NamedRecord: instance [overlap ok] New (a := b)
+ Data.NamedRecord: new :: New o => o

Files

Sample.hs view
@@ -1,8 +1,9 @@ {-# LANGUAGE Haskell2010     , TemplateHaskell     , FlexibleContexts+    , TypeOperators  #-}-{-# OPTIONS -ddump-splices #-}+-- {-# OPTIONS -ddump-splices #-}  module Main where 
named-records.cabal view
@@ -1,5 +1,5 @@ Name:           named-records-Version:        0.3.1+Version:        0.3.2 Synopsis:       Flexible records with named fields. Description:    Flexible records with named fields.                 .@@ -20,6 +20,8 @@                 .                 [@v0.3.1@] Added sample files to cabal package,                     requirements bumped for names-v0.3+                .+                [@v0.3.2@] Added @new@.                  License:        MIT License-File:   LICENSE@@ -39,7 +41,7 @@ Source-Repository head     type: darcs     location: hub.darcs.net:names-    tag: v0.3.1+    tag: v0.3.2   
src/Data/NamedRecord.hs view
@@ -148,6 +148,7 @@ -} module Data.NamedRecord (     Property (get, set),+    New (new),     add,      (:=) (..),@@ -193,6 +194,12 @@ infixr 2 :+  +add :: b -> a -> a :+ b+add = flip (:+)++infixl 1 `add`++ class Property o n v | o n -> v where     get :: o -> n -> v     set :: o -> n := v -> o@@ -201,12 +208,6 @@ infixl 1 `get`  -add :: b -> a -> a :+ b-add = flip (:+)--infixl 1 `add`-- instance Property (n := v) n v where     get (_ := v) _ = v     set _ v = v@@ -220,6 +221,16 @@     set (a :+ b) p = a :+ (set b p)  +class New o where+    new :: o++instance New (a := b) where+    new = _type := _value++instance (New a, New b) => New (a :+ b) where+    new = new :+ new++ class ToExp a where     toExp' :: a -> Q Exp @@ -305,7 +316,7 @@     Record name xs ~> fs = do         let typeD typ = TySynD (mkName name) [] typ -            noValue = VarE 'value+            noValue = VarE '_value              normalize (n, v, d) = do                 v' <- v@@ -359,7 +370,7 @@     ++ " You should never see this."     ++ " Srsly, what did you do?" -value = error "Data.NameRecord.undefined: No value set."+_value = error "Data.NameRecord.undefined: No value set."  has :: RecordTemplate a b c => a -> b -> c has = (~>)