Reputation: 43
I'm trying to wrap parts of the titanium api with PureScripts foreign function interface but I'm having trouble working out what the type definitions of the functions should be.
module Ti where
foreign import data Window :: *
foreign import window
""" function (config) {
return function () {
return Ti.UI.createWindow(config);
}
} """ :: ??? -> Window
foreign import open
""" function (window) {
return function () {
window.open();
return window;
}
} """ :: Window -> Window
main = do
w <- window ???
open w
Upvotes: 2
Views: 474
Reputation: 4169
You might consider using the Foreign
type from the purescript-foreign
library as the argument type, together with the purescript-options
library to construct the appropriate options object.
I've written a short guide to the purescript-options
library here, and there is another example in the project repository.
Upvotes: 2