Skip to content

Commit

Permalink
Resolve problems
Browse files Browse the repository at this point in the history
  • Loading branch information
simmsb committed Mar 27, 2024
1 parent 563fad0 commit f11c765
Show file tree
Hide file tree
Showing 19 changed files with 82 additions and 59 deletions.
1 change: 1 addition & 0 deletions calamity-commands/CalamityCommands/Dsl.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE RecursiveDo #-}
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}

-- | A DSL for generating commands and groups
module CalamityCommands.Dsl (
Expand Down
2 changes: 2 additions & 0 deletions calamity-commands/CalamityCommands/Help.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}

-- | A default help command implementation
module CalamityCommands.Help (
helpCommand',
Expand Down
1 change: 1 addition & 0 deletions calamity-commands/CalamityCommands/Parser.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}

-- | Something that can parse user input
module CalamityCommands.Parser (
Expand Down
1 change: 1 addition & 0 deletions calamity-commands/CalamityCommands/Utils.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE RecursiveDo #-}
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}

-- | Command handler utilities
module CalamityCommands.Utils (
Expand Down
4 changes: 2 additions & 2 deletions calamity-commands/calamity-commands.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions calamity/Calamity/Cache/InMemory.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -Wno-unused-top-binds #-}

Expand Down
1 change: 1 addition & 0 deletions calamity/Calamity/Client/Client.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
{-# OPTIONS_GHC -Wno-name-shadowing #-}

-- | The client
Expand Down
1 change: 1 addition & 0 deletions calamity/Calamity/Client/ShardManager.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
-- | Contains stuff for managing shards
module Calamity.Client.ShardManager (shardBot) where

Expand Down
1 change: 1 addition & 0 deletions calamity/Calamity/Commands/CalamityParsers.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}

-- | 'ParameterParser' instances for calamity models
Expand Down
1 change: 1 addition & 0 deletions calamity/Calamity/Commands/Dsl.hs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions calamity/Calamity/Gateway/Shard.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
-- | The shard logic
module Calamity.Gateway.Shard (
Shard (..),
Expand Down
1 change: 1 addition & 0 deletions calamity/Calamity/HTTP/Internal/Request.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
-- | Generic Request type
module Calamity.HTTP.Internal.Request (
Request (..),
Expand Down
1 change: 1 addition & 0 deletions calamity/Calamity/Interactions/Utils.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
-- | Interaction related utilities
module Calamity.Interactions.Utils (
respond,
Expand Down
1 change: 1 addition & 0 deletions calamity/Calamity/Interactions/View.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
{-# LANGUAGE TemplateHaskell #-}

module Calamity.Interactions.View (
Expand Down
16 changes: 15 additions & 1 deletion calamity/Calamity/Internal/Utils.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
{-# LANGUAGE CPP #-}
-- | Internal utilities and instances
module Calamity.Internal.Utils (
whileMFinalIO,
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions calamity/Calamity/Types/CDNAsset.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
-- | Things that can be fetched from the discord CDN
module Calamity.Types.CDNAsset (
CDNAsset (..),
Expand Down
18 changes: 9 additions & 9 deletions calamity/calamity.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
59 changes: 21 additions & 38 deletions flake.lock

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

29 changes: 20 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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, ... }:
Expand All @@ -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 = {
Expand Down

0 comments on commit f11c765

Please sign in to comment.