{-# LANGUAGE ExplicitNamespaces #-}

-- | This module defines the interface to HasChor. The client of the library is
-- highly recommended to only use constructs exported by this module.
module Choreography (
  -- * Locations and Located Values
  LocTm,
  LocTy,
  type (@),
  mkLoc,

  -- * The Choreo monad
  Choreo,
  -- ** Choreo operations
  locally,
  (~>),
  (~~>),
  cond,
  cond',

  -- * Message transport backends
  -- ** The HTTP backend
  Host,
  Port,
  HttpConfig,
   mkHttpConfig,

  -- * Running choreographies
  runChoreo,
  runChoreography
  ) where

import Choreography.Location
import Choreography.Choreo
import Choreography.Network
import Choreography.Network.Http
import Choreography.Network.Local
import Control.Monad.IO.Class
import Data.Proxy

-- | Run a choreography with a message transport backend.
runChoreography :: (Backend config, MonadIO m) => config -> Choreo m a -> LocTm -> m a
runChoreography :: forall config (m :: * -> *) a.
(Backend config, MonadIO m) =>
config -> Choreo m a -> LocTm -> m a
runChoreography config
cfg Choreo m a
choreo LocTm
l = forall c (m :: * -> *) a.
(Backend c, MonadIO m) =>
c -> LocTm -> Network m a -> m a
runNetwork config
cfg LocTm
l (forall (m :: * -> *) a. Choreo m a -> LocTm -> Network m a
epp Choreo m a
choreo LocTm
l)