<p>Haskell Stack: <a href="https://docs.haskellstack.org/en/stable/README/">https://docs.haskellstack.org/en/stable/README/</a></p>
<p>Stack is a build tool for Haskell with focus on reproducible build plans, multi-package projects, and a consistent, easy-to-learn interface. With stack, one can create new project: <kbd>stack new my-project yesod-sqlite</kbd> (more in the quick start guide: <a href="https://www.yesodweb.com/page/quickstart">https://www.yesodweb.com/page/quickstart</a>)</p>

<p><a href="https://github.com/Tuula/deep-sky/blob/baa0807dd36b61fd02174b17c10013862af4ec18/config/models">models</a> is used to define shape of the data and Yesod uses it to generate datatypes and database for you. For example, to define a Star that has name, spectral type, luminosity class and link to StarSystem, one can write:</p>

<pre><code>
Star json
    name Text
    starSystemId StarSystemId
    spectralType SpectralType
    luminosityClass LuminosityClass
</code></pre>

<p>Custom types, like LuminosityClass, need mapping between datatype and database. In simple cases like this, Yesod can do that:

<pre><code>
data LuminosityClass = Iap | Ia | Iab | Ib | II | III | IV | V | VI | VII
    deriving (Show, Read, Eq)
derivePersistField "LuminosityClass"
</code></pre>

<p>The "derivePersistField" part is template haskell call that will generate mapping needed.</p>

<p>For those interested seeing some code, source is available at <a href="https://github.com/Tuula/deep-sky/">https://github.com/Tuula/deep-sky/</a> (<a href="https://github.com/Tuula/deep-sky/tree/baa0807dd36b61fd02174b17c10013862af4ec18">https://github.com/Tuula/deep-sky/tree/baa0807dd36b61fd02174b17c10013862af4ec18</a> is situation before lots of Elm related changes that I mentioned in passing in the episode)</p>

