Calling existing JS function with Haste and passing in a record datatype

34 views
Skip to first unread message

Philipp Meier

unread,
Sep 29, 2015, 9:53:43 AM9/29/15
to haste-compiler
Hi guys!

Sorry for this question but I am still a complete Haskell and Haste beginner.
So im trying to call a JS function I have and pass in a Record as a parameter.
As I understand Haste should be able to transform the Record into a JS object right?

Anyway you'll find the code here: http://pastebin.com/cJeuApH7

Sadly it doesn't work, I get the error:

    No instance for (ToAny Figure) arising from a use of `ffi'
    In the expression: ffi "(function(x) {renderGame(x); return 5;})"
    In an equation for `render':
        render = ffi "(function(x) {renderGame(x); return 5;})"


Hope someone can help :)

Philipp Meier

unread,
Sep 29, 2015, 3:44:43 PM9/29/15
to haste-compiler
Figured it out.

The solution was to have all the datatypes deriving from Generic. Also declare an empty instance ToAny for every datatype. (instance ToAny GameBoard)
Reply all
Reply to author
Forward
0 new messages