stackoverflow / pure-clj

A small strongly typed language that compiles to Clojure http://purescript.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pure-clj (Purescript Clojure backend)

A small strongly typed programming language with expressive types that compiles to JavaScript Clojure, written in and inspired by Haskell.

This is not a fork of the compiler, but a different compiler that translates purescript corefn output to Clojure.

The pure-clj organisation hosts ports of some core libraries.

To use it, it is recommended to use psc-package and the pure-clj package sets.

Usage

Install purescript and have purs on your path.

Install pure-clj from this repository, compile it and put it on your path (as pursclj).

Install psc-package.

Install leiningen then:

lein new pure-clj `project-name`

This will create a new pure-clj project. Change the set in the psc-package.json file to the latest clj set in the repo.

Now you can use lein pursclj to compile your Purescript project to Clojure and lein testp to run tests (configurable in the project.clj).

Types

Purescript type Clojure/Java type Notes
Int long 64 bits Java long
Boolean boolean
String String
Array clojure.lang.PersistentVector Compiles to Clojure's persistent vectors
Records clojure.lang.PersistentArrayMap Compiles to Clojure's persistent maps
Tagged Union Clojure defrecord
Newtype as underlying type
Functions Clojure functions curried foo a b = ... -> (def foo (fn [a] (fn [b] ...)))

FFI

Instead of .js files, foreign files should be valid Clojure (.clj) files and should be placed together with the original .purs file.

About

A small strongly typed language that compiles to Clojure http://purescript.org

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 99.7%Language:Clojure 0.3%