Python backend for Idris (generates Python source, not bytecode).
OTHER License
python -O
) and flattenedDExp
Field "gets" does not exist in object signature "Session"
Iterable Int is not mixed into signature "Response"
foreach
-- higher-order FFI :)pythag 100
from 5.5 secs to 3.5 secs, probably because of APPLY0
forkPIO
(example)Just x
compiles to x
, Nothing
compiles to None
None
Text
to represent generated code in the prettyprinterText
seems to be a bit slower than String
Text
seems to be about as fast as String
String
is the simplestFirst, the codegen:
$ stack build
Then, the library:
$ cd lib
$ stack exec idris -- --install python.ipkg
Some Python libraries for the example programs:
$ pip install requests bs4 numpy
Compile the example
$ cd examples/
$ stack exec idris -- example.idr -p python --codegen python -o example.py
First, the codegen:
$ cabal sandbox init --sandbox $IDRIS_PATH/.cabal-sandbox
$ cabal configure && cabal build
Then, the library:
$ cd lib
$ idris --install python.ipkg
Some Python libraries for the example programs:
$ pip install requests bs4 numpy
Finally, set up your path appropriately:
$ export PATH="$PATH:$IDRIS_PATH/.cabal-sandbox/bin/"
Compile the example
$ cd examples/
$ idris example.idr -p python --codegen python -o example.py
$ python example.py
Idris has got the following exciting features:
1. Full dependent types with dependent pattern matching
2. Simple foreign function interface (to C)
3. Compiler-supported interactive editing: the compiler helps you write code using the types
4. where clauses, with rule, simple case expressions, pattern matching let and lambda bindings
5. Dependent records with projection and update
6. Type classes
7. Type-driven overloading resolution
8. do notation and idiom brackets
9. Indentation significant syntax
10. Extensible syntax
11. Cumulative universes
12. Totality checking
13. Hugs style interactive environment
Total number of features: 13
thread A starting
thread B starting
thread A done
thread B done
thread A says 9121
thread B says 9121
And now, let's fail!
-> (1) everything's fine: [Errno 13] Permission denied: '/root/hello'
-> (2) everything's fine: [Errno 13] Permission denied: '/root/hello'
>>> import example
>>> example.greet()
Hello world!