paf31 / purescript-thermite

A simple PureScript wrapper for React
MIT License
350 stars 55 forks source link

Can't run the example #109

Closed DoctorRyner closed 4 years ago

DoctorRyner commented 4 years ago

For example this

import Prelude

import Effect (Effect)
import React as R
import React.DOM as R
import React.DOM.Props as RP
import ReactDOM as RDOM
import Thermite (defaultPerformAction, defaultRender)
import Thermite as T
import Thermite.DOM (defaultMain)

type Model = { counter :: Int }

initialState :: Model
initialState = { counter: 0 }

spec ::forall props event. T.Spec Model props event
spec = T.Spec {performAction: defaultPerformAction, render: defaultRender}

main :: Effect Unit
main = defaultMain spec (const initialState) "MyComponent" {}

Gives me something like:

No type class instance was found for\n\n    Prim.Row.Union t0\n                   t4\n                   ()\n\n  The instance head contains unknown type variables. Consider adding a type annotation.\n\nwhile applying a function defaultMain\n  of type ReactPropFields t0 t1 => Spec (Record t2)\n                                     { children :: Children\n                                     | t0\n                                     }\n                                     t3\n                                   -> ({ children :: Children\n                                       | t0\n                                       }\n                                       -> Record t2\n                                      )\n                                      -> String -> ... -> ...\n  to argument spec\nwhile inferring the type of defaultMain spec\nin value declaration main\n\nwhere t3 is an unknown type\n      t1 is an unknown type\n      t0 is an unknown type\n      t2 is an unknown type\n      t4 is an unknown type\n"

And something like this happens when I try any example from readme

athanclark commented 4 years ago

Thanks @DoctorRyner, sorry for neglecting this - I'll get a new version re-issued hopefully by tomorrow; things are just a bit busy for me at the moment. Sorry again!

DoctorRyner commented 4 years ago

Ok. So, I'm sorry but is there any progress?

athanclark commented 4 years ago

Duplicate of #104

Sorry for the delay; the README has been updated. The issue is due to how purescript-react solves a typeclass relating it's props argument when using createElement. The README in the github repo is updated, but the pursuit documentation will have to wait until another version is iterated. I hope this helps!