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

Skip to first unread message

Philipp Meier

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:

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

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
0 new messages