启动 Yi Editor 时“找不到模块‘Yi’”

“Could not find module ‘Yi’” when launching Yi Editor

我使用 Stack(全局设置)成功安装了 Yi Editor。

  • OS X El Capitan 10.11.5
  • Stack 1.1.0 (LTS 6.7)

我将以下配置文件放在 ~/.config/yi/yi.hs.

import Yi
main = putStrLn "It works."

然后我运行yi在“**error**”窗格中得到以下错误。

/Users/kakkun61/.config/yi/yi.hs:1:8:
    Could not find module ‘Yi’
    Use -v to see a list of the files searched for.

我该如何解决这个问题?易编辑在哪里找到图书馆?

P.S。 yi 没有 -v 选项。

$ yi -v
yi: unrecognized option `-v'

使用堆栈

这对我适用于堆栈:

$ git clone https://github.com/yi-editor/yi.git
$ cd yi
$ cabal get Hclip
...create a stack.yaml file...
$ stack build
$ stack exec yi

stack.yaml 文件包括:

resolver: lts-6.0
packages:
- '.'
- 'Hclip-3.0.0.4'

注意:在 stack build 我尝试 stack installstack exec yi 后停止工作 - 所以不要 运行 stack install.

使用 Cabal 沙箱

我能够使用 cabal 沙箱安装它:

$ git clone https://github.com/yi-editor/yi.git
$ cd yi
$ cabal sandbox init
$ cabal install --only-dependencies
$ cabal install
$ cabal exec yi

修改 yi.hs 也有效:

$ cp example-configs/yi-simple.hs ~/.config/yi/yi.hs
$ cabal exec yi

要设置脚本以便您可以从任何目录 运行 yi,请使用:

#!/bin/sh

YI_DIR=...
env CABAL_SANDBOX_CONFIG=$YI_DIR/cabal.sandbox.config cabal exec yi -- "$@"

此处 YI_DIR 是包含 cabal.sandbox.config 文件的目录。

请注意,这些说明与在以下位置找到的说明几乎相同:

http://yi-editor.github.io/pages/installing/#InstallinginsideaCabalsandbox

除了使用 cabal exec.

调用 yi 的方式

使用stack exec yi。如果你想给 Yi 添加选项,使用 stack exec -- yi --foo.

$ stack exec yi
Run from outside a project, using implicit global project config
Using resolver: lts-6.7 from implicit global project's config file: /Users/kakkun61/.stack/global-project/stack.yaml
Configuration '/Users/kakkun61/.config/yi/yi.hs' changed. Recompiling.
Program reconfiguration successful.
Launching custom binary /Users/kakkun61/.cache/yi/yi-darwin-x86_64

It works.