packages feed

Fin 0.2.1.0 → 0.2.2.0

raw patch · 3 files changed

+13/−3 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Fin.List: at :: Functor f => Fin n -> (a -> f a) -> List n a -> f (List n a)
+ Data.Fin.List: swap :: Fin n -> Fin n -> List n a -> List n a

Files

Data/Fin/List.hs view
@@ -1,5 +1,5 @@ module Data.Fin.List (Peano, List (..),-                      fromList, uncons, head, tail, init, last, reverse, (!!)) where+                      fromList, uncons, head, tail, init, last, reverse, at, swap, (!!)) where  import Prelude () import Data.Fin.Private
Data/Fin/Private.hs view
@@ -2,7 +2,7 @@  module Data.Fin.Private where -import Prelude (Functor (..), Show (..), Num (..), Enum (..), Bounded (..), Integral (..), Bool (..), Integer, ($), (&&), fst, snd, error)+import Prelude (Functor (..), Show (..), Num (..), Enum (..), Bounded (..), Integral (..), Bool (..), Integer, ($), (&&), fst, snd, flip, uncurry, error) import Control.Applicative import Control.Arrow (Kleisli (..)) import Control.Category@@ -182,3 +182,13 @@ Nil !! n = case n of (x:._)  !! Zero = x (_:.xs) !! Succ n = xs !! n++at :: Functor f => Fin n -> (a -> f a) -> List n a -> f (List n a)+at Zero f (a:.as) = (:.as) <$> f a+at (Succ n) f (a:.as) = (a:.) <$> at n f as++swap :: Fin n -> Fin n -> List n a -> List n a+swap Zero Zero as = as+swap (Succ m) (Succ n) (a:.as) = a:.swap m n as+swap Zero (Succ n) (a:.as) = uncurry (:.) $ at n (flip (,) a) as+swap (Succ m) Zero (a:.as) = uncurry (:.) $ at m (flip (,) a) as
Fin.cabal view
@@ -1,5 +1,5 @@ name:                Fin-version:             0.2.1.0+version:             0.2.2.0 synopsis:            Finite totally-ordered sets -- description:          license:             BSD3