module Data.Records( module Data.Proxy, HasField(..), SetField(..), hasField, composeSet, ) whereimport qualified Prelude() -- do not import Preludeimport Primitivesimport Data.Functionimport Data.Proxyimport {-# SOURCE #-} Data.Typeabletype Get r a = r -> atype Set r a = r -> a -> rtype GetSet r a = r -> (a, a -> r)type HasField :: forall (k::Kind) . k -> Type -> Type -> Constraintclass HasField x r a | x r -> a where getField :: Proxy x -> r -> a -- Get r atype SetField :: forall (k::Kind) . k -> Type -> Type -> Constraintclass SetField x r a | x r -> a where setField :: Proxy x -> r -> a -> r -- Set r ahasField :: forall x r a . (HasField x r a, SetField x r a) => Proxy x -> r -> (a, a -> r) -- GetSet r ahasField p r = (getField p r, setField p r)composeSet :: forall a b c . GetSet a b -> (b -> c -> b) -> (a -> c -> a)composeSet gs1 b_to_c_to_b a c = case gs1 a of (b, b_to_a) -> b_to_a (b_to_c_to_b b c)