Skip to content

Commit

Permalink
Support building with scotty-0.20
Browse files Browse the repository at this point in the history
Fixes #98.
  • Loading branch information
RyanGlScott committed Oct 5, 2023
1 parent 40331fa commit 16c1de1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
9 changes: 8 additions & 1 deletion Graphics/Blank.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions blank-canvas.cabal
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 16c1de1

Please sign in to comment.