tomjaguarpaw / haskell-opaleye

Other
599 stars 115 forks source link

Add nullableToMaybeFields #542

Closed tomjaguarpaw closed 2 years ago

tomjaguarpaw commented 2 years ago

We don't seem to have nullableToMaybeFields :: FieldNullable a -> MaybeFields (Field a). Add it.

N.B. it shouldn't need an SqlType a constraint. Something like the following should work

nullableToMaybeFields x = MaybeFields (not (isNull x)) (unsafeCoerceColumn x)
tomjaguarpaw commented 2 years ago

Needed for, e.g. https://github.com/tomjaguarpaw/haskell-opaleye/issues/541