stack is a new, complete, cross-platform development tool aimed at both new and experienced Haskell developers alike, for installing and setting up the compiler, installing packages needed, and building, testing or benchmarking one or more packages in a project at a time. It's the whole stack.
We developed it in collaboration with the Commercial Haskell Group, with two deliberate goals in mind:
- Newbie friendliness, ease of setup and doing the right thing by default. Just get people running with Haskell as conveniently as possible.
- Catering to the finer points of serious commercial Haskell development. Supporting the modern use-cases of working on large Haskell projects.
In short, it's a program that you run in a directory with a stack configuration file in it (stack.yaml—automatically created if one doesn't exist). That directory may contain one or many packages inside it to be built. Then there are commands to build, test, install dependencies, run GHC, etc.
Here's a rundown of the advantages stack brings to the table. For both newbies and experienced Haskellers:
- It's really easy to get going with Haskell. You can just run stack build in a package directory and it will automatically download and install GHC, the standard Haskell compiler, for you, download the package index and install packages that are needed.
- It also caters to newbies reading books who just want to run ghc on a file. You can run stack ghc X.hs and it will download GHC if necessary, etc. until it can run GHC on that file. The same is true for stack ghci, etc.
- It automatically assumes (and does some figuring out if there's a project Cabal file) the latest LTS Haskell release as its source of packages, or otherwise a nightly release. This means you can just use packages without worrying about what versions match up and trying to think like a package manager thinks.
For experienced Haskellers, there is support for typical use-cases and subtleties of larger projects:
- This also means you can just put the snapshot release in your version control, via the stack.yaml file, which is important for reliable collaboration.
- Serious commercial or large scale users of Haskell can build so-called "mega-repos", by adding to the list of packages in your stack.yaml, you can build/test/bench multiple projects at once. stack build will just build everything. stack build this will build this package and rebuild anything that depends on it, and also any of its dependencies that changed.
- You can enable profiling in the configuration and this will automatically rebuild all packages with profiling turned on for you.
- Packages are installed into isolated package databases by default. There is a layering of three package databases: The global database, the snapshot database, and your personal project's database. Many projects can share the same global database (base, bytestring, etc.) and the snapshot database (e.g. text, haskell-src-exts, etc.)—which means no unnecessary rebuilding of packages—and yet each project has its own package database, so they are isolated from each other and cannot break each other.
- Binary installs of your personal projects are also isolated into that directory.
- In this "local" database, you can also specify newer upstream versions than are available in the snapshot. In fact, the snapshot is optional, you can be based on plain Hackage. This is not the default behaviour and is a configuration option.
- It also supports docker integration for truly sandboxed environments. By enabling docker in the configuration, running stack build will download the image if necessary and then run the build inside the docker image. There is an array of options available for the docker integration.
We first arrived at this tool based on feedback from our clients at FP Complete and have been using this tool in-house ourselves for around a year, in several iterations. This final iteration has had particular focus on ease of use. We were also motivated by the results of the recent Haskell survey.
Feedback from members of the Commercial Haskell Group has been very helpful in shaping the direction of the tool in a positive way and we now open it up, open source, in beta and for the Haskell community as a whole and welcome your contributions, ideas and feedback!
stack is available on Hackage (cabal install stack), as well as binary downloads for Windows, Mac, and Linux, with Ubuntu and Arch packages. Please note that this is a beta release: we anticipate bugs, and will work to quickly resolve them. Please be sure to report issues on the Github issue tracker.
Haskell_ITA is a project to form a community of Haskell programmers who live in Italy or speak Italian. The way I'd like to proceed is to form a critical mass online and then start meetups and conferences.
There is a subreddit here:
There's a maling list here:
A facebook group here:
A twitter account here:
Please tell everyone who may be interested.submitted by vitalijzad
[link] [15 comments]
I recently had two functions of very similar shape, only difference was that one was pure and the other need some I/O. The former was easily written using mapAccumL. I failed to find a function like mapAccumL that runs in a monad, so I wrote up the following:mapAccumM :: (Monad m, Traversable t) => (a -> b -> m (a, c)) -> a -> t b -> m (a, t c) mapAccumM f a l = swap <$> runStateT (mapM go l) a where go i = do s <- get (s', r) <- lift $ f s i put s' return r
Bring on the comments/suggestions/improvements/etc!
The Yesod Book is pretty good, but a toy example would be nice as well. A casual search on github surfaces this: https://github.com/josuf107/Fizzckle,
but something even simpler would be great!submitted by chibro2
[link] [6 comments]
I installed ghc 7.10.1 (replace 7.6.3 with 7.10.1):$ wget https://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-x86_64-unknown-linux.tar.bz2 $ tar xvf ghc-7.6.3-x86_64-unknown-linux.tar.bz2 $ cd ghc-7.6.3 $ ./configure --prefix=/usr/local/haskell/ghc-7.10.1 $ make $ sudo make install
And then unziped Haskell Platform 2014.2.0.0 for Linux, 64bit from https://www.haskell.org/platform/linux.htmlcd / sudo tar xvf ...downloaded-tarfile... sudo /usr/local/haskell/ghc-7.8.3-x86-64/bin/activate-hs
And then I got an error:Couldn't deduce location of ghc root. activate-hs [-q | -v] [-n] [-p dir] [ghc-root] -q | --quiet supress informational output -v | --verbose print actions as they are taken -n | --dryrun don't actually do anything (implies -v) -p | --prefix tree to sym-link executables, man pages, etc (defaults to /usr/local) ghc-root directory containing ghc tree
What should I do?
Also I initially installed ghc without "--prefix" so I have this:$ type ghc ghc is hashed (/usr/local/bin/ghc)
And I also have it installed in /usr/local/haskell/ghc-7.10.1
And the worst thing - I don't know how to upgrade Cabal:$ cabal --version cabal-install version 22.214.171.124 using version 1.16.0 of the Cabal library $ type cabal cabal is hashed (/usr/bin/cabal) submitted by gilded_honour
[link] [9 comments]
By which i mean (a subset of) applicatives for whichf <$> p x1 <*> p x2 <*> ...
is the same asp (f <$> x1 <*> x2 <*> ...)
For functions p :: (forall a. f a -> g a)?submitted by apsod
[link] [11 comments]
I'm new to Haskell. I've read most of LYAH and RWH and have also done some small programms. No I would like to use Haskell with an Oracle DB. I would like to use HaskellDB with HDBC.ODBC. Can anybody give me an example, how to connect via HaskellDB und HDBC with ODBC?
I was able to connect to the DB via HDBC and run a query. But I don't know how to connect via HaskellDB and ODBC. I can't find an example.submitted by marido73
[link] [3 comments]