record 0.4.0.1 → 0.4.0.2
raw patch · 2 files changed
+29/−2 lines, 2 files
Files
- library/Record/TH.hs +28/−1
- record.cabal +1/−1
library/Record/TH.hs view
@@ -188,10 +188,37 @@ recordConFunDecs :: Bool -> Int -> [Dec] recordConFunDecs strict arity =- [inline, fun]+ [inline, signature, fun] where inline = PragmaD (InlineP name Inline FunLike AllPhases)+ signature =+ SigD name type_+ where+ type_ =+ ForallT varBndrs [] $+ foldr AppT recordType $+ map (AppT ArrowT) $+ interleave nameProxyTypes valueVariableTypes+ where+ varBndrs =+ map PlainTV $+ interleave nameVariableNames valueVariableNames+ recordType =+ foldl' AppT (ConT (recordName strict arity)) $ + interleave nameVariableTypes valueVariableTypes+ valueVariableTypes =+ map VarT valueVariableNames+ valueVariableNames =+ map (\i -> mkName ("v" <> show i)) [1 .. arity]+ nameVariableTypes =+ map VarT nameVariableNames+ nameVariableNames =+ map (\i -> mkName ("n" <> show i)) [1 .. arity]+ nameProxyTypes =+ map (AppT (ConT (mkName "FieldName"))) nameVariableTypes+ interleave a b =+ join $ zipWith (\a b -> [a, b]) a b fun = FunD name [Clause [] (NormalB (recordConLambdaExp strict arity)) []] name =
record.cabal view
@@ -1,7 +1,7 @@ name: record version:- 0.4.0.1+ 0.4.0.2 synopsis: Anonymous records description: