HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulehslua-classes-2.3.1Haskell2010

HsLua.Class.Exposable

Call Haskell functions from Lua.

  • 1 class
  • 3 values
classclass LuaError e => Exposable e a where
#

Operations and functions that can be pushed to the Lua stack. This is a helper function not intended to be used directly. Use the toHaskellFunction wrapper instead.

Methods

  • partialApply :: StackIndex -> a -> Peek e NumResults

    Helper function, called by toHaskellFunction. Should do a partial application of the argument at the given index to the underlying function. Recurses if necessary, causing further partial applications until the operation is a easily exposable to Lua.

Instances4Exposable
valuetoHaskellFunction :: Exposable e a => a -> HaskellFunction e
#

Convert a Haskell function to a function type directly exposable to Lua. Any Haskell function can be converted provided that:

  • all arguments are instances of Peekable

  • return type is LuaE e a, where a is an instance of Pushable

Any exception of type e will be caught.

Important: this does not catch exceptions other than e; exception handling must be done by the Haskell function. Failure to do so will cause the program to crash.

E.g., the following code could be used to handle an Exception of type FooException, if that type is an instance of MonadCatch and Pushable:

toHaskellFunction (myFun `catchM` (\e -> raiseError (e :: FooException)))