alist 0.1.0.4 → 0.1.0.5
raw patch · 2 files changed
+19/−8 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.AList: AList :: AList a -> AList a -> AList a
- Data.AList: instance GHC.Read.Read (Data.AList.AList a)
- Data.AList: instance GHC.Show.Show (Data.AList.AList a)
+ Data.AList: AListAppend :: AList a -> AList a -> AList a
+ Data.AList: AListTip :: a -> AList a
+ Data.AList: drawAList :: Show a => AList a -> [Char]
+ Data.AList: drawAList' :: Show a => AList a -> [Char]
+ Data.AList: fold :: () => (t -> t -> t) -> t -> AList t -> t
+ Data.AList: instance GHC.Read.Read a => GHC.Read.Read (Data.AList.AList a)
+ Data.AList: instance GHC.Show.Show a => GHC.Show.Show (Data.AList.AList a)
+ Data.AList: singleton :: () => a -> AList a
+ Data.AList: sum :: AList Integer -> Integer
Files
- Data/AList.hs +18/−7
- alist.cabal +1/−1
Data/AList.hs view
@@ -1,19 +1,30 @@ module Data.AList where +import Prelude hiding (sum) import Data.Monoid import Data.Semigroup -data AList a = AListEmpty- | AList (AList a) (AList a)+data AList a = AListTip a+ | AListAppend (AList a) (AList a)+ | AListEmpty deriving (Read,Show) -append a@(AList _ _) b@(AList _ _) = AList a b -append AListEmpty a = a-append a AListEmpty = a+singleton x = AListTip x+append = AListAppend -instance Monoid (AList a) where +fold f base (AListAppend a b) = f (fold f base a) (fold f base b)+fold f base (AListTip x) = x+fold f base AListEmpty = base++sum = fold (+) 0++drawAList x = '[' : drawAList' x ++ "]"+drawAList' AListEmpty = ""+drawAList' (AListAppend a b) = drawAList' a ++ "," ++ drawAList' b+drawAList' (AListTip a) = show a ++instance Monoid (AList a) where mempty = AListEmpty mappend = append instance Semigroup (AList a) where (<>) = append-
alist.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.0.4+version: 0.1.0.5 -- A short (one-line) description of the package. synopsis: lists with O(1) append