No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
joneshf Hack in defs
Really it would be better to generate the proper AST originally.
Since this is mostly an experiment library, I don't care though :P.
Latest commit ea797e4 Jul 2, 2016
Failed to load latest commit information.
src Hack in defs Jul 2, 2016
.gitignore Initial commit Jun 29, 2016
LICENSE Initial commit Jun 29, 2016 Show directory structure and one way to use it Jun 29, 2016
Setup.hs Initial commit Jun 29, 2016
pyrescript.cabal Rename executable to `pysc` Jun 29, 2016
stack.yaml Initial commit Jun 29, 2016


It's a Python backend for PureScript!

Inspired by Purescript-to-Python.

Very Alpha software here!


You'll need stack.

After installing stack. You should be able to:

stack build


Assuming all went well you can start compiling files.

stack exec pysc <FILE>

Not much to currently see, but it will compile a simple file like:

module Foo where

infixl 4 wat as +

wat :: forall a b. a -> b -> a
wat x _ =  x

foo :: Int
foo = 1 + 2

bar :: Boolean
bar = true

baz :: Boolean
baz = false

to a file like:

# Generated by pysc version

wat = lambda x:     lambda v:         x
foo = wat(1)(2)
baz = False
bar = True
__all__ = [ "bar", "baz", "foo", "wat" ]

Based on that output, there's clearly lots of work to actually be done :).

The file structure looks like:

└── Foo
    ├── externs.json

So, you should be able to fire up a python interpreter and use the compiled file:

➜  pyrescript git:(master) ipython
Python 3.5.1 (default, Mar  3 2016, 09:29:07)
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import output.Foo

In [2]:
Out[2]: True

In [3]: output.Foo.baz
Out[3]: False

In [4]:
Out[4]: 1

In [5]: output.Foo.wat([1,2,3])(None)
Out[5]: [1, 2, 3]