Skip to content

Commit

Permalink
added deepseq constraint on Enum so that paramList works as expected.
Browse files Browse the repository at this point in the history
  • Loading branch information
Montmorency committed Sep 5, 2022
1 parent 63b9a6b commit 0d63007
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions IHP/SchemaCompiler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ compileTypes options schema@(Schema statements) =
<> "import qualified Database.PostgreSQL.Simple.Types\n"
<> "import IHP.Job.Types\n"
<> "import IHP.Job.Queue ()\n"
<> "import qualified Control.DeepSeq as DeepSeq\n"
<> "import qualified Data.Dynamic\n"
<> "import Data.Scientific\n"

Expand Down Expand Up @@ -339,6 +340,7 @@ compileEnumDataDefinitions enum@(CreateEnumType { name, values }) =
<> "instance Default " <> modelName <> " where def = " <> enumValueToConstructorName (unsafeHead values) <> "\n"
<> "instance ToField " <> modelName <> " where\n" <> indent (unlines (map compileToFieldInstanceForValue values))
<> "instance InputValue " <> modelName <> " where\n" <> indent (unlines (map compileInputValue values)) <> "\n"
<> "instance DeepSeq.NFData " <> modelName <> " where\n" <> indent ("rnf a = ()") <> "\n"
<> "instance IHP.Controller.Param.ParamReader " <> modelName <> " where readParameter = IHP.Controller.Param.enumParamReader; readParameterJSON = IHP.Controller.Param.enumParamReaderJSON\n"
where
modelName = tableNameToModelName name
Expand Down

0 comments on commit 0d63007

Please sign in to comment.