never executed always true always false
    1 -- GENERATED by C->Haskell Compiler, version 0.28.8 Switcheroo, 25 November 2017 (Haskell)
    2 -- Edit the ORIGNAL .chs file instead!
    3 
    4 
    5 module QuantLib.Commodity
    6   (
    7     -- * Types
    8     -- ** Commodity types
    9     CommodityType
   10     -- ** Units of measure
   11   , UnitOfMeasure
   12   , UnitOfMeasureType(..)
   13     -- ** Payment terms
   14   , PaymentTerm
   15   , PaymentTermEventType(..)
   16     -- ** Quantities and costs
   17   , Quantity
   18   , CommodityUnitCost
   19     -- ** Date intervals and pricing periods
   20   , DateInterval
   21   , PricingPeriod
   22   , PricingPeriods
   23     -- ** Unit conversions
   24   , UnitOfMeasureConversion
   25   , UnitOfMeasureConversionType(..)
   26 
   27     -- * Constructors
   28     -- ** Commodity metadata
   29   , commodityType
   30   , nullCommodityType
   31   , unitOfMeasure
   32   , lotUnitOfMeasure
   33   , barrelUnitOfMeasure
   34   , mtUnitOfMeasure
   35   , mbUnitOfMeasure
   36   , gallonUnitOfMeasure
   37   , litreUnitOfMeasure
   38   , kilolitreUnitOfMeasure
   39   , tokyoKilolitreUnitOfMeasure
   40   , paymentTerm
   41   , pricingPeriod
   42   , unitOfMeasureConversion
   43 
   44     -- * Mutators
   45     -- ** Conversion repository
   46   , addUomConversion
   47   , clearUomConversions
   48     -- ** Global commodity settings
   49   , setCommoditySettingsCurrency
   50   , setCommoditySettingsUnitOfMeasure
   51 
   52     -- * Inspectors
   53     -- ** Quantity, period and conversion calculations
   54   , roundedQuantity
   55   , closeQuantity
   56   , closeEnoughQuantity
   57   , isDateBetween
   58   , intersection
   59   , convertQuantity
   60   , chainUnitOfMeasureConversion
   61     -- ** Commodity metadata
   62   , commodityTypeCode
   63   , commodityTypeName
   64   , commodityTypeEmpty
   65   , unitOfMeasureName
   66   , unitOfMeasureCode
   67   , unitOfMeasureType
   68   , unitOfMeasureEmpty
   69   , paymentTermName
   70   , paymentTermEventType
   71   , paymentTermOffsetDays
   72   , paymentTermCalendar
   73   , paymentTermEmpty
   74   , paymentTermGetPaymentDate
   75     -- ** Pricing periods and conversions
   76   , pricingPeriodStartDate
   77   , pricingPeriodEndDate
   78   , pricingPeriodPaymentDate
   79   , pricingPeriodQuantity
   80   , unitOfMeasureConversionSource
   81   , unitOfMeasureConversionTarget
   82   , unitOfMeasureConversionCommodityType
   83   , unitOfMeasureConversionType
   84   , unitOfMeasureConversionFactor
   85   , unitOfMeasureConversionCode
   86   , lookupUomConversion
   87     -- ** Global commodity settings
   88   , commoditySettingsCurrency
   89   , commoditySettingsUnitOfMeasure
   90   ) where
   91 import qualified Foreign.C.String as C2HSImp
   92 import qualified Foreign.C.Types as C2HSImp
   93 import qualified Foreign.ForeignPtr as C2HSImp
   94 import qualified Foreign.Marshal.Utils as C2HSImp
   95 import qualified Foreign.Ptr as C2HSImp
   96 import qualified System.IO.Unsafe as C2HSImp
   97 
   98 
   99 import Control.Exception (mask_)
  100 import System.IO.Unsafe (unsafePerformIO)
  101 import QuantLib.Internal
  102 import QuantLib.Internal.Type
  103 import QuantLib.Internal.Common
  104 import Foreign.Marshal.Alloc(alloca)
  105 
  106 
  107 
  108 
  109 
  110 
  111 
  112 
  113 
  114 
  115 
  116 
  117 
  118 
  119 
  120 
  121 
  122 
  123 
  124 
  125 data UnitOfMeasureConversionType = UomDirect
  126                                  | UomDerived
  127   deriving (Enum,Show,Eq,Read)
  128 
  129 
  130 
  131 -- |Construct a custom commodity type identified by its code (e.g. \"HO\") and descriptive name
  132 -- (e.g. \"Heating Oil\"). QuantLib has no fixed enum of commodity types -- every instance is
  133 -- user-registered by code, the same way a custom 'QuantLib.Currency.customCurrency' is.
  134 commodityType :: (String) -- ^code
  135  -> (String) -- ^name
  136  -> IO ((CommodityType))
  137 commodityType a1 a2 =
  138   C2HSImp.withCString a1 $ \a1' -> 
  139   C2HSImp.withCString a2 $ \a2' -> 
  140   preErrorCheck $ \a3' -> 
  141   commodityType'_ a1' a2' a3' >>= \res ->
  142   peekCommodityType res >>= \res' ->
  143   errorCheck  a3'>>
  144   return (res')
  145 
  146 
  147 
  148 -- |The fixed placeholder commodity type QuantLib itself uses where no real commodity type
  149 -- applies (e.g. in unit-of-measure-only conversions).
  150 nullCommodityType :: IO ((CommodityType))
  151 nullCommodityType =
  152   preErrorCheck $ \a1' -> 
  153   nullCommodityType'_ a1' >>= \res ->
  154   peekCommodityType res >>= \res' ->
  155   errorCheck  a1'>>
  156   return (res')
  157 
  158 
  159 
  160 -- |The commodity code, e.g. \"HO\".
  161 commodityTypeCode :: CommodityType -> String
  162 commodityTypeCode x = unsafePerformIO $ mask_ (commodityTypeCodeRaw x)
  163 commodityTypeCodeRaw :: (CommodityType) -> IO ((String))
  164 commodityTypeCodeRaw a1 =
  165   withCommodityType a1 $ \a1' -> 
  166   commodityTypeCodeRaw'_ a1' >>= \res ->
  167   peekDynString res >>= \res' ->
  168   return (res')
  169 
  170 
  171 
  172 -- |The descriptive name, e.g. \"Heating Oil\".
  173 commodityTypeName :: CommodityType -> String
  174 commodityTypeName x = unsafePerformIO $ mask_ (commodityTypeNameRaw x)
  175 commodityTypeNameRaw :: (CommodityType) -> IO ((String))
  176 commodityTypeNameRaw a1 =
  177   withCommodityType a1 $ \a1' -> 
  178   commodityTypeNameRaw'_ a1' >>= \res ->
  179   peekDynString res >>= \res' ->
  180   return (res')
  181 
  182 
  183 
  184 -- |Whether this is a usable instance (as opposed to one built via a default constructor).
  185 commodityTypeEmpty :: (CommodityType) -> (Bool)
  186 commodityTypeEmpty a1 =
  187   C2HSImp.unsafePerformIO $
  188   withCommodityType a1 $ \a1' -> 
  189   commodityTypeEmpty'_ a1' >>= \res ->
  190   let {res' = C2HSImp.toBool res} in
  191   return (res')
  192 
  193 
  194 
  195 -- |Construct a custom unit of measure from its descriptive name (e.g. \"Barrels\"), code (e.g.
  196 -- \"BBL\"), and type (mass/volume/energy/quantity).
  197 unitOfMeasure :: (String) -- ^name
  198  -> (String) -- ^code
  199  -> (UnitOfMeasureType) -> IO ((UnitOfMeasure))
  200 unitOfMeasure a1 a2 a3 =
  201   C2HSImp.withCString a1 $ \a1' -> 
  202   C2HSImp.withCString a2 $ \a2' -> 
  203   let {a3' = fromEnumC a3} in 
  204   preErrorCheck $ \a4' -> 
  205   unitOfMeasure'_ a1' a2' a3' a4' >>= \res ->
  206   peekUnitOfMeasure res >>= \res' ->
  207   errorCheck  a4'>>
  208   return (res')
  209 
  210 
  211 
  212 -- |The descriptive name, e.g. \"Barrels\".
  213 unitOfMeasureName :: UnitOfMeasure -> String
  214 unitOfMeasureName x = unsafePerformIO $ mask_ (unitOfMeasureNameRaw x)
  215 unitOfMeasureNameRaw :: (UnitOfMeasure) -> IO ((String))
  216 unitOfMeasureNameRaw a1 =
  217   withUnitOfMeasure a1 $ \a1' -> 
  218   unitOfMeasureNameRaw'_ a1' >>= \res ->
  219   peekDynString res >>= \res' ->
  220   return (res')
  221 
  222 
  223 
  224 -- |The code, e.g. \"BBL\", \"MT\".
  225 unitOfMeasureCode :: UnitOfMeasure -> String
  226 unitOfMeasureCode x = unsafePerformIO $ mask_ (unitOfMeasureCodeRaw x)
  227 unitOfMeasureCodeRaw :: (UnitOfMeasure) -> IO ((String))
  228 unitOfMeasureCodeRaw a1 =
  229   withUnitOfMeasure a1 $ \a1' -> 
  230   unitOfMeasureCodeRaw'_ a1' >>= \res ->
  231   peekDynString res >>= \res' ->
  232   return (res')
  233 
  234 
  235 
  236 -- |The unit's type (mass/volume/energy/quantity).
  237 unitOfMeasureType :: (UnitOfMeasure) -> (UnitOfMeasureType)
  238 unitOfMeasureType a1 =
  239   C2HSImp.unsafePerformIO $
  240   withUnitOfMeasure a1 $ \a1' -> 
  241   unitOfMeasureType'_ a1' >>= \res ->
  242   let {res' = toEnumC res} in
  243   return (res')
  244 
  245 
  246 
  247 -- |Whether this is a usable instance (as opposed to one built via a default constructor).
  248 unitOfMeasureEmpty :: (UnitOfMeasure) -> (Bool)
  249 unitOfMeasureEmpty a1 =
  250   C2HSImp.unsafePerformIO $
  251   withUnitOfMeasure a1 $ \a1' -> 
  252   unitOfMeasureEmpty'_ a1' >>= \res ->
  253   let {res' = C2HSImp.toBool res} in
  254   return (res')
  255 
  256 
  257 
  258 -- |The lot, a dimensionless 'UnitOfMeasure::Quantity' unit.
  259 lotUnitOfMeasure :: IO ((UnitOfMeasure))
  260 lotUnitOfMeasure =
  261   preErrorCheck $ \a1' -> 
  262   lotUnitOfMeasure'_ a1' >>= \res ->
  263   peekUnitOfMeasure res >>= \res' ->
  264   errorCheck  a1'>>
  265   return (res')
  266 
  267 
  268 
  269 -- |Barrels (BBL), the base petroleum volume unit.
  270 barrelUnitOfMeasure :: IO ((UnitOfMeasure))
  271 barrelUnitOfMeasure =
  272   preErrorCheck $ \a1' -> 
  273   barrelUnitOfMeasure'_ a1' >>= \res ->
  274   peekUnitOfMeasure res >>= \res' ->
  275   errorCheck  a1'>>
  276   return (res')
  277 
  278 
  279 
  280 -- |Metric tonnes (MT).
  281 mtUnitOfMeasure :: IO ((UnitOfMeasure))
  282 mtUnitOfMeasure =
  283   preErrorCheck $ \a1' -> 
  284   mtUnitOfMeasure'_ a1' >>= \res ->
  285   peekUnitOfMeasure res >>= \res' ->
  286   errorCheck  a1'>>
  287   return (res')
  288 
  289 
  290 
  291 -- |Thousand barrels (MB).
  292 mbUnitOfMeasure :: IO ((UnitOfMeasure))
  293 mbUnitOfMeasure =
  294   preErrorCheck $ \a1' -> 
  295   mbUnitOfMeasure'_ a1' >>= \res ->
  296   peekUnitOfMeasure res >>= \res' ->
  297   errorCheck  a1'>>
  298   return (res')
  299 
  300 
  301 
  302 -- |US gallons.
  303 gallonUnitOfMeasure :: IO ((UnitOfMeasure))
  304 gallonUnitOfMeasure =
  305   preErrorCheck $ \a1' -> 
  306   gallonUnitOfMeasure'_ a1' >>= \res ->
  307   peekUnitOfMeasure res >>= \res' ->
  308   errorCheck  a1'>>
  309   return (res')
  310 
  311 
  312 
  313 -- |Litres.
  314 litreUnitOfMeasure :: IO ((UnitOfMeasure))
  315 litreUnitOfMeasure =
  316   preErrorCheck $ \a1' -> 
  317   litreUnitOfMeasure'_ a1' >>= \res ->
  318   peekUnitOfMeasure res >>= \res' ->
  319   errorCheck  a1'>>
  320   return (res')
  321 
  322 
  323 
  324 -- |Kilolitres.
  325 kilolitreUnitOfMeasure :: IO ((UnitOfMeasure))
  326 kilolitreUnitOfMeasure =
  327   preErrorCheck $ \a1' -> 
  328   kilolitreUnitOfMeasure'_ a1' >>= \res ->
  329   peekUnitOfMeasure res >>= \res' ->
  330   errorCheck  a1'>>
  331   return (res')
  332 
  333 
  334 
  335 -- |Tokyo kilolitres.
  336 tokyoKilolitreUnitOfMeasure :: IO ((UnitOfMeasure))
  337 tokyoKilolitreUnitOfMeasure =
  338   preErrorCheck $ \a1' -> 
  339   tokyoKilolitreUnitOfMeasure'_ a1' >>= \res ->
  340   peekUnitOfMeasure res >>= \res' ->
  341   errorCheck  a1'>>
  342   return (res')
  343 
  344 
  345 
  346 -- |Construct a payment term: a named offset (in calendar-adjusted days) from either the trade
  347 -- date or the pricing-period end date.
  348 paymentTerm :: (String) -- ^name
  349  -> (PaymentTermEventType) -> (Int) -- ^offsetDays
  350  -> (Calendar) -> IO ((PaymentTerm))
  351 paymentTerm a1 a2 a3 a4 =
  352   C2HSImp.withCString a1 $ \a1' -> 
  353   let {a2' = fromEnumC a2} in 
  354   let {a3' = fromIntegral a3} in 
  355   withCalendar a4 $ \a4' -> 
  356   preErrorCheck $ \a5' -> 
  357   paymentTerm'_ a1' a2' a3' a4' a5' >>= \res ->
  358   peekPaymentTerm res >>= \res' ->
  359   errorCheck  a5'>>
  360   return (res')
  361 
  362 
  363 
  364 -- |The payment term's name, e.g. \"Pricing end + 5 days\".
  365 paymentTermName :: PaymentTerm -> String
  366 paymentTermName x = unsafePerformIO $ mask_ (paymentTermNameRaw x)
  367 paymentTermNameRaw :: (PaymentTerm) -> IO ((String))
  368 paymentTermNameRaw a1 =
  369   withPaymentTerm a1 $ \a1' -> 
  370   paymentTermNameRaw'_ a1' >>= \res ->
  371   peekDynString res >>= \res' ->
  372   return (res')
  373 
  374 
  375 
  376 -- |Whether the offset is measured from the trade date or the pricing date.
  377 paymentTermEventType :: (PaymentTerm) -> (PaymentTermEventType)
  378 paymentTermEventType a1 =
  379   C2HSImp.unsafePerformIO $
  380   withPaymentTerm a1 $ \a1' -> 
  381   paymentTermEventType'_ a1' >>= \res ->
  382   let {res' = toEnumC res} in
  383   return (res')
  384 
  385 
  386 
  387 -- |The number of (calendar-adjusted) offset days.
  388 paymentTermOffsetDays :: (PaymentTerm) -> (Int)
  389 paymentTermOffsetDays a1 =
  390   C2HSImp.unsafePerformIO $
  391   withPaymentTerm a1 $ \a1' -> 
  392   paymentTermOffsetDays'_ a1' >>= \res ->
  393   let {res' = fromIntegral res} in
  394   return (res')
  395 
  396 
  397 
  398 -- |The calendar used to adjust the payment date.
  399 paymentTermCalendar :: (PaymentTerm) -> IO ((Calendar))
  400 paymentTermCalendar a1 =
  401   withPaymentTerm a1 $ \a1' -> 
  402   preErrorCheck $ \a2' -> 
  403   paymentTermCalendar'_ a1' a2' >>= \res ->
  404   peekCalendar res >>= \res' ->
  405   errorCheck  a2'>>
  406   return (res')
  407 
  408 
  409 
  410 -- |Whether this is a usable instance (as opposed to one built via a default constructor).
  411 paymentTermEmpty :: (PaymentTerm) -> (Bool)
  412 paymentTermEmpty a1 =
  413   C2HSImp.unsafePerformIO $
  414   withPaymentTerm a1 $ \a1' -> 
  415   paymentTermEmpty'_ a1' >>= \res ->
  416   let {res' = C2HSImp.toBool res} in
  417   return (res')
  418 
  419 
  420 
  421 -- |Applies the term's offset (and calendar adjustment) to a trade or pricing-period-end date to
  422 -- get the actual payment date.
  423 paymentTermGetPaymentDate :: (PaymentTerm) -> (Day) -> IO ((Day))
  424 paymentTermGetPaymentDate a1 a2 =
  425   withPaymentTerm a1 $ \a1' -> 
  426   withDay a2 $ \a2' -> 
  427   preErrorCheck $ \a3' -> 
  428   paymentTermGetPaymentDate'_ a1' a2' a3' >>= \res ->
  429   let {res' = toDay res} in
  430   errorCheck  a3'>>
  431   return (res')
  432 
  433 
  434 
  435 -- |A commodity type, unit of measure, and amount. Its FFI arguments are flat because c2hs's
  436 -- @&@ tuple-splitter supports only pairs.
  437 type Quantity = (CommodityType, UnitOfMeasure, Double)
  438 
  439 quantityRoundedAmount :: (UnitOfMeasure) -> (Double) -> (Double)
  440 quantityRoundedAmount a1 a2 =
  441   C2HSImp.unsafePerformIO $
  442   withUnitOfMeasure a1 $ \a1' -> 
  443   let {a2' = realToFrac a2} in 
  444   quantityRoundedAmount'_ a1' a2' >>= \res ->
  445   let {res' = realToFrac res} in
  446   return (res')
  447 
  448 
  449 
  450 -- |Round a quantity's amount per its unit of measure's rounding convention. The commodity type and
  451 -- unit of measure are unaffected by rounding, so they're carried straight through in Haskell
  452 -- rather than round-tripped through the C++ call.
  453 roundedQuantity :: Quantity -> Quantity
  454 roundedQuantity (ct, uom, amount) = (ct, uom, quantityRoundedAmount uom amount)
  455 
  456 qlQuantityClose_ :: (CommodityType) -> (UnitOfMeasure) -> (Double) -> (CommodityType) -> (UnitOfMeasure) -> (Double) -> (Int) -> IO ((Bool))
  457 qlQuantityClose_ a1 a2 a3 a4 a5 a6 a7 =
  458   withCommodityType a1 $ \a1' -> 
  459   withUnitOfMeasure a2 $ \a2' -> 
  460   let {a3' = realToFrac a3} in 
  461   withCommodityType a4 $ \a4' -> 
  462   withUnitOfMeasure a5 $ \a5' -> 
  463   let {a6' = realToFrac a6} in 
  464   let {a7' = fromIntegral a7} in 
  465   preErrorCheck $ \a8' -> 
  466   qlQuantityClose_'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  467   let {res' = C2HSImp.toBool res} in
  468   errorCheck  a8'>>
  469   return (res')
  470 
  471 
  472 
  473 -- |Whether two quantities are close to within @n@ ULPs (default 42 upstream), after converting
  474 -- the second to the first's unit of measure if their units differ (which throws unless a
  475 -- conversion is reachable -- see 'lookupUomConversion').
  476 closeQuantity :: Quantity -> Quantity -> Int -> IO Bool
  477 closeQuantity (ct1, uom1, amt1) (ct2, uom2, amt2) n = qlQuantityClose_ ct1 uom1 amt1 ct2 uom2 amt2 n
  478 
  479 qlQuantityCloseEnough_ :: (CommodityType) -> (UnitOfMeasure) -> (Double) -> (CommodityType) -> (UnitOfMeasure) -> (Double) -> (Int) -> IO ((Bool))
  480 qlQuantityCloseEnough_ a1 a2 a3 a4 a5 a6 a7 =
  481   withCommodityType a1 $ \a1' -> 
  482   withUnitOfMeasure a2 $ \a2' -> 
  483   let {a3' = realToFrac a3} in 
  484   withCommodityType a4 $ \a4' -> 
  485   withUnitOfMeasure a5 $ \a5' -> 
  486   let {a6' = realToFrac a6} in 
  487   let {a7' = fromIntegral a7} in 
  488   preErrorCheck $ \a8' -> 
  489   qlQuantityCloseEnough_'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  490   let {res' = C2HSImp.toBool res} in
  491   errorCheck  a8'>>
  492   return (res')
  493 
  494 
  495 
  496 -- |As 'closeQuantity', but using QuantLib's relative (rather than absolute) closeness test.
  497 closeEnoughQuantity :: Quantity -> Quantity -> Int -> IO Bool
  498 closeEnoughQuantity (ct1, uom1, amt1) (ct2, uom2, amt2) n = qlQuantityCloseEnough_ ct1 uom1 amt1 ct2 uom2 amt2 n
  499 
  500 -- |A commodity's unit cost: a cash amount (a @(Double, Currency)@ pair, standing in for
  501 -- QuantLib's @Money@) per 'UnitOfMeasure'. A plain tuple, like 'Quantity' -- it carries no
  502 -- calculation of its own upstream.
  503 type CommodityUnitCost = (Double, Currency, UnitOfMeasure)
  504 
  505 -- |A date range, inclusive of both ends. No C++ call is needed for either operation below --
  506 -- 'Day' (from @Data.Time.Calendar@) already has the 'Ord' instance QuantLib's own comparisons rely
  507 -- on, so both are plain Haskell functions rather than shim calls.
  508 type DateInterval = (Day, Day)
  509 
  510 -- |Whether a date falls within the interval, optionally excluding either end.
  511 isDateBetween :: DateInterval
  512               -> Day -- ^date
  513               -> Bool -- ^includeFirst
  514               -> Bool -- ^includeLast
  515               -> Bool
  516 isDateBetween (startDate, endDate) date includeFirst includeLast =
  517   (if includeFirst then date >= startDate else date > startDate) &&
  518   (if includeLast then date <= endDate else date < endDate)
  519 
  520 -- |The overlap of two date intervals, or 'Nothing' if they don't overlap at all (upstream returns
  521 -- a default-constructed, both-dates-null 'DateInterval' in this case; a 'Maybe' is the natural
  522 -- Haskell equivalent).
  523 intersection :: DateInterval -> DateInterval -> Maybe DateInterval
  524 intersection (s1, e1) (s2, e2)
  525   | (s1 < s2 && e1 < s2) || (s1 > e2 && e1 > e2) = Nothing
  526   | otherwise = Just (max s1 s2, min e1 e2)
  527 
  528 -- |A 'DateInterval' over which a fixed 'Quantity' is priced, paid on
  529 -- 'pricingPeriodPaymentDate'. Named fields keep the value readable across energy-swap APIs.
  530 data PricingPeriod = PricingPeriod
  531   { pricingPeriodStartDate :: Day
  532   , pricingPeriodEndDate :: Day
  533   , pricingPeriodPaymentDate :: Day
  534   , pricingPeriodQuantity :: Quantity
  535   } deriving (Show, Eq)
  536 
  537 type PricingPeriods = [PricingPeriod]
  538 
  539 -- |Construct a 'PricingPeriod', enforcing upstream's @DateInterval@ invariant that the end date
  540 -- is not before the start date.
  541 pricingPeriod :: Day -> Day -> Day -> Quantity -> PricingPeriod
  542 pricingPeriod startDate endDate
  543   | endDate < startDate = error "pricingPeriod: end date must be >= start date"
  544   | otherwise = PricingPeriod startDate endDate
  545 
  546 -- |Construct a conversion factor between two units of measure for a given commodity type: a unit
  547 -- of @source@ is worth @conversionFactor@ units of @target@.
  548 unitOfMeasureConversion :: (CommodityType) -> (UnitOfMeasure) -- ^source
  549  -> (UnitOfMeasure) -- ^target
  550  -> (Double) -- ^conversionFactor
  551  -> IO ((UnitOfMeasureConversion))
  552 unitOfMeasureConversion a1 a2 a3 a4 =
  553   withCommodityType a1 $ \a1' -> 
  554   withUnitOfMeasure a2 $ \a2' -> 
  555   withUnitOfMeasure a3 $ \a3' -> 
  556   let {a4' = realToFrac a4} in 
  557   preErrorCheck $ \a5' -> 
  558   unitOfMeasureConversion'_ a1' a2' a3' a4' a5' >>= \res ->
  559   peekUnitOfMeasureConversion res >>= \res' ->
  560   errorCheck  a5'>>
  561   return (res')
  562 
  563 
  564 
  565 -- |The source unit of measure.
  566 unitOfMeasureConversionSource :: (UnitOfMeasureConversion) -> IO ((UnitOfMeasure))
  567 unitOfMeasureConversionSource a1 =
  568   withUnitOfMeasureConversion a1 $ \a1' -> 
  569   preErrorCheck $ \a2' -> 
  570   unitOfMeasureConversionSource'_ a1' a2' >>= \res ->
  571   peekUnitOfMeasure res >>= \res' ->
  572   errorCheck  a2'>>
  573   return (res')
  574 
  575 
  576 
  577 -- |The target unit of measure.
  578 unitOfMeasureConversionTarget :: (UnitOfMeasureConversion) -> IO ((UnitOfMeasure))
  579 unitOfMeasureConversionTarget a1 =
  580   withUnitOfMeasureConversion a1 $ \a1' -> 
  581   preErrorCheck $ \a2' -> 
  582   unitOfMeasureConversionTarget'_ a1' a2' >>= \res ->
  583   peekUnitOfMeasure res >>= \res' ->
  584   errorCheck  a2'>>
  585   return (res')
  586 
  587 
  588 
  589 -- |The commodity type this conversion applies to.
  590 unitOfMeasureConversionCommodityType :: (UnitOfMeasureConversion) -> IO ((CommodityType))
  591 unitOfMeasureConversionCommodityType a1 =
  592   withUnitOfMeasureConversion a1 $ \a1' -> 
  593   preErrorCheck $ \a2' -> 
  594   unitOfMeasureConversionCommodityType'_ a1' a2' >>= \res ->
  595   peekCommodityType res >>= \res' ->
  596   errorCheck  a2'>>
  597   return (res')
  598 
  599 
  600 
  601 -- |Whether the conversion was given directly, or derived by chaining two other conversions.
  602 unitOfMeasureConversionType :: (UnitOfMeasureConversion) -> (UnitOfMeasureConversionType)
  603 unitOfMeasureConversionType a1 =
  604   C2HSImp.unsafePerformIO $
  605   withUnitOfMeasureConversion a1 $ \a1' -> 
  606   unitOfMeasureConversionType'_ a1' >>= \res ->
  607   let {res' = (toEnum . fromIntegral) res} in
  608   return (res')
  609 
  610 
  611 
  612 -- |The conversion factor: a unit of the source is worth this many units of the target.
  613 unitOfMeasureConversionFactor :: (UnitOfMeasureConversion) -> (Double)
  614 unitOfMeasureConversionFactor a1 =
  615   C2HSImp.unsafePerformIO $
  616   withUnitOfMeasureConversion a1 $ \a1' -> 
  617   unitOfMeasureConversionFactor'_ a1' >>= \res ->
  618   let {res' = realToFrac res} in
  619   return (res')
  620 
  621 
  622 
  623 -- |A code identifying the conversion, e.g. \"Heating OilMTBBL\".
  624 unitOfMeasureConversionCode :: UnitOfMeasureConversion -> String
  625 unitOfMeasureConversionCode x = unsafePerformIO $ mask_ (unitOfMeasureConversionCodeRaw x)
  626 unitOfMeasureConversionCodeRaw :: (UnitOfMeasureConversion) -> IO ((String))
  627 unitOfMeasureConversionCodeRaw a1 =
  628   withUnitOfMeasureConversion a1 $ \a1' -> 
  629   unitOfMeasureConversionCodeRaw'_ a1' >>= \res ->
  630   peekDynString res >>= \res' ->
  631   return (res')
  632 
  633 
  634 
  635 qlUnitOfMeasureConversionConvert_ :: (UnitOfMeasureConversion) -> (CommodityType) -> (UnitOfMeasure) -> (Double) -> IO ((Double), (CommodityType), (UnitOfMeasure))
  636 qlUnitOfMeasureConversionConvert_ a1 a2 a3 a4 =
  637   withUnitOfMeasureConversion a1 $ \a1' -> 
  638   withCommodityType a2 $ \a2' -> 
  639   withUnitOfMeasure a3 $ \a3' -> 
  640   let {a4' = realToFrac a4} in 
  641   alloca $ \a5' -> 
  642   alloca $ \a6' -> 
  643   preErrorCheck $ \a7' -> 
  644   qlUnitOfMeasureConversionConvert_'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  645   let {res' = realToFrac res} in
  646   peekCommodityTypePtr  a5'>>= \a5'' -> 
  647   peekUnitOfMeasurePtr  a6'>>= \a6'' -> 
  648   errorCheck  a7'>>
  649   return (res', a5'', a6'')
  650 
  651 
  652 
  653 -- |Apply the conversion factor to a quantity, converting it from the conversion's source to its
  654 -- target unit of measure (or vice versa). Throws if the quantity's unit of measure is on neither
  655 -- side of the conversion.
  656 convertQuantity :: UnitOfMeasureConversion -> Quantity -> IO Quantity
  657 convertQuantity conv (ct, uom, amount) = do
  658   (amount', ct', uom') <- qlUnitOfMeasureConversionConvert_ conv ct uom amount
  659   pure (ct', uom', amount')
  660 
  661 -- |Combine two conversions sharing a common unit of measure into a derived conversion between
  662 -- their other two units. Throws if the conversions don't share a common unit.
  663 chainUnitOfMeasureConversion :: (UnitOfMeasureConversion) -> (UnitOfMeasureConversion) -> IO ((UnitOfMeasureConversion))
  664 chainUnitOfMeasureConversion a1 a2 =
  665   withUnitOfMeasureConversion a1 $ \a1' -> 
  666   withUnitOfMeasureConversion a2 $ \a2' -> 
  667   preErrorCheck $ \a3' -> 
  668   chainUnitOfMeasureConversion'_ a1' a2' a3' >>= \res ->
  669   peekUnitOfMeasureConversion res >>= \res' ->
  670   errorCheck  a3'>>
  671   return (res')
  672 
  673 
  674 
  675 -- |Look up a (possibly derived, via triangulation) conversion between two units of measure for a
  676 -- given commodity type. Throws if none can be found. Pre-populated with a set of known petroleum
  677 -- conversion factors even before any 'addUomConversion' call.
  678 lookupUomConversion :: (CommodityType) -> (UnitOfMeasure) -- ^source
  679  -> (UnitOfMeasure) -- ^target
  680  -> (UnitOfMeasureConversionType) -> IO ((UnitOfMeasureConversion))
  681 lookupUomConversion a1 a2 a3 a4 =
  682   withCommodityType a1 $ \a1' -> 
  683   withUnitOfMeasure a2 $ \a2' -> 
  684   withUnitOfMeasure a3 $ \a3' -> 
  685   let {a4' = (fromIntegral . fromEnum) a4} in 
  686   preErrorCheck $ \a5' -> 
  687   lookupUomConversion'_ a1' a2' a3' a4' a5' >>= \res ->
  688   peekUnitOfMeasureConversion res >>= \res' ->
  689   errorCheck  a5'>>
  690   return (res')
  691 
  692 
  693 
  694 -- |Register a conversion with the global unit-of-measure conversion repository, replacing any
  695 -- existing conversion between the same commodity type and pair of units.
  696 addUomConversion :: (UnitOfMeasureConversion) -> IO ()
  697 addUomConversion a1 =
  698   withUnitOfMeasureConversion a1 $ \a1' -> 
  699   addUomConversion'_ a1' >>
  700   return ()
  701 
  702 
  703 
  704 -- |Reset the unit-of-measure conversion repository back to its built-in set of known petroleum
  705 -- conversion factors, discarding anything added via 'addUomConversion'.
  706 clearUomConversions :: IO ()
  707 clearUomConversions =
  708   clearUomConversions'_ >>
  709   return ()
  710 
  711 
  712 
  713 -- |The global commodity currency setting (defaults to USD).
  714 commoditySettingsCurrency :: IO ((Currency))
  715 commoditySettingsCurrency =
  716   preErrorCheck $ \a1' -> 
  717   commoditySettingsCurrency'_ a1' >>= \res ->
  718   peekCurrency res >>= \res' ->
  719   errorCheck  a1'>>
  720   return (res')
  721 
  722 
  723 
  724 -- |Set the global commodity currency setting.
  725 setCommoditySettingsCurrency :: (Currency) -> IO ()
  726 setCommoditySettingsCurrency a1 =
  727   withCurrency a1 $ \a1' -> 
  728   setCommoditySettingsCurrency'_ a1' >>
  729   return ()
  730 
  731 
  732 
  733 -- |The global commodity unit-of-measure setting (defaults to barrels).
  734 commoditySettingsUnitOfMeasure :: IO ((UnitOfMeasure))
  735 commoditySettingsUnitOfMeasure =
  736   preErrorCheck $ \a1' -> 
  737   commoditySettingsUnitOfMeasure'_ a1' >>= \res ->
  738   peekUnitOfMeasure res >>= \res' ->
  739   errorCheck  a1'>>
  740   return (res')
  741 
  742 
  743 
  744 -- |Set the global commodity unit-of-measure setting.
  745 setCommoditySettingsUnitOfMeasure :: (UnitOfMeasure) -> IO ()
  746 setCommoditySettingsUnitOfMeasure a1 =
  747   withUnitOfMeasure a1 $ \a1' -> 
  748   setCommoditySettingsUnitOfMeasure'_ a1' >>
  749   return ()
  750 
  751 
  752 
  753 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
  754 
  755 foreign import ccall safe "QuantLib/Commodity.chs.h qlCommodityType"
  756   commodityType'_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCommodityType))))))
  757 
  758 foreign import ccall safe "QuantLib/Commodity.chs.h qlNullCommodityType"
  759   nullCommodityType'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCommodityType))))
  760 
  761 foreign import ccall safe "QuantLib/Commodity.chs.h qlCommodityTypeCode"
  762   commodityTypeCodeRaw'_ :: ((C2HSImp.Ptr (CCommodityType)) -> (IO (C2HSImp.Ptr C2HSImp.CChar)))
  763 
  764 foreign import ccall safe "QuantLib/Commodity.chs.h qlCommodityTypeName"
  765   commodityTypeNameRaw'_ :: ((C2HSImp.Ptr (CCommodityType)) -> (IO (C2HSImp.Ptr C2HSImp.CChar)))
  766 
  767 foreign import ccall safe "QuantLib/Commodity.chs.h qlCommodityTypeEmpty"
  768   commodityTypeEmpty'_ :: ((C2HSImp.Ptr (CCommodityType)) -> (IO C2HSImp.CInt))
  769 
  770 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasure"
  771   unitOfMeasure'_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure)))))))
  772 
  773 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureName"
  774   unitOfMeasureNameRaw'_ :: ((C2HSImp.Ptr (CUnitOfMeasure)) -> (IO (C2HSImp.Ptr C2HSImp.CChar)))
  775 
  776 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureCode"
  777   unitOfMeasureCodeRaw'_ :: ((C2HSImp.Ptr (CUnitOfMeasure)) -> (IO (C2HSImp.Ptr C2HSImp.CChar)))
  778 
  779 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureUnitType"
  780   unitOfMeasureType'_ :: ((C2HSImp.Ptr (CUnitOfMeasure)) -> (IO C2HSImp.CInt))
  781 
  782 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureEmpty"
  783   unitOfMeasureEmpty'_ :: ((C2HSImp.Ptr (CUnitOfMeasure)) -> (IO C2HSImp.CInt))
  784 
  785 foreign import ccall safe "QuantLib/Commodity.chs.h qlLotUnitOfMeasure"
  786   lotUnitOfMeasure'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure))))
  787 
  788 foreign import ccall safe "QuantLib/Commodity.chs.h qlBarrelUnitOfMeasure"
  789   barrelUnitOfMeasure'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure))))
  790 
  791 foreign import ccall safe "QuantLib/Commodity.chs.h qlMTUnitOfMeasure"
  792   mtUnitOfMeasure'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure))))
  793 
  794 foreign import ccall safe "QuantLib/Commodity.chs.h qlMBUnitOfMeasure"
  795   mbUnitOfMeasure'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure))))
  796 
  797 foreign import ccall safe "QuantLib/Commodity.chs.h qlGallonUnitOfMeasure"
  798   gallonUnitOfMeasure'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure))))
  799 
  800 foreign import ccall safe "QuantLib/Commodity.chs.h qlLitreUnitOfMeasure"
  801   litreUnitOfMeasure'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure))))
  802 
  803 foreign import ccall safe "QuantLib/Commodity.chs.h qlKilolitreUnitOfMeasure"
  804   kilolitreUnitOfMeasure'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure))))
  805 
  806 foreign import ccall safe "QuantLib/Commodity.chs.h qlTokyoKilolitreUnitOfMeasure"
  807   tokyoKilolitreUnitOfMeasure'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure))))
  808 
  809 foreign import ccall safe "QuantLib/Commodity.chs.h qlPaymentTerm"
  810   paymentTerm'_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPaymentTerm))))))))
  811 
  812 foreign import ccall safe "QuantLib/Commodity.chs.h qlPaymentTermName"
  813   paymentTermNameRaw'_ :: ((C2HSImp.Ptr (CPaymentTerm)) -> (IO (C2HSImp.Ptr C2HSImp.CChar)))
  814 
  815 foreign import ccall safe "QuantLib/Commodity.chs.h qlPaymentTermEventType_"
  816   paymentTermEventType'_ :: ((C2HSImp.Ptr (CPaymentTerm)) -> (IO C2HSImp.CInt))
  817 
  818 foreign import ccall safe "QuantLib/Commodity.chs.h qlPaymentTermOffsetDays"
  819   paymentTermOffsetDays'_ :: ((C2HSImp.Ptr (CPaymentTerm)) -> (IO C2HSImp.CInt))
  820 
  821 foreign import ccall safe "QuantLib/Commodity.chs.h qlPaymentTermCalendar"
  822   paymentTermCalendar'_ :: ((C2HSImp.Ptr (CPaymentTerm)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCalendar)))))
  823 
  824 foreign import ccall safe "QuantLib/Commodity.chs.h qlPaymentTermEmpty"
  825   paymentTermEmpty'_ :: ((C2HSImp.Ptr (CPaymentTerm)) -> (IO C2HSImp.CInt))
  826 
  827 foreign import ccall safe "QuantLib/Commodity.chs.h qlPaymentTermGetPaymentDate"
  828   paymentTermGetPaymentDate'_ :: ((C2HSImp.Ptr (CPaymentTerm)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
  829 
  830 foreign import ccall safe "QuantLib/Commodity.chs.h qlQuantityRoundedAmount"
  831   quantityRoundedAmount'_ :: ((C2HSImp.Ptr (CUnitOfMeasure)) -> (C2HSImp.CDouble -> (IO C2HSImp.CDouble)))
  832 
  833 foreign import ccall safe "QuantLib/Commodity.chs.h qlQuantityClose"
  834   qlQuantityClose_'_ :: ((C2HSImp.Ptr (CCommodityType)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CCommodityType)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt)))))))))
  835 
  836 foreign import ccall safe "QuantLib/Commodity.chs.h qlQuantityCloseEnough"
  837   qlQuantityCloseEnough_'_ :: ((C2HSImp.Ptr (CCommodityType)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CCommodityType)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt)))))))))
  838 
  839 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversion"
  840   unitOfMeasureConversion'_ :: ((C2HSImp.Ptr (CCommodityType)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasureConversion))))))))
  841 
  842 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionSource"
  843   unitOfMeasureConversionSource'_ :: ((C2HSImp.Ptr (CUnitOfMeasureConversion)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure)))))
  844 
  845 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionTarget"
  846   unitOfMeasureConversionTarget'_ :: ((C2HSImp.Ptr (CUnitOfMeasureConversion)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure)))))
  847 
  848 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionCommodityType"
  849   unitOfMeasureConversionCommodityType'_ :: ((C2HSImp.Ptr (CUnitOfMeasureConversion)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCommodityType)))))
  850 
  851 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionType_"
  852   unitOfMeasureConversionType'_ :: ((C2HSImp.Ptr (CUnitOfMeasureConversion)) -> (IO C2HSImp.CInt))
  853 
  854 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionFactor"
  855   unitOfMeasureConversionFactor'_ :: ((C2HSImp.Ptr (CUnitOfMeasureConversion)) -> (IO C2HSImp.CDouble))
  856 
  857 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionCode"
  858   unitOfMeasureConversionCodeRaw'_ :: ((C2HSImp.Ptr (CUnitOfMeasureConversion)) -> (IO (C2HSImp.Ptr C2HSImp.CChar)))
  859 
  860 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionConvert"
  861   qlUnitOfMeasureConversionConvert_'_ :: ((C2HSImp.Ptr (CUnitOfMeasureConversion)) -> ((C2HSImp.Ptr (CCommodityType)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr (CCommodityType))) -> ((C2HSImp.Ptr (C2HSImp.Ptr (CUnitOfMeasure))) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
  862 
  863 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionChain"
  864   chainUnitOfMeasureConversion'_ :: ((C2HSImp.Ptr (CUnitOfMeasureConversion)) -> ((C2HSImp.Ptr (CUnitOfMeasureConversion)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasureConversion))))))
  865 
  866 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionManagerLookup"
  867   lookupUomConversion'_ :: ((C2HSImp.Ptr (CCommodityType)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> ((C2HSImp.Ptr (CUnitOfMeasure)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasureConversion))))))))
  868 
  869 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionManagerAdd"
  870   addUomConversion'_ :: ((C2HSImp.Ptr (CUnitOfMeasureConversion)) -> (IO ()))
  871 
  872 foreign import ccall safe "QuantLib/Commodity.chs.h qlUnitOfMeasureConversionManagerClear"
  873   clearUomConversions'_ :: (IO ())
  874 
  875 foreign import ccall safe "QuantLib/Commodity.chs.h qlCommoditySettingsCurrency"
  876   commoditySettingsCurrency'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCurrency))))
  877 
  878 foreign import ccall safe "QuantLib/Commodity.chs.h qlCommoditySettingsSetCurrency"
  879   setCommoditySettingsCurrency'_ :: ((C2HSImp.Ptr (CCurrency)) -> (IO ()))
  880 
  881 foreign import ccall safe "QuantLib/Commodity.chs.h qlCommoditySettingsUnitOfMeasure"
  882   commoditySettingsUnitOfMeasure'_ :: ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CUnitOfMeasure))))
  883 
  884 foreign import ccall safe "QuantLib/Commodity.chs.h qlCommoditySettingsSetUnitOfMeasure"
  885   setCommoditySettingsUnitOfMeasure'_ :: ((C2HSImp.Ptr (CUnitOfMeasure)) -> (IO ()))