packages feed

hoppy-generator 0.5.0 → 0.5.1

raw patch · 4 files changed

+39/−12 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Foreign.Hoppy.Generator.Language.Haskell: instance GHC.Base.Semigroup Foreign.Hoppy.Generator.Language.Haskell.Output

Files

hoppy-generator.cabal view
@@ -1,5 +1,5 @@ name: hoppy-generator-version: 0.5.0+version: 0.5.1 synopsis: C++ FFI generator - Code generator homepage: http://khumba.net/projects/hoppy license: AGPL-3
src/Foreign/Hoppy/Generator/Language/Haskell.hs view
@@ -130,6 +130,7 @@ #if !MIN_VERSION_base(4,8,0) import Data.Monoid (Monoid, mappend, mconcat, mempty) #endif+import Data.Semigroup as Sem import qualified Data.Set as S import Data.Tuple (swap) import Foreign.Hoppy.Generator.Common@@ -339,11 +340,14 @@     -- whole module.   } +instance Sem.Semigroup Output where+  (Output e i b x) <> (Output e' i' b' x') =+    Output (e <> e') (i <> i') (b <> b') (x <> x')+ instance Monoid Output where   mempty = Output mempty mempty mempty mempty -  (Output e i b x) `mappend` (Output e' i' b' x') =-    Output (e `mappend` e') (i `mappend` i') (b `mappend` b') (x `mappend` x')+  mappend = (<>)    mconcat os =     Output (mconcat $ map outputExports os)
src/Foreign/Hoppy/Generator/Language/Haskell/Internal.hs view
@@ -155,12 +155,22 @@   -- GeneralizedNewtypeDeriving is to enable automatic deriving of   -- Data.Bits.Bits instances for bitspace newtypes.   concat-  [ "{-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving"-  , ", MultiParamTypeClasses, ScopedTypeVariables, TypeSynonymInstances, UndecidableInstances #-}\n"+  [ concat $ "{-# LANGUAGE " : intersperse ", " extensions ++ [" #-}\n"]   , "#if !MIN_VERSION_base(4,8,0)\n"   , "{-# LANGUAGE OverlappingInstances #-}\n"   , "#endif\n\n"   ]+  where extensions =+          [ "CPP"+          , "FlexibleContexts"+          , "FlexibleInstances"+          , "ForeignFunctionInterface"+          , "GeneralizedNewtypeDeriving"+          , "MultiParamTypeClasses"+          , "ScopedTypeVariables"+          , "TypeSynonymInstances"+          , "UndecidableInstances"+          ]  generateSource :: Module -> Generator () generateSource m = do
src/Foreign/Hoppy/Generator/Spec/Base.hs view
@@ -218,6 +218,7 @@ #if !MIN_VERSION_base(4,8,0) import Data.Monoid (Monoid, mappend, mconcat, mempty) #endif+import Data.Semigroup as Sem import qualified Data.Set as S import Foreign.Hoppy.Generator.Common import {-# SOURCE #-} qualified Foreign.Hoppy.Generator.Language.Haskell as Haskell@@ -581,10 +582,13 @@     -- ^ The includes specified by a 'Reqs'.   } deriving (Show) +instance Sem.Semigroup Reqs where+  (<>) (Reqs incl) (Reqs incl') = Reqs $ mappend incl incl'+ instance Monoid Reqs where   mempty = Reqs mempty -  mappend (Reqs incl) (Reqs incl') = Reqs $ mappend incl incl'+  mappend = (<>)    mconcat reqs = Reqs $ mconcat $ map reqsIncludes reqs @@ -636,7 +640,7 @@ newtype ExtName = ExtName   { fromExtName :: String     -- ^ Returns the string an an 'ExtName' contains.-  } deriving (Eq, Monoid, Ord)+  } deriving (Eq, Sem.Semigroup, Monoid, Ord)  instance Show ExtName where   show extName = concat ["$\"", fromExtName extName, "\"$"]@@ -2290,11 +2294,14 @@     -- ^ Extracts the list of exception handlers.   } +instance Sem.Semigroup ExceptionHandlers where+  (<>) e1 e2 =+    ExceptionHandlers $ exceptionHandlersList e1 ++ exceptionHandlersList e2+ instance Monoid ExceptionHandlers where   mempty = ExceptionHandlers [] -  mappend e1 e2 =-    ExceptionHandlers $ exceptionHandlersList e1 ++ exceptionHandlersList e2+  mappend = (<>)  -- | Types that can handle exceptions. class HandlesExceptions a where@@ -2318,9 +2325,12 @@     -- exports.   } +instance Sem.Semigroup Addendum where+  (<>) (Addendum a) (Addendum b) = Addendum $ a >> b+ instance Monoid Addendum where   mempty = Addendum $ return ()-  mappend (Addendum a) (Addendum b) = Addendum $ a >> b+  mappend = (<>)  -- | A typeclass for types that have an addendum. class HasAddendum a where@@ -2357,11 +2367,14 @@     -- bindings.   } deriving (Show) +instance Sem.Semigroup HsImportSet where+  (<>) (HsImportSet m) (HsImportSet m') =+    HsImportSet $ M.unionWith mergeImportSpecs m m'+ instance Monoid HsImportSet where   mempty = HsImportSet M.empty -  mappend (HsImportSet m) (HsImportSet m') =-    HsImportSet $ M.unionWith mergeImportSpecs m m'+  mappend = (<>)    mconcat sets =     HsImportSet $ M.unionsWith mergeImportSpecs $ map getHsImportSet sets