packages feed

nvim-hs-contrib 1.0.0.0 → 2.0.0.0

raw patch · 3 files changed

+17/−19 lines, 3 filesdep ~nvim-hsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: nvim-hs

API changes (from Hackage documentation)

- Neovim.User.Input: input :: String -> Maybe String -> Maybe String -> Neovim env (Either NeovimException Object)
+ Neovim.User.Input: input :: NvimObject result => String -> Maybe String -> Maybe String -> Neovim env result

Files

library/Neovim/User/Choice.hs view
@@ -15,6 +15,7 @@     where  import           Neovim+import           Neovim.API.String  import           Data.Char (toLower) import           Data.List (isPrefixOf)@@ -34,10 +35,7 @@ -- (1-based). askForIndex :: [Object] -> Neovim env (Maybe Int) askForIndex cs = vim_call_function "inputlist" [ObjectArray cs] >>= \case-    Left e ->-        err $ exceptionToDoc e--    Right a -> case fromObject a of+    a -> case fromObject a of         Right i | i >= 1 && i <= length cs ->             return $ Just i @@ -64,14 +62,14 @@     spec <- vim_call_function                 "inputdialog" $ (message ++ " (Y/n) ")                     +: ("" :: String) +: ("no" :: String) +: []-    case fmap fromObject spec of-        Right (Right s) | map toLower s `isPrefixOf` "yes" ->+    case fromObject spec of+        Right s | map toLower s `isPrefixOf` "yes" ->             return True -        Right (Right s) | map toLower s `isPrefixOf` "no" ->+        Right s | map toLower s `isPrefixOf` "no" ->             return False -        Right (Left e) ->+        Left e ->             err e          _ ->
library/Neovim/User/Input.hs view
@@ -14,18 +14,20 @@     where  import Neovim+import Neovim.API.String import Neovim.User.Choice  import System.Directory   -- | Helper function that calls the @input()@ function of neovim.-input :: String -- ^ Message to display+input :: NvimObject result+      => String -- ^ Message to display       -> Maybe String -- ^ Input fiiled in       -> Maybe String -- ^ Completion mode-      -> Neovim env (Either NeovimException Object)-input message mPrefilled mCompletion = vim_call_function "input" $-    (message <> " ")+      -> Neovim env result+input message mPrefilled mCompletion = fmap fromObjectUnsafe+  . vim_call_function "input" $ (message <> " ")     +: maybe "" id mPrefilled     +: maybe [] (+: []) mCompletion @@ -37,10 +39,9 @@                 -> Maybe FilePath -- ^ Prefilled text                 -> Neovim env FilePath askForDirectory message mPrefilled = do-    fp <- errOnInvalidResult $ input message mPrefilled (Just "dir")+    fp <- input message mPrefilled (Just "dir") -    efp <- errOnInvalidResult $-            vim_call_function "expand" $ (fp :: FilePath) +: []+    efp <- fmap fromObjectUnsafe . vim_call_function "expand" $ (fp :: FilePath) +: []      whenM (not <$> liftIO (doesDirectoryExist efp)) $         whenM (yesOrNo (efp ++ " does not exist, create it?")) $@@ -52,5 +53,4 @@ askForString :: String -- ^ message to put in front              -> Maybe String -- ^ Prefilled text              -> Neovim env String-askForString message mPrefilled =-    errOnInvalidResult $ input message mPrefilled Nothing+askForString message mPrefilled = input message mPrefilled Nothing
nvim-hs-contrib.cabal view
@@ -1,5 +1,5 @@ name:                nvim-hs-contrib-version:             1.0.0.0+version:             2.0.0.0 synopsis:            Haskell plugin backend for neovim description:   Library for nvim-hs.@@ -24,7 +24,7 @@    -- other-extensions:   build-depends:        base >=4.6 && < 5-                      , nvim-hs >= 1.0+                      , nvim-hs >= 2.0 && <3                       , prettyprinter                       , prettyprinter-ansi-terminal                       , bytestring