Node.WorkerBees
- Package
- purescript-node-workerbees
- Repository
- natefaubion/purescript-node-workerbees
#WorkerThread Source
data WorkerThread t0
#makeAsMain Source
makeAsMain :: forall a i o. Sendable o => WorkerConstructor a i o -> Effect Unit
Implements the worker code that can later be called via the
unsafeWorkerFromPath
function. This code must be bundled such that
main
is actually called in the file.
#unsafeWorkerFromPath Source
unsafeWorkerFromPath :: forall a i o. Sendable o => String -> Worker a i o
Builds a new worker given a path to the compiled code constituting the main
function that should execute in the worker. The worker code should be created
using makeAsMain
. The path must be either an absolute path or a relative
path that begins with ./ or ../
unsafeWorkerFromPath "./output/My.Bundled.Output/index.js"
#lift Source
lift :: forall e a b. (a -> b) -> WorkerConstructor e a b
#liftReader Source
liftReader :: forall e a b. (a -> Reader e b) -> WorkerConstructor e a b
#liftEffect Source
liftEffect :: forall e a b. (a -> Effect b) -> WorkerConstructor e a b
#liftReaderT Source
liftReaderT :: forall e a b. (a -> ReaderT e Effect b) -> WorkerConstructor e a b
#post Source
post :: forall i. Sendable i => i -> WorkerThread i -> Effect Unit
Sends some input to a worker thread to process.
#Sendable Source
class Sendable (a :: Type)
Only Sendable things can be sent back and forth between a worker thread and its parent. These include things that are represented by JavaScript primitives. Arbitrary PureScript values cannot be sent, but variants, records and newtypes of these things can. If you have a newtype of some Sendable, you must wrap it.
Instances
Sendable Int
Sendable Number
Sendable String
Sendable Boolean
(Sendable a) => Sendable (Array a)
(Sendable a) => Sendable (Object a)
(RowToList r rl, SendableRowList rl) => Sendable (Record r)
(RowToList r rl, SendableRowList rl) => Sendable (Variant r)
Sendable (SendWrapper a)
Sendable Json
Sendable Unit
Sendable Void
Sendable ArrayBuffer
(Fail (Beside (Quote a) (Text " is not known to be Sendable"))) => Sendable a
#SendableRowList Source
class SendableRowList :: RowList Type -> Constraint
class SendableRowList (rl :: RowList Type)
Instances
SendableRowList Nil
(Sendable a, SendableRowList rest) => SendableRowList (Cons sym a rest)
#unsafeWrap Source
unsafeWrap :: forall a. a -> SendWrapper a
Use with care. If you send something that isn't actually Sendable, it will raise an exception.
#unwrap Source
unwrap :: forall a. SendWrapper a -> a