Allow enabling the servant build flag with older versions of stm

Allowing building with ghc 9.0.2 (debian stable).

Updated patch covering all uses of writeTMVar.
This commit is contained in:
Joey Hess 2024-10-17 20:55:31 -04:00
parent facde8bf85
commit b83fdf66df
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 27 additions and 8 deletions

23
Utility/STM.hs Normal file
View file

@ -0,0 +1,23 @@
{- support for old versions of the stm package
-
- Copyright 2024 Joey Hess <id@joeyh.name>
-
- License: BSD-2-clause
-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-tabs #-}
module Utility.STM (
module Control.Concurrent.STM,
#if ! MIN_VERSION_stm(2,5,1)
writeTMVar
#endif
) where
import Control.Concurrent.STM
#if ! MIN_VERSION_stm(2,5,1)
writeTMVar :: TMVar t -> t -> STM ()
writeTMVar t new = tryTakeTMVar t >> putTMVar t new
#endif