sdp 0.2 → 0.2.0.1
raw patch · 11 files changed
+66/−18 lines, 11 filesdep ~ghc-primsetup-changed
Dependency ranges changed: ghc-prim
Files
- Setup.hs +0/−2
- sdp.cabal +19/−4
- src/SDP/Index.hs +6/−1
- src/SDP/Linear.hs +12/−2
- src/SDP/Prim/SArray.hs +7/−2
- src/SDP/Prim/SBytes.hs +1/−1
- src/SDP/SafePrelude.hs +9/−4
- src/SDP/Shape.hs +5/−0
- src/SDP/Templates/AnyBorder.hs +1/−1
- src/SDP/Templates/AnyChunks.hs +1/−1
- src/SDP/Unboxed.hs +5/−0
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
sdp.cabal view
@@ -1,5 +1,5 @@ name: sdp-version: 0.2+version: 0.2.0.1 category: Data Structures synopsis: Simple Data Processing@@ -16,6 +16,20 @@ build-type: Simple cabal-version: >=1.10 +tested-with:+ -- lts-7.24+ GHC == 8.0.1,+ -- lts-9.21+ GHC == 8.0.2,+ -- lts-11.22+ GHC == 8.2.2,+ -- lts-12.26+ GHC == 8.4.4,+ -- lts-18.8+ GHC == 8.10.6,+ -- lts-18.13+ GHC == 8.10.7+ source-repository head type: git location: https://github.com/andreymulik/sdp@@ -34,9 +48,9 @@ ghc-options: -O2 -Wall -Wcompat -Wno-orphans build-depends:- base >= 4.9 && < 5,- ghc-prim >= 0.5.3 && < 0.7,- data-default-class >= 0.1 && < 0.2+ base >= 4.9 && < 5,+ ghc-prim >= 0.5 && < 0.7,+ data-default-class >= 0.1 && < 0.2 exposed-modules: SDP.SafePrelude@@ -112,4 +126,5 @@ Text.Show.SDP Text.Read.SDP+
src/SDP/Index.hs view
@@ -385,8 +385,12 @@ instance Index CPtrdiff where offset = offsetIntegral instance Index CSigAtomic where offset = offsetIntegral +#if MIN_VERSION_base(4,10,0)+-- | @since base-4.10.0.0+instance Index CBool where offset = offsetIntegral; defaultBounds = defaultBoundsUnsign+#endif+ instance Index CSize where offset = offsetIntegral; defaultBounds = defaultBoundsUnsign-instance Index CBool where offset = offsetIntegral; defaultBounds = defaultBoundsUnsign instance Index CUChar where offset = offsetIntegral; defaultBounds = defaultBoundsUnsign instance Index CUShort where offset = offsetIntegral; defaultBounds = defaultBoundsUnsign @@ -555,6 +559,7 @@ emptyEx :: String -> a emptyEx = throw . EmptyRange . showString "in SDP.Index."+
src/SDP/Linear.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} {-# LANGUAGE PatternSynonyms, ViewPatterns, BangPatterns, DefaultSignatures #-}-{-# LANGUAGE Trustworthy, TypeOperators, TypeFamilies, ConstraintKinds #-}+{-# LANGUAGE Trustworthy, TypeOperators, TypeFamilies, ConstraintKinds, CPP #-} {- | Module : SDP.Linear@@ -558,9 +558,18 @@ > splitsOn "fo" "foobar bazfoobar1" == ["","obar baz","obar1"] -}- default splitsOn :: (Eq e, Bordered s i) => s -> s -> [s] splitsOn :: (Eq e) => s -> s -> [s]+#if __GLASGOW_HASKELL__ >= 820+ default splitsOn :: (Eq e, Bordered s i) => s -> s -> [s] splitsOn sub line = drop (sizeOf sub) <$> parts (infixes sub line) line+ -- ghc-8.0.1 has bug in default signatures, so this can be used with it+#else+ {-+ Not tested, but should be significantly slower than the definitions below.+ If you plan to support ghc-8.0.1, override splitsOn in all your instances.+ -}+ splitsOn sub line = fromList <$> splitsOn (listL sub) (listL line)+#endif {- | @replaceBy sub new line@ replace every non-overlapping occurrence of @sub@@@ -915,6 +924,7 @@ -} ascending :: (Split s e, Sort s e, Ord e) => s -> [Int] -> Bool ascending = all sorted ... flip splits+
src/SDP/Prim/SArray.hs view
@@ -65,7 +65,6 @@ import Data.Typeable import Data.Coerce import Data.String-import Data.Proxy import Text.Read @@ -147,7 +146,7 @@ isNull = \ (SArray# c _ _) -> c == 0 instance Semigroup (SArray# e) where (<>) = (++)-instance Monoid (SArray# e) where mempty = Z+instance Monoid (SArray# e) where mempty = Z; mappend = (<>) instance Default (SArray# e) where def = Z instance Estimate (SArray# e)@@ -1206,6 +1205,10 @@ ascsBounds :: (Ord a) => [(a, b)] -> (a, a) ascsBounds = \ ((x, _) : xs) -> foldr (\ (e, _) (mn, mx) -> (min mn e, max mx e)) (x, x) xs +-- | In base-4.9 'asProxyTypeOf' has less general type @a -> Proxy a -> a@.+asProxyTypeOf :: a -> proxy a -> a+asProxyTypeOf = const+ -------------------------------------------------------------------------------- undEx :: String -> a@@ -1222,4 +1225,6 @@ unreachEx :: String -> a unreachEx = throw . UnreachableException . showString "in SDP.Prim.SArray."++
src/SDP/Prim/SBytes.hs view
@@ -145,7 +145,7 @@ isNull es = case es of {(SBytes# 0 _ _) -> True; _ -> False} instance (Unboxed e) => Semigroup (SBytes# e) where (<>) = (++)-instance (Unboxed e) => Monoid (SBytes# e) where mempty = Z+instance (Unboxed e) => Monoid (SBytes# e) where mempty = Z; mappend = (<>) instance Default (SBytes# e) where
src/SDP/SafePrelude.hs view
@@ -1,5 +1,5 @@ {-# OPTIONS_HADDOCK ignore-exports #-}-{-# LANGUAGE Safe #-}+{-# LANGUAGE Safe, CPP #-} {- | Module : SDP.SafePrelude@@ -42,6 +42,10 @@ module Prelude, +#if !MIN_VERSION_base(4,11,0)+ Semigroup (..),+#endif+ -- * Combinators on, (?), (?+), (?-), (?^), (?:), (+?), (...), (<=<<), (>>=>), (>>=<<) )@@ -67,6 +71,10 @@ import SDP.Comparing import SDP.Estimate +#if !MIN_VERSION_base(4,11,0)+import Data.Semigroup ( Semigroup (..) ) -- For base >= 4.9 && < 4.11+#endif+ import Data.Functor.Classes import Data.Bifunctor import Data.Foldable hiding ( foldrM, foldlM, concat, concatMap )@@ -164,7 +172,4 @@ -- | 'stToMIO' is just @'liftIO' . 'stToIO'@. stToMIO :: (MonadIO io) => ST RealWorld e -> io e stToMIO = liftIO . stToIO---
src/SDP/Shape.hs view
@@ -202,7 +202,12 @@ instance Shape CUIntMax instance Shape CSize++#if MIN_VERSION_base(4,10,0)+-- | @since base-4.10.0.0 instance Shape CBool+#endif+ instance Shape CPtrdiff instance Shape CSigAtomic
src/SDP/Templates/AnyBorder.hs view
@@ -127,7 +127,7 @@ lzero = withBounds lzero instance (Linear1 (AnyBorder rep i) e) => Semigroup (AnyBorder rep i e) where (<>) = (++)-instance (Linear1 (AnyBorder rep i) e) => Monoid (AnyBorder rep i e) where mempty = Z+instance (Linear1 (AnyBorder rep i) e) => Monoid (AnyBorder rep i e) where mempty = Z; mappend = (<>) instance (Linear1 (AnyBorder rep i) e) => Default (AnyBorder rep i e) where def = Z instance (Index i) => Estimate (AnyBorder rep i e)
src/SDP/Templates/AnyChunks.hs view
@@ -136,7 +136,7 @@ where AnyChunks xs <> AnyChunks ys = AnyChunks (xs ++ ys) -instance Monoid (AnyChunks rep e) where mempty = AnyChunks []+instance Monoid (AnyChunks rep e) where mempty = AnyChunks []; mappend = (<>) instance Default (AnyChunks rep e) where def = AnyChunks [] instance (Bordered1 rep Int e) => Estimate (AnyChunks rep e)
src/SDP/Unboxed.hs view
@@ -457,7 +457,12 @@ SDP_DERIVE_FOREIGN_UNBOXED(CSUSeconds) SDP_DERIVE_FOREIGN_UNBOXED(CSize)++#if MIN_VERSION_base(4,10,0)+-- | @since base-4.10.0.0 SDP_DERIVE_FOREIGN_UNBOXED(CBool)+#endif+ SDP_DERIVE_FOREIGN_UNBOXED(CFloat) SDP_DERIVE_FOREIGN_UNBOXED(CDouble) SDP_DERIVE_FOREIGN_UNBOXED(CSigAtomic)