on master help sign in
add documentation for adding new data types via the existential datatype
commitff2a98bde8957eafab06f81c4f9c91574f619e38 authorAgentM <agentm@themactionfaction.com> dateWed 14 Oct 2015, 23:47 (11 years ago) parent278cb13
2 files changed+21−1
README.markdown+1−1 docs/new_datatypes.markdown+20
README.markdown+1−1
@@ -20,7 +20,7 @@ Project:M36 is written entirely in the [Haskell programming language](https://ww
20201. [Transaction Graph Operators](docs/transaction_graph_operators.markdown)
21211. [Persistent Library Driver](docs/persistent_library_driver.markdown)
22221. [ProjectM36.Client Library](docs/projectm36_client_library.markdown)
23−
23+1. [Adding New Data Types](docs/new_datatypes.markdown)
2424
2525## Development
2626
docs/new_datatypes.markdownnew file+20
@@ -0,0 +1,20 @@
1+# Creating New Data Types
2+
3+## Introduction
4+
5+The most common data types are built into Project:M36 directly. Such types include integers, text, byte strings, booleans and floats. It can often be handy to create one's own data types in a database and manipulate them as first-class values through the relational algebra.
6+
7+Project:M36 makes it easy to add any Haskell data type to the database. Any type which includes instances for a set of typeclasses can be supported.
8+
9+## Support
10+
11+Any Haskell data type which is an instance of ```Atomable``` is a candidate for a Project:M36 value called an ```Atom```. Database tuples are composed of Atoms.
12+
13+Project:M36 does not yet support dynamically-loaded components, so the data type must be compiled into the Project:M36 backend.
14+
15+### Implementation
16+
17+1. Create an instance of your data type for the ```Atomable``` typeclass. The ```Atomable``` typeclass implies instances for a variety of standard typeclasses.
18+1. Update the ```Binary Atom``` instance to include deserialization for your type.
19+1. Update the ```makeAtomFromText``` in ```ProjectM36/Atom.hs``` to support CSV import.
20+1. Optionally adjust ```TutorialD/Interpreter/RelationalExpression.hs``` to add support for parsing your data type in the TutorialD interpreter. Look for ```atomP```.