You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Template Haskell approach has the advantage of giving you compiler errors if the name of the command is invalid or if your command definition cannot be translated to a callable command. The latter is not applicable for this case which will probably cover most use cases, so it doesn't really matter here. I've tried to achieve the former with OverloadedStrings, but the conversion is done at runtime, so I don't know how to achieve a similar user experience if something goes wrong. I think it is very valuable that the error message also tells you the exact position where the error originated from.
/home/saep/git/saepfigs/home/config/nvim/nvim-hs/Neovim/Example/Plugin.hs:27:15: error:
• Exception when trying to run compile-time code:
Custom command name must start with a capital letter: "throwExceptionCommand"
I'm not convinced that this is actually worth implementing because it only saves you from writing a type signature. If you are also writing documentation for the command somewhere (vim-help, haddock or something in the Readme) then this additional work is also negligible.
I'm not opposed to an alternative export API that covers functions, commands and autocommands without using Template Haskell as long as it covers the common use cases.
The current TH-based design makes a lot of usual Haskellisms rather annoying, eg, requiring an explicit binding to get a function into the right shape
just to export it:
For simple cases like this, it would be nice to have a function:
such that the above call could be implemented more simply as
which avoids the TH and prevents needing to define the no-op
doRefine
.The text was updated successfully, but these errors were encountered: