old-style | new-style |
---|---|
install --only-dependencies |
part of new-build |
install path-to-local-dir |
add a ./cabal.project file, add your local dependency, then use new-build (cabal.project syntax is described in the announcement) |
install path-to-local-sdist |
does not exist yet |
install remote-package-uri |
does not exist yet |
install [--bindir=.. ] |
does not exist (yet) |
configure |
new-configure |
build |
(part of) new-build |
clean |
does not exist yet; you have to remove ./dist-newstyle/ and ./cabal.project.local by hand, and potentially ./dist/ as well, i may have observed that it got touched by new-build (not sure, really). This needs to be done for each package referenced from the cabal.project as well. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE Arrows, TemplateHaskell #-} | |
module Main where | |
import Prelude hiding (id, init, (.)) | |
import Control.Arrow | |
import Control.Category |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- a djinn environment that encodes an instance of the | |
-- post correspondence problem. it requires recursive data | |
-- types. | |
data Foo a b x y = Foo (Bar a b (a x) (b (a (a y)))) | |
(Bar a b (a (b x)) (a (a y))) | |
(Bar a b (b (b (a x))) (b (b y))) | |
-- we need duplicate to enforce N>=1 | |
data Bar a b x y = Bar (Bar a b (a x) (b (a (a y)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Monad.Trans.Writer | |
import Data.Monoid ( Sum(..) ) | |
f :: Writer (Sum Int) () | |
f = undefined | |
g :: Writer (Sum Int) Int | |
g = do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cabal list --simple-output | sed "s/ .*//" | uniq | xargs cabal info -v | grep "^ [^ ]" | sed "s/ //" | sed "s/\..*//" | sort | uniq -c | sort -bgr | |
# or full module names via | |
#cabal list --simple-output | sed "s/ .*//" | uniq | xargs cabal info -v | grep "^ [^ ]" | sed "s/ //" | sort | |
# (cannot post the latter; gists seem to have length limit on what you can paste :D) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module Main where | |
data HList :: [*] -> * where | |
HNil :: HList '[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The most common thing is to install a library (so your project can use it) or | |
an executable (like when you install `hoogle` so you can search documentation | |
locally). Behind the scenes, this involves a number of steps: | |
1. determine package version plan (a consistent Set (Library,Version)) | |
2. download dependencies (i.e. their source) | |
3. install dependencies (i.e. do steps 1-6a for each dependency) | |
4. configure (think: what to build in which order, with which compiler flags etc.) | |
5. build | |
6a. register (libraries) in package repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Running 2 test suites... | |
Test suite unit-tests: RUNNING... | |
Test suite unit-tests: PASS | |
Test suite logged to: dist/test/Cabal-1.25.0.0-unit-tests.log | |
Test suite package-tests: RUNNING... | |
package-tests: We couldn't understand the build configuration. Try editing Cabal.cabal to have 'build-type: Custom' and then rebuild | |
ing, or manually specifying CABAL_PACKAGETESTS_* environment variables (see README.md for more details). | |
Original error: Saved package config file body is corrupt. Try re-running the 'configure' command. | |
Test suite package-tests: FAIL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ls -1 stackage | xargs -I{} bash -c "find \"stackage/{}\" -type f -name \"*.hs\" -o -name \"*.lhs\"\ | |
| xargs grep -h \"^import\" \ | |
| grep \" as \" \ | |
| sed \"s/ \+as//\" \ | |
| sed \"s/^import \+\(qualified \+\)\?//\" \ | |
| sort \ | |
| uniq \ | |
" \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Distribution.Simple | |
import Distribution.PackageDescription | |
import Distribution.Simple.Program | |
import Distribution.Simple.Command | |
import Distribution.Simple.PreProcess | |
import Distribution.Simple.Setup | |
import Distribution.Simple.LocalBuildInfo | |
import Distribution.Simple.BuildPaths | |
import Distribution.Simple.BuildTarget | |
import System.Process |
OlderNewer