100% documentation coverage

This commit is contained in:
Oliver Charles 2020-01-18 18:29:22 +00:00
parent 5a6467b179
commit e119d8861e
7 changed files with 15 additions and 13 deletions

View File

@ -28,8 +28,8 @@ reduces to just @Expr ..@:
>>> :t packageName ( package :: Package ( Expr m ) )
Expr m String
When we 'select' queries of this type, @f@ will be instantiated as @Identity@,
at which point all wrapping entire disappears:
When we 'Rel8.Query.select' queries of this type, @f@ will be instantiated as
@Identity@, at which point all wrapping entire disappears:
>>> :t packageName ( package :: Package Identity )
String
@ -45,6 +45,6 @@ type family Column ( f :: Type -> Type ) ( a :: Type ) :: Type where
-- | The @C@ newtype simply wraps 'Column', but this allows us to work
-- injectivity problems of functions that return type family applications
-- (for example, 'zipRecord').
-- (for example, 'Rel8.HigherKinded.zipRecord').
newtype C f x =
C { toColumn :: Column f x }

View File

@ -24,7 +24,8 @@ tableSchema =
}
@
If you want to programatically create @ColumnSchema@'s, you can use 'fromString':
If you want to programatically create @ColumnSchema@'s, you can use
'Data.String.fromString':
@
import Data.String ( fromString )

View File

@ -27,9 +27,9 @@ data MaybeTable t f =
}
-- | If you 'select' a @MaybeTable@, you'll get back a @MaybeTable@ as a result.
-- However, this structure is awkward to use in ordinary Haskell, so 'toMaybe'
-- lets you transform a @MaybeTable@ into a normal @Maybe@ value.
-- | If you 'Rel8.Query.select' a @MaybeTable@, you'll get back a @MaybeTable@
-- as a result. However, this structure is awkward to use in ordinary Haskell,
-- so 'toMaybe' lets you transform a @MaybeTable@ into a normal @Maybe@ value.
toMaybe :: MaybeTable t Identity -> Maybe t
toMaybe MaybeTable{ isNull, maybeTable }
| isNull = Nothing

View File

@ -128,7 +128,7 @@ each schema =
-- | Select all rows from another table that match a given predicate. If the
-- predicate is not satisfied, 'nullTable' is returned.
-- predicate is not satisfied, a null 'MaybeTable' is returned.
--
-- @leftJoin t p@ is equivalent to @LEFT JOIN t ON p@.
leftJoin

View File

@ -24,7 +24,7 @@ import {-# source #-} Rel8.FromRow
-- | The type of @SELECT@able queries. You generally will not explicitly use
-- this type, instead preferring to be polymorphic over any 'MonadQuery m'.
-- Functions like 'select' will instantiate 'm' to be 'Query' when they run
-- Functions like 'select' will instantiate @m@ to be 'Query' when they run
-- queries.
newtype Query a = Query ( Opaleye.Query a )
deriving ( Functor, Applicative )

View File

@ -12,10 +12,11 @@ the schema of the columns within this table.
For each selectable table in your database, you should provide a @TableSchema@
in order to interact with the table via Rel8. For a table storing a list of
Haskell packages (as defined in the example for 'Column'), we would write:
Haskell packages (as defined in the example for 'Rel8.Column.Column'), we would
write:
@
haskellPackage :: TableSchema ( HaskellPackage 'ColumnSchema' )
haskellPackage :: TableSchema ( HaskellPackage 'Rel8.ColumnSchema.ColumnSchema' )
haskellPackage =
TableSchema
{ tableName = "haskell_package"
@ -37,7 +38,7 @@ data TableSchema ( schema :: Type ) =
-- the connection's @search_path@ will be used.
, tableColumns :: schema
-- ^ The columns of the table. Typically you would use a a higher-kinded
-- data type here, parameterized by the 'ColumnSchema' functor.
-- data type here, parameterized by the 'Rle8.ColunmSchema.ColumnSchema' functor.
}
deriving
( Functor )

View File

@ -18,7 +18,7 @@ import Rel8.Unconstrained
-- | Zip the "leaves" of a data structure together.
class CanZipLeaves a b Unconstrained => ZipLeaves a b f g | a -> f, b -> g where
-- | An associated constraint that applies to all leaves. For example,
-- you can constraint all leaves to be instances of 'DBEq'.
-- you can constraint all leaves to be instances of 'Rel8.DBEq.DBEq'.
type CanZipLeaves a b (c :: * -> Constraint) :: Constraint
zipLeaves