Frames-map-reduce 0.4.1.1 → 0.4.1.2
raw patch · 5 files changed
+38/−20 lines, 5 filesdep ~basedep ~hashabledep ~textPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, hashable, text, vinyl
API changes (from Hackage documentation)
- Frames.MapReduce: instance (Data.Vinyl.Derived.KnownField t, Data.Hashable.Class.Hashable (Data.Vinyl.TypeLevel.Snd t), Data.Hashable.Class.Hashable (Frames.Rec.Record rs), rs Data.Vinyl.Lens.⊆ (t : rs)) => Data.Hashable.Class.Hashable (Frames.Rec.Record (t : rs))
- Frames.MapReduce: instance Data.Hashable.Class.Hashable (Frames.Rec.Record '[])
- Frames.MapReduce.General: instance (Data.Vinyl.Derived.KnownField t, GHC.Base.Functor f, Frames.MapReduce.General.RecGetFieldC t record f (t : rs), Frames.MapReduce.General.RCastC rs (t : rs) record f, Data.Hashable.Class.Hashable (f (Data.Vinyl.TypeLevel.Snd t)), Data.Hashable.Class.Hashable (record (f Data.Vinyl.Functor.:. Data.Vinyl.Functor.ElField) rs)) => Data.Hashable.Class.Hashable (record (f Data.Vinyl.Functor.:. Data.Vinyl.Functor.ElField) (t : rs))
- Frames.MapReduce.General: instance (Data.Vinyl.TypeLevel.NatToInt (Data.Vinyl.TypeLevel.RLength rs), Data.Vinyl.Core.RecApplicative rs, Data.Vinyl.Core.RPureConstrained (Data.Vinyl.ARec.Internal.IndexableField rs) rs) => Frames.MapReduce.General.IsoRec rs Data.Vinyl.ARec.Internal.ARec f
- Frames.MapReduce.General: instance forall k (record :: ((GHC.Types.Symbol, *) -> *) -> [k] -> *) (f :: * -> *). Data.Hashable.Class.Hashable (record (f Data.Vinyl.Functor.:. Data.Vinyl.Functor.ElField) '[])
+ Frames.MapReduce: instance (GHC.Generics.Generic (Data.Vinyl.Core.Rec Data.Vinyl.Functor.ElField rs), GHC.Classes.Eq (Data.Vinyl.Core.Rec Data.Vinyl.Functor.ElField rs), Data.Hashable.Class.GHashable Data.Hashable.Class.Zero (GHC.Generics.Rep (Data.Vinyl.Core.Rec Data.Vinyl.Functor.ElField rs))) => Data.Hashable.Class.Hashable (Data.Vinyl.Core.Rec Data.Vinyl.Functor.ElField rs)
+ Frames.MapReduce.General: instance (Data.Vinyl.Derived.KnownField t, GHC.Base.Functor f, Frames.MapReduce.General.RecGetFieldC t record f (t : rs), Frames.MapReduce.General.RCastC rs (t : rs) record f, GHC.Classes.Eq (record (f Data.Vinyl.Functor.:. Data.Vinyl.Functor.ElField) (t : rs)), Data.Hashable.Class.Hashable (f (Data.Vinyl.TypeLevel.Snd t)), Data.Hashable.Class.Hashable (record (f Data.Vinyl.Functor.:. Data.Vinyl.Functor.ElField) rs)) => Data.Hashable.Class.Hashable (record (f Data.Vinyl.Functor.:. Data.Vinyl.Functor.ElField) (t : rs))
+ Frames.MapReduce.General: instance (Data.Vinyl.TypeLevel.NatToInt (Data.Vinyl.TypeLevel.RLength rs), Data.Vinyl.Core.RecApplicative rs, Data.Vinyl.Core.RPureConstrained (Data.Vinyl.ARec.Internal.IndexableField rs) rs, Data.Vinyl.ARec.Internal.ToARec rs) => Frames.MapReduce.General.IsoRec rs Data.Vinyl.ARec.Internal.ARec f
+ Frames.MapReduce.General: instance forall k (record :: ((GHC.Types.Symbol, *) -> *) -> [k] -> *) (f :: * -> *). GHC.Classes.Eq (record (f Data.Vinyl.Functor.:. Data.Vinyl.Functor.ElField) '[]) => Data.Hashable.Class.Hashable (record (f Data.Vinyl.Functor.:. Data.Vinyl.Functor.ElField) '[])
- Frames.Aggregation: aggregateAllFold :: forall ak ak' d. ((ak' ++ d) ⊆ ((ak ++ d) ++ ak'), ak ⊆ (ak ++ d), ak' ⊆ (ak' ++ d), d ⊆ (ak' ++ d), Ord (Record ak'), Ord (Record ak), RecVec (ak' ++ d)) => RecordKeyMap ak ak' -> Fold (Record d) (Record d) -> Fold (Record (ak ++ d)) (FrameRec (ak' ++ d))
+ Frames.Aggregation: aggregateAllFold :: forall ak ak' d. AggregateAllC ak ak' d => RecordKeyMap ak ak' -> Fold (Record d) (Record d) -> Fold (Record (ak ++ d)) (FrameRec (ak' ++ d))
Files
- CHANGELOG.md +3/−0
- Frames-map-reduce.cabal +5/−5
- src/Frames/Aggregation.hs +1/−8
- src/Frames/MapReduce.hs +13/−2
- src/Frames/MapReduce/General.hs +16/−5
CHANGELOG.md view
@@ -1,3 +1,6 @@+v0.4.4.2+* Bumped upper bounds in cabal+ v 0.4.1.1 * Bumped some upper bounds
Frames-map-reduce.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: Frames-map-reduce-version: 0.4.1.1+version: 0.4.1.2 synopsis: Frames wrapper for map-reduce-folds and some extra folds helpers. description: Frames-map-reduce provides some helpers for using the map-reduce-folds library with vinyl records and Frames. These include functions for filtering Frames, splitting records into key columns and data columns and@@ -36,12 +36,12 @@ , Frames.Aggregation.Maybe build-depends: Frames >= 0.6.1 && < 0.8,- base >= 4.12.0 && < 4.17,+ base >= 4.12.0 && < 5, containers >= 0.5.0 && < 0.7,- hashable >= 1.2.7 && < 1.4,+ hashable >= 1.2.7 && < 1.6, map-reduce-folds >= 0.1.0 && < 0.2, profunctors >= 5.3 && < 5.7,- vinyl >= 0.11.0 && < 0.14,+ vinyl >= 0.11.0 && < 0.15, foldl >= 1.4.5 && < 1.5, newtype >= 0.2 && < 0.3 hs-source-dirs: src@@ -57,7 +57,7 @@ foldl, Frames, Frames-map-reduce,- text >= 1.2.3 && < 1.3,+ text >= 1.2.3 && < 2.2, vector, vinyl, random >= 1.2 && < 1.3,
src/Frames/Aggregation.hs view
@@ -108,14 +108,7 @@ -- perform a weighted-sum over the percentages. aggregateAllFold :: forall ak ak' d- . ( (ak' V.++ d) F.⊆ ((ak V.++ d) V.++ ak')- , ak F.⊆ (ak V.++ d)- , ak' F.⊆ (ak' V.++ d)- , d F.⊆ (ak' V.++ d)- , Ord (F.Record ak')- , Ord (F.Record ak)- , FI.RecVec (ak' V.++ d)- )+ . AggregateAllC ak ak' d => RecordKeyMap ak ak' -- ^ get aggregated key from key -> (FL.Fold (F.Record d) (F.Record d)) -- ^ aggregate data -> FL.Fold (F.Record (ak V.++ d)) (F.FrameRec (ak' V.++ d))
src/Frames/MapReduce.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-}@@ -67,7 +68,17 @@ import qualified Data.Vinyl as V import qualified Data.Vinyl.TypeLevel as V +#if MIN_VERSION_base(4,16,0)+import GHC.Generics (Generic, Rep)+import Data.Hashable.Generic as Hash+#endif+ -- | This is only here so we can use hash maps for the grouping step. This should properly be in Frames itself.+#if MIN_VERSION_base(4,16,0)+instance (Generic (V.Rec V.ElField rs), Eq (V.Rec V.ElField rs), Hash.GHashable Hash.Zero (Rep (V.Rec V.ElField rs))) => Hash.Hashable (V.Rec V.ElField rs) where+ hashWithSalt = Hash.genericHashWithSalt+ {-# INLINEABLE hashWithSalt #-}+#else instance Hash.Hashable (F.Record '[]) where hash = const 0 {-# INLINABLE hash #-}@@ -77,8 +88,8 @@ instance (V.KnownField t, Hash.Hashable (V.Snd t), Hash.Hashable (F.Record rs), rs F.⊆ (t ': rs)) => Hash.Hashable (F.Record (t ': rs)) where hashWithSalt s r = s `Hash.hashWithSalt` (F.rgetField @t r) `Hash.hashWithSalt` (F.rcast @rs r) {-# INLINABLE hashWithSalt #-}---- | Filter records using a function on the entire record. +#endif+-- | Filter records using a function on the entire record. unpackFilterRow :: (F.Record rs -> Bool) -> MR.Unpack (F.Record rs) (F.Record rs) unpackFilterRow test = MR.Filter test
src/Frames/MapReduce/General.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-}@@ -88,7 +89,11 @@ instance (V.NatToInt (V.RLength rs) , V.RecApplicative rs- , V.RPureConstrained (V.IndexableField rs) rs) => IsoRec rs V.ARec f where+ , V.RPureConstrained (V.IndexableField rs) rs+#if MIN_VERSION_vinyl(0,14,2)+ , V.ToARec rs+#endif+ ) => IsoRec rs V.ARec f where toRec = V.fromARec fromRec = V.toARec @@ -104,27 +109,35 @@ `V.rappend` (toRec @bs @record @f rhs) -- | This is only here so we can use hash maps for the grouping step. This should properly be in Frames itself.+#if MIN_VERSION_hashable(1,4,0)+instance Eq (record (f :. ElField) '[]) => Hash.Hashable (record (f :. ElField) '[]) where+#else instance Hash.Hashable (record (f :. ElField) '[]) where+#endif hash = const 0 {-# INLINABLE hash #-} hashWithSalt s = const s -- TODO: this seems BAD! Or not? {-# INLINABLE hashWithSalt #-} + instance (V.KnownField t , Functor f , RecGetFieldC t record f (t ': rs) , RCastC rs (t ': rs) record f+#if MIN_VERSION_hashable(1,4,0)+ , Eq (record (f :. ElField) (t ': rs))+#endif , Hash.Hashable (f (V.Snd t)) , Hash.Hashable (record (f :. ElField) rs) ) => Hash.Hashable (record (f :. ElField) (t ': rs)) where hashWithSalt s r = s `Hash.hashWithSalt` (rgetFieldF @t r) `Hash.hashWithSalt` (rcastF @rs r) {-# INLINABLE hashWithSalt #-} --- | Don't do anything +-- | Don't do anything unpackNoOp :: MR.Unpack (record (f :. ElField) rs) (record (f :. ElField) rs) unpackNoOp = MR.Filter (const True) --- | Filter records using a function on the entire record. +-- | Filter records using a function on the entire record. unpackFilterRow :: (record (f :. ElField) rs -> Bool) -> MR.Unpack (record (f :. ElField) rs) (record (f :. ElField) rs)@@ -270,5 +283,3 @@ where addKey k = fmap (\y -> fromRec . V.rappend (toRec k) . toRec $ makeRec y) {-# INLINABLE makeRecsWithKeyM #-}--