haskell

What is the current situation for using Vim as IDE for Haskell on Archlinux?

那年仲夏 提交于 2021-01-27 19:13:58
问题 My target, if doable, is to have command completion for Haskell in work in Vim, via YouCompleteMe. In this respect, as you can see in the following, I haven't found a consesus yet about how to get it to work. The latest comments on a relevant issue on YouCompleteMe are not that old, therefore I installed haskell-ide-engine from the AUR (the repo on GitHub is here. However, since it was taking so long (it took 110 minutes!) I checked the PKGBUILD file just to discover this: # ... # Supported

How to integrate dependency into existing project in Haskell?

落爺英雄遲暮 提交于 2021-01-27 18:41:28
问题 I am currently trying to get started with Haskell because I want to use parts of the code base of Pandoc for a different project. Since I am new to Haskell I need proper IDE features like code completion and jump to definition AND type information and documentation on hover . I chose VSCode with the Haskell extension for the job. Now comes my problem: Pandoc depends on pandoc-types which is an integral part of the code, which I need to understand and modify. But using the ghc-option "

Plotting a graph using Haskell

主宰稳场 提交于 2021-01-27 15:00:32
问题 Is that possible to plot a simple graph using Haskell ? Can any of you show me how to do that ? The graph should contain at lest 3 points 回答1: haskell-chart seems to be good. The wiki contains a list of graphs drawn using that package. 来源: https://stackoverflow.com/questions/20824756/plotting-a-graph-using-haskell

Is it possible to enforce a type constraint on a class instance for a higher-kinded type?

人盡茶涼 提交于 2021-01-27 15:00:19
问题 I have a type defined like this: newtype PrimeSet a = P Integer deriving Eq I have also defined a function which converts a prime set to a list, given that its type parameter is an Integral . toList :: Integral a => PrimeSet a -> [a] I now what to give PrimeSet a Foldable instance, so this was my first attempt (after importing fold from Data.Foldable ): instance Foldable PrimeSet where foldMap f = fold . map f . toList This didn't work, however, and the compiler told me that it Could not

Plotting a graph using Haskell

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 14:41:11
问题 Is that possible to plot a simple graph using Haskell ? Can any of you show me how to do that ? The graph should contain at lest 3 points 回答1: haskell-chart seems to be good. The wiki contains a list of graphs drawn using that package. 来源: https://stackoverflow.com/questions/20824756/plotting-a-graph-using-haskell

Libraries “rt” and “dl” in Cygwin

假装没事ソ 提交于 2021-01-27 13:55:27
问题 Perhaps this is stupid but I'm unable to find out which package I have to install in Cygwin to fix the following missing libraries: config.status: creating unix.buildinfo config.status: creating include/HsUnixConfig.h cabal.exe: Missing dependencies on foreign libraries: * Missing header file: HsUnix.h * Missing C libraries: rt, dl Any ideas or how do you generally find out which package to install when you get feedback that file xxx is missing (I remember that in gentoo this was quite

Haskell - could not find module 'Test.QuickCheck'

眉间皱痕 提交于 2021-01-27 13:15:05
问题 I'm getting an error that says the module doesn't exist when I try to runhaskell. It's odd because I try to install it first and says its up to date. Any idea how to fix this? 回答1: You could try creating the package environment in the local directory that holds your project, like this: c:\Users\...\ex1haskell> cabal install --lib --package-env . QuickCheck This should create a file of the form .ghc.environment.xxx in ex1haskell , which hopefully should be picked up by runhaskell / ghci / ghc

Fail to define an infinite stream

巧了我就是萌 提交于 2021-01-27 12:50:48
问题 I'm working on UPENN Haskell Homework 6 Exercise 5, trying to define a ruler function 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,... where the nth element in the stream (assuming the first element corresponds to n = 1) is the largest power of 2 which evenly divides n . I just came up with an idea to build it without any divisibility testing: data Stream x = Cons x (Stream x) deriving (Eq) streamRepeat x = Cons x (streamRepeat x) interleaveStreams (Cons x xs) (Cons y ys) = Cons x (Cons y

Can I check whether a bounded list contains duplicates, in linear time?

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-27 12:20:40
问题 Suppose I have an Int list where elements are known to be bounded and the list is known to be no longer than their range, so that it is entirely possible for it not to contain duplicates. How can I test most quickly whether it is the case? I know of nubOrd. It is quite fast. We can pass our list through and see if it becomes shorter. But the efficiency of nubOrd is still not linear. My idea is that we can trade space for time efficiency. Imperatively, we would allocate a bit field as wide as

Using QuickCheck to generate multiple arbitrary parameters for a given function

孤街浪徒 提交于 2021-01-27 11:52:40
问题 Context I have the following function: prop_SignAndVerify :: (PrivKey a b) => Blind a -> BS.ByteString -> Bool prop_SignAndVerify bsk msg = case verify pk msg sig of Left e -> error e Right b -> b where sk = getBlind bsk pk = toPublic sk sig = case sign sk msg of Left e -> error e Right s -> s I would like to do something like: -- instance PrivKey RSA.PrivateKey RSA.PublicKey where... genRSA :: Gen RSA.PrivateKey genRSAMessage :: Gen BS.ByteString main = do quickCheck . verbose $ forAll