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

Follow Data.Text types for splitOn #446

Closed bneijt closed 7 years ago

bneijt commented 7 years ago

Data.Text.splitOn uses Text -> Text -> [Text], with Text as a first argument.

Follow that implementation.

bergmark commented 7 years ago

Sorry for the delay. This looks great, thanks! I'll make a release now.

bergmark commented 7 years ago

Shipped!

bneijt commented 7 years ago

Sorry to have to say this, but it seems the code I pushed is broken because Text seems to be represented as an array of characters. The code I presented won't work and a workaround is: ffi "%2.join(\"\").split(%1)"

Which might even be why the original author did not follow the Data.Text type signature.

Is there a good way to add unit tests to this kind of thing?

bergmark commented 7 years ago

I think you can just add these tests to the normal unit tests and then run the fay-tests executable.

But Text is represented as js strings, it's why the type exists. There may be some type conversion bugs lurking around that's causing this issue, I'm trying to recall the details....