Advertisement
Guest User

Untitled

a guest
Nov 7th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. {-# LANGUAGE ForeignFunctionInterface #-}
  2. {-# LANGUAGE QuasiQuotes #-}
  3. {-# LANGUAGE TemplateHaskell #-}
  4. module Main where
  5.  
  6. import qualified Language.C.Inline.Cpp as C
  7.  
  8. C.context C.cppCtx
  9.  
  10. C.include "<iostream>"
  11. C.include "Owen.hpp"
  12. C.include "<boost/math/special_functions/owens_t.hpp>"
  13.  
  14. cppTest :: C.CDouble -> C.CDouble -> IO ()
  15. cppTest h a = do
  16. [C.block| void {
  17. std::cout << "Hello, Owen! " << boost::math::owens_t($(double h), $(double a)) << std::endl;
  18.  
  19. {
  20.  
  21. std::cout << "Conversion function" << std::endl;
  22. Knot k = Knot(10);
  23. double km = 100;
  24.  
  25. std::cout << "10 knots + 100km=" << k + km << std::endl;
  26. }
  27. } |]
  28.  
  29.  
  30. main :: IO ()
  31. main = cppTest 2 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement