neovimhaskell / nvim-hs

Neovim API for Haskell plugins as well as the plugin provider
Other
267 stars 18 forks source link

Doesn't build with stack #65

Closed hasufell closed 6 years ago

hasufell commented 6 years ago
$ stack new my-nvim-hs https://raw.githubusercontent.com/neovimhaskell/nvim-hs/master/stack-template.hsfiles --bare --omit-packages --ignore-subdirs
Downloading template "https://raw.githubusercontent.com/neovimhaskell/nvim-hs/master/stack-template.hsfiles" to create project "my-nvim-hs" in the current directory
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- ./

Selecting the best among 13 snapshots...

Downloaded lts-11.14 build plan.    
Didn't see buffer-builder-0.2.4.6@sha256:ecba958a414f46416eba1aefca8fcdfe31679c4981b67715b6a45d5a28c14157,5236 in your package indices.
Updating and trying again.
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/                                 
Downloading timestamp                                                                            
Downloading snapshot                                                                             
Updating index                                                                                   
Updated package index downloaded                                                                 
Update complete                                                                                  
Populated index cache.    
* Partially matches lts-11.14
    nvim-hs not found
        - my-nvim-hs requires >=1 && <2

Downloaded nightly-2018-06-18 build plan.    
* Matches nightly-2018-06-18

Selected resolver: nightly-2018-06-18
Initialising configuration using resolver: nightly-2018-06-18
Total number of user packages considered: 1
Writing configuration to file: stack.yaml
All done.

$ stack setup
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-8.4.3.                                      
Installed GHC.                                                                
stack will use a sandboxed GHC it installed
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec

$ stack build

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for transformers-compat-0.6.2(+five-three):
    transformers-0.5.2.0 from stack configuration does not match >=0.5.3 && <0.6  (latest matching version is 0.5.5.0)
needed due to my-nvim-hs-0.1.0.0 -> transformers-compat-0.6.2

Some different approaches to resolving this:

  * Set 'allow-newer: true' to ignore all version constraints and build anyway.

  * Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working build configuration.
    This can be convenient when dealing with many complicated constraint errors, but results may be unpredictable.

  * Recommended action: try adding the following to your extra-deps in /home/jule/.config/nvim/stack.yaml:

- transformers-0.5.5.0

Plan construction failed.
hasufell commented 6 years ago

Even after adding transformers-0.5.5.0 to extra-deps, it fails:

    Configuring nvim-hs-1.0.0.1...
    Building nvim-hs-1.0.0.1...
    Preprocessing library nvim-hs-1.0.0.1...
    [ 1 of 29] Compiling Neovim.Plugin.Startup ( library/Neovim/Plugin/Startup.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Plugin/Startup.o )
    [ 2 of 29] Compiling Neovim.Log       ( library/Neovim/Log.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Log.o )
    [ 3 of 29] Compiling Neovim.Exceptions ( library/Neovim/Exceptions.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Exceptions.o )
    [ 4 of 29] Compiling Neovim.Compat.Megaparsec ( library/Neovim/Compat/Megaparsec.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Compat/Megaparsec.o )
    [ 5 of 29] Compiling Neovim.Classes   ( library/Neovim/Classes.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Classes.o )
    [ 6 of 29] Compiling Neovim.Plugin.Classes ( library/Neovim/Plugin/Classes.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Plugin/Classes.o )
    [ 7 of 29] Compiling Neovim.Plugin.IPC.Classes ( library/Neovim/Plugin/IPC/Classes.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Plugin/IPC/Classes.o )
    [ 8 of 29] Compiling Neovim.Plugin.IPC ( library/Neovim/Plugin/IPC.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Plugin/IPC.o )
    [ 9 of 29] Compiling Neovim.Context.Internal ( library/Neovim/Context/Internal.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Context/Internal.o )
    [10 of 29] Compiling Neovim.Context   ( library/Neovim/Context.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Context.o )
    [11 of 29] Compiling Neovim.Plugin.Internal ( library/Neovim/Plugin/Internal.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Plugin/Internal.o )
    [12 of 29] Compiling Neovim.Config    ( library/Neovim/Config.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Config.o )
    [13 of 29] Compiling Neovim.RPC.Common ( library/Neovim/RPC/Common.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/RPC/Common.o )
    [14 of 29] Compiling Neovim.Util      ( library/Neovim/Util.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/Util.o )
    [15 of 29] Compiling Neovim.RPC.Classes ( library/Neovim/RPC/Classes.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/RPC/Classes.o )
    [16 of 29] Compiling Neovim.RPC.FunctionCall ( library/Neovim/RPC/FunctionCall.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/RPC/FunctionCall.o )
    [17 of 29] Compiling Neovim.RPC.EventHandler ( library/Neovim/RPC/EventHandler.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/RPC/EventHandler.o )
    [18 of 29] Compiling Neovim.RPC.SocketReader ( library/Neovim/RPC/SocketReader.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/RPC/SocketReader.o )
    [19 of 29] Compiling Neovim.API.Parser ( library/Neovim/API/Parser.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/API/Parser.o )
    [20 of 29] Compiling Neovim.API.TH    ( library/Neovim/API/TH.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/API/TH.o )
    [21 of 29] Compiling Neovim.API.String ( library/Neovim/API/String.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Neovim/API/String.o )

    /tmp/stack23185/nvim-hs-1.0.0.1/library/Neovim/API/String.hs:24:3: error:
        Illegal variable name: ‘type’
        When splicing a TH declaration:
          nvim_set_client_info name_0 version_1 type_2 methods_3 attributes_4 = Neovim.RPC.FunctionCall.scall ((Neovim.Plugin.Classes.F GHC.Base.. Data.ByteString.UTF8.fromString) "nvim_set_client_info") [Neovim.Classes.toObject name_0,
                                                                                                                                                                                                       Neovim.Classes.toObject version_1,
                                                                                                                                                                                                       Neovim.Classes.toObject type_2,
                                                                                                                                                                                                       Neovim.Classes.toObject methods_3,
                                                                                                                                                                                                       Neovim.Classes.toObject attributes_4]
saep commented 6 years ago

I had no trouble installing it. The output for for everything up until stack build has been the same for me. stack build simply worked. I tested on a debian stretch machine with a relatively fresh install of stack.

It is odd that you had to pin the transformers version to 0.5.5.0 because it is the version in the nightly snapshot (nightly-2018-06-18). The stack.yaml looks like this for me (after removing comments):

resolver: nigthly-2018-06-18
packages:
- .

Can you try renaming your ~/.stack directory and do a fresh stack setup and stack build?

hasufell commented 6 years ago

Can you try renaming your ~/.stack directory and do a fresh stack setup and stack build?

That would kinda break everything else I've done on my system via stack, no? So rather not.

saep commented 6 years ago

Hence "renaming", so you can go back in a few seconds.

hasufell commented 6 years ago

same error.

saep commented 6 years ago

Okay, the function nvim_set_client_info seems to be very new and the neovim version I was testing with did not have it. I guess the API code generator should ignore variable names and just number them. I may fix it tomorrow or at the weekend.

One probably has to replace the parameterlist here https://github.com/neovimhaskell/nvim-hs/blob/master/library/Neovim/API/TH.hs#L173 with a sufficiently large list of different variable names.

$ zipWith (\i _ -> "arg" ++ show i) [1..] (parameters nf)

If you cannot wait, feel free to test it and create a PR. ;-)

saep commented 6 years ago

You'll have to use a version >= 1.0.0.2 of nvim-hs. I'll make a relase in a few minutes.