-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
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 <*> bThen 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!
Metadata
Metadata
Assignees
Labels
No labels