Better error message on foreign export #77

Closed
rahulmutt opened this Issue Oct 16, 2016 · 5 comments

Comments

Projects
None yet
4 participants
@rahulmutt
Member

rahulmutt commented Oct 16, 2016

According to @NCrashed:

Just to note, the current implementation fails on the:

import Primes
import GHC.Base

foreign export java takePrime :: Int -> Java a Int

takePrime i = return . fromIntegral $ primes !! i

primes = filterPrime [2..]
where filterPrime (p:xs) =
p : filterPrime [x | x <- xs, x mod p /= 0]
With:

ghcvm: panic! (the 'impossible' happened)
(GHCVM version 0.0.1):
No type variables for the Java foreign export!

The panic should be replaced with a notice that you cannot have a quantified variable in the tag position of the Java monad for exports (yet). This should be done in GHCVM.TypeCheck.TcForeign.

@tibi77

This comment has been minimized.

Show comment
Hide comment
@tibi77

tibi77 Feb 28, 2018

Why can't it be done in compiler/ETA/Utils/Panic.hs just by changing the panic output or maybe by giving the sorry output instead[1]?
Or have i not understood the issue properly?

[1]"sorry! (unimplemented feature or known bug)\n"

tibi77 commented Feb 28, 2018

Why can't it be done in compiler/ETA/Utils/Panic.hs just by changing the panic output or maybe by giving the sorry output instead[1]?
Or have i not understood the issue properly?

[1]"sorry! (unimplemented feature or known bug)\n"

@rahulmutt

This comment has been minimized.

Show comment
Hide comment
@rahulmutt

rahulmutt Feb 28, 2018

Member

@tibi77 So the idea is to give a "human-readable" error that clearly states what mistake the programmer made and how they can fix it. I think you might have misunderstood it.

Member

rahulmutt commented Feb 28, 2018

@tibi77 So the idea is to give a "human-readable" error that clearly states what mistake the programmer made and how they can fix it. I think you might have misunderstood it.

@NickSeagull

This comment has been minimized.

Show comment
Hide comment
@NickSeagull

NickSeagull Mar 15, 2018

Collaborator

Did this get fixed in #341 ? 😄

Collaborator

NickSeagull commented Mar 15, 2018

Did this get fixed in #341 ? 😄

@jneira

This comment has been minimized.

Show comment
Hide comment
@jneira

jneira May 21, 2018

Collaborator

@rahulmutt yeah, it seems it can be closed

Collaborator

jneira commented May 21, 2018

@rahulmutt yeah, it seems it can be closed

@rahulmutt

This comment has been minimized.

Show comment
Hide comment
@rahulmutt

rahulmutt May 22, 2018

Member

Great, closing!

Member

rahulmutt commented May 22, 2018

Great, closing!

@rahulmutt rahulmutt closed this May 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment