From 9d7e697474720b2c6e78fbf11066a8499fc55807 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 8 Dec 2018 13:26:14 -0400 Subject: Update to lts-12.10, support ghc 8.4, and aeson 1.3. Don't fully understand the need for the MonoLocalBinds language extension, which was not needed before but now ghc complains if it's not included, but I've tested it and it does work. All the rest of the changes are straightforward AMP changes and dep updates. Removed fgl from stack.yaml because it seems that indirect dep no longer needs to be specified for stack to build. Added custom-setup stanza since stack now warns without one. This commit was sponsored by Trenton Cronholm on Patreon. --- CHANGELOG | 4 ++-- CmdLine.hs | 1 - Crypto.hs | 8 ++++++-- Graphviz.hs | 3 ++- ProtocolBuffers.hs | 3 ++- Role/Developer.hs | 3 ++- Role/User.hs | 3 ++- Session.hs | 1 + Types.hs | 6 +++++- Val.hs | 3 ++- WebSockets.hs | 3 ++- debug-me.cabal | 7 +++++-- doc/bugs/fails_to_build_against_current_LTS_Haskell.mdwn | 2 ++ stack.yaml | 5 ++--- 14 files changed, 35 insertions(+), 17 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c4f2857..d80372c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,6 @@ -debug-me (1.20170811) UNRELEASED; urgency=medium +debug-me (1.20181208) UNRELEASED; urgency=medium - * stack.yaml: Update to lts-11.17. + * Update to lts-12.10, support ghc 8.4, and aeson 1.3. -- Joey Hess Tue, 10 Jul 2018 13:28:50 -0400 diff --git a/CmdLine.hs b/CmdLine.hs index 2a64b6c..28227d4 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -8,7 +8,6 @@ module CmdLine where import Types import ServerList -import Data.Monoid import Options.Applicative import Network.URI import Network.Wai.Handler.Warp (Port) diff --git a/Crypto.hs b/Crypto.hs index 2fe27e0..af3ad17 100644 --- a/Crypto.hs +++ b/Crypto.hs @@ -16,6 +16,7 @@ import Crypto.Error import Crypto.Random.Entropy import Data.ByteArray (convert) import qualified Data.ByteString as B +import qualified Data.Semigroup as Sem dummySignature :: Signature dummySignature = OtherSignature (Val mempty) @@ -78,10 +79,13 @@ mkSigVerifier (PublicKey (Val pk)) = CryptoPassed pk' -> SigVerifier 1 (Ed25519.verify pk') CryptoFailed _ -> mempty +instance Sem.Semigroup SigVerifier where + SigVerifier na a <> SigVerifier nb b = + SigVerifier (na+nb) $ \d s -> b d s || a d s + instance Monoid SigVerifier where mempty = SigVerifier 0 $ \_b _s -> False - mappend (SigVerifier na a) (SigVerifier nb b) = - SigVerifier (na+nb) $ \d s -> b d s || a d s + mappend = (Sem.<>) data MySessionKey = MySessionKey Ed25519.SecretKey Ed25519.PublicKey diff --git a/Graphviz.hs b/Graphviz.hs index f8f165c..abbb93a 100644 --- a/Graphviz.hs +++ b/Graphviz.hs @@ -12,7 +12,6 @@ import CmdLine import Log import Data.Char hiding (Control) -import Data.Monoid import Data.GraphViz import Data.GraphViz.Attributes.Complete import Data.GraphViz.Types.Generalised as G @@ -23,6 +22,8 @@ import qualified Data.ByteString.Lazy as L import qualified Data.Text.Lazy as T import qualified Data.Text.Lazy.Encoding as T import Data.Text.Encoding.Error +import Data.Monoid +import Prelude graphviz :: GraphvizOpts -> IO () graphviz opts = do diff --git a/ProtocolBuffers.hs b/ProtocolBuffers.hs index e87a156..d7c7799 100644 --- a/ProtocolBuffers.hs +++ b/ProtocolBuffers.hs @@ -5,7 +5,7 @@ {-# LANGUAGE DeriveGeneric, DataKinds, MultiParamTypeClasses #-} {-# LANGUAGE FlexibleContexts, UndecidableInstances #-} -{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE OverloadedStrings, MonoLocalBinds #-} {- | Protocol buffers serialization for the debug-me wire protocol. - @@ -319,6 +319,7 @@ instance Encode a => Encode (MessageP a) -- This is why UndecidableInstances is needed. The need -- for a Monoid instance is an implementation detail of -- Data.ProtocolBuffers. +-- MonoLocalBinds is also used to avoid a ghc warning. instance (Monoid (Message a), Generic a, Decode a) => Decode (MessageP a) instance Encode a => Encode (ActivityP a) instance (Monoid (Message a), Generic a, Decode a) => Decode (ActivityP a) diff --git a/Role/Developer.hs b/Role/Developer.hs index d706a7a..abdad08 100644 --- a/Role/Developer.hs +++ b/Role/Developer.hs @@ -38,9 +38,10 @@ import qualified Data.Text as T import Data.List import Data.Maybe import Control.Monad -import Data.Monoid import Data.Time.Clock.POSIX import Network.URI +import Data.Monoid +import Prelude run :: DeveloperOpts -> IO () run = run' developer . debugUrl diff --git a/Role/User.hs b/Role/User.hs index 6ee1a42..6ec0302 100644 --- a/Role/User.hs +++ b/Role/User.hs @@ -30,11 +30,12 @@ import System.Exit import qualified Data.Text.IO as T import qualified Data.ByteString as B import Data.List.NonEmpty (NonEmpty(..), toList) -import Data.Monoid import Data.Maybe import Data.Time.Clock.POSIX import System.IO import System.Environment +import Data.Monoid +import Prelude run :: UserOpts -> IO ExitCode run os = fromMaybe (ExitFailure 101) <$> connect diff --git a/Session.hs b/Session.hs index 9571ed1..7343e82 100644 --- a/Session.hs +++ b/Session.hs @@ -11,6 +11,7 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as B8 import System.Exit import Data.Monoid +import Prelude startSession :: B.ByteString startSession = "** debug-me session started" diff --git a/Types.hs b/Types.hs index ce986c7..bbf296f 100644 --- a/Types.hs +++ b/Types.hs @@ -22,6 +22,7 @@ import JSON import qualified Data.Text as T import Data.Time.Clock.POSIX +import qualified Data.Semigroup as Sem -- | Things that the developer sees. data Seen = Seen @@ -194,9 +195,12 @@ newtype ElapsedTime = ElapsedTime Double mkElapsedTime :: POSIXTime -> POSIXTime -> ElapsedTime mkElapsedTime start end = ElapsedTime $ fromRational $ toRational (end - start) +instance Sem.Semigroup ElapsedTime where + ElapsedTime a <> ElapsedTime b = ElapsedTime (a+b) + instance Monoid ElapsedTime where mempty = ElapsedTime 0 - mappend (ElapsedTime a) (ElapsedTime b) = ElapsedTime (a+b) + mappend = (Sem.<>) instance DataSize ElapsedTime where dataSize _ = 16 -- 128 bit Double diff --git a/Val.hs b/Val.hs index c395a95..f024b9d 100644 --- a/Val.hs +++ b/Val.hs @@ -16,10 +16,11 @@ import qualified Codec.Binary.Base64 as B64 import qualified Data.Text as T import qualified Data.Text.Encoding as T import qualified Data.ByteString as B +import qualified Data.Semigroup as Sem -- | Newtype of ByteString so we can have JSON instances without orphans. newtype Val = Val { val :: B.ByteString } - deriving (Show, Generic, Eq, Monoid) + deriving (Show, Generic, Eq, Sem.Semigroup, Monoid) instance DataSize Val where dataSize (Val b) = fromIntegral (B.length b) diff --git a/WebSockets.hs b/WebSockets.hs index c2fcb95..7a53c8c 100644 --- a/WebSockets.hs +++ b/WebSockets.hs @@ -40,12 +40,13 @@ import qualified Data.Serialize import qualified Data.Text as T import qualified Data.ByteString.Lazy as L import Data.List -import Data.Monoid import Data.Maybe import Text.Read import Control.Monad import Network.URI import System.IO +import Data.Monoid +import Prelude -- | Framing protocol used over a websocket connection. -- diff --git a/debug-me.cabal b/debug-me.cabal index a601e34..9fa28b9 100644 --- a/debug-me.cabal +++ b/debug-me.cabal @@ -45,6 +45,9 @@ Extra-Source-Files: debug-me.default developer-keyring.gpg +custom-setup + Setup-Depends: base (>= 4.9 && < 5.0), Cabal, filepath + Executable debug-me Main-Is: debug-me.hs GHC-Options: -threaded -Wall -fno-warn-tabs -O2 @@ -60,11 +63,11 @@ Executable debug-me , stm-chans (>= 3.0) , posix-pty (>= 0.2.1) , terminal-size (>= 0.3) - , aeson (>= 0.11 && < 1.3) + , aeson (>= 0.11 && < 1.4) , sandi (>= 0.4) , text (>= 1.2.2) , optparse-applicative (>= 0.12) - , graphviz (== 2999.18.*) + , graphviz (>= 2999.18.0 && < 2999.21) , time (>= 1.6) , filepath (>= 1.4) , directory (>= 1.2) diff --git a/doc/bugs/fails_to_build_against_current_LTS_Haskell.mdwn b/doc/bugs/fails_to_build_against_current_LTS_Haskell.mdwn index 52b9faf..2d1c0aa 100644 --- a/doc/bugs/fails_to_build_against_current_LTS_Haskell.mdwn +++ b/doc/bugs/fails_to_build_against_current_LTS_Haskell.mdwn @@ -13,3 +13,5 @@ debug-me fails to build against LTS 8.23: make[2]: *** [debug-me] Error 1 --spwhitton + +> [[fixed|done]] --[[Joey]] diff --git a/stack.yaml b/stack.yaml index abe5576..ca6d0ad 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,9 +1,8 @@ packages: - '.' -resolver: lts-11.17 +resolver: lts-12.10 extra-deps: -- graphviz-2999.18.1.2 +- graphviz-2999.20.0.2 - posix-pty-0.2.1.1 - sandi-0.4.2 -- fgl-5.5.4.0 explicit-setup-deps: -- cgit v1.2.3