Skip to content

Commit

Permalink
Derive Traversable for Value (#414)
Browse files Browse the repository at this point in the history
* Derive Traversable for Value

* changelog, cabal
  • Loading branch information
parsonsmatt authored Dec 26, 2024
1 parent 91aa8d2 commit 235bd9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.5.14.0 (unreleased)
========
- @parsonsmatt
- [#414](https://github.com/bitemyapp/esqueleto/pull/414)
- Derive `Foldable` and `Traversable` for `Value`.

3.5.13.2
========
- @blujupiter32
Expand Down
2 changes: 1 addition & 1 deletion esqueleto.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cabal-version: 1.12

name: esqueleto

version: 3.5.13.2
version: 3.5.14.0
synopsis: Type-safe EDSL for SQL queries on persistent backends.
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.
.
Expand Down
8 changes: 3 additions & 5 deletions src/Database/Esqueleto/Internal/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
Expand Down Expand Up @@ -1270,11 +1271,8 @@ else_ = id

-- | A single value (as opposed to a whole entity). You may use
-- @('^.')@ or @('?.')@ to get a 'Value' from an 'Entity'.
newtype Value a = Value { unValue :: a } deriving (Eq, Ord, Show, Typeable)

-- | @since 1.4.4
instance Functor Value where
fmap f (Value a) = Value (f a)
newtype Value a = Value { unValue :: a }
deriving (Eq, Ord, Show, Typeable, Functor, Foldable, Traversable)

instance Applicative Value where
(<*>) (Value f) (Value a) = Value (f a)
Expand Down

0 comments on commit 235bd9a

Please sign in to comment.