nvim-hs 2.3.2.1 → 2.3.2.3
raw patch · 8 files changed
+54/−50 lines, 8 filesdep ~deepseqdep ~mtl
Dependency ranges changed: deepseq, mtl
Files
- nvim-hs.cabal +2/−2
- src/Neovim/API/Parser.hs +19/−17
- src/Neovim/Classes.hs +12/−9
- src/Neovim/Context/Internal.hs +3/−2
- src/Neovim/Plugin/IPC/Classes.hs +12/−13
- src/Neovim/RPC/EventHandler.hs +2/−4
- src/Neovim/RPC/FunctionCall.hs +3/−2
- tests/API/THSpec.hs +1/−1
nvim-hs.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: nvim-hs-version: 2.3.2.1+version: 2.3.2.3 synopsis: Haskell plugin backend for neovim description: This package provides a plugin provider for neovim. It allows you to write@@ -129,7 +129,7 @@ , hslogger , messagepack >= 0.5.4 , network- , mtl >= 2.2.1 && < 2.3+ , mtl >= 2.2.1 && < 2.4 , optparse-applicative , time-locale-compat , megaparsec < 10
src/Neovim/API/Parser.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+ {- | Module : Neovim.API.Parser Description : P.Parser for the msgpack output stram API@@ -19,7 +20,8 @@ import Neovim.OS (isWindows) import Control.Applicative (optional)-import Control.Monad.Except (MonadError (throwError), forM)+import Control.Monad (forM)+import Control.Monad.Except (MonadError (throwError)) import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as LB import Data.Map (Map)@@ -56,16 +58,16 @@ throudh the @nvim --api-info@ command. -} data NeovimFunction = NeovimFunction- { -- | function name- name :: String- , -- | A list of type name and variable name.- parameters :: [(NeovimType, String)]- , -- | Indicator whether the function can fail/throws exceptions.- canFail :: Bool- , -- | Indicator whether the this function is asynchronous.- async :: Bool- , -- | Functions return type.- returnType :: NeovimType+ { name :: String+ -- ^ function name+ , parameters :: [(NeovimType, String)]+ -- ^ A list of type name and variable name.+ , canFail :: Bool+ -- ^ Indicator whether the function can fail/throws exceptions.+ , async :: Bool+ -- ^ Indicator whether the this function is asynchronous.+ , returnType :: NeovimType+ -- ^ Functions return type. } deriving (Show) @@ -73,12 +75,12 @@ output. -} data NeovimAPI = NeovimAPI- { -- | The error types are defined by a name and an identifier.- errorTypes :: [(String, Int64)]- , -- | Extension types defined by neovim.- customTypes :: [(String, Int64)]- , -- | The remotely executable functions provided by the neovim api.- functions :: [NeovimFunction]+ { errorTypes :: [(String, Int64)]+ -- ^ The error types are defined by a name and an identifier.+ , customTypes :: [(String, Int64)]+ -- ^ Extension types defined by neovim.+ , functions :: [NeovimFunction]+ -- ^ The remotely executable functions provided by the neovim api. } deriving (Show)
src/Neovim/Classes.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RankNTypes #-} {- | Module : Neovim.Classes@@ -32,10 +32,14 @@ import Neovim.Exceptions (NeovimException (..)) -import Control.Applicative+import Control.Applicative (Applicative (liftA2)) import Control.Arrow ((***))-import Control.DeepSeq-import Control.Monad.Except+import Control.DeepSeq (NFData)+import Control.Monad ()+import Control.Monad.Except (+ MonadError (throwError),+ )+import Control.Monad.IO.Class (MonadIO) import Data.ByteString (ByteString) import Data.Int ( Int16,@@ -47,7 +51,6 @@ import Data.MessagePack import Data.Monoid import Data.Text as Text (Text)-import Data.Traversable hiding (forM, mapM) import Data.Vector (Vector) import qualified Data.Vector as V import Data.Word (@@ -349,7 +352,7 @@ -- By the magic of vim, i will create these. instance (NvimObject o1, NvimObject o2) => NvimObject (o1, o2) where- toObject (o1, o2) = ObjectArray $ [toObject o1, toObject o2]+ toObject (o1, o2) = ObjectArray [toObject o1, toObject o2] fromObject (ObjectArray [o1, o2]) = (,)@@ -358,7 +361,7 @@ fromObject o = throwError $ "Expected ObjectArray, but got" <+> viaShow o instance (NvimObject o1, NvimObject o2, NvimObject o3) => NvimObject (o1, o2, o3) where- toObject (o1, o2, o3) = ObjectArray $ [toObject o1, toObject o2, toObject o3]+ toObject (o1, o2, o3) = ObjectArray [toObject o1, toObject o2, toObject o3] fromObject (ObjectArray [o1, o2, o3]) = (,,)@@ -418,7 +421,7 @@ fromObject o = throwError $ "Expected ObjectArray, but got" <+> viaShow o instance (NvimObject o1, NvimObject o2, NvimObject o3, NvimObject o4, NvimObject o5, NvimObject o6, NvimObject o7, NvimObject o8) => NvimObject (o1, o2, o3, o4, o5, o6, o7, o8) where- toObject (o1, o2, o3, o4, o5, o6, o7, o8) = ObjectArray $ [toObject o1, toObject o2, toObject o3, toObject o4, toObject o5, toObject o6, toObject o7, toObject o8]+ toObject (o1, o2, o3, o4, o5, o6, o7, o8) = ObjectArray [toObject o1, toObject o2, toObject o3, toObject o4, toObject o5, toObject o6, toObject o7, toObject o8] fromObject (ObjectArray [o1, o2, o3, o4, o5, o6, o7, o8]) = (,,,,,,,)@@ -433,7 +436,7 @@ fromObject o = throwError $ "Expected ObjectArray, but got" <+> viaShow o instance (NvimObject o1, NvimObject o2, NvimObject o3, NvimObject o4, NvimObject o5, NvimObject o6, NvimObject o7, NvimObject o8, NvimObject o9) => NvimObject (o1, o2, o3, o4, o5, o6, o7, o8, o9) where- toObject (o1, o2, o3, o4, o5, o6, o7, o8, o9) = ObjectArray $ [toObject o1, toObject o2, toObject o3, toObject o4, toObject o5, toObject o6, toObject o7, toObject o8, toObject o9]+ toObject (o1, o2, o3, o4, o5, o6, o7, o8, o9) = ObjectArray [toObject o1, toObject o2, toObject o3, toObject o4, toObject o5, toObject o6, toObject o7, toObject o8, toObject o9] fromObject (ObjectArray [o1, o2, o3, o4, o5, o6, o7, o8, o9]) = (,,,,,,,,)
src/Neovim/Context/Internal.hs view
@@ -25,7 +25,6 @@ Doc, NFData, Pretty (pretty),- deepseq, ) import Neovim.Exceptions ( NeovimException (..),@@ -42,6 +41,8 @@ ) import Neovim.Plugin.IPC (SomeMessage) +import Control.Monad.IO.Class (MonadIO)+import Data.Functor (void) import Data.Map (Map) import qualified Data.Map as Map import Data.MessagePack (Object)@@ -87,9 +88,9 @@ MonadReader (ask, local), ReaderT (..), asks,- void, ) import Prelude+import Control.DeepSeq (deepseq) {- | This is the environment in which all plugins are initially started.
src/Neovim/Plugin/IPC/Classes.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE ExistentialQuantification #-}-{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-} {- | Module : Neovim.Plugin.IPC.Classes@@ -30,9 +30,7 @@ import Neovim.Classes ( Generic, Int64,- NFData (..), Pretty (pretty),- deepseq, (<+>), ) import Neovim.Plugin.Classes (FunctionName, NeovimEventId)@@ -55,6 +53,7 @@ writeTQueue, ) +import Control.DeepSeq (NFData, deepseq, rnf) import Prelude {- | Taken from xmonad and based on ideas in /An Extensible Dynamically-Typed@@ -113,12 +112,12 @@ an identifier used to map the result to the function that has been called. -} data Request = Request- { -- | Name of the function to call.- reqMethod :: FunctionName- , -- | Identifier to map the result to a function call invocation.- reqId :: !Int64- , -- | Arguments for the function.- reqArgs :: [Object]+ { reqMethod :: FunctionName+ -- ^ Name of the function to call.+ , reqId :: !Int64+ -- ^ Identifier to map the result to a function call invocation.+ , reqArgs :: [Object]+ -- ^ Arguments for the function. } deriving (Eq, Ord, Show, Typeable, Generic) @@ -145,10 +144,10 @@ of the computation. -} data Notification = Notification- { -- | Event name of the notification.- notEvent :: NeovimEventId- , -- | Arguments for the function.- notArgs :: [Object]+ { notEvent :: NeovimEventId+ -- ^ Event name of the notification.+ , notArgs :: [Object]+ -- ^ Arguments for the function. } deriving (Eq, Ord, Show, Typeable, Generic)
src/Neovim/RPC/EventHandler.hs view
@@ -40,20 +40,18 @@ yield, (.|), )+import Control.Monad (forever) import Control.Monad.Reader ( MonadReader, ReaderT (runReaderT),- forever, ) import Data.ByteString (ByteString) import qualified Data.Map as Map import Data.Serialize (encode) import System.IO (Handle) import System.Log.Logger (debugM)-import UnliftIO (modifyTVar', readTVar)-+import UnliftIO (MonadUnliftIO, modifyTVar', readTVar) import Prelude-import UnliftIO (MonadUnliftIO) {- | This function will establish a connection to the given socket and write msgpack-rpc requests to it.
src/Neovim/RPC/FunctionCall.hs view
@@ -1,5 +1,5 @@-{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE LambdaCase #-}+{-# LANGUAGE RecordWildCards #-} {- | Module : Neovim.RPC.FunctionCall@@ -29,11 +29,12 @@ import qualified Neovim.RPC.Classes as MsgpackRPC import Control.Applicative+import Control.Monad (void, (<=<)) import Control.Monad.Reader import Data.MessagePack +import UnliftIO (STM, atomically, newEmptyTMVarIO, readTMVar, throwIO) import Prelude-import UnliftIO (STM, newEmptyTMVarIO, readTMVar, throwIO, atomically) -- | Helper function that concurrently puts a 'Message' in the event queue and returns an 'STM' action that returns the result. acall ::
tests/API/THSpec.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}+{-# OPTIONS_GHC -Wno-incomplete-uni-patterns -Wno-overlapping-patterns #-} module API.THSpec where