ihaskell-widgets fixes for GHC < 9.0 (#1529)

* ihaskell-widgets: work with aeson <2
* stack/stack-8.{4,6}: turn off -Werror
This commit is contained in:
Vaibhav Sagar 2024-10-23 13:10:12 +11:00 committed by GitHub
parent c775913d93
commit 8856c17bbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
@ -26,6 +27,10 @@ import Control.Monad (void)
import Data.Aeson
import Data.Aeson.Types (parse)
import Data.IORef (newIORef)
#if MIN_VERSION_aeson(2,0,0)
#else
import Data.Text (Text)
#endif
import Data.Vinyl (Rec(..), (<+>))
import IHaskell.Display
@ -78,9 +83,15 @@ instance IHaskellWidget Controller where
parseAndSet @Connected "connected"
parseAndSet @Timestamp "timestamp"
triggerChange widget
#if MIN_VERSION_aeson(2,0,0)
where parseAndSet :: forall f. (RElemOf f (WidgetFields ControllerType),
IHaskellWidget Controller,
ToKey f, FromJSON (FieldType f)) => Key -> IO ()
#else
where parseAndSet :: forall f. (RElemOf f (WidgetFields ControllerType),
IHaskellWidget Controller,
ToKey f, FromJSON (FieldType f)) => Text -> IO ()
#endif
parseAndSet s = case parse (.: s) o of
Success x -> void $ setField' @f widget x
_ -> pure ()

View File

@ -29,9 +29,9 @@ extra-deps:
ghc-options:
# Eventually we want "$locals": -Wall -Wpartial-fields -Werror
ghc-parser: -Wall -Wpartial-fields -Werror
ihaskell: -Wall -Wpartial-fields -Werror
ihaskell-widgets: -Wall -Wpartial-fields -Werror
# ghc-parser: -Wall -Wpartial-fields -Werror
# ihaskell: -Wall -Wpartial-fields -Werror
# ihaskell-widgets: -Wall -Wpartial-fields -Werror
nix:
packages:

View File

@ -28,9 +28,9 @@ extra-deps:
ghc-options:
# Eventually we want "$locals": -Wall -Wpartial-fields -Werror
ghc-parser: -Wall -Wpartial-fields -Werror
ihaskell: -Wall -Wpartial-fields -Werror
ihaskell-widgets: -Wall -Wpartial-fields -Werror
# ghc-parser: -Wall -Wpartial-fields -Werror
# ihaskell: -Wall -Wpartial-fields -Werror
# ihaskell-widgets: -Wall -Wpartial-fields -Werror
nix:
packages: