Skip to content

Commit

Permalink
web sublibrary (#1697)
Browse files Browse the repository at this point in the history
Towards #1043

Creates a new sub-library for the web service.  Also moved the `Swarm.App` module from the `swarm` library to the `swarm` executable.
  • Loading branch information
kostmo authored Jan 1, 2024
1 parent ccd64fc commit f6f01b2
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 19 deletions.
4 changes: 4 additions & 0 deletions src/Swarm/App.hs → app/Swarm/App.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

{- HLINT ignore "Use underscore" -}

-- |
-- SPDX-License-Identifier: BSD-3-Clause
Expand Down
File renamed without changes.
File renamed without changes.
71 changes: 52 additions & 19 deletions swarm.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,38 @@ common ghc2021-extensions
-- Not GHC2021, but until we get \cases we use \case a lot
LambdaCase

library swarm-web
import: stan-config, common, ghc2021-extensions
exposed-modules: Swarm.Web
Swarm.Web.Worldview
other-modules: Paths_swarm
autogen-modules: Paths_swarm
build-depends: aeson,
base,
brick,
bytestring,
commonmark,
colour,
containers,
lens,
http-types,
nonempty-containers,
palette,
servant-docs,
servant-server >= 0.19 && < 0.21,
text,
witch,
wai >= 3.2 && < 3.3,
wai-app-static >= 3.1.8 && < 3.1.9,
warp,
build-depends: swarm-util,
swarm,
hs-source-dirs: src/swarm-web
default-language: Haskell2010
default-extensions:
-- Avoid unexpected unevaluated thunk buildup
-- See discussion in #415
StrictData

library swarm-util
import: stan-config, common, ghc2021-extensions
Expand All @@ -121,16 +153,16 @@ library swarm-util
filepath >= 1.4 && < 1.5,
fused-effects >= 1.1.1.1 && < 1.2,
lens >= 4.19 && < 5.3,
megaparsec >= 9.6.1 && < 9.7,
minimorph >= 0.3 && < 0.4,
mtl >= 2.2.2 && < 2.4,
servant-docs >= 0.12 && < 0.14,
template-haskell >= 2.16 && < 2.21,
text >= 1.2.4 && < 2.1,
transformers >= 0.5 && < 0.7,
vector >= 0.12 && < 0.14,
witch >= 1.1.1.0 && < 1.3,
yaml >= 0.11 && < 0.11.12.0,
transformers >= 0.5 && < 0.7,
servant-docs >= 0.12 && < 0.14,
megaparsec >= 9.6.1 && < 9.7,
hs-source-dirs: src/swarm-util
default-language: Haskell2010
default-extensions:
Expand All @@ -140,8 +172,7 @@ library swarm-util

library
import: stan-config, common, ghc2021-extensions
exposed-modules: Swarm.App
Swarm.Constant
exposed-modules: Swarm.Constant
Swarm.Doc.Keyword
Swarm.Doc.Pedagogy
Swarm.Doc.Util
Expand Down Expand Up @@ -288,8 +319,6 @@ library
Swarm.TUI.Panel
Swarm.Util.Effect
Swarm.Version
Swarm.Web
Swarm.Web.Worldview

reexported-modules: Control.Carrier.Accum.FixedStrict
, Data.BoolExpr.Simplify
Expand Down Expand Up @@ -347,9 +376,7 @@ library
parser-combinators >= 1.2 && < 1.4,
prettyprinter >= 1.7.0 && < 1.8,
random >= 1.2.0 && < 1.3,
wai-app-static >= 3.1.8 && < 3.1.9,
servant-docs >= 0.12 && < 0.14,
servant-server >= 0.19 && < 0.21,
SHA >= 1.6.4 && < 1.6.5,
simple-enumeration >= 0.2 && < 0.3,
split >= 0.2.3 && < 0.3,
Expand All @@ -365,16 +392,11 @@ library
unordered-containers >= 0.2.14 && < 0.3,
vector >= 0.12 && < 0.14,
vty >= 6.0 && < 6.1,
wai >= 3.2 && < 3.3,
warp >= 3.2 && < 3.4,
witch >= 1.1.1.0 && < 1.3,
witherable >= 0.4 && < 0.5,
word-wrap >= 0.5 && < 0.6,
yaml >= 0.11 && < 0.11.12.0
if os(windows)
build-depends: vty-windows >= 0.1.0.3 && < 0.2
else
build-depends: vty-unix >= 0.1.0.0 && < 0.2
yaml >= 0.11 && < 0.11.12.0,
build-depends: swarm-util
hs-source-dirs: src
default-language: Haskell2010
Expand All @@ -386,16 +408,26 @@ library
executable swarm
import: stan-config, common
main-is: Main.hs
other-modules: Swarm.App
build-depends: optparse-applicative >= 0.16 && < 0.19,
githash >= 0.1.6 && < 0.2,
terminal-size >= 0.3 && < 1.0,
blaze-html >= 0.9.1 && < 0.9.2,
servant >= 0.19 && < 0.21,
-- Imports shared with the library don't need bounds
base,
text,
brick,
fused-effects,
lens,
prettyprinter,
swarm
text,
vty,
swarm,
swarm-web,
if os(windows)
build-depends: vty-windows >= 0.1.0.3 && < 0.2,
else
build-depends: vty-unix >= 0.1.0.0 && < 0.2,
hs-source-dirs: app
default-language: Haskell2010
ghc-options: -threaded
Expand Down Expand Up @@ -430,6 +462,7 @@ executable swarm-docs
text,
transformers,
vector,
swarm-web,
hs-source-dirs: app/doc
default-language: Haskell2010
ghc-options: -threaded
Expand Down Expand Up @@ -472,7 +505,7 @@ test-suite swarm-unit
text,
time,
witch,
vty
vty,
hs-source-dirs: test/unit
default-language: Haskell2010
ghc-options: -threaded
Expand All @@ -495,7 +528,7 @@ test-suite swarm-integration
swarm,
text,
witch,
yaml
yaml,
hs-source-dirs: test/integration
default-language: Haskell2010
ghc-options: -threaded
Expand Down

0 comments on commit f6f01b2

Please sign in to comment.