From 33be3852893b584301ed0282cec8ab8e5fbab725 Mon Sep 17 00:00:00 2001 From: Eduard Nicodei Date: Sat, 22 Jun 2024 11:05:37 +0100 Subject: [PATCH] breaking changes --- contrib/cabal.project | 3 ++- lib/unison-sqlite/src/Unison/Sqlite/Connection.hs | 4 ++-- parser-typechecker/src/Unison/Runtime/MCode.hs | 1 - parser-typechecker/src/Unison/Runtime/Serialize.hs | 1 - unison-cli/src/Unison/Cli/Share/Projects.hs | 7 +++---- unison-cli/src/Unison/Share/Sync.hs | 8 ++++---- unison-cli/unison-cli.cabal | 6 +++--- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/contrib/cabal.project b/contrib/cabal.project index 6e71a2f181..f7814ac4cc 100644 --- a/contrib/cabal.project +++ b/contrib/cabal.project @@ -1,4 +1,5 @@ packages: + ../fuzzyfind codebase2/codebase codebase2/codebase-sqlite codebase2/codebase-sqlite-hashing-v2 @@ -50,7 +51,7 @@ source-repository-package constraints: fsnotify < 0.4, crypton-x509-store <= 1.6.8, - servant <= 0.19.1, + servant <= 0.20.1, optparse-applicative <= 0.17.1.0 -- For now there is no way to apply ghc-options for all local packages diff --git a/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs b/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs index f46917ddc8..b133adef4e 100644 --- a/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs +++ b/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs @@ -172,9 +172,9 @@ execute conn@(Connection _ _ conn0) sql@(Sql s params) = do -- -- This function does not support parameters, and is mostly useful for executing DDL and migrations. executeStatements :: Connection -> Text -> IO () -executeStatements conn@(Connection _ _ (Sqlite.Connection database)) sql = do +executeStatements conn@(Connection _ _ connection) sql = do logQuery (Sql sql []) Nothing - Direct.Sqlite.exec database sql `catch` \(exception :: Sqlite.SQLError) -> + Direct.Sqlite.exec (Sqlite.connectionHandle connection) sql `catch` \(exception :: Sqlite.SQLError) -> throwSqliteQueryException SqliteQueryExceptionInfo { connection = conn, diff --git a/parser-typechecker/src/Unison/Runtime/MCode.hs b/parser-typechecker/src/Unison/Runtime/MCode.hs index 28f821f231..c3d9c837bb 100644 --- a/parser-typechecker/src/Unison/Runtime/MCode.hs +++ b/parser-typechecker/src/Unison/Runtime/MCode.hs @@ -36,7 +36,6 @@ module Unison.Runtime.MCode ) where -import Control.Applicative (liftA2) import Data.Bifunctor (bimap, first) import Data.Bits (shiftL, shiftR, (.|.)) import Data.Coerce diff --git a/parser-typechecker/src/Unison/Runtime/Serialize.hs b/parser-typechecker/src/Unison/Runtime/Serialize.hs index 622fc11e79..1d1213cc45 100644 --- a/parser-typechecker/src/Unison/Runtime/Serialize.hs +++ b/parser-typechecker/src/Unison/Runtime/Serialize.hs @@ -2,7 +2,6 @@ module Unison.Runtime.Serialize where -import Control.Applicative (liftA2) import Control.Monad (replicateM) import Data.Bits (Bits) import Data.ByteString qualified as B diff --git a/unison-cli/src/Unison/Cli/Share/Projects.hs b/unison-cli/src/Unison/Cli/Share/Projects.hs index 961ed69858..a328f369e0 100644 --- a/unison-cli/src/Unison/Cli/Share/Projects.hs +++ b/unison-cli/src/Unison/Cli/Share/Projects.hs @@ -256,10 +256,9 @@ servantClientToCli action = do let clientEnv :: ClientEnv clientEnv = (mkClientEnv httpManager hardCodedBaseUrl) - { Servant.makeClientRequest = \url request -> - (Servant.defaultMakeClientRequest url request) - { Http.Client.responseTimeout = Http.Client.responseTimeoutMicro (60 * 1000 * 1000 {- 60s -}) - } + { Servant.makeClientRequest = \url request -> do + defaultRequest <- (Servant.defaultMakeClientRequest url request) + return defaultRequest { Http.Client.responseTimeout = Http.Client.responseTimeoutMicro (60 * 1000 * 1000 {- 60s -}) } } liftIO (runClientM action clientEnv) diff --git a/unison-cli/src/Unison/Share/Sync.hs b/unison-cli/src/Unison/Share/Sync.hs index 8df14b8f99..69f2508d8c 100644 --- a/unison-cli/src/Unison/Share/Sync.hs +++ b/unison-cli/src/Unison/Share/Sync.hs @@ -1051,10 +1051,10 @@ httpUploadEntities :: go f (Auth.AuthenticatedHttpClient httpClient) unisonShareUrl req = (Servant.mkClientEnv httpClient unisonShareUrl) { Servant.makeClientRequest = \url request -> - -- Disable client-side timeouts - (Servant.defaultMakeClientRequest url request) - { Http.Client.responseTimeout = Http.Client.responseTimeoutNone - } + do + -- Disable client-side timeouts + defaultRequest <- (Servant.defaultMakeClientRequest url request) + return defaultRequest {Http.Client.responseTimeout = Http.Client.responseTimeoutNone} } & runReaderT (f req) & runExceptT diff --git a/unison-cli/unison-cli.cabal b/unison-cli/unison-cli.cabal index 12dac1eea3..151c7ee96a 100644 --- a/unison-cli/unison-cli.cabal +++ b/unison-cli/unison-cli.cabal @@ -236,7 +236,7 @@ library , semialign , semigroups , servant - , servant-client + , servant-client >=0.20 , shellmet , stm , template-haskell @@ -378,7 +378,7 @@ executable transcripts , semialign , semigroups , servant - , servant-client + , servant-client >=0.20 , shellmet , silently , stm @@ -526,7 +526,7 @@ test-suite cli-tests , semialign , semigroups , servant - , servant-client + , servant-client >=0.20 , shellmet , stm , template-haskell