HarmTrace-Base 1.0.0.2 → 1.1.0.1
raw patch · 2 files changed
+17/−6 lines, 2 filesdep ~ListLikedep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ListLike, base
API changes (from Hackage documentation)
+ HarmTrace.Base.MusicTime: prettyPrint :: Show a => [TimedData a] -> String
Files
- HarmTrace-Base.cabal +4/−4
- src/HarmTrace/Base/MusicTime.hs +13/−2
HarmTrace-Base.cabal view
@@ -1,11 +1,11 @@ name: HarmTrace-Base -version: 1.0.0.2 +version: 1.1.0.1 synopsis: Parsing and unambiguously representing musical chords. description: HarmTrace: Harmony Analysis and Retrieval of Music with Type-level Representations of Abstract Chords Entities . - We present HarmTrace-Base, a libary for parsing and + We present HarmTrace-Base, a library for parsing and unambiguously representing musical chords. copyright: (c) 2012--2013 W. Bas de Haas and Jose Pedro Magalhaes @@ -25,8 +25,8 @@ hs-source-dirs: src - build-depends: base >= 4.4 && < 4.7, uu-parsinglib ==2.7.4.*, - ListLike ==3.1.*, binary >= 0.6.4, ghc-prim >= 0.2 + build-depends: base >= 4.4 && < 4.8, uu-parsinglib ==2.7.4.*, + ListLike >=3.1, binary >= 0.6.4, ghc-prim >= 0.2 ghc-options: -Wall
src/HarmTrace/Base/MusicTime.hs view
@@ -61,11 +61,12 @@ , dropTimed , timeStamp , beat + , prettyPrint ) where import HarmTrace.Base.MusicRep - +import Data.List (intercalate) -- | When reducing and expaninding 'TimedData' types there might be rounding -- errors in the floating point time stamps. The 'roundingError' parameter @@ -132,7 +133,7 @@ a == b = chordLab a == chordLab b instance Show (ProbChord) where - show (ProbChord c _p) = show c -- ++ ':' : printf "%.2f" p + show (ProbChord c p) = show c ++ ':' : show p instance Show Beat where show One = "1" @@ -295,3 +296,13 @@ -- 'Timed' data structure dropTimed :: [TimedData a] -> [a] dropTimed = map getData + +-- | Pretty prints a list of 'TimedData's, one per line +prettyPrint :: Show a => [TimedData a] -> String +prettyPrint = intercalate "\n" . map pprint where + + pprint :: Show a => TimedData a -> String + pprint (TimedData d [ ]) = "not set - not set: " ++ show d + pprint (TimedData d [x]) = show x ++" - not set: " ++ show d + pprint (TimedData d ts ) = show (head ts) ++ " - " ++ show (last ts) + ++ ": " ++ show d