Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract WebService into its own package #613

Merged
merged 11 commits into from
Sep 11, 2024
1 change: 1 addition & 0 deletions lib/haskell/cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ packages:
./natural4
./anyall
./explainable
./web-service

-- Environment files are required to run the doctests via `cabal test doctests`
write-ghc-environment-files: always
Expand Down
52 changes: 0 additions & 52 deletions lib/haskell/explainable/explainable.cabal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 0 additions & 35 deletions lib/haskell/explainable/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,41 +56,6 @@ ghc-options:
library:
source-dirs: src

executables:
explainable-exe:
main: Main.hs
# other-modules:
# - Options
# - Paths_explainable
source-dirs: app
ghc-options:
- -Wall
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- bytestring
- explainable
- servant
- servant-server
- servant-openapi3
- servant-swagger-ui
- openapi3
- warp
- wai
- wai-logger
- directory
- filepath
- lens
- optics-core
- optics
- optparse-applicative
- scientific
- QuickCheck
- quickcheck-instances
# TODO: if this project advances, the server should be its own library
- hspec

tests:
explainable-test:
main: Spec.hs
Expand Down
5 changes: 5 additions & 0 deletions lib/haskell/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ packages:
- natural4
- anyall
- explainable
- web-service

extra-deps:
# if you are actively developing both baby-l4 and the natural4 code that uses it (import L4.*)
Expand Down Expand Up @@ -40,6 +41,10 @@ extra-deps:
- log-effectful-1.0.0.0
- parser-combinators-1.3.0
- monadic-recursion-schemes-0.1.13.2
- servant-0.20.2
- servant-server-0.20.2
- servant-openapi3-2.0.1.6

# - holmes-0.3.2.0
# - unbound-generics-0.4.3@sha256:12209c0049000d0dd8c3eb6013d0278a8b269a2421d9758083aab9f58c4b6b4c,5446

Expand Down
21 changes: 21 additions & 0 deletions lib/haskell/stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,27 @@ packages:
size: 356
original:
hackage: monadic-recursion-schemes-0.1.13.2
- completed:
hackage: servant-0.20.2@sha256:a4613dc1caa40d1b8db7aff00417dc2d651a8d73a90add3d934218b1778df35c,5371
pantry-tree:
sha256: 23364c969c171541475d270a7cf0d20ee59b4b88058deafef80b0070416670f0
size: 2944
original:
hackage: servant-0.20.2
- completed:
hackage: servant-server-0.20.2@sha256:5a2d11959256fed8f4918f02f55cb597b61cc92191a672cd2d2228fadd5ee0ec,6226
pantry-tree:
sha256: 234c87e0a70ab6b15df75b526b344715584693be4a5c1b373ecfaaebc9c4127b
size: 2615
original:
hackage: servant-server-0.20.2
- completed:
hackage: servant-openapi3-2.0.1.6@sha256:60be03aa18d9a2e267ec3814d3305c3bd341398dcfcdf868ab851a12a1e81591,4939
pantry-tree:
sha256: a43be8a3c3b88606dd8856006e7ad60ee70e64474e85717bfa6d580d69cb5a0b
size: 1637
original:
hackage: servant-openapi3-2.0.1.6
snapshots:
- completed:
sha256: 98fe98dae6f42f9b4405e5467f62f57df2896c57b742a09772688c900c722510
Expand Down
11 changes: 11 additions & 0 deletions lib/haskell/web-service/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog for `web-service`

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the
[Haskell Package Versioning Policy](https://pvp.haskell.org/).

## Unreleased

## 0.1.0.0 - YYYY-MM-DD
30 changes: 30 additions & 0 deletions lib/haskell/web-service/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright Author name here (c) 2023

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of Author name here nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6 changes: 6 additions & 0 deletions lib/haskell/web-service/app/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Main (main) where

import Application

main :: IO ()
main = defaultMain
94 changes: 94 additions & 0 deletions lib/haskell/web-service/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: web-service
version: 0.1.0.0
github: "githubuser/web-service"
license: BSD3
author: "Author name here"
maintainer: "[email protected]"
copyright: "2023 Author name here"

extra-source-files:
- CHANGELOG.md

# Metadata used when publishing your package
# synopsis: Short description of your package
# category: Web

# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description: Please see the README on GitHub at <https://github.com/githubuser/web-service#readme>

dependencies:
- base >= 4.7 && < 5
- aeson
- bytestring
- containers
- extra
- unordered-containers
- transformers
- mtl
- prettyprinter
- text
- effectful
- string-interpolate
- numeric-extras
- servant ^>= 0.20.2
- servant-server ^>= 0.20.2
- servant-openapi3
- servant-swagger-ui
- openapi3
- warp
- wai
- wai-logger
- directory
- filepath
- lens
- optics-core
- optics
- optparse-applicative
- scientific
# Backends
- explainable
- simala

language: GHC2021

ghc-options:
- -Wall
- -Wcompat
- -Widentities
- -Wincomplete-record-updates
- -Wincomplete-uni-patterns
- -Wmissing-export-lists
- -Wmissing-home-modules
- -Wpartial-fields
- -Wredundant-constraints

library:
source-dirs: src

executables:
web-service-exe:
main: Main.hs
source-dirs: app
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- web-service

tests:
web-service-test:
main: Spec.hs
source-dirs: test
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
build-tools: hspec-discover:hspec-discover
dependencies:
- web-service
- hspec
- QuickCheck
- quickcheck-instances
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE DataKinds #-}

module Main (main) where
module Application (defaultMain) where

import Network.Wai
import Network.Wai.Handler.Warp
Expand Down Expand Up @@ -29,8 +29,8 @@ opts =
-- Main Application and wiring
-- ----------------------------------------------------------------------------

main :: IO ()
main = do
defaultMain :: IO ()
defaultMain = do
Options{port, serverName} <- execParser opts
withStdoutLogger $ \aplogger -> do
let settings = setPort port $ setLogger aplogger defaultSettings
Expand Down
Loading