diff --git a/ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Controller/Controller.hs b/ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Controller/Controller.hs index c8e71f42..759a5a4e 100644 --- a/ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Controller/Controller.hs +++ b/ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Controller/Controller.hs @@ -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 () diff --git a/stack/stack-8.4.yaml b/stack/stack-8.4.yaml index bf0106fc..c2ed85bf 100644 --- a/stack/stack-8.4.yaml +++ b/stack/stack-8.4.yaml @@ -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: diff --git a/stack/stack-8.6.yaml b/stack/stack-8.6.yaml index c95cdac3..4e94b263 100644 --- a/stack/stack-8.6.yaml +++ b/stack/stack-8.6.yaml @@ -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: