Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Extensions over a future version of GHC.Records.
Provides the function modifyField
plus the orphan instances:
HasField '(x1,x2)
for selecting first thex1
field, then thex2
field. Available for()
and tuples up to arity 5.HasField "_1" (a,b) a
for selecting the first compomnent of a pair, plus similarly for all fields up of all tuples up to arity 5.
Using these functions together you get:
modifyField @'("_1","_2") negate ((1,2),3,4,5) == ((1,-2),3,4,5)
Synopsis
- module GHC.Records.Compat
- modifyField :: forall x r a. HasField x r a => r -> (a -> a) -> r
Documentation
module GHC.Records.Compat
modifyField :: forall x r a. HasField x r a => r -> (a -> a) -> r Source #
Modify a field in a record.
Orphan instances
HasField () a a Source # | |
HasField "_1" (a, b) a Source # | |
HasField "_2" (a, b) b Source # | |
HasField "_1" (a, b, c) a Source # | |
HasField "_2" (a, b, c) b Source # | |
HasField "_3" (a, b, c) c Source # | |
HasField "_1" (a, b, c, d) a Source # | |
HasField "_2" (a, b, c, d) b Source # | |
HasField "_3" (a, b, c, d) c Source # | |
HasField "_4" (a, b, c, d) d Source # | |
HasField "_1" (a, b, c, d, e) a Source # | |
HasField "_2" (a, b, c, d, e) b Source # | |
HasField "_3" (a, b, c, d, e) c Source # | |
HasField "_4" (a, b, c, d, e) d Source # | |
HasField "_5" (a, b, c, d, e) e Source # | |
(a1 ~ r2, HasField x1 r1 a1, HasField x2 r2 a2) => HasField ((,) x1 x2 :: (k2, k1)) r1 a2 Source # | |
(a1 ~ r2, a2 ~ r3, HasField x1 r1 a1, HasField x2 r2 a2, HasField x3 r3 a3) => HasField ((,,) x1 x2 x3 :: (k3, k2, k1)) r1 a3 Source # | |
(a1 ~ r2, a2 ~ r3, a3 ~ r4, HasField x1 r1 a1, HasField x2 r2 a2, HasField x3 r3 a3, HasField x4 r4 a4) => HasField ((,,,) x1 x2 x3 x4 :: (k4, k3, k2, k1)) r1 a4 Source # | |
(a1 ~ r2, a2 ~ r3, a3 ~ r4, a4 ~ r5, HasField x1 r1 a1, HasField x2 r2 a2, HasField x3 r3 a3, HasField x4 r4 a4, HasField x5 r5 a5) => HasField ((,,,,) x1 x2 x3 x4 x5 :: (k5, k4, k3, k2, k1)) r1 a5 Source # | |