on master help sign in
Document ToExprs and FromExprs
9d3480cOllie Charles
src/Rel8/Table/Serialize.hs+5
@@ -51,6 +51,9 @@ import Rel8.Type ( DBType )
51import Data.Functor.Apply ( WrappedApplicative(..) )
51import Data.Functor.Apply ( WrappedApplicative(..) )
52
52
53
53
54+-- | @ToExprs exprs a@ is evidence that the types @exprs@ and @a@ describe
55+-- essentially the same type, but @exprs@ is in the 'Expr' context, and @a@ is
56+-- in the 'Result' context.
54type ToExprs :: Type -> Type -> Constraint
57type ToExprs :: Type -> Type -> Constraint
55class Table Expr exprs => ToExprs exprs a where
58class Table Expr exprs => ToExprs exprs a where
56 fromResult :: Columns exprs (Col Result) -> a
59 fromResult :: Columns exprs (Col Result) -> a
@@ -190,6 +193,8 @@ instance (KnownSpec spec, x ~ Col Expr spec) =>
190 toResult = toColumns
193 toResult = toColumns
191
194
192
195
196+-- | The @FromExprs@ type function maps a type in the @Expr@ context to the
197+-- corresponding type in the @Result@ context.
193type FromExprs :: Type -> Type
198type FromExprs :: Type -> Type
194type family FromExprs a
199type family FromExprs a
195type instance FromExprs (Expr a) = a
200type instance FromExprs (Expr a) = a