Skip to content

Commit d73a4f9

Browse files
committed
Add some version constaints
1 parent 9de00b7 commit d73a4f9

File tree

3 files changed

+8
-43
lines changed

3 files changed

+8
-43
lines changed

library/Neovim/RPC/EventHandler.hs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ import Control.Concurrent.STM hiding (writeTQueue)
2828
import Control.Monad.Reader
2929
import Control.Monad.Trans.Resource
3030
import Data.ByteString (ByteString)
31-
import Data.Conduit as C
32-
#if MIN_VERSION_conduit_extra(1,2,2)
33-
import Data.Conduit.Binary (sinkHandleFlush)
34-
#else
35-
import Data.Conduit.Binary (sinkHandle)
36-
#endif
31+
import Conduit as C
3732
import qualified Data.Map as Map
3833
import Data.Serialize (encode)
3934
import System.IO (Handle)
@@ -51,11 +46,7 @@ runEventHandler writeableHandle env =
5146
runEventHandlerContext env . runConduit $ do
5247
eventHandlerSource
5348
.| eventHandler
54-
#if MIN_VERSION_conduit_extra(1,2,2)
5549
.| (sinkHandleFlush writeableHandle)
56-
#else
57-
.| (sinkHandle writeableHandle)
58-
#endif
5950

6051

6152
-- | Convenient monad transformer stack for the event handler
@@ -86,21 +77,13 @@ eventHandler = await >>= \case
8677
eventHandler
8778

8879

89-
#if MIN_VERSION_conduit_extra(1,2,2)
90-
type EncodedResponse = Flush ByteString
91-
#else
92-
type EncodedResponse = ByteString
93-
#endif
80+
type EncodedResponse = C.Flush ByteString
9481

9582
yield' :: (MonadIO io) => MsgpackRPC.Message -> ConduitM i EncodedResponse io ()
9683
yield' o = do
9784
liftIO . debugM "EventHandler" $ "Sending: " ++ show o
98-
#if MIN_VERSION_conduit_extra(1,2,2)
9985
yield . Chunk . encode $ toObject o
10086
yield Flush
101-
#else
102-
yield . encode $ toObject o
103-
#endif
10487

10588
handleMessage :: (Maybe FunctionCall, Maybe MsgpackRPC.Message)
10689
-> ConduitM i EncodedResponse EventHandler ()

library/Neovim/RPC/SocketReader.hs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ import Control.Concurrent (forkIO)
3636
import Control.Concurrent.STM
3737
import Control.Monad (void)
3838
import Control.Monad.Trans.Class (lift)
39-
import Data.Conduit as C
40-
import Data.Conduit.Binary
41-
import Data.Conduit.Cereal
39+
import Conduit as C
40+
import Data.Conduit.Cereal (conduitGet2)
4241
import Data.Default (def)
4342
import Data.Foldable (foldl', forM_)
4443
import qualified Data.Map as Map
@@ -65,12 +64,6 @@ runSocketReader :: Handle
6564
-> IO ()
6665
runSocketReader readableHandle cfg =
6766
void . runNeovim (Internal.retypeConfig (Internal.customConfig cfg) cfg) . runConduit $ do
68-
-- addCleanup (cleanUpHandle h) (sourceHandle h)
69-
-- TODO test whether/how this should be handled
70-
-- this has been commented out because I think that restarting the
71-
-- plugin provider should not cause the stdin and stdout handles to be
72-
-- closed since that would cause neovim to stop the plugin provider (I
73-
-- think).
7467
sourceHandle readableHandle
7568
.| conduitGet2 Data.Serialize.get
7669
.| messageHandlerSink

nvim-hs.cabal

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: nvim-hs
2-
version: 0.3.0
2+
version: 1.0.0.0
33
synopsis: Haskell plugin backend for neovim
44
description:
55
This package provides a plugin provider for neovim. It allows you to write
@@ -99,17 +99,7 @@ library
9999
, bytestring
100100
, cereal
101101
, cereal-conduit >= 0.7.3
102-
, conduit
103-
104-
-- sinkHandle flushed after every yield in the releases
105-
-- [1.1.2, 1.1.17) and in release 1.2.2 an API was added
106-
-- to flush manually, so any other version probably does
107-
-- not work unless you set NoBuffering on the handle (see #61)
108-
-- I think having NoBuffering on TCP-Handles is kind of
109-
-- ridicilous, so the version range [1.1.17, 1.2.2) is
110-
-- simply excluded
111-
, conduit-extra >= 1.1.2 && < 1.1.17 || >= 1.2.2
112-
102+
, conduit >= 1.3.0
113103
, containers
114104
, data-default
115105
, deepseq >= 1.1 && < 1.5
@@ -125,7 +115,7 @@ library
125115
, time-locale-compat
126116
, megaparsec
127117
, process
128-
, resourcet
118+
, resourcet >= 1.1.10
129119
, setenv >= 0.1.1.3
130120
, stm
131121
, streaming-commons
@@ -134,7 +124,7 @@ library
134124
, time
135125
, transformers
136126
, transformers-base
137-
, unliftio
127+
, unliftio >= 0.2
138128
, unliftio-core
139129
, utf8-string
140130
, void
@@ -160,7 +150,6 @@ test-suite hspec
160150
, cereal
161151
, cereal-conduit
162152
, conduit
163-
, conduit-extra
164153
, containers
165154
, data-default
166155
, directory

0 commit comments

Comments
 (0)