The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

rvboyd (4) [Avatar] Offline
#1
(complete newbie to Elm !)

I need to dynamically add Markers to Google Maps for an Android Mobile App.
I see this link ... https://github.com/rtfeldman/elm-google-maps/issues/2 .... and it appears that it is not easy and/or straight forward.
I would like to see topics like this covered in your book.

=========================
Here are some topics of things I need, but am having trouble finding Elm info ...... so these may be suggestions for possible coverage in your book.

* Google Maps ... why can't I find any examples of displaying/interacting-with GIS Maps via Elm?
* Deployment ... ex: any special problems with hosting Elm ... for example, deploying to Digital Ocean?
*Background Images (not just embedded images as per Chapter 2) ... can they be dynamically added/changed?
*Layouts ... can Bootstrap layouts be used ... to change Grid Layout automatically for Mobile vs Tablet vs Desktop?
*Bootstrap ... it appears from http://package.elm-lang.org/packages/rundis/elm-bootstrap/latest that one cannot use resources like Bootstrap in a direct way ... need "mapping" between Elm and resources like Bootstrap ........... so some info on how to interface from Elm to a resource for which no package is yet available ...... I did a search of the MEAP PDF for "package" and did not see anything yet about building one ...
*Mobile ... example of producing an Android Mobile App
*JSON ... is decoding JSON difficult? ... as per this link https://medium.com/@eeue56/json-decoding-in-elm-is-still-difficult-cad2d1fb39ae#.evj4diqdm
*Clarification/Examples of what can be done with "Subscriptions" ... as per "A Farewell to FRP Making signals unnecessary with The Elm Architecture" ... http://elm-lang.org/blog/farewell-to-frp ....... could Ports/Subscriptions be used to communicate with Javascript/Google Map to add Markers and receive events (user Click/Selection)?

*EXAMPLES would be very helpful to give a newbie the assurance that, while he presently is focused on just learning the basics of Elm, there are not a lot of Elm deadends ahead ............ so while I see http://elm-lang.org/examples/ .......... I would really like to see something more substantial like https://developers.google.com/maps/documentation/javascript/examples/

Just "2 cents" from someone only in first chapter of your MEAP!
tempusfugit (144) [Avatar] Offline
#2
rvboyd wrote:Just "2 cents" from someone only in first chapter of your MEAP!
Just "2 cents" from an Elm neophyte after playing around with it for a bit.
I need to dynamically add Markers to Google Maps for an Android Mobile App.
I'm under the impression that this book focuses on "Elm in the Browser" - so I'd expect that any knowledge transfer to mobile app development is the reader's responsibility. Though highly experimental ventures can be found (Daily Drip).
I see this link ... https://github.com/rtfeldman/elm-google-maps/issues/2 .... and it appears that it is not easy and/or straight forward.
That issue could very well originate from the Google Maps web component itself (mapWrapper workaround). Wouldn't be the first time some people had problems with it.
I would really like to see something more substantial like https://developers.google.com/maps/documentation/javascript/examples/
After a quick scan of those examples I would expect that those usage scenarios could be utilized in Elm through general use of ports and subscriptions. Whenever you use a JavaScript library outside of Elm you are responsible for designing the "API" that your Elm app actually needs. The Elm Architecture (TEA) acts as an anti corruption layer (ACL) so you are typically going to have to provide some JavaScript glue code on the other side of that ACL and occasionally deal with Json.Decode and Json.Encode.
Clarification/Examples of what can be done with "Subscriptions" ... as per "A Farewell to FRP Making signals unnecessary with The Elm Architecture" ... http://elm-lang.org/blog/farewell-to-frp
Subscriptions are just the opposite to ports. Browser/JavaScript bound data leaves through ports, Elm app bound data (besides anything coming from the DOM) enters through subscriptions. Have a look at Figure 5.9 How Subscriptions fit into Elm programs on page 147(151) of v4. For a no-HTML (headless) example with just ports and subscriptions see Elm example of ports and subscriptions.
Sigh - if you've only ever done imperative programming before - then it will feel unfamiliar. Do yourself a favor and expose yourself to Rich Hickey's Talk Simple Made Easy. Judging things based on familiarity ("easy") vs. lack of familiarity ("difficult") is problematic. You become familiar with it by using it, so it's all about practice, practice, practice.
*Background Images (not just embedded images as per Chapter 2) ... can they be dynamically added/changed?
You have access to the Html.Attributes.class, Html.Attributes.classList and Html.Attributes.style functions so utilizing the background-image CSS property shouldn't be a problem. If you need to manipulate something on the ancestor body element, a port and some JavaScript glue code can help with that (though there may be a better way that I'm not aware of).
*Bootstrap ... it appears from http://package.elm-lang.org/packages/rundis/elm-bootstrap/latest that one cannot use resources like Bootstrap in a direct way ... need "mapping" between Elm and resources like Bootstrap
Again CSS based "anything" shouldn't be a problem - though I'd imagine that one would be using embedded (elm-make Main.elm --output elm.js) rather that fullscreen (elm-make Main.elm --output main.html) Elm. Granted Bootstrap is popular but it has its detractors and some suggest that even plain CSS should be used sparingly.
would be very helpful to give a newbie the assurance that, while he presently is focused on just learning the basics of Elm, there are not a lot of Elm deadends ahead
Elm is still very much in the phase where breaking changes happen in order to avoid "dead ends" and that can drive some people away (at least for the time being) - different situations have different needs and tolerances. Elm is still pre-1.0. For example Google went ahead with drastic divergences in Angular 2 despite numerous disgruntled 1.x adoptees - so I think looking for any type of "assurances" is largely futile.

It may be a good time to explore what attracted you to Elm in the first place.

Hope this helps somehow.
rvboyd (4) [Avatar] Offline
#3
Thanx for all the info in your response. I have a LOT of "learning" before I am confident that some of my questions even make sense! smilie

My questions arise from an application I have been working on ... which runs both as App in Mobile ... and in Browser. It deals with GIS and Weather. The GIS portion requires Google Maps + Markers + Interactivity. The Weather data comes down as XML ... which I was converting to JSON to process in Javascript. From your response, maybe I should just directly go from XML into Elm (duh!) ... and forget JSON. My question about Elm interfacing with libraries ... was because I also need to support Bluetooth ... and I did not find Bluetooth listed in the Elm Packages. I was curious what kind of issues I might be facing in order to build an "interface" from Elm to Bluetooth ... somewhat general guidelines/feedback from those who have done something similar in Elm.