[elm-discuss] Re: Tour of an open-source 4,000 LoC Elm SPA

2017-05-08 Thread Erik Lott
A great many folks are going to be thankful for this SPA example... You are a saint good sir. On Monday, May 8, 2017 at 3:59:16 AM UTC-4, Richard Feldman wrote: > > I get asked if there are any sizeable open-source Elm SPA examples out > there...so I made one! > > Hope it's useful: https://dev.t

[elm-discuss] Re: File Uploads - as simple as I could manage

2017-05-07 Thread Erik Lott
You may want to see "file-reader" if you haven't seen it already: https://github.com/simonh1000/file-reader On Friday, May 5, 2017 at 1:32:46 PM UTC-4, Kasey Speakman wrote: > > After a bit of research on file uploads, I pared it down to the simplest > method I could find. Here is the recipe I ca

Re: [elm-discuss] New guidelines for posting on Elm-discuss

2017-05-07 Thread Erik Lott
Noah, a general code of conduct is a great idea, even if nothing other than to point at if a sensitive topic begins to get heated. Great job bud. I tend to have the same opinion of Slack (we use it in house). Slack is an indispensable collaboration tool, but it makes a less than perfect message

[elm-discuss] Re: Poll for Intermediate to Advanced topics that people struggle with

2017-05-02 Thread Erik Lott
For the folks who are struggling with authentication, are you having issues with authentication in general (elm, javascript, other), or is there an issue implementing authentication specifically in Elm? On Tuesday, May 2, 2017 at 10:10:03 AM UTC-4, Alan McCann wrote: > > I echo Peter Damoc's en

Re: [elm-discuss] Ports seem contrived when trying to format a value as money

2017-04-30 Thread Erik Lott
Noah is right. You don't want to reach for Native for this type of integration. If this can't be smoothly integrated with ports (we've all felt that pain), the next best option is to write the elements of the plug-in that you need in elm. On Sunday, April 30, 2017 at 1:37:04 PM UTC-4, Noah Hall

Re: [elm-discuss] Re: Moving on

2017-04-30 Thread Erik Lott
> > I'm going to call out the air of ungratefulness and animosity in this > thread. Evan is giving you software for free, and it's software that's good > enough that you invest your time into writing it and commenting about it. > You should not expect Elm to move at the same pace as Angular (b

Re: [elm-discuss] Re: Moving on

2017-04-26 Thread Erik Lott
> > Better javascript interop to allow the community to provide the missing > web APIs and effect managers (task ports have been mooted on several > occasions) I'd much rather have the web APIs available natively within Elm, so that javascript interops are minimal/unnecessary. On Wednesday,

Re: [elm-discuss] Re: Moving on

2017-04-25 Thread Erik Lott
> > Does anybody has an idea how other languages/platforms manage to get > community involved? The elm community will grow organically if it's given the chance. However, to have a thriving and exciting community, at a minimum, developers need to be able to actively write, contribute and share

[elm-discuss] Re: view function to call other view function with different Msg type

2017-04-24 Thread Erik Lott
Whoops. Html.map is correct... view : Model -> Html Msg view model = div [] (model.items |> List.map itemView |> List.map (Html.map ItemMsg) ) On Sunday, April 23, 2017 at 1:49:22 PM UTC-4, Max Goldstein wrote: > > Yes, Ian is correct. > > Html.At

[elm-discuss] Re: view function to call other view function with different Msg type

2017-04-22 Thread Erik Lott
view : Model -> Html Msg view model = div [] (model.items |> List.map itemView |> List.map (Html.Attributes.map ItemMsg) ) On Saturday, April 22, 2017 at 5:25:41 PM UTC-4, Vardhan wrote: > > [ Pardon if this appear twice ] > > hi, > this is my

Re: [elm-discuss] Re: Comments on the TEA Components package

2017-04-21 Thread Erik Lott
> > To recap: > >1. Earlier > I >said "between 0.16 and today, *we learned that a Model-View-Update >triplet is the wrong unit of composition for Elm applications...composing >individual functions* wa

[elm-discuss] Re: Scaling Elm

2017-04-19 Thread Erik Lott
Marek, about the tea-component package: If you're discouraged by the boilerplate for nested update and view functions, you can clean-up the boilerplate with a single function each... no need to create an entire abstraction package. On Wednesday, April 19, 2017 at 3:34:31 PM UTC-4, Marek Fajkus

[elm-discuss] Re: Scaling Elm

2017-04-19 Thread Erik Lott
Marek, One difference might be that we don't deal with sign-in in SPA itself. > We're using Html.programWithFlags and passing user info to elm on > embedding. Good stuff. Less work when you don't have to worry about auth states. On Wednesday, April 19, 2017 at 1:48:39 PM UTC-4, Marek Fajkus

[elm-discuss] Re: Scaling Elm

2017-04-19 Thread Erik Lott
) > 3) We split our larger pages into sections which function as separate mini > apps > > I've found myself thinking in terms of mini apps a lot lately. Each Page > and each page Section functions as a separate mini app, notably they don't > interact with each other

[elm-discuss] Re: Scaling Elm

2017-04-19 Thread Erik Lott
I'm a little pressed for time, but I'll try to give a general architecture outline that works really well for us. Our primary elm SPA is a customer facing administrative control panel that communicates with a backend api server and amazon S3. The app manages authentication, authorization, subsc

Re: [elm-discuss] Managing global state in Elm

2016-12-02 Thread Erik Lott
9:25:48 AM UTC-5, Birowsky wrote: > > The problem i see with this approach is that in hierarchy of deeply nested > components, the whole ancestry would need to know about the intention of > the leaf. I was hoping towards more of a command-like approach. > > > On Dec 2, 2016,

Re: [elm-discuss] Managing global state in Elm

2016-12-02 Thread Erik Lott
Birowsky, your leaf component will need return messages to the parent, and the parent can act on those messages to update it's state. There's no magic to it unfortunately. Do you have a specific problem you're trying to solve? On Wednesday, November 30, 2016 at 12:04:08 PM UTC-5, Birowsky wrote:

[elm-discuss] Re: How to use Navigation library

2016-11-26 Thread Erik Lott
that should say : Simon, I'm just glancing at this code, but this page *shouldn't* perform page refreshes at all. It should only fire UrlChange events without reload the browser. Am I missing something? On Saturday, November 26, 2016 at 5:59:56 PM UTC-5, Erik Lott wrote: > > T

[elm-discuss] Re: How to use Navigation library

2016-11-26 Thread Erik Lott
> > The aim is to get the navigation history ticking along properly without > page refreshes. Simon, I'm just glancing at this code, but this page should perform page refreshes at all. It should only fire UrlChange events without reload the browser. Am I missing something? On Saturday, Novem

[elm-discuss] Re: How to use Navigation library

2016-11-26 Thread Erik Lott
Wouter, in regards to that sequence of events, I would reduce sequence to the following question: What does my elm app do when the address bar is "/apples/234" ? If apple 234 exists, show the apple page. If apple 234 does not exist, show a "Not Found" page. IMHO if the user types the url "/app

[elm-discuss] Re: How to use Navigation library

2016-11-26 Thread Erik Lott
ng some kind of redirect command with > the confirmation from the server, and again here how would you prevent page > reloading?) > > On Friday, 25 November 2016 23:29:49 UTC+1, Erik Lott wrote: >> >> Is there any reason to favour one over the other, otherwise I'm l

[elm-discuss] Re: How to use Navigation library

2016-11-25 Thread Erik Lott
2016 at 11:22:01 AM UTC-5, Simon wrote: > > Erik, > that makes such a lot of sense. Thanks for spelling it out. Is there any > reason to favour one over the other, otherwise I'm likely to go with 2. > Simon > > On Friday, 25 November 2016 16:52:20 UTC+1, Erik Lott wro

[elm-discuss] Re: How to use Navigation library

2016-11-25 Thread Erik Lott
> > One of the main benefits of routing/navigation is that a user can bookmark > or send a URL to someone else, and the website loads up in the correct > state. Option number 1 seems like it would handle this case naturally. I'm > not sure how it would work for option number 2. The Elm-route-

[elm-discuss] Re: How to use Navigation library

2016-11-25 Thread Erik Lott
When you're creating an SPA in elm, you'll generally need to choose one of two navigation styles: *1. Allow the address bar to drive your model* The standard Navigation package provides this type of functionality. Your model will respond to changes in the address bar, and your views will (gener

Re: [elm-discuss] Structure for large Elm apps

2016-10-24 Thread Erik Lott
> > Above all of this, the other key subdivision we are making in our SPA and > that I would recommend having seen where other programmers often first > head, is having a top layer that handles overall app state — e.g., logged > in v not logged in — as a type union. This can also often be where

Re: [elm-discuss] Re: Inter-Component Communication in 0.17

2016-10-23 Thread Erik Lott
If you need to communicate between 2 or more enclosed pieces of functionality/modules, you'll need to orchestrate that communication via their parent. Like I said, I regret posting the original solution that I did, since it was essentially circumventing the elm language. You should try to stay

Re: [elm-discuss] Re: Inter-Component Communication in 0.17

2016-10-22 Thread Erik Lott
You're such a jerk Richard :) On Saturday, October 22, 2016 at 1:21:44 PM UTC-4, Richard Feldman wrote: > > Oh man, now I feel like a total jerk for my harsh tone. > > My apologies, and thank you for the update Erik! <3 > -- You received this message because you are subscribed to the Google Grou

Re: [elm-discuss] Re: Inter-Component Communication in 0.17

2016-10-22 Thread Erik Lott
Problem solved! Post deleted (thumbs up) On Saturday, October 22, 2016 at 10:50:38 AM UTC-4, Richard Feldman wrote: > > On Friday, July 15, 2016 at 9:49:41 PM UTC-7, Erik Lott wrote: >> >> Max, build a non-trival 15+ page SPA within a single elm component, and >&g

Re: [elm-discuss] Re: Inter-Component Communication in 0.17

2016-10-22 Thread Erik Lott
As the OP, I agree. Don't do this. We quickly abandoned this functionality after we wrote it. One of those posts I would I could remove... On Saturday, October 22, 2016 at 10:50:38 AM UTC-4, Richard Feldman wrote: > > On Friday, July 15, 2016 at 9:49:41 PM UTC-7, Erik Lott wrote

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-21 Thread Erik Lott
aging the returned outmsg in the top level, generate the Cmd from there. On Tuesday, September 20, 2016 at 9:30:12 AM UTC-4, Rupert Smith wrote: > > On Sunday, September 18, 2016 at 9:33:14 PM UTC+1, Erik Lott wrote: >> >> I'm not sure what the outmessage package is th

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-18 Thread Erik Lott
at examples of the update and view method returning useful messages. On Saturday, September 17, 2016 at 1:50:26 PM UTC-4, Rupert Smith wrote: > > On Saturday, September 17, 2016 at 2:01:54 AM UTC+1, Erik Lott wrote: >> >> No, our pages make their own HTTP requests from within the page,

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread Erik Lott
- that will involve sending an 'OutMsg' from your page's "update" function. Happy to explain further if anything is unclear. On Friday, September 16, 2016 at 6:17:24 PM UTC-4, Rupert Smith wrote: > > On Friday, September 16, 2016 at 6:07:42 PM UTC+1, Erik Lott wro

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread Erik Lott
Rupert, here is a high level overview of how we currently structure our elm SPAs: 1. Top layer: This layer manages routing, page changes, and page resource loading, and current user state 2. Page layer: These are individual pages - typically one page for each url. There may be deepe

Re: [elm-discuss] Re: elm-mdl and sub modules

2016-09-02 Thread Erik Lott
> wrote: > >> Can we have multiple of them? I didn't realise that! >> >> On Fri, Sep 2, 2016 at 11:35 PM Erik Lott > > wrote: >> >>> Mario, just keep a Material.Model in the model of each sub-page. >>> >>> >>> On Friday, S

[elm-discuss] Re: elm-mdl and sub modules

2016-09-02 Thread Erik Lott
Mario, just keep a Material.Model in the model of each sub-page. On Friday, September 2, 2016 at 6:18:55 PM UTC-4, Mario Sangiorgio wrote: > > Hello everybody, > > I've been experimenting for a while with elm. Previously I tried plain elm > and I found it very effective to have a module for each

Re: [elm-discuss] Re: Design of Large Elm apps

2016-09-01 Thread Erik Lott
n "client" and "server" since the latter would suggest > code running on another machine which while this separation enables that > possibility is not something that is happening here. I thought about > "viewModel" and "dataModel" but that see

[elm-discuss] Re: Design of Large Elm apps

2016-08-30 Thread Erik Lott
@JoshAdams has been kind enough to share a simple single level SPA example on another thread that might be of use to some folks arriving here. Here's what I've been working on. The recent git history is all about > refactoring. Haven't introduced 'sub-components with state' or w/e and > don't

Re: [elm-discuss] A more concrete question about API design

2016-08-30 Thread Erik Lott
> > As a newbie, I struggle to grasp whether I should tap into the Cmd module, > and if so, how to do that. If by "tap into the Cmd module" you mean messing around with the Native Cmd code, or creating your own effects manager, than no, don't reach for that - it's not necessary to solve your

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-30 Thread Erik Lott
> > @Erik Lott, did you mean: > view : Msg -> Msg -> Int -> Html Msg > Or did I miss something? Yeah, just a typo. Thanks for catching that. On Tuesday, August 30, 2016 at 5:27:06 AM UTC-4, Wouter In t Velt wrote: > > @Erik Lott, did you mean: > > vie

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-29 Thread Erik Lott
Wouter, looks good. Yeah, it's not a big deal if the counter is nested or not in this case. Just one thought - I'm not sure that the generic signature of the CounterView.view is useful here: view : msg -> msg -> Int -> Html msg Yes, keeping the signature generic allows you to avoid importing Ms

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-29 Thread Erik Lott
> > Here's what I've been working on. The recent git history is all about > refactoring. Haven't introduced 'sub-components with state' or w/e and > don't see it coming soon. It's an Elm-SPA with a Phoenix backend: > https://github.com/knewter/time-tracker Josh, make sure to share this exa

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-28 Thread Erik Lott
> > It's like I keep falling whenever I try to ride this new elm-bike. > And I keep hearing from others that they just get up and go and don't fall, > so I should also just go and don't fall, or be very specific at which > point in my process I fall off my bike. > (Sorry if the analogy is somewh

Re: [elm-discuss] Re: Design of Large Elm apps

2016-08-28 Thread Erik Lott
Mark, tell me about this code: type APICommand msg = AddForum (Error -> msg) (ForumID -> msg) String | DeleteForum (Error -> msg) (() -> msg) ForumID | PostMessage (Error -> msg) (() -> msg) ForumID String type APISubscription msg = ForumList (List (ForumID, String) -> msg) |

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-28 Thread Erik Lott
Folks, Elm scales just fine. We're at the tail-end of a large SPA front-end build in Elm... lots of complexity, and it's been wonderful. The counter examples, sortable table, and autocomplete are fine examples of how to modularize elm code. They don't lead you down the wrong path, nor do they d

[elm-discuss] Re: Collecting use cases for File, ArrayBuffer and TypedArrays/DataViews

2016-08-24 Thread Erik Lott
Our primary application allows photographers to upload hundreds/thousands of images for portfolio display. image delivery, etc. I guess you could say that our app is generally driven by image uploads. I would love to see this functionality provided by Elm, rather than having to use ports... On

[elm-discuss] Re: Task ports: A proposal to make it easier to integrate JS with Elm.

2016-08-23 Thread Erik Lott
based on concrete use cases not on waffly > hand-waving. I'll try and find time to write one up. > > > On Tuesday, August 23, 2016 at 11:56:06 PM UTC+10, Erik Lott wrote: >> >> Although I'd love to be able to use and compose port commands like tasks, >&

Re: [elm-discuss] Managing global state in Elm

2016-08-23 Thread Erik Lott
> > Does Elm have best practices for managing and reconciling state between > components and global application state managers? Yes: don't hold global state in your components' models :) It might help to think about this question differently. Going back to the OP's original question, let's fo

[elm-discuss] Re: Task ports: A proposal to make it easier to integrate JS with Elm.

2016-08-23 Thread Erik Lott
Although I'd love to be able to use and compose port commands like tasks, I'm not a big fan of this solution. regular ports only let you send data off or receive data back, not both. This is a good design decision. Ports isolate Elm from the underlaying language (javascript) and avoids creati

[elm-discuss] Re: We need a clearer story on architecture

2016-08-17 Thread Erik Lott
I feel like I just wrote you a vague response - something I try to avoid. If you have a specific question about how to build or structure something in Elm, don't hesitate to ask. On Wednesday, August 17, 2016 at 12:19:21 PM UTC-4, Oliver Searle-Barnes wrote: > > I've been using Elm for about 4

[elm-discuss] Re: We need a clearer story on architecture

2016-08-17 Thread Erik Lott
Oliver, we're currently migrating a large production SPA to Elm - 15+ pages non-trivial app, drag and drop interfaces, complex data display, integrating with multiple backends, etc. Not a toy. Components - the best advice I've heard is to extract view/model/update > separately, as we've seen wi

Re: [elm-discuss] Re: Design of Large Elm apps

2016-08-09 Thread Erik Lott
d add some context to your comments. On Tuesday, August 9, 2016 at 10:28:33 PM UTC-4, Richard Feldman wrote: > > Either. :) > > On Tue, Aug 9, 2016, 7:20 PM Erik Lott > > wrote: > >> Richard, just to clarify, when you say "pages", are you referring to >

[elm-discuss] Re: Design of Large Elm apps

2016-08-09 Thread Erik Lott
Richard, just to clarify, when you say "pages", are you referring to server side rendered pages that each contain an Elm app, or a large Elm single page app that handles routing internally? On Tuesday, August 9, 2016 at 7:54:24 PM UTC-4, Richard Feldman wrote: > > But passing the callback do

Re: [elm-discuss] Re: Inter-Component Communication in 0.17

2016-07-21 Thread Erik Lott
Data transfer object. Call it whatever you'd like :) It's the object that travels in and out through the port. On Thursday, July 21, 2016 at 6:59:46 PM UTC-4, Duane Johnson wrote: > > > On Thu, Jul 21, 2016 at 1:47 PM, Erik Lott > wrote: > >> type alias DTO = &g

Re: [elm-discuss] Re: Inter-Component Communication in 0.17

2016-07-21 Thread Erik Lott
;)])} > ``` > > Although I am using this style for a certain javascript callback library > that Elm does not support yet and not needed it to toss messages 'far' away > yet, and hope to not need to... > > > On Thursday, July 21, 2016 at 12:01:26 PM UTC-6, Erik Lott

Re: [elm-discuss] Re: Inter-Component Communication in 0.17

2016-07-21 Thread Erik Lott
Hey Aislan, Max's point of avoiding unnecessary components is a good one, but it depends on what scale of app/architecture you're talking about. When you're building building smaller types of UI components, it's a good rule to get you started. For example, let's say you want to build something

Re: [elm-discuss] Re: Inter-Component Communication in 0.17

2016-07-15 Thread Erik Lott
Max, build a non-trival 15+ page SPA within a single elm component, and tell me how that goes :) On Friday, July 15, 2016 at 8:08:23 PM UTC-4, Max Goldstein wrote: > > Allow me to suggest that this approach is *totally overkill*. It might not > be, but this is something Richard and I were discu

[elm-discuss] Re: Sending messages up the component tree in Elm 0.17

2016-07-13 Thread Erik Lott
Sandi, one way to manage component to component communication is to use ports and subscriptions: https://groups.google.com/d/msg/elm-discuss/i99LBvYSkpY/yQyk6WB0AAAJ Hope that helps. On Thursday, July 7, 2016 at 1:50:41 PM UTC-4, Sandi Dušić wrote: > > In Elm 0.16 the Architecture tutorial had o

Re: [elm-discuss] Bubbling Http Errors from Nested Components

2016-07-12 Thread Erik Lott
, Erik Lott wrote: > > No, that's clear Alex. Thanks for taking the time to write that out. This > is a great pattern. It accomplishes what I mentioned above, yet in a > cleaner way. > > When I see something like this, I'm surprised how versatile union types >

[elm-discuss] Inter-Component Communication in 0.17

2016-07-12 Thread Erik Lott
As a quick note to anyone struggling with how to perform app wide inter-component communication in elm 0.17 (e.g. anyone building a non-trivial SPA), here is one simple way to setup pubsub style communication using Elm Ports and Subscriptions. In this example, ChildOne will broadcast a message

Re: [elm-discuss] Bubbling Http Errors from Nested Components

2016-07-07 Thread Erik Lott
Failed err -> ... > Internal Something -> ... > Internal AnotherThing -> ... > Internal ChildMsg subMsg -> > let > (newModel, cmd) = Child.update subMsg model.child > in > { model | child = newModel } ! [ Cm

Re: [elm-discuss] Bubbling Http Errors from Nested Components

2016-07-07 Thread Erik Lott
handle tasks that didn't need > to be routed back to the originator and that could be used to send messages > to the top-level (or elsewhere). That said, once one gets into replacing > Cmd, the API request model makes a lot of sense. > > Mark > > On Jul 5, 2016, at 5:4

Re: [elm-discuss] Re: Bubbling Http Errors from Nested Components

2016-07-07 Thread Erik Lott
Mark: That's lead me to think about but not yet write a command alternative that > could also handle tasks that didn't need to be routed back to the > originator and that could be used to send messages to the top-level (or > elsewhere). I think you've nailed it. The suggested ELM architecture

[elm-discuss] Re: Bubbling Http Errors from Nested Components

2016-07-06 Thread Erik Lott
Yeah, the cookie is acting like a global var, which makes me cringe as much as you... On Wednesday, July 6, 2016 at 2:50:40 PM UTC-4, Josh Adams wrote: > > What we need is a simple way to communicate these events from the API >> module to the root of the application. What if we use an external

Re: [elm-discuss] Re: Authentication & Session Management

2016-07-06 Thread Erik Lott
del", > you'll call "ChildComponent.update context msg model" > > Does that help? > > > On Wed, Jul 6, 2016 at 2:57 PM Erik Lott > > wrote: > >> Can you explain how this works? >> >> >> >> >> On Wednesday, July 6, 2

[elm-discuss] Re: Authentication & Session Management

2016-07-06 Thread Erik Lott
wUrl command from the updateUrl function (used by > Navigation). > > urlUpdate : Context -> Navigation.Location -> ( Model, Cmd a ) > > and the rest of the update functions: > > update : Context -> a -> Model -> ( Model, Cmd a ) > > On Wednesday, July 6, 2016

[elm-discuss] Re: Bubbling Http Errors from Nested Components

2016-07-06 Thread Erik Lott
ifferently. >> Would love to hear any suggestions from more experienced folks re: this :) >> >> -Josh >> http://www.dailydrip.com/topics/elm >> >> On Tuesday, July 5, 2016 at 7:46:16 AM UTC-5, Erik Lott wrote: >>> >>> My app has several layers

[elm-discuss] Authentication & Session Management

2016-07-06 Thread Erik Lott
*Is there an idiomatic/proven way to approach Authentication in an Elm single page app?* Sadly, there are very few resources online that touch on authentication, yet it's an unavoidable part of SPA development. It would be great if this discussion could serve as the best answer to this question.

Re: [elm-discuss] Re: Bubbling Http Errors from Nested Components

2016-07-06 Thread Erik Lott
Josh, The code snippet you wrote is just the standard architecture. This is what I would expect.. But, if I'm understanding your previous messages correctly, it sounds like you're suggesting that nested components should "message" (such as with OutMsg in the brian hicks article you recommende

Re: [elm-discuss] Re: Bubbling Http Errors from Nested Components

2016-07-06 Thread Erik Lott
Max, yeah I understand the Req structure, but I'm not sure what it benefit it would provide with the 401 issue that I'm facing yeah. Here's the original thread by the way: https://groups.google.com/forum/#!searchin/elm-discuss/authentication/elm-discuss/j-Wa6NGiYUM/mDqWXywXAwAJ I think this ent

Re: [elm-discuss] Re: Bubbling Http Errors from Nested Components

2016-07-05 Thread Erik Lott
Josh, let's say I have components nested 3 levels deep: MainComponent, which contains AdminComponent, which contains 3 components [ApplesComponent, OrangesComponent, and BananasComponent] Each of the 3 child-most components need to load their respective resource (apples, oranges, and bananas),

Re: [elm-discuss] Re: Bubbling Http Errors from Nested Components

2016-07-05 Thread Erik Lott
Josh, won't you experience either message or function explosion doing direct communication like that? Let's say I have components nested 3 levels deep: MainComponent, which contains AdminComponent, which contains 3 components [ApplesComponent, OrangesComponent, and BananasComponent] Each of th

Re: [elm-discuss] Re: Bubbling Http Errors from Nested Components

2016-07-05 Thread Erik Lott
Josh, I took a moment and read those articles. They're both a great, but they're only discussing communication between direct parent and child components. This type of interaction is fairly easy to model. I want to understand what you're saying because it seems I'm missing something. Let's sa

Re: [elm-discuss] Bubbling Http Errors from Nested Components

2016-07-05 Thread Erik Lott
; to be routed back to the originator and that could be used to send messages > to the top-level (or elsewhere). That said, once one gets into replacing > Cmd, the API request model makes a lot of sense. > > Mark > > On Jul 5, 2016, at 5:46 AM, Erik Lott > > wrote: >

Re: [elm-discuss] Re: Bubbling Http Errors from Nested Components

2016-07-05 Thread Erik Lott
Thanks for getting back Josh. But I'm still wondering a few things: Anywhere I was currently wishing to call the API from the child, I would > instead signify to the root that I would like to take an equivalent action > and be notified of the outcome. Can you give me an example of this in El

[elm-discuss] Re: Bubbling Http Errors from Nested Components

2016-07-05 Thread Erik Lott
; Would love to hear any suggestions from more experienced folks re: this :) > > -Josh > http://www.dailydrip.com/topics/elm > > On Tuesday, July 5, 2016 at 7:46:16 AM UTC-5, Erik Lott wrote: >> >> My app has several layers of nested components. Various components >&g

[elm-discuss] Bubbling Http Errors from Nested Components

2016-07-05 Thread Erik Lott
My app has several layers of nested components. Various components throughout the tree will need to interact with our API via http requests. If any API request returns a 401 - Not Authorized error, or a Timeout Error, the error needs to bubble up to the root component where is can be handled ap

[elm-discuss] Re: Multiple Union Types vs Multiple Functions

2016-07-04 Thread Erik Lott
Thanks for the feedback Max. I'm new to Elm, so I wasn't entirely sure what you meant by Opaque Union Types, until I came across a previous thread where you clearly explain what they are, and why they're useful: https://groups.google.com/d/msg/elm-discuss/0XbEEb4hkjM/fP2iAjbNBgAJ That thread wa

[elm-discuss] Multiple Union Types vs Multiple Functions

2016-07-03 Thread Erik Lott
In Elm (or functional languages in general), is it preferable to show intent using union types or functions? See the code below for an example of what I mean. Forgive the sudo/incomplete code *Multiple Union Types & One Case Statement* In this example, the "Req" union types are used to com