diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index b6410da..9b6e38c 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -22,7 +22,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - ghc-version: ['9.6', '9.4', '9.2', '8.10'] + ghc-version: ['9.8', '9.6', '9.4', '9.2', '8.10'] docspec: [false] experimental: [false] diff --git a/ChangeLog.md b/ChangeLog.md index a05f900..2ab570a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,8 @@ +0.11.1.0 +=== +* Rect and Point show instances include negative brackets. +* removed NegativeLiterals as a requirement. + 0.11.0.0 === * fixes for numhask-0.11 diff --git a/numhask-space.cabal b/numhask-space.cabal index 67b1ab7..dab2f89 100644 --- a/numhask-space.cabal +++ b/numhask-space.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: numhask-space -version: 0.11.0.1 +version: 0.11.1.0 license: BSD-3-Clause license-file: LICENSE copyright: Tony Day (c) 2016 @@ -101,14 +101,14 @@ library build-depends: , adjunctions >=4.0 && <5 , base >=4.7 && <5 - , containers >=0.6 && <0.7 + , containers >=0.6 && <0.8 , distributive >=0.4 && <0.7 - , numhask >=0.10 && <0.12 + , numhask >=0.10 && <0.13 , random >=1.2 && <1.3 , semigroupoids >=5.3 && <6.1 , tdigest >=0.2.1 && <0.4 - , text >=1.2 && <2.1 - , time >=1.9 && <1.13 + , text >=1.2 && <2.2 + , time >=1.9.1 && <1.13 , vector >=0.12.3 && <0.14 exposed-modules: NumHask.Space diff --git a/src/NumHask/Space.hs b/src/NumHask/Space.hs index e21867d..3df0e24 100644 --- a/src/NumHask/Space.hs +++ b/src/NumHask/Space.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE NegativeLiterals #-} {-# LANGUAGE RebindableSyntax #-} -- | Mathematics does not rigorously define a [space](https://en.wikipedia.org/wiki/Space_(mathematics\)), leaving library devs free to explore. @@ -63,14 +62,3 @@ import NumHask.Space.Types hiding () -- - A time span is a 'Space' containing moments of time. -- -- - A 'Histogram' is a divided 'Range' with a count of elements within each division. - --- $extensions --- > :t Point 1.0 -1.0 --- Point 1.0 -1.0 --- :: (Subtractive a, FromRatio a Integer, --- FromRatio (a -> Point a) Integer) => --- a -> Point a --- --- > :set -XNegativeLiterals --- > :t Point 1.0 -1.0 --- Point 1.0 -1.0 :: FromRatio a Integer => Point a diff --git a/src/NumHask/Space/Histogram.hs b/src/NumHask/Space/Histogram.hs index 115a8ae..1a9f282 100644 --- a/src/NumHask/Space/Histogram.hs +++ b/src/NumHask/Space/Histogram.hs @@ -29,6 +29,7 @@ import NumHask.Space.Rect import NumHask.Space.Types -- $setup +-- >>> :set -XRebindableSyntax -- >>> import NumHask.Prelude -- >>> import NumHask.Space diff --git a/src/NumHask/Space/Point.hs b/src/NumHask/Space/Point.hs index 6e51f93..3fa45dd 100644 --- a/src/NumHask/Space/Point.hs +++ b/src/NumHask/Space/Point.hs @@ -22,7 +22,6 @@ module NumHask.Space.Point where import Data.Distributive -import Data.Functor.Classes import Data.Functor.Rep import NumHask.Prelude hiding (Distributive) import NumHask.Space.Range @@ -31,9 +30,9 @@ import System.Random import System.Random.Stateful -- $setup +-- >>> :set -XRebindableSyntax -- >>> import NumHask.Prelude -- >>> import NumHask.Space --- >>> :set -XFlexibleContexts -- | A 2-dimensional Point of a's -- @@ -65,17 +64,11 @@ data Point a = Point instance (Ord a, Additive a, Show a) => Show (Point a) where show (Point a b) = "Point " <> wrap a <> " " <> wrap b where - wrap x = bool (show x) ("(" <> show x <> ")") (x show x <> ")") (x < zero) instance Functor Point where fmap f (Point a b) = Point (f a) (f b) -instance Eq1 Point where - liftEq f (Point a b) (Point c d) = f a c && f b d - -instance Show1 Point where - liftShowsPrec sp _ d (Point a b) = showsBinaryWith sp sp "Point" d a b - instance Applicative Point where pure a = Point a a diff --git a/src/NumHask/Space/Range.hs b/src/NumHask/Space/Range.hs index 01bdb3c..65389c8 100644 --- a/src/NumHask/Space/Range.hs +++ b/src/NumHask/Space/Range.hs @@ -11,7 +11,6 @@ where import Data.Distributive as D import Data.Functor.Apply (Apply (..)) -import Data.Functor.Classes import Data.Functor.Rep import GHC.Show (show) import NumHask.Prelude hiding (show) @@ -20,7 +19,6 @@ import NumHask.Space.Types as S -- $setup -- -- >>> :set -XFlexibleContexts --- >>> :set -XGADTs -- >>> import NumHask.Prelude -- >>> import NumHask.Space @@ -60,12 +58,6 @@ data Range a = Range a a instance (Show a) => Show (Range a) where show (Range a b) = "Range " <> show a <> " " <> show b -instance Eq1 Range where - liftEq f (Range a b) (Range c d) = f a c && f b d - -instance Show1 Range where - liftShowsPrec sp _ d (Range a b) = showsBinaryWith sp sp "Range" d a b - instance Functor Range where fmap f (Range a b) = Range (f a) (f b) diff --git a/src/NumHask/Space/Rect.hs b/src/NumHask/Space/Rect.hs index 7fb3807..2133eae 100644 --- a/src/NumHask/Space/Rect.hs +++ b/src/NumHask/Space/Rect.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE NegativeLiterals #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RebindableSyntax #-} {-# LANGUAGE TypeFamilies #-} @@ -36,7 +35,7 @@ import NumHask.Space.Types -- $setup -- --- >>> :set -XFlexibleContexts +-- >>> :set -XRebindableSyntax -- >>> import NumHask.Prelude -- >>> import NumHask.Space @@ -101,7 +100,7 @@ instance (Ord a, Additive a, Show a) => Show (Rect a) where show (Rect a b c d) = "Rect " <> wrap a <> " " <> wrap b <> " " <> wrap c <> " " <> wrap d where - wrap x = bool (show x) ("(" <> show x <> ")") (x show x <> ")") (x < zero) instance Distributive Rect where collect f x = @@ -290,7 +289,7 @@ gridF f r g = (\x -> (x, f (mid x))) <$> gridSpace r g -- >>> aspect 2 -- Rect (-1.0) 1.0 (-0.5) 0.5 aspect :: Double -> Rect Double -aspect a = Rect (a * -0.5) (a * 0.5) -0.5 0.5 +aspect a = Rect (a * (-0.5)) (a * 0.5) (-0.5) 0.5 -- | convert a Rect to a ratio -- diff --git a/src/NumHask/Space/Time.hs b/src/NumHask/Space/Time.hs index 0238385..e67b859 100644 --- a/src/NumHask/Space/Time.hs +++ b/src/NumHask/Space/Time.hs @@ -29,13 +29,11 @@ import NumHask.Space.Types -- $setup -- +-- >>> :set -XRebindableSyntax -- >>> import NumHask.Prelude -- >>> import NumHask.Space --- >>> import NumHask.Space.Time -- >>> import Data.Text (Text, pack) -- >>> import Data.Time --- --- > :set -XOverloadedStrings -- | a step in time data TimeGrain diff --git a/src/NumHask/Space/Types.hs b/src/NumHask/Space/Types.hs index 6ca64e0..c7b0b9e 100644 --- a/src/NumHask/Space/Types.hs +++ b/src/NumHask/Space/Types.hs @@ -44,6 +44,7 @@ import System.Random.Stateful import Prelude qualified as P -- $setup +-- >>> :set -XRebindableSyntax -- >>> import NumHask.Prelude -- >>> import NumHask.Space -- >>> import System.Random.Stateful