Merge pull request #45 from greydot/newtypes
Replace data with newtype in Value and ValueList.
This commit is contained in:
commit
37e2a88f03
@ -16,7 +16,6 @@ module Database.Esqueleto.Internal.Language
|
|||||||
Esqueleto(..)
|
Esqueleto(..)
|
||||||
, from
|
, from
|
||||||
, Value(..)
|
, Value(..)
|
||||||
, unValue
|
|
||||||
, ValueList(..)
|
, ValueList(..)
|
||||||
, SomeValue(..)
|
, SomeValue(..)
|
||||||
, ToSomeValues(..)
|
, ToSomeValues(..)
|
||||||
@ -624,9 +623,7 @@ else_ = id
|
|||||||
|
|
||||||
-- | A single value (as opposed to a whole entity). You may use
|
-- | A single value (as opposed to a whole entity). You may use
|
||||||
-- @('^.')@ or @('?.')@ to get a 'Value' from an 'Entity'.
|
-- @('^.')@ or @('?.')@ to get a 'Value' from an 'Entity'.
|
||||||
data Value a = Value a deriving (Eq, Ord, Show, Typeable)
|
newtype Value a = Value { unValue :: a } deriving (Eq, Ord, Show, Typeable)
|
||||||
-- Note: because of GHC bug #6124 we use @data@ instead of @newtype@.
|
|
||||||
-- <https://ghc.haskell.org/trac/ghc/ticket/6124>
|
|
||||||
|
|
||||||
|
|
||||||
-- | /Since: 1.4.4/
|
-- | /Since: 1.4.4/
|
||||||
@ -634,19 +631,10 @@ instance Functor Value where
|
|||||||
fmap f (Value a) = Value (f a)
|
fmap f (Value a) = Value (f a)
|
||||||
|
|
||||||
|
|
||||||
-- | Unwrap a 'Value'.
|
|
||||||
--
|
|
||||||
-- /Since: 1.4.1/
|
|
||||||
unValue :: Value a -> a
|
|
||||||
unValue (Value a) = a
|
|
||||||
|
|
||||||
|
|
||||||
-- | A list of single values. There's a limited set of functions
|
-- | A list of single values. There's a limited set of functions
|
||||||
-- able to work with this data type (such as 'subList_select',
|
-- able to work with this data type (such as 'subList_select',
|
||||||
-- 'valList', 'in_' and 'exists').
|
-- 'valList', 'in_' and 'exists').
|
||||||
data ValueList a = ValueList a deriving (Eq, Ord, Show, Typeable)
|
newtype ValueList a = ValueList a deriving (Eq, Ord, Show, Typeable)
|
||||||
-- Note: because of GHC bug #6124 we use @data@ instead of @newtype@.
|
|
||||||
-- <https://ghc.haskell.org/trac/ghc/ticket/6124>
|
|
||||||
|
|
||||||
|
|
||||||
-- | A wrapper type for for any @expr (Value a)@ for all a.
|
-- | A wrapper type for for any @expr (Value a)@ for all a.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user