Skip to content

Commit

Permalink
remove data-default-class (#386)
Browse files Browse the repository at this point in the history
* remove data-default-class

* upd changelog

---------

Co-authored-by: Marco Zocca <marco.zocca@unfoldml.com>
  • Loading branch information
ocramz and Marco Zocca committed Mar 10, 2024
1 parent 4776ec4 commit 24ecfbd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
12 changes: 0 additions & 12 deletions Web/Scotty/Internal/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import qualified Control.Monad.Trans.Resource as RT (InternalState, InvalidAcces

import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy.Char8 as LBS8 (ByteString)
import Data.Default.Class (Default, def)
import Data.String (IsString(..))
import qualified Data.Text as T (Text, pack)
import Data.Typeable (Typeable)
Expand Down Expand Up @@ -58,18 +57,12 @@ data Options = Options { verbose :: Int -- ^ 0 = silent, 1(def) = startup banner
-- servers using `setFdCacheDuration`.
}

instance Default Options where
def = defaultOptions

defaultOptions :: Options
defaultOptions = Options 1 W.defaultSettings

newtype RouteOptions = RouteOptions { maxRequestBodySize :: Maybe Kilobytes -- max allowed request size in KB
}

instance Default RouteOptions where
def = defaultRouteOptions

defaultRouteOptions :: RouteOptions
defaultRouteOptions = RouteOptions Nothing

Expand Down Expand Up @@ -100,9 +93,6 @@ data ScottyState m =
, routeOptions :: RouteOptions
}

-- instance Default (ScottyState m) where
-- def = defaultScottyState

defaultScottyState :: ScottyState m
defaultScottyState = ScottyState [] [] Nothing defaultRouteOptions

Expand Down Expand Up @@ -231,8 +221,6 @@ setHeaderWith f sr = sr { srHeaders = f (srHeaders sr) }
setStatus :: Status -> ScottyResponse -> ScottyResponse
setStatus s sr = sr { srStatus = s }

instance Default ScottyResponse where
def = defaultScottyResponse

-- | The default response has code 200 OK and empty body
defaultScottyResponse :: ScottyResponse
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## next [????.??.??]


### Breaking changes
* Remove dependency on data-default class (#386). We have been exporting constants for default config values since 0.20, and this dependency was simply unnecessary.



## 0.22 [2024.03.09]

### New
Expand Down
1 change: 0 additions & 1 deletion scotty.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ Library
bytestring >= 0.10.0.2 ,
case-insensitive >= 1.0.0.1 && < 1.3,
cookie >= 0.4,
data-default-class >= 0.1,
exceptions >= 0.7 && < 0.11,
http-types >= 0.9.1 && < 0.13,
monad-control >= 1.0.0.3 && < 1.1,
Expand Down

0 comments on commit 24ecfbd

Please sign in to comment.