summaryrefslogtreecommitdiff
path: root/testsuite/tests/rep-poly/T21239.hs
blob: 9ca1961114e5b77e815c9551650d8c20eabd2313 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}

module T21239 where

import GHC.Exts

-- This test goes wrong if we don't properly decompose
-- when unifying ConcreteTv metavariables.

atomicModifyMutVar#
  :: MutVar# s a
  -> (a -> b)
  -> State# s
  -> (# State# s, c #)
atomicModifyMutVar# mv f s =
  case unsafeCoerce# (atomicModifyMutVar2# mv f s) of
    (# s', _, ~(_, res) #) -> (# s', res #)