I generated a new project using Yesod and am trying to go through the source to see how the pieces fit together. I am still a bit unfamiliar with most of the types so I have to keep a browser open where I hoogle/hayoo for types of things.
When I use Intellij for Java development I can usually just jump in to the source code of most of my dependencies. I wanted to try to replicate this for Haskell.
Since I am using vim for Haskell I thought I would just get the source for everything listed in build-depends and then generate a specific cabal_tags file and add that to vim's tags option.
My cabal skills are very rudimentary though. I noticed there is cabal get which can get the source for a package but it seems you need to explicitly specify the package and there doesn't seem to be an option for getting everything specified under build-depends in the .cabal file.
Related
I've been going through the book Haskell Programming from First Principles and I've gotten to the section on testing where I've started to encounter this strange issue.
Whenever I try and edit the .cabal file for my project, every time I save it it reverts back to the template .cabal file that is generated when creating a project with stack.
I've tried saving without formatting and editing the file in Notes (I'm on Mac), saving, and then reopening the project in vscode (this also reverts the file to the template).
Does anyone have any idea what might be going on? I'm using the basic Haskell extension, the syntax highlighting extension, the debugging extension (which I have not gotten to work, anyway), and brittany for auto-formatting.
Thanks all!
When I checked my package.yaml (as referenced by #Koterpillar) I realized that it was acting as a generator of sorts for my .cabal file.
I then edited package.yaml with the information I needed and it fixed my issue. My .cabal file now contains the appropriate parameters.
Thanks #Koterpillar!
i want to move from using CMake to Premake for my current project, but im usig vim and the YCM plugin which is really great for making my setup like an IDE. However, the plugin needs compilation flags file which is produced when running CMake. Is there something for Premake to generate a file like that as well?
Premake does not do this in its current state (alpha 13). If you have some insights as to what is necessary for getting it to work, the best thing to do would be to submit a ticket in the issue tracker.
I'm afraid, if your new build system does not generate that compilation flags file (yet), you'll need to maintain your own (hand-crafted) one. You can find an example at https://github.com/Valloric/ycmd/blob/0e999dbee209ea79a522259816ce3a68b7d6cddc/examples/.ycm_extra_conf.py.
I would advice to have (at least) one per project rather than one generic one in your $HOME.
Although I have to admit, that it would be beneficial to get it created and in sync with the actual build system, I don't find it too troublesome to maintain it manually. At the end of the day it only contains the C++ standard you want to use, a set of preprocessor symbols and a set of both system and user include directories.
I want to use a PureScript in the program code to generate text of JavaScript from it. For example, I use Julius (from Yesod) to directly insert a javascript. I want to use the same PureScript .Maybe there are such solutions or libraries?
Thank you!
When I have done something similar, I've kept the Purescript source in separate files, and combined the Haskell & Purescript parts later (during the build or at runtime). I think this is the easiest way, and you can keep using existing Purescript tools.
I had my web server read the JS output from purs at runtime. Another option would be to use file-embed to include the JS text when compiling the Haskell code. One reason to prefer file-embed is if you need to have a single executable file to deploy.
Finally, I have a Makefile that builds the Purescript code, then the Haskell code.
I am using haskell-mode for Emacs. I succeeded at creating etags for my haskell project on every save by hasktags, however, the cabal dependencies can not be navigated to this way. So I wonder: Is there a way to make this source code navigation work for cabal dependencies, too? (as it is easily possible for java-maven projects for example..)
You can try haskdogs, which provides a thin wrapper around hasktags and executes it for your imported modules as well as your own code. It maintains a repository of module sources in ~/.haskdogs and indexes into that.
I'm using it with vi and have been quite happy with it so far.
I downloaded a set of source code for a program in a book and I got a makefile.
I am quite new to Linux, and I want to know whether there is any way I can see the actual source code written in C?
Or what exactly am I to do with it?
It sounds like you may not have downloaded the complete source code from the book web site. As mentioned previously, a Makefile is only the instructions for building the source code, and the source code is normally found in additional files with names ending in .c and .h. Perhaps you could look around the book web site for more files to download?
Or, since presumably the book web site is public, let us know which one it is and somebody will be happy to point you in the right direction.
A Makefile does not contain any source itself. It is simply a list of instructions in a special format which specifies what commands should be run, and in what order, to build your program. If you want to see where the source is, your Makefile will likely contain many "filename.c"'s and "filename.h"'s. You can use grep to find all the instances of ".c" and ".h" in the file, which should correspond to the C source and header files in the project. The following command should do the trick:
grep -e '\.[ch]' Makefile
To use the Makefile to build your project, simply typing make should do something reasonable. If that doesn't do what you want, look for unindented lines ending in a colon; these are target names, and represent different arguments you can specify after "make" to build a particular part of your project, or build it in a certain way. For instance, make install, make all, and make debug are common targets.
You probably have GNU Make on your system; much more information on Makefiles can be found here.
It looks like you also need to download the SB-AllSource.zip file. Then use make (with the Makefile that you've already downloaded) to build.