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

Graphics.Input crashes if Text is not imported #203

Closed
TheSeamau5 opened this Issue Mar 24, 2015 · 10 comments

Comments

Projects
None yet
3 participants
@TheSeamau5
Contributor

TheSeamau5 commented Mar 24, 2015

Buttons from Graphics.Input do not work.

The following code :

import Graphics.Input (button)
import Signal (channel, send)

chan = channel ""

badButton =
  button (send chan "") "+"

causes the following error :

Cannot read property 'make' of undefined

Open the developer console for more details.

Note: this problem also exists in the latest commits.

@TheSeamau5

This comment has been minimized.

Show comment
Hide comment
@TheSeamau5

TheSeamau5 Mar 24, 2015

Contributor

Note: I encountered this problem as I tried to answer this thread on the mailing list: https://groups.google.com/forum/#!topic/elm-discuss/7aG8wS2jnBI

Kinda weird to try to explain the relationship between buttons and signals when buttons don't work.

Contributor

TheSeamau5 commented Mar 24, 2015

Note: I encountered this problem as I tried to answer this thread on the mailing list: https://groups.google.com/forum/#!topic/elm-discuss/7aG8wS2jnBI

Kinda weird to try to explain the relationship between buttons and signals when buttons don't work.

@TheSeamau5

This comment has been minimized.

Show comment
Hide comment
@TheSeamau5

TheSeamau5 Mar 24, 2015

Contributor

Actually, there's even a more minimal example of the bug:

import Graphics.Input (button)

badButton = button 
Contributor

TheSeamau5 commented Mar 24, 2015

Actually, there's even a more minimal example of the bug:

import Graphics.Input (button)

badButton = button 
@TheSeamau5

This comment has been minimized.

Show comment
Hide comment
@TheSeamau5

TheSeamau5 Mar 24, 2015

Contributor

This seems to be true of all functions in the Graphics.Input package.

import Graphics.Input 

badButton =  Graphics.Input.dropDown

yields the same error.

Contributor

TheSeamau5 commented Mar 24, 2015

This seems to be true of all functions in the Graphics.Input package.

import Graphics.Input 

badButton =  Graphics.Input.dropDown

yields the same error.

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Mar 24, 2015

Member

Thanks for the reports, if you want to take a swing at it that'd be great. I am relatively overloaded, so it is not feasible for me to address every issue that comes up immediately.

As an aside about mailing list / issue protocol, can you try to do more drafting and revising such that we don't get 3+ messages in a row that could have been one? Both here and on the mailing list it makes it much harder to follow the thread of conversation, you have to do a lot of summarizing in your mind that could have been done by the author. I mean no offense at all when I say this! I just think it makes things artificially difficult, and it'd be pretty easy for everyone to have a better situation.

Member

evancz commented Mar 24, 2015

Thanks for the reports, if you want to take a swing at it that'd be great. I am relatively overloaded, so it is not feasible for me to address every issue that comes up immediately.

As an aside about mailing list / issue protocol, can you try to do more drafting and revising such that we don't get 3+ messages in a row that could have been one? Both here and on the mailing list it makes it much harder to follow the thread of conversation, you have to do a lot of summarizing in your mind that could have been done by the author. I mean no offense at all when I say this! I just think it makes things artificially difficult, and it'd be pretty easy for everyone to have a better situation.

@TheSeamau5

This comment has been minimized.

Show comment
Hide comment
@TheSeamau5

TheSeamau5 Mar 24, 2015

Contributor

No offense taken. I'll try my best. Sometimes I write several messages in a row because I had several thoughts in a row spread across the day.

In this case, I just reported the error and didn't think I could find anything but then found a few more things along the way.

Now, that said, I found why this has happened:

The following code totally works.

import Text
import Graphics.Input (button)

okButton = button

This might be potentially an issue for elm-compiler. Basically, in the Native Javascript, Graphics.Input requires the use of Text but not in the Elm code. Well, there is an import Native.Text but I suspect it to be somewhat broken or something went wrong in the code generation.

If it is in fact the case that it's the compiler's fault, then this is beyond my expertise. Maybe I'll modify the import line to import Text instead of import Native.Text but that sounds like just patching one instance of a bug rather than solving a deeper problem.

Contributor

TheSeamau5 commented Mar 24, 2015

No offense taken. I'll try my best. Sometimes I write several messages in a row because I had several thoughts in a row spread across the day.

In this case, I just reported the error and didn't think I could find anything but then found a few more things along the way.

Now, that said, I found why this has happened:

The following code totally works.

import Text
import Graphics.Input (button)

okButton = button

This might be potentially an issue for elm-compiler. Basically, in the Native Javascript, Graphics.Input requires the use of Text but not in the Elm code. Well, there is an import Native.Text but I suspect it to be somewhat broken or something went wrong in the code generation.

If it is in fact the case that it's the compiler's fault, then this is beyond my expertise. Maybe I'll modify the import line to import Text instead of import Native.Text but that sounds like just patching one instance of a bug rather than solving a deeper problem.

@TheSeamau5 TheSeamau5 changed the title from Graphics.Input buttons do not work to Graphics.Input crashes if Text is not imported Mar 24, 2015

@TheSeamau5

This comment has been minimized.

Show comment
Hide comment
@TheSeamau5

TheSeamau5 Mar 24, 2015

Contributor

It seems that in the end there's already such an issue in elm-compiler. It seems to be a bug in elm-make. I'm thus closing the issue here and move the findings to elm-compiler.

Contributor

TheSeamau5 commented Mar 24, 2015

It seems that in the end there's already such an issue in elm-compiler. It seems to be a bug in elm-make. I'm thus closing the issue here and move the findings to elm-compiler.

@TheSeamau5 TheSeamau5 closed this Mar 24, 2015

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Mar 24, 2015

Member

I think @mgold fixed this bug in the latest version of core. Is there a closed issue about adding a Text import?

Member

evancz commented Mar 24, 2015

I think @mgold fixed this bug in the latest version of core. Is there a closed issue about adding a Text import?

@TheSeamau5

This comment has been minimized.

Show comment
Hide comment
@TheSeamau5

TheSeamau5 Mar 24, 2015

Contributor

Actually, I take that back, it's fixed. What I saw was a different bug o_0.

If you're interested, it's caused by the following code:

import Graphics.Input exposing (button)
import Port exposing (Port, message)

port num : Port Int

b = button (message num.address 0) ""

which yields :

Cannot read property 'arity' of undefined


Open the developer console for more details.
Contributor

TheSeamau5 commented Mar 24, 2015

Actually, I take that back, it's fixed. What I saw was a different bug o_0.

If you're interested, it's caused by the following code:

import Graphics.Input exposing (button)
import Port exposing (Port, message)

port num : Port Int

b = button (message num.address 0) ""

which yields :

Cannot read property 'arity' of undefined


Open the developer console for more details.
@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Mar 24, 2015

Member

Probably has to do with implementation changes happening in 0.15 so that looks like something we can find and fix.

Member

evancz commented Mar 24, 2015

Probably has to do with implementation changes happening in 0.15 so that looks like something we can find and fix.

@mgold

This comment has been minimized.

Show comment
Hide comment
@mgold

mgold Mar 24, 2015

Contributor

Seems right to me -- the import Text has been fixed but this arity stuff is new.

Contributor

mgold commented Mar 24, 2015

Seems right to me -- the import Text has been fixed but this arity stuff is new.

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