Skip to content

Commit

Permalink
Merge branch 'master' into deprecate-legacy-exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ocramz authored Oct 13, 2023
2 parents 16f8750 + 123ff5f commit 5820149
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 22 deletions.
2 changes: 2 additions & 0 deletions Web/Scotty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ import Network.Wai (Application, Middleware, Request, StreamingBody)
import Network.Wai.Handler.Warp (Port)

import Web.Scotty.Internal.Types (ScottyT, ActionT, ErrorHandler, Param, RoutePattern, Options, defaultOptions, File, Kilobytes, ScottyState, defaultScottyState, StatusError(..), Content(..))

import UnliftIO.Exception (Handler(..), catch)


type ScottyM = ScottyT IO
type ActionM = ActionT IO

Expand Down
2 changes: 2 additions & 0 deletions Web/Scotty/Action.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ import Numeric.Natural

import Web.Scotty.Internal.Types
import Web.Scotty.Util (mkResponse, addIfNotPresent, add, replace, lazyTextToStrictByteString, strictByteStringToLazyText)

import UnliftIO.Exception (Handler(..), catch, catches)


import Network.Wai.Internal (ResponseReceived(..))

-- | Evaluate a route, catch all exceptions (user-defined ones, internal and all remaining, in this order)
Expand Down
22 changes: 0 additions & 22 deletions Web/Scotty/Internal/Types.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleInstances #-}
Expand Down Expand Up @@ -242,40 +241,19 @@ instance (Semigroup a) => Semigroup (ScottyT m a) where

instance
( Monoid a
#if !(MIN_VERSION_base(4,11,0))
, Semigroup a
#endif
#if !(MIN_VERSION_base(4,8,0))
, Functor m
#endif
) => Monoid (ScottyT m a) where
mempty = return mempty
#if !(MIN_VERSION_base(4,11,0))
mappend = (<>)
#endif

instance
( Monad m
#if !(MIN_VERSION_base(4,8,0))
, Functor m
#endif
, Semigroup a
) => Semigroup (ActionT m a) where
x <> y = (<>) <$> x <*> y

instance
( Monad m, Monoid a
#if !(MIN_VERSION_base(4,11,0))
, Semigroup a
#endif
#if !(MIN_VERSION_base(4,8,0))
, Functor m
#endif
) => Monoid (ActionT m a) where
mempty = return mempty
#if !(MIN_VERSION_base(4,11,0))
mappend = (<>)
#endif

------------------ Scotty Routes --------------------
data RoutePattern = Capture Text
Expand Down
2 changes: 2 additions & 0 deletions Web/Scotty/Trans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ import Web.Scotty.Route
import Web.Scotty.Internal.Types (ActionT(..), ScottyT(..), defaultScottyState, Application, RoutePattern, Options(..), defaultOptions, RouteOptions(..), defaultRouteOptions, ErrorHandler, Kilobytes, File, addMiddleware, setHandler, updateMaxRequestBodySize, routes, middlewares, ScottyException(..), ScottyState, defaultScottyState, StatusError(..), Content(..))
import Web.Scotty.Util (socketDescription)
import Web.Scotty.Body (newBodyInfo)

import UnliftIO.Exception (Handler(..), catch, catches)


-- | Run a scotty application using the warp server.
-- NB: scotty p === scottyT p id
scottyT :: (Monad m, MonadIO n)
Expand Down

0 comments on commit 5820149

Please sign in to comment.