mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-14 10:26:07 +00:00
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:
parent
c775913d93
commit
8856c17bbd
@ -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 ()
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user