faylang / fay

A proper subset of Haskell that compiles to JavaScript
https://github.com/faylang/fay/wiki
BSD 3-Clause "New" or "Revised" License
1.29k stars 86 forks source link

Support for TypeScript #450

Closed junjihashimoto closed 6 years ago

junjihashimoto commented 6 years ago

Hi,

This PR supports generating a TypeScript file instead of JavaScript's one. TypeScript is usefull for checking ffi-description. It finds runtime-bugs of "fay-base/src/Data/Time.hs" and "src/Prelude.hs".

And current implementation makes unreachable codes like below.

hogehoge = function () {
  return 1;
  throw "unhandled case" ..;
}

deleteAfterReturn-function deletes above statements after return.

bergmark commented 6 years ago

This looks really cool, thanks!

I'll try to take a look during the weekend,

Cheers

junjihashimoto commented 6 years ago

I'm looking forward to your review.

bergmark commented 6 years ago

And oh, we should run these tests on travis, see .travis.yml. So we need to make sure tsc is available there as well, do you know what the best way to do that is?

The travis job seemed to be broken unrelated to this change, I'm looking into it on the travis branch.

junjihashimoto commented 6 years ago

Thank you for your kind review.

junjihashimoto commented 6 years ago

https://travis-ci.org/faylang/fay/jobs/347073163 node.js is too slow.

junjihashimoto commented 6 years ago

I think not node.js but AUFS is too slow. https://docs.travis-ci.com/user/reference/overview/

junjihashimoto commented 6 years ago

Hi, @bergmark san.

I think my work is done. And any comments are welcome. For example, this PR needs git-squash or version bump.

bergmark commented 6 years ago

Great work! No squashing or version bumps needed, I'll try to make a hackage release tonight.

junjihashimoto commented 6 years ago

Thx!

bergmark commented 6 years ago

Here's the release: https://hackage.haskell.org/package/fay-0.24.0.0