generic finger-tree structure (http://staff.city.ac.uk/~ross/papers/FingerTree.html)

#1`Measured`: Fundep necessary?

I wonder if the functional dependency on Measured is really necessary. It seems more natural to have multiple measures instead of multiple leaf types. For example a finger tree of text chunks could measure the number of characters, words, lines, etc.

-- Unnatural
FingerTree (Sum Int) Text
FingerTree (Sum Int) Words
FingerTree (Sum Int) Lines

-- Natural
FingerTree CharCount Text
FingerTree WordCount Text
FingerTree LineCount Text
  • This looks plausible, but we need to be sure it will do no harm. The fundep isn't needed by the package itself, but might save the need for type annotations on uses of functions like singleton, fromList and measure. Need to check with users of the package.

  • One option is to have an underlying class with no fundep and an overlying class with a fundep solely for inference.