Skip to content

Commit 4d06cfe

Browse files
committed
add Generics support for ghc 7.4
1 parent 2066ac5 commit 4d06cfe

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

data-default-class/Data/Default/Class.hs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131

3232
{-# LANGUAGE CPP #-}
3333

34-
#if __GLASGOW_HASKELL__ >= 706
35-
#define HAVE_GHC_706 1
36-
#else
37-
#define HAVE_GHC_706 0
38-
#endif
34+
#define HAVE_GHC_GENERICS (__GLASGOW_HASKELL__ >= 704)
3935

40-
#if HAVE_GHC_706
36+
#if HAVE_GHC_GENERICS
4137
{-# LANGUAGE DefaultSignatures, TypeOperators, FlexibleContexts #-}
4238
#endif
4339

@@ -46,7 +42,7 @@ module Data.Default.Class (
4642
Default(..)
4743
) where
4844

49-
#if HAVE_GHC_706
45+
#if HAVE_GHC_GENERICS
5046
import GHC.Generics
5147

5248
class GDefault f where
@@ -70,7 +66,7 @@ class Default a where
7066
-- | The default value for this type.
7167
def :: a
7268

73-
#if HAVE_GHC_706
69+
#if HAVE_GHC_GENERICS
7470
default def :: (Generic a, GDefault (Rep a)) => a
7571
def = to gdef
7672
#endif

data-default-class/data-default-class.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ source-repository head
1515

1616
Library
1717
Build-Depends: base >=2 && <5
18+
if impl(ghc == 7.4.*)
19+
-- for GHC.Generics
20+
Build-Depends: ghc-prim
1821
Exposed-Modules: Data.Default.Class

0 commit comments

Comments
 (0)