New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documenting how to construct algebraic datatypes from python #35
Comments
for data C = Ctor Int Int to create Ctor: def new(t): return {'.t': t}
Ctor(1, new(Ctor)) Ctor.create(1)(2) Sorry for late reply! |
for enums, like nothing = Nothing.value |
Thanks! I tried this, but it looks like the problem still persists: -- snippet from Main.purs
addM :: Maybe Int -> Maybe Int -> Maybe Int
addM a b = (+) <$> a <*> b # testMain.py
import pspy.Main.pure as Main
import pspy.Data.Maybe.pure as Maybe
print(Maybe.Just.create(1))
print(Main.addM(Maybe.Just.create(1))(Maybe.Just.create(2))) yields {'value0': 1, '.t': <function ps_Just at 0x7f19302ea710>}
{'.t': <function ps_Nothing at 0x7f1930349b90>} Thanks in advance for your help! |
thautwarm
added a commit
to purescript-python/purescripto
that referenced
this issue
Aug 10, 2020
Sorry, purescripto 0.8.9 didn't release. Now |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For interop, I'm having trouble calling a purescript function from python. If I have:
Then this works:
This produces the wrong output (it yields nothing):
and this crashes.
The first solution is of course fine, but it requires more boilerplate, and I'm assuming it must be possible to use the
Just
constructor or theNothing
constructor directly somehow.Thanks!
The text was updated successfully, but these errors were encountered: