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 89 forks source link

Fay.Convert doesn't check for newtypes #413

Open bergmark opened 10 years ago

bergmark commented 10 years ago
λ> showToFay (NewType 1)
Just (Object (fromList [("instance",String "NewType"),("slot1",Number 1.0)]))

The result should be Just (Number 1.0).

Currently we're using Data.Data for this and afaict it can't check for newtypes. GHC Generics can but only in >= 7.8. In the short term #412 provides a solution by removing the newtype optimizations so you'll be able to use that if you need to pass newtypes through the server side.

Another user workaround is to use a normal data type for types that are shared with the server side.

I think we need to wait a bit before dropping GHC 7.6 support, let me know if this is a hindrance for anyone.