On Fri, Mar 21, 2014 at 8:22 AM, Dennis Raddle <dennis.raddle@gmail.com> wrote:
This is a fairly complex problem

I'm sure you're right about this.
 
and I don't expect anyone to follow it all, but I thought I would just post it and see if anyone can immediately identify unidiomatic Haskell.

Have you run it through hlint? What does it say? Let us know if there's anything in hlint's output that's befuddling -- treat it more as a syntax h(l)inter than a syntax (h)linter.

p.s. A note about exposition: consider providing some input & output examples to illustrate what these functions are up to. The preceding paragraphs indicate twisty exceptions and special cases that are hard-going for the casual reader. Which means fewer eyeballs on your email.

p.p.s. Are there any interesting properties of these functions that you could leverage quickcheck on?

-- Kim-Ee