For interop, I'm having trouble calling a purescript function from python. If I have:
just :: Int -> Maybe Int
just = Just
addMaybe :: Maybe Int -> Maybe Int -> Maybe Int
addMaybe a b = (+) <$> a <*> b
Then this works:
import foo.Main.pure as Main
print(Main.addMaybe(Main.just(1))(Main.just(2)))
This produces the wrong output (it yields nothing):
import foo.Main.pure as Main
import foo.Data.Maybe.pure as Maybe
Just = Maybe.Just
print(Main.addMaybe({'value0': 3, '.t': Just})({'value0': 3, '.t': Just}))
and this crashes.
import foo.Main.pure as Main
import foo.Data.Maybe.pure as Maybe
Just = Maybe.Just
print(Main.addMaybe(Just(1))(Just(2)))
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 the Nothing constructor directly somehow.
Thanks!
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
Justconstructor or theNothingconstructor directly somehow.Thanks!