-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement experimental support for CPP
- Loading branch information
Showing
34 changed files
with
339 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,5 @@ foo = 5 | |
|
||
data Foo = Foo Int | ||
{-# ANN type Foo ("HLint: ignore") #-} | ||
|
||
{- Comment -} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
main = return () | ||
|
||
-- stack runhaskell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
main = return () | ||
|
||
-- stack runhaskell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Main (main) where | ||
|
||
import Data.Void | ||
import Test.Hspec | ||
import Test.Hspec.Megaparsec | ||
import Text.Megaparsec | ||
import Text.Megaparsec.Char | ||
|
||
# if !MIN_VERSION_base(4,13,0) | ||
import Data.Semigroup ((<>)) | ||
# endif | ||
|
||
main :: IO () | ||
main = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Main (main) where | ||
|
||
import Data.Void | ||
import Test.Hspec | ||
import Test.Hspec.Megaparsec | ||
import Text.Megaparsec | ||
import Text.Megaparsec.Char | ||
|
||
# if !MIN_VERSION_base(4,13,0) | ||
import Data.Semigroup ((<>)) | ||
# endif | ||
|
||
main :: IO () | ||
main = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
instance Stream s => Monad (ParsecT e s m) where | ||
return = pure | ||
(>>=) = pBind | ||
|
||
#if !(MIN_VERSION_base(4,13,0)) | ||
fail = Fail.fail | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
instance Stream s => Monad (ParsecT e s m) where | ||
return = pure | ||
(>>=) = pBind | ||
#if !(MIN_VERSION_base(4,13,0)) | ||
fail = Fail.fail | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
instance Stream s => Monad (ParsecT e s m) where | ||
return = pure | ||
(>>=) = pBind | ||
|
||
#if !(MIN_VERSION_base(4,13,0)) | ||
fail = Fail.fail | ||
#endif | ||
|
||
foo :: Int | ||
foo = undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
instance Stream s => Monad (ParsecT e s m) where | ||
return = pure | ||
(>>=) = pBind | ||
#if !(MIN_VERSION_base(4,13,0)) | ||
fail = Fail.fail | ||
#endif | ||
|
||
foo :: Int | ||
foo = undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
decompressingPipe :: | ||
(PrimMonad m, MonadThrow m, MonadResource m) => | ||
CompressionMethod -> | ||
ConduitT ByteString ByteString m () | ||
decompressingPipe Store = C.awaitForever C.yield | ||
decompressingPipe Deflate = Z.decompress $ Z.WindowBits (-15) | ||
|
||
#ifdef ENABLE_BZIP2 | ||
decompressingPipe BZip2 = BZ.bunzip2 | ||
#else | ||
decompressingPipe BZip2 = throwM BZip2Unsupported | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
decompressingPipe | ||
:: (PrimMonad m, MonadThrow m, MonadResource m) | ||
=> CompressionMethod | ||
-> ConduitT ByteString ByteString m () | ||
decompressingPipe Store = C.awaitForever C.yield | ||
decompressingPipe Deflate = Z.decompress $ Z.WindowBits (-15) | ||
#ifdef ENABLE_BZIP2 | ||
decompressingPipe BZip2 = BZ.bunzip2 | ||
#else | ||
decompressingPipe BZip2 = throwM BZip2Unsupported | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
decompressingPipe :: | ||
(PrimMonad m, MonadThrow m, MonadResource m) => | ||
CompressionMethod -> | ||
ConduitT ByteString ByteString m () | ||
decompressingPipe Store = C.awaitForever C.yield | ||
decompressingPipe Deflate = Z.decompress $ Z.WindowBits (-15) | ||
|
||
#ifdef ENABLE_BZIP2 | ||
decompressingPipe BZip2 = BZ.bunzip2 | ||
#else | ||
decompressingPipe BZip2 = throwM BZip2Unsupported | ||
#endif | ||
|
||
foo :: Int | ||
foo = undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
decompressingPipe | ||
:: (PrimMonad m, MonadThrow m, MonadResource m) | ||
=> CompressionMethod | ||
-> ConduitT ByteString ByteString m () | ||
decompressingPipe Store = C.awaitForever C.yield | ||
decompressingPipe Deflate = Z.decompress $ Z.WindowBits (-15) | ||
#ifdef ENABLE_BZIP2 | ||
decompressingPipe BZip2 = BZ.bunzip2 | ||
#else | ||
decompressingPipe BZip2 = throwM BZip2Unsupported | ||
#endif | ||
|
||
foo :: Int | ||
foo = undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ffff, ffffffff :: Natural | ||
|
||
#ifdef HASKELL_ZIP_DEV_MODE | ||
ffff = 200 | ||
ffffffff = 5000 | ||
#else | ||
ffff = 0xffff | ||
ffffffff = 0xffffffff | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ffff, ffffffff :: Natural | ||
#ifdef HASKELL_ZIP_DEV_MODE | ||
ffff = 200 | ||
ffffffff = 5000 | ||
#else | ||
ffff = 0xffff | ||
ffffffff = 0xffffffff | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ffff, ffffffff :: Natural | ||
|
||
#ifdef HASKELL_ZIP_DEV_MODE | ||
ffff = 200 | ||
ffffffff = 5000 | ||
#else | ||
ffff = 0xffff | ||
ffffffff = 0xffffffff | ||
#endif | ||
|
||
foo :: Int | ||
foo = undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ffff, ffffffff :: Natural | ||
#ifdef HASKELL_ZIP_DEV_MODE | ||
ffff = 200 | ||
ffffffff = 5000 | ||
#else | ||
ffff = 0xffff | ||
ffffffff = 0xffffffff | ||
#endif | ||
|
||
foo :: Int | ||
foo = undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
sinkData h compression = do | ||
(uncompressedSize, crc32, compressedSize) <- | ||
case compression of | ||
Store -> | ||
withCompression | ||
dataSink | ||
Deflate -> | ||
withCompression $ | ||
Z.compress 9 (Z.WindowBits (-15)) .| dataSink | ||
#ifdef ENABLE_BZIP2 | ||
BZip2 -> withCompression $ | ||
BZ.bzip2 .| dataSink | ||
#else | ||
BZip2 -> throwM BZip2Unsupported | ||
#endif | ||
return | ||
DataDescriptor | ||
{ ddCRC32 = fromIntegral crc32, | ||
ddCompressedSize = compressedSize, | ||
ddUncompressedSize = uncompressedSize | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
sinkData h compression = do | ||
(uncompressedSize, crc32, compressedSize) <- | ||
case compression of | ||
Store -> withCompression | ||
dataSink | ||
Deflate -> withCompression $ | ||
Z.compress 9 (Z.WindowBits (-15)) .| dataSink | ||
#ifdef ENABLE_BZIP2 | ||
BZip2 -> withCompression $ | ||
BZ.bzip2 .| dataSink | ||
#else | ||
BZip2 -> throwM BZip2Unsupported | ||
#endif | ||
return DataDescriptor | ||
{ ddCRC32 = fromIntegral crc32 | ||
, ddCompressedSize = compressedSize | ||
, ddUncompressedSize = uncompressedSize } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Main (main) where | ||
|
||
import Data.Void | ||
import Test.Hspec | ||
import Test.Hspec.Megaparsec | ||
import Text.Megaparsec | ||
import Text.Megaparsec.Char | ||
|
||
#if !MIN_VERSION_base(4,13,0) | ||
import Data.Semigroup ((<>)) | ||
#endif | ||
|
||
main :: IO () | ||
main = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Main (main) where | ||
|
||
import Data.Void | ||
import Test.Hspec | ||
import Test.Hspec.Megaparsec | ||
import Text.Megaparsec | ||
import Text.Megaparsec.Char | ||
|
||
#if !MIN_VERSION_base(4,13,0) | ||
import Data.Semigroup ((<>)) | ||
#endif | ||
|
||
main :: IO () | ||
main = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.