Skip to content

Instantly share code, notes, and snippets.

@Searge
Last active November 5, 2018 18:35
Show Gist options
  • Save Searge/76c8bad83d0f9c387e02b5fa92d6c1d2 to your computer and use it in GitHub Desktop.
Save Searge/76c8bad83d0f9c387e02b5fa92d6c1d2 to your computer and use it in GitHub Desktop.
Помилки Конфігурація cabal, gcc

Вступ до Кабалових пісочниць

Цей пост описує ізольовані компоненти, нову особливість cabal, яка буде присутня у версії 1.18. Пісочниці дозволяють створювати пакети окремо, створюючи для кожного пакунка приватний пакет. Якщо ви знайомі з віртуальною версією Python або RVM Ruby, це аналог Haskell. Незважаючи на те, що 1,18 все ще не існує, ви можете вже експериментувати з новими функціями, будуючи cabal з Git. Цей пост призначений, головним чином, для людей, що знаходяться в пісочниці. Якщо ви вже користувалися cabal-dev, не соромтеся пропускати вступні розділи.

Будуємо Cabal з git

Вважаємо, що ви вже маєте попередню встановлену версію:

$ git clone git://github.com/haskell/cabal.git /path/to/cabal
$ cd /path/to/cabal
$ cabal install Cabal/ cabal-install/

Це все! тепер ви маєте останню версію cabal встановлену у ~/.cabal/bin.

Альтернативно, якщо у вас є тільки GHC:

$ git clone git://github.com/haskell/cabal.git /path/to/cabal
$ cd /path/to/cabal/Cabal
$ runhaskell Setup.hs configure
$ runhaskell Setup.hs build
$ runhaskell Setup.hs install
$ cd ../cabal-install
$ sh bootstrap.sh

Що таке пісочниці і чому вони потрібні?

Якщо ви використовували Haskell якийсь час, ви, напевно, чули вираз "Кабалове пекло". Це означає, що встановлення нового пакета з cabal install може зламати існуючі пакунки у вашій системі.

Причиною такої поведінки є руйнівні перевстановлення. На момент написання цього документа Cabal не підтримує наявність декількох екземплярів однієї версії одного пакета, встановленого одночасно (але зауважте, що встановлення декількох версій одного і того ж пакунка цілком нормально). Так як це впливає на вас, користувача?

Уявіть собі, що ви встановили бібліотеку foo, яка залежить від bar-1.0, що у свою чергу залежить від baz (будь-якої версії):

Simple diagram

Через деякий час ви вирішите встановити quux, що залежить від bar-1.0 і baz-2.0. Оскільки у вас встановлено лише baz-1.0, вам потрібно встановити baz-2.0 і перекомпілювати bar-1.0 на нього:

Complex diagram

Але оскільки Cabal дозволяє встановити лише один екземпляр bar-1.0, пакет foo-1.0 тепер зламаний, оскільки це залежить від екземпляра пакету bar-1.0, що було видалено! Кюст багато плачу та скрегіт зубів:

Don't know diagram

Хоча ми знаємо, що правильно вирішити цю проблему (див. Розділ "Майбутня робота" нижче), час для цього займе деякий час, а пісочниці - це порівняно невисока вартість проміжного рішення. Ідея полягає в тому, щоб побудувати кожен пакет в ізольованому середовищі ("пісочниця") з бази даних пакетної локальної пакета. Оскільки пісочниці є проектами, ми можемо стримувати їх, щоб вони були внутрішньо послідовні та просто забороняли такі конфлікти, як описано вище.

Крім полегшення проблеми "Кабального пекла", пісочниці також корисні, коли ваш пакет залежить від патчів або невиданих бібліотек.

Використання

Використання пісочниць є простим: якщо ви вже знаєте, як використовувати інструмент cabal для побудови ваших пакетів, потрібно лише вивчити декілька додаткових команд. Щоб ініціалізувати свіжу пісочницю у поточному каталозі, запустіть ініціалізацію ізоляції cabal sandbox init. Всі наступні команди (наприклад, build та install) з цього пункту використовуватимуть пісочницю.

$ cd /path/to/my/haskell/library
$ cabal sandbox init                   # Initialise the sandbox
$ cabal install --only-dependencies    # Install dependencies into the sandbox
$ cabal build                          # Build your package inside the sandbox

Можливо, корисно зробити вихідний пакет для встановлення в пісочниці - наприклад, якщо ваш пакет залежить від виправленої або невиданої версії бібліотеки. Це можна зробити за допомогою командної команди cabal sandbox add-source - подумайте про це як "local hackage". Якщо додаток-джерело залежить пізніше, його буде переінсталювати автоматично.

$ cabal sandbox add-source /my/patched/library # Add a new add-source dependency
$ cabal install --dependencies-only            # Install it into the sandbox
$ cabal build                                  # Build the local package
$ $EDITOR /my/patched/library/Source.hs        # Modify the add-source dependency
$ cabal build                                  # Modified dependency is automatically reinstalled

Зазвичай параметри пісочниці (наприклад, рівень оптимізації) успадковуються від головного файлу конфігурації Cabal ($HOME/.cabal/config). Іноді, однак, потрібно змінити деякі параметри спеціально для окремої пісочниці. Ви можете зробити це, створивши файл cabal.config у тій самій директорії з вашим cabal.sandbox.config (який був створений ініціалізованою пісочницею). Цей файл має такий же синтаксис, що й основний файл конфігурації Cabal.

$ cat cabal.config
documentation: True
constraints: foo == 1.0, bar >= 2.0, baz
$ cabal build                                  # Uses settings from the cabal.config file

Коли ви вирішите, що більше не хочете створювати свій пакет всередині пісочниці, просто видаліть його:

$ cabal sandbox delete                       # Built-in command
$ rm -rf .cabal-sandbox cabal.sandbox.config # Alternative manual method

Розширене використання

Поведінка команди add-source за умовчанням - це відстежувати внесені зміни до доданої залежності та повторно встановити копію пакету пісочниці, коли це необхідно. Іноді це не бажано: в цих випадках ви можете використовувати add-source --snapshot, що відключає відстеження змін. Окрім add-source, існують також list-sources і команди delete-source.

Іноді хочеться поділитися однією пісочницею між декількома пакетами. Це можна легко зробити за допомогою параметра --sandbox:

$ cd /path/to/shared-sandbox
$ cabal sandbox init --sandbox .
$ cd /path/to/package-a
$ cabal sandbox init --sandbox /path/to/shared-sandbox
$ cd /path/to/package-b
$ cabal sandbox init --sandbox /path/to/shared-sandbox

Підтримується використання декількох різних версій GHC одночасно за допомогою опції -w:

$ cabal sandbox init
$ cabal install --only-dependencies -w /path/to/ghc-1 # Install dependencies for both compilers
$ cabal install --only-dependencies -w /path/to/ghc-2
$ cabal configure -w /path/to/ghc-1                   # Build with the first compiler
$ cabal build
$ cabal configure -w /path/to/ghc-2                   # Build with the second compiler
$ cabal build

Інколи може бути корисним запустити інструмент ghc-pkg безпосередньо в пакеті DB для пісочниці (наприклад, вам може знадобитися скасувати реєстрацію деяких пакетів). Комбінація піктограми hc-pkg є зручною обгорткою для ghc-pkg, яка працює з відповідним аргументом --package-conf:

$ cabal -v sandbox hc-pkg list
Using a sandbox located at /path/to/.cabal-sandbox
'ghc-pkg' '--global' '--no-user-package-conf'
    '--package-conf=/path/to/.cabal-sandbox/i386-linux-ghc-7.4.2-packages.conf.d'
    'list'
[...]

Для користувачів cabal-dev

Функція пісочниці надає вам принципово таку ж функціональність, як cabal-dev, але інтегрована з самим інструментом cabal. Ось зручний cheatsheet для користувачів cabal-dev:

Дія cabal-dev cabal sanbox
Ініціалізувати пісочницю cabal-dev $ANY_COMMAND cabal sandbox init
Видалити пісочницю rm -rf ./cabal-dev cabal sandbox delete
З'єднайте вихідний каталог з пісочниці N/A cabal sandbox add-source
Зробити пакет доступним у пісочниці cabal-dev add-source cabal sandbox add-source --snapshot
Побудуйте поточний пакет cabal-dev build cabal build
Встановіть пакет в пісочницю cabal-dev install $PKGNAME cabal install $PKGNAME
Будь-яка інша стандартна команда cabal cabal-dev $COMMAND cabal $COMMAND
Встановити залежностей пакунка cabal-dev install-deps cabal install --only-dependencies
Запустіть sandbox-local ghci cabal-dev ghci cabal repl
Ghc-pkg, обмежений пісочницею cabal-dev ghc-pkg cabal sandbox hc-pkg
Шлях до каталогу пісочниці ./cabal-dev ./.cabal-sandbox

Одна важлива відмінність полягає в тому, що add-source додає посилання до вихідного каталогу замість того, щоб робити вихідний знімок для встановлення. Пакунки додаткових джерел повторно встановлюються кожного разу, коли пакунок із пісочниці встановлено. Щоб отримати поведінку cabal-dev, скористайтеся cabal add-source --snapshot.

Інша відмінність полягає в тому, що ізольовані компоненти мають обмежений послідовність, тобто деструктивно повторно встановити пакет (як у прикладі введення) не дозволяється. Встановлення декількох версій пакунка все ще добре.

Майбутня робота

У майбутньому ми хочемо, щоб за замовчуванням створювалось герметичність, тобто система збирання повинна працювати так, ніби всі артефакти збірки були перебудовані заново кожного разу. В ідеалі, ця функція буде побудована на вершині чисто функціональної Nix-подібної пакункової бази даних, яка дозволить обмінюватися артефактами будівель між різними збірками, не турбуючись про проблему деструктивного оновлення, викладеної в вступі. На жаль, це великий і нетривіальний проект, хоча деякі роботи вже виконані в цьому напрямку. Можливим проміжним рішенням є запуск кожного збірки у власній пісочниці.

Існує також ряд порівняно невеликих проблем інтерфейсу з пісочницями, які були перенесені до наступного випуску (1.20). Щоб отримати докладнішу інформацію про це, перегляньте трекери Cabal bug.

Нарешті, але не менш важливо, ми дуже зацікавлені у вашому відгуку про цю функцію, особливо про те, наскільки добре вона працює у масштабних проектах.

Подяка

Дякуємо Йохану Тібеллу, Дункану Кутцу та Андресу Льху за відгуки та керівництво кодами, а також Google, щоб заплатити за роботу над цим проектом протягом минулого літа. Дякую Rogan Creswick за написання оригінального інструменту cabal-dev, на якому спирається ця робота.

Помилки

Конфігурація cabal, gcc

❯ cabal configure --with-gcc=/usr/local/Cellar/gcc/8.1.0/bin/gcc-8
Resolving dependencies...
Configuring Haskell-0.1.0.0...
clang: error: unknown argument: '-no-pie'
`gcc' failed in phase `C Compiler'. (Exit code: 1)
❯ /usr/local/bin/gcc-8 -v
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc-8
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/8.1.0/libexec/gcc/x86_64-apple-darwin15.6.0/8.1.0/lto-wrapper
Target: x86_64-apple-darwin15.6.0
Configured with: ../configure --build=x86_64-apple-darwin15.6.0 --prefix=/usr/local/Cellar/gcc/8.1.0 --libdir=/usr/local/Cellar/gcc/8.1.0/lib/gcc/8 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-8 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --enable-checking=release --with-pkgversion='Homebrew GCC 8.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-nls
Thread model: posix
gcc version 8.1.0 (Homebrew GCC 8.1.0)

~/.stack/programs/x86_64-osx/ghc-8.2.2/lib/ghc-8.2.2/settings

2:  ("C compiler command", "gcc"),
3: ("C compiler flags", " -m64 -fno-stack-protector"),
4: ("C compiler link flags", " -m64 "),
5: ("C compiler supports -no-pie", "NO"),
6: ("Haskell CPP command","gcc"),

~/.cabal/config

program-locations
  -- alex-location:
  -- ar-location:
  -- c2hs-location:
  -- cpphs-location:
  -- doctest-location:
  -- gcc-location: /usr/local/bin/gcc-8

Allow overriding gcc-location

❯ ghc --info
 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("GCC extra via C opts"," -fwrapv -fno-builtin")
 ,("C compiler command","gcc")
 ,("C compiler flags"," -fno-stack-protector")
 ,("C compiler link flags"," ")
 ,("C compiler supports -no-pie","YES")
 ,("Haskell CPP command","gcc")
 ,("Haskell CPP flags","-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs")
 ,("ld command","ld")
 ,("ld flags","")
 ,("ld supports compact unwind","YES")
 ,("ld supports build-id","NO")
 ,("ld supports filelist","YES")
 ,("ld is GNU ld","NO")
 ,("ar command","ar")
 ,("ar flags","qcls")
 ,("ar supports at file","NO")
 ,("ranlib command","")
 ,("touch command","touch")
 ,("dllwrap command","/bin/false")
 ,("windres command","/bin/false")
 ,("libtool command","libtool")
 ,("perl command","/usr/bin/perl")
 ,("cross compiling","NO")
 ,("target os","OSDarwin")
 ,("target arch","ArchX86_64")
 ,("target word size","8")
 ,("target has GNU nonexec stack","False")
 ,("target has .ident directive","True")
 ,("target has subsections via symbols","True")
 ,("target has RTS linker","YES")
 ,("Unregisterised","NO")
 ,("LLVM llc command","llc")
 ,("LLVM opt command","opt")
 ,("LLVM clang command","clang")
 ,("Project version","8.4.2")
 ,("Project Git commit id","28595b7ab619d9a812cce23a546d7deabb486372")
 ,("Booter version","8.2.2")
 ,("Stage","2")
 ,("Build platform","x86_64-apple-darwin")
 ,("Host platform","x86_64-apple-darwin")
 ,("Target platform","x86_64-apple-darwin")
 ,("Have interpreter","YES")
 ,("Object splitting supported","NO")
 ,("Have native code generator","YES")
 ,("Support SMP","YES")
 ,("Tables next to code","YES")
 ,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn")
 ,("RTS expects libdw","NO")
 ,("Support dynamic-too","YES")
 ,("Support parallel --make","YES")
 ,("Support reexported-modules","YES")
 ,("Support thinning and renaming package flags","YES")
 ,("Support Backpack","YES")
 ,("Requires unified installed package IDs","YES")
 ,("Uses package keys","YES")
 ,("Uses unit IDs","YES")
 ,("Dynamic by default","NO")
 ,("GHC Dynamic","YES")
 ,("GHC Profiled","NO")
 ,("Leading underscore","YES")
 ,("Debug on","False")
 ,("LibDir","/Library/Frameworks/GHC.framework/Versions/8.4.2-x86_64/usr/lib/ghc-8.4.2")
 ,("Global Package DB","/Library/Frameworks/GHC.framework/Versions/8.4.2-x86_64/usr/lib/ghc-8.4.2/package.conf.d")
 ]

cabal install stylish-haskell
Resolving dependencies...
Downloading base-compat-0.10.1...
Downloading colour-2.3.4...
Configuring colour-2.3.4...
Configuring base-compat-0.10.1...
Building base-compat-0.10.1...
Building colour-2.3.4...
Installed colour-2.3.4
Downloading dlist-0.8.0.4...
Configuring dlist-0.8.0.4...
Building dlist-0.8.0.4...
Installed dlist-0.8.0.4
Downloading file-embed-0.0.10.1...
Configuring file-embed-0.0.10.1...
Building file-embed-0.0.10.1...
Installed base-compat-0.10.1
Downloading old-locale-1.0.0.7...
Configuring old-locale-1.0.0.7...
Building old-locale-1.0.0.7...
Installed file-embed-0.0.10.1
Downloading polyparse-1.12...
Configuring polyparse-1.12...
Building polyparse-1.12...
Installed old-locale-1.0.0.7
Downloading semigroups-0.18.4...
Configuring semigroups-0.18.4...
Building semigroups-0.18.4...
Installed semigroups-0.18.4
Downloading strict-0.3.2...
Configuring strict-0.3.2...
Building strict-0.3.2...
Installed strict-0.3.2
Downloading th-abstraction-0.2.6.0...
Configuring th-abstraction-0.2.6.0...
Building th-abstraction-0.2.6.0...
Installed th-abstraction-0.2.6.0
Downloading time-locale-compat-0.1.1.4...
Configuring time-locale-compat-0.1.1.4...
Building time-locale-compat-0.1.1.4...
Installed time-locale-compat-0.1.1.4
Downloading transformers-compat-0.6.2...
Configuring transformers-compat-0.6.2...
Building transformers-compat-0.6.2...
Installed polyparse-1.12
Downloading unliftio-core-0.1.1.0...
Configuring unliftio-core-0.1.1.0...
Building unliftio-core-0.1.1.0...
Installed unliftio-core-0.1.1.0
Downloading uuid-types-1.0.3...
Configuring uuid-types-1.0.3...
Building uuid-types-1.0.3...
Installed transformers-compat-0.6.2
Downloading vector-algorithms-0.7.0.1...
Configuring vector-algorithms-0.7.0.1...
Building vector-algorithms-0.7.0.1...
Installed uuid-types-1.0.3
Downloading ansi-terminal-0.8.0.4...
Configuring ansi-terminal-0.8.0.4...
Building ansi-terminal-0.8.0.4...
Installed ansi-terminal-0.8.0.4
Downloading old-time-1.1.0.3...
Configuring old-time-1.1.0.3...
Building old-time-1.1.0.3...
Installed old-time-1.1.0.3
Downloading tagged-0.8.5...
Configuring tagged-0.8.5...
Building tagged-0.8.5...
Installed tagged-0.8.5
Downloading exceptions-0.10.0...
Configuring exceptions-0.10.0...
Building exceptions-0.10.0...
Installed exceptions-0.10.0
Downloading ansi-wl-pprint-0.6.8.2...
Configuring ansi-wl-pprint-0.6.8.2...
Building ansi-wl-pprint-0.6.8.2...
Installed ansi-wl-pprint-0.6.8.2
Downloading cpphs-1.20.8...
Configuring cpphs-1.20.8...
Building cpphs-1.20.8...
Installed cpphs-1.20.8
Downloading aeson-1.3.1.1...
Configuring aeson-1.3.1.1...
Installed vector-algorithms-0.7.0.1
Downloading resourcet-1.2.1...
Configuring resourcet-1.2.1...
Building aeson-1.3.1.1...
Building resourcet-1.2.1...
Installed resourcet-1.2.1
Downloading optparse-applicative-0.14.2.0...
Configuring optparse-applicative-0.14.2.0...
Building optparse-applicative-0.14.2.0...
Installed optparse-applicative-0.14.2.0
Downloading haskell-src-exts-1.20.2...
Configuring haskell-src-exts-1.20.2...
Building haskell-src-exts-1.20.2...
Installed aeson-1.3.1.1
Downloading mono-traversable-1.0.8.1...
Configuring mono-traversable-1.0.8.1...
Building mono-traversable-1.0.8.1...
Installed mono-traversable-1.0.8.1
Downloading conduit-1.3.0.2...
Configuring conduit-1.3.0.2...
Building conduit-1.3.0.2...
Installed conduit-1.3.0.2
Downloading yaml-0.8.30...
Configuring yaml-0.8.30...
Building yaml-0.8.30...
Installed yaml-0.8.30
Installed haskell-src-exts-1.20.2
Downloading stylish-haskell-0.9.2.0...
Configuring stylish-haskell-0.9.2.0...
Building stylish-haskell-0.9.2.0...
Installed stylish-haskell-0.9.2.0
Updating documentation index
/Users/searge/Library/Haskell/share/doc/x86_64-osx-ghc-8.4.2/index.html
❯ cabal install hsdev
Resolving dependencies...
In order, the following would be installed:
Only-0.1 (via: sqlite-simple-0.4.15.0) (new package)
SafeSemaphore-0.10.1 (via: simple-log-0.9.3) (new package)
base-compat-0.9.3 (latest: 0.10.1) (via: aeson-pretty-0.8.7 aeson-1.2.4.0)
(new version)
base-orphans-0.7 (via: lens-4.16.1 profunctors-5.2.2 semigroupoids-5.2.2
bifunctors-5.5.2 distributive-0.5.3 transformers-base-0.4.5.2) (new package)
base-unicode-symbols-0.2.2.4 (via: text-region-0.3.0.0 simple-log-0.9.3
hformat-0.3.1.0) (new package)
blaze-builder-0.4.1.0 (via: sqlite-simple-0.4.15.0 blaze-textual-0.2.1.0) (new
package)
cabal-doctest-1.0.6 (via: lens-4.16.1 semigroupoids-5.2.2 comonad-5.0.3
distributive-0.5.3) (new package)
cereal-0.5.5.0 (via: hfsevents-0.1.6) (new package)
clock-0.7.2 (via: extra-1.6.5) (new package)
cmdargs-0.10.20 (via: hlint-2.0.15 aeson-pretty-0.8.7) (new package)
contravariant-1.4.1 (via: lens-4.16.1 kan-extensions-5.1 adjunctions-4.4
profunctors-5.2.2 semigroupoids-5.2.2 comonad-5.0.3) (new package)
data-default-class-0.1.2.0 (via: data-default-0.7.1.1
data-default-instances-containers-0.0.1 data-default-instances-dlist-0.0.1
data-default-instances-old-locale-0.0.1) (new package)
data-lens-light-0.1.2.2 (via: haskell-names-0.9.1) (new package)
direct-sqlite-2.3.23 (via: hsdev-0.3.1.3 sqlite-simple-0.4.15.0) (new package)
exceptions-0.8.3 (latest: 0.10.0) (via: hsdev-0.3.1.3 hsdev-0.3.1.3
lens-4.16.1 free-5.0.2 simple-log-0.9.3 conduit-1.3.0.2 resourcet-1.2.1) (new
version)
fail-4.9.0.0 (via: kan-extensions-5.1) (new package)
ghc-paths-0.1.0.9 (via: hsdev-0.3.1.3 hdocs-0.5.2.1 haddock-api-2.19.0.1) (new
package)
ghc-syb-utils-0.2.3.3 (via: hsdev-0.3.1.3) (new package)
groups-0.4.1.0 (via: text-region-0.3.0.0) (new package)
haddock-library-1.5.0.1 (via: haddock-api-2.19.0.1) (new package)
microlens-0.4.9.1 (via: simple-log-0.9.3 microlens-platform-0.3.10
microlens-ghc-0.4.9 microlens-mtl-0.1.11.1 microlens-th-0.4.2.1) (new package)
mmorph-1.1.2 (via: hsdev-0.3.1.3 simple-log-0.9.3) (new package)
monad-loops-0.4.3 (via: hsdev-0.3.1.3 hsdev-0.3.1.3) (new package)
refact-0.3.0.2 (via: hlint-2.0.15) (new package)
reflection-2.1.3 (via: lens-4.16.1) (new package)
regex-pcre-builtin-0.94.4.8.8.35 (via: hsdev-0.3.1.3) (new package)
traverse-with-class-1.0.0.0 (via: haskell-names-0.9.1) (new package)
uniplate-1.6.12 (via: hsdev-0.3.1.3 hlint-2.0.15 haskell-src-exts-util-0.2.3
haskell-names-0.9.1) (new package)
unix-compat-0.5.0.1 (via: fsnotify-0.2.1.2) (new package)
void-0.7.2 (via: lens-4.16.1 adjunctions-4.4) (new package)
aeson-1.2.4.0 (latest: 1.3.1.1) (via: hsdev-0.3.1.3 hsdev-0.3.1.3
text-region-0.3.0.0 hlint-2.0.15 yaml-0.8.30 hdocs-0.5.2.1 hdocs-0.5.2.1
aeson-pretty-0.8.7 aeson-pretty-0.8.7 haskell-names-0.9.1) (new version)
transformers-base-0.4.5.2 (via: hsdev-0.3.1.3 free-5.0.2 lifted-base-0.2.3.12
monad-control-1.0.2.3) (new package)
hformat-0.3.1.0 (via: hsdev-0.3.1.3 simple-log-0.9.3) (new package)
blaze-textual-0.2.1.0 (via: sqlite-simple-0.4.15.0) (new package)
distributive-0.5.3 (via: lens-4.16.1 kan-extensions-5.1 adjunctions-4.4
free-5.0.2 profunctors-5.2.2 semigroupoids-5.2.2 comonad-5.0.3) (new package)
hfsevents-0.1.6 (via: fsnotify-0.2.1.2) (new package)
extra-1.6.5 (latest: 1.6.6) (via: hlint-2.0.15) (new package)
data-default-instances-old-locale-0.0.1 (via: data-default-0.7.1.1) (new
package)
data-default-instances-dlist-0.0.1 (via: data-default-0.7.1.1) (new package)
data-default-instances-containers-0.0.1 (via: data-default-0.7.1.1) (new
package)
resourcet-1.2.1 (via: yaml-0.8.30 conduit-1.3.0.2) (reinstall) (changes:
exceptions-0.10.0 removed)
haddock-api-2.19.0.1 (via: hdocs-0.5.2.1) (new package)
microlens-th-0.4.2.1 (via: microlens-platform-0.3.10) (new package)
microlens-mtl-0.1.11.1 (via: microlens-platform-0.3.10) (new package)
microlens-ghc-0.4.9 (via: microlens-platform-0.3.10) (new package)
haskell-names-0.9.1 (via: hsdev-0.3.1.3) (new package)
aeson-pretty-0.8.7 (via: hsdev-0.3.1.3 hsdev-0.3.1.3 hdocs-0.5.2.1) (new
package)
monad-control-1.0.2.3 (via: hsdev-0.3.1.3 lifted-base-0.2.3.12) (new package)
sqlite-simple-0.4.15.0 (via: hsdev-0.3.1.3) (new package)
comonad-5.0.3 (via: lens-4.16.1 kan-extensions-5.1 adjunctions-4.4 free-5.0.2
profunctors-5.2.2 semigroupoids-5.2.2 bifunctors-5.5.2) (new package)
fsnotify-0.2.1.2 (via: hsdev-0.3.1.3) (new package)
data-default-0.7.1.1 (via: hsdev-0.3.1.3 hlint-2.0.15 simple-log-0.9.3
haskell-src-exts-util-0.2.3) (new package)
conduit-1.3.0.2 (via: yaml-0.8.30) (reinstall) (changes: exceptions-0.10.0
removed, resourcet-1.2.1 removed)
microlens-platform-0.3.10 (via: simple-log-0.9.3) (new package)
hdocs-0.5.2.1 (via: hsdev-0.3.1.3) (new package)
lifted-base-0.2.3.12 (via: hsdev-0.3.1.3) (new package)
bifunctors-5.5.2 (via: lens-4.16.1 free-5.0.2 profunctors-5.2.2
semigroupoids-5.2.2) (new package)
haskell-src-exts-util-0.2.3 (via: hlint-2.0.15) (new package)
yaml-0.8.30 (via: hlint-2.0.15) (reinstall) (changes: aeson-1.3.1.1 removed,
conduit-1.3.0.2 removed, resourcet-1.2.1 removed)
simple-log-0.9.3 (via: hsdev-0.3.1.3) (new package)
semigroupoids-5.2.2 (via: lens-4.16.1 kan-extensions-5.1 adjunctions-4.4
free-5.0.2) (new package)
profunctors-5.2.2 (via: lens-4.16.1 kan-extensions-5.1 adjunctions-4.4
free-5.0.2) (new package)
hlint-2.0.15 (latest: 2.1.5) (via: hsdev-0.3.1.3) (new package)
free-5.0.2 (via: lens-4.16.1 kan-extensions-5.1 adjunctions-4.4) (new package)
adjunctions-4.4 (via: kan-extensions-5.1) (new package)
kan-extensions-5.1 (via: lens-4.16.1) (new package)
lens-4.16.1 (via: hsdev-0.3.1.3 text-region-0.3.0.0) (new package)
text-region-0.3.0.0 (via: hsdev-0.3.1.3) (new package)
hsdev-0.3.1.3 (new package)
cabal: The following packages are likely to be broken by the reinstalls:
stylish-haskell-0.9.2.0
Use --force-reinstalls if you want to install anyway.

Невдалося налаштувати hsdev і SublimeHaskell

Backend configuration: "Remote hsdev@localhost:4567"

Incompatible hsdev, detected version 0.0.0.0
Version should be ≥ 0.2.0.0 and < 0.3.0.0

Пішов дивитися issues.

Tools (cabal, hsdev, ghc-mod, ghc, etc.) are usually installed in a directory that is already added to your PATH environment variable. SublimeHaskell will also look for these tools in several "Haskell standard" places. These places include:

Builder *nix Platforms
stack $HOME/.local/bin
cabal user $HOME/.cabal/bin
cabal global /usr/local/bin

Попробував встановити stack install hsdev-0.3.0.0 т.я. подумав, що відкритий pull request вже доданно до репозитарію. Попросило додати кілька залежностей в ~/.stack/global-project/stack.yaml, додав:

extra-deps:
- haddock-api-2.18.1
- hdocs-0.5.2.1
- hlint-2.0.15
- extra-1.6.5
- haddock-library-1.4.4

Також додав в Path через mate .zshrc:

export PATH="$HOME/.local/bin:$PATH"

Виявилося — непрацює! Треба старішу версію. stack install hsdev-0.2.5.1 — не підходить, бо вимагає дурні залежності, то - haskell-src-exts-1.19.1, то - haskell-src-exts-1.20.2.

Спробувати:

  • Знайти стабільну версію hsdev < 0.3.0.0
  • Знайти шлях де cabal встановив той hsdev та stylish-haskell-0.9.2.0
  • Взнати, як видаляти пакунки встановленні через stack пакунки.

stylish-haskell cabal встановив в ~/Library/Haskell/bin.

В принципі, я так і подумав. А от hsdev там не виявилося, тільки cpphs. Mac OS X Common Installation Paths

Ні, актуальна версія hsdev < 0.3.0.0, все-таки 0.2.5.1 😒

❯ ghc --info
 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("GCC extra via C opts"," -fwrapv -fno-builtin")
 ,("C compiler command","gcc")
 ,("C compiler flags"," -m64 -fno-stack-protector")
 ,("C compiler link flags"," -m64 ")
 ,("C compiler supports -no-pie","NO")
 ,("Haskell CPP command","gcc")
 ,("Haskell CPP flags","-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs")
 ,("ld command","ld")
 ,("ld flags"," -arch x86_64")
 ,("ld supports compact unwind","YES")
 ,("ld supports build-id","NO")
 ,("ld supports filelist","YES")
 ,("ld is GNU ld","NO")
 ,("ar command","/usr/bin/ar")
 ,("ar flags","clqs")
 ,("ar supports at file","NO")
 ,("touch command","touch")
 ,("dllwrap command","/bin/false")
 ,("windres command","/bin/false")
 ,("libtool command","libtool")
 ,("perl command","/usr/bin/perl")
 ,("cross compiling","NO")
 ,("target os","OSDarwin")
 ,("target arch","ArchX86_64")
 ,("target word size","8")
 ,("target has GNU nonexec stack","False")
 ,("target has .ident directive","True")
 ,("target has subsections via symbols","True")
 ,("target has RTS linker","@HaskellHaveRTSLinker@")
 ,("Unregisterised","NO")
 ,("LLVM llc command","llc")
 ,("LLVM opt command","opt")
 ,("Project version","8.2.1")
 ,("Project Git commit id","0cee25253f9f2cb4f19f021fd974bdad3c26a80b")
 ,("Booter version","7.10.3")
 ,("Stage","2")
 ,("Build platform","x86_64-apple-darwin")
 ,("Host platform","x86_64-apple-darwin")
 ,("Target platform","x86_64-apple-darwin")
 ,("Have interpreter","YES")
 ,("Object splitting supported","NO")
 ,("Have native code generator","YES")
 ,("Support SMP","YES")
 ,("Tables next to code","YES")
 ,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn")
 ,("RTS expects libdw","NO")
 ,("Support dynamic-too","YES")
 ,("Support parallel --make","YES")
 ,("Support reexported-modules","YES")
 ,("Support thinning and renaming package flags","YES")
 ,("Support Backpack","YES")
 ,("Requires unified installed package IDs","YES")
 ,("Uses package keys","YES")
 ,("Uses unit IDs","YES")
 ,("Dynamic by default","NO")
 ,("GHC Dynamic","YES")
 ,("GHC Profiled","NO")
 ,("Leading underscore","YES")
 ,("Debug on","False")
 ,("LibDir","/Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1")
 ,("Global Package DB","/Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/package.conf.d")
 ]

~/Code/Haskell/ghci
❯ stack upgrade
Current Stack version: 1.5.1, available download version: 1.7.1
Newer version detected, downloading
Querying for archive location for platform: osx-x86_64-static
Querying for archive location for platform: osx-x86_64
Downloading from: https://github.com/commercialhaskell/stack/releases/download/v1.7.1/stack-1.7.1-osx-x86_64.tar.gz
Download complete, testing executable
Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2
New stack executable available at /Users/searge/.local/bin/stack

~/Code/Haskell/ghci 10s
❯ stack setup
Downloaded lts-11.10 build plan.
AesonException "Error in $.packages.cassava.constraints.flags['bytestring--lt-0_10_4']: Invalid flag name: \"bytestring--lt-0_10_4\""

~/Code/Haskell/ghci 7s
❯ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

Запуск в домашньому каталозі

Спрацювало, але не дуже мені подобається:

~
❯ stack setup
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-8.2.2.
Installed GHC.
stack will use a sandboxed GHC it installed
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 ghci
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Downloading root
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Downloading timestamp
Downloading snapshot
Downloading mirrors
Cannot update index (no local copy)
Downloading index
Updated package index downloaded
Update complete
Populated index cache.

Note: No local targets specified, so a plain ghci will be started with no package hiding or package options.

      If you want to use package hiding and options, then you can try one of the following:

      * If you want to start a different project configuration
        than /Users/searge/.stack/global-project/stack.yaml, then you can use stack init to create a new stack.yaml for
        the packages in the current directory.

      * If you want to use the project configuration
        at /Users/searge/.stack/global-project/stack.yaml, then you can add to its 'packages' field.

Configuring GHCi with the following packages:
GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /private/var/folders/k3/412l536j6493cqc0060sv2hm0000gn/T/haskell-stack-ghci/2a3bbd58/ghci-script
Prelude>
Leaving GHCi.

~ 1m 58s

Встановлення Siblime Haskell

cabal install stylish-haskell
clang: error: unknown argument: '-no-pie'
`gcc' failed in phase `C Compiler'. (Exit code: 1)
gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Summary: For example, this option is expected by ghc (haskell compiler). Currently, building with ghc will fail with:

clang: error: unknown argument: '-no-pie'
`gcc' failed in phase `Linker'. (Exit code: 1)
. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
configure_recipe

This won't do anything (but won't fail with an error)

Leopard got rid of no-pie for a period: http://trac.macports.org/ticket/34064 As the comments note, upgrading xcode/ld to more recent versions enables the flag.

# Налаштування Atom IDE Haskell
З *SublimeHaskell* щось не виходить, вирішив спробувати перемкнутися на *Atom IDE*, вивчаю і переглядаю [залежності](https://atom-haskell.github.io/overview/requirements/):
- [stylish-haskell](https://github.com/jaspervdj/stylish-haskell), був встановлений, тільки зробив конфігураційний файл в домашньому каталозі<
```bash
stylish-haskell --defaults > ~/.stylish-haskell.yaml
```
- [hindent](https://github.com/commercialhaskell/hindent) вже треба було встановлювати.
Виявилося, що через те, що я налагоджував [`gcc' failed in phase `C Compiler'](https://stackoverflow.com/questions/50386787/cabal-install-gcc-failed-in-phase-c-compiler/50419101#50419101) вручну, то інсталятор визначив це як помилку і проігнорував конфігураційний файл.
- - [ ] потрібно в цьому розібратися і налаштувати потім.
```bash
stack install hindent
Warning: /Users/searge/Code/Haskell/Haskell.cabal was modified manually. Ignoring
/Users/searge/Code/Haskell/package.yaml in favor of the cabal file. If you want to use the package.yaml file
instead of the cabal file, then please delete the cabal file.
...
hindent --help
hindent --version --help --style STYLE --line-length <...> (--indent-size <...>|--tab-size <...>) --no-force-newline (--sort-imports|--no-sort-imports) [-X<...>]* --validate [<FILENAME>]
Version 5.2.5
Default --indent-size is 2. Specify --indent-size 4 if you prefer that.
-X to pass extensions e.g. -XMagicHash etc.
The --style option is now ignored, but preserved for backwards-compatibility.
Johan Tibell is the default and only style.
```
- [brittany](https://github.com/lspitzner/brittany) _(haskell source code formatter)_ в принципі встановився так само як і попередній пакунок, через `stack`, хоча на GitHubi є варіанти і з `cabal`. Також, у автора є [цікавий Gist](https://gist.github.com/lspitzner/097c33177248a65e7657f0c6d0d12075), наскільки я зрозумів, він пропагує забити на SublimeHaskell
- - [ ] потім спробувати.
```bash
stack install brittany
Warning: /Users/searge/Code/Haskell/Haskell.cabal was modified manually. Ignoring
/Users/searge/Code/Haskell/package.yaml in favor of the cabal file. If you want to use the package.yaml file
instead of the cabal file, then please delete the cabal file.
...
❯ brittany --version
brittany version 0.9.0.1
Copyright (C) 2016-2017 Lennart Spitzner
There is NO WARRANTY, to the extent permitted by law.
~/Code/Haskell
❯ brittany --help
NAME
brittany - haskell source pretty printer
...
```
- [ghc-mod](https://github.com/DanielG/ghc-mod) -- а от з ним не все так просто, `stack` видає наступне:
```bash
❯ stack install ghc-mod
Warning: /Users/searge/Code/Haskell/Haskell.cabal was modified manually. Ignoring
/Users/searge/Code/Haskell/package.yaml in favor of the cabal file. If you want to use the package.yaml file
instead of the cabal file, then please delete the cabal file.
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for ghc-mod-5.8.0.0:
Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25 (latest matching version is 1.24.2.0)
base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10 (latest matching version is 4.9.1.0)
cabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has no specified version (latest matching
version is 0.7.3.0)
extra-1.6.6 from stack configuration does not match <1.6 && >=1.4 (latest matching version is 1.5.3)
ghc-8.2.2 from stack configuration does not match >=7.6 && <8.2
haskell-src-exts-1.20.2 from stack configuration does not match <1.20 && >=1.18 (latest matching version is 1.19.1)
hlint-2.1.5 from stack configuration does not match <2.1 && >=2.0.8 (latest matching version is 2.0.15)
monad-journal-0.8.1 from stack configuration does not match <0.8 && >=0.4 (latest matching version is 0.7.2)
optparse-applicative-0.14.2.0 from stack configuration does not match >=0.13.0.0 && <0.14 (latest matching version
is 0.13.2.0)
needed since ghc-mod is a build target.
```
Практично те саме, що й з попереднім...
// перекур...
---
> Надоїло все, пробую з'ясувати, чи можна налаштувати Haskell так, щоб ці залежності не вискакували одна за одною...
Видалив Haskell, пробую знайти старішу версію, яка працюватиме зі всіма пакетами.
```bash
❯ sudo uninstall-hs thru 8.4.2 --remove
-- Removing version 8.4.2 and earlier
** /Library/Haskell is not empty, but has no more versions. Consider removing.
```
Завантажую [Haskell Platform 8.2.1 Full 64bit](https://www.haskell.org/platform/prior.html). В `ghc-mod` необхідна версія `cabal-install version 1.24.0.2` вихід спробувати щось таке:
```bash
cabal install 'cabal-install >=1.18 && <1.25'
**********************************************************************
=== Configuration for cabal has been written to
/Users/searge/.cabal/config
=== Executables will be installed in:
/Users/searge/Library/Haskell/bin
You may wish to place this on your PATH by adding the following
line to your ~/.bash_profile:
export PATH="$HOME/Library/Haskell/bin:$PATH"
=== When documentation is built, a master index to all documentation
will be placed in:
/Users/searge/Library/Haskell/doc/index.html
You may wish to bookmark that file once it gets built (after the
first cabal install).
**********************************************************************
Updating documentation index
/Users/searge/Library/Haskell/share/doc/x86_64-osx-ghc-8.2.1/index.html
~ 20m 51s
❯ cabal --version
cabal-install version 2.0.0.0
compiled using version 2.0.0.2 of the Cabal library
```
> By default, any dependencies of the package are installed into the global or user package databases (e.g. using cabal install --only-dependencies). If you’re building several different packages that have incompatible dependencies, this can cause the build to fail. One way to avoid this problem is to build each package in an isolated environment (“sandbox”), with a sandbox-local package database. Because sandboxes are per-project, inconsistent dependencies can be simply disallowed.
> For more on sandboxes, see also [this article](http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html).
Знайшов кілька цікавих ресурсів:
- [Використовуйте Stack для початку роботи](https://github.com/bitemyapp/learnhaskell/blob/master/guide-ua.md#Використовуйте-stack-для-початку-роботи-з-haskell)
- [Чому це важливо](https://mail.haskell.org/pipermail/haskell-community/2015-September/000014.html)
- [Прощай, cabal. Здравствуй, stack!](https://ruhaskell.org/posts/utils/2015/07/13/from-cabal-to-stack.html)
Усі ці данні трохи застарілі, але на всякий випадок знову видалив `Haskell Platform` через:
```bash
❯ sudo uninstall-hs thru 8.2.1 -s
echo -- Removing version 8.2.1 and earlier
rm -rf /Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64
rm -rf /Library/Haskell/ghc-8.2.1-x86_64
rm -rf /Users/searge/.ghc/x86_64-darwin-8.2.1
rm -rf /Users/searge/Library/Haskell/ghc-8.2.1-x86_64
rm -f /usr/local/bin/activate-hs
rm -f /usr/local/bin/alex
rm -f /usr/local/bin/cabal
rm -f /usr/local/bin/cabal.real
rm -f /usr/local/bin/cabal.wrap
rm -f /usr/local/bin/ghc
rm -f /usr/local/bin/ghc-8.2.1
rm -f /usr/local/bin/ghc-clang-wrapper
rm -f /usr/local/bin/ghc-pkg
rm -f /usr/local/bin/ghc-pkg-8.2.1
rm -f /usr/local/bin/ghci
rm -f /usr/local/bin/ghci-8.2.1
rm -f /usr/local/bin/haddock
rm -f /usr/local/bin/haddock-ghc-8.2.1
rm -f /usr/local/bin/happy
rm -f /usr/local/bin/hp2ps
rm -f /usr/local/bin/hpc
rm -f /usr/local/bin/hsc2hs
rm -f /usr/local/bin/HsColour
rm -f /usr/local/bin/runghc
rm -f /usr/local/bin/runghc-8.2.1
rm -f /usr/local/bin/runhaskell
rm -f /usr/local/bin/stack
rm -f /usr/local/bin/uninstall-hs
rm -rf /Library/Frameworks/GHC.framework
rm -f /Library/Haskell/current
echo ** /Library/Haskell is not empty, but has no more versions. Consider removing.
```
Найсмішніше, що хоч тут написано: `rm -f /usr/local/bin/stack`, банальна перевірка показує:
```bash
❯ stack --version
Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2
❯ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library
```
Зробив: `❯ sudo uninstall-hs thru 8.2.1 --remove`, тепер все видалено крім кабалу і стеку.
Спробував:
```bash
❯ stack uninstall
Error: stack does not manage installations in global locations. The only global mutation stack
performs is executable copying. For the default executable destination, please run
stack path --local-bin
~
❯ stack path --local-bin
Writing implicit global project config file to: /Users/searge/.stack/global-project/stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-11.10
Downloaded lts-11.10 build plan.
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-8.2.2.
Installed GHC.
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Downloading root
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Downloading timestamp
Downloading snapshot
Downloading mirrors
Cannot update index (no local copy)
Downloading index
Updated package index downloaded
Update complete
Populated index cache.
/Users/searge/.local/bin
~ 7m 40s
~/.local/bin
❯ ls -aH
. .. brittany hindent hsdev stack
```
Видалення [кабалу](https://gist.github.com/begriffs/6408415):
```sh
rm -fr ~/.ghc
rm -fr ~/Library/Haskell/*/lib
rm -fr ~/Library/Haskell/bin/*
rm -fr ~/Library/Haskell/repo-cache
rm -fr ~/.cabal/packages
# Then in your project
# rm -fr .hsenv
```
Видалення [стеку](https://www.reddit.com/r/haskell/comments/6z06ih/how_to_uninstall_stack/dmrm08t/):
```sh
rm -dfr .stack .stylish-haskell.yaml
rm -fr ~/.local/bin/*
```
Нарешті перевірка дала результат:
```zsh
❯ cabal --version
zsh: command not found: cabal
~
❯ stack --version
zsh: command not found: stack
```
Йдемо дивитися видиво.
Вирішив використати цю формулу з оф. сайту, замість homebrew:
```zsh
curl -sSL https://get.haskellstack.org/ | sh
Using generic bindist...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 619 0 619 0 0 619 0 --:--:-- --:--:-- --:--:-- 943
100 7524k 100 7524k 0 0 1254k 0 0:00:06 0:00:06 --:--:-- 1698k
Installing Stack to: /usr/local/bin/stack...
-------------------------------------------------------------------------------
Stack has been installed to: /usr/local/bin/stack
NOTE: You may need to run 'xcode-select --install' to set
up the Xcode command-line tools, which Stack uses.
~ 12s
❯ stack setup
Writing implicit global project config file to: /Users/searge/.stack/global-project/stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-11.10
Downloaded lts-11.10 build plan.
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-8.2.2.
Installed GHC.
stack will use a sandboxed GHC it installed
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
~ 5m 50s
```
Недолік такого способу, що `ghci` треба по дурному запускати:
```zsh
~
❯ stack ghci
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Downloading root
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Downloading timestamp
Downloading snapshot
Downloading mirrors
Cannot update index (no local copy)
Downloading index
Updated package index downloaded
Update complete
Populated index cache.
Note: No local targets specified, so a plain ghci will be started with no package hiding or package
options.
If you want to use package hiding and options, then you can try one of the following:
* If you want to start a different project configuration
than /Users/searge/.stack/global-project/stack.yaml, then you can use stack init to create a
new stack.yaml for the packages in the current directory.
* If you want to use the project configuration
at /Users/searge/.stack/global-project/stack.yaml, then you can add to its 'packages' field.
Configuring GHCi with the following packages:
GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /private/var/folders/k3/412l536j6493cqc0060sv2hm0000gn/T/haskell-stack-ghci/2a3bbd58/ghci-script
Prelude>
Leaving GHCi.
~ 1m 32s
```
**Про Docker**, [в тому відео](https://www.youtube.com/watch?v=sRonIB8ZStw) використовують його для розвертання стека:
> **macOS**: Docker for Mac is the supported way to use Docker integration on macOS (the older Docker Machine (boot2docker) approach to using Docker on macOS is not supported due to issues with host volume mounting that make Stack [nearly unusable](https://docs.haskellstack.org/en/stable/docker_integration/) for anything but the most trivial projects).
```zsh
❯ ls .stack/programs/x86_64-osx/ghc-8.2.2/bin
ghc ghc-pkg-8.2.2 haddock hpc runghc-8.2.2
ghc-8.2.2 ghci haddock-ghc-8.2.2 hsc2hs runhaskell
ghc-pkg ghci-8.2.2 hp2ps runghc
~
❯ .stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.2.2
~
❯ stack path
stack-root: /Users/searge/.stack
project-root: /Users/searge/.stack/global-project
config-location: /Users/searge/.stack/global-project/stack.yaml
bin-path: /Users/searge/.stack/snapshots/x86_64-osx/lts-11.10/8.2.2/bin:/Users/searge/.stack/compiler-tools/x86_64-osx/ghc-8.2.2/bin:/Users/searge/.stack/programs/x86_64-osx/ghc-8.2.2/bin:/Users/searge/.rvm/gems/ruby-2.4.2/bin:/Users/searge/.rvm/gems/ruby-2.4.2@global/bin:/Users/searge/.rvm/rubies/ruby-2.4.2/bin:/Users/searge/.local/bin:/Users/searge/Library/Haskell/bin:/Applications/Racket v6.12/bin:/Users/searge/anaconda3/bin:/Users/searge/.nvm/versions/node/v9.6.1/bin:/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:.:/Users/searge/.rvm/bin
programs: /Users/searge/.stack/programs/x86_64-osx
compiler-exe: /Users/searge/.stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc
compiler-bin: /Users/searge/.stack/programs/x86_64-osx/ghc-8.2.2/bin
compiler-tools-bin: /Users/searge/.stack/compiler-tools/x86_64-osx/ghc-8.2.2/bin
local-bin: /Users/searge/.local/bin
extra-include-dirs:
extra-library-dirs:
snapshot-pkg-db: /Users/searge/.stack/snapshots/x86_64-osx/lts-11.10/8.2.2/pkgdb
local-pkg-db: /Users/searge/.stack/global-project/.stack-work/install/x86_64-osx/lts-11.10/8.2.2/pkgdb
global-pkg-db: /Users/searge/.stack/programs/x86_64-osx/ghc-8.2.2/lib/ghc-8.2.2/package.conf.d
ghc-package-path: /Users/searge/.stack/global-project/.stack-work/install/x86_64-osx/lts-11.10/8.2.2/pkgdb:/Users/searge/.stack/snapshots/x86_64-osx/lts-11.10/8.2.2/pkgdb:/Users/searge/.stack/programs/x86_64-osx/ghc-8.2.2/lib/ghc-8.2.2/package.conf.d
snapshot-install-root: /Users/searge/.stack/snapshots/x86_64-osx/lts-11.10/8.2.2
local-install-root: /Users/searge/.stack/global-project/.stack-work/install/x86_64-osx/lts-11.10/8.2.2
snapshot-doc-root: /Users/searge/.stack/snapshots/x86_64-osx/lts-11.10/8.2.2/doc
local-doc-root: /Users/searge/.stack/global-project/.stack-work/install/x86_64-osx/lts-11.10/8.2.2/doc
dist-dir: .stack-work/dist/x86_64-osx/Cabal-2.0.1.0
local-hpc-root: /Users/searge/.stack/global-project/.stack-work/install/x86_64-osx/lts-11.10/8.2.2/hpc
local-bin-path: /Users/searge/.local/bin
ghc-paths: /Users/searge/.stack/programs/x86_64-osx
```
Встановив hlint stylish-haskell
```bash
stack install hlint stylish-haskell
...
Copying from /Users/searge/.stack/snapshots/x86_64-osx/lts-11.10/8.2.2/bin/hlint to /Users/searge/.local/bin/hlint
Copying from /Users/searge/.stack/global-project/.stack-work/install/x86_64-osx/lts-11.10/8.2.2/bin/stylish-haskell to /Users/searge/.local/bin/stylish-haskell
Copied executables to /Users/searge/.local/bin:
- hlint
- stylish-haskell
Warning: The hlint executable found on the PATH environment variable is
/Users/searge/.stack/snapshots/x86_64-osx/lts-11.10/8.2.2/bin/hlint and not the version that was just
installed. This means that hlint calls on the command line will not use this version.
~ 4m 13s
❯ hlint --version
HLint v2.1.5, (C) Neil Mitchell 2006-2018
~
❯ which hlint
/Users/searge/.stack/snapshots/x86_64-osx/lts-11.10/8.2.2/bin/hlint
```
Дуже дивно ¯\_(ツ)_/¯
#### Встановив `spacemac`
```
╭─ Quick Help ─────────────────────────────────────────────────────────────────╮
│ │
│ Press [TAB] or [J] to move to next button. │
│ │
│ Press [Shift-TAB] or [K] to move to previous button. │
│ │
│ Press [w] to jump to warning list. │
│ │
│ Press [r] to jump to recent file list if it is enabled. │
│ │
│ Press [p] to jump to project list if it is enabled. │
│ │
│ Press [b] to jump to bookmark list if it is enabled. │
│ │
│ Press [c] to jump to org-agenda list if it is enabled. │
│ │
│ Press [d] to jump to org-todo list if it is enabled. │
│ │
│ Press [o] to jump to any link or button. │
│ │
│ Press [m] to jump to the top menu. │
│ │
│ Press [SPC] (in Vim editing style) or [Alt-m] (in Emacs editing style) to │
│ access Spacemacs commands (will list only the Vim style ones for the rest │
│ of this help). │
│ │
│ Press [SPC f e d] (or [Alt-m f e d] in Emacs style) to access .spacemacs │
│ file. │
│ │
│ Press [SPC h SPC] to access a list of documentation and supported layers. │
│ You can type anything to narrow to a specific feature i.e. "python" for │
│ Python layer. There are multiple lists and you can press [Ctrl-o] to │
│ switch between them. │
│ │
│ When reading a document, you can use [SPC s j] to jump to a heading. │
│ │
│ Please consult Spacemacs documentation from [SPC h SPC] for more details. │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
```
#### Налаштування `NeoVIM`
```
- INFO: Executable: Not found
## Ruby provider (optional)
- INFO: Ruby: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
- WARNING: Missing "neovim" gem.
- ADVICE:
- Run in shell: gem install neovim
- Is the gem bin directory in $PATH? Check `gem environment`.
- If you are using rvm/rbenv/chruby, try "rehashing".
## Node provider (optional)
- INFO: Node: v9.6.1
- WARNING: Missing "neovim" npm package.
- ADVICE:
- Run in shell: npm install -g neovim
- Is the npm bin directory in $PATH?
Python integration provider-python
Nvim supports the Vim legacy python-vim and python3 interfaces via
external Python interpreters connected via RPC.
Note: Only the Vim 7.3 API is supported; bindeval (Vim 7.4) is not.
PYTHON QUICKSTART
If you used a package manager to install Nvim, you might already have the
required neovim Python package. Run :checkhealth to see if your system is
up-to-date.
Following are steps to install the package with Python's pip tool.
Note: Depending on your system, pip might refer to Python 2 or Python 3,
which is why the following instructions mention pip2 or pip3
explicitly. If one of these is not available, try pip.
To use Vim Python 2/3 plugins with Nvim:
- For Python 2 plugins, make sure an interpreter for Python 2.6 or 2.7 is
available in your $PATH, then install the neovim Python package systemwide:
$ sudo pip2 install --upgrade neovim
or for the current user:
$ pip2 install --user --upgrade neovim
- For Python 3 plugins, make sure an interpreter for Python 3.3 or above is
available in your $PATH, then install the neovim Python package systemwide:
$ sudo pip3 install --upgrade neovim
or for the current user:
$ pip3 install --user --upgrade neovim
Note: The --upgrade flag ensures you have the latest version even if
a previous version was already installed.
PYTHON PROVIDER CONFIGURATION
g:python_host_prog
g:python3_host_prog
Program to use for evaluating Python code. Setting this makes startup faster.
Also useful for working with virtualenvs.
let g:python_host_prog = '/path/to/python'
let g:python3_host_prog = '/path/to/python3'
g:loaded_python_provider
To disable Python 2 support:
let g:loaded_python_provider = 1
g:loaded_python3_provider
To disable Python 3 support:
let g:loaded_python3_provider = 1
PYTHON VIRTUALENVS
If you plan to use per-project virtualenvs often, you should assign
a virtualenv for Neovim and hard-code the interpreter path via
g:python_host_prog (or g:python3_host_prog) so that the "neovim" python
package is not required for each Environment. Example using pyenv:
pyenv install 3.4.4
pyenv virtualenv 3.4.4 py3neovim
pyenv activate py3neovim
pip install neovim
pyenv which python # Note the path
The last command reports the interpreter path. Add it to your init.vim:
let g:python3_host_prog = '/full/path/to/py3neovim/bin/python'
More information:
https://github.com/zchee/deoplete-jedi/wiki/Setting-up-Python-for-Neovim
==============================================================================
Ruby integration provider-ruby
Nvim supports the Vim legacy ruby-vim interface via external Ruby
interpreters connected via RPC.
Run :checkhealth to see if your system is up-to-date
UBY QUICKSTART
To use Vim Ruby plugins with Nvim, just install the latest neovim RubyGem:
$ gem install neovim
RUBY PROVIDER CONFIGURATION
g:loaded_ruby_provider
To disable Ruby support:
let g:loaded_ruby_provider = 1
g:ruby_host_prog
Command to start the Ruby host. By default this is neovim-ruby-host. For users
who use per-project Ruby versions with tools like RVM or rbenv, setting this can
prevent the need to install the neovim gem in every project.
To use an absolute path (e.g. to an rbenv installation):
let g:ruby_host_prog = '~/.rbenv/versions/2.4.1/bin/neovim-ruby-host'
To use the RVM "system" Ruby installation:
let g:ruby_host_prog = 'rvm system do neovim-ruby-host'
==============================================================================
Clipboard integration provider-clipboard clipboard
vim has no direct connection to the system clipboard. Instead it depends on
a provider which transparently uses shell commands to communicate with the
system clipboard or any other clipboard "backend".
To ALWAYS use the clipboard for ALL operations (instead of interacting with
the '+' and/or '*' registers explicitly):
set clipboard+=unnamedplus
See 'clipboard' for details and options.
clipboard-tool
The presence of a working clipboard tool implicitly enables the '+' and '*'
registers. Nvim looks for these clipboard tools, in order of priority:
- g:clipboard
- pbcopy/pbpaste (macOS)
- xsel (if $DISPLAY is set)
- xclip (if $DISPLAY is set)
- lemonade (for SSH) https://github.com/pocke/lemonade
- doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
- win32yank (Windows)
- tmux (if $TMUX is set)
g:clipboard
To configure a custom clipboard tool, set g:clipboard to a dictionary:
let g:clipboard = {
\ 'name': 'myClipboard',
\ 'copy': {
\ '+': 'tmux load-buffer -',
\ '*': 'tmux load-buffer -',
\ },
\ 'paste': {
\ '+': 'tmux save-buffer -',
\ '*': 'tmux save-buffer -',
\ },
\ 'cache_enabled': 1,
\ }
If cache_enabled is TRUE then when a selection is copied, Nvim will cache
the selection until the copy command process dies. When pasting, if the copy
process has not died, the cached selection is applied.
==============================================================================
X11 selection mechanism clipboard-x11 x11-selection
X11 clipboard providers store text in "selections". Selections are owned by an
application, so when the application gets closed, the selection text is lost.
The contents of selections are held by the originating application (e.g., upon
a copy), and only passed to another application when that other application
requests them (e.g., upon a paste).
quoteplus quote+
There are three documented X11 selections: PRIMARY, SECONDARY, and CLIPBOARD.
CLIPBOARD is typically used in X11 applications for copy/paste operations
(Ctrl-c/v), while PRIMARY is used for the last selected text, which is
generally inserted with the middle mouse button.
Nvim's X11 clipboard providers only utilize the PRIMARY and CLIPBOARD
selections, used for the '*' and '+' registers, respectively.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment