on master help sign in
Document KRel8able
9c974cbOllie Charles
src/Rel8/Generic/Rel8able.hs+10−9
@@ -47,6 +47,7 @@ import Rel8.Table
47 )
47 )
48
48
49
49
50+-- | The kind of 'Rel8able' types
50type KRel8able :: Type
51type KRel8able :: Type
51type KRel8able = K.Rel8able
52type KRel8able = K.Rel8able
52
53
@@ -62,34 +63,34 @@ type KRel8able = K.Rel8able
62-- , fieldN :: Column f Tn OR HKn f
63-- , fieldN :: Column f Tn OR HKn f
63-- }
64-- }
64-- @
65-- @
65−--
66+--
66-- where @Tn@ is any Haskell type, and @HKn@ is any higher-kinded type.
67-- where @Tn@ is any Haskell type, and @HKn@ is any higher-kinded type.
67−--
68+--
68-- That is, higher-kinded data are records where all fields in the record are
69-- That is, higher-kinded data are records where all fields in the record are
69-- all either of the type @Column f T@ (for any @T@), or are themselves
70-- all either of the type @Column f T@ (for any @T@), or are themselves
70-- higher-kinded data:
71-- higher-kinded data:
71−--
72+--
72-- [Nested]
73-- [Nested]
73−--
74+--
74-- @
75-- @
75-- data Nested f =
76-- data Nested f =
76-- Nested { nested1 :: MyType f
77-- Nested { nested1 :: MyType f
77-- , nested2 :: MyType f
78-- , nested2 :: MyType f
78-- }
79-- }
79-- @
80-- @
80−--
81+--
81-- The @Rel8able@ type class is used to give us a special mapping operation
82-- The @Rel8able@ type class is used to give us a special mapping operation
82-- that lets us change the type parameter @f@.
83-- that lets us change the type parameter @f@.
83−--
84+--
84-- [Supplying @Rel8able@ instances]
85-- [Supplying @Rel8able@ instances]
85−--
86+--
86-- This type class should be derived generically for all table types in your
87-- This type class should be derived generically for all table types in your
87-- project. To do this, enable the @DeriveAnyType@ and @DeriveGeneric@ language
88-- project. To do this, enable the @DeriveAnyType@ and @DeriveGeneric@ language
88-- extensions:
89-- extensions:
89−--
90+--
90-- @
91-- @
91-- \{\-\# LANGUAGE DeriveAnyClass, DeriveGeneric #-\}
92-- \{\-\# LANGUAGE DeriveAnyClass, DeriveGeneric #-\}
92−--
93+--
93-- data MyType f = MyType { fieldA :: Column f T }
94-- data MyType f = MyType { fieldA :: Column f T }
94-- deriving ( GHC.Generics.Generic, Rel8able )
95-- deriving ( GHC.Generics.Generic, Rel8able )
95-- @
96-- @