record-hasfield-1.0: A version of GHC.Records as available in future GHCs.

Safe HaskellSafe
LanguageHaskell2010

GHC.Records.Compat

Description

This module provides a version of GHC.Records as it will be after the implementation of GHC proposal #42.

In future GHC versions it will be an alias for GHC.Records.

Synopsis

Documentation

class HasField x r a | x r -> a where Source #

Constraint representing the fact that the field x can be get and set on the record type r and has field type a. This constraint will be solved automatically, but manual instances may be provided as well.

The function should satisfy the invariant:

uncurry ($) (hasField @x r) == r

Methods

hasField :: r -> (a -> r, a) Source #

Function to get and set a field in a record.

Instances
HasField () a a Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: a -> (a -> a, a) Source #

HasField "_1" (a, b) a Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b) -> (a -> (a, b), a) Source #

HasField "_2" (a, b) b Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b) -> (b -> (a, b), b) Source #

HasField "_1" (a, b, c) a Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c) -> (a -> (a, b, c), a) Source #

HasField "_2" (a, b, c) b Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c) -> (b -> (a, b, c), b) Source #

HasField "_3" (a, b, c) c Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c) -> (c -> (a, b, c), c) Source #

HasField "_1" (a, b, c, d) a Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c, d) -> (a -> (a, b, c, d), a) Source #

HasField "_2" (a, b, c, d) b Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c, d) -> (b -> (a, b, c, d), b) Source #

HasField "_3" (a, b, c, d) c Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c, d) -> (c -> (a, b, c, d), c) Source #

HasField "_4" (a, b, c, d) d Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c, d) -> (d -> (a, b, c, d), d) Source #

HasField "_1" (a, b, c, d, e) a Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c, d, e) -> (a -> (a, b, c, d, e), a) Source #

HasField "_2" (a, b, c, d, e) b Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c, d, e) -> (b -> (a, b, c, d, e), b) Source #

HasField "_3" (a, b, c, d, e) c Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c, d, e) -> (c -> (a, b, c, d, e), c) Source #

HasField "_4" (a, b, c, d, e) d Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c, d, e) -> (d -> (a, b, c, d, e), d) Source #

HasField "_5" (a, b, c, d, e) e Source # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: (a, b, c, d, e) -> (e -> (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 # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: r1 -> (a2 -> 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 # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: r1 -> (a3 -> 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 # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: r1 -> (a4 -> 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 # 
Instance details

Defined in GHC.Records.Extra

Methods

hasField :: r1 -> (a5 -> r1, a5) Source #

getField :: forall x r a. HasField x r a => r -> a Source #

Get a field in a record.

setField :: forall x r a. HasField x r a => r -> a -> r Source #

Set a field in a record.