fixed-length 0.2.1 → 0.2.2
raw patch · 2 files changed
+28/−2 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.FixedLength: class ConsAll f
+ Data.FixedLength: consAll :: (ConsAll f, ResultSize f ~ n, NumberOfArguments f ~ n, Natural n) => f
+ Data.FixedLength: instance (a Data.Type.Equality.~ Data.FixedLength.ResultElement f, Data.FixedLength.ConsAll f) => Data.FixedLength.ConsAll (a -> f)
+ Data.FixedLength: instance Data.FixedLength.ConsAll (Data.FixedLength.T n a)
- Data.FixedLength: type family Curried n a b
+ Data.FixedLength: type family ResultElement f
Files
- fixed-length.cabal +2/−2
- src/Data/FixedLength.hs +26/−0
fixed-length.cabal view
@@ -1,5 +1,5 @@ Name: fixed-length-Version: 0.2.1+Version: 0.2.2 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -25,7 +25,7 @@ Build-Type: Simple Source-Repository this- Tag: 0.2.1+ Tag: 0.2.2 Type: darcs Location: http://hub.darcs.net/thielema/fixed-length/
src/Data/FixedLength.hs view
@@ -13,6 +13,7 @@ (!:), end, singleton, viewL, switchL, head, tail, switchEnd, Curried, curry, uncurry,+ ConsAll, NumberOfArguments, ResultSize, ResultElement, consAll, minimum, maximum, ) where @@ -334,6 +335,31 @@ Unary.switchNat (Uncurry switchEnd) (Uncurry $ \f -> switchL (\x -> uncurry (f x)))+++class ConsAll f where+ type NumberOfArguments f+ type ResultSize f+ type ResultElement f+ consAux ::+ (NumberOfArguments f ~ m, ResultSize f ~ n, ResultElement f ~ a) =>+ (T m a -> T n a) -> f++instance ConsAll (T n a) where+ type NumberOfArguments (T n a) = Unary.Zero+ type ResultSize (T n a) = n+ type ResultElement (T n a) = a+ consAux f = f end++instance (a ~ ResultElement f, ConsAll f) => ConsAll (a -> f) where+ type NumberOfArguments (a->f) = Unary.Succ (NumberOfArguments f)+ type ResultSize (a->f) = ResultSize f+ type ResultElement (a->f) = ResultElement f+ consAux f x = consAux (f . (x!:))++consAll ::+ (ConsAll f, ResultSize f ~ n, NumberOfArguments f ~ n, Natural n) => f+consAll = consAux P.id undefinedElem :: T n a -> a