Add ImpredicativeTypes everywhere to make mask (grr, exceptions) work with GHC 7.8.4

This commit is contained in:
Michael Walker 2015-02-16 02:50:52 +00:00
parent ad98bb6d90
commit f41a39e490
4 changed files with 9 additions and 4 deletions

View File

@ -1,4 +1,5 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}

View File

@ -1,4 +1,5 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}

View File

@ -1,4 +1,5 @@
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}

View File

@ -1,3 +1,5 @@
{-# LANGUAGE ImpredicativeTypes #-}
-- | Tests sourced from <https://github.com/sctbenchmarks>.
module Tests.Cases where
@ -148,27 +150,27 @@ threadKillUmask = do
-- | Test atomicity of STM.
stmAtomic :: MonadConc m => m Int
stmAtomic = do
x <- atomically $ newCTVar 0
x <- atomically $ newCTVar (0::Int)
atomically $ writeCTVar x 1 >> writeCTVar x 2
atomically $ readCTVar x
-- | Test STM retry
stmRetry :: MonadConc m => m Bool
stmRetry = do
x <- atomically $ newCTVar 0
x <- atomically $ newCTVar (0::Int)
fork . atomically $ writeCTVar x 1 >> retry
(==0) `liftM` atomically (readCTVar x)
-- | Test STM orElse
stmOrElse :: MonadConc m => m Bool
stmOrElse = do
x <- atomically $ newCTVar 0
x <- atomically $ newCTVar (0::Int)
atomically $ (writeCTVar x 1 >> retry) `orElse` writeCTVar x 2
(==2) `liftM` atomically (readCTVar x)
-- | Test STM exceptions
stmExc :: MonadConc m => m Bool
stmExc = do
x <- atomically $ newCTVar 0
x <- atomically $ newCTVar (0::Int)
atomically $ writeCTVar x 1 >> throwSTM Overflow
(==0) `liftM` atomically (readCTVar x)