Skip to content

Instantly share code, notes, and snippets.

@egisatoshi
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egisatoshi/450aa3d5d1c7d7d14e74 to your computer and use it in GitHub Desktop.
Save egisatoshi/450aa3d5d1c7d7d14e74 to your computer and use it in GitHub Desktop.
old wiki (内容が古くなったので移動)

Welcome to the egison wiki!

How to start Development

Checkout Egison

$ git clone https://github.com/egisatoshi/egison.git

It will create egison directory.

Setup VM environment

For now, we use this VM "haskell-eval" via vagrant 1.1. The VM needs about 6GB disk space. 8MB space will be enough.

# Vagrant box add would download 1GB file. After this, box config is added to ~/.vagrant.d/boxes
$ vagrant box add haskell-eval http://download.fpcomplete.com/haskell-eval-alpha-2013-01-29.box

$ cd (The path to top of your egison files)
$ vagrant init

Now, your egison directory should be like this.

hoge@fuga ~/dev/egison3 (takei-shg)
$ ls
LICENSE  README.md  Vagrantfile  benchmark  cabal-dev  dist  egison.cabal  elisp  hs-src  lib  sample  test

Check the Vagrantfile is in your directory.

Now start to install the VM.

# Start to create VM image. It will takes several minutes.
$ vagrant up

After the vagrant VM is ready, let's connect to the VM.

hoge@fuga ~/dev/egison3 (takei-shg)
$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)

 * Documentation:  https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Wed May  1 00:49:33 2013 from 10.0.2.2
vagrant@precise32:~$

Now, You are connecting the VM via ssh.

This VM has GHC 7.4.2 and some libraries from Stackage repository.
Unfortunately, cabal is not on the path, so let's set.

vagrant@precise32:~$ vi .bash_aliases

export PATH=$PATH:~/.cabal/bin/

vagrant@precise32:~$ . .bashrc
vagrant@precise32:~$ cabal update

Check that you can call cabal. I recommend not to update cabal-install itself.

Install Egison

The directory where the Vagrantfile exists is automatically mounted onto the Vagrant VM.
The path to the mounted directory is /vagrant

vagrant@precise32:~$ cd /vagrant
vagrant@precise32:/vagrant$ ls
benchmark  cabal-dev  dist  egison.cabal  elisp  hs-src  lib  LICENSE  README.md  sample  test  Vagrantfile

Now, let's build Egison!!

vagrant@precise32:~$ cabal install
vagrant@precise32:/vagrant$ find ~/.cabal/ -name "egison"
/home/vagrant/.cabal/bin/egison

Try Egison!!

vagrant@precise32:~$ cd /vagrant
vagrant@precise32:/vagrant$ egison sample/poker-hands.egi
<Straight-Flush>
<Flush>
<Full-House>
<Straight>
<Nothing>
Unbound variable: main

You can also execute Egison Interpreter.

vagrant@precise32:/vagrant$ egison
Egison Version 3.0.0 (C) 2011-2013 Satoshi Egi
http://egison.pira.jp
Welcome to Egison Interpreter!
>

Test Egison

First, you should install egison with --enable-tests option.

vagrant@precise32:/vagrant$ cabal install --enable-tests

Now you can execute cabal test.

vagrant@precise32:/vagrant$ cabal test

Take a Rest

When you leave the development of Egison, type this.

$ cd (The path to egison)
$ vagrant halt

This will shutdown your VM gracefully (doc).

When you want to delete the VM image, type this.

$ vagrant destroy

That's all. Enjoy!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment