From def87231b2f7421c295364ed81a5f69e294b4dcf Mon Sep 17 00:00:00 2001 From: Anatolii Prylutskyi Date: Mon, 9 Feb 2026 19:52:09 +0200 Subject: [PATCH 1/2] Add GHC 9.6+ and aeson 2.2 compatibility for socket-io - Add AllowAmbiguousTypes pragma to SocketIO.hs - Replace generic OnArgs base instance with EventHandler-specific instance to satisfy GHC 9.6+ stricter fundep checking - Add attoparsec-aeson dependency and import Data.Aeson.Parser for the json parser (moved from Data.Aeson in aeson 2.2) Co-Authored-By: Claude Opus 4.6 (1M context) --- socket-io/socket-io.cabal | 1 + socket-io/src/Network/SocketIO.hs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/socket-io/socket-io.cabal b/socket-io/socket-io.cabal index 8c856ae..d76b5c0 100644 --- a/socket-io/socket-io.cabal +++ b/socket-io/socket-io.cabal @@ -24,6 +24,7 @@ library build-depends: aeson >=0.7 && <1.6, attoparsec >=0.10 && <0.14, + attoparsec-aeson, base >=4.6 && <4.15, bytestring >=0.10 && <0.12, engine-io >= 1 && <1.3, diff --git a/socket-io/src/Network/SocketIO.hs b/socket-io/src/Network/SocketIO.hs index 4c044b5..594b81a 100644 --- a/socket-io/src/Network/SocketIO.hs +++ b/socket-io/src/Network/SocketIO.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} @@ -63,6 +64,7 @@ import Data.Ord (comparing) import qualified Control.Concurrent.STM as STM import qualified Data.Aeson as Aeson +import qualified Data.Aeson.Parser as AesonParser import qualified Data.Attoparsec.ByteString as Attoparsec import qualified Data.Attoparsec.ByteString.Char8 as AttoparsecC8 import qualified Data.ByteString.Builder as Builder @@ -123,7 +125,7 @@ parsePacket = do pIdStr <- (Just <$> numberStr) <|> pure Nothing - Packet t attachments namespace pIdStr <$> ((Just <$> Aeson.json) <|> pure Nothing) + Packet t attachments namespace pIdStr <$> ((Just <$> AesonParser.json) <|> pure Nothing) where @@ -254,7 +256,7 @@ onJSON eventName handler = class OnArgs a r | a -> r where parseArgs :: Aeson.Array -> a -> Maybe r -instance OnArgs a a where +instance OnArgs (EventHandler a) (EventHandler a) where parseArgs v m | V.null v = Just m | otherwise = Nothing From 4d3be600a479d86be371701636daca16468a4865 Mon Sep 17 00:00:00 2001 From: Anatolii Prylutskyi Date: Mon, 9 Feb 2026 20:22:07 +0200 Subject: [PATCH 2/2] Relax cabal dependency bounds for GHC 9.8 + aeson 2.2 Update upper bounds in engine-io.cabal and socket-io.cabal to support GHC 9.8 (base 4.19, text 2.1, mtl 2.3, transformers 0.6) and aeson 2.2.x. --- engine-io/engine-io.cabal | 18 +++++++++--------- socket-io/socket-io.cabal | 16 ++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/engine-io/engine-io.cabal b/engine-io/engine-io.cabal index 1e72067..7eb1f86 100644 --- a/engine-io/engine-io.cabal +++ b/engine-io/engine-io.cabal @@ -27,23 +27,23 @@ library RankNTypes, OverloadedStrings, RecordWildCards build-depends: - aeson >=0.7 && <1.6, + aeson >=2.0 && <2.3, async >=2.0 && <2.3, - attoparsec >=0.11 && <0.14, - base >=4.8 && <4.15, + attoparsec >=0.11 && <0.15, + base >=4.8 && <4.21, base64-bytestring >=1.0 && <1.3, - bytestring >=0.10.2.0 && <0.12, + bytestring >=0.10.2.0 && <0.13, errors >= 2.0.0 && <2.4, - free >= 4.9 && <5.2, + free >= 4.9 && <5.3, monad-loops >=0.4 && <0.5, mwc-random >=0.13 && <0.16, stm >=2.4 && <2.6, stm-delay >= 0.1.1 && <0.2, - text >=0.11 && <1.3, - transformers >=0.2 && <0.6, + text >=0.11 && <2.2, + transformers >=0.2 && <0.7, unordered-containers >=0.2 && <0.3, - vector >=0.10 && <0.13, - websockets >=0.11 && <0.13 + vector >=0.10 && <0.14, + websockets >=0.11 && <0.14 hs-source-dirs: src default-language: Haskell2010 diff --git a/socket-io/socket-io.cabal b/socket-io/socket-io.cabal index d76b5c0..9f93543 100644 --- a/socket-io/socket-io.cabal +++ b/socket-io/socket-io.cabal @@ -22,18 +22,18 @@ library FlexibleContexts, OverloadedStrings, RankNTypes build-depends: - aeson >=0.7 && <1.6, - attoparsec >=0.10 && <0.14, + aeson >=2.0 && <2.3, + attoparsec >=0.10 && <0.15, attoparsec-aeson, - base >=4.6 && <4.15, - bytestring >=0.10 && <0.12, + base >=4.6 && <4.21, + bytestring >=0.10 && <0.13, engine-io >= 1 && <1.3, - mtl >=2.1 && <2.3, + mtl >=2.1 && <2.4, stm >=2.4 && <2.6, - text >=0.11 && <1.3, - transformers >=0.2 && <0.6, + text >=0.11 && <2.2, + transformers >=0.2 && <0.7, unordered-containers >=0.2 && <0.3, - vector >=0.10 && <0.13 + vector >=0.10 && <0.14 hs-source-dirs: src default-language: Haskell2010