   (MkRank x) * (MkRank y) = MkRank (x*y)
   abs (MkRank x) = MkRank (abs x)
   signum (MkRank x) = MkRank (signum x)
-  fromInteger x 
-    | x > ( fromIntegral (maxBound :: CInt)) = error "Rank value does not fit into 32 bits" 
+  fromInteger x
+    | x > ( fromIntegral (maxBound :: CInt)) = error "Rank value does not fit into 32 bits"
     | x < 0             = error "Negative Rank value"
     | otherwise         = MkRank (fromIntegral x)
 


{# enum ThreadSupport {underscoreToCase} deriving (Eq,Ord,Show) #}

{- From MPI 2.2 report:
 "To make it possible for an application to interpret an error code, the routine
 MPI_ERROR_CLASS converts any error code into one of a small set of standard
 error codes"
-}

data MPIError
   = MPIError
     { mpiErrorClass :: ErrorClass
     , mpiErrorString :: String
     , mpiErrorCode :: CInt
     }
   deriving (Eq, Show, Typeable)


   let errClass = cToEnum errClassRaw
   unless (errClass == Success) $ do
      errStr <- errorString code
      throwIO $ MPIError errClass errStr

-- | Convert MPI error code human-readable error description. Corresponds to @MPI_Error_string@.
errorString :: CInt -> IO String
errorString code =
  allocaBytes (fromIntegral maxErrorString) $ \ptr ->
