Guidelines for Adding New Types and Typeclasses in Drasil - JacquesCarette/Drasil GitHub Wiki
Warning: Wiki should not be edited directly. Edit the files in the ./wiki/ folder instead and make a PR.
Please see Chunks, Recipes, and Information Encoding for more details on the use of data types in Drasil.
Using Haskell types for Drasil
At a higher level, here is how we embed knowledge in Haskell:
- data constructors (whether ADTs or GADTs) are useful when we have multiple potential choices, and we need to discover at the point of use what we have, as these can be queried (by pattern matching)
- class methods are useful when we have many different representations, but they all share some core ideas. At the point of use, we just want "the idea" (via a function) and don't care about the details at all.
- record fields (with data) are useful when we have a specific representation that's made up of pieces, and we want to access the whole and the pieces
- record fields (with all functions) are one way to implement fake objects; they're basically equivalent to (Haskell) class methods
The above is a slightly edited copy of @JacquesCarette's discussion on a similar topic.
Type Dependency Graphs
To see a table of all up-to-date type dependency graphs in Drasil, visit our website. There are also class-instance dependency graphs along with module dependency graphs.
Datatypes list (Updated June 2021)
Types in drasil-lang
See the Haddock Documentation
Typeclasses
The typeclasses used by Drasil can be found in the Haddock Documentation. Specifically, the Language.Drasil and Drasil.Database contain some that may be helpful to reference.