-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Stack of error, reader, writer, state, and prompt monad transformers
--
-- Please see the README on GitHub at
-- https://github.com/nbloomf/script-monad#readme
@package script-monad
@version 0.0.4
-- | ScriptT is an unrolled stack of reader, writer, state, error,
-- and prompt monad transformers, meant as a basis for building more
-- specific DSLs. Also comes in "monad transformer transformer" flavor
-- with ScriptTT.
--
-- The addition of prompt to the monad team makes it straightforward to
-- build effectful computations which defer the actual effects (and
-- effect types) to an evaluator function that is both precisely
-- controlled and easily extended. This allows us to build testable and
-- composable API layers.
--
-- The name "script" is meant to evoke the script of a play. In the
-- theater sense a script is not a list of instructions so much as
-- a list of suggestions, and every cast gives a unique
-- interpretation. Similarly a 'ScriptT eff a' is a pure value that gets
-- an effectful interpretation in monad eff from a user-supplied
-- evaluator.
module Control.Monad.Script
-- | Opaque stack of error (e), reader (r), writer
-- (w), state (s), and prompt (p) monad
-- transformers.
type ScriptT e r w s p = ScriptTT e r w s p IdentityT
-- | Opaque stack of error (e), reader (r), writer
-- (w), state (s), and prompt (p) monad
-- transformers, accepting a monad transformer parameter (t).
-- Behaves something like a monad transformer transformer.
data ScriptTT (e :: *) (r :: *) (w :: *) (s :: *) (p :: * -> *) (t :: (* -> *) -> * -> *) (eff :: * -> *) (a :: *)
-- | Execute a ScriptTT with a specified inital state and
-- environment and with a specified prompt evaluator into the effect
-- monad eff.
execScriptTT :: (Monad eff, Monad (t eff), MonadTrans t) => s -> r -> (forall u. p u -> eff u) -> ScriptTT e r w s p t eff a -> t eff (Either e a, s, w)
-- | Lift a value from the inner transformer.
liftScriptTT :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => t eff a -> ScriptTT e r w s p t eff a
-- | Inject an Either into a Script.
except :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => Either e a -> ScriptTT e r w s p t eff a
-- | Run an action, applying a function to any error.
triage :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => (e1 -> e2) -> ScriptTT e1 r w s p t eff a -> ScriptTT e2 r w s p t eff a
-- | Raise an error.
throw :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => e -> ScriptTT e r w s p t eff a
-- | Run an action, applying a handler in case of an error result.
catch :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => ScriptTT e r w s p t eff a -> (e -> ScriptTT e r w s p t eff a) -> ScriptTT e r w s p t eff a
-- | Retrieve the environment.
ask :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => ScriptTT e r w s p t eff r
-- | Run an action with a locally adjusted environment of the same type.
local :: (Monad eff, Monad (t eff), MonadTrans t) => (r -> r) -> ScriptTT e r w s p t eff a -> ScriptTT e r w s p t eff a
-- | Run an action with a locally adjusted environment of a possibly
-- different type.
transport :: (Monad eff, Monad (t eff), MonadTrans t) => (r2 -> r1) -> ScriptTT e r1 w s p t eff a -> ScriptTT e r2 w s p t eff a
-- | Retrieve the image of the environment under a given function.
reader :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t, Monad (t eff)) => (r -> a) -> ScriptTT e r w s p t eff a
-- | Write to the log.
tell :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => w -> ScriptTT e r w s p t eff ()
-- | Run an action and attach the log to the result, setting the log to
-- mempty.
draft :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => ScriptTT e r w s p t eff a -> ScriptTT e r w s p t eff (a, w)
-- | Run an action and attach the log to the result.
listen :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => ScriptTT e r w s p t eff a -> ScriptTT e r w s p t eff (a, w)
-- | Run an action that returns a value and a log-adjusting function, and
-- apply the function to the local log.
pass :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => ScriptTT e r w s p t eff (a, w -> w) -> ScriptTT e r w s p t eff a
-- | Run an action, applying a function to the local log.
censor :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => (w -> w) -> ScriptTT e r w s p t eff a -> ScriptTT e r w s p t eff a
-- | Retrieve the current state.
get :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => ScriptTT e r w s p t eff s
-- | Replace the state.
put :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => s -> ScriptTT e r w s p t eff ()
-- | Modify the current state lazily.
modify :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => (s -> s) -> ScriptTT e r w s p t eff ()
-- | Modify the current state strictly.
modify' :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => (s -> s) -> ScriptTT e r w s p t eff ()
-- | Retrieve the image of the current state under a given function.
gets :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => (s -> a) -> ScriptTT e r w s p t eff a
-- | Inject an atomic effect.
prompt :: (Monoid w, Monad eff, Monad (t eff), MonadTrans t) => p a -> ScriptTT e r w s p t eff a
-- | Turn a ScriptTT with a monadic evaluator into a
-- Property; for testing with QuickCheck. Wraps
-- execScriptTT.
checkScriptTT :: forall eff t q prop e r w s p a. (Monad eff, Monad (t eff), MonadTrans t, Show q, Testable prop) => s -> r -> (forall u. p u -> eff u) -> (t eff (Either e a, s, w) -> IO q) -> (q -> prop) -> ScriptTT e r w s p t eff a -> Property
instance (GHC.Base.Monoid w, GHC.Base.Monad eff, GHC.Base.Monad (t eff), Control.Monad.Trans.Class.MonadTrans t) => GHC.Base.Monad (Control.Monad.Script.ScriptTT e r w s p t eff)
instance (GHC.Base.Monoid w, GHC.Base.Monad eff, GHC.Base.Monad (t eff), Control.Monad.Trans.Class.MonadTrans t, Control.Monad.Fail.MonadFail (t eff)) => Control.Monad.Fail.MonadFail (Control.Monad.Script.ScriptTT e r w s p t eff)
instance (GHC.Base.Monoid w, GHC.Base.Monad eff, GHC.Base.Monad (t eff), Control.Monad.Trans.Class.MonadTrans t) => GHC.Base.Applicative (Control.Monad.Script.ScriptTT e r w s p t eff)
instance (GHC.Base.Monoid w, GHC.Base.Monad eff, GHC.Base.Monad (t eff), Control.Monad.Trans.Class.MonadTrans t) => GHC.Base.Functor (Control.Monad.Script.ScriptTT e r w s p t eff)
instance (GHC.Base.Monoid w, forall (m :: * -> *). GHC.Base.Monad m => GHC.Base.Monad (t m), Control.Monad.Trans.Class.MonadTrans t) => Control.Monad.Trans.Class.MonadTrans (Control.Monad.Script.ScriptTT e r w s p t)
instance (GHC.Base.Monoid w, GHC.Base.Monad eff, forall (m :: * -> *). GHC.Base.Monad m => GHC.Base.Monad (t m), Control.Monad.Trans.Class.MonadTrans t, Test.QuickCheck.Arbitrary.Arbitrary a, Test.QuickCheck.Arbitrary.CoArbitrary a) => Test.QuickCheck.Arbitrary.Arbitrary (Control.Monad.Script.ScriptTT e r w s p t eff a)
instance GHC.Show.Show (Control.Monad.Script.ScriptTT e r w s p t eff a)
-- | A fake filesystem for testing.
module Data.MockIO.FileSystem
-- | A mapping from "handles" of type a to lists of lines.
data FileSystem a
FileSystem :: [File a] -> FileSystem a
-- | Abstraction of a text file consisting of a "handle" and a list of
-- lines.
data File a
File :: a -> [Text] -> File a
-- | File "handle"
[_fileHandle] :: File a -> a
-- | List of lines
[_fileContents] :: File a -> [Text]
-- | No files; populate with writeLines or appendLines.
emptyFileSystem :: FileSystem a
-- | Detect whether a file with the given handle exists.
fileExists :: Eq a => a -> FileSystem a -> Bool
-- | Detect whether a file with the given handle exists and has given
-- contents.
hasFile :: Eq a => a -> [Text] -> FileSystem a -> Bool
-- | Delete a file; if no such file exists, has no effect.
deleteFile :: Eq a => a -> FileSystem a -> FileSystem a
-- | Retrieve the contents of a file, or nothing if the file does not
-- exist.
getLines :: Eq a => a -> FileSystem a -> Maybe [Text]
-- | Overwrite the contents of a file.
writeLines :: Eq a => a -> [Text] -> FileSystem a -> FileSystem a
-- | Append to a file.
appendLines :: Eq a => a -> [Text] -> FileSystem a -> FileSystem a
-- | Read the first line of a file.
readLine :: Eq a => e -> e -> a -> FileSystem a -> Either e (Text, FileSystem a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.MockIO.FileSystem.File a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.MockIO.FileSystem.FileSystem a)
instance GHC.Show.Show a => GHC.Show.Show (Data.MockIO.FileSystem.FileSystem a)
instance (GHC.Classes.Eq a, Test.QuickCheck.Arbitrary.Arbitrary a) => Test.QuickCheck.Arbitrary.Arbitrary (Data.MockIO.FileSystem.FileSystem a)
instance GHC.Show.Show a => GHC.Show.Show (Data.MockIO.FileSystem.File a)
-- | A fake IO monad for testing.
module Data.MockIO
-- | A state monad over MockWorld.
data MockIO s a
MockIO :: (MockWorld s -> (a, MockWorld s)) -> MockIO s a
[runMockIO] :: MockIO s a -> MockWorld s -> (a, MockWorld s)
-- | Retrieve the current MockWorld.
getMockWorld :: MockIO s (MockWorld s)
-- | Replace the current MockWorld.
putMockWorld :: MockWorld s -> MockIO s ()
-- | Mutate the current MockWorld strictly.
modifyMockWorld :: (MockWorld s -> MockWorld s) -> MockIO s ()
-- | Bump the timer by a given number of microseconds.
incrementTimer :: Int -> MockIO s ()
-- | Just enough state to mock out a basic filesystem and HTTP server.
data MockWorld s
MockWorld :: FileSystem (Either FilePath Handle) -> UTCTime -> (Text -> MockNetwork s HttpResponse) -> (Text -> ByteString -> MockNetwork s HttpResponse) -> (Text -> MockNetwork s HttpResponse) -> MockServer s -> MockWorld s
[_files] :: MockWorld s -> FileSystem (Either FilePath Handle)
[_time] :: MockWorld s -> UTCTime
[_httpGet] :: MockWorld s -> Text -> MockNetwork s HttpResponse
[_httpPost] :: MockWorld s -> Text -> ByteString -> MockNetwork s HttpResponse
[_httpDelete] :: MockWorld s -> Text -> MockNetwork s HttpResponse
[_serverState] :: MockWorld s -> MockServer s
-- | Type representing the internal state of an HTTP server.
newtype MockServer s
MockServer :: s -> MockServer s
[unMockServer] :: MockServer s -> s
-- | 1970-01-01 00:00:00
epoch :: UTCTime
-- | Empty filesystem and trivial HTTP responses
basicMockWorld :: s -> MockWorld s
-- | State monad representing network interaction.
data MockNetwork s a
MockNetwork :: (MockServer s -> (Either HttpException a, MockServer s)) -> MockNetwork s a
[unMockNetwork] :: MockNetwork s a -> MockServer s -> (Either HttpException a, MockServer s)
-- | Throw an HttpException.
errorMockNetwork :: HttpException -> MockNetwork s a
-- | Retrieve the internal state of the fake HTTP server.
getMockServer :: MockNetwork s s
-- | Replace the internal state of the fake HTTP server.
putMockServer :: s -> MockNetwork s ()
-- | Mutate the internal state of the fake HTTP server (strictly).
modifyMockServer :: (s -> s) -> MockNetwork s ()
-- | Status 200; no headers
_200ok :: ByteString -> HttpResponse
-- | Status 400; no headers
_400badRequest :: ByteString -> HttpResponse
-- | Status 404; no headers
_404notFound :: ByteString -> HttpResponse
-- | Status 405; no headers
_405methodNotAllowed :: ByteString -> HttpResponse
-- | Status 408; no headers
_408requestTimeout :: ByteString -> HttpResponse
-- | Status 500; no headers
_500internalServerError :: ByteString -> HttpResponse
instance GHC.Show.Show s => GHC.Show.Show (Data.MockIO.MockServer s)
instance GHC.Classes.Eq s => GHC.Classes.Eq (Data.MockIO.MockServer s)
instance GHC.Base.Monad (Data.MockIO.MockIO s)
instance GHC.Base.Applicative (Data.MockIO.MockIO s)
instance GHC.Base.Functor (Data.MockIO.MockIO s)
instance GHC.Show.Show (Data.MockIO.MockIO s a)
instance Test.QuickCheck.Arbitrary.Arbitrary a => Test.QuickCheck.Arbitrary.Arbitrary (Data.MockIO.MockIO s a)
instance GHC.Classes.Eq s => GHC.Classes.Eq (Data.MockIO.MockWorld s)
instance GHC.Show.Show s => GHC.Show.Show (Data.MockIO.MockWorld s)
instance Test.QuickCheck.Arbitrary.Arbitrary s => Test.QuickCheck.Arbitrary.Arbitrary (Data.MockIO.MockWorld s)
instance Test.QuickCheck.Arbitrary.CoArbitrary s => Test.QuickCheck.Arbitrary.CoArbitrary (Data.MockIO.MockWorld s)
instance GHC.Base.Monad (Data.MockIO.MockNetwork s)
instance GHC.Base.Applicative (Data.MockIO.MockNetwork s)
instance GHC.Base.Functor (Data.MockIO.MockNetwork s)
instance GHC.Show.Show (Data.MockIO.MockNetwork s a)
instance Test.QuickCheck.Arbitrary.Arbitrary a => Test.QuickCheck.Arbitrary.Arbitrary (Data.MockIO.MockNetwork s a)
-- | A basic type and monad transformer transformer for describing HTTP
-- interactions.
module Control.Monad.Script.Http
-- | An HTTP session returning an a, writing to a log of type
-- W e w, reading from an environment of type R e w r,
-- with state of type S s, throwing errors of type E e,
-- performing effectful computations described by P p a, with
-- inner monad eff. HttpTT over IdentityT.
type HttpT e r w s p = HttpTT e r w s p IdentityT
-- | An HTTP session returning an a, writing to a log of type
-- W e w, reading from an environment of type R e w r,
-- with state of type S s, throwing errors of type E e,
-- performing effectful computations described by P p a, and
-- with inner monad t eff.
data HttpTT e r w s p t eff a
-- | Execute an HttpTT session.
execHttpTT :: (Monad eff, Monad (t eff), MonadTrans t) => S s -> R e w r -> (forall u. P p u -> eff u) -> HttpTT e r w s p t eff a -> t eff (Either (E e) a, S s, W e w)
-- | Lift a value from the inner transformer.
liftHttpTT :: (Monad eff, Monad (t eff), MonadTrans t) => t eff a -> HttpTT e r w s p t eff a
-- | Also logs the exception.
throwError :: (Monad eff, Monad (t eff), MonadTrans t) => e -> HttpTT e r w s p t eff a
-- | Also logs the exception.
throwJsonError :: (Monad eff, Monad (t eff), MonadTrans t) => JsonError -> HttpTT e r w s p t eff a
-- | Also logs the exception.
throwHttpException :: (Monad eff, Monad (t eff), MonadTrans t) => HttpException -> HttpTT e r w s p t eff a
-- | Also logs the exception.
throwIOException :: (Monad eff, Monad (t eff), MonadTrans t) => IOException -> HttpTT e r w s p t eff a
-- | Re-throws other error types.
catchError :: (Monad eff, Monad (t eff), MonadTrans t) => HttpTT e r w s p t eff a -> (e -> HttpTT e r w s p t eff a) -> HttpTT e r w s p t eff a
-- | Re-throws other error types.
catchJsonError :: (Monad eff, Monad (t eff), MonadTrans t) => HttpTT e r w s p t eff a -> (JsonError -> HttpTT e r w s p t eff a) -> HttpTT e r w s p t eff a
-- | Re-throws other error types.
catchHttpException :: (Monad eff, Monad (t eff), MonadTrans t) => HttpTT e r w s p t eff a -> (HttpException -> HttpTT e r w s p t eff a) -> HttpTT e r w s p t eff a
-- | Re-throws other error types.
catchIOException :: (Monad eff, Monad (t eff), MonadTrans t) => HttpTT e r w s p t eff a -> (IOException -> HttpTT e r w s p t eff a) -> HttpTT e r w s p t eff a
-- | Handle any thrown error. To handle only errors of a specific type, see
-- catchError, catchJsonError,
-- catchIOException, or catchHttpException.
catchAnyError :: (Monad eff, Monad (t eff), MonadTrans t) => HttpTT e r w s p t eff a -> (e -> HttpTT e r w s p t eff a) -> (HttpException -> HttpTT e r w s p t eff a) -> (IOException -> HttpTT e r w s p t eff a) -> (JsonError -> HttpTT e r w s p t eff a) -> HttpTT e r w s p t eff a
-- | Pretty printer for errors
printError :: (e -> Text) -> E e -> Text
-- | Error type.
data E e
E_Http :: HttpException -> E e
E_IO :: IOException -> E e
E_Json :: JsonError -> E e
-- | Client-supplied error type.
E :: e -> E e
-- | Retrieve the environment.
ask :: (Monad eff, Monad (t eff), MonadTrans t) => HttpTT e r w s p t eff (R e w r)
-- | Run an action with a locally adjusted environment of the same type.
local :: (Monad eff, Monad (t eff), MonadTrans t) => (R e w r -> R e w r) -> HttpTT e r w s p t eff a -> HttpTT e r w s p t eff a
-- | Retrieve the image of the environment under a given function.
reader :: (Monad eff, Monad (t eff), MonadTrans t) => (R e w r -> a) -> HttpTT e r w s p t eff a
-- | Generic session environment.
data R e w r
R :: LogOptions e w -> (LogOptions e w -> LogEntry e w -> Maybe Text) -> Handle -> Maybe (MVar ()) -> Text -> (HttpException -> Maybe e) -> r -> R e w r
[_logOptions] :: R e w r -> LogOptions e w
-- | Printer for log entries.
[_logEntryPrinter] :: R e w r -> LogOptions e w -> LogEntry e w -> Maybe Text
-- | Handle for printing logs
[_logHandle] :: R e w r -> Handle
-- | Lock used to prevent race conditions when writing to the log.
[_logLock] :: R e w r -> Maybe (MVar ())
-- | Identifier string for the session; used to help match log entries
-- emitted by the same session.
[_uid] :: R e w r -> Text
-- | Function for elevating HttpExceptions to a client-supplied
-- error type.
[_httpErrorInject] :: R e w r -> HttpException -> Maybe e
-- | Client-supplied environment type.
[_env] :: R e w r -> r
-- | Environment constructor
basicEnv :: (Show e, Show w) => r -> R e w r
-- | Environment constructor
trivialEnv :: r -> R e w r
-- | Options for tweaking the logs.
data LogOptions e w
LogOptions :: Bool -> Bool -> Bool -> LogSeverity -> Bool -> (Bool -> e -> Text) -> (Bool -> w -> Text) -> LogOptions e w
-- | Toggle color
[_logColor] :: LogOptions e w -> Bool
-- | Toggle JSON pretty printing
[_logJson] :: LogOptions e w -> Bool
-- | Toggle to silence the logs
[_logSilent] :: LogOptions e w -> Bool
-- | Suppress log output below this severity
[_logMinSeverity] :: LogOptions e w -> LogSeverity
-- | Toggle for printing HTTP headers
[_logHeaders] :: LogOptions e w -> Bool
-- | Printer for client-supplied error type. The boolean toggles JSON
-- pretty printing.
[_printUserError] :: LogOptions e w -> Bool -> e -> Text
-- | Printer for client-supplied log type. the boolean toggles JSON pretty
-- printing.
[_printUserLog] :: LogOptions e w -> Bool -> w -> Text
-- | Noisy, in color, without parsing JSON responses, and using Show
-- instances for user-supplied error and log types.
basicLogOptions :: (Show e, Show w) => LogOptions e w
-- | Noisy, in color, without parsing JSON responses, and using trivial
-- printers for user-supplied error and log types. For testing.
trivialLogOptions :: LogOptions e w
-- | Extract the user-defined log entries.
logEntries :: W e w -> [w]
-- | Syslog style log severities.
data LogSeverity
-- | Debug-level messages
LogDebug :: LogSeverity
-- | Informational messages
LogInfo :: LogSeverity
-- | Normal but significant condition
LogNotice :: LogSeverity
-- | Warning conditions
LogWarning :: LogSeverity
-- | Error conditions
LogError :: LogSeverity
-- | Critical conditions
LogCritical :: LogSeverity
-- | Action must be taken immediately
LogAlert :: LogSeverity
-- | System is unusable
LogEmergency :: LogSeverity
-- | Set the severity level of all log actions in a session.
setLogSeverity :: (Monad eff, Monad (t eff), MonadTrans t) => LogSeverity -> HttpTT e r w s p t eff a -> HttpTT e r w s p t eff a
-- | Log type
data W e w
-- | All log statements should go through logNow.
printHttpLogs :: Handle -> Maybe (MVar ()) -> LogOptions e w -> (LogOptions e w -> LogEntry e w -> Maybe Text) -> W e w -> IO ()
-- | Simple default pretty printer for LogEntrys.
basicLogEntryPrinter :: LogOptions e w -> LogEntry e w -> Maybe Text
-- | Retrieve the image of the current state under a given function.
gets :: (Monad eff, Monad (t eff), MonadTrans t) => (S s -> a) -> HttpTT e r w s p t eff a
-- | Modify the current state strictly.
modify :: (Monad eff, Monad (t eff), MonadTrans t) => (S s -> S s) -> HttpTT e r w s p t eff ()
-- | State type
data S s
S :: Options -> Maybe Session -> s -> S s
[_httpOptions] :: S s -> Options
[_httpSession] :: S s -> Maybe Session
[_userState] :: S s -> s
-- | State constructor
basicState :: s -> S s
-- | Inject an atomic effect.
prompt :: (Monad eff, Monad (t eff), MonadTrans t) => P p a -> HttpTT e r w s p t eff a
-- | Atomic effects
data P p a
[HPutStrLn] :: Handle -> Text -> P p (Either IOException ())
[HPutStrLnBlocking] :: MVar () -> Handle -> Text -> P p (Either IOException ())
[GetSystemTime] :: P p UTCTime
[ThreadDelay] :: Int -> P p ()
[HttpGet] :: Options -> Maybe Session -> Url -> P p (Either HttpException HttpResponse)
[HttpPost] :: Options -> Maybe Session -> Url -> ByteString -> P p (Either HttpException HttpResponse)
[HttpDelete] :: Options -> Maybe Session -> Url -> P p (Either HttpException HttpResponse)
[P] :: p a -> P p a
-- | Basic evaluator for interpreting atomic Http effects in
-- IO.
evalIO :: (p a -> IO a) -> P p a -> IO a
-- | Basic evaluator for interpreting atomic Http effects in
-- MockIO.
evalMockIO :: (p a -> MockIO s a) -> P p a -> MockIO s a
-- | Write a comment to the log
comment :: (Monad eff, Monad (t eff), MonadTrans t) => Text -> HttpTT e r w s p t eff ()
-- | Pause the thread
wait :: (Monad eff, Monad (t eff), MonadTrans t) => Int -> HttpTT e r w s p t eff ()
-- | For debug level messages
logDebug :: (Monad eff, Monad (t eff), MonadTrans t) => w -> HttpTT e r w s p t eff ()
-- | For informational messages
logInfo :: (Monad eff, Monad (t eff), MonadTrans t) => w -> HttpTT e r w s p t eff ()
-- | For normal but significant conditions
logNotice :: (Monad eff, Monad (t eff), MonadTrans t) => w -> HttpTT e r w s p t eff ()
-- | For warning conditions
logWarning :: (Monad eff, Monad (t eff), MonadTrans t) => w -> HttpTT e r w s p t eff ()
-- | For error conditions
logError :: (Monad eff, Monad (t eff), MonadTrans t) => w -> HttpTT e r w s p t eff ()
-- | For critical conditions
logCritical :: (Monad eff, Monad (t eff), MonadTrans t) => w -> HttpTT e r w s p t eff ()
-- | Action must be taken immediately
logAlert :: (Monad eff, Monad (t eff), MonadTrans t) => w -> HttpTT e r w s p t eff ()
-- | System is unusable
logEmergency :: (Monad eff, Monad (t eff), MonadTrans t) => w -> HttpTT e r w s p t eff ()
-- | Write a line to a handle
hPutStrLn :: (Monad eff, Monad (t eff), MonadTrans t) => Handle -> Text -> HttpTT e r w s p t eff ()
-- | Write a line to a handle, using the given MVar as a lock
hPutStrLnBlocking :: (Monad eff, Monad (t eff), MonadTrans t) => MVar () -> Handle -> Text -> HttpTT e r w s p t eff ()
-- | Run a GET request
httpGet :: (Monad eff, Monad (t eff), MonadTrans t) => Url -> HttpTT e r w s p t eff HttpResponse
-- | Run a GET request, but do not write the request or response
-- to the logs.
httpSilentGet :: (Monad eff, Monad (t eff), MonadTrans t) => Url -> HttpTT e r w s p t eff HttpResponse
-- | Run a POST request
httpPost :: (Monad eff, Monad (t eff), MonadTrans t) => Url -> ByteString -> HttpTT e r w s p t eff HttpResponse
-- | Run a POST request, but do not write the request or response
-- to the logs.
httpSilentPost :: (Monad eff, Monad (t eff), MonadTrans t) => Url -> ByteString -> HttpTT e r w s p t eff HttpResponse
-- | Run a DELETE request
httpDelete :: (Monad eff, Monad (t eff), MonadTrans t) => Url -> HttpTT e r w s p t eff HttpResponse
-- | Run a DELETE request, but do not write the request or
-- response to the logs.
httpSilentDelete :: (Monad eff, Monad (t eff), MonadTrans t) => Url -> HttpTT e r w s p t eff HttpResponse
-- | Parse a ByteString to a JSON Value.
parseJson :: (Monad eff, Monad (t eff), MonadTrans t) => ByteString -> HttpTT e r w s p t eff Value
-- | Object member lookup.
lookupKeyJson :: (Monad eff, Monad (t eff), MonadTrans t) => Text -> Value -> HttpTT e r w s p t eff Value
-- | Decode a Value to some other type.
constructFromJson :: (Monad eff, Monad (t eff), MonadTrans t, FromJSON a) => Value -> HttpTT e r w s p t eff a
-- | To make type signatures nicer
type Url = Text
-- | Represents the kinds of errors that can occur when parsing and
-- decoding JSON.
data JsonError
-- | A generic JSON error; try not to use this.
JsonError :: Text -> JsonError
-- | A failed parse.
JsonParseError :: ByteString -> JsonError
-- | An attempt to look up the value of a key that does not exist on an
-- object.
JsonKeyDoesNotExist :: Text -> Value -> JsonError
-- | An attempt to look up the value of a key on something other than an
-- object.
JsonKeyLookupOffObject :: Text -> Value -> JsonError
-- | A failed attempt to convert a Value to some other type.
JsonConstructError :: String -> JsonError
-- | Non-opaque HTTP response type.
data HttpResponse
HttpResponse :: Status -> HttpVersion -> ResponseHeaders -> ByteString -> CookieJar -> HttpResponse
[_responseStatus] :: HttpResponse -> Status
[_responseVersion] :: HttpResponse -> HttpVersion
[_responseHeaders] :: HttpResponse -> ResponseHeaders
[_responseBody] :: HttpResponse -> ByteString
[_responseCookieJar] :: HttpResponse -> CookieJar
-- | Turn an HttpTT into a property; for testing with QuickCheck.
checkHttpTT :: forall eff t q e r w s p a prop. (Monad eff, Monad (t eff), MonadTrans t, Show q, Testable prop) => S s -> R e w r -> (forall u. P p u -> eff u) -> (t eff (Either (E e) a, S s, W e w) -> IO q) -> (q -> prop) -> HttpTT e r w s p t eff a -> Property
instance GHC.Show.Show e => GHC.Show.Show (Control.Monad.Script.Http.E e)
instance GHC.Show.Show Control.Monad.Script.Http.HttpVerb
instance GHC.Classes.Eq Control.Monad.Script.Http.HttpVerb
instance (GHC.Show.Show e, GHC.Show.Show w) => GHC.Show.Show (Control.Monad.Script.Http.Log e w)
instance (GHC.Show.Show e, GHC.Show.Show w) => GHC.Show.Show (Control.Monad.Script.Http.LogEntry e w)
instance (GHC.Show.Show e, GHC.Show.Show w) => GHC.Show.Show (Control.Monad.Script.Http.W e w)
instance GHC.Show.Show s => GHC.Show.Show (Control.Monad.Script.Http.S s)
instance (GHC.Base.Monad eff, GHC.Base.Monad (t eff), Control.Monad.Trans.Class.MonadTrans t) => GHC.Base.Functor (Control.Monad.Script.Http.HttpTT e r w s p t eff)
instance (GHC.Base.Monad eff, GHC.Base.Monad (t eff), Control.Monad.Trans.Class.MonadTrans t) => GHC.Base.Applicative (Control.Monad.Script.Http.HttpTT e r w s p t eff)
instance (GHC.Base.Monad eff, GHC.Base.Monad (t eff), Control.Monad.Trans.Class.MonadTrans t) => GHC.Base.Monad (Control.Monad.Script.Http.HttpTT e r w s p t eff)
instance (GHC.Base.Monad eff, GHC.Base.Monad (t eff), Control.Monad.Trans.Class.MonadTrans t, Control.Monad.Fail.MonadFail (t eff)) => Control.Monad.Fail.MonadFail (Control.Monad.Script.Http.HttpTT e r w s p t eff)
instance (Control.Monad.Trans.Class.MonadTrans t, forall (m :: * -> *). GHC.Base.Monad m => GHC.Base.Monad (t m)) => Control.Monad.Trans.Class.MonadTrans (Control.Monad.Script.Http.HttpTT e r w s p t)
instance GHC.Base.Semigroup (Control.Monad.Script.Http.W e w)
instance GHC.Base.Monoid (Control.Monad.Script.Http.W e w)