homotuple 0.1.2.1 → 0.2.0.0
raw patch · 4 files changed
+41/−43 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Tuple.Homotuple: type IsHomolisttuple (n :: Nat) a = IsList (Homotuple n a)
- Data.Tuple.Homotuple: type IsHomotupleItem (n :: Nat) a = a ~ Item (Homotuple n a)
- Data.Tuple.Homotuple: (<$>) :: (IsHomolisttuple n a, IsHomolisttuple n b, IsHomotupleItem n a, IsHomotupleItem n b) => (a -> b) -> Homotuple n a -> Homotuple n b
+ Data.Tuple.Homotuple: (<$>) :: (IsList (Homotuple n a), IsList (Homotuple n b), a ~ Item (Homotuple n a), b ~ Item (Homotuple n b)) => (a -> b) -> Homotuple n a -> Homotuple n b
- Data.Tuple.Homotuple: (<*>) :: (IsHomolisttuple n0 (a -> b), IsHomolisttuple n1 a, IsHomolisttuple (n0 * n1) b, IsHomotupleItem n0 (a -> b), IsHomotupleItem n1 a, IsHomotupleItem (n0 * n1) b) => Homotuple n0 (a -> b) -> Homotuple n1 a -> Homotuple (n0 * n1) b
+ Data.Tuple.Homotuple: (<*>) :: (IsList (Homotuple n0 (a -> b)), IsList (Homotuple n1 a), IsList (Homotuple (n0 * n1) b), (a -> b) ~ Item (Homotuple n0 (a -> b)), a ~ Item (Homotuple n1 a), b ~ Item (Homotuple (n0 * n1) b)) => Homotuple n0 (a -> b) -> Homotuple n1 a -> Homotuple (n0 * n1) b
- Data.Tuple.Homotuple: (<>) :: (IsHomolisttuple n0 a, IsHomolisttuple n1 a, IsHomolisttuple (n0 + n1) a, IsHomotupleItem n0 a, IsHomotupleItem n1 a, IsHomotupleItem (n0 + n1) a) => Homotuple n0 a -> Homotuple n1 a -> Homotuple (n0 + n1) a
+ Data.Tuple.Homotuple: (<>) :: (IsList (Homotuple n0 a), IsList (Homotuple n1 a), IsList (Homotuple (n0 + n1) a), a ~ Item (Homotuple n0 a), a ~ Item (Homotuple n1 a), a ~ Item (Homotuple (n0 + n1) a)) => Homotuple n0 a -> Homotuple n1 a -> Homotuple (n0 + n1) a
- Data.Tuple.Homotuple: (>>=) :: (IsHomolisttuple n0 a, IsHomolisttuple n1 b, IsHomolisttuple (n0 * n1) b, IsHomotupleItem n0 a, IsHomotupleItem n1 b, IsHomotupleItem (n0 * n1) b) => Homotuple n0 a -> (a -> Homotuple n1 b) -> Homotuple (n0 * n1) b
+ Data.Tuple.Homotuple: (>>=) :: (IsList (Homotuple n0 a), IsList (Homotuple n1 b), IsList (Homotuple (n0 * n1) b), a ~ Item (Homotuple n0 a), b ~ Item (Homotuple n1 b), b ~ Item (Homotuple (n0 * n1) b)) => Homotuple n0 a -> (a -> Homotuple n1 b) -> Homotuple (n0 * n1) b
- Data.Tuple.Homotuple: replicate :: forall (n :: Nat) a. (IsHomolisttuple n a, IsHomotupleItem n a, KnownNat n) => a -> Homotuple n a
+ Data.Tuple.Homotuple: replicate :: forall (n :: Nat) a. (IsList (Homotuple n a), a ~ Item (Homotuple n a), KnownNat n) => a -> Homotuple n a
Files
- ChangeLog.md +6/−0
- homotuple.cabal +1/−1
- template/Homotuple.hs +25/−33
- template/HomotupleItem.hs +9/−9
ChangeLog.md view
@@ -1,5 +1,11 @@ # Changelog for homotuple +## 0.2.0.0++2021.03.19++Remove utility constraints.+ ## 0.1.2.1 2020.06.13
homotuple.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12 name: homotuple-version: 0.1.2.1+version: 0.2.0.0 synopsis: Homotuple, all whose elements are the same type description: Homotuple, all whose elements are the same type category: Data
template/Homotuple.hs view
@@ -20,7 +20,7 @@ -- Stability : experimental -- Portability : GHC ----- Homotuples, whoes items are the same type or which are lists with type-level length.+-- Homotuples, whose items are the same type or which are lists with type-level length. module Data.Tuple.Homotuple ( Homotuple@@ -33,13 +33,10 @@ , pure -- * Monad-like , (>>=)- -- * Semigoupe-like+ -- * Semigroupe-like , (<>) -- * Monoid-like , pattern Empty- -- * Utility constraints- , IsHomolisttuple- , IsHomotupleItem -- * For implementers , errorLengthMismatch ) where@@ -194,23 +191,18 @@ errorLengthMismatch :: HasCallStack => a errorLengthMismatch = error "length mismatch" --- Utility constraints--type IsHomolisttuple (n :: Nat) a = IsList (Homotuple n a)-type IsHomotupleItem (n :: Nat) a = a ~ Item (Homotuple n a)- -- List-like -replicate :: forall (n :: Nat) a. (IsHomolisttuple n a, IsHomotupleItem n a, KnownNat n) => a -> Homotuple n a+replicate :: forall (n :: Nat) a. (IsList (Homotuple n a), a ~ Item (Homotuple n a), KnownNat n) => a -> Homotuple n a replicate = fromList . L.replicate (fromInteger $ natVal (Proxy :: Proxy n)) -- Functor-like (<$>)- :: ( IsHomolisttuple n a- , IsHomolisttuple n b- , IsHomotupleItem n a- , IsHomotupleItem n b+ :: ( IsList (Homotuple n a)+ , IsList (Homotuple n b)+ , a ~ Item (Homotuple n a)+ , b ~ Item (Homotuple n b) ) => (a -> b) -> Homotuple n a -> Homotuple n b f <$> t = fromList $ L.map f $ toList t@@ -218,12 +210,12 @@ -- Applicative-like (<*>)- :: ( IsHomolisttuple n0 (a -> b)- , IsHomolisttuple n1 a- , IsHomolisttuple (n0 * n1) b- , IsHomotupleItem n0 (a -> b)- , IsHomotupleItem n1 a- , IsHomotupleItem (n0 * n1) b+ :: ( IsList (Homotuple n0 (a -> b))+ , IsList (Homotuple n1 a)+ , IsList (Homotuple (n0 * n1) b)+ , (a -> b) ~ Item (Homotuple n0 (a -> b))+ , a ~ Item (Homotuple n1 a)+ , b ~ Item (Homotuple (n0 * n1) b) ) => Homotuple n0 (a -> b) -> Homotuple n1 a -> Homotuple (n0 * n1) b f <*> t = fromList $ toList f A.<*> toList t@@ -234,12 +226,12 @@ -- Monad-like (>>=)- :: ( IsHomolisttuple n0 a- , IsHomolisttuple n1 b- , IsHomolisttuple (n0 * n1) b- , IsHomotupleItem n0 a- , IsHomotupleItem n1 b- , IsHomotupleItem (n0 * n1) b+ :: ( IsList (Homotuple n0 a)+ , IsList (Homotuple n1 b)+ , IsList (Homotuple (n0 * n1) b)+ , a ~ Item (Homotuple n0 a)+ , b ~ Item (Homotuple n1 b)+ , b ~ Item (Homotuple (n0 * n1) b) ) => Homotuple n0 a -> (a -> Homotuple n1 b) -> Homotuple (n0 * n1) b m >>= f = fromList $ toList m M.>>= (toList . f)@@ -247,12 +239,12 @@ -- Semigroup-like (<>)- :: ( IsHomolisttuple n0 a- , IsHomolisttuple n1 a- , IsHomolisttuple (n0 + n1) a- , IsHomotupleItem n0 a- , IsHomotupleItem n1 a- , IsHomotupleItem (n0 + n1) a+ :: ( IsList (Homotuple n0 a)+ , IsList (Homotuple n1 a)+ , IsList (Homotuple (n0 + n1) a)+ , a ~ Item (Homotuple n0 a)+ , a ~ Item (Homotuple n1 a)+ , a ~ Item (Homotuple (n0 + n1) a) ) => Homotuple n0 a -> Homotuple n1 a
template/HomotupleItem.hs view
@@ -1,9 +1,9 @@--- <length> - -type instance Homotuple <length> a = <homotuple> - -instance IsList <homotuple> where - type Item <homotuple> = a - fromList <list> = <tuple> - fromList _ = errorLengthMismatch - toList <tuple> = <list> +-- <length>++type instance Homotuple <length> a = <homotuple>++instance IsList <homotuple> where+ type Item <homotuple> = a+ fromList <list> = <tuple>+ fromList _ = errorLengthMismatch+ toList <tuple> = <list>