-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | pdynload is polymorphic dynamic linking library. -- -- This package use GHC-API implement polymorphic dynamic loading -- function -- pdynload. Because pdynload invoke the regular type checker -- at runtime, so pdynload is perfectly safety and does not inhibit the -- use of any features of the type system. @package pdynload @version 0.0.2 module System.Plugin -- | Polymorphic dynamic loading. -- -- Resolves the specified symbol to any given type. This means linking -- the package containing it if it is not already linked, extracting the -- value of that symbol, and returning that value. -- -- Here has simplest demo for test: -- --
-- module Main where
--
-- import System.Plugin
-- import Unsafe.Coerce
--
-- main = do
-- val <- pdynload ("Prelude", "reverse") ("", "String -> String")
-- let str = case val of
-- Just v -> (unsafeCoerce v :: String -> String) "hello"
-- Nothing -> "Load failed."
-- print str
--
--
-- Because pdynload check type at runtime, so don't afraid
-- unsafeCoerce, it is perfect safety.
pdynload :: (String, String) -> (String, String) -> IO (Maybe a)
instance Show TypeCheckStatus
instance Eq TypeCheckStatus
instance Ord TypeCheckStatus