Skip to content

Commit

Permalink
hsc -> hs
Browse files Browse the repository at this point in the history
  • Loading branch information
larskuhtz committed Jun 7, 2022
1 parent f5f8215 commit 30518a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
21 changes: 7 additions & 14 deletions src/Database/RocksDB/C.hsc → src/Database/RocksDB/C.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ import Foreign
import Foreign.C.Types
import Foreign.C.String

#ifdef mingw32_HOST_OS
#include <rocksdb\c.h>
#else
#include <rocksdb/c.h>
#endif

data RocksDB
data LCache
data LComparator
Expand Down Expand Up @@ -51,15 +45,14 @@ type Val = CString

newtype CompressionOpt = CompressionOpt { compressionOpt :: CInt }
deriving (Eq, Show)
#{enum CompressionOpt, CompressionOpt
, noCompression = 0
, snappyCompression = 1
, zlibCompression = 2
, bz2Compression = 3
, lz4Compression = 4
, lz4hcCompression = 5
}

noCompression, snappyCompression, zlibCompression, bz2Compression, lz4Compression, lz4hcCompression :: CompressionOpt
noCompression = CompressionOpt 0
snappyCompression = CompressionOpt 1
zlibCompression = CompressionOpt 2
bz2Compression = CompressionOpt 3
lz4Compression = CompressionOpt 4
lz4hcCompression = CompressionOpt 5

foreign import ccall safe "rocksdb\\c.h rocksdb_open"
c_rocksdb_open :: OptionsPtr -> DBName -> ErrPtr -> IO RocksDBPtr
Expand Down
9 changes: 3 additions & 6 deletions src/Database/RocksDB/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,9 @@ mkOpts Options{..} = do
return (Options' opts_ptr Nothing cmp)

where
ccompression NoCompression =
noCompression
ccompression SnappyCompression =
snappyCompression
ccompression ZlibCompression =
zlibCompression
ccompression NoCompression = noCompression
ccompression SnappyCompression = snappyCompression
ccompression ZlibCompression = zlibCompression

maybeSetCmp :: OptionsPtr -> Maybe Comparator -> IO (Maybe Comparator')
maybeSetCmp opts_ptr (Just mcmp) = Just <$> setcmp opts_ptr mcmp
Expand Down

0 comments on commit 30518a1

Please sign in to comment.