diff --git a/hasql.cabal b/hasql.cabal
--- a/hasql.cabal
+++ b/hasql.cabal
@@ -1,6 +1,6 @@
 cabal-version: 3.0
 name: hasql
-version: 1.9
+version: 1.9.1
 category: Hasql, Database, PostgreSQL
 synopsis: Fast PostgreSQL driver with a flexible mapping API
 description:
@@ -160,6 +160,7 @@
     transformers >=0.6 && <0.7,
     uuid >=1.3 && <2,
     vector >=0.10 && <0.14,
+    witherable >=0.5 && <0.6,
 
 library testing-kit
   import: base
diff --git a/library/Hasql/Decoders/All.hs b/library/Hasql/Decoders/All.hs
--- a/library/Hasql/Decoders/All.hs
+++ b/library/Hasql/Decoders/All.hs
@@ -19,7 +19,7 @@
 
 -- |
 -- Decoder of a query result.
-newtype Result a = Result (Results.Results a) deriving (Functor)
+newtype Result a = Result (Results.Results a) deriving (Functor, Filterable)
 
 -- |
 -- Decode no value from the result.
@@ -129,7 +129,7 @@
 -- |
 -- Decoder of a value.
 newtype Value a = Value (Value.Value a)
-  deriving (Functor)
+  deriving (Functor, Filterable)
 
 type role Value representational
 
@@ -292,7 +292,7 @@
 -- Refine a value decoder, lifting the possible error to the session level.
 {-# INLINEABLE refine #-}
 refine :: (a -> Either Text b) -> Value a -> Value b
-refine fn (Value v) = Value (Value.Value (\b -> A.refine fn (Value.run v b)))
+refine fn (Value v) = Value (Value.refine fn v)
 
 -- |
 -- A generic decoder of @HSTORE@ values.
diff --git a/library/Hasql/Decoders/Results.hs b/library/Hasql/Decoders/Results.hs
--- a/library/Hasql/Decoders/Results.hs
+++ b/library/Hasql/Decoders/Results.hs
@@ -20,6 +20,11 @@
   = Results (ReaderT (Bool, LibPQ.Connection) (ExceptT CommandError IO) a)
   deriving (Functor, Applicative, Monad)
 
+instance Filterable Results where
+  {-# INLINE mapMaybe #-}
+  mapMaybe fn =
+    refine (Prelude.maybe (Left "Invalid result") Right . fn)
+
 {-# INLINE run #-}
 run :: Results a -> LibPQ.Connection -> Bool -> IO (Either CommandError a)
 run (Results stack) conn idt =
diff --git a/library/Hasql/Decoders/Value.hs b/library/Hasql/Decoders/Value.hs
--- a/library/Hasql/Decoders/Value.hs
+++ b/library/Hasql/Decoders/Value.hs
@@ -7,6 +7,11 @@
   = Value (Bool -> A.Value a)
   deriving (Functor)
 
+instance Filterable Value where
+  {-# INLINE mapMaybe #-}
+  mapMaybe fn =
+    refine (maybe (Left "Invalid value") Right . fn)
+
 {-# INLINE run #-}
 run :: Value a -> Bool -> A.Value a
 run (Value imp) integerDatetimes =
@@ -22,3 +27,9 @@
 decoderFn :: (Bool -> ByteString -> Either Text a) -> Value a
 decoderFn fn =
   Value $ \integerDatetimes -> A.fn $ fn integerDatetimes
+
+-- |
+-- Refine a value decoder, lifting the possible error to the session level.
+{-# INLINE refine #-}
+refine :: (a -> Either Text b) -> Value a -> Value b
+refine fn (Value run) = Value (A.refine fn . run)
diff --git a/library/Hasql/Prelude.hs b/library/Hasql/Prelude.hs
--- a/library/Hasql/Prelude.hs
+++ b/library/Hasql/Prelude.hs
@@ -54,9 +54,9 @@
 import Data.IORef as Exports
 import Data.Int as Exports
 import Data.Ix as Exports
-import Data.List as Exports hiding (all, and, any, concat, concatMap, elem, find, foldl, foldl', foldl1, foldr, foldr1, isSubsequenceOf, mapAccumL, mapAccumR, maximum, maximumBy, minimum, minimumBy, notElem, or, product, sortOn, sum, uncons)
+import Data.List as Exports hiding (all, and, any, concat, concatMap, elem, filter, find, foldl, foldl', foldl1, foldr, foldr1, isSubsequenceOf, mapAccumL, mapAccumR, maximum, maximumBy, minimum, minimumBy, notElem, or, product, sortOn, sum, uncons)
 import Data.List.NonEmpty as Exports (NonEmpty (..))
-import Data.Maybe as Exports
+import Data.Maybe as Exports hiding (catMaybes, mapMaybe)
 import Data.Monoid as Exports hiding (Alt, (<>))
 import Data.Ord as Exports
 import Data.Profunctor.Unsafe as Exports
@@ -101,7 +101,8 @@
 import Text.ParserCombinators.ReadPrec as Exports (ReadPrec, readP_to_Prec, readPrec_to_P, readPrec_to_S, readS_to_Prec)
 import Text.Printf as Exports (hPrintf, printf)
 import Unsafe.Coerce as Exports
-import Prelude as Exports hiding (Read, all, and, any, concat, concatMap, elem, fail, foldl, foldl1, foldr, foldr1, id, mapM, mapM_, maximum, minimum, notElem, or, product, sequence, sequence_, sum, (.))
+import Witherable as Exports
+import Prelude as Exports hiding (Read, all, and, any, concat, concatMap, elem, fail, filter, foldl, foldl1, foldr, foldr1, id, mapM, mapM_, maximum, minimum, notElem, or, product, sequence, sequence_, sum, (.))
 
 type LazyByteString =
   Data.ByteString.Lazy.ByteString
diff --git a/library/Hasql/Statement.hs b/library/Hasql/Statement.hs
--- a/library/Hasql/Statement.hs
+++ b/library/Hasql/Statement.hs
@@ -64,6 +64,11 @@
   {-# INLINE fmap #-}
   fmap = rmap
 
+instance Filterable (Statement params) where
+  {-# INLINE mapMaybe #-}
+  mapMaybe filtrator (Statement template encoder decoder preparable) =
+    Statement template encoder (mapMaybe filtrator decoder) preparable
+
 instance Profunctor Statement where
   {-# INLINE dimap #-}
   dimap f1 f2 (Statement template encoder decoder preparable) =
