packages feed

composite-base 0.7.3.0 → 0.7.4.0

raw patch · 2 files changed

+21/−2 lines, 2 filesdep +deepseqPVP ok

version bump matches the API change (PVP)

Dependencies added: deepseq

API changes (from Hackage documentation)

+ Composite.Record: instance (Control.DeepSeq.NFData x, Control.DeepSeq.NFData (Composite.Record.Record xs)) => Control.DeepSeq.NFData (Composite.Record.Record (x : xs))
+ Composite.Record: instance Control.DeepSeq.NFData (Composite.Record.Record '[])
+ Composite.Record: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (s Composite.Record.:-> a)
+ Composite.Record: instance GHC.TypeLits.KnownSymbol s => Data.Vinyl.XRec.IsoHKD Data.Functor.Identity.Identity (s Composite.Record.:-> a)

Files

composite-base.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 9ad4c3dbcebb7a2fc26869aa4c21921b8a5c42df6ec18a74ec26bb63aba05ed5+-- hash: fb59636ec3fec271338fcf40579360e7d7bb49a3868128fe5e244a4f564acca1  name:           composite-base-version:        0.7.3.0+version:        0.7.4.0 synopsis:       Shared utilities for composite-* packages. description:    Shared helpers for the various composite packages. category:       Records@@ -33,6 +33,7 @@   ghc-options: -Wall -O2   build-depends:       base >=4.7 && <5+    , deepseq >=1.4 && <1.5     , exceptions >=0.8.3 && <0.11     , lens >=4.15.4 && <4.20     , monad-control >=1.0.2.2 && <1.1@@ -61,6 +62,7 @@       QuickCheck     , base >=4.7 && <5     , composite-base+    , deepseq >=1.4 && <1.5     , exceptions >=0.8.3 && <0.11     , hspec     , lens >=4.15.4 && <4.20
src/Composite/Record.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE UndecidableInstances #-} -- argh, for ReifyNames+{-# OPTIONS_GHC -fno-warn-orphans #-} module Composite.Record   ( Rec((:&), RNil), Record   , pattern (:*:), pattern (:^:)@@ -11,6 +12,7 @@   , RDelete, RDeletable, rdelete   ) where +import Control.DeepSeq(NFData(rnf)) import Control.Lens (Iso, iso) import Control.Lens.TH (makeWrapped) import Data.Functor.Identity (Identity(Identity))@@ -24,6 +26,7 @@ import Data.Vinyl.Functor (Compose(Compose), Const(Const), (:.)) import Data.Vinyl.Lens (type (∈), type (⊆)) import qualified Data.Vinyl.TypeLevel as Vinyl+import Data.Vinyl.XRec(IsoHKD(HKD, toHKD, unHKD)) import Foreign.Storable (Storable) import GHC.TypeLits (KnownSymbol, Symbol, symbolVal) @@ -81,8 +84,22 @@   Val a >>= k = k a   {-# INLINE (>>=) #-} +instance NFData a => NFData (s :-> a) where+  rnf (Val x) = rnf x++instance NFData (Record '[]) where+  rnf RNil = ()++instance (NFData x, NFData (Record xs)) => NFData (Record (x : xs)) where+  rnf (x :& xs) = rnf x `seq` rnf xs+ instance forall (s :: Symbol) a. (KnownSymbol s, Show a) => Show (s :-> a) where   showsPrec p (Val a) = ((symbolVal (Proxy :: Proxy s) ++ " :-> ") ++) . showsPrec p a++instance KnownSymbol s => IsoHKD Identity (s :-> a) where+  type HKD Identity (s :-> a) = a+  unHKD = Identity . Val+  toHKD (Identity (Val x)) = x  -- |Convenience function to make an @'Identity' (s ':->' a)@ with a particular symbol, used for named field construction. --