Formatting

This commit is contained in:
rightfold 2017-06-13 11:49:07 +02:00
parent 49a2465e5f
commit 13d0fcfb8e
No known key found for this signature in database
GPG Key ID: 199D0373AC917A8F
2 changed files with 9 additions and 10 deletions

View File

@ -2,9 +2,8 @@
purescript-postgresql-client is a PostgreSQL client library for PureScript.
To use this library, you need to add `pg` as an npm dependency.
`pg` being the npm repo of https://github.com/brianc/node-postgres
To use this library, you need to add `pg` as an npm dependency. You can also
find this npm library on [https://github.com/brianc/node-postgres][pg].
The purspgpp preprocessor has been replaced by [sqltopurs], which is a code
generator instead of a preprocessor, and easier to use.

View File

@ -3,6 +3,7 @@ module Database.PostgreSQL.Value where
import Control.Monad.Eff (kind Effect)
import Control.Monad.Error.Class (throwError)
import Control.Monad.Except (runExcept)
import Data.Array as Array
import Data.Bifunctor (lmap)
import Data.ByteString (ByteString)
import Data.DateTime.Instant (Instant)
@ -10,7 +11,6 @@ import Data.Either (Either)
import Data.Foreign (Foreign, isNull, readArray, readBoolean, readChar, readInt, readNumber, readString, toForeign, unsafeFromForeign)
import Data.List (List)
import Data.List as List
import Data.Array(fromFoldable)
import Data.Maybe (Maybe(..))
import Data.Traversable (traverse)
import Prelude
@ -53,17 +53,17 @@ instance toSQLValueString :: ToSQLValue String where
instance fromSQLValueString :: FromSQLValue String where
fromSQLValue = lmap show <<< runExcept <<< readString
instance fromSQLValueArray :: (FromSQLValue a) => FromSQLValue (Array a) where
fromSQLValue = traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
instance toSQLValueArray :: (ToSQLValue a) => ToSQLValue (Array a) where
toSQLValue = toForeign <<< map toSQLValue
instance fromSQLValueList :: (FromSQLValue a) => FromSQLValue (List a) where
fromSQLValue = map List.fromFoldable <<< traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
instance fromSQLValueArray :: (FromSQLValue a) => FromSQLValue (Array a) where
fromSQLValue = traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
instance toSQLValueList :: (ToSQLValue a) => ToSQLValue (List a) where
toSQLValue = toForeign <<< fromFoldable <<< map toSQLValue
toSQLValue = toForeign <<< Array.fromFoldable <<< map toSQLValue
instance fromSQLValueList :: (FromSQLValue a) => FromSQLValue (List a) where
fromSQLValue = map List.fromFoldable <<< traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
instance toSQLValueByteString :: ToSQLValue ByteString where
toSQLValue = toForeign