neovimhaskell / nvim-hs

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

Fibonacci(n) with n > 127 fails #44

Closed srenatus closed 8 years ago

srenatus commented 8 years ago

Hi there,

This is a great project, thanks a lot!

Playing with the example code, I've noticed the following: when I :echo Fibonacci(128), it fails with

Error detected while processing function Fibonacci:
line    1:
Expected any Integer value, but got ObjectUInt 128
0
Press ENTER or type command to continue

It's probably Data.MessagePack that uses ObjectUInt for n > 127.

Not that this is a real problem, I suppose (except that it'd be cool to change the 2000 to a 20 in the example code, maybe). But out of curiosity -- how would you fix the function to work with both small and big integers?

saep commented 8 years ago

The ObjectUint constructor seems to be new. The fix is either to depend on an older version or to add cases in https://github.com/neovimhaskell/nvim-hs/blob/master/library/Neovim/Classes.hs where it makes any sense. I'm going to fix this sometime this weekend or feel free to create a pull request. If you do so, don't forget to add an appropriate lower bound on the messagepack dependency.

srenatus commented 8 years ago

Fixed with #45, I suppose. Thanks!