Replace ad-hoc isLeft by import from Data.Either
This commit is contained in:
parent
3a5488c89d
commit
20d150d12c
@ -67,8 +67,9 @@ execParams conn query params = do
|
|||||||
Nothing -> pure result
|
Nothing -> pure result
|
||||||
Just message -> except $ Left $ ErrorInvalidResult status $ Encoding.decodeUtf8 message
|
Just message -> except $ Left $ ErrorInvalidResult status $ Encoding.decodeUtf8 message
|
||||||
|
|
||||||
|
-- The order of the type parameters is important, because it is more common to use type applications for providing the row type.
|
||||||
fetch
|
fetch
|
||||||
:: forall a b. (ToParamList a, FromRow b)
|
:: forall b a. (ToParamList a, FromRow b)
|
||||||
=> Connection
|
=> Connection
|
||||||
-> Text
|
-> Text
|
||||||
-> a
|
-> a
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
module Database.PostgreSQL.OpiumSpec (spec) where
|
module Database.PostgreSQL.OpiumSpec (spec) where
|
||||||
|
|
||||||
import Data.ByteString (ByteString)
|
import Data.ByteString (ByteString)
|
||||||
|
import Data.Either (isLeft)
|
||||||
import Data.Functor.Identity (Identity (..))
|
import Data.Functor.Identity (Identity (..))
|
||||||
import Data.Proxy (Proxy (..))
|
import Data.Proxy (Proxy (..))
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
@ -53,10 +54,6 @@ newtype Only a = Only
|
|||||||
|
|
||||||
instance Opium.FromField a => Opium.FromRow (Only a) where
|
instance Opium.FromField a => Opium.FromRow (Only a) where
|
||||||
|
|
||||||
isLeft :: Either a b -> Bool
|
|
||||||
isLeft (Left _) = True
|
|
||||||
isLeft _ = False
|
|
||||||
|
|
||||||
shouldHaveColumns
|
shouldHaveColumns
|
||||||
:: Opium.FromRow a
|
:: Opium.FromRow a
|
||||||
=> Proxy a
|
=> Proxy a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user