Typo 1: Database.Persist.Quasi, section "Sum types", subsection "Field level"
In the subsection, one can find the following code snippet:
-- @Employment.hs
{-# LANGUAGE TemplateHaskell #-}
module Employment where
import Database.Persist.TH
import Prelude
data Employment = Employed | Unemployed | Retired
deriving (Show, Read, Eq)
derivePersistField Employment <-------
However, copying this code directly will result in the following error:
Illegal term-level use of the type constructor or class 'Employment'
...
In the first argument of 'derivedPersistField', namely
'Employment'
In the expression: derivePersistField Employment [GHC-31891]
This was likely a typo; changing Employment to "Employment" as a string seems to solve the issue.
Typo 2:
Right under the code snippet of the previous typo, there was the following passage:
derivePersistField stores sum type values as strins in the database. While not as efficient as using integers, this approach simplifies adding and removing values from your enumeration.
The strins likely should have been strings.
Typo 1:
Database.Persist.Quasi, section "Sum types", subsection "Field level"In the subsection, one can find the following code snippet:
However, copying this code directly will result in the following error:
This was likely a typo; changing
Employmentto"Employment"as a string seems to solve the issue.Typo 2:
Right under the code snippet of the previous typo, there was the following passage:
The strins likely should have been strings.