compiler change

Christian Maeder maeder at tzi.de
Thu Sep 21 04:55:45 EDT 2006


I have to port the following piece of code to ghc-6.6:

[...]
addSimpleFallOut :: IO a -> IO (Either String a)
simpleFallOutId :: ObjectID
(simpleFallOutId, addSimpleFallOut) = mkSimpleFallOut

mkSimpleFallOut :: (ObjectID,IO a -> IO (Either String a))
mkSimpleFallOut = unsafePerformIO newFallOut
{-# NOINLINE mkSimpleFallOut #-}

newFallOut :: IO (ObjectID, IO a -> IO (Either String a))
[...]

ghc-6.5.20060919 reports:
    Couldn't match expected type `forall a.
                                  IO a -> IO (Either String a)'
           against inferred type `IO a -> IO (Either String a)'
      Expected type: (ObjectID,
                      forall a1. IO a1 -> IO (Either String a1))
      Inferred type: (ObjectID, IO a -> IO (Either String a))
    In the expression: mkSimpleFallOut
    In a pattern binding:
        (simpleFallOutId, addSimpleFallOut) = mkSimpleFallOut

I can make the code compile by rewriting the pair as:

simpleFallOutId = fst mkSimpleFallOut
addSimpleFallOut = snd mkSimpleFallOut

However, in this case I have inlined mkSimpleFallOut manually! Does this
matter? If so, how could I rewrite the above code?

Cheers Christian



More information about the Glasgow-haskell-users mailing list