LoginSignup
5
6

More than 5 years have passed since last update.

MacOSXのAtomでOCaml環境設定

Last updated at Posted at 2017-02-10

brewでOCamlインストール

% brew install ocaml
  • OCaml起動確認
% ocaml
        OCaml version 4.04.0
# 
  • OCaml起動確認終了
# exit 0;;

文字化け回避

  • 文字化けする
# "アイウエオ";;
- : string = "\227\130\162\227\130\164\227\130\166\227\130\168\227\130\170"
  • .ocamlinit編集
~/.ocamlinit
let printer ppf = Format.fprintf ppf "\"%s\"";;
#install_printer printer

  • OCaml再起動
# "アイウエオ";;
- : string = "アイウエオ"

Opam

  • opam本体をインストール
% brew install opam
% opam --version
1.2.2
% opam init

Atom

  • opamでmerlin, ocp-indentインストール
opam install merlin
opam install ocp-indent
  • OCaml関連のpackageインストール
apm install language-ocaml linter ocaml-indent

  • 補完良いよ。
  • エラーもはいてくれる。

スクリーンショット 2017-02-10 19.14.01.png

OCamlインタプリンタでコマンドの履歴を残す

  • OCamlインタプリンタで.mlファイルを実行する時にhistoryを残るようにするためにrlwrapをインストール。
% brew install rlwrap
  • rlwrapから起動すると↓↑で過去に叩いたコマンドに移動できる。
% rlwrap ocaml
        OCaml version 4.04.0

# 

  • 毎回の事なので.zshrcでラップ。
alias ocaml='rlwrap ocaml'
5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6