on master help sign in
adjust docs for Atomable and Tupleable to reference Proxy
commit4da5ec0a786a766de053a8e91e5a42481b00626b authorAgentM <agentm@themactionfaction.com> dateThu 28 Sep 2017, 22:13 (9 years ago) parent2ff4067
2 files changed+5−5
docs/new_datatypes.markdown+3−3 docs/tupleable.markdown+2−2
docs/new_datatypes.markdown+3−3
@@ -103,9 +103,9 @@ The essential ```Atomable``` typeclass functions are:
103103| -------- | ------- |
104104| ```toAtom :: a -> Atom``` | convert a Haskell data type to a database atom |
105105| ```fromAtom :: Atom -> a``` | convert a database atom to a Haskell data type |
106−| ```toAtomType :: a -> AtomType``` | generate a database AtomType for a Haskell datatype |
107−| ```toAddTypeExpr :: a -> DatabaseContextExpr``` | generate a ```DatabaseContextExpr``` which can be executed against a database context in order to add the new type |
106+| ```toAtomType :: Proxy a -> AtomType``` | generate a database AtomType for a Haskell datatype |
107+| ```toAddTypeExpr :: Proxy a -> DatabaseContextExpr``` | generate a ```DatabaseContextExpr``` which can be executed against a database context in order to add the new type |
108108
109−In addition, basic Haskell data types like ```Int```, ```Double```, ```Text```, ```Day```, ```Bool```, ```UTCTime```, and l```ByteString``` already have Atomable instances ready-to-go. In addition, an ```Atomable``` instance is available for lists: ```Atomable a => [a]```, though one should be very careful not to use this in a common anti-pattern. Typically, it makes more sense to store one-to-many relationships as discrete relation variables; when storing them as lists, one gives up the various query capabilities and optimizations of the relational algebra.
109+In addition, basic Haskell data types like ```Int```, ```Double```, ```Text```, ```Day```, ```Bool```, ```UTCTime```, and l```ByteString``` already have `Atomable` instances ready-to-go. In addition, an ```Atomable``` instance is available for lists: ```Atomable a => [a]```, though one should be very careful not to use this in a common anti-pattern. Typically, it makes more sense to store one-to-many relationships as discrete relation variables; when storing them as lists, one gives up the various query capabilities and optimizations of the relational algebra.
110110
111111To be clear, these data types are not black boxes once stored in the database. These new types can be scanned and manipulated by Haskell scripts which can be created at runtime. For more information, read about [```AtomFunction```s](/docs/atomfunctions.markdown).
docs/tupleable.markdown+2−2
@@ -27,9 +27,9 @@ Now, ```Person``` values can be marshaled between the database and the client. T
2727
2828The ```Tupleable``` module includes the following functions:
2929
30− * ```toInsertExpr :: (Tupleable a, Traversable t) => t a -> RelVarName -> Either RelationalError DatabaseContextExpr```
30+ * ```toInsertExpr :: forall a. forall t. (Tupleable a, Traversable t) => t a -> RelVarName -> Either RelationalError DatabaseContextExpr```
3131 * creates an ```Insert``` expression which can be used to insert a set of ```Tupleable``` values into the relation variable named by the ```RelVarName```
32− * ```toAttributes :: a -> Attributes```
32+ * ```toAttributes :: Proxy a -> Attributes```
3333 * generates ```Attributes``` from a ```Tupleable``` value- can be used with ```undefined```, so an actual value is not necessary
3434 * ```toTuple :: a -> RelationTuple```
3535 * converts a ```Tupleable``` value to a tuple for use in queries