dlist 0.7.0.1 → 0.7.1
raw patch · 5 files changed
+56/−1 lines, 5 files
Files
- ChangeLog.md +14/−0
- Data/DList.hs +21/−0
- README.md +1/−0
- dlist.cabal +1/−1
- tests/Main.hs +19/−0
ChangeLog.md view
@@ -2,6 +2,20 @@ Change Log ========== +Version 0.7.1 (2014-06-28) *100th Anniversary of the Assassination of Franz Ferdinand*+--------------------------------------------------------------------------------------++#### Package changes++* Add `IsList` instance for GHC >= 7.8 ([Icelandjack](https://github.com/Icelandjack))++Version 0.7.0.1 (2014-03-24) *World Tuberculosis Day*+-----------------------------------------------------++#### Package changes++* Change QuickCheck upper bound from 2.7 to 2.8+ Version 0.7 (2014-03-17) *St. Patrick's Day* --------------------------------------------
Data/DList.hs view
@@ -2,6 +2,10 @@ {-# OPTIONS_HADDOCK prune #-} {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708+-- For the IsList instance:+{-# LANGUAGE TypeFamilies #-}+#endif ----------------------------------------------------------------------------- -- |@@ -55,10 +59,18 @@ import qualified Data.Foldable as F #ifdef __GLASGOW_HASKELL__+ import Text.Read (Lexeme(Ident), lexP, parens, prec, readPrec, readListPrec, readListPrecDefault)++#if __GLASGOW_HASKELL__ >= 708+import GHC.Exts (IsList)+-- This is for the IsList methods, which conflict with fromList, toList:+import qualified GHC.Exts #endif +#endif+ import Control.Applicative(Applicative(..), Alternative, (<|>)) import qualified Control.Applicative (empty) @@ -270,4 +282,13 @@ instance IsString (DList Char) where fromString = fromList {-# INLINE fromString #-}++#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708+instance IsList (DList a) where+ type Item (DList a) = a+ fromList = fromList+ {-# INLINE fromList #-}+ toList = toList+ {-# INLINE toList #-}+#endif
README.md view
@@ -1,4 +1,5 @@ [](https://travis-ci.org/spl/dlist)+[](https://hackage.haskell.org/package/dlist) The Haskell `dlist` package defines a list-like type supporting O(1) append and snoc operations.
dlist.cabal view
@@ -1,5 +1,5 @@ name: dlist-version: 0.7.0.1+version: 0.7.1 synopsis: Difference lists description: Difference lists are a list-like type supporting O(1) append. This is
tests/Main.hs view
@@ -1,4 +1,9 @@ {-# OPTIONS_GHC -Wall #-}+{-# LANGUAGE CPP #-}+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708+-- For the IsList test:+{-# LANGUAGE OverloadedLists #-}+#endif -------------------------------------------------------------------------------- @@ -78,6 +83,17 @@ f :: DList Int -> DList Int f = id +#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708+-- | Test that the IsList instance methods compile and work with simple lists+prop_IsList :: Bool+prop_IsList = test_fromList [1,2,3] && test_toList (fromList [1,2,3])+ where+ test_fromList, test_toList :: DList Int -> Bool+ test_fromList x = x == fromList [1,2,3]+ test_toList [1,2,3] = True+ test_toList _ = False+#endif+ -------------------------------------------------------------------------------- props :: [(String, Property)]@@ -98,6 +114,9 @@ , ("map fusion", property (prop_map_fusion (+1) (+1))) , ("read . show", property prop_show_read) , ("show . read", property prop_read_show)+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708+ , ("IsList", property prop_IsList)+#endif ] --------------------------------------------------------------------------------