labels 0.0.0 → 0.1.0
raw patch · 4 files changed
+6/−11 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Labels.Internal: instance Labels.Internal.Has l a r => GHC.OverloadedLabels.IsLabel l (r -> a)
Files
- CHANGELOG +3/−0
- README.md +2/−4
- labels.cabal +1/−1
- src/Labels/Internal.hs +0/−6
CHANGELOG view
@@ -1,2 +1,5 @@+0.1.0:+ * Drop the convenience accessor #foo. Must use get #foo+ 0.0.0: * First version
README.md view
@@ -33,8 +33,6 @@ <tr><td>Get fields of a record</td><td><pre lang="haskell"> > get #bar (#foo := "hi", #bar := 123) 123-> #bar (#foo := "hi", #bar := 123) -- or this convenience-123 </pre></td></tr> <tr><td>Set fields of a record</td><td><pre lang="haskell"> > set #bar 66 (#foo := "hi", #bar := 123)@@ -99,14 +97,14 @@ Accessing fields is natural as anything: ``` haskell-> V.sum (V.map #low rows)+> V.sum (V.map (get #low) rows) 2331.789993 ``` We can just make up new fields on the fly: ``` haskell-> let diffed = V.map (\row -> cons (#diff := (#high row - #low row)) row) rows+> let diffed = V.map (\row -> cons (#diff := (get #high row - get #low row)) row) rows > mapM_ print (V.take 2 diffed) (#diff := 1.1400000000000006,#date := "2016-08-10",#high := 108.900002,#low := 107.760002) (#diff := 0.9300000000000068,#date := "2016-08-09",#high := 108.940002,#low := 108.010002)
labels.cabal view
@@ -1,5 +1,5 @@ name: labels-version: 0.0.0+version: 0.1.0 synopsis: Declare and access tuple fields with labels description: Declare and access tuple fields with labels. An approach to anonymous records.
src/Labels/Internal.hs view
@@ -93,11 +93,6 @@ IsLabel (l :: Symbol) (Proxy l') where fromLabel _ = Proxy {-# INLINE fromLabel #-}--instance Has l a r =>- IsLabel (l :: Symbol) (r -> a) where- fromLabel _ = get (Proxy :: Proxy l)- {-# INLINE fromLabel #-} #endif instance IsString (Q Exp) where@@ -193,4 +188,3 @@ (mapM (\size -> mapM (\slot -> makeInstance size slot) [1 .. size]) [1 .. 24]))-