packages feed

extensible 0.8 → 0.8.1

raw patch · 5 files changed

+40/−3 lines, 5 filesdep +incrementalPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: incremental

API changes (from Hackage documentation)

- Data.Extensible.Dictionary: instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Text.Prettyprint.Doc.Internal.Pretty h xs => Data.Text.Prettyprint.Doc.Internal.Pretty (xs Data.Extensible.Struct.:& h)
- Data.Extensible.Dictionary: instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Text.Prettyprint.Doc.Internal.Pretty h xs => Data.Text.Prettyprint.Doc.Internal.Pretty (xs Data.Extensible.Sum.:/ h)
- Data.Extensible.Field: instance forall v1 (k :: GHC.Types.Symbol) (h :: v1 -> Type) (v2 :: v1). (GHC.TypeLits.KnownSymbol k, Data.Text.Prettyprint.Doc.Internal.Pretty (h v2)) => Data.Text.Prettyprint.Doc.Internal.Pretty (Data.Extensible.Field.Field h (k 'Type.Membership.Internal.:> v2))
- Data.Extensible.Wrapper: instance forall j (f :: j -> Type) i (g :: i -> j) (a :: i). Data.Text.Prettyprint.Doc.Internal.Pretty (f (g a)) => Data.Text.Prettyprint.Doc.Internal.Pretty (Data.Extensible.Wrapper.Comp f g a)
+ Data.Extensible.Dictionary: instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Incremental.Incremental h xs => Data.Incremental.Incremental (xs Data.Extensible.Struct.:& h)
+ Data.Extensible.Dictionary: instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Prettyprinter.Internal.Pretty h xs => Prettyprinter.Internal.Pretty (xs Data.Extensible.Struct.:& h)
+ Data.Extensible.Dictionary: instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Prettyprinter.Internal.Pretty h xs => Prettyprinter.Internal.Pretty (xs Data.Extensible.Sum.:/ h)
+ Data.Extensible.Dictionary: instance forall v (xs :: [Type.Membership.Internal.Assoc GHC.Types.Symbol v]) (h :: v -> Type). Type.Membership.Forall (Type.Membership.KeyIs GHC.TypeLits.KnownSymbol) xs => Data.Csv.Conversion.DefaultOrdered (Data.Extensible.Field.RecordOf h xs)
+ Data.Extensible.Field: instance forall k v (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Data.Incremental.Incremental (h (Type.Membership.TargetOf kv)) => Data.Incremental.Incremental (Data.Extensible.Field.Field h kv)
+ Data.Extensible.Field: instance forall v1 (k :: GHC.Types.Symbol) (h :: v1 -> Type) (v2 :: v1). (GHC.TypeLits.KnownSymbol k, Prettyprinter.Internal.Pretty (h v2)) => Prettyprinter.Internal.Pretty (Data.Extensible.Field.Field h (k 'Type.Membership.Internal.:> v2))
+ Data.Extensible.Internal.Rig: instance GHC.Base.Functor (Data.Extensible.Internal.Rig.Exchange a b s)
+ Data.Extensible.Wrapper: instance forall j (f :: j -> Type) i (g :: i -> j) (a :: i). Prettyprinter.Internal.Pretty (f (g a)) => Prettyprinter.Internal.Pretty (Data.Extensible.Wrapper.Comp f g a)

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+0.8.1+------------------------------------------------+* Added `DefaultOrdered` and `Incremental` instances to `:&`+* Added an `Incremental` instance to `Field`+ 0.8 ------------------------------------------------ 
extensible.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.4 name:                extensible-version:             0.8+version:             0.8.1 synopsis:            Extensible, efficient, optics-friendly data types and effects homepage:            https://github.com/fumieval/extensible bug-reports:         http://github.com/fumieval/extensible/issues@@ -12,11 +12,11 @@ license-file:        LICENSE author:              Fumiaki Kinoshita maintainer:          Fumiaki Kinoshita <fumiexcel@gmail.com>-copyright:           Copyright (c) 2017 Fumiaki Kinoshita+copyright:           Copyright (c) 2017-2020 Fumiaki Kinoshita category:            Data, Records build-type:          Simple stability:           experimental-Tested-With:         GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.2+Tested-With:         GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.2  extra-source-files:   examples/*.hs@@ -79,6 +79,7 @@     , deepseq     , ghc-prim     , hashable+    , incremental >= 0.3.1     , membership     , monad-skeleton >= 0.1.2     , prettyprinter >= 1.2.1 && <2
src/Data/Extensible/Dictionary.hs view
@@ -38,6 +38,9 @@ import Data.Extensible.Wrapper import Data.Hashable import qualified Data.HashMap.Strict as HM+import Data.Incremental+import Data.Maybe (isJust)+import Data.Monoid (Any(..)) import Data.Text.Prettyprint.Doc import qualified Data.Vector.Generic as G import qualified Data.Vector.Generic.Mutable as M@@ -203,6 +206,12 @@   toNamedRecord = hfoldlWithIndexFor (Proxy :: Proxy (KeyTargetAre KnownSymbol (Instance1 Csv.ToField h)))     (\k m v -> HM.insert (BC.pack (symbolVal (proxyKeyOf k))) (Csv.toField v) m)     HM.empty++instance Forall (KeyIs KnownSymbol) xs => Csv.DefaultOrdered (RecordOf h xs) where+  headerOrder _ = V.fromList $ henumerateFor+    (Proxy :: Proxy (KeyIs KnownSymbol))+    (Proxy :: Proxy xs)+    (\k r -> stringKeyOf k : r) [] #endif  -- | @'parseJSON' 'J.Null'@ is called for missing fields.@@ -315,3 +324,19 @@   baddDicts (EmbedAt i x) = EmbedAt i (Pair (hlookup i bdicts) x)  #endif++instance WrapForall Incremental h xs => Incremental (xs :& h) where+  type Delta (xs :& h) = xs :& WrapDelta h+  patch r =+    hmapWithIndexFor+      (Proxy :: Proxy (Instance1 Incremental h))+      (\i (WrapDelta d) -> maybe (hlookup i r) (patch (hlookup i r)) d)+  diff r =+    check+      . hmapWithIndexFor+        (Proxy :: Proxy (Instance1 Incremental h))+        (\i x -> WrapDelta (diff (hlookup i r) x))+    where+      check t+        | getAny $ hfoldMap (Any . isJust . unwrapDelta) t = Just t+        | otherwise = Nothing
src/Data/Extensible/Field.hs view
@@ -64,6 +64,7 @@ import Data.Extensible.Wrapper import Data.Functor.Identity import Data.Hashable+import Data.Incremental (Incremental) import Data.String import Data.Text.Prettyprint.Doc import qualified Data.Vector.Generic as G@@ -111,6 +112,7 @@ ND_Field(Csv.FromField) ND_Field(Csv.ToField) #endif+ND_Field(Incremental)  newtype instance U.MVector s (Field h x) = MV_Field (U.MVector s (h (TargetOf x))) newtype instance U.Vector (Field h x) = V_Field (U.Vector (h (TargetOf x)))
src/Data/Extensible/Internal/Rig.hs view
@@ -47,6 +47,10 @@ -- | Reifies the structure of 'Iso's data Exchange a b s t = Exchange (s -> a) (b -> t) +instance Functor (Exchange a b s) where+  fmap f (Exchange sa bt) = Exchange sa (f . bt)+  {-# INLINE fmap #-}+ instance Profunctor (Exchange a b) where   dimap f g (Exchange sa bt) = Exchange (sa . f) (g . bt)   {-# INLINE dimap #-}