joneshf/pyrescript
null
{ "createdAt": "2016-06-29T07:30:56Z", "defaultBranch": "master", "description": null, "fullName": "joneshf/pyrescript", "homepage": null, "language": "Haskell", "name": "pyrescript", "pushedAt": "2016-07-02T14:33:57Z", "stargazersCount": 46, "topics": [], "updatedAt": "2023-02-07T12:47:05Z", "url": "https://github.com/joneshf/pyrescript"}PyreScript
Section titled “PyreScript”It’s a Python backend for PureScript!
Inspired by [Purescript-to-Python][1].
Very Alpha software here!
Installation
Section titled “Installation”You’ll need [stack][2].
After installing [stack][2]. You should be able to:
stack buildAssuming 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 -> awat x _ = x
foo :: Intfoo = 1 + 2
bar :: Booleanbar = true
baz :: Booleanbaz = falseto a file like:
# Generated by pysc version 0.9.1.0
wat = lambda x: lambda v: xfoo = wat(1)(2)baz = Falsebar = 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__.pySo, you should be able to fire up a python interpreter and use the compiled file:
➜ pyrescript git:(master) ipythonPython 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.barOut[2] !: True
In [3] !: output.Foo.bazOut[3] !: False
In [4] !: output.Foo.fooOut[4] !: 1
In [5] !: output.Foo.wat([1,2,3])(None)Out[5] !: [1, 2, 3][1] !: https://github.com/Gabriel439/Purescript-to-Python [2] !: http://docs.haskellstack.org/en/stable/README/#how-to-install