packages feed

fclabels 1.0.2 → 1.0.3

raw patch · 2 files changed

+9/−10 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

fclabels.cabal view
@@ -1,5 +1,5 @@ Name:          fclabels-Version:       1.0.2+Version:       1.0.3 Author:        Sebastiaan Visser, Erik Hesselink, Chris Eidhof, Sjoerd Visscher. Synopsis:      First class accessor labels. Description:   This package provides first class labels that can act as@@ -19,9 +19,9 @@                .                See the "Data.Label.Maybe" module for the use of partial labels.                .-               > 1.0.1 -> 1.0.2-               >   - Allow generating monomorphic labels.-               >   - Prettify type variables in TH-derived code.+               > 1.0.2 -> 1.0.3+               >   - Deriving labels for datatypes from other modules now works+               >     also when imported qualified. Maintainer:    Sebastiaan Visser <code@fvisser.nl> License:       BSD3 License-File:  LICENCE
src/Data/Label/Derive.hs view
@@ -106,8 +106,8 @@             setter    = [| arr (\(v, p) -> $(caseE [|p|] (cases (bodyS [|p|] [|v|]) ++ wild))) |]             cases b   = map (\ctor -> match (recP ctor []) (normalB b) []) ctors             wild      = [match wildP (normalB [| Left () |]) []]-            bodyS p v = [| Right $( record p fieldName v ) |]-            bodyG p   = [| Right $( fromString fieldName `appE` p ) |]+            bodyS p v = [| Right $( record p field v ) |]+            bodyG p   = [| Right $( varE field `appE` p ) |]      -- Build a single record label definition for labels that cannot fail.     derivePureLabel = (if concrete then mono else poly, body)@@ -116,13 +116,12 @@         poly = forallT forallVars (return []) [t| Arrow $(arrow) => Lens $(arrow) $(inputType) $(return prettyFieldtyp) |]         body = [| lens $(getter) $(setter) |]           where-            getter = [| arr $(fromString fieldName) |]-            setter = [| arr (\(v, p) -> $(record [| p |] fieldName [| v |])) |]+            getter = [| arr $(varE field) |]+            setter = [| arr (\(v, p) -> $(record [| p |] field [| v |])) |]      -- Generate a name for the label. If the original selector starts with an     -- underscore, remove it and make the next character lowercase. Otherwise,     -- add 'l', and make the next character uppercase.-    fieldName = nameBase field     labelName = mkName $       case nameBase field of         '_' : c : rest -> toLower c : rest@@ -143,7 +142,7 @@     prettyFieldtyp = prettyType fieldtyp      -- Q style record updating.-    record rec fld val = val >>= \v -> recUpdE rec [return (mkName fld, v)]+    record rec fld val = val >>= \v -> recUpdE rec [return (fld, v)]      -- Build a function declaration with both a type signature and body.     function (s, b) = liftM2 (,)