I often feel the same. The "just use ports" argument frustrates me when ports, unlike tasks, just don't compose. Eg a hypothetical
readSessionFromLocalStorage `Task.andThen` makeAPIRequest Function which, because local storage isn't available in Task form (Yet) turns into a 2 stage thing in an update method. If I want to use some custom JS API client to make an http request I hit the same wall because I need to remove it from my nicely composed chain of tasks and pollute my update function with port related back and forth. Ports and Subs are, however, more like channels than one off events, and so as they stand they simply can't compose in the same way as tasks. What I'd like is something more like a plugin style approach, where on the JS side I can write a function that returns a Promise and hook that into Elm (eg set Elm.Main.tasks.mytask to be that function), and then on the Elm side I can use that as a task (maybe by declaring 'task mytask : String -> Result String SomeOutput'). This would make it far easier to embed JavaScript snippets into Elm in a,composable way than ports when you don't want an open one way communication channel. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.