darklang / tablecloth

A standard library with the same API in F#, Rescript and OCaml

Home Page:https://www.tablecloth.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tablecloth-bucklescript@0.0.7 fails to build String.toList with bs-platform-8.3.1 for

TristanCacqueray opened this issue · comments

It seems like the published version of tablecloth-bucklescript is failing to build with this error:

$ yarn add tablecloth-bucklescript
$ cat yarn.lock
bs-platform@^8.2.0:
  version "8.3.1"
  resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-8.3.1.tgz#49ac0d7b84bcec190a7361353557cae965f92c67"
  integrity sha512-U7nKEGF1BfvODzcv1g2loeltE8YRCgX8mMlCojImsgI0HwfQKEq7ggO5dF1ae9ZfFxiLaI0069ZyoK5GLBO2OQ==

tablecloth-bucklescript@^0.0.7:
  version "0.0.7"
  resolved "https://registry.yarnpkg.com/tablecloth-bucklescript/-/tablecloth-bucklescript-0.0.7.tgz#635f66b773900cac4ee8287a8d2b21a294b7f038"
  integrity sha512-LR509lBXGDZcunx74BxdP5AgmeGpNPe4VKbH7edADjHor7hLa1MNFy5EbuL5HgrI893sGxTpBwlQq7nKJ0O9Fg==

$ bsb -make-world -w
Different compiler version: clean current repo
Cleaning... 13 files.
bsb: [8/8] src/tablecloth.cmj
FAILED: src/tablecloth.cmj

  We've found a bug for you!
  ./node_modules/tablecloth-bucklescript/src/tablecloth.ml:1244:5-74

  1242 ┆
  1243 ┆ let toList (s : string) : char list =
  1244 ┆   s |> Js.String.castToArrayLike |> Js.Array.from |> Belt.List.fromArray
  1245 ┆
  1246 ┆

  This has type: Js.String.t Belt.List.t (defined as Js.String.t list)
  Somewhere wanted: char list

  The incompatible parts:
    Js.String.t (defined as string) vs char

According to the master version, it seems like this is missing a map Char.fromString characterString before the final fromArray.

Sorry about that, we need to release a new version.

Quickfix for those looking for a temporary solution is to use any Bucklescript version before 8.3, e.g. latest 8.2:

  "devDependencies": {
    "bs-platform": "~8.2"
  },

This is probably fixed in version 0.0.8-1 which I just published.

However, we're only supporting latest versions of rescript in the future 0.1.0 - if this is still an issue please report it and we'll fix it.