Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Hugs compatibility #5

Merged
merged 1 commit into from

2 participants

@ehird

No description provided.

@ekmett ekmett merged commit e1a5df2 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 11, 2012
  1. @ehird

    Hugs compatibility

    ehird authored
This page is out of date. Refresh to see the latest.
View
11 Data/List/NonEmpty.hs
@@ -1,4 +1,7 @@
{-# LANGUAGE CPP #-}
+#ifdef LANGUAGE_DeriveDataTypeable
+{-# LANGUAGE DeriveDataTypeable #-}
+#endif
-----------------------------------------------------------------------------
-- |
-- Module : Data.List.NonEmpty
@@ -41,7 +44,7 @@ module Data.List.NonEmpty (
, repeat -- :: a -> NonEmpty a
, cycle -- :: NonEmpty a -> NonEmpty a
, unfold -- :: (a -> (b, Maybe a) -> a -> NonEmpty b
- , insert -- :: Foldable f => a -> f a -> NonEmpty a
+ , insert -- :: (Foldable f, Ord a) => a -> f a -> NonEmpty a
-- * Extracting sublists
, take -- :: Int -> NonEmpty a -> [a]
, drop -- :: Int -> NonEmpty a -> [a]
@@ -94,7 +97,7 @@ import Control.Monad
import Data.Foldable hiding (toList)
import qualified Data.Foldable as Foldable
import qualified Data.List as List
-import Data.Monoid hiding (Last)
+import Data.Monoid (mappend)
import Data.Traversable
-- import Data.Semigroup hiding (Last)
-- import Data.Semigroup.Foldable
@@ -134,7 +137,9 @@ uncons ~(a :| as) = (a, nonEmpty as)
instance Functor NonEmpty where
fmap f ~(a :| as) = f a :| fmap f as
+#if MIN_VERSION_base(4,2,0)
b <$ ~(_ :| as) = b :| (b <$ as)
+#endif
{-
instance Extend NonEmpty where
@@ -255,7 +260,7 @@ tails = fromList . List.tails . Foldable.toList
{-# INLINE tails #-}
-- | 'insert' an item into a 'NonEmpty'
-insert :: Foldable f => Ord a => a -> f a -> NonEmpty a
+insert :: (Foldable f, Ord a) => a -> f a -> NonEmpty a
insert a = fromList . List.insert a . Foldable.toList
{-# INLINE insert #-}
View
6 Data/Semigroup.hs
@@ -1,3 +1,7 @@
+{-# LANGUAGE CPP #-}
+#ifdef LANGUAGE_DeriveDataTypeable
+{-# LANGUAGE DeriveDataTypeable #-}
+#endif
-----------------------------------------------------------------------------
-- |
-- Module : Data.Semigroup
@@ -168,6 +172,7 @@ instance Num a => Semigroup (Sum a) where
instance Num a => Semigroup (Product a) where
Product a <> Product b = Product (a * b)
+#if MIN_VERSION_base(3,0,0)
instance Semigroup (Monoid.First a) where
Monoid.First Nothing <> b = b
a <> _ = a
@@ -177,6 +182,7 @@ instance Semigroup (Monoid.Last a) where
a <> Monoid.Last Nothing = a
_ <> b = b
times1p _ a = a
+#endif
instance Semigroup (NonEmpty a) where
(a :| as) <> ~(b :| bs) = a :| (as ++ b : bs)
View
2  Numeric/Natural/Internal.hs
@@ -28,7 +28,7 @@ instance Show Natural where
showsPrec d (Natural n) = showsPrec d n
instance Read Natural where
- readPrec = fmap Natural $ step readPrec
+ readsPrec d = map (\(n, s) -> (Natural n, s)) . readsPrec d
instance Num Natural where
Natural n + Natural m = Natural (n + m)
View
10 semigroups.cabal
@@ -1,8 +1,8 @@
name: semigroups
category: Algebra, Data, Data Structures, Math
-version: 0.8.2
+version: 0.8.3
license: BSD3
-cabal-version: >= 1.6
+cabal-version: >= 1.10
license-file: LICENSE
author: Edward A. Kmett
maintainer: Edward A. Kmett <ekmett@gmail.com>
@@ -25,8 +25,11 @@ flag base2
manual: False
library
+ default-language: Haskell98
+ other-extensions: CPP
+
if !impl(hugs)
- extensions: DeriveDataTypeable
+ other-extensions: DeriveDataTypeable
cpp-options: -DLANGUAGE_DeriveDataTypeable
if flag(base2)
@@ -37,7 +40,6 @@ library
containers >= 0.3 && < 0.5
ghc-options: -Wall
- extensions: CPP
exposed-modules:
Data.Semigroup
Something went wrong with that request. Please try again.