packages feed

hs-bindgen-1.0.0.0: test-artefacts/fixtures/functions/callbacks/Example/Safe.hs

{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_HADDOCK prune #-}

module Example.Safe
    ( Example.Safe.readFileWithProcessor
    , Example.Safe.watchTemperature
    , Example.Safe.onFileOpened
    , Example.Safe.onProgressChanged
    , Example.Safe.validateInput
    , Example.Safe.onNewMeasurement
    , Example.Safe.onNewMeasurement2
    , Example.Safe.onBufferReady
    , Example.Safe.transformMeasurement
    , Example.Safe.processWithCallbacks
    , Example.Safe.registerHandler
    , Example.Safe.executePipeline
    , Example.Safe.runProcessor
    , Example.Safe.processMeasurementWithValidation
    , Example.Safe.f
    , Example.Safe.f2
    )
  where

import qualified HsBindgen.Runtime.Support as BG
import qualified HsBindgen.Runtime.Support.CAPI
import Example
import Prelude (IO, fmap)

$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
  [ "#include <functions/callbacks.h>"
  , "signed int hs_bindgen_99bda9cd8097b0ea ("
  , "  void (*arg1) ("
  , "  signed int arg1"
  , "),"
  , "  signed int arg2"
  , ")"
  , "{"
  , "  return (readFileWithProcessor)(arg1, arg2);"
  , "}"
  , "void hs_bindgen_84b75366c836fc85 ("
  , "  void (*arg1) ("
  , "  signed int arg1"
  , "),"
  , "  signed int arg2"
  , ")"
  , "{"
  , "  (watchTemperature)(arg1, arg2);"
  , "}"
  , "void hs_bindgen_f2580f574faa3697 ("
  , "  FileOpenedNotification arg1"
  , ")"
  , "{"
  , "  (onFileOpened)(arg1);"
  , "}"
  , "void hs_bindgen_654057b291ee37ea ("
  , "  ProgressUpdate arg1"
  , ")"
  , "{"
  , "  (onProgressChanged)(arg1);"
  , "}"
  , "signed int hs_bindgen_5df7aac6996be10f ("
  , "  DataValidator arg1,"
  , "  signed int arg2"
  , ")"
  , "{"
  , "  return (validateInput)(arg1, arg2);"
  , "}"
  , "void hs_bindgen_8f1bb1c4d2b5355f ("
  , "  MeasurementReceived arg1"
  , ")"
  , "{"
  , "  (onNewMeasurement)(arg1);"
  , "}"
  , "void hs_bindgen_d805e39c6cbdd620 ("
  , "  MeasurementReceived2 arg1"
  , ")"
  , "{"
  , "  (onNewMeasurement2)(arg1);"
  , "}"
  , "void hs_bindgen_8d803591bcf10ba5 ("
  , "  SampleBufferFull arg1"
  , ")"
  , "{"
  , "  (onBufferReady)(arg1);"
  , "}"
  , "void hs_bindgen_16c298a15b737eb2 ("
  , "  struct Measurement *arg1,"
  , "  void (*arg2) ("
  , "  struct Measurement *arg1,"
  , "  double (*arg2) ("
  , "  double arg1,"
  , "  signed int arg2"
  , "),"
  , "  signed int arg3"
  , ")"
  , ")"
  , "{"
  , "  (transformMeasurement)(arg1, arg2);"
  , "}"
  , "void hs_bindgen_e6a073138e56764f ("
  , "  void (*arg1) ("
  , "  struct Measurement *arg1,"
  , "  FileOpenedNotification arg2,"
  , "  signed int arg3"
  , ")"
  , ")"
  , "{"
  , "  (processWithCallbacks)(arg1);"
  , "}"
  , "void hs_bindgen_ece0d4f94c2319f0 ("
  , "  struct MeasurementHandler *arg1"
  , ")"
  , "{"
  , "  (registerHandler)(arg1);"
  , "}"
  , "void hs_bindgen_d66d7470a7a213b0 ("
  , "  struct Measurement *arg1,"
  , "  struct DataPipeline *arg2"
  , ")"
  , "{"
  , "  (executePipeline)(arg1, arg2);"
  , "}"
  , "void hs_bindgen_e925d3ce6e5fb395 ("
  , "  struct Measurement *arg1,"
  , "  struct Processor *arg2"
  , ")"
  , "{"
  , "  (runProcessor)(arg1, arg2);"
  , "}"
  , "void hs_bindgen_1e432e1595a1ef55 ("
  , "  struct Measurement *arg1,"
  , "  void (*arg2) ("
  , "  struct Measurement *arg1,"
  , "  void (*arg2) ("
  , "  struct Measurement *arg1,"
  , "  DataValidator arg2,"
  , "  signed int arg3"
  , "),"
  , "  DataValidator arg3"
  , ")"
  , ")"
  , "{"
  , "  (processMeasurementWithValidation)(arg1, arg2);"
  , "}"
  , "void hs_bindgen_d5cd030edf2e0364 ("
  , "  void (*arg1) ("
  , "  foo arg1"
  , ")"
  , ")"
  , "{"
  , "  (f)(arg1);"
  , "}"
  , "void hs_bindgen_a10eec74074627ba ("
  , "  void (*arg1) ("
  , "  foo2 const arg1"
  , ")"
  , ")"
  , "{"
  , "  (f2)(arg1);"
  , "}"
  ]))

-- __unique:__ @test_functionscallbacks_Example_Safe_readFileWithProcessor@
foreign import ccall safe "hs_bindgen_99bda9cd8097b0ea" hs_bindgen_99bda9cd8097b0ea_base ::
     BG.FunPtr BG.Void
  -> BG.CInt
  -> IO BG.CInt

-- __unique:__ @test_functionscallbacks_Example_Safe_readFileWithProcessor@
hs_bindgen_99bda9cd8097b0ea ::
     BG.FunPtr (BG.CInt -> IO ())
  -> BG.CInt
  -> IO BG.CInt
hs_bindgen_99bda9cd8097b0ea =
  \x0 ->
    \x1 ->
      fmap BG.fromFFIType (hs_bindgen_99bda9cd8097b0ea_base (BG.toFFIType x0) (BG.toFFIType x1))

{-| __C declaration:__ @readFileWithProcessor@

    __defined at:__ @functions\/callbacks.h 4:5@

    __exported by:__ @functions\/callbacks.h@
-}
readFileWithProcessor ::
     BG.FunPtr (BG.CInt -> IO ())
     -- ^ __C declaration:__ @processLine@
  -> BG.CInt
     -- ^ __C declaration:__ @fileId@
  -> IO BG.CInt
readFileWithProcessor = hs_bindgen_99bda9cd8097b0ea

-- __unique:__ @test_functionscallbacks_Example_Safe_watchTemperature@
foreign import ccall safe "hs_bindgen_84b75366c836fc85" hs_bindgen_84b75366c836fc85_base ::
     BG.FunPtr BG.Void
  -> BG.CInt
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_watchTemperature@
hs_bindgen_84b75366c836fc85 ::
     BG.FunPtr (BG.CInt -> IO ())
  -> BG.CInt
  -> IO ()
hs_bindgen_84b75366c836fc85 =
  \x0 ->
    \x1 ->
      hs_bindgen_84b75366c836fc85_base (BG.toFFIType x0) (BG.toFFIType x1)

{-| __C declaration:__ @watchTemperature@

    __defined at:__ @functions\/callbacks.h 5:6@

    __exported by:__ @functions\/callbacks.h@
-}
watchTemperature ::
     BG.FunPtr (BG.CInt -> IO ())
     -- ^ __C declaration:__ @onTempChange@
  -> BG.CInt
     -- ^ __C declaration:__ @sensorId@
  -> IO ()
watchTemperature = hs_bindgen_84b75366c836fc85

-- __unique:__ @test_functionscallbacks_Example_Safe_onFileOpened@
foreign import ccall safe "hs_bindgen_f2580f574faa3697" hs_bindgen_f2580f574faa3697_base ::
     BG.FunPtr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_onFileOpened@
hs_bindgen_f2580f574faa3697 ::
     FileOpenedNotification
  -> IO ()
hs_bindgen_f2580f574faa3697 =
  \x0 ->
    hs_bindgen_f2580f574faa3697_base (BG.toFFIType x0)

{-| __C declaration:__ @onFileOpened@

    __defined at:__ @functions\/callbacks.h 14:6@

    __exported by:__ @functions\/callbacks.h@
-}
onFileOpened ::
     FileOpenedNotification
     -- ^ __C declaration:__ @notify@
  -> IO ()
onFileOpened = hs_bindgen_f2580f574faa3697

-- __unique:__ @test_functionscallbacks_Example_Safe_onProgressChanged@
foreign import ccall safe "hs_bindgen_654057b291ee37ea" hs_bindgen_654057b291ee37ea_base ::
     BG.FunPtr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_onProgressChanged@
hs_bindgen_654057b291ee37ea ::
     ProgressUpdate
  -> IO ()
hs_bindgen_654057b291ee37ea =
  \x0 ->
    hs_bindgen_654057b291ee37ea_base (BG.toFFIType x0)

{-| __C declaration:__ @onProgressChanged@

    __defined at:__ @functions\/callbacks.h 15:6@

    __exported by:__ @functions\/callbacks.h@
-}
onProgressChanged ::
     ProgressUpdate
     -- ^ __C declaration:__ @update@
  -> IO ()
onProgressChanged = hs_bindgen_654057b291ee37ea

-- __unique:__ @test_functionscallbacks_Example_Safe_validateInput@
foreign import ccall safe "hs_bindgen_5df7aac6996be10f" hs_bindgen_5df7aac6996be10f_base ::
     BG.FunPtr BG.Void
  -> BG.CInt
  -> IO BG.CInt

-- __unique:__ @test_functionscallbacks_Example_Safe_validateInput@
hs_bindgen_5df7aac6996be10f ::
     DataValidator
  -> BG.CInt
  -> IO BG.CInt
hs_bindgen_5df7aac6996be10f =
  \x0 ->
    \x1 ->
      fmap BG.fromFFIType (hs_bindgen_5df7aac6996be10f_base (BG.toFFIType x0) (BG.toFFIType x1))

{-| __C declaration:__ @validateInput@

    __defined at:__ @functions\/callbacks.h 16:5@

    __exported by:__ @functions\/callbacks.h@
-}
validateInput ::
     DataValidator
     -- ^ __C declaration:__ @validator@
  -> BG.CInt
     -- ^ __C declaration:__ @rawValue@
  -> IO BG.CInt
validateInput = hs_bindgen_5df7aac6996be10f

-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement@
foreign import ccall safe "hs_bindgen_8f1bb1c4d2b5355f" hs_bindgen_8f1bb1c4d2b5355f_base ::
     BG.FunPtr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement@
hs_bindgen_8f1bb1c4d2b5355f ::
     MeasurementReceived
  -> IO ()
hs_bindgen_8f1bb1c4d2b5355f =
  \x0 ->
    hs_bindgen_8f1bb1c4d2b5355f_base (BG.toFFIType x0)

{-| __C declaration:__ @onNewMeasurement@

    __defined at:__ @functions\/callbacks.h 27:6@

    __exported by:__ @functions\/callbacks.h@
-}
onNewMeasurement ::
     MeasurementReceived
     -- ^ __C declaration:__ @handler@
  -> IO ()
onNewMeasurement = hs_bindgen_8f1bb1c4d2b5355f

-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement2@
foreign import ccall safe "hs_bindgen_d805e39c6cbdd620" hs_bindgen_d805e39c6cbdd620_base ::
     BG.FunPtr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement2@
hs_bindgen_d805e39c6cbdd620 ::
     MeasurementReceived2
  -> IO ()
hs_bindgen_d805e39c6cbdd620 =
  \x0 ->
    hs_bindgen_d805e39c6cbdd620_base (BG.toFFIType x0)

{-| __C declaration:__ @onNewMeasurement2@

    __defined at:__ @functions\/callbacks.h 30:6@

    __exported by:__ @functions\/callbacks.h@
-}
onNewMeasurement2 ::
     MeasurementReceived2
     -- ^ __C declaration:__ @handler@
  -> IO ()
onNewMeasurement2 = hs_bindgen_d805e39c6cbdd620

-- __unique:__ @test_functionscallbacks_Example_Safe_onBufferReady@
foreign import ccall safe "hs_bindgen_8d803591bcf10ba5" hs_bindgen_8d803591bcf10ba5_base ::
     BG.FunPtr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_onBufferReady@
hs_bindgen_8d803591bcf10ba5 ::
     SampleBufferFull
  -> IO ()
hs_bindgen_8d803591bcf10ba5 =
  \x0 ->
    hs_bindgen_8d803591bcf10ba5_base (BG.toFFIType x0)

{-| __C declaration:__ @onBufferReady@

    __defined at:__ @functions\/callbacks.h 33:6@

    __exported by:__ @functions\/callbacks.h@
-}
onBufferReady ::
     SampleBufferFull
     -- ^ __C declaration:__ @handler@
  -> IO ()
onBufferReady = hs_bindgen_8d803591bcf10ba5

-- __unique:__ @test_functionscallbacks_Example_Safe_transformMeasurement@
foreign import ccall safe "hs_bindgen_16c298a15b737eb2" hs_bindgen_16c298a15b737eb2_base ::
     BG.Ptr BG.Void
  -> BG.FunPtr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_transformMeasurement@
hs_bindgen_16c298a15b737eb2 ::
     BG.Ptr Measurement
  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())
  -> IO ()
hs_bindgen_16c298a15b737eb2 =
  \x0 ->
    \x1 ->
      hs_bindgen_16c298a15b737eb2_base (BG.toFFIType x0) (BG.toFFIType x1)

{-| __C declaration:__ @transformMeasurement@

    __defined at:__ @functions\/callbacks.h 38:6@

    __exported by:__ @functions\/callbacks.h@
-}
transformMeasurement ::
     BG.Ptr Measurement
     -- ^ __C declaration:__ @data@
  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())
     -- ^ __C declaration:__ @transformer@
  -> IO ()
transformMeasurement = hs_bindgen_16c298a15b737eb2

-- __unique:__ @test_functionscallbacks_Example_Safe_processWithCallbacks@
foreign import ccall safe "hs_bindgen_e6a073138e56764f" hs_bindgen_e6a073138e56764f_base ::
     BG.FunPtr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_processWithCallbacks@
hs_bindgen_e6a073138e56764f ::
     BG.FunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())
  -> IO ()
hs_bindgen_e6a073138e56764f =
  \x0 ->
    hs_bindgen_e6a073138e56764f_base (BG.toFFIType x0)

{-| __C declaration:__ @processWithCallbacks@

    __defined at:__ @functions\/callbacks.h 43:6@

    __exported by:__ @functions\/callbacks.h@
-}
processWithCallbacks ::
     BG.FunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())
     -- ^ __C declaration:__ @handler@
  -> IO ()
processWithCallbacks = hs_bindgen_e6a073138e56764f

-- __unique:__ @test_functionscallbacks_Example_Safe_registerHandler@
foreign import ccall safe "hs_bindgen_ece0d4f94c2319f0" hs_bindgen_ece0d4f94c2319f0_base ::
     BG.Ptr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_registerHandler@
hs_bindgen_ece0d4f94c2319f0 ::
     BG.Ptr MeasurementHandler
  -> IO ()
hs_bindgen_ece0d4f94c2319f0 =
  \x0 ->
    hs_bindgen_ece0d4f94c2319f0_base (BG.toFFIType x0)

{-| __C declaration:__ @registerHandler@

    __defined at:__ @functions\/callbacks.h 56:6@

    __exported by:__ @functions\/callbacks.h@
-}
registerHandler ::
     BG.Ptr MeasurementHandler
     -- ^ __C declaration:__ @handler@
  -> IO ()
registerHandler = hs_bindgen_ece0d4f94c2319f0

-- __unique:__ @test_functionscallbacks_Example_Safe_executePipeline@
foreign import ccall safe "hs_bindgen_d66d7470a7a213b0" hs_bindgen_d66d7470a7a213b0_base ::
     BG.Ptr BG.Void
  -> BG.Ptr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_executePipeline@
hs_bindgen_d66d7470a7a213b0 ::
     BG.Ptr Measurement
  -> BG.Ptr DataPipeline
  -> IO ()
hs_bindgen_d66d7470a7a213b0 =
  \x0 ->
    \x1 ->
      hs_bindgen_d66d7470a7a213b0_base (BG.toFFIType x0) (BG.toFFIType x1)

{-| __C declaration:__ @executePipeline@

    __defined at:__ @functions\/callbacks.h 64:6@

    __exported by:__ @functions\/callbacks.h@
-}
executePipeline ::
     BG.Ptr Measurement
     -- ^ __C declaration:__ @data@
  -> BG.Ptr DataPipeline
     -- ^ __C declaration:__ @pipeline@
  -> IO ()
executePipeline = hs_bindgen_d66d7470a7a213b0

-- __unique:__ @test_functionscallbacks_Example_Safe_runProcessor@
foreign import ccall safe "hs_bindgen_e925d3ce6e5fb395" hs_bindgen_e925d3ce6e5fb395_base ::
     BG.Ptr BG.Void
  -> BG.Ptr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_runProcessor@
hs_bindgen_e925d3ce6e5fb395 ::
     BG.Ptr Measurement
  -> BG.Ptr Processor
  -> IO ()
hs_bindgen_e925d3ce6e5fb395 =
  \x0 ->
    \x1 ->
      hs_bindgen_e925d3ce6e5fb395_base (BG.toFFIType x0) (BG.toFFIType x1)

{-| __C declaration:__ @runProcessor@

    __defined at:__ @functions\/callbacks.h 80:6@

    __exported by:__ @functions\/callbacks.h@
-}
runProcessor ::
     BG.Ptr Measurement
     -- ^ __C declaration:__ @data@
  -> BG.Ptr Processor
     -- ^ __C declaration:__ @processor@
  -> IO ()
runProcessor = hs_bindgen_e925d3ce6e5fb395

-- __unique:__ @test_functionscallbacks_Example_Safe_processMeasurementWithValidation@
foreign import ccall safe "hs_bindgen_1e432e1595a1ef55" hs_bindgen_1e432e1595a1ef55_base ::
     BG.Ptr BG.Void
  -> BG.FunPtr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_processMeasurementWithValidation@
hs_bindgen_1e432e1595a1ef55 ::
     BG.Ptr Measurement
  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())
  -> IO ()
hs_bindgen_1e432e1595a1ef55 =
  \x0 ->
    \x1 ->
      hs_bindgen_1e432e1595a1ef55_base (BG.toFFIType x0) (BG.toFFIType x1)

{-| __C declaration:__ @processMeasurementWithValidation@

    __defined at:__ @functions\/callbacks.h 85:6@

    __exported by:__ @functions\/callbacks.h@
-}
processMeasurementWithValidation ::
     BG.Ptr Measurement
     -- ^ __C declaration:__ @data@
  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())
     -- ^ __C declaration:__ @processor@
  -> IO ()
processMeasurementWithValidation =
  hs_bindgen_1e432e1595a1ef55

-- __unique:__ @test_functionscallbacks_Example_Safe_f@
foreign import ccall safe "hs_bindgen_d5cd030edf2e0364" hs_bindgen_d5cd030edf2e0364_base ::
     BG.FunPtr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_f@
hs_bindgen_d5cd030edf2e0364 ::
     BG.FunPtr (Foo -> IO ())
  -> IO ()
hs_bindgen_d5cd030edf2e0364 =
  \x0 ->
    hs_bindgen_d5cd030edf2e0364_base (BG.toFFIType x0)

{-| __C declaration:__ @f@

    __defined at:__ @functions\/callbacks.h 96:6@

    __exported by:__ @functions\/callbacks.h@
-}
f ::
     BG.FunPtr (Foo -> IO ())
     -- ^ __C declaration:__ @callback@
  -> IO ()
f = hs_bindgen_d5cd030edf2e0364

-- __unique:__ @test_functionscallbacks_Example_Safe_f2@
foreign import ccall safe "hs_bindgen_a10eec74074627ba" hs_bindgen_a10eec74074627ba_base ::
     BG.FunPtr BG.Void
  -> IO ()

-- __unique:__ @test_functionscallbacks_Example_Safe_f2@
hs_bindgen_a10eec74074627ba ::
     BG.FunPtr (Foo2 -> IO ())
  -> IO ()
hs_bindgen_a10eec74074627ba =
  \x0 ->
    hs_bindgen_a10eec74074627ba_base (BG.toFFIType x0)

{-| __C declaration:__ @f2@

    __defined at:__ @functions\/callbacks.h 97:6@

    __exported by:__ @functions\/callbacks.h@
-}
f2 ::
     BG.FunPtr (Foo2 -> IO ())
     -- ^ __C declaration:__ @handler@
  -> IO ()
f2 = hs_bindgen_a10eec74074627ba