̏8      !"#$%&'()*+,-./0123456789: ; < = > ? @ A B C D E F G H I JKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%& ' ( ) * + , - . / 0 1 2 3 4 5 6 7  (c) Henning Thielemann 2007haskell@henning-thielemann.destable Haskell 98Safe8nA list of elements of alternating types, where the type of the beginning and the end element is equal, namely b. Example:  1 :> 'a' : 2: 'b' : 3: End9vA list of elements of alternating types, where the types of the beginning and the end element are independent, namely a at the beginning, b at the end. Example:  1 :> 'a' : 2: 'b' :< End 8:9;<=>?@8:9<;:5<5  (c) Henning Thielemann 2007-2009haskell@henning-thielemann.destable Haskell 98SafeACounterpart to  .BCounterpart to  .CZCurrently it is not checked, whether n is too big. Don't rely on the current behaviour of  splitAt n x for  n > length x./DEFGHIJKLABMNOPQRSTUVWXYZ[\]^_`abcdefghCijklmnoDpqrstu (c) Henning Thielemann 2007-2010haskell@henning-thielemann.destable Haskell 98Safev,The constructor is only exported for use in Data.AlternatingList.List.Mixed.,vwxyz{|}~vw (c) Henning Thielemann 2007-2009haskell@henning-thielemann.destable Haskell 98Safe ,55 (c) Henning Thielemann 2007-2009haskell@henning-thielemann.destable Haskell 98Safe$[Duration of an empty event list is considered zero. However, I'm not sure if this is sound. 5 (c) Henning Thielemann 2007-2009haskell@henning-thielemann.destable Haskell 98Safe&e   5(c) Henning Thielemann 2007haskell@henning-thielemann.destable Haskell 98Safe(   (c) Henning Thielemann 2007-2010haskell@henning-thielemann.destable Haskell 98Safe)5 (c) Henning Thielemann 2007-2010haskell@henning-thielemann.destable Haskell 98Safe+o (c) Henning Thielemann 2007-2010haskell@henning-thielemann.destable Haskell 98Safe, 5 (c) Henning Thielemann 2007-2010haskell@henning-thielemann.destable Haskell 98Safe. !"#$%&'()*+,-./0123*,+ !"#$%&'()-./0123 (c) Henning Thielemann 2007-2010haskell@henning-thielemann.destable Haskell 98Safe1 456745 (c) Henning Thielemann 2007-2010haskell@henning-thielemann.destable Haskell 98Safe289:;<=>?@ABCDEFGHIJKLM85Safe8.Given the time fraction that remains from the preceding event and the current time difference, evaluate an integer time difference and the remaining fractional part. If we would simply map Time to integer values with respect to the sampling rate, then rounding errors would accumulate. (c) Henning Thielemann 2007-2010haskell@henning-thielemann.destable Haskell 98Safec bCheck whether time values are in ascending order. The list is processed lazily and times that are smaller than there predecessors are replaced by  undefined. If you would remove the  undefined_ times from the resulting list the times may still not be ordered. E.g. consider the time list  [0,3,1,2]jmSince we need it later for MIDI generation, we will also define a slicing into equivalence classes of events.kWe will also sometimes need a function which groups events by equal start times. This implementation is not so obvious since we work with time differences. The criterion is: Two neighbouring events start at the same time if the second one has zero time difference.mWill fail on infinite lists.o3Apply a function to the lists of coincident events.pa sorts a list of coinciding events, that is all events but the first one have time difference 0. pg sorts all coinciding events in a list thus yielding a canonical representation of a time ordered list.r The first important function is rA which merges the events of two lists into a new time order list.s Note that r compares entire events rather than just start times. This is to ensure that it is commutative, a desirable condition for some of the proofs used in secref{equivalence}. It is also necessary to assert a unique representation of the performance independent of the structure of the 'Music.T note'. The same function for inserting into a time ordered list with a trailing pause. The strictness annotation is necessary for working with infinite lists.NHere are two other functions that are already known for non-padded time lists.tThe final critical function is insert{, which inserts an event into an already time-ordered sequence of events. For instance it is used in MidiFiles to insert a NoteOff event into a list of NoteOn and NoteOff events.vMove events towards the front of the event list. You must make sure, that no event is moved before time zero. This works only for finite lists.xHere are some functions for discretizing the time information. When converting the precise relative event times to the integer relative event times we have to prevent accumulation of rounding errors. We avoid this problem with a stateful conversion which remembers each rounding error we make. This rounding error is used to correct the next rounding. Given the relative time and duration of a note the function discretizeEventM creates a StateW which computes the rounded relative time. It is corrected by previous rounding errors.The resulting event list may have differing time differences which were equal before discretization, but the overall timing is uniformly close to the original.6 NOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy6NPOSTQRUVXWYZ[\]^_`arstuvwehijcdfgpqkno xyblm (c) Henning Thielemann 2007-2010haskell@henning-thielemann.destable Haskell 98SafeHKeep only events that match a predicate while preserving absolute times.UAdds times in a left-associative fashion. Use this if the time is a strict data type.Using a classification function we splice the event list into lists, each containing the same class. Absolute time stamps are preserved.IGroup events that have equal start times (that is zero time differences).(Reverse to collectCoincident: Turn each body into a separate event. ( xs == flatten (collectCoincident xs)3Apply a function to the lists of coincident events.a sorts a list of coinciding events, that is all events but the first one have time difference 0. g sorts all coinciding events in a list thus yielding a canonical representation of a time ordered list.NThis function merges the events of two lists into a new event list. Note that  compares entire events rather than just start times. This is to ensure that it is commutative, one of the properties we test for. is like , but does not simply use the methods of the B class but allows a custom comparison function. If in event lists xs and ys there are coinciding elements x and y, and cmp x y is True, then x comes before y in mergeBy cmp xs ys. EventList> EventList.mergeBy (\_ _ -> True) (0 /. 'a' ./ empty) (0 /. 'b' ./ empty) 0 /. 'a' ./ 0 /. 'b' ./ empty EventList> EventList.mergeBy (\_ _ -> False) (0 /. 'a' ./ empty) (0 /. 'b' ./ empty) 0 /. 'b' ./ 0 /. 'a' ./ empty7 inserts an event into an event list at the given time.Move events towards the front of the event list. You must make sure, that no event is moved before time zero. This works only for finite lists. We provide  and  for discretizing the time information. When converting the precise relative event times to the integer relative event times we have to prevent accumulation of rounding errors. We avoid this problem with a stateful conversion which remembers each rounding error we make. This rounding error is used to correct the next rounding. Given the relative time and duration of an event the function  floorDiff creates a W which computes the rounded relative time. It is corrected by previous rounding errors.The resulting event list may have differing time differences which were equal before discretization, but the overall timing is uniformly close to the original.We use  floorDiff rather than ; in order to compute exclusively with non-negative numbers.sWe tried hard to compute everything with respect to relative times. However sometimes we need absolute time values.dConvert from relative time stamps to absolute time stamps using a custom accumulator function (like (+)).YConvert from absolute time stamps to relative time stamps using custom subtraction (like (-) ) and zero.;4z{|}~;4z|{}~(c) Henning Thielemann 2007haskell@henning-thielemann.destable Haskell 98Safe 567z z56755 (c) Henning Thielemann 2007-2009haskell@henning-thielemann.destable Haskell 98Safe:3Apply a function to the lists of coincident events.a sorts a list of coinciding events, that is all events but the first one have time difference 0. g sorts all coinciding events in a list thus yielding a canonical representation of a time ordered list.Move events towards the front of the event list. You must make sure, that no event is moved before time zero. This works only for finite lists., ,  (c) Henning Thielemann 2007-2010haskell@henning-thielemann.destable Haskell 98SafeSort coincident elements. The first important function is A which merges the events of two lists into a new time order list. Note that { compares entire events rather than just start times. This is to ensure that it is commutative, a desirable condition for some of the proofs used in Haskore/section equivalence. It is also necessary to assert a unique representation of the event list independent of the structure of the event type. The same function for inserting into a time ordered list with a trailing pause.Move events towards the front of the event list. You must make sure, that no event is moved before time zero. This works only for finite lists.Like ( but restricts the look-ahead time. For $moveForwardRestricted maxTimeDiff xs7 all time differences (aka the moveForward offsets) in xs must be at most  maxTimeDiffj. With this restriction the function is lazy enough for handling infinite event lists. However the larger  maxTimeDiff& the more memory and time is consumed. currently only for testing currently only for testing currently only for testing LMerge several event lists respecting the start time of the outer event list. and  are essentially the same.  must use J in order to work on infinite lists, however if there are many empty lists, summing of their durations will be done from right to left, which is inefficient. Thus we detect subsequent empty lists and merge them from left to right. Uses sharing.]If there is an event at the cutting time, this event is returned in the suffix part. That is splitAtTime t0 (t0 . x $. t1 ./ empty) == (pause t0, 0 . x . t1 ./ empty)Analogously to the  /  pair we have to versions of O, where the clever implementation sums up pauses from the beginning to the end.UAdds times in a left-associative fashion. Use this if the time is a strict data type.jAdds times in a right-associative fashion. Use this if the time is a data type like lazy Peano numbers or Numeric.NonNegative.Chunky.Cf. mSince we need it later for MIDI generation, we will also define a slicing into equivalence classes of events.E89JKLM      !"#$%E8     LJ 9!K"#M$% (c) Henning Thielemann 2007haskell@henning-thielemann.destable Haskell 98Safe+)This is not a good name, expect a change.,)This is not a good name, expect a change.-~At the division time move all zero time differences to the suffix part, that is we will always split before a group of events.0}At the division time move all zero time differences to the prefix part, that is we will always split after a group of events.>?BCGHI&'()*+,-./012&'>?BCGHI()*+,-./012 (c) Henning Thielemann 2007haskell@henning-thielemann.destable Haskell 98Safe*:;<=@ADEF34567:;43*<=@ADEF5673545 !"#$%&'()*+,-./012 3,-456.789:;<=>?@ABCDEF"GHIJ'(KL)*DEFMN+:O!P<=>?@AB/012,-456.789Q:;RSTUVWXYZP[\]^_`abcde<=>?@AB/012 fgh,-456.789:;RSTUVWCXP[\]^_`ab"#$c!deijklGHmnIJKLop12 ?@A,-456.789:RSTUWXP[\]^_`ab"#$c!deop12 ?@ABfgh,-456.789\]^_`qbrstuvwx#y$z{|}cX[RST~UVWdeij % & { | } m n      ,  / 0 - 4 < > = ? @ A  B  : ; " # $    ,-4>?@:nmAB#$NW'event-list-0.1.2-A5O0bQ5gahA8F1bL7HjoC1 Data.EventList.Absolute.TimeBody Data.EventList.Absolute.TimeTime!Data.EventList.Absolute.TimeMixed Data.EventList.Relative.BodyBody Data.EventList.Relative.BodyTime Data.EventList.Relative.TimeBody!Data.EventList.Relative.MixedBody Data.EventList.Relative.TimeTime!Data.EventList.Relative.MixedTime!Data.EventList.Relative.TimeMixedData.AlternatingList.Custom#Data.AlternatingList.List.DisparateFoldablefoldfoldMap!Data.AlternatingList.List.UniformData.AlternatingList.List.Mixed'Data.EventList.Absolute.TimeBodyPrivate'Data.EventList.Absolute.TimeTimePrivate'Data.EventList.Relative.BodyBodyPrivate'Data.EventList.Relative.BodyTimePrivate'Data.EventList.Relative.TimeBodyPrivate'Data.EventList.Relative.TimeTimePrivateData.EventList.UtilityControl.Monad.StateStateTswitchLswitchRmapBodymapTimedurationdelayappendconcatcyclesnocBodysnocTime viewTimeR viewBodyR switchTimeR switchBodyR mapTimeInitconcatMapMonoidtraversemapM fromPairList toPairList getBodiesgetTimes durationR traverse_ traverseBody traverseTimemapM_mapBodyMmapTimeMfoldr foldrPairemptynull singletonconssnocviewLviewRspanmapTimeL mapTimeHead mapTimeTailconsBodyconsTime viewTimeL viewBodyL switchTimeL switchBodyLmapTimeR mapTimeLast forceTimeHeadflatten checkTimesfiltermapMaybe catMaybes partitionpartitionMaybeslicecollectCoincidentcollectCoincidentFoldrcollectCoincidentNonLazy mapCoincident normalize isNormalizedmergemergeByinsertinsertBy moveForward decreaseStart discretizeresample zipWithBody zipWithTimeunziptoAbsoluteEventListfromAbsoluteEventListtoAbsoluteEventListGenfromAbsoluteEventListGen.//.pauseisPausepad moveBackwardmoveForwardRestrictedmoveForwardRestrictedBymoveForwardRestrictedByStrictmoveForwardRestrictedByQueuearrange arrangeBy concatNaive cycleNaive splitAtTimetakeTimedropTime catMaybesRpartitionMaybeRfoldlreversemapBodyR mapBodyLast mapBodyInit appendBodyEndprependBodyEndsplitAfterTime takeAfterTime dropAfterTimemapBodyL mapBodyHead mapBodyTailUniform Disparate:<End:> mapDisparate mapUniformfoldrDisparate foldrUniform concatMonoidsplitAtformatmapmapFirst mapSecond zipWithFirst zipWithSecondsequence sequence_ traverseFirsttraverseSecond getFirsts getSecondslength genericLengthmapHeadmapLasttakedropgenericSplitAt genericTake genericDrop spanFirst spanSecondConsdeconsPair pairFirst pairSecond fromFirstListfromSecondListfromEitherList isSingleton mapSecondHeadforceSecondHead filterFirst filterSecondpartitionFirstpartitionSecondpartitionMaybeFirstpartitionMaybeSecondpartitionEitherFirstpartitionEitherSecondunzipEitherFirstunzipEitherSecondcatMaybesFirstcatMaybesSecond_leaddisp consFirst consSecond snocFirst snocSecond viewFirstL viewSecondL viewFirstR viewSecondR switchFirstL switchSecondL switchFirstR switchSecondR mapFirstL mapFirstHead mapFirstTail mapSecondL mapSecondTail mapFirstR mapFirstLast mapFirstInit mapSecondR mapSecondLast mapSecondInitreverseUniformreverseDisparateappendUniformUniformappendDisparateUniformappendUniformDisparateconcatDisparate concatUniformsplitAtDisparateUniformsplitAtUniformDisparatesplitAtUniformUniform takeDisparate takeUniform dropDisparate dropUniform$~liftliftAliftM$*$**unlift$*~$~* appendAlt appendSwitch$~~ roundDiff' roundDiff floorDiffbeforeBybase Data.OldListsortghc-prim GHC.ClassesOrd