{-# LANGUAGE DeriveDataTypeable #-} module MLP.Error where import Foreign.C.Types import Data.Typeable import Control.Exception import qualified MLP toCInt :: MLP.Error -> CInt toCInt MLP.NOT_SUPPORTED = (-1000) toCInt MLP.NOT_IMPLEMENTED = (-1001) toCInt MLP.OK = 0 toCInt MLP.INTERNAL_ERROR = 1 toCInt MLP.RUNTIME_ERROR = 2 toCInt MLP.LIBRARY_ERROR = 3 fromCInt :: CInt -> MLP.Error fromCInt (-1000) = MLP.NOT_SUPPORTED fromCInt (-1001) = MLP.NOT_IMPLEMENTED fromCInt 0 = MLP.OK fromCInt 1 = MLP.INTERNAL_ERROR fromCInt 2 = MLP.RUNTIME_ERROR fromCInt 3 = MLP.LIBRARY_ERROR