-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This avoids the use of CPP where possible; the last remaining CPP use-site could in principle be avoided too by using cabal-level conditional compilation but for now we've just reduced the source-code exposed to the CPP phase to a bare minimum. While at it, also fixup the package description and upgrade to cabal-version:2.0 as there's little reason not to in 2021.
- Loading branch information
Showing
4 changed files
with
48 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{-# LANGUAGE CPP #-} | ||
{-# LANGUAGE Trustworthy #-} | ||
|
||
-- | | ||
-- Module : Compat | ||
-- License : BSD-3 | ||
-- Maintainer : Herbert Valerio Riedel <[email protected]> | ||
-- Stability : stable | ||
-- | ||
-- Compat layer to reduce code exposure to CPP to a bare minimum | ||
-- | ||
module Compat (constructBS) where | ||
|
||
import Foreign.ForeignPtr (ForeignPtr) | ||
import Data.Word (Word8) | ||
import Data.ByteString.Internal (ByteString (..)) | ||
|
||
-- | Directly construct a 'ByteString', unsafely | ||
constructBS :: ForeignPtr Word8 -> Int -> ByteString | ||
#if MIN_VERSION_bytestring(0,11,0) | ||
constructBS = BS | ||
#else | ||
constructBS = \fp -> PS fp 0 | ||
#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