fixed-length 0.2.2.1 → 0.2.3
raw patch · 2 files changed
+22/−6 lines, 2 filesdep +transformersPVP ok
version bump matches the API change (PVP)
Dependencies added: transformers
API changes (from Hackage documentation)
+ Data.FixedLength: instance Type.Data.Num.Unary.Natural n => Data.Functor.Classes.Eq1 (Data.FixedLength.T n)
+ Data.FixedLength: instance Type.Data.Num.Unary.Natural n => Data.Functor.Classes.Show1 (Data.FixedLength.T n)
+ Data.FixedLength: instance Type.Data.Num.Unary.Natural n => GHC.Show.Show (Data.FixedLength.Index n)
Files
- fixed-length.cabal +3/−2
- src/Data/FixedLength.hs +19/−4
fixed-length.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: 2.2 Name: fixed-length-Version: 0.2.2.1+Version: 0.2.3 License: BSD-3-Clause License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -25,7 +25,7 @@ Build-Type: Simple Source-Repository this- Tag: 0.2.2.1+ Tag: 0.2.3 Type: darcs Location: https://hub.darcs.net/thielema/fixed-length/ @@ -37,6 +37,7 @@ Build-Depends: tfp >=1.0 && <1.1, storable-record >=0.0.3 && <0.1,+ transformers >=0.5 && <0.6, non-empty >=0.2 && <0.4, utility-ht >=0.0.1 && <0.1, base >=4 && <5
src/Data/FixedLength.hs view
@@ -31,10 +31,12 @@ import qualified Control.Applicative as App import qualified Data.Traversable as Trav import qualified Data.Foldable as Fold+import qualified Data.Functor.Classes as FunctorC import qualified Data.List as List import Control.Applicative (Applicative, liftA2) import Data.Traversable (Traversable, foldMapDefault) import Data.Foldable (Foldable, foldMap)+import Data.Functor.Classes (Eq1, eq1, Show1, showsPrec1) import Data.Maybe (Maybe(Nothing, Just)) import Data.List ((++)) import Data.Word (Word)@@ -111,19 +113,29 @@ instance (Natural n, Eq a) => Eq (T n a) where- xs == ys = Fold.and $ zipWith (==) xs ys+ (==) = eq1 +instance (Natural n) => Eq1 (T n) where+ liftEq eq xs ys = Fold.and $ zipWith eq xs ys++ showsPrec :: (Natural n, Show a) => Int -> T n a -> ShowS-showsPrec p =+showsPrec = showsPrec1++liftShowsPrec_ :: (Natural n) => (Int -> a -> ShowS) -> Int -> T n a -> ShowS+liftShowsPrec_ showsPrec_ p = P.showParen (p>5) . concatS . List.intersperse (P.showString "!:") . (++ [P.showString "end"]) .- List.map (P.showsPrec 6) . toList+ List.map (showsPrec_ 6) . toList instance (Natural n, Show a) => Show (T n a) where- showsPrec = showsPrec+ showsPrec = showsPrec1 +instance (Natural n) => Show1 (T n) where+ liftShowsPrec showsPrec_ _showsList = liftShowsPrec_ showsPrec_ + toList :: (Natural n) => T n a -> [a] toList = Fold.toList @@ -194,6 +206,9 @@ newtype Index n = Index (Position n)++instance (Natural n) => Show (Index n) where+ show i = 'i' : P.show (numFromIndex i) unpackSucc :: Index (Unary.Succ n) -> Succ (Index n) unpackSucc (Index n1) =