From a68279e6c42192d17aae2c1acc3188030253c7ba Mon Sep 17 00:00:00 2001 From: rightfold Date: Tue, 4 Apr 2017 13:33:19 +0200 Subject: [PATCH] Add FromSQLValue Boolean instance --- src/Database/PostgreSQL.purs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Database/PostgreSQL.purs b/src/Database/PostgreSQL.purs index 3f1c642..9b197ba 100644 --- a/src/Database/PostgreSQL.purs +++ b/src/Database/PostgreSQL.purs @@ -28,7 +28,7 @@ import Data.Array (head) import Data.ByteString (ByteString) import Data.DateTime.Instant (Instant) import Data.Either (Either(..)) -import Data.Foreign (Foreign, isNull, readArray, readChar, readInt, readString, toForeign, unsafeFromForeign) +import Data.Foreign (Foreign, isNull, readArray, readBoolean, readChar, readInt, readString, toForeign, unsafeFromForeign) import Data.Foreign.Null (writeNull) import Data.List (List) import Data.List as List @@ -112,6 +112,9 @@ instance fromSQLRowTuple5 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fr instance toSQLValueBoolean :: ToSQLValue Boolean where toSQLValue = toForeign +instance fromSQLValueBoolean :: FromSQLValue Boolean where + fromSQLValue = fromRight <<< runExcept <<< readBoolean + instance toSQLValueChar :: ToSQLValue Char where toSQLValue = toForeign