From 86550fb76ad90f23a434e2fa04e5de7f546ea4e4 Mon Sep 17 00:00:00 2001 From: Rahul Manne Date: Sun, 19 Dec 2021 15:44:46 -0800 Subject: [PATCH] Use cabal over stack; upgrade dependencies Aeson implemented KeyMap to use over Hashmap network client implemented equalCookieJar instead of Eq CookieJar --- .gitignore | 2 +- cabal.project | 7 ++ package.yaml | 151 ------------------------ reddit.cabal | 178 +++++++++++++++++++++++++++++ src/Reddit/Types/Empty.hs | 2 +- src/Reddit/Types/Reddit.hs | 2 +- stack.yaml => stack-lts-18.19.yaml | 0 7 files changed, 188 insertions(+), 154 deletions(-) create mode 100644 cabal.project delete mode 100644 package.yaml create mode 100644 reddit.cabal rename stack.yaml => stack-lts-18.19.yaml (100%) diff --git a/.gitignore b/.gitignore index b623f9b..3753bdc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ */.DS_Store .cabal-sandbox cabal.sandbox.config -*.cabal dist/ dist-newstyle/ test_config.yaml .stack-work/ stack*.yaml.lock result +.direnv diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000..543ddc3 --- /dev/null +++ b/cabal.project @@ -0,0 +1,7 @@ +packages: *.cabal + +source-repository-package + type: git + location: https://github.com/intolerable/api-builder.git + tag: f7440211195da98cfa93b6a97e51892b939919e1 + --sha256: 0x890cr9wlc7w4g679imm90bd07z03s07g6nhjsy97r1mq76igzh diff --git a/package.yaml b/package.yaml deleted file mode 100644 index 0bb18cd..0000000 --- a/package.yaml +++ /dev/null @@ -1,151 +0,0 @@ -name: reddit -version: '0.2.3.0' -synopsis: Library for interfacing with Reddit's API -description: > - A library for interfacing with Reddit''s API in Haskell. Handles - logins, rate-limiting and converting to and from JSON responses. - Supports most user-facing Reddit API functions, as well as some - moderator endpoints. - Check out the readme at . - - Contributions are welcome. - -category: Network -author: Fraser Murray -maintainer: fraser.m.murray@gmail.com -copyright: Copyright (c) Fraser Murray, 2013-2018 -license: BSD2 -github: intolerable/reddit - -extra-source-files: - - README.md - - test/data/aboutMe_example.json - - test/data/getUserInfo_example.json - - test/data/getUserComments_example.json - -ghc-options: - - -Wall -Wcompat - -default-extensions: - - FlexibleInstances - - GADTs - - GeneralizedNewtypeDeriving - - LambdaCase - - OverloadedStrings - - OverloadedStrings - -library: - source-dirs: src - ghc-options: - - -fno-warn-dodgy-imports - exposed-modules: - - Reddit - - Reddit.Actions - - Reddit.Actions.Captcha - - Reddit.Actions.Comment - - Reddit.Actions.Flair - - Reddit.Actions.Message - - Reddit.Actions.Moderation - - Reddit.Actions.OAuth - - Reddit.Actions.Post - - Reddit.Actions.Search - - Reddit.Actions.Subreddit - - Reddit.Actions.Thing - - Reddit.Actions.User - - Reddit.Actions.Voting - - Reddit.Actions.Wiki - - Reddit.Login - - Reddit.Types - - Reddit.Types.Captcha - - Reddit.Types.Comment - - Reddit.Types.Error - - Reddit.Types.Flair - - Reddit.Types.Listing - - Reddit.Types.Message - - Reddit.Types.Moderation - - Reddit.Types.Options - - Reddit.Types.OAuth - - Reddit.Types.Post - - Reddit.Types.Reddit - - Reddit.Types.SearchOptions - - Reddit.Types.Subreddit - - Reddit.Types.SubredditSettings - - Reddit.Types.Thing - - Reddit.Types.User - - Reddit.Types.Wiki - dependencies: - - base >=4.6 - - aeson >=0.9 - - api-builder >=0.10 - - bytestring ==0.10.* - - data-default-class >=0.0.1 - - free >=4 - - http-client >=0.4.30 - - http-client-tls >=0.2 - - http-types >=0.8 - - network >=2.6 - - text ==1.* - - time >=1.5 - - transformers >=0.4 - - unordered-containers >=0.2.5 - - vector >=0.10 - - base64-bytestring - -tests: - - test-anon: - main: Spec.hs - source-dirs: - - test-anon - - test-utils - default-extensions: - - Rank2Types - dependencies: - - base ==4.* - - Cabal >=1.16.0 - - api-builder - - data-default-class - - reddit - - hspec - - text - - time - - transformers - - test-io: - main: Spec.hs - source-dirs: - - test-io - - test-utils - default-extensions: - - Rank2Types - - RecordWildCards - dependencies: - - base ==4.* - - Cabal >=1.16.0 - - api-builder - - bytestring - - data-default-class - - directory - - http-client - - http-client-tls - - reddit - - hspec - - text - - time - - transformers - - yaml - - test: - main: Spec.hs - source-dirs: test - dependencies: - - base ==4.* - - Cabal >=1.16.0 - - aeson - - api-builder - - bytestring - - reddit - - hspec - - text - - time - - transformers diff --git a/reddit.cabal b/reddit.cabal new file mode 100644 index 0000000..1b143f6 --- /dev/null +++ b/reddit.cabal @@ -0,0 +1,178 @@ +cabal-version: 2.4 +name: reddit +version: 0.2.3.0 +license: BSD-2-Clause +copyright: Copyright (c) Fraser Murray, 2013-2018 +maintainer: fraser.m.murray@gmail.com +author: Fraser Murray +category: Network + +-- TODO: Before hackage release. +-- A short (one-line) description of the package. +-- synopsis: + +-- A longer description of the package. +description: > + A library for interfacing with Reddit''s API in Haskell. Handles + logins, rate-limiting and converting to and from JSON responses. + Supports most user-facing Reddit API functions, as well as some + moderator endpoints. + Check out the readme at . + + Contributions are welcome. + +-- A URL where users can report bugs. +-- bug-reports: + +extra-source-files: + LICENSE + README.md + +library + build-depends: + , base + , text + , base >=4.6 + , aeson >=0.9 + , api-builder >=0.10 + , bytestring ==0.10.* + , data-default-class >=0.0.1 + , free >=4 + , http-client >=0.4.30 + , http-client-tls >=0.2 + , http-types >=0.8 + , network >=2.6 + , text ==1.* + , time >=1.5 + , transformers >=0.4 + , unordered-containers >=0.2.5 + , vector >=0.10 + , base64-bytestring + + exposed-modules: + Reddit + , Reddit.Actions + , Reddit.Actions.Captcha + , Reddit.Actions.Comment + , Reddit.Actions.Flair + , Reddit.Actions.Message + , Reddit.Actions.Moderation + , Reddit.Actions.OAuth + , Reddit.Actions.Post + , Reddit.Actions.Search + , Reddit.Actions.Subreddit + , Reddit.Actions.Thing + , Reddit.Actions.User + , Reddit.Actions.Voting + , Reddit.Actions.Wiki + , Reddit.Login + , Reddit.Types + , Reddit.Types.Captcha + , Reddit.Types.Comment + , Reddit.Types.Error + , Reddit.Types.Flair + , Reddit.Types.Listing + , Reddit.Types.Message + , Reddit.Types.Moderation + , Reddit.Types.Options + , Reddit.Types.OAuth + , Reddit.Types.Post + , Reddit.Types.Reddit + , Reddit.Types.SearchOptions + , Reddit.Types.Subreddit + , Reddit.Types.SubredditSettings + , Reddit.Types.Thing + , Reddit.Types.User + , Reddit.Types.Wiki + + , Reddit.Parser + , Reddit.Routes + , Reddit.Routes.Captcha + , Reddit.Routes.Comment + , Reddit.Routes.Flair + , Reddit.Routes.Message + , Reddit.Routes.Moderation + , Reddit.Routes.Post + , Reddit.Routes.Search + , Reddit.Routes.Subreddit + , Reddit.Routes.Thing + , Reddit.Routes.User + , Reddit.Routes.Vote + , Reddit.Routes.Wiki + , Reddit.Types.Empty + , Reddit.Utilities + + other-modules: + Paths_reddit + + ghc-options: + -Wall -Wcompat -fno-warn-dodgy-imports + + default-extensions: + FlexibleInstances + GADTs + GeneralizedNewtypeDeriving + LambdaCase + OverloadedStrings + + hs-source-dirs: src + default-language: Haskell2010 + +-- tests: +-- +-- test-anon: +-- main: Spec.hs +-- source-dirs: +-- - test-anon +-- - test-utils +-- default-extensions: +-- - Rank2Types +-- dependencies: +-- - base ==4.* +-- - Cabal >=1.16.0 +-- - api-builder +-- - data-default-class +-- - reddit +-- - hspec +-- - text +-- - time +-- - transformers +-- +-- test-io: +-- main: Spec.hs +-- source-dirs: +-- - test-io +-- - test-utils +-- default-extensions: +-- - Rank2Types +-- - RecordWildCards +-- dependencies: +-- - base ==4.* +-- - Cabal >=1.16.0 +-- - api-builder +-- - bytestring +-- - data-default-class +-- - directory +-- - http-client +-- - http-client-tls +-- - reddit +-- - hspec +-- - text +-- - time +-- - transformers +-- - yaml +-- +-- test: +-- main: Spec.hs +-- source-dirs: test +-- dependencies: +-- - base ==4.* +-- - Cabal >=1.16.0 +-- - aeson +-- - api-builder +-- - bytestring +-- - reddit +-- - hspec +-- - text +-- - time +-- - transformers diff --git a/src/Reddit/Types/Empty.hs b/src/Reddit/Types/Empty.hs index c0aa232..e31b6f7 100644 --- a/src/Reddit/Types/Empty.hs +++ b/src/Reddit/Types/Empty.hs @@ -5,7 +5,7 @@ import Data.Aeson import Data.Aeson.Types import Data.Monoid import Prelude -import qualified Data.HashMap.Strict as Hash +import qualified Data.Aeson.KeyMap as Hash -- | More specific @void@ for forcing a @Empty@ @FromJSON@ instance nothing :: Monad m => m Empty -> m () diff --git a/src/Reddit/Types/Reddit.hs b/src/Reddit/Types/Reddit.hs index 80953c4..cefb0e3 100644 --- a/src/Reddit/Types/Reddit.hs +++ b/src/Reddit/Types/Reddit.hs @@ -98,7 +98,7 @@ instance FromJSON Modhash where parseJSON _ = mempty data LoginDetails = LoginDetails Modhash CookieJar - deriving (Show, Eq) + deriving Show instance Receivable LoginDetails where receive x = do diff --git a/stack.yaml b/stack-lts-18.19.yaml similarity index 100% rename from stack.yaml rename to stack-lts-18.19.yaml