PureScriptでHello world
関数型言語系の本山(と思ってる)Haskell を勉強したいけど、
折角勉強しても使い道を思いつかなかった時に PureScript を知る。
PureScript は Haskell -> Javascript のコンパイラ。
正しくは Haskell “風"らしいが、最終系は Haskell になるのだろ。
Mac 上で Hello world してみる。
まず Cabal をインストールする( Cabal は Haskell のパッケージシステム)。
ついでに実行環境用に node もインストール
brew install ghc cabal-install node
次に PureScript のインストール
psc --main=Main hello.purs > hello.js
もし psc と打ち込んでもTerminalが反応しなかったら以下のようにパスを通す。
export PATH="$HOME/.cabal/bin:$PATH"
Hello world を書く。ファイル名は hello.purs とする。
module Main where
import Debug.Trace
main = trace "Hello, PureScript!"
コンパイル
cabal update
cabal install purescript
実行
node hello.js
> Hello, PureScript!
参考:
PureScript::Getting Started
http://purescript.readthedocs.org/en/latest/start.html
PureScript::Hello, PureScript!
http://purescript.readthedocs.org/en/latest/intro.html#hello-purescript
Read other posts
日記
(11)
大晦日
(9)
読書メーター
(7)
impro
(6)
技術
(5)
Android
(2)
LMDE2
(2)
Linux
(2)
ORSC
(2)
RSGT
(2)
coaching
(2)
docker
(2)
写真
(2)
応用演劇
(2)
読書ノート
(2)
随想
(2)
Ansible
BLE
Bluetooth
Forum Theatre
GPU
INDIA
PostgreSQL
RSGT2016
Scrum Gathering
VISA
WFH
Windows 10
Windows 7
advent calendar
bash
blogger
book
coach
creative-process
docker registry
event
facilitation
feedback
git
goal
hello world
laos
laravel
linux mint
lmde2
microphone
phpunit
presentation
rsgt
rust
scrum
scrum fest osaka
serverside
speaker
sprint review
sqlite
sveltia-cms
trip
ubuntu16
vision
ゴール
デザイン思考
パターン・ランゲージ
ビジョン
ラオス
ラオ語
修理
創造プロセス
勉強会
演劇教育
課題解決