diff --git a/calamity-commands/CalamityCommands/Dsl.hs b/calamity-commands/CalamityCommands/Dsl.hs index 34a1df0..cf3bb2d 100644 --- a/calamity-commands/CalamityCommands/Dsl.hs +++ b/calamity-commands/CalamityCommands/Dsl.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RecursiveDo #-} +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} -- | A DSL for generating commands and groups module CalamityCommands.Dsl ( diff --git a/calamity-commands/CalamityCommands/Help.hs b/calamity-commands/CalamityCommands/Help.hs index 89fa004..fb0c26d 100644 --- a/calamity-commands/CalamityCommands/Help.hs +++ b/calamity-commands/CalamityCommands/Help.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} + -- | A default help command implementation module CalamityCommands.Help ( helpCommand', diff --git a/calamity-commands/CalamityCommands/Parser.hs b/calamity-commands/CalamityCommands/Parser.hs index d40f0e2..e83de61 100644 --- a/calamity-commands/CalamityCommands/Parser.hs +++ b/calamity-commands/CalamityCommands/Parser.hs @@ -1,4 +1,5 @@ {-# LANGUAGE TemplateHaskell #-} +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} -- | Something that can parse user input module CalamityCommands.Parser ( diff --git a/calamity-commands/CalamityCommands/Utils.hs b/calamity-commands/CalamityCommands/Utils.hs index 96664cb..e0ac4b1 100644 --- a/calamity-commands/CalamityCommands/Utils.hs +++ b/calamity-commands/CalamityCommands/Utils.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RecursiveDo #-} +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} -- | Command handler utilities module CalamityCommands.Utils ( diff --git a/calamity-commands/calamity-commands.cabal b/calamity-commands/calamity-commands.cabal index 1e71d5e..9b43c33 100644 --- a/calamity-commands/calamity-commands.cabal +++ b/calamity-commands/calamity-commands.cabal @@ -102,7 +102,7 @@ library ViewPatterns ghc-options: - -fplugin=Polysemy.Plugin -funbox-strict-fields -Wall + -funbox-strict-fields -Wall -fno-warn-name-shadowing build-depends: @@ -111,7 +111,7 @@ library , optics >=0.4.1 && <0.5 , polysemy >=1.5 && <2 , polysemy-plugin >=0.3 && <0.5 - , text >=1.2 && <2.1 + , text >=1.2 && <2.2 , text-show >=3.8 && <4 , unordered-containers >=0.2 && <0.3 diff --git a/calamity/Calamity/Cache/InMemory.hs b/calamity/Calamity/Cache/InMemory.hs index 5cd1c07..53d1ed5 100644 --- a/calamity/Calamity/Cache/InMemory.hs +++ b/calamity/Calamity/Cache/InMemory.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} diff --git a/calamity/Calamity/Client/Client.hs b/calamity/Calamity/Client/Client.hs index 812863a..00e521c 100644 --- a/calamity/Calamity/Client/Client.hs +++ b/calamity/Calamity/Client/Client.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} {-# OPTIONS_GHC -Wno-name-shadowing #-} -- | The client diff --git a/calamity/Calamity/Client/ShardManager.hs b/calamity/Calamity/Client/ShardManager.hs index f0657a1..055de48 100644 --- a/calamity/Calamity/Client/ShardManager.hs +++ b/calamity/Calamity/Client/ShardManager.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} -- | Contains stuff for managing shards module Calamity.Client.ShardManager (shardBot) where diff --git a/calamity/Calamity/Commands/CalamityParsers.hs b/calamity/Calamity/Commands/CalamityParsers.hs index c32ede0..213be21 100644 --- a/calamity/Calamity/Commands/CalamityParsers.hs +++ b/calamity/Calamity/Commands/CalamityParsers.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -- | 'ParameterParser' instances for calamity models diff --git a/calamity/Calamity/Commands/Dsl.hs b/calamity/Calamity/Commands/Dsl.hs index 9d1e067..92ed977 100644 --- a/calamity/Calamity/Commands/Dsl.hs +++ b/calamity/Calamity/Commands/Dsl.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} {- | A DSL for generating commands and groups This is effectively just a re-export of "CalamityCommands.Dsl" but with diff --git a/calamity/Calamity/Gateway/Shard.hs b/calamity/Calamity/Gateway/Shard.hs index 160cbd6..26645e3 100644 --- a/calamity/Calamity/Gateway/Shard.hs +++ b/calamity/Calamity/Gateway/Shard.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} -- | The shard logic module Calamity.Gateway.Shard ( Shard (..), diff --git a/calamity/Calamity/HTTP/Internal/Request.hs b/calamity/Calamity/HTTP/Internal/Request.hs index 2093889..b6e180d 100644 --- a/calamity/Calamity/HTTP/Internal/Request.hs +++ b/calamity/Calamity/HTTP/Internal/Request.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} -- | Generic Request type module Calamity.HTTP.Internal.Request ( Request (..), diff --git a/calamity/Calamity/Interactions/Utils.hs b/calamity/Calamity/Interactions/Utils.hs index 4c3708f..db05962 100644 --- a/calamity/Calamity/Interactions/Utils.hs +++ b/calamity/Calamity/Interactions/Utils.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} -- | Interaction related utilities module Calamity.Interactions.Utils ( respond, diff --git a/calamity/Calamity/Interactions/View.hs b/calamity/Calamity/Interactions/View.hs index bf37a0b..743c1f9 100644 --- a/calamity/Calamity/Interactions/View.hs +++ b/calamity/Calamity/Interactions/View.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} {-# LANGUAGE TemplateHaskell #-} module Calamity.Interactions.View ( diff --git a/calamity/Calamity/Internal/Utils.hs b/calamity/Calamity/Internal/Utils.hs index e85bfcc..cf37e4c 100644 --- a/calamity/Calamity/Internal/Utils.hs +++ b/calamity/Calamity/Internal/Utils.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} +{-# LANGUAGE CPP #-} -- | Internal utilities and instances module Calamity.Internal.Utils ( whileMFinalIO, @@ -172,6 +174,7 @@ instance Aeson.ToJSON a => Aeson.ToJSON (MaybeNull a) where toEncoding WasNull = null_ toEncoding (NotNull x) = Aeson.toEncoding x +#if MIN_VERSION_aeson(2,2,0) (.?=) :: (Aeson.ToJSON v, Aeson.KeyValue e kv) => Aeson.Key -> Maybe v -> Maybe kv k .?= Just v = Just (k Aeson..= v) _ .?= Nothing = Nothing @@ -180,7 +183,18 @@ _ .?= Nothing = Nothing k .= v = Just (k Aeson..= v) class CalamityToJSON' a where - toPairs :: Aeson.KeyValue e kv => a -> [Maybe kv] + toPairs :: Aeson.KeyValue kv => a -> [Maybe kv] +#else +(.?=) :: (Aeson.ToJSON v, Aeson.KeyValue kv) => Aeson.Key -> Maybe v -> Maybe kv +k .?= Just v = Just (k Aeson..= v) +_ .?= Nothing = Nothing + +(.=) :: (Aeson.ToJSON v, Aeson.KeyValue kv) => Aeson.Key -> v -> Maybe kv +k .= v = Just (k Aeson..= v) + +class CalamityToJSON' a where + toPairs :: Aeson.KeyValue kv => a -> [Maybe kv] +#endif newtype CalamityToJSON a = CalamityToJSON a diff --git a/calamity/Calamity/Types/CDNAsset.hs b/calamity/Calamity/Types/CDNAsset.hs index 40a4ef6..acda1cf 100644 --- a/calamity/Calamity/Types/CDNAsset.hs +++ b/calamity/Calamity/Types/CDNAsset.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-} -- | Things that can be fetched from the discord CDN module Calamity.Types.CDNAsset ( CDNAsset (..), diff --git a/calamity/calamity.cabal b/calamity/calamity.cabal index 73b7705..3d21294 100644 --- a/calamity/calamity.cabal +++ b/calamity/calamity.cabal @@ -183,19 +183,19 @@ library ViewPatterns ghc-options: - -fplugin=Polysemy.Plugin -funbox-strict-fields -Wall + -funbox-strict-fields -Wall -fno-warn-name-shadowing build-depends: - aeson >=2.2 && <2.3 + aeson >=2.1 && <2.3 , aeson-optics >=1.2 && <2 , async >=2.2 && <3 , base >=4.13 && <5 - , bytestring >=0.10 && <0.12 + , bytestring >=0.10 && <0.13 , calamity-commands >=0.4 && <0.5 , colour >=2.3.5 && <2.4 , concurrent-extra >=0.7 && <0.8 - , containers >=0.6 && <0.7 + , containers >=0.6 && <0.8 , crypton-connection >=0.2.6 && <0.4 , crypton-x509-system >=1.6.6 && <1.7 , data-default-class >=0.1 && <0.2 @@ -208,7 +208,7 @@ library , exceptions >=0.10 && <0.11 , focus >=1.0 && <2 , hashable >=1.2 && <2 - , http-api-data >=0.4.3 && <0.6 + , http-api-data >=0.4.3 && <0.7 , http-client >=0.5 && <0.8 , http-date >=0.0.8 && <0.1 , http-types >=0.12 && <0.13 @@ -226,15 +226,15 @@ library , stm >=2.5 && <3 , stm-chans >=3.0 && <4 , stm-containers >=1.1 && <2 - , text >=1.2 && <2.1 + , text >=1.2 && <2.2 , text-show >=3.8 && <4 - , time >=1.8 && <1.13 - , tls >=1.7 && <2 + , time >=1.8 && <1.15 + , tls >=1.7 && <3 , typerep-map >=0.5 && <0.7 , unagi-chan >=0.4 && <0.5 , unboxing-vector >=0.2 && <0.3 , unordered-containers >=0.2 && <0.3 , vector >=0.12 && <0.14 - , websockets >=0.12 && <0.13 + , websockets >=0.13 && <0.14 default-language: Haskell2010 diff --git a/flake.lock b/flake.lock index bf372a2..9ef2d83 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1688466019, - "narHash": "sha256-VeM2akYrBYMsb4W/MmBo1zmaMfgbL4cH3Pu8PGyIwJ0=", + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8e8d955c22df93dbe24f19ea04f47a74adbdc5ec", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", "type": "github" }, "original": { @@ -35,11 +35,11 @@ }, "flake-root": { "locked": { - "lastModified": 1680964220, - "narHash": "sha256-dIdTYcf+KW9a4pKHsEbddvLVSfR1yiAJynzg2x0nfWg=", + "lastModified": 1692742795, + "narHash": "sha256-f+Y0YhVCIJ06LemO+3Xx00lIcqQxSKJHXT/yk1RTKxw=", "owner": "srid", "repo": "flake-root", - "rev": "f1c0b93d05bdbea6c011136ba1a135c80c5b326c", + "rev": "d9a70d9c7a5fd7f3258ccf48da9335e9b47c3937", "type": "github" }, "original": { @@ -55,11 +55,11 @@ ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -70,11 +70,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1689107492, - "narHash": "sha256-lmiJka/2cxlX6XtFQVbgqH95cf2VPbAsFdGwaH0j82M=", + "lastModified": 1711376786, + "narHash": "sha256-AgTchS11b8y7RGLKv6tsHPuzthcgDok4VIpqq+BG5O4=", "owner": "srid", "repo": "haskell-flake", - "rev": "815315c0c1ffb3d5c54d0868fb7f7fd6987d8cde", + "rev": "b5bfa21723e55590e92f4896d7bc3ad212cf425a", "type": "github" }, "original": { @@ -85,11 +85,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1689601424, - "narHash": "sha256-WEqoSflQP65MF9O9k+JEkvUXMEoyCatmMAoLOowcEoE=", + "lastModified": 1711370797, + "narHash": "sha256-2xu0jVSjuKhN97dqc4bVtvEH52Rwh6+uyI1XCnzoUyI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d0f2758381caca8b4fb4a6cac61721cc9de06bd9", + "rev": "c726225724e681b3626acc941c6f95d2b0602087", "type": "github" }, "original": { @@ -102,11 +102,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1688049487, - "narHash": "sha256-100g4iaKC9MalDjUW9iN6Jl/OocTDtXdeAj7pEGIRh4=", + "lastModified": 1709237383, + "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4bc72cae107788bf3f24f30db2e2f685c9298dc9", + "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", "type": "github" }, "original": { @@ -117,22 +117,6 @@ "type": "github" } }, - "req": { - "flake": false, - "locked": { - "lastModified": 1688066193, - "narHash": "sha256-mI8Sx+RSXpYnLikC40psp7hPR5yITNVMwMFltT4Ril8=", - "owner": "mrkkrp", - "repo": "req", - "rev": "97da1e5bb2b12595ce73c4518783aaf9b3f86fc0", - "type": "github" - }, - "original": { - "owner": "mrkkrp", - "repo": "req", - "type": "github" - } - }, "root": { "inputs": { "check-flake": "check-flake", @@ -141,7 +125,6 @@ "gitignore": "gitignore", "haskell-flake": "haskell-flake", "nixpkgs": "nixpkgs", - "req": "req", "treefmt-nix": "treefmt-nix" } }, @@ -152,11 +135,11 @@ ] }, "locked": { - "lastModified": 1689620039, - "narHash": "sha256-BtNwghr05z7k5YMdq+6nbue+nEalvDepuA7qdQMAKoQ=", + "lastModified": 1710781103, + "narHash": "sha256-nehQK/XTFxfa6rYKtbi8M1w+IU1v5twYhiyA4dg1vpg=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "719c2977f958c41fa60a928e2fbc50af14844114", + "rev": "7ee5aaac63c30d3c97a8c56efe89f3b2aa9ae564", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 9b4aa17..2e9c4f5 100644 --- a/flake.nix +++ b/flake.nix @@ -17,8 +17,8 @@ flake-root.url = "github:srid/flake-root"; - req.url = "github:mrkkrp/req"; - req.flake = false; + # req.url = "github:mrkkrp/req"; + # req.flake = false; }; outputs = inputs@{ self, nixpkgs, gitignore, flake-parts, ... }: @@ -33,24 +33,35 @@ ]; perSystem = { self', lib, config, pkgs, ... }: { haskellProjects.default = { - basePackages = pkgs.haskell.packages.ghc945; + #basePackages = pkgs.haskell.packages.ghc981; packages = { - crypton-connection.source = "0.3.1"; - crypton-x509-system.source = "1.6.7"; - crypton-x509.source = "1.7.6"; - tls.source = "1.7.0"; - req.source = inputs.req; - http-client-tls.source = "0.3.6.2"; + type-errors.source = "0.2.0.2"; + websockets.source = "0.13.0.0"; + # crypton-connection.source = "0.3.1"; + # crypton-x509-system.source = "1.6.7"; + # crypton-x509.source = "1.7.6"; + # tls.source = "1.7.0"; + # req.source = inputs.req; + # http-client-tls.source = "0.3.6.2"; }; settings = { + aeson-optics.jailbreak = true; + type-errors.check = false; ListLike.check = false; di-core.check = false; optics.check = false; crypton-x509.check = false; vector.check = false; ghcid.check = false; + + haskell-language-server.custom = with pkgs.haskell.lib.compose; lib.flip lib.pipe [ + (disableCabalFlag "floskell") + (disableCabalFlag "ormolu") + (drv: drv.override { hls-ormolu-plugin = null; }) + (drv: drv.override { hls-floskell-plugin = null; }) + ]; }; devShell = {