scotty-0.22: Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp
Safe HaskellSafe-Inferred
LanguageHaskell2010

Web.Scotty.Internal.Types

Synopsis

Documentation

data Options Source #

Constructors

Options 

Fields

  • verbose :: Int

    0 = silent, 1(def) = startup banner

  • settings :: Settings

    Warp Settings Note: to work around an issue in warp, the default FD cache duration is set to 0 so changes to static files are always picked up. This likely has performance implications, so you may want to modify this for production servers using setFdCacheDuration.

Instances

Instances details
Default Options Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

def :: Options #

newtype RouteOptions Source #

Instances

Instances details
Default RouteOptions Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

def :: RouteOptions #

data BodyChunkBuffer Source #

Constructors

BodyChunkBuffer 

Fields

data BodyInfo Source #

The key part of having two MVars is that we can "clone" the BodyInfo to create a copy where the index is reset to 0, but the chunk cache is the same. Passing a cloned BodyInfo into each matched route allows them each to start from the first chunk if they call bodyReader.

Introduced in (#308)

Constructors

BodyInfo 

Fields

newtype ScottyT m a Source #

Constructors

ScottyT 

Fields

Instances

Instances details
Applicative (ScottyT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

pure :: a -> ScottyT m a #

(<*>) :: ScottyT m (a -> b) -> ScottyT m a -> ScottyT m b #

liftA2 :: (a -> b -> c) -> ScottyT m a -> ScottyT m b -> ScottyT m c #

(*>) :: ScottyT m a -> ScottyT m b -> ScottyT m b #

(<*) :: ScottyT m a -> ScottyT m b -> ScottyT m a #

Functor (ScottyT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

fmap :: (a -> b) -> ScottyT m a -> ScottyT m b #

(<$) :: a -> ScottyT m b -> ScottyT m a #

Monad (ScottyT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

(>>=) :: ScottyT m a -> (a -> ScottyT m b) -> ScottyT m b #

(>>) :: ScottyT m a -> ScottyT m b -> ScottyT m b #

return :: a -> ScottyT m a #

Monoid a => Monoid (ScottyT m a) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

mempty :: ScottyT m a #

mappend :: ScottyT m a -> ScottyT m a -> ScottyT m a #

mconcat :: [ScottyT m a] -> ScottyT m a #

Semigroup a => Semigroup (ScottyT m a) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

(<>) :: ScottyT m a -> ScottyT m a -> ScottyT m a #

sconcat :: NonEmpty (ScottyT m a) -> ScottyT m a #

stimes :: Integral b => b -> ScottyT m a -> ScottyT m a #

data ActionError Source #

Internal exception mechanism used to modify the request processing flow.

The exception constructor is not exposed to the user and all exceptions of this type are caught and processed within the runAction function.

Constructors

AERedirect Text

Redirect

AENext

Stop processing this route and skip to the next one

AEFinish

Stop processing the request

tryNext :: MonadUnliftIO m => m a -> m Bool Source #

data StatusError Source #

Deprecated: If it is supposed to be caught, a proper exception type should be defined

E.g. when a parameter is not found in a query string (400 Bad Request) or when parsing a JSON body fails (422 Unprocessable Entity)

Constructors

StatusError Status Text

Deprecated: If it is supposed to be caught, a proper exception type should be defined

Instances

Instances details
Exception StatusError Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Show StatusError Source # 
Instance details

Defined in Web.Scotty.Internal.Types

MonadUnliftIO m => MonadError StatusError (ActionT m) Source #

Models the invariant that only StatusErrors can be thrown and caught.

Instance details

Defined in Web.Scotty.Internal.Types

Methods

throwError :: StatusError -> ActionT m a #

catchError :: ActionT m a -> (StatusError -> ActionT m a) -> ActionT m a #

type ErrorHandler m = Handler (ActionT m) () Source #

Specializes a Handler to the ActionT monad

type Param = (Text, Text) Source #

type File t = (Text, FileInfo t) Source #

Type parameter t is the file content. Could be () when not needed or a FilePath for temp files instead.

data ScottyResponse Source #

Constructors

SR 

Instances

Instances details
Default ScottyResponse Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

def :: ScottyResponse #

defaultScottyResponse :: ScottyResponse Source #

The default response has code 200 OK and empty body

newtype ActionT m a Source #

Constructors

ActionT 

Fields

Instances

Instances details
MonadTransControl ActionT Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Associated Types

type StT ActionT a #

Methods

liftWith :: Monad m => (Run ActionT -> m a) -> ActionT m a #

restoreT :: Monad m => m (StT ActionT a) -> ActionT m a #

MonadTrans ActionT Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

lift :: Monad m => m a -> ActionT m a #

MonadBaseControl b m => MonadBaseControl b (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Associated Types

type StM (ActionT m) a #

Methods

liftBaseWith :: (RunInBase (ActionT m) b -> b a) -> ActionT m a #

restoreM :: StM (ActionT m) a -> ActionT m a #

MonadUnliftIO m => MonadError StatusError (ActionT m) Source #

Models the invariant that only StatusErrors can be thrown and caught.

Instance details

Defined in Web.Scotty.Internal.Types

Methods

throwError :: StatusError -> ActionT m a #

catchError :: ActionT m a -> (StatusError -> ActionT m a) -> ActionT m a #

MonadReader r m => MonadReader r (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

ask :: ActionT m r #

local :: (r -> r) -> ActionT m a -> ActionT m a #

reader :: (r -> a) -> ActionT m a #

MonadBase b m => MonadBase b (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

liftBase :: b α -> ActionT m α #

MonadIO m => MonadFail (ActionT m) Source #

Modeled after the behaviour in scotty < 0.20, fail throws a StatusError with code 500 ("Server Error"), which can be caught with catch.

Instance details

Defined in Web.Scotty.Internal.Types

Methods

fail :: String -> ActionT m a #

MonadIO m => MonadIO (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

liftIO :: IO a -> ActionT m a #

MonadUnliftIO m => Alternative (ActionT m) Source #

empty throws ActionError AENext, whereas (<|>) catches any ActionErrors or StatusErrors in the first action and proceeds to the second one.

Instance details

Defined in Web.Scotty.Internal.Types

Methods

empty :: ActionT m a #

(<|>) :: ActionT m a -> ActionT m a -> ActionT m a #

some :: ActionT m a -> ActionT m [a] #

many :: ActionT m a -> ActionT m [a] #

Applicative m => Applicative (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

pure :: a -> ActionT m a #

(<*>) :: ActionT m (a -> b) -> ActionT m a -> ActionT m b #

liftA2 :: (a -> b -> c) -> ActionT m a -> ActionT m b -> ActionT m c #

(*>) :: ActionT m a -> ActionT m b -> ActionT m b #

(<*) :: ActionT m a -> ActionT m b -> ActionT m a #

Functor m => Functor (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

fmap :: (a -> b) -> ActionT m a -> ActionT m b #

(<$) :: a -> ActionT m b -> ActionT m a #

Monad m => Monad (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

(>>=) :: ActionT m a -> (a -> ActionT m b) -> ActionT m b #

(>>) :: ActionT m a -> ActionT m b -> ActionT m b #

return :: a -> ActionT m a #

MonadUnliftIO m => MonadPlus (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

mzero :: ActionT m a #

mplus :: ActionT m a -> ActionT m a -> ActionT m a #

MonadCatch m => MonadCatch (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

catch :: (HasCallStack, Exception e) => ActionT m a -> (e -> ActionT m a) -> ActionT m a #

MonadThrow m => MonadThrow (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

throwM :: (HasCallStack, Exception e) => e -> ActionT m a #

MonadUnliftIO m => MonadUnliftIO (ActionT m) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

withRunInIO :: ((forall a. ActionT m a -> IO a) -> IO b) -> ActionT m b #

(Monad m, Monoid a) => Monoid (ActionT m a) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

mempty :: ActionT m a #

mappend :: ActionT m a -> ActionT m a -> ActionT m a #

mconcat :: [ActionT m a] -> ActionT m a #

(Monad m, Semigroup a) => Semigroup (ActionT m a) Source # 
Instance details

Defined in Web.Scotty.Internal.Types

Methods

(<>) :: ActionT m a -> ActionT m a -> ActionT m a #

sconcat :: NonEmpty (ActionT m a) -> ActionT m a #

stimes :: Integral b => b -> ActionT m a -> ActionT m a #

type StT ActionT a Source # 
Instance details

Defined in Web.Scotty.Internal.Types

type StM (ActionT m) a Source # 
Instance details

Defined in Web.Scotty.Internal.Types

type StM (ActionT m) a = StM (ReaderT ActionEnv m) a

tryAnyStatus :: MonadUnliftIO m => m a -> m Bool Source #

catches either ActionError (thrown by next), ScottyException (thrown if e.g. a query parameter is not found) or StatusError (via raiseStatus)

data RoutePattern Source #

Instances

Instances details
IsString RoutePattern Source # 
Instance details

Defined in Web.Scotty.Internal.Types