inline-c 0.6.0.5 → 0.6.0.6
raw patch · 5 files changed
+37/−5 lines, 5 filesdep ~ansi-wl-pprintdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: ansi-wl-pprint, base
API changes (from Hackage documentation)
+ Language.C.Inline.Context: instance Data.Semigroup.Semigroup Language.C.Inline.Context.Context
+ Language.C.Types: instance Data.Semigroup.Semigroup Language.C.Types.Specifiers
- Language.C.Inline: class WithPtrs a where type WithPtrsPtrs a :: * withPtrs_ f = do { (x, _) <- withPtrs f; return x } where {
+ Language.C.Inline: class WithPtrs a where {
- Language.C.Inline.Context: class VecCtx a where type VecCtxScalar a :: * where {
+ Language.C.Inline.Context: class VecCtx a where {
Files
- changelog.md +1/−0
- inline-c.cabal +2/−2
- src/Language/C/Inline/Context.hs +19/−1
- src/Language/C/Types.hs +14/−1
- test/Language/C/Types/ParseSpec.hs +1/−1
changelog.md view
@@ -1,3 +1,4 @@+- 0.6.0.6: Support GHC 8.4 - 0.6.0.5: Update readme - 0.6.0.4: Remove QuickCheck dependency - 0.6.0.3: Remove cryptohash dependencies
inline-c.cabal view
@@ -1,5 +1,5 @@ name: inline-c-version: 0.6.0.5+version: 0.6.0.6 synopsis: Write Haskell source files including C code inline. No FFI required. description: See <https://github.com/fpco/inline-c/blob/master/README.md>. license: MIT@@ -33,7 +33,7 @@ other-modules: Language.C.Inline.FunPtr ghc-options: -Wall build-depends: base >=4.7 && <5- , ansi-wl-pprint+ , ansi-wl-pprint >= 0.6.8 , bytestring , containers , hashable
src/Language/C/Inline/Context.hs view
@@ -51,7 +51,6 @@ import Data.Coerce import Data.Int (Int8, Int16, Int32, Int64) import qualified Data.Map as Map-import Data.Monoid ((<>)) import Data.Typeable (Typeable) import qualified Data.Vector.Storable as V import qualified Data.Vector.Storable.Mutable as VM@@ -65,6 +64,12 @@ import qualified Text.Parser.Token as Parser import qualified Data.HashSet as HashSet +#if MIN_VERSION_base(4,9,0)+import Data.Semigroup (Semigroup, (<>))+#else+import Data.Monoid ((<>))+#endif+ #if __GLASGOW_HASKELL__ < 710 import Data.Monoid (Monoid(..)) import Data.Traversable (traverse)@@ -150,6 +155,17 @@ -- ^ TH.LangC by default } ++#if MIN_VERSION_base(4,9,0)+instance Semigroup Context where+ ctx2 <> ctx1 = Context+ { ctxTypesTable = ctxTypesTable ctx1 <> ctxTypesTable ctx2+ , ctxAntiQuoters = ctxAntiQuoters ctx1 <> ctxAntiQuoters ctx2+ , ctxOutput = ctxOutput ctx1 <|> ctxOutput ctx2+ , ctxForeignSrcLang = ctxForeignSrcLang ctx1 <|> ctxForeignSrcLang ctx2+ }+#endif+ instance Monoid Context where mempty = Context { ctxTypesTable = mempty@@ -158,12 +174,14 @@ , ctxForeignSrcLang = Nothing } +#if !MIN_VERSION_base(4,11,0) mappend ctx2 ctx1 = Context { ctxTypesTable = ctxTypesTable ctx1 <> ctxTypesTable ctx2 , ctxAntiQuoters = ctxAntiQuoters ctx1 <> ctxAntiQuoters ctx2 , ctxOutput = ctxOutput ctx1 <|> ctxOutput ctx2 , ctxForeignSrcLang = ctxForeignSrcLang ctx1 <|> ctxForeignSrcLang ctx2 }+#endif -- | Context useful to work with vanilla C. Used by default. --
src/Language/C/Types.hs view
@@ -65,11 +65,16 @@ import Control.Monad.State (execState, modify) import Data.List (partition) import Data.Maybe (fromMaybe)-import Data.Monoid ((<>)) import Data.Typeable (Typeable) import Text.PrettyPrint.ANSI.Leijen ((</>), (<+>)) import qualified Text.PrettyPrint.ANSI.Leijen as PP +#if MIN_VERSION_base(4,9,0)+import Data.Semigroup (Semigroup, (<>))+#else+import Data.Monoid ((<>))+#endif+ #if __GLASGOW_HASKELL__ < 710 import Data.Foldable (Foldable) import Data.Functor ((<$>))@@ -103,11 +108,19 @@ , functionSpecifiers :: [P.FunctionSpecifier] } deriving (Typeable, Show, Eq) +#if MIN_VERSION_base(4,9,0)+instance Semigroup Specifiers where+ Specifiers x1 y1 z1 <> Specifiers x2 y2 z2 =+ Specifiers (x1 ++ x2) (y1 ++ y2) (z1 ++ z2)+#endif+ instance Monoid Specifiers where mempty = Specifiers [] [] [] +#if !MIN_VERSION_base(4,11,0) mappend (Specifiers x1 y1 z1) (Specifiers x2 y2 z2) = Specifiers (x1 ++ x2) (y1 ++ y2) (z1 ++ z2)+#endif data Type i = TypeSpecifier Specifiers TypeSpecifier
test/Language/C/Types/ParseSpec.hs view
@@ -247,7 +247,7 @@ arbitrary = do modIds <- QC.listOf arbitraryModId id_ <- QC.oneof [arbitraryConId, arbitraryVarId]- if null modIds && HashSet.member id_ haskellReservedWords+ if HashSet.member id_ haskellReservedWords then QC.arbitrary else return $ fromString $ intercalate "." $ modIds ++ [id_] where