Skip to content

Repository files navigation

inline-python

This is library which embeds python interpreter into haskell programs and allows calling python code from haskell and haskell from python seamlessly. This project is inspired by haskell-R. and tries to use similar conventions.

As an example take following program. It captures from environment variables with _hs suffix. This includes haskell functions.

{-# LANGUAGE QuasiQuotes #-}
importPython.InlineimportPython.Inline.QQmain::IO()
main = withPython $dolet input = [1..10] :: [Int]
let square ::Int->IOInt
square x =pure (x * x)
print=<< runPy $do
fromPy' @[Int] =<< [pye| [ square_hs(x) for x in input_hs ] |]

it would output:

[1,4,9,16,25,36,49,64,81,100]

About

Embedding of python interpreter into haskell programs

Resources

Stars

18 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages