safe-plugins-0.1: A small wrapper over hs-plugins to allow loading safe plugins

Safe HaskellNone

System.Plugins.Safe

Synopsis

Documentation

data Extension

This represents language extensions beyond a base Language definition (such as Haskell98) that are supported by some implementations, usually in some special mode.

type Arg = String

type Symbol = String

data LoadStatus a

The LoadStatus type encodes the return status of functions that perform dynamic loading in a type isomorphic to Either. Failure returns a list of error strings, success returns a reference to a loaded module, and the Haskell value corresponding to the symbol that was indexed.

loadOneValueSource

Arguments

:: [Arg]

Any command-line arguments for compiler

-> [FilePath]

Include paths

-> FilePath

Source file name

-> [Extension]

Language extensions to enable

-> [String]

Force this modules to be imported by plugin

-> [String]

Allow to import this modules

-> Symbol

Symbol to load

-> IO (LoadStatus a) 

Load one specified symbol from Haskell source file. That source will be:

  • Forced to use specified language extensions;
  • Forced to import specified modules;
  • Allowed to import specified set of modules;
  • Forbidden to import any other modules;
  • Forbidden to use any FFI declarations.

Unsafe declarations will be simply removed from module.

WARNING: source file name should start with capital letter.