staltz/flux-challenge

Can't build Elm solution

Closed this issue · 2 comments

I tried building @mattjbray's elm solution and got this:

I cannot find find module 'Http'.

Module 'Main' is trying to import it.

I then ran elm-package install evancz/elm-http which added evancz/elm-http 3.0.0 to the elm-package.json file.

Running elm-make again gave me Cannot find variable Http.getWithAbort..

I searched the elm-http repo, all tags, for this method, nothing showed up on the sources. I thought maybe I hadded the wrong package and googled "http.getwithabort", only this repo showed up.

Maybe I'm doing something stupid, this is like the third example elm app I try to build. I'm going to the countryside with no internet and I thought I'd get some elm stuff building to be able to study them.

Yes, getWithAbort is a custom function that you won't find anywhere else.

The spec for flux-challenge requires us to abort some XHRs, which the official elm-http package does not currently support.

The work-around is to use my fork of elm-http, where I've hacked in a getWithAbort function.

Quick Fix

Do the following to reset any changes in your local directory:

rm -rf submissions/mattjbray/elm-stuff
git checkout -- submissions/mattjbray/elm-package.json

Then follow steps 2-4 of the Elm submission README.

More detail

If you follow those steps you'll end up with my forked elm-http library in submissions/mattjbray/elm-http. elm-make will know where to look for the Http module because I've added this directory to elm-package.json: https://github.com/staltz/flux-challenge/blob/master/submissions/mattjbray/elm-package.json#L8

Here's the function signature for getWithAbort, if you're trying to follow the code: https://github.com/mattjbray/elm-http/blob/f6a5bf8ce10f9869ec45b275b4bfe3ad8b668475/src/Http.elm#L388

If you run into anything else that doesn't make sense, just ping me!

Works perfectly =]