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

Mapping over task sent out of port causes runtime error #368

Closed
mgold opened this Issue Aug 24, 2015 · 1 comment

Comments

Projects
None yet
3 participants
@mgold
Contributor

mgold commented Aug 24, 2015

This program

import Task exposing (Task)

port one : Task Int Int
port one = Task.succeed 3

port two : Task Int Int
port two = Task.map identity one

crashes with the message

Cannot read property 'tag' of undefined

Open the developer console for more details.

The problem appears if you (1) have a task sent out a port (2) which is mapped over by another task (3) which is itself sent out a port. If you remove the port keyword from either definition (on both lines), the error disappears.

The workaround is to only send the final task out a port, and this makes a lot of sense. It would be fairly easy to put a better runtime error into place. However, it's not obvious how to catch this at compile time.

@theor

This comment has been minimized.

Show comment
Hide comment
@theor

theor Dec 26, 2015

same problem here - a nicer error message at runtime, or even better, at compilation time would be better.

theor commented Dec 26, 2015

same problem here - a nicer error message at runtime, or even better, at compilation time would be better.

@evancz evancz closed this May 11, 2016

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