greskell-core 0.1.2.7 → 0.1.3.0
raw patch · 4 files changed
+94/−1 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Greskell.AsIterator: instance Data.Greskell.AsIterator.AsIterator (GHC.Base.NonEmpty a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON Data.Semigroup.Internal.All
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON Data.Semigroup.Internal.Any
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Functor.Identity.Identity a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Monoid.First a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Monoid.Last a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.First a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Internal.Dual a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Internal.Product a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Internal.Sum a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Last a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Max a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Min a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Option a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.WrappedMonoid a)
+ Data.Greskell.GraphSON: instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (GHC.Base.NonEmpty a)
Files
- ChangeLog.md +27/−0
- greskell-core.cabal +1/−1
- src/Data/Greskell/AsIterator.hs +4/−0
- src/Data/Greskell/GraphSON.hs +62/−0
ChangeLog.md view
@@ -1,5 +1,32 @@ # Revision history for greskell-core +## 0.1.3.0 -- 2019-12-27++### GraphSON module++* Add `FromGraphSON` instances to the following wrapper types.+ * `Identity` functor+ * `NonEmpty` list+ * From `Data.Semigroup`+ * `Min`+ * `Max`+ * `First`+ * `Last`+ * `WrappedMonoid`+ * `Dual`+ * `Option`+ * From `Data.Monoid`+ * `First`+ * `Last`+ * `Sum`+ * `Product`+ * `All`+ * `Any`++### AsIterator module++* Add `AsIterator` instance to `NonEmpty`.+ ## 0.1.2.7 -- 2019-10-02 * Confirm test with `hashable-1.3.0.0` and `semigroups-0.19.1`.
greskell-core.cabal view
@@ -1,5 +1,5 @@ name: greskell-core-version: 0.1.2.7+version: 0.1.3.0 author: Toshio Ito <debug.ito@gmail.com> maintainer: Toshio Ito <debug.ito@gmail.com> license: BSD3
src/Data/Greskell/AsIterator.hs view
@@ -11,6 +11,7 @@ import qualified Data.HashMap.Lazy as L (HashMap) import Data.HashSet (HashSet)+import Data.List.NonEmpty (NonEmpty) import Data.Int (Int8, Int16, Int32, Int64) import qualified Data.IntMap.Lazy as L (IntMap) import Data.IntSet (IntSet)@@ -107,6 +108,9 @@ type IteratorItem (Set a) = a instance AsIterator IntSet where type IteratorItem IntSet = Int+-- | @since 0.1.3.0+instance AsIterator (NonEmpty a) where+ type IteratorItem (NonEmpty a) = a instance AsIterator (GMap c k v) where type IteratorItem (GMap c k v) = GMapEntry k v
src/Data/Greskell/GraphSON.hs view
@@ -42,11 +42,13 @@ import Data.Aeson.Types (Parser) import qualified Data.Aeson.Types as Aeson (parseEither) import Data.Foldable (Foldable(foldr))+import Data.Functor.Identity (Identity(..)) import Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as HM import qualified Data.HashMap.Lazy as L (HashMap) import Data.HashSet (HashSet) import Data.Hashable (Hashable(..))+import Data.List.NonEmpty (NonEmpty(..)) import Data.Int (Int8, Int16, Int32, Int64) import qualified Data.IntMap.Lazy as L (IntMap) import qualified Data.IntMap.Lazy as LIntMap@@ -54,8 +56,10 @@ import qualified Data.Map.Lazy as L (Map) import qualified Data.Map.Lazy as LMap import Data.Monoid (mempty)+import qualified Data.Monoid as M import Data.Ratio (Ratio) import Data.Scientific (Scientific)+import qualified Data.Semigroup as S import Data.Sequence (Seq) import Data.Set (Set) import Data.Text (Text, unpack)@@ -97,6 +101,7 @@ -- - Map-like types (e.g. 'L.HashMap' and 'L.Map'): parse into 'GMap' -- first, then unwrap the 'GMap' wrapper. That way, all versions of -- GraphSON formats are handled properly.+-- - Trivial wrapper types (e.g. 'Identity'): just parse the item inside. -- - Other types: see the individual instance documentation. -- -- Note that 'Char' does not have 'FromGraphSON' instance. This is@@ -215,6 +220,13 @@ parseGraphSON = parseUnwrapList instance FromGraphSON a => FromGraphSON (Seq a) where parseGraphSON = parseUnwrapList+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (NonEmpty a) where+ parseGraphSON gv = do+ list <- parseGraphSON gv+ case list of+ [] -> fail ("Empty list.")+ (a : rest) -> return (a :| rest) ---- Set instances @@ -223,7 +235,45 @@ instance (FromGraphSON a, Eq a, Hashable a) => FromGraphSON (HashSet a) where parseGraphSON = parseUnwrapList +---- Trivial wrapper type instances +-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (Identity a) where+ parseGraphSON = fmap Identity . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (S.Min a) where+ parseGraphSON = fmap S.Min . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (S.Max a) where+ parseGraphSON = fmap S.Max . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (S.First a) where+ parseGraphSON = fmap S.First . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (S.Last a) where+ parseGraphSON = fmap S.Last . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (S.WrappedMonoid a) where+ parseGraphSON = fmap S.WrapMonoid . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (S.Dual a) where+ parseGraphSON = fmap S.Dual . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (M.Sum a) where+ parseGraphSON = fmap M.Sum . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (M.Product a) where+ parseGraphSON = fmap M.Product . parseGraphSON++-- | @since 0.1.3.0+instance FromGraphSON M.All where+ parseGraphSON = fmap M.All . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON M.Any where+ parseGraphSON = fmap M.Any . parseGraphSON+++ ---- GMap and others -- | Use 'parseToFlattenedMap'.@@ -282,6 +332,18 @@ -- | Try 'Left', then 'Right'. instance (FromGraphSON a, FromGraphSON b) => FromGraphSON (Either a b) where parseGraphSON gv = (fmap Left $ parseGraphSON gv) <|> (fmap Right $ parseGraphSON gv)++---- Trivial wrapper for Maybe++-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (S.Option a) where+ parseGraphSON = fmap S.Option . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (M.First a) where+ parseGraphSON = fmap M.First . parseGraphSON+-- | @since 0.1.3.0+instance FromGraphSON a => FromGraphSON (M.Last a) where+ parseGraphSON = fmap M.Last . parseGraphSON ---- Others