<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> I don't understand how this turned into an argument about simplicity. I never said it was complex.</blockquote>
<div><br></div><div>i wasn't arguing, just confused about what you were asking cuz i didn't see what wasn't straightforward. so i addressed the straightforward interpretation in order to ask what that was missing. :) looks like polyphony is the issue, so i think you need a directed acyclic graph (DAG).</div>
<div><br></div><div><a href="http://hackage.haskell.org/packages/archive/containers/0.3.0.0/doc/html/Data-Graph.html">http://hackage.haskell.org/packages/archive/containers/0.3.0.0/doc/html/Data-Graph.html</a></div><div><br>
</div><div>since every note has at most one pre-Tie and one post-Tie, i guess you don't need a general DAG -- but a graph library would have the algorithms for walking the Ties (ie, <font class="Apple-style-span" face="'courier new', monospace">dfs, components, reachable, </font>etc. in the mentioned library).</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">I conceive of this problem as multiple passes. On the first pass, I translate XML notes into a convenient internal representation, on the second pass sort them, then make a pass to figure out ties. Whether this is the best approach, I do not know.</div>
</blockquote><div><br></div><div>sure that makes sense, i was just addressing the last pass, the matter of wiring up the tie references.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Regarding my use of Rational, it's because I'm representing *notated* durations or positions in time, which are always fractions of integers. Suppose I give the command to my program to play via midi everything from bar 1 beat 1 to bar 2 beat 2 1/2. I want to use Rational so I know 2 1/2 means 2 1/2 and not 2.49999999999. </blockquote>
<div><br></div><div>i wasn't suggesting anything Numeric for durations -- those are NoteDurs like (Dotted $ Triplet Half). you don't need numerics until resolving temporal locations, like milliseconds or subdivisions of a beat. those may be irrational numbers (consider if the tempo is irrational, or tiny random jitter in timing) -- though it's a totally pedantic point on my part and realistically won't matter. ;)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I don't quite get this:<div class="im"><br>
> forall x. (Real x, Fractional x) => x if you're picky.<br></div></blockquote><div> </div><div>just being agnostic about the true representation as long as you have <font class="Apple-style-span" face="'courier new', monospace">(/),</font> <font class="Apple-style-span" face="'courier new', monospace">compare, realToFrac, toRational</font>. the client can choose some concrete representation like Rationals, Floats, Doubles, some Fixed resolution, some C type, something they make up, etc. space or speed or compatibility may trump precision for some applications.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
(*) I may want to use the location of a note (bar and beat) as the key in a Map, which I believe should be done with Rational and not Float.</blockquote><div><br></div><div>location needs subdiv, which is (very pedantically) not Rational. :)</div>
<div><br></div><div>-e</div></div>