OvermindDL1 / bucklescript-tea

TEA for Bucklescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tea_html2 style strange signature

j-hotlink opened this issue · comments

In tea_html,

style : string -> string -> 'a Vdom.property

but in tea_html2.Attributes,

style : 'a Vdom.properties -> string -> 'a Vdom.t

Is the html2 signature an error (or if not what is the correct usage)?

Thanks.

They are pointing to two different things. The tea_html one is a property accessor, and the tea_html2 one is the style element. Generally only html or html2 should be used, not both, they correspond to different versions of the elm API and html2 was contributed by a PR. It might be best to just match the 'modern' elm API again since 0.19 came out, which would be a breaking change if we deprecate these, but considering the moving target that Elm is... >.>

Or could even make an html3... ^.^;

Maybe this should be left as a todo to deprecate html and html2 and replace it with just an updated html for when Elm 0.20 comes out (soonish?). Thoughts?

yeah - I was trying to stick with html2 exclusively when I hit this issue.

The function causing the problem is Tea.Html2.Attributes.style not Tea.Html2.style.

It's type seems too low level and it's unclear how to use it, eg:

Elm 0.19
style : String -> String -> Attribute msg

tea_html.ml
Tea.Html.style : string -> string -> 'a Vdom.property

tea_html2.ml
Tea.Html2.Attributes.class' : string -> 'a Vdom.property
Tea.Html2.Attributes.style : 'a Vdom.properties -> string -> 'a Vdom.t ???

As a workaround I've had to use the Tea.Html.style tag (all others use html2), but it doesn't feel good.

Uncertain about the api versioning approach, but given that elm releases are so far apart (years sometimes) I guess simple filenames are ok to start (html1, html2, ..) - but it's unlikely to support the richer package ecosystem if that starts migrating. I think git might work better, since Elm core packages (like html) tend to be upgraded at the same time as the compiler making branched releases or tagged snapshots reasonable.

Given the main adopters are likely to be frustrated elm users (like me), I think a good goal is to make the transition as easy as possible for those people, by having the master branch closely match the current state of elm (which is what most people will expect to try out). A lot of litter might detract from clarity.

BTW: I ditched Elm a week ago, and I've found the switch to bs and bucklescript-tea a huge joy - of course thanks to the advantages of ocaml and bs, but also because bucklescript-tea 👍 is so open and made it really easy with few surprises.

Oh wait, it's in the Attributes module? Okay that is wrong yep. ^.^;

I'll fix that now!

Oh I see what they did! They are referencing the higher call instead of the VDom call, easy fix... and done, 0.11.0 released. :-)

but also because bucklescript-tea +1 is so open and made it really easy with few surprises.

I'm happy to hear that, I built it to port my own Elm apps but I've even been using it for 'new' projects lately too. ^.^;

Someone built an Elm->bucklescript-tea converter just recently actually! I expect them to PR links into the Readme soon, it looks pretty awesome. :-)

And yeah, I think I will update to the latest Elm API on the next major update and toss out the old versions, it's not a hard transition for people to move over and the compiler pretty much tells you where, so it should work well. :-)