Synaptic > Haskell > STACK


Downloading the latest package list from hackage.haskell.org
ryoji@ubuntu:~/HackTheTower$ cabal install ghc-mod
Resolving dependencies...
Downloading ansi-wl-pprint-
Downloading base-orphans-0.6...
Configuring ansi-wl-pprint-
Downloading clock-0.7.2...
Configuring base-orphans-0.6...
Downloading cpphs-1.20.5...
Configuring clock-0.7.2...
Downloading djinn-lib-
Configuring cpphs-1.20.5...
Downloading dlist-
Downloading exceptions-0.8.3...
Downloading fail-
Downloading fclabels-
Downloading ghc-paths-
Downloading ghc-syb-utils-
Downloading lifted-base-
Downloading mmorph-1.1.0...
Downloading prelude-extras-
Downloading safe-0.3.14...
Downloading tagged-0.8.4...
Downloading utf8-string-
Downloading void-0.7.2...
Building ansi-wl-pprint-
Building cpphs-1.20.5...
Building clock-0.7.2...
Building base-orphans-0.6...
Installed ansi-wl-pprint-
Configuring dlist-
Building dlist-
Configuring fail-
Installed clock-0.7.2
Downloading extra-1.5.3...
Building fail-
Configuring exceptions-0.8.3...
Installed fail-
Downloading MonadRandom-0.5.1...
Configuring fclabels-
Installed dlist-
Configuring hlint-2.0.9...
Building hlint-2.0.9...
Installed hlint-2.0.9
Downloading ghc-mod-
Configuring ghc-mod-
Building ghc-mod-
Installed ghc-mod-

vim .xsessionrc

# add Cabal's bin directory to the executable search PATH if it exists
if [ -d "$HOME/.cabal/bin" ] ; then
ryoji@ubuntu:~$ ghci
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
Prelude> 1 * 2
Prelude> :t 1
1 :: Num a => a
Prelude> :t return 1
return 1 :: (Monad m, Num a) => m a

Prelude> putStrLn "hello"
Prelude> x <- return 42 //https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/interactive-evaluation.html
Prelude> print x

simply means

print `return 42`



bmi :: Floating a => a -> a -> a
bmi weight height = weight / height ^ 2
..<interactive>:21:1: Not in scope:

is equivalent to like scala's

def bmi(<?>: of Floating, <?>: of Floating): <?> = {
  ? / ? ^ 2
def bmiImpl(weight: Double, height: Double): Double = {
  weight / height ^ 2

map. generics. monad

Prelude> let lucky x = show (x + 1)
Prelude> :t lucky
lucky :: (Num a, Show a) => a -> String
Prelude> lucky 1
Prelude> let bmi weight height = weight / height ^ 2
Prelude> bmi 80 2.0

Prelude> :show bindings
x :: Integer = 42
lucky :: (Num a, Show a) => a -> String = _
bmi :: Fractional a => a -> a -> a = _


ryoji@ubuntu:~$ stack setup
Run from outside a project, using implicit global project config
Using resolver: lts-8.18 from implicit global project's config file: /home/ryoji/.stack/global-project/stack.yaml
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-8.0.2.                                      
Installed GHC.                               
stack will use a locally installed GHC
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
stack upgrade
Registering stack-1.4.0...
Completed all 173 actions.
Copying from /tmp/stack-upgrade6391/stack-1.4.0/.stack-work/install/x86_64-linux/lts-6.25/7.10.3/bin/stack to /home/ryoji/.local/bin/stack

Copied executables to /home/ryoji/.local/bin:
- stack


ryoji@ubuntu:/$ cabal install statistics
Resolving dependencies...
Downloading math-functions-
Configuring math-functions-
Building math-functions-
Installed math-functions-
Downloading statistics-
Configuring statistics-
Building statistics-
Installed statistics-
ryoji@ubuntu:/$ cabal install statistics
Resolving dependencies...
Downloading math-functions-
Configuring math-functions-
Building math-functions-
Installed math-functions-
Downloading statistics-


stack install ghc-mod
stack install hlint
stack install phoityne-vscode
stack install intero QuickCheck stack-run
stack install stylish-haskell
14:31	ghc-mod
			Attempting to use a ghc-mod compiled with a different version of ghc:
			GHC version: '7.10.3'
			ghc-mod compiled with ghc version: '8.0.2'
			Please reconfigure ghc-mod to use a version compiled with GHC 7.10.3
ryoji@ubuntu:~$ ghc-mod --version
ghc-mod version compiled by GHC 8.0.2
ryoji@ubuntu:~$ stack ghc
ghc: no input files
Usage: For basic information, try the `--help' option.
ryoji@ubuntu:~$ stack ghci
Configuring GHCi with the following packages: 
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /tmp/ghci14477/ghci-script
Prelude> :quit
Leaving GHCi.
ryoji@ubuntu:~$ stack new my-project
Downloading template "new-template" to create project "my-project" in my-project/ ...

The following parameters were needed by the template but not provided: author-email, author-name, category, copyright, github-username
You can provide them in /home/ryoji/.stack/config.yaml, like this:
    author-email: value
    author-name: value
    category: value
    copyright: value
    github-username: value
Or you can pass each one as parameters like this:
stack new my-project new-template -p "author-email:value" -p "author-name:value" -p "category:value" -p "copyright:value" -p "github-username:value"

Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- my-project/my-project.cabal

Selecting the best among 10 snapshots...

* Matches lts-8.18

Selected resolver: lts-8.18
Initialising configuration using resolver: lts-8.18
Total number of user packages considered: 1
Writing configuration to file: my-project/stack.yaml
All done.


    last modified: 18 June 2017 [ View wiki source Close ]