I am using Data.Exists. I notice that runExists takes a function that operates on the Exists field.
Let’s say I have
newtype ObjectF s =
  { n1   :: Number
  , ns   :: s }
type Object = Exists ObjectF
and I want to run runExists to obtain the n1 field.
getN1 :: ObjectF s -> Number getN1 (ObjectF o) = o.n1 var :: Object -> Number var o = runExists getN1 o
My question is, is there a way to define the function ‘getN1’ automatically or obtain a function on a newtype that accesses a particular field?
