diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,3 +3,10 @@
 ## 0.1.0.0 - 2023-08-30
 
 First release.
+
+
+## 0.1.1.0 - 2023-09-18
+
+- New data type `IntegralResult` to store the result (value, error, code), instead of in a triplet.
+
+- Replaced `Double` with `CDouble` and `Int` with `CInt`.
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -1,13 +1,17 @@
 # numerical-integration
 
-One-dimensional numerical integration using the 'NumericalIntegration' C++ library.
+One-dimensional numerical integration using the 
+['NumericalIntegration'](https://github.com/tbs1980/NumericalIntegration) C++ library.
 
 ___
 
-***Example.*** Integrate x² between 0 and 1 with desired relative error 1e-10 and 
-using 200 subdivisions.
+***Example.*** Integrate x² between 0 and 1 with desired relative error 1e-5 and 
+using 200 subdivisions. Exact value: 1/3.
 
 ```haskell
-example :: IO (Double, Double, Int) -- value, error estimate, error code
-example = integration (\x -> x*x) 0 1 1e-10 200
+example :: IO IntegralResult -- value, error estimate, error code
+example = integration (\x -> x*x) 0 1 1e-5 200
+-- IntegralResult {_value = 0.3333333333333334, _error = 3.7007434154171895e-15, _code = 0}
 ```
+
+The error code 0 indicates the success.
diff --git a/cpp/integration.cpp b/cpp/integration.cpp
--- a/cpp/integration.cpp
+++ b/cpp/integration.cpp
@@ -16,7 +16,7 @@
 
  public:
   Integrand(std::function<double(double)>& f_) : f(f_) {}
-  double operator()(const double x) const { return f(x); }
+  double operator()(const double& x) const { return f(x); }
 };
 
 double integration(double f(double),
diff --git a/numerical-integration.cabal b/numerical-integration.cabal
--- a/numerical-integration.cabal
+++ b/numerical-integration.cabal
@@ -1,6 +1,6 @@
 cabal-version:       2.2
 name:                numerical-integration
-version:             0.1.0.2
+version:             0.1.1.0
 synopsis:            Numerical integration.
 description:         One-dimensional numerical integration using the 'NumericalIntegration' C++ library.
 homepage:            https://github.com/stla/numerical-integration#readme
diff --git a/src/Numerical/Integration.hs b/src/Numerical/Integration.hs
--- a/src/Numerical/Integration.hs
+++ b/src/Numerical/Integration.hs
@@ -1,34 +1,41 @@
 {-# LANGUAGE ForeignFunctionInterface #-}
 module Numerical.Integration
-  (integration)
+  (integration, IntegralResult(..))
   where
 import           Foreign.Marshal.Alloc (free, mallocBytes)
 import           Foreign.Ptr           (FunPtr, Ptr, freeHaskellFunPtr)
 import           Foreign.Storable      (peek, sizeOf)
+import           Foreign.C             (CDouble(..), CInt(..))               
 
+data IntegralResult = IntegralResult {
+  _value :: CDouble,
+  _error :: CDouble,
+  _code  :: Int
+} deriving Show
+
 foreign import ccall safe "wrapper" funPtr
-    :: (Double -> Double) -> IO(FunPtr (Double -> Double))
+    :: (CDouble -> CDouble) -> IO (FunPtr (CDouble -> CDouble))
 
 foreign import ccall safe "integration" c_integration
-    :: FunPtr (Double -> Double) -> Double -> Double -> Double -> Int
-    -> Ptr Double -> Ptr Int -> IO Double
+    :: FunPtr (CDouble -> CDouble) -> CDouble -> CDouble -> CDouble -> CInt
+    -> Ptr CDouble -> Ptr CInt -> IO CDouble
 
 -- | Numerical integration.
-integration :: (Double -> Double)       -- ^ integrand
-            -> Double                   -- ^ lower bound
-            -> Double                   -- ^ upper bound
-            -> Double                   -- ^ desired relative error
-            -> Int                      -- ^ number of subdivisions
-            -> IO (Double, Double, Int) -- ^ value, error estimate, error code
+integration :: (CDouble -> CDouble)       -- ^ integrand
+            -> CDouble                   -- ^ lower bound
+            -> CDouble                   -- ^ upper bound
+            -> CDouble                   -- ^ desired relative error
+            -> CInt                      -- ^ number of subdivisions
+            -> IO IntegralResult        -- ^ value, error estimate, error code
 integration f lower upper relError subdiv = do
-  errorEstimatePtr <- mallocBytes (sizeOf (0 :: Double))
-  errorCodePtr <- mallocBytes (sizeOf (0 :: Int))
+  errorEstimatePtr <- mallocBytes (sizeOf (0 :: CDouble))
+  errorCodePtr <- mallocBytes (sizeOf (0 :: CInt))
   fPtr <- funPtr f
   result <-
     c_integration fPtr lower upper relError subdiv errorEstimatePtr errorCodePtr
   errorEstimate <- peek errorEstimatePtr
-  errorCode <- peek errorCodePtr
-  let out = (result, errorEstimate, errorCode)
+  errorCode <- fromIntegral <$> peek errorCodePtr
+  let out = IntegralResult {_value = result, _error = errorEstimate, _code = errorCode}
   free errorEstimatePtr
   free errorCodePtr
   freeHaskellFunPtr fPtr
