-- | Erlang style processes with message passing concurrency based on
-- (more) @extensible-effects@.
module Control.Eff.Concurrent
  (
    -- * Concurrent Processes with Message Passing Concurrency
    module Control.Eff.Concurrent.Process
  ,
    -- * Data Types and Functions for APIs (aka Protocols)
    module Control.Eff.Concurrent.Api
  ,
    -- ** /Client/ Functions for Consuming APIs
    module Control.Eff.Concurrent.Api.Client
  ,
    -- ** /Server/ Functions for Providing APIs
    module Control.Eff.Concurrent.Api.Server
  ,
    -- ** /Observer/ Functions for Events and Event Listener
    module Control.Eff.Concurrent.Api.Observer
  ,
    -- * /Scheduler/ Process Effect Handler
    -- ** Concurrent Scheduler
    module Control.Eff.Concurrent.Process.ForkIOScheduler
  ,
    -- ** Single Threaded Scheduler
    module Control.Eff.Concurrent.Process.SingleThreadedScheduler
  ,
    -- * Utilities
    -- ** Logging Effect
    module Control.Eff.Log
  ,
    -- ** Preventing Space Leaks
    module Control.Eff.Loop
  )
where

import           Control.Eff.Concurrent.Process ( ProcessId(..)
                                                , fromProcessId
                                                , Process(..)
                                                , ConsProcess
                                                , ResumeProcess(..)
                                                , SchedulerProxy(..)
                                                , thisSchedulerProxy
                                                , executeAndCatch
                                                , executeAndResume
                                                , yieldProcess
                                                , sendMessage
                                                , sendMessageAs
                                                , sendMessageChecked
                                                , spawn
                                                , spawn_
                                                , receiveMessage
                                                , receiveMessageAs
                                                , receiveLoop
                                                , self
                                                , sendShutdown
                                                , sendShutdownChecked
                                                , exitWithError
                                                , exitNormally
                                                , raiseError
                                                , catchRaisedError
                                                , ignoreProcessError
                                                )
import           Control.Eff.Concurrent.Api
                                                ( Api
                                                , Synchronicity(..)
                                                , Server(..)
                                                , fromServer
                                                , proxyAsServer
                                                , asServer
                                                )
import           Control.Eff.Concurrent.Api.Client
                                                ( cast
                                                , castChecked
                                                , call
                                                , castRegistered
                                                , callRegistered
                                                , callRegisteredA
                                                , ServesApi
                                                , registerServer
                                                )
import           Control.Eff.Concurrent.Api.Server
                                                ( serve
                                                , ApiHandler(..)
                                                , unhandledCallError
                                                , unhandledCastError
                                                , defaultTermination
                                                , serveBoth
                                                , serve3
                                                , tryApiHandler
                                                , UnhandledRequest()
                                                , catchUnhandled
                                                , ensureAllHandled
                                                , requestFromDynamic
                                                , exitUnhandled
                                                )

import           Control.Eff.Concurrent.Api.Observer
                                                ( Observer(..)
                                                , Observable(..)
                                                , notifyObserver
                                                , registerObserver
                                                , forgetObserver
                                                , SomeObserver(..)
                                                , notifySomeObserver
                                                , Observers()
                                                , manageObservers
                                                , addObserver
                                                , removeObserver
                                                , notifyObservers
                                                , CallbackObserver
                                                , spawnCallbackObserver
                                                , spawnLoggingObserver
                                                )
import           Control.Eff.Concurrent.Process.ForkIOScheduler
                                                ( schedule
                                                , defaultMain
                                                , defaultMainWithLogChannel
                                                , SchedulerError(..)
                                                , SchedulerIO
                                                , forkIoScheduler
                                                , HasSchedulerIO
                                                )

import           Control.Eff.Concurrent.Process.SingleThreadedScheduler
                                                ( schedulePure )
import           Control.Eff.Log
import           Control.Eff.Loop