Git Product home page Git Product logo

pyrescript's Introduction

PyreScript

It's a Python backend for PureScript!

Inspired by Purescript-to-Python.

Very Alpha software here!

Installation

You'll need stack.

After installing stack. You should be able to:

stack build

Usage

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 0.9.1.0

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:

output
└── Foo
    ├── externs.json
    └── __init__.py

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]: output.Foo.bar
Out[2]: True

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

In [4]: output.Foo.foo
Out[4]: 1

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

pyrescript's People

Contributors

joneshf avatar

Stargazers

Daniel Kahlenberg avatar  avatar weize avatar zaoqi avatar vtheno avatar Suyan avatar Taine Zhao avatar Tim Kersey avatar Anupam <|> अनुपम avatar Brandon Elam Barker avatar Sidharth avatar Conrad Steenberg avatar Tim Steenvoorden avatar shrynx avatar CHEN Xiaosong avatar Alex Holmes avatar Dom De Re avatar paluh avatar Fabian Beuke avatar  avatar  avatar  avatar P. Oscar Boykin avatar Daniel Pous Montardit avatar Karthik Ravikanti avatar Josh Miller avatar Victor Borja avatar Haromn avatar Alexander avatar Pascal Hartig avatar Raphael Gaschignard avatar YAMAMOTO Yuji avatar Alex Mingoia avatar Andrew Darqui avatar Taylor Fausak avatar  avatar John A. De Goes avatar Maciej avatar Felix Schlitter avatar Risto Stevcev avatar Jelle Herold avatar Gary Burgess avatar Sibelius Seraphini avatar Rick Elrod avatar Paul Young avatar Simon Richardson avatar

Watchers

James Cloos avatar  avatar Brandon Elam Barker avatar David Peter avatar  avatar

Forkers

epost

pyrescript's Issues

Support typeclasses and foreign modules

Working on this.

  • Return something that can be indexed using a.b syntax instead of a function application a(b)
  • Work out how to import .py file from same dir.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.