Skip to content

Commit

Permalink
Merge pull request #1829 from digitallyinduced/amitaibu-patch-3
Browse files Browse the repository at this point in the history
Add `Bounded` to Enums
  • Loading branch information
mpscholten authored Sep 30, 2023
2 parents 275c010 + ce6efcc commit 95891d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion IHP/SchemaCompiler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ findForeignKeyConstraint CreateTable { name } column =
compileEnumDataDefinitions :: (?schema :: Schema) => Statement -> Text
compileEnumDataDefinitions CreateEnumType { values = [] } = "" -- Ignore enums without any values
compileEnumDataDefinitions enum@(CreateEnumType { name, values }) =
"data " <> modelName <> " = " <> (intercalate " | " valueConstructors) <> " deriving (Eq, Show, Read, Enum)\n"
"data " <> modelName <> " = " <> (intercalate " | " valueConstructors) <> " deriving (Eq, Show, Read, Enum, Bounded)\n"
<> "instance FromField " <> modelName <> " where\n"
<> indent (unlines (map compileFromFieldInstanceForValue values))
<> " fromField field (Just value) = returnError ConversionFailed field (\"Unexpected value for enum value. Got: \" <> Data.String.Conversions.cs value)\n"
Expand Down

0 comments on commit 95891d0

Please sign in to comment.