packages feed

libtorch-ffi-helper (empty) → 2.0.0.0

raw patch · 3 files changed

+61/−0 lines, 3 filesdep +basedep +ghc

Dependencies added: base, ghc

Files

+ libtorch-ffi-helper.cabal view
@@ -0,0 +1,23 @@+cabal-version:       3.0+name:                libtorch-ffi-helper+version:             2.0.0.0+-- The prefix(2.0) of this version("2.0.0.0") is the same as libtorch's one.+synopsis:            Helpers for integrating libtorch-ffi with Hasktorch.+description:         Provide macros and plugins for building libtorch-ffi of hasktorch.+homepage:            https://github.com/hasktorch/hasktorch#readme+license:             BSD-3-Clause+author:              Austin Huang+maintainer:          hasktorch@gmail.com+copyright:           2018 Austin Huang+category:            Codegen+build-type:          Simple++library+ exposed-modules:     Torch.Internal.Unmanaged.Helper+                    , GHC.NotExport.Plugin+ hs-source-dirs: src+ default-language: Haskell2010+ build-depends:       base >= 4.7 && < 5+                    , ghc >=8.5 && < 9.8+ if os(darwin)+   ghc-options: -optc=-Wno-int-conversion
+ src/GHC/NotExport/Plugin.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE CPP #-}++module GHC.NotExport.Plugin (plugin) where++#if MIN_VERSION_ghc(9,0,0)+import GHC.Driver.Plugins+import GHC.Types.Avail+import GHC.Types.Name+import GHC.Tc.Types+import GHC.Utils.Outputable+#else+import GhcPlugins+import Plugins+import TcRnTypes+import Avail+#endif++import Data.List (isPrefixOf)++plugin :: Plugin+plugin =+  defaultPlugin+    { typeCheckResultAction = notExportPlugins,+      pluginRecompile = purePlugin+    }++notExportPlugins cmdOptions modSummary env = do+  let updated_tcg_exports = filter (\v -> not (isPrefixOf "inline_c_ffi" ((showSDocUnsafe . ppr . nameOccName . availName) v))) $ tcg_exports env+  return env {tcg_exports = updated_tcg_exports}
+ src/Torch/Internal/Unmanaged/Helper.hs view
@@ -0,0 +1,9 @@+{-# LANGUAGE ForeignFunctionInterface #-}++module Torch.Internal.Unmanaged.Helper where++import Foreign.Ptr++foreign import ccall "wrapper" callbackHelper :: (Ptr () -> IO (Ptr ())) -> IO (FunPtr (Ptr () -> IO (Ptr ())))++foreign import ccall "wrapper" callbackHelper2 :: (Ptr () -> Ptr () -> IO (Ptr ())) -> IO (FunPtr (Ptr () -> Ptr () -> IO (Ptr ())))