Skip to content

Commit b42d628

Browse files
committed
Add Functor and Bifunctor instances for (:&)
1 parent 30a5e80 commit b42d628

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
3.5.11.3
2+
========
3+
- @isomorpheme
4+
- [#393](https://github.com/bitemyapp/esqueleto/pull/393)
5+
- Add Functor and Bifunctor instances for `(:&)`
6+
17
3.5.11.2
28
========
39
- @arguri

esqueleto.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cabal-version: 1.12
22

33
name: esqueleto
44

5-
version: 3.5.11.2
5+
version: 3.5.11.3
66
synopsis: Type-safe EDSL for SQL queries on persistent backends.
77
description: @esqueleto@ is a bare bones, type-safe EDSL for SQL queries that works with unmodified @persistent@ SQL backends. Its language closely resembles SQL, so you don't have to learn new concepts, just new syntax, and it's fairly easy to predict the generated SQL and optimize it for your backend. Most kinds of errors committed when writing SQL are caught as compile-time errors---although it is possible to write type-checked @esqueleto@ queries that fail at runtime.
88
.

src/Database/Esqueleto/Internal/Internal.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import Data.Semigroup
5252
import qualified Control.Monad.Trans.Reader as R
5353
import qualified Control.Monad.Trans.State as S
5454
import qualified Control.Monad.Trans.Writer as W
55+
import Data.Bifunctor (Bifunctor(..))
5556
import qualified Data.ByteString as B
5657
import Data.Coerce (coerce)
5758
import qualified Data.Conduit as C
@@ -1442,6 +1443,14 @@ data (:&) a b = a :& b
14421443
deriving (Eq, Show)
14431444
infixl 2 :&
14441445

1446+
-- | @since 3.5.11.3
1447+
instance Functor (:&) where
1448+
fmap = bimap id
1449+
1450+
-- | @since 3.5.11.3
1451+
instance Bifunctor (:&) where
1452+
bimap f g (x :& y) = f x :& g y
1453+
14451454
-- | Different kinds of locking clauses supported by 'locking'.
14461455
--
14471456
-- Note that each RDBMS has different locking support. The

0 commit comments

Comments
 (0)