mwotton/lz4hs — pull request #6 by cartazio (2013-03-04 05:36:48+00:00)
Title: fixed long standing decompression bug!!!

Fixed issue https://github.com/mwotton/lz4hs/issues/5#issuecomment-14364357

Also had to add ScopedTypeVariables so that I could annotate the r variable with a fixed type and thus suppress having a type Defaulting warning.

An alternative approach to suppressing that warning would be to replace

```haskell
return $! if (r <= 0) then 0 else l
```

with

```haskell
return $! if (r <= 0) then max r 0 else l
```

but that needless complicates reasoning about code that was already somewhat subtle to debug!
(i'm happy to change it to that variant, but I think no one who's going to use this library in the forseeable future isn't using a relatively modern variant of ghc, so that'd be overkill probably)