Module

Pinto.Monitor

This module wraps erlang:monitor in Pinto.MessageRouting so that sensible message structures can be sent back to the monitoring process

#monitor

monitor :: forall msg process m. HasPid process => MonadEffect m => HasSelf m msg => process -> (MonitorMsg -> msg) -> m (RouterRef MonitorRef)

Given something that has a pid (A GenServer, a Process.. or just a Pid), attach a monitor by using erlang:monitor on the underlying pid, a message will be sent to the current process, lifted into the constructor f provided

#monitorTo

monitorTo :: forall msg process target. HasPid process => HasProcess msg target => process -> target -> (MonitorMsg -> msg) -> Effect (RouterRef MonitorRef)

Given something that has a pid (A GenServer, a Process.. or just a Pid), attach a monitor by using erlang:monitor on the underlying pid, a message will be sent to the current process, lifted into the constructor f provided

#demonitor

demonitor :: RouterRef MonitorRef -> Effect Unit

Stops a monitor started with Monitor.monitor, using erlang:demonitor and subject to the same restrictions/caveats

#MonitorMsg

data MonitorMsg

Reference to a monitor, used to stop the monitor once it is started

Constructors

#MonitorType

data MonitorType

The type of monitor this message is being sent on behalf

Constructors

#MonitorRef

data MonitorRef

Reference to a monitor, used to stop the monitor once it is started

#MonitorObject

type MonitorObject = Foreign

This is probably a Pid, but until it is needed it will be Foreign

#MonitorInfo

type MonitorInfo = Foreign

The 'reason' for the monitor being invoked, if this needs unpacking then FFI will need to be written

Modules