ranged-list 0.1.0.1 → 0.1.1.1
raw patch · 5 files changed
+36/−6 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.List.Length: data RangeL :: Nat -> Nat -> * -> *
+ Data.List.Length: data RangeL :: Nat -> Nat -> Type -> Type
- Data.List.Length: data RangeR :: Nat -> Nat -> * -> *
+ Data.List.Length: data RangeR :: Nat -> Nat -> Type -> Type
- Data.List.Range: data RangeL :: Nat -> Nat -> * -> *
+ Data.List.Range: data RangeL :: Nat -> Nat -> Type -> Type
- Data.List.Range: data RangeR :: Nat -> Nat -> * -> *
+ Data.List.Range: data RangeR :: Nat -> Nat -> Type -> Type
Files
- ranged-list.cabal +2/−2
- src/Data/List/Length.hs +0/−1
- src/Data/List/Range/Nat.hs +0/−1
- src/Data/List/Range/RangeL.hs +17/−1
- src/Data/List/Range/RangeR.hs +17/−1
ranged-list.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 349e85c819f827a30071512b7dc4e2e3b2add699054a5d970f833e60ce71577d+-- hash: 3cf01e9e48430e4ab13f9d91acd3c46961815fbb460b724547e694c3b9b4582c name: ranged-list-version: 0.1.0.1+version: 0.1.1.1 synopsis: The list like structure whose length or range of length can be specified description: Please see the README on GitHub at <https://github.com/YoshikuniJujo/ranged-list#readme> category: List
src/Data/List/Length.hs view
@@ -42,7 +42,6 @@ -- * RIGHT TO LEFT RightToLeft, (++..), rightToLeft ) where -import GHC.TypeNats (type (-)) import Control.Arrow (first, (***)) import Data.List.Range ( RangeL(..), AddL, (++.), LoosenLMax, loosenLMax, Unfoldr,
src/Data/List/Range/Nat.hs view
@@ -11,7 +11,6 @@ -- * RangedNatR RangedNatR, natR, toIntR, fromIntR, splitAtR ) where -import GHC.TypeNats (type (-)) import Data.Bool (bool) import Data.List.Length (repeatL, repeatR) import Data.List.Range (
src/Data/List/Range/RangeL.hs view
@@ -43,6 +43,7 @@ import Control.Arrow (first, second, (***), (&&&)) import Control.Monad.Identity (Identity(..)) import Control.Monad.State (StateL(..))+import Data.Kind (Type) import Data.Foldable (toList) import Data.Bool (bool) import Data.Maybe (isJust, fromMaybe)@@ -87,7 +88,7 @@ -- RANGE LEFT -data RangeL :: Nat -> Nat -> * -> * where+data RangeL :: Nat -> Nat -> Type -> Type where NilL :: 0 <= m => RangeL 0 m a (:..) :: 1 <= m => a -> RangeL 0 (m - 1) a -> RangeL 0 m a (:.) :: (1 <= n, 1 <= m) =>@@ -131,6 +132,21 @@ instance {-# OVERLAPPABLE #-} (1 <= n, Foldable (RangeL (n - 1) (m - 1))) => Foldable (RangeL n m) where foldr (-<) z (x :. xs) = x -< foldr (-<) z xs++-- INSTANCE TRAVERSABLE++instance Traversable (RangeL 0 0) where traverse _ NilL = pure NilL++instance {-# OVERLAPPABLE #-}+ Traversable (RangeL 0 (m - 1)) => Traversable (RangeL 0 m) where+ traverse f = \case+ NilL -> pure NilL; x :.. xs -> (:..) <$> f x <*> traverse f xs++instance {-# OVERLAPPABLE #-} (1 <= n, Traversable (RangeL (n - 1) (m - 1))) =>+ Traversable (RangeL n m) where+ traverse f (x :. xs) = (:.) <$> f x <*> traverse f xs++-- INSTANCE APPLICATIVE instance Applicative (LengthL 0) where pure _ = NilL; _ <*> _ = NilL
src/Data/List/Range/RangeR.hs view
@@ -42,6 +42,7 @@ import Control.Arrow (first, second, (***), (&&&)) import Control.Monad.Identity (Identity(..)) import Control.Monad.State (StateR(..))+import Data.Kind (Type) import Data.Foldable import Data.Bool (bool) import Data.Maybe (isJust, fromMaybe)@@ -74,7 +75,7 @@ -- RANGE RIGHT -data RangeR :: Nat -> Nat -> * -> * where+data RangeR :: Nat -> Nat -> Type -> Type where NilR :: 0 <= m => RangeR 0 m a (:++) :: 1 <= m => RangeR 0 (m - 1) a -> a -> RangeR 0 m a (:+) :: (1 <= n, 1 <= m) =>@@ -118,6 +119,21 @@ instance {-# OVERLAPPABLE #-} (1 <= n, Foldable (RangeR (n - 1) (m - 1))) => Foldable (RangeR n m) where foldr (-<) z (xs :+ x) = foldr (-<) (x -< z) xs++-- INSTANCE TRAVERSABLE++instance Traversable (RangeR 0 0) where traverse _ NilR = pure NilR++instance {-# OVERLAPPABLE #-}+ Traversable (RangeR 0 (m - 1)) => Traversable (RangeR 0 m) where+ traverse f = \case+ NilR -> pure NilR; xs :++ x -> (:++) <$> traverse f xs <*> f x++instance {-# OVERLAPPABLE #-} (1 <= n, Traversable (RangeR (n - 1) (m - 1))) =>+ Traversable (RangeR n m) where+ traverse f (xs :+ x) = (:+) <$> traverse f xs <*> f x++-- INSTANCE APPLICATIVE instance Applicative (RangeR 0 0) where pure _ = NilR; _ <*> _ = NilR