[commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Derive Generic and Generic1 for Data.Tree (630bedc)
git at git.haskell.org
git at git.haskell.org
Mon Apr 17 21:39:49 UTC 2017
- Previous message: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Revert "add Generics instance for Map, Set, IntMap, and IntSet" (c26240e)
- Next message: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #200 from treeowl/generic-tree (b8204a6)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Repository : ssh://git@git.haskell.org/containers
On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394
Link : http://git.haskell.org/packages/containers.git/commitdiff/630bedcc2bf95eb8764b7565c33279737565bfa6
>---------------------------------------------------------------
commit 630bedcc2bf95eb8764b7565c33279737565bfa6
Author: David Feuer <David.Feuer at gmail.com>
Date: Thu Apr 21 22:27:33 2016 -0400
Derive Generic and Generic1 for Data.Tree
Unlike the other container types, `Data.Tree.Tree` is fully
exposed. Therefore, we can and should derive `Generic` and
`Generic1` instances for it.
>---------------------------------------------------------------
630bedcc2bf95eb8764b7565c33279737565bfa6
Data/Tree.hs | 14 ++++++++++++++
changelog.md | 2 ++
2 files changed, 16 insertions(+)
diff --git a/Data/Tree.hs b/Data/Tree.hs
index a6f64f9..acfc8c2 100644
--- a/Data/Tree.hs
+++ b/Data/Tree.hs
@@ -2,6 +2,9 @@
#if __GLASGOW_HASKELL__
{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-}
#endif
+#if __GLASGOW_HASKELL__ >= 702
+{-# LANGUAGE DeriveGeneric #-}
+#endif
#if __GLASGOW_HASKELL__ >= 703
{-# LANGUAGE Trustworthy #-}
#endif
@@ -52,6 +55,11 @@ import Control.DeepSeq (NFData(rnf))
#ifdef __GLASGOW_HASKELL__
import Data.Data (Data)
#endif
+#if __GLASGOW_HASKELL__ >= 706
+import GHC.Generics (Generic, Generic1)
+#elif __GLASGOW_HASKELL__ >= 702
+import GHC.Generics (Generic)
+#endif
#if MIN_VERSION_base(4,8,0)
import Data.Coerce
@@ -63,7 +71,13 @@ data Tree a = Node {
subForest :: Forest a -- ^ zero or more child trees
}
#ifdef __GLASGOW_HASKELL__
+#if __GLASGOW_HASKELL__ >= 706
+ deriving (Eq, Read, Show, Data, Generic, Generic1)
+#elif __GLASGOW_HASKELL__ >= 702
+ deriving (Eq, Read, Show, Data, Generic)
+#else
deriving (Eq, Read, Show, Data)
+#endif
#else
deriving (Eq, Read, Show)
#endif
diff --git a/changelog.md b/changelog.md
index eac87bb..1ee6eb5 100644
--- a/changelog.md
+++ b/changelog.md
@@ -11,6 +11,8 @@
* Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Seq`.
+ * Derive `Generic` and `Generic1` for `Data.Tree.Tree`.
+
## 0.5.6.2 *Dec 2014*
* Bundled with GHC 7.10.1.
- Previous message: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Revert "add Generics instance for Map, Set, IntMap, and IntSet" (c26240e)
- Next message: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #200 from treeowl/generic-tree (b8204a6)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the ghc-commits
mailing list