From 9110064fe62f98dd3ecc5fb4c3915a843492b8fb Mon Sep 17 00:00:00 2001 From: stuebinm Date: Mon, 23 Oct 2023 23:18:34 +0200 Subject: a year went by This does many meta-things, but changes no functionality: - get rid of stack, and use just cabal with a stackage snapshot instead (why did I ever think stack was a good idea?) - update the stackage snapshot to something halfway recent - thus making builds work on nixpkgs-23.05 (current stable) - separating out packages into their own cabal files - use the GHC2021 set of extensions as default - very slight code changes to make things build again - update readme accordingly - stylish-haskell run --- server/Handlers.hs | 2 -- server/HtmlOrphans.hs | 6 ++---- server/Main.hs | 14 ++++--------- server/Server.hs | 31 ++++++++++------------------- server/Worker.hs | 12 +++++------ server/default.nix | 26 ++++++++++++++++++++++++ server/server.cabal | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 102 insertions(+), 44 deletions(-) create mode 100644 server/default.nix create mode 100644 server/server.cabal (limited to 'server') diff --git a/server/Handlers.hs b/server/Handlers.hs index 8990f01..10a729c 100644 --- a/server/Handlers.hs +++ b/server/Handlers.hs @@ -1,7 +1,5 @@ {-# LANGUAGE BlockArguments #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE ExplicitForAll #-} -{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} diff --git a/server/HtmlOrphans.hs b/server/HtmlOrphans.hs index e3887c6..a8a355c 100644 --- a/server/HtmlOrphans.hs +++ b/server/HtmlOrphans.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE DataKinds #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} @@ -7,8 +7,6 @@ -- so it's safe to never define it {-# OPTIONS_GHC -Wno-missing-methods #-} {-# OPTIONS_GHC -Wno-orphans #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleInstances #-} -- | Module containing orphan instances of Lucid's ToHtml, used for rendering -- linter results as html @@ -236,7 +234,7 @@ instance ToHtml (Org True, RemoteRef, DirResult a) where where maxlevel = maximumLintLevel res - placeList :: (Monad m, ToHtml a) => [a] -> HtmlT m () + placeList :: (Monad m, ToHtml h) => [h] -> HtmlT m () placeList occurances = sequence_ . intersperse ", " $ occurances <&> \place -> code_ [class_ "small text-muted"] (toHtml place) diff --git a/server/Main.hs b/server/Main.hs index 0aafd65..6431b3f 100644 --- a/server/Main.hs +++ b/server/Main.hs @@ -1,13 +1,7 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveAnyClass #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TypeFamilies #-} -- | simple server offering linting "as a service" diff --git a/server/Server.hs b/server/Server.hs index ac03a3b..059078b 100644 --- a/server/Server.hs +++ b/server/Server.hs @@ -1,24 +1,13 @@ -{-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveAnyClass #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DerivingStrategies #-} -{-# LANGUAGE ExistentialQuantification #-} -{-# LANGUAGE ExplicitForAll #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE TupleSections #-} -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} module Server ( loadConfig , Org(..) diff --git a/server/Worker.hs b/server/Worker.hs index ba0fb41..2aa74e0 100644 --- a/server/Worker.hs +++ b/server/Worker.hs @@ -1,10 +1,8 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-deferred-out-of-scope-variables #-} module Worker (linterThread, Job(..)) where diff --git a/server/default.nix b/server/default.nix new file mode 100644 index 0000000..5826f0c --- /dev/null +++ b/server/default.nix @@ -0,0 +1,26 @@ +{ mkDerivation, aeson, async, base, base-compat, base64-bytestring +, bytestring, containers, cryptohash-sha1, directory, extra +, filepath, fmt, getopt-generics, http-client, http-types, lib +, lucid, microlens-platform, monad-logger, process, servant +, servant-client, servant-lucid, servant-server, servant-websockets +, stm, text, time, tomland, universum, uuid, wai, wai-extra, walint +, warp, websockets +}: +mkDerivation { + pname = "walint-server"; + version = "0.1"; + src = ./.; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + aeson async base base-compat base64-bytestring bytestring + containers cryptohash-sha1 directory extra filepath fmt + getopt-generics http-client http-types lucid microlens-platform + monad-logger process servant servant-client servant-lucid + servant-server servant-websockets stm text time tomland universum + uuid wai wai-extra walint warp websockets + ]; + homepage = "https://stuebinm.eu/git/walint"; + license = "unknown"; + mainProgram = "walint-server"; +} diff --git a/server/server.cabal b/server/server.cabal new file mode 100644 index 0000000..5b563a6 --- /dev/null +++ b/server/server.cabal @@ -0,0 +1,55 @@ +cabal-version: 3.0 +name: walint-server +version: 0.1 +author: stuebinm +maintainer: stuebinm@disroot.org +copyright: 2023 stuebinm +homepage: https://stuebinm.eu/git/walint + +executable walint-server + main-is: Main.hs + other-modules: + Handlers + HtmlOrphans + Server + Worker + default-extensions: + NoImplicitPrelude + ghc-options: -Wall -Wno-name-shadowing -Wno-unticked-promoted-constructors -rtsopts -threaded + build-depends: + aeson + , async + , base + , base-compat + , base64-bytestring + , bytestring + , containers + , cryptohash-sha1 + , directory + , extra + , filepath + , fmt + , getopt-generics + , http-client + , http-types + , lucid + , microlens-platform + , monad-logger + , process + , servant + , servant-client + , servant-lucid + , servant-server + , servant-websockets + , stm + , text + , time + , tomland + , universum + , uuid + , wai + , wai-extra + , walint + , warp + , websockets + default-language: GHC2021 -- cgit v1.2.3