Add FromField Word

This commit is contained in:
2023-09-17 05:31:32 +02:00
parent e307ee73d8
commit 83d2c07396
2 changed files with 21 additions and 0 deletions
@@ -56,6 +56,7 @@ instance FromField Char where
parseField = anyChar
-- | See https://www.postgresql.org/docs/current/datatype-numeric.html.
-- We assume that 'Int' has 64 bits. This is not guaranteed but reasonable enough.
instance FromField Int where
validOid Proxy = Oid.smallint \/ Oid.integer \/ Oid.bigint
parseField = signed decimal
@@ -65,6 +66,10 @@ instance FromField Integer where
validOid Proxy = Oid.smallint \/ Oid.integer \/ Oid.bigint
parseField = signed decimal
instance FromField Word where
validOid Proxy = Oid.smallint \/ Oid.integer \/ Oid.bigint
parseField = decimal
doubleParser :: Parser Double
doubleParser = choice
[ string "NaN" $> nan