Subject: Re: [commit: packages/stm] master: Refactor & update `stm.cabal` to `cabal-version>=1.10` (aa4774b)
From: Simon Marlow <[email-masked]>
To: [email-masked]
Date: Fri, 18 Oct 2013 13:06:13 +0200
Newsgroups: gmane.comp.lang.haskell.ghc.devel
List-Id: GHC development discussion <ghc-devs.haskell.org>

I'm not keen on losing the changelog from the description.  The idea of 
having the changelog in the description is:

   - it is prominent on the Hackage page for the package

   - it's next to the version in the .cabal file, so you're more likely
     to update it when updating the version.

I don't mind splitting it into two - maybe the first few entries in the 
description and the rest in a separate file, with a link from the 
description.

Cheers,
Simon

On 14/10/2013 22:38, git-4Dsf34iY/[email-masked] wrote:
> Repository : ssh://git-4Dsf34iY/[email-masked]/stm
>
> On branch  : master
> Link       : http://git.haskell.org/packages/stm.git/commitdiff/aa4774b7d5f65cbf007803ff54995921a36fbaeb
>
>> ---------------------------------------------------------------
>
> commit aa4774b7d5f65cbf007803ff54995921a36fbaeb
> Author: Herbert Valerio Riedel <hvr-mXXj517/[email-masked]>
> Date:   Mon Oct 14 22:02:35 2013 +0200
>
>      Refactor & update `stm.cabal` to `cabal-version>=1.10`
>
>      As the current code fails to build with GHC 6.10, I've updated the Cabal
>      meta-data to declare support for GHC>=6.12 and dropped support for
>      base3. This also moves the changelog from the Cabal description field
>      into a separate `changelog` file and adds a few entries.
>
>      The code compiles warning-free for all tested GHC versions.
>
>      Signed-off-by: Herbert Valerio Riedel <hvr-mXXj517/[email-masked]>
>
>
>> ---------------------------------------------------------------
>
> aa4774b7d5f65cbf007803ff54995921a36fbaeb
>   Control/Concurrent/STM/TVar.hs |    5 --
>   Control/Sequential/STM.hs      |   18 -------
>   changelog                      |   38 +++++++++++++++
>   stm.cabal                      |  103 ++++++++++++++++++----------------------
>   4 files changed, 83 insertions(+), 81 deletions(-)
>
> diff --git a/Control/Concurrent/STM/TVar.hs b/Control/Concurrent/STM/TVar.hs
> index d15896b..6435e17 100644
> --- a/Control/Concurrent/STM/TVar.hs
> +++ b/Control/Concurrent/STM/TVar.hs
> @@ -43,11 +43,6 @@ import GHC.Weak
>   import Control.Sequential.STM
>   #endif
>
> -#if ! (MIN_VERSION_base(4,2,0))
> -readTVarIO = atomically . readTVar
> -#endif
> -
> -
>   -- Like 'modifyIORef' but for 'TVar'.
>   -- | Mutate the contents of a 'TVar'. /N.B./, this version is
>   -- non-strict.
> diff --git a/Control/Sequential/STM.hs b/Control/Sequential/STM.hs
> index 468e7bd..a644e67 100644
> --- a/Control/Sequential/STM.hs
> +++ b/Control/Sequential/STM.hs
> @@ -40,35 +40,17 @@ instance Monad STM where
>   	x <- m r
>   	unSTM (k x) r
>
> -#ifdef BASE4
>   atomically :: STM a -> IO a
>   atomically (STM m) = do
>       r <- newIORef (return ())
>       m r `onException` do
>   	rollback <- readIORef r
>   	rollback
> -#else
> -atomically :: STM a -> IO a
> -atomically (STM m) = do
> -    r <- newIORef (return ())
> -    m r `catch` \ ex -> do
> -	rollback <- readIORef r
> -	rollback
> -	throw ex
> -#endif
>
> -#ifdef BASE4
>   throwSTM :: Exception e => e -> STM a
> -#else
> -throwSTM :: Exception -> STM a
> -#endif
>   throwSTM = STM . const . throwIO
>
> -#ifdef BASE4
>   catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a
> -#else
> -catchSTM :: STM a -> (Exception -> STM a) -> STM a
> -#endif
>   catchSTM (STM m) h = STM $ \ r -> do
>       old_rollback <- readIORef r
>       writeIORef r (return ())
> diff --git a/changelog b/changelog
> new file mode 100644
> index 0000000..1296a41
> --- /dev/null
> +++ b/changelog
> @@ -0,0 +1,38 @@
> +-*-changelog-*-
> +
> +2.4.2.1  Oct 2013
> +
> +	* Updated behaviour of `newBroadcastTChanIO` to match
> +	`newBroadcastTChan` in causing an error on a read from
> +	the broadcast channel
> +
> +	* Add `mkWeakTVar`
> +
> +	* Add `isFullTBQueue`
> +
> +	* Fix `TChan` created via `newBroadcastTChanIO` to throw same
> +	exception on a `readTChan` as when created via `newBroadcastTChan`
> +
> +2.4.2  Nov 2012
> +
> +	* Add "Control.Concurrent.STM.TSem" (transactional semaphore)
> +
> +	* Add Applicative/Alternative instances of STM for GHC <7.0
> +
> +        * Throw proper exception when `readTChan` called on a broadcast
> +	`TChan`
> +
> +2.4  Jul 2012
> +
> +	* Add "Control.Concurrent.STM.TQueue" (a faster `TChan`)
> +
> +	* Add "Control.Concurrent.STM.TBQueue" (a bounded channel based on
> +	`TQueue`)
> +
> +	* Add `Eq` instance for `TChan`
> +
> +	* Add `newBroadcastTChan` and `newBroadcastTChanIO`
> +
> +	* Some performance improvements for `TChan`
> +
> +	* Add `cloneTChan`
> diff --git a/stm.cabal b/stm.cabal
> index 568b8a3..998bb24 100644
> --- a/stm.cabal
> +++ b/stm.cabal
> @@ -1,68 +1,55 @@
> -name:		stm
> +name:           stm
>   version:        2.4.2.1
> -license:	BSD3
> -license-file:	LICENSE
> -maintainer:	[email-masked]
> -synopsis:	Software Transactional Memory
> +license:        BSD3
> +license-file:   LICENSE
> +maintainer:     [email-masked]
> +bug-reports:    http://ghc.haskell.org/trac/ghc/newticket?component=libraries%20%28other%29&keywords=stm
> +synopsis:       Software Transactional Memory
>   category:       Concurrency
> -description:
> - A modular composable concurrency abstraction.
> - .
> - Changes in version 2.4.2.1
> - .
> - * Updated behaviour of @newBroadcastTChanIO@ to match
> -   @newBroadcastTChan@ in causing an error on a read from
> -   the broadcast channel.
> - .
> - Changes in version 2.4.2
> - .
> - * Added "Control.Concurrent.STM.TSem" (transactional semaphore)
> - .
> - Changes in version 2.4.1
> - .
> - * Added Applicative/Alternative instances of STM for GHC <7.0
> - .
> - Changes in version 2.4
> - .
> - * Added "Control.Concurrent.STM.TQueue" (a faster @TChan@)
> - .
> - * Added "Control.Concurrent.STM.TBQueue" (a bounded channel based on @TQueue@)
> - .
> - * @TChan@ has an @Eq@ instances
> - .
> - * Added @newBroadcastTChan@ and @newBroadcastTChanIO@
> - .
> - * Some performance improvements for @TChan@
> - .
> - * Added @cloneTChan@
> -
> +description:    A modular composable concurrency abstraction.
>   build-type:     Simple
> -cabal-version:  >=1.6
> +cabal-version:  >=1.10
> +tested-with:    GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1, GHC==6.12.3
> +
> +extra-source-files:
> +    changelog
>
>   source-repository head
>       type:     git
>       location: http://git.haskell.org/packages/stm.git
>
> -flag base4
> +source-repository this
> +    type:     git
> +    location: http://git.haskell.org/packages/stm.git
> +    tag:      stm-2.4.2.1-release
>
>   library
> -  exposed-modules:
> -    Control.Concurrent.STM
> -    Control.Concurrent.STM.TArray
> -    Control.Concurrent.STM.TVar
> -    Control.Concurrent.STM.TChan
> -    Control.Concurrent.STM.TMVar
> -    Control.Concurrent.STM.TQueue
> -    Control.Concurrent.STM.TBQueue
> -    Control.Concurrent.STM.TSem
> -    Control.Monad.STM
> -  other-modules:
> -    Control.Sequential.STM
> -  build-depends: base < 5, array
> -  if flag(base4)
> -    build-depends: base >=4
> -    cpp-options:   -DBASE4
> -  else
> -    build-depends: base <4
> -  if impl(ghc >= 6.10)
> -    build-depends: base >=4
> +    default-language: Haskell98
> +    other-extensions:
> +        CPP
> +        DeriveDataTypeable
> +        FlexibleInstances
> +        MagicHash
> +        MultiParamTypeClasses
> +        UnboxedTuples
> +    if impl(ghc >= 7.2)
> +        other-extensions: Trustworthy
> +
> +    build-depends:
> +        base  >= 4.2 && < 4.8,
> +        array >= 0.3 && < 0.6
> +
> +    exposed-modules:
> +        Control.Concurrent.STM
> +        Control.Concurrent.STM.TArray
> +        Control.Concurrent.STM.TVar
> +        Control.Concurrent.STM.TChan
> +        Control.Concurrent.STM.TMVar
> +        Control.Concurrent.STM.TQueue
> +        Control.Concurrent.STM.TBQueue
> +        Control.Concurrent.STM.TSem
> +        Control.Monad.STM
> +    other-modules:
> +        Control.Sequential.STM
> +
> +    ghc-options: -Wall
> \ No newline at end of file
>
> _______________________________________________
> ghc-commits mailing list
> [email-masked]
> http://www.haskell.org/mailman/listinfo/ghc-commits
>