From 16c1de1906597a3bbb849b5700b77d0e95f4d53d Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Thu, 5 Oct 2023 05:45:44 -0700 Subject: [PATCH] Support building with scotty-0.20 Fixes #98. --- Changelog.md | 3 +++ Graphics/Blank.hs | 9 ++++++++- blank-canvas.cabal | 7 +++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 06cf69d..c178a71 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,6 @@ +### 0.7.4 [2023.10.05] +* Support building with `scotty-0.20`. + ### 0.7.3 * Allow building with GHC 9.0. diff --git a/Graphics/Blank.hs b/Graphics/Blank.hs index 1df682c..9a7efcb 100644 --- a/Graphics/Blank.hs +++ b/Graphics/Blank.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} @@ -291,7 +292,7 @@ blankCanvas opts actions = do -- There has to be a better way of doing this, using function, perhaps? get (Scotty.regex "^/(.*)$") $ do - fileName :: Text <- Scotty.param "1" + fileName :: Text <- captureParam "1" db <- liftIO $ atomically $ readTVar $ locals if fileName `S.member` db then do @@ -307,6 +308,12 @@ blankCanvas opts actions = do $ setTimeout 5 $ defaultSettings ) app + where +#if MIN_VERSION_scotty(0,20,0) + captureParam = Scotty.captureParam +#else + captureParam = Scotty.param +#endif -- | Sends a set of canvas commands to the 'Canvas'. Attempts -- to common up as many commands as possible. Should not crash. diff --git a/blank-canvas.cabal b/blank-canvas.cabal index e9c2458..8f33f94 100644 --- a/blank-canvas.cabal +++ b/blank-canvas.cabal @@ -1,5 +1,5 @@ Name: blank-canvas -Version: 0.7.3 +Version: 0.7.4 Synopsis: HTML5 Canvas Graphics Library Description: @blank-canvas@ is a Haskell binding to the complete @@ -89,7 +89,10 @@ Library http-types >= 0.8 && < 0.13, mime-types >= 0.1.0.3 && < 0.2, kansas-comet >= 0.4 && < 0.5, - scotty >= 0.10 && < 0.13, + -- TODO: Eventually, we should bump the lower version + -- bounds to >=0.20 so that we can remove some CPP in + -- Graphics.Blank. + scotty >= 0.10 && < 0.21, semigroups >= 0.18 && < 1, stm >= 2.2 && < 2.6, text >= 1.1 && < 2.2,