Marcin 'Qrczak' Kowalczyk wrote:
> My preference is still (B). (A) is not *very* bad, but should really
> replicate (-7) "foo" be []?

Mine too.

Actually after writing my own version of "drop" it turns out that
in my case n < 0 is a programmer error and n > length xs a user error.
So what you end up with (if (B) is choosen) is something like:

bafDrop :: Int -> String -> String
bafDrop i xs | i > length xs = bafError "corrupt BAF file"
             | otherwise     = drop i xs

Of course n < 0 isn't always a programmer error and you might want
to overwrite it. So that would suggest (A), but right now (B) is my
favourite, because I can't think of a practical example where n < 0
would be a user error.

Actually, (A) might be better, the extra check for i < 0 is not
time consuming anyway. I guess flipping a coin to choose between
(A) and (B) would work just as well (provided this doesn't lead
to a discussion about what coin to use).

  Jan

P.S. Now that I see the "bafDrop" outside the code, it looks odd. I
     have no right claiming that the BAF -file- is corrupt at that
     point. I'll have to rewrite this using some exception Monad.
     Since this would make the code even bigger I might as well
     put the entire code of drop in it. So much for code reuse...

Reply via email to