Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

every literal Double produces 'Not in scope: fromRational' #3

Closed
crooney opened this issue May 15, 2014 · 7 comments
Closed

every literal Double produces 'Not in scope: fromRational' #3

crooney opened this issue May 15, 2014 · 7 comments
Assignees
Labels

Comments

@crooney
Copy link
Owner

crooney commented May 15, 2014

Every Double literal in the examples produces the above error, w/ nothing further. I see in the Fay changelog that fromRational was taken out last week, but I'm unclear on why it affects doubles. I'll dig in further if noone knows offhand, but I'm hoping it's something trivial that one of you guys knows about before I wade in. Cheers.

@crooney crooney self-assigned this May 15, 2014
@bergmark
Copy link
Collaborator

I don't see this in the changelog, where does it say this?

Anyway, this is because of RebindableSyntax, from the GHC docs:

  • An integer literal 368 means "fromInteger (368::Integer)", rather than "Prelude.fromInteger (368::Integer)".
  • Fractional literals are handed in just the same way, except that the translation is fromRational (3.68::Rational).

We should export fromRational from Prelude, either it was removed by accident or it was never present.

@bergmark
Copy link
Collaborator

Oh I randomly found some more info about this: faylang/fay-base#21

@bergmark
Copy link
Collaborator

To clarify the comments I made there, I think you can work around this for now by defining

fromRational :: Fractional a => ??? -> a
fromRational = ffi "%1"

This is just a phony function that won't be called (unless you call it explicitly in which case it won't do what you expect ;) ). Hacky hack, but you can try it out. Can't think right now it seems so i don't know what ??? should be, you can probably trial and error it to work.

@crooney
Copy link
Owner Author

crooney commented May 15, 2014

Ok, thanks for the help; I will get on this shortly. The changelog I mentioned.

@crooney crooney closed this as completed May 15, 2014
@bergmark
Copy link
Collaborator

The only mention of fromRational i see there is for the server-side type transcoding, which has no relation to this, am I missing something?

@crooney
Copy link
Owner Author

crooney commented May 16, 2014

No, it's just that that was the only mention I saw; I should have looked in fay-base and not fay, but I'm stupid.

@bergmark
Copy link
Collaborator

Ok, no worries :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants