flaw-lmdb/Flaw/Data/Lmdb.hs

Summary

Maintainability
Test Coverage

Redundant do
Open

      iteration z r = do
        -- if we got key-value pair
        if r == MDB_SUCCESS then do
          -- get key
          keyLength <- fromIntegral . ptrToIntPtr <$> peek keyBufPtr
Severity: Minor
Found in flaw-lmdb/Flaw/Data/Lmdb.hs by hlint

Found

do if r == MDB_SUCCESS then
     do keyLength <- fromIntegral . ptrToIntPtr <$> peek keyBufPtr
        keyPtr <- peekElemOff keyBufPtr 1
        key <- B.packCStringLen (keyPtr, keyLength)
        if B.isPrefixOf keyPrefix key then
          do valueLength <- fromIntegral . ptrToIntPtr <$> peek valueBufPtr
             valuePtr <- peekElemOff valueBufPtr 1
             value <- B.packCStringLen (valuePtr, valueLength)
             (continue, nz) <- step key value z
             if continue then
               iteration nz =<<
                 mdb_cursor_get cursorPtr keyBufPtr valueBufPtr MDB_NEXT
               else return nz
          else return z
     else if r == MDB_NOTFOUND then return z else lmdbThrowError r

Perhaps

if r == MDB_SUCCESS then
  do keyLength <- fromIntegral . ptrToIntPtr <$> peek keyBufPtr
     keyPtr <- peekElemOff keyBufPtr 1
     key <- B.packCStringLen (keyPtr, keyLength)
     if B.isPrefixOf keyPrefix key then
       do valueLength <- fromIntegral . ptrToIntPtr <$> peek valueBufPtr
          valuePtr <- peekElemOff valueBufPtr 1
          value <- B.packCStringLen (valuePtr, valueLength)
          (continue, nz) <- step key value z
          if continue then
            iteration nz =<<
              mdb_cursor_get cursorPtr keyBufPtr valueBufPtr MDB_NEXT
            else return nz
       else return z
  else if r == MDB_NOTFOUND then return z else lmdbThrowError r

Use camelCase
Open

data MDB_cursor
Severity: Minor
Found in flaw-lmdb/Flaw/Data/Lmdb.hs by hlint

Found

data MDB_cursor

Perhaps

data MDBCursor

Use camelCase
Open

data MDB_txn
Severity: Minor
Found in flaw-lmdb/Flaw/Data/Lmdb.hs by hlint

Found

data MDB_txn

Perhaps

data MDBTxn

Use camelCase
Open

data MDB_env
Severity: Minor
Found in flaw-lmdb/Flaw/Data/Lmdb.hs by hlint

Found

data MDB_env

Perhaps

data MDBEnv

Use camelCase
Open

type MDB_dbi = CUInt
Severity: Minor
Found in flaw-lmdb/Flaw/Data/Lmdb.hs by hlint

Found

type MDB_dbi = CUInt

Perhaps

type MDBDbi = CUInt

Use camelCase
Open

type MDB_val = Ptr CChar
Severity: Minor
Found in flaw-lmdb/Flaw/Data/Lmdb.hs by hlint

Found

type MDB_val = Ptr CChar

Perhaps

type MDBVal = Ptr CChar

There are no issues that match your filters.

Category
Status