I put the "try" in the wrong place.  Silly me

-- This also works and uses <|> directly instead of via option
countBetween' m n p | m<=n = do
  xs <- count m p
  let loop 0 acc = return (acc [])
      loop i acc =
        (do x <- try p
            loop (pred i) (acc . (x:))) <|>
        (return (acc []))
  ys <- loop (n-m) id
  return (xs++ys)


_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to