emacs-module-0.1.1: Utilities to write Emacs dynamic modules

Copyright(c) Sergey Vinokurov 2018
LicenseBSD3-style (see LICENSE)
Maintainerserg.foo@gmail.com
Safe HaskellNone
LanguageHaskell2010

Emacs.Module

Contents

Description

This module is the entry point for writing Emacs extensions in Haskell.

This package, though provides a lot of wrapping around Emacs's bare C interface, still presumes some familiarity with said interface. Thus, when developnig Emacs modules it's recommended to keep a reference of the C interface around. One such reference is https://phst.github.io/emacs-modules.html.

Minimalistic example

Consider Emacs function

(defun foo (f x y z &optional w t &rest quux)
  (+ (funcall f (* x y z)) (* (or w 1) (or t 2)) (length quux)))

With help of this package, it may be defined as

{--}
{--}

import Data.Maybe
import Data.Emacs.Module.SymbolName.TH
import Emacs.Module

foo
  :: (MonadEmacs m, Monad (m s))
  => EmacsFunction ('S ('S ('S ('S 'Z)))) ('S ('S 'Z)) 'True s m
foo (R f (R x (R y (R z (O w (O t (Rest quux))))))) = do
  x'    <- extractInt x
  y'    <- extractInt y
  z'    <- extractInt z
  w'    <- traverse extractInt w
  t'    <- traverse extractInt t

  tmp   <- makeInt (x' * y' * z')
  tmp'  <- extractInt =<< funcall [esym|funcall|] [f, tmp]

  produceRef =<< makeInt (tmp' + fromMaybe 1 w' * fromMaybe 2 t' + length quux)

Creating Emacs dynamic module

In order to make shared object or dll callable from Emacs, a cabal project with foreign-library section has to be created. Please refer to https://github.com/sergv/emacs-module/tree/master/test for such a project.

Please note that this project will need a small C file for initialising Haskell runtime. In the project mentioned before it's present as https://github.com/sergv/emacs-module/blob/master/test/cbits/emacs_wrapper.c

Synopsis

EmacsM

data EmacsM s a Source #

Concrete monad for interacting with Emacs. It provides:

  1. Ability to call Emacs C functions and automatically rethrows any errors (non-local exits) from elisp as Haskell exceptions.
  2. Tracks ownership of any produced Emacs values and communicates that to Emacs, so that GC on Emacs side will not make any values in Haskell invalid (funnily enough, this can happen!).

Parameter s serves to make ownership-tracking capabilities possible. It's use is the same as in ST monad. That is, it creates local threads so that no produced Emacs values can leave past runEmacsM.

Instances
MonadBase IO (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

liftBase :: IO α -> EmacsM s α #

MonadBaseControl IO (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Associated Types

type StM (EmacsM s) a :: * #

Methods

liftBaseWith :: (RunInBase (EmacsM s) IO -> IO a) -> EmacsM s a #

restoreM :: StM (EmacsM s) a -> EmacsM s a #

Monad (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

(>>=) :: EmacsM s a -> (a -> EmacsM s b) -> EmacsM s b #

(>>) :: EmacsM s a -> EmacsM s b -> EmacsM s b #

return :: a -> EmacsM s a #

fail :: String -> EmacsM s a #

Functor (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

fmap :: (a -> b) -> EmacsM s a -> EmacsM s b #

(<$) :: a -> EmacsM s b -> EmacsM s a #

MonadFix (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

mfix :: (a -> EmacsM s a) -> EmacsM s a #

Applicative (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

pure :: a -> EmacsM s a #

(<*>) :: EmacsM s (a -> b) -> EmacsM s a -> EmacsM s b #

liftA2 :: (a -> b -> c) -> EmacsM s a -> EmacsM s b -> EmacsM s c #

(*>) :: EmacsM s a -> EmacsM s b -> EmacsM s b #

(<*) :: EmacsM s a -> EmacsM s b -> EmacsM s a #

MonadIO (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

liftIO :: IO a -> EmacsM s a #

MonadThrow (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

throwM :: Exception e => e -> EmacsM s a #

MonadCatch (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

catch :: Exception e => EmacsM s a -> (e -> EmacsM s a) -> EmacsM s a #

MonadMask (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

mask :: ((forall a. EmacsM s a -> EmacsM s a) -> EmacsM s b) -> EmacsM s b #

uninterruptibleMask :: ((forall a. EmacsM s a -> EmacsM s a) -> EmacsM s b) -> EmacsM s b #

generalBracket :: EmacsM s a -> (a -> ExitCase b -> EmacsM s c) -> (a -> EmacsM s b) -> EmacsM s (b, c) #

MonadResource (EmacsM s) Source # 
Instance details

Defined in Emacs.Module.Monad

Methods

liftResourceT :: ResourceT IO a -> EmacsM s a #

(Throws EmacsThrow, Throws EmacsError, Throws EmacsInternalError) => MonadEmacs EmacsM Source # 
Instance details

Defined in Emacs.Module.Monad

Associated Types

type EmacsRef EmacsM :: k -> Type Source #

type EmacsReturn EmacsM :: k -> Type Source #

Methods

produceRef :: EmacsRef EmacsM s -> EmacsM s (EmacsReturn EmacsM s) Source #

nonLocalExitCheck :: WithCallStack => EmacsM s (FuncallExit ()) Source #

nonLocalExitGet :: WithCallStack => EmacsM s (FuncallExit (EmacsRef EmacsM s, EmacsRef EmacsM s)) Source #

nonLocalExitSignal :: WithCallStack => EmacsRef EmacsM s -> [EmacsRef EmacsM s] -> EmacsM s () Source #

nonLocalExitThrow :: WithCallStack => EmacsRef EmacsM s -> EmacsRef EmacsM s -> EmacsM s () Source #

nonLocalExitClear :: WithCallStack => EmacsM s () Source #

freeValue :: WithCallStack => EmacsRef EmacsM s -> EmacsM s () Source #

makeFunctionExtra :: (WithCallStack, EmacsInvocation req opt rest, GetArities req opt rest) => (forall (s' :: k). (Throws EmacsThrow, Throws EmacsError, Throws EmacsInternalError, Throws UserError) => EmacsArgs req opt rest (EmacsRef EmacsM s') -> Ptr extra -> EmacsM s' (EmacsReturn EmacsM s')) -> ByteString -> Ptr extra -> EmacsM s (EmacsRef EmacsM s) Source #

funcall :: WithCallStack => SymbolName -> [EmacsRef EmacsM s] -> EmacsM s (EmacsRef EmacsM s) Source #

funcallPrimitive :: WithCallStack => SymbolName -> [EmacsRef EmacsM s] -> EmacsM s (EmacsRef EmacsM s) Source #

funcallPrimitive_ :: WithCallStack => SymbolName -> [EmacsRef EmacsM s] -> EmacsM s () Source #

intern :: WithCallStack => SymbolName -> EmacsM s (EmacsRef EmacsM s) Source #

typeOf :: WithCallStack => EmacsRef EmacsM s -> EmacsM s (EmacsRef EmacsM s) Source #

isNotNil :: WithCallStack => EmacsRef EmacsM s -> EmacsM s Bool Source #

eq :: WithCallStack => EmacsRef EmacsM s -> EmacsRef EmacsM s -> EmacsM s Bool Source #

extractWideInteger :: WithCallStack => EmacsRef EmacsM s -> EmacsM s Int64 Source #

makeWideInteger :: WithCallStack => Int64 -> EmacsM s (EmacsRef EmacsM s) Source #

extractDouble :: WithCallStack => EmacsRef EmacsM s -> EmacsM s Double Source #

makeDouble :: WithCallStack => Double -> EmacsM s (EmacsRef EmacsM s) Source #

extractString :: WithCallStack => EmacsRef EmacsM s -> EmacsM s ByteString Source #

makeString :: WithCallStack => ByteString -> EmacsM s (EmacsRef EmacsM s) Source #

extractUserPtr :: WithCallStack => EmacsRef EmacsM s -> EmacsM s (Ptr a) Source #

makeUserPtr :: WithCallStack => UserPtrFinaliser a -> Ptr a -> EmacsM s (EmacsRef EmacsM s) Source #

assignUserPtr :: WithCallStack => EmacsRef EmacsM s -> Ptr a -> EmacsM s () Source #

extractUserPtrFinaliser :: WithCallStack => EmacsRef EmacsM s -> EmacsM s (UserPtrFinaliser a) Source #

assignUserPtrFinaliser :: WithCallStack => EmacsRef EmacsM s -> UserPtrFinaliser a -> EmacsM s () Source #

vecGet :: WithCallStack => EmacsRef EmacsM s -> Int -> EmacsM s (EmacsRef EmacsM s) Source #

vecSet :: WithCallStack => EmacsRef EmacsM s -> Int -> EmacsRef EmacsM s -> EmacsM s () Source #

vecSize :: WithCallStack => EmacsRef EmacsM s -> EmacsM s Int Source #

type StM (EmacsM s) a Source # 
Instance details

Defined in Emacs.Module.Monad

type StM (EmacsM s) a
type EmacsRef EmacsM Source # 
Instance details

Defined in Emacs.Module.Monad

type EmacsReturn EmacsM Source # 
Instance details

Defined in Emacs.Module.Monad

runEmacsM :: Env -> (forall s. EmacsM s a) -> IO a Source #

Execute emacs interaction session using an environment supplied by Emacs.

Basic bindings

class MonadEmacs (m :: k -> Type -> Type) where Source #

A mtl-style typeclass for interacting with Emacs. Typeclass functions are mostly direct translations of emacs interface provided by 'emacs-module.h'.

For more functions please refer to Emacs.Module.Functions module.

Associated Types

type EmacsRef m :: k -> Type Source #

Emacs value that is managed by the m monad. Will be cleaned up after m finishes its execution.

type EmacsReturn m :: k -> Type Source #

Type of values that Haskell functions may returns to Emacs.

Methods

produceRef :: EmacsRef m s -> m s (EmacsReturn m s) Source #

Return an EmacsRef back to Emacs.

nonLocalExitCheck :: WithCallStack => m s (FuncallExit ()) Source #

Check whether a non-local exit is pending.

nonLocalExitGet :: WithCallStack => m s (FuncallExit (EmacsRef m s, EmacsRef m s)) Source #

Check whether a non-local exit is pending and get detailed data in case it is.

nonLocalExitSignal Source #

Arguments

:: WithCallStack 
=> EmacsRef m s

Error symbol

-> [EmacsRef m s]

Error data, will be converted to a list as Emacs API expects.

-> m s () 

Equivalent to Emacs's signal function.

NB if a non-local exit is alredy pending, this function will not overwrite it. In order to do that, use nonLocalExitClear.

nonLocalExitThrow Source #

Arguments

:: WithCallStack 
=> EmacsRef m s

Tag

-> EmacsRef m s

Data

-> m s () 

Equivalent to Emacs's throw function.

NB if a non-local exit is alredy pending, this function will not overwrite it. In order to do that, use nonLocalExitClear.

nonLocalExitClear :: WithCallStack => m s () Source #

Clean any pending local exits.

freeValue :: WithCallStack => EmacsRef m s -> m s () Source #

Make value eligible for collection during next GC within Emacs.

makeFunctionExtra Source #

Arguments

:: (WithCallStack, EmacsInvocation req opt rest, GetArities req opt rest) 
=> (forall s'. EmacsFunctionExtra req opt rest extra s' m)

Haskell function to export

-> ByteString

Documentation

-> Ptr extra

Extra data to be passed to the Haskell function

-> m s (EmacsRef m s) 

Make Haskell function available as an anonymoucs Emacs function. In order to be able to use it later from Emacs it should be fed into bindFunction.

NB Each call to this function produces a small memory leak that will not be freed up. Hence, try not to create unbounded number of functions. This happens because GHC has to generate some wrapping code to convert between ccall and Haskell calling convention each time a function is exported. It is possible to free this code after function will not be used, but it's currently not supported.

funcall Source #

Arguments

:: WithCallStack 
=> SymbolName

Function name

-> [EmacsRef m s]

Arguments

-> m s (EmacsRef m s) 

Invoke an Emacs function that may call back into Haskell.

funcallPrimitive Source #

Arguments

:: WithCallStack 
=> SymbolName

Function name

-> [EmacsRef m s]

Arguments

-> m s (EmacsRef m s) 

Invoke an Emacs function. The function should be simple and must not call back into Haskell.

funcallPrimitive_ Source #

Arguments

:: WithCallStack 
=> SymbolName

Function name

-> [EmacsRef m s]

Arguments

-> m s () 

Invoke an Emacs function and ignore its result. The function should be simple and must not call back into Haskell.

intern :: WithCallStack => SymbolName -> m s (EmacsRef m s) Source #

Convert a string to an Emacs symbol.

typeOf :: WithCallStack => EmacsRef m s -> m s (EmacsRef m s) Source #

Get type of an Emacs value as an Emacs symbol.

isNotNil :: WithCallStack => EmacsRef m s -> m s Bool Source #

Check whether Emacs value is not nil.

eq :: WithCallStack => EmacsRef m s -> EmacsRef m s -> m s Bool Source #

Primitive equality. Tests whether two symbols, integers or characters are the equal, but not much more. For more complete equality comparison do

funcallPrimitive [esym|equal|] [x, y]

extractWideInteger :: WithCallStack => EmacsRef m s -> m s Int64 Source #

Try to unpack a wide integer from a value.

makeWideInteger :: WithCallStack => Int64 -> m s (EmacsRef m s) Source #

Pack a wide integer for Emacs.

extractDouble :: WithCallStack => EmacsRef m s -> m s Double Source #

Try to unpack a floating-point number from a value.

makeDouble :: WithCallStack => Double -> m s (EmacsRef m s) Source #

Convert a floating-point number into Emacs value.

extractString :: WithCallStack => EmacsRef m s -> m s ByteString Source #

Extract string contents from an Emacs value.

makeString :: WithCallStack => ByteString -> m s (EmacsRef m s) Source #

Convert a utf8-encoded ByteString into an Emacs value.

extractUserPtr :: WithCallStack => EmacsRef m s -> m s (Ptr a) Source #

Extract a user pointer from an Emacs value.

makeUserPtr Source #

Arguments

:: WithCallStack 
=> UserPtrFinaliser a

Finalisation action that will be executed when user pointer gets garbage-collected by Emacs.

-> Ptr a 
-> m s (EmacsRef m s) 

Pack a user pointer into an Emacs value.

assignUserPtr :: WithCallStack => EmacsRef m s -> Ptr a -> m s () Source #

Set user pointer to a new value

extractUserPtrFinaliser :: WithCallStack => EmacsRef m s -> m s (UserPtrFinaliser a) Source #

Extract a finaliser from an user_ptr.

assignUserPtrFinaliser :: WithCallStack => EmacsRef m s -> UserPtrFinaliser a -> m s () Source #

Assign new finaliser into an user_ptr.

vecGet :: WithCallStack => EmacsRef m s -> Int -> m s (EmacsRef m s) Source #

Extract an element from an Emacs vector.

vecSet Source #

Arguments

:: WithCallStack 
=> EmacsRef m s

Vector

-> Int

Index

-> EmacsRef m s

New value

-> m s () 

Assign an element into an Emacs vector.

vecSize :: WithCallStack => EmacsRef m s -> m s Int Source #

Get size of an Emacs vector.

Instances
(Throws EmacsThrow, Throws EmacsError, Throws EmacsInternalError) => MonadEmacs EmacsM Source # 
Instance details

Defined in Emacs.Module.Monad

Associated Types

type EmacsRef EmacsM :: k -> Type Source #

type EmacsReturn EmacsM :: k -> Type Source #

Methods

produceRef :: EmacsRef EmacsM s -> EmacsM s (EmacsReturn EmacsM s) Source #

nonLocalExitCheck :: WithCallStack => EmacsM s (FuncallExit ()) Source #

nonLocalExitGet :: WithCallStack => EmacsM s (FuncallExit (EmacsRef EmacsM s, EmacsRef EmacsM s)) Source #

nonLocalExitSignal :: WithCallStack => EmacsRef EmacsM s -> [EmacsRef EmacsM s] -> EmacsM s () Source #

nonLocalExitThrow :: WithCallStack => EmacsRef EmacsM s -> EmacsRef EmacsM s -> EmacsM s () Source #

nonLocalExitClear :: WithCallStack => EmacsM s () Source #

freeValue :: WithCallStack => EmacsRef EmacsM s -> EmacsM s () Source #

makeFunctionExtra :: (WithCallStack, EmacsInvocation req opt rest, GetArities req opt rest) => (forall (s' :: k). (Throws EmacsThrow, Throws EmacsError, Throws EmacsInternalError, Throws UserError) => EmacsArgs req opt rest (EmacsRef EmacsM s') -> Ptr extra -> EmacsM s' (EmacsReturn EmacsM s')) -> ByteString -> Ptr extra -> EmacsM s (EmacsRef EmacsM s) Source #

funcall :: WithCallStack => SymbolName -> [EmacsRef EmacsM s] -> EmacsM s (EmacsRef EmacsM s) Source #

funcallPrimitive :: WithCallStack => SymbolName -> [EmacsRef EmacsM s] -> EmacsM s (EmacsRef EmacsM s) Source #

funcallPrimitive_ :: WithCallStack => SymbolName -> [EmacsRef EmacsM s] -> EmacsM s () Source #

intern :: WithCallStack => SymbolName -> EmacsM s (EmacsRef EmacsM s) Source #

typeOf :: WithCallStack => EmacsRef EmacsM s -> EmacsM s (EmacsRef EmacsM s) Source #

isNotNil :: WithCallStack => EmacsRef EmacsM s -> EmacsM s Bool Source #

eq :: WithCallStack => EmacsRef EmacsM s -> EmacsRef EmacsM s -> EmacsM s Bool Source #

extractWideInteger :: WithCallStack => EmacsRef EmacsM s -> EmacsM s Int64 Source #

makeWideInteger :: WithCallStack => Int64 -> EmacsM s (EmacsRef EmacsM s) Source #

extractDouble :: WithCallStack => EmacsRef EmacsM s -> EmacsM s Double Source #

makeDouble :: WithCallStack => Double -> EmacsM s (EmacsRef EmacsM s) Source #

extractString :: WithCallStack => EmacsRef EmacsM s -> EmacsM s ByteString Source #

makeString :: WithCallStack => ByteString -> EmacsM s (EmacsRef EmacsM s) Source #

extractUserPtr :: WithCallStack => EmacsRef EmacsM s -> EmacsM s (Ptr a) Source #

makeUserPtr :: WithCallStack => UserPtrFinaliser a -> Ptr a -> EmacsM s (EmacsRef EmacsM s) Source #

assignUserPtr :: WithCallStack => EmacsRef EmacsM s -> Ptr a -> EmacsM s () Source #

extractUserPtrFinaliser :: WithCallStack => EmacsRef EmacsM s -> EmacsM s (UserPtrFinaliser a) Source #

assignUserPtrFinaliser :: WithCallStack => EmacsRef EmacsM s -> UserPtrFinaliser a -> EmacsM s () Source #

vecGet :: WithCallStack => EmacsRef EmacsM s -> Int -> EmacsM s (EmacsRef EmacsM s) Source #

vecSet :: WithCallStack => EmacsRef EmacsM s -> Int -> EmacsRef EmacsM s -> EmacsM s () Source #

vecSize :: WithCallStack => EmacsRef EmacsM s -> EmacsM s Int Source #

Define functions callable by Emacs

type EmacsFunction req opt rest (s :: k) (m :: k -> Type -> Type) = (Throws EmacsThrow, Throws EmacsError, Throws EmacsInternalError, Throws UserError) => EmacsArgs req opt rest (EmacsRef m s) -> m s (EmacsReturn m s) Source #

Basic Haskell function that can be called by Emacs.

type EmacsFunctionExtra req opt rest extra (s :: k) (m :: k -> Type -> Type) = (Throws EmacsThrow, Throws EmacsError, Throws EmacsInternalError, Throws UserError) => EmacsArgs req opt rest (EmacsRef m s) -> Ptr extra -> m s (EmacsReturn m s) Source #

A Haskell functions that is callable by Emacs.

This type differs from EmacsFunction in that it has an extra parameter which will result in an additional pointer being passed to this function when it's called by Emacs. Contents of the pointer is specified when function is exported to Emacs.

data Nat Source #

Type-level Peano numbers.

Indented to be used with DataKinds extension enabled.

Constructors

Z 
S Nat 

data R a b Source #

Required argument of an exported function.

Constructors

R !a !b 

data O a b Source #

Optional argument of an exported function.

Constructors

O !(Maybe a) !b 

newtype Rest a Source #

All other arguments of an exported function as a list.

Constructors

Rest [a] 

data Stop a Source #

End of argument list of an exported funciton.

Constructors

Stop 

Error types

data EmacsError Source #

A high-level error thrown when an Emacs function fails.

data EmacsInternalError Source #

A low-level error thrown when assumptions of this package are violated and it's not safe to proceed further.

reportAllErrorsToEmacs Source #

Arguments

:: Env 
-> IO a

Result to return on error.

-> ((Throws EmacsInternalError, Throws EmacsError, Throws UserError, Throws EmacsThrow) => IO a) 
-> IO a 

Catch all errors this package might throw in an IO action and make Emacs aware of them.

This is a convenience function intended to be used around exported initialise entry point into an Emacs module.

Other types

Reexports

data Env Source #

Emacs environment, right from the 'emacs-module.h'.

Third-party reexports

class Monad m => MonadThrow (m :: * -> *) #

A class for monads in which exceptions may be thrown.

Instances should obey the following law:

throwM e >> x = throwM e

In other words, throwing an exception short-circuits the rest of the monadic computation.

Minimal complete definition

throwM

Instances
MonadThrow [] 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> [a] #

MonadThrow Maybe 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Maybe a #

MonadThrow IO 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> IO a #

MonadThrow Q 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Q a #

MonadThrow STM 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> STM a #

e ~ SomeException => MonadThrow (Either e) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> Either e a #

MonadThrow m => MonadThrow (MaybeT m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> MaybeT m a #

MonadThrow m => MonadThrow (ListT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ListT m a #

MonadThrow m => MonadThrow (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

throwM :: Exception e => e -> ResourceT m a #

MonadThrow (EmacsM s) # 
Instance details

Defined in Emacs.Module.Monad

Methods

throwM :: Exception e => e -> EmacsM s a #

MonadThrow m => MonadThrow (ExceptT e m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ExceptT e m a #

(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> WriterT w m a #

MonadThrow m => MonadThrow (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> StateT s m a #

(Error e, MonadThrow m) => MonadThrow (ErrorT e m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ErrorT e m a #

MonadThrow m => MonadThrow (IdentityT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> IdentityT m a #

MonadThrow m => MonadThrow (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> StateT s m a #

(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> WriterT w m a #

MonadThrow m => MonadThrow (ReaderT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ReaderT r m a #

MonadThrow m => MonadThrow (ContT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ContT r m a #

(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> RWST r w s m a #

(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> RWST r w s m a #

class X e => Throws e #

A Throws e constraint indicates a computation may throw synchronous exception e. Introduce a constraint with throw, and discharge it with catch.

You may ignore the X superclass; it exists only to prevent additional Throws instances from being created.

Instances
Throws (Catch a) 
Instance details

Defined in Control.Exception.Safe.Checked