Re: [elm-discuss] Re: The Elm Discourse is Ready

2017-12-11 Thread Dustin Farris
Does that happen often?

> On Dec 11, 2017, at 8:45 AM, Brian Hicks  wrote:
> 
> They had some downtime last night but it is back up now.
> 
> -- 
> 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.

-- 
Dustin Farris



-- 
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.


Re: [elm-discuss] Re: The Elm Discourse is Ready

2017-12-10 Thread Dustin Farris
This isn’t loading for me.



Sent from my iPhone

> On Dec 4, 2017, at 11:29 PM, Herdi Bintang  wrote:
> 
> How to report problem? I can't login or signup using Google account.
> 
>> On Friday, December 1, 2017 at 10:30:15 PM UTC+7, Brian Hicks wrote:
>> Hey all,
>> 
>> The Elm Discourse is now live at https://discourse.elm-lang.org. Hosting has 
>> been graciously provided by discourse.org. You can log in with your existing 
>> Google or GitHub accounts, or an email and password of your choice.
>> 
>> As I mentioned earlier this week, we intend to replace Google Groups with 
>> Discourse if everything shakes out OK. There are more details on the site: 
>> https://discourse.elm-lang.org/t/transition-plan-from-google-groups/20/3. To 
>> summarize: we'd appreciate if you could take new threads to Discourse so we 
>> can give it a solid run. We will likely not be able to migrate existing 
>> discussions, but we will retain this list in read-only mode so that existing 
>> discussions will not be lost. We hope existing discussions can continue and 
>> finish up over here so that those threads are not separated and hard to join 
>> later.
>> 
>> We're going to try an experiment around discussion categories. Right now, we 
>> have these:
>> 
>> 1. Learn
>> 2. Request Feedback
>> 3. Show and Tell
>> 
>> The idea is to select your intention for writing the post and things should 
>> sort themselves out automatically. People get what they need, and we all 
>> communicate in a healthy way. There's a thread on the forum where we hashed 
>> out the design decisions for these categories. If you get stuck on which 
>> category a post belongs in, feel free to contact me privately however makes 
>> sense to you and I'll help you out. :)
>> 
>> Thanks, and see you there.
>> Brian
>> 
>> P.S. It's completely possible to maintain an email-only interface if you are 
>> so inclined. Once you sign up, go to your settings (click your picture in 
>> the top right, then the gear icon.) From there, select "Emails" and then 
>> "Enable mailing list mode." That said, the web interface is much nicer than 
>> it is here; give it a try.
> 
> -- 
> 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.

-- 
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.


Re: [elm-discuss] Approval Queue and Moderation Slowdowns

2017-11-29 Thread Dustin Farris
The new discussions thing on GitHub looks pretty cool.  Unsure if it works over 
email but I would think it does.


https://github.com/blog/2471-introducing-team-discussions


Sent from my iPhone

> On Nov 29, 2017, at 3:06 PM, Brian Hicks  wrote:
> 
> Hey folks!
> 
> I've had a few messages about disappearing emails here over the last month. 
> Sorry about that! I know it's super frustrating to spend time on a quality 
> post only to have it disappear for hours or days. Often this means that we 
> haven't got around to approving messages, but Google Groups has also been 
> dropping them! This isn't great, and we can do better!
> 
> We've been hobbling along approving every message and poster manually since 
> the huge wave of Italian spam a couple years ago, but we need to move away 
> from these manual processes so we can make a good experience for people 
> discussing things here! Because of these things, we are currently looking for 
> a replacement for Google Groups for elm-discuss. The current candidate is 
> Discourse, which will still let people post and interact via email if you 
> prefer, but has a much more approachable web interface, does not require a 
> Google account, and has better (and more visible) moderation tools.
> 
> In the meantime, and TL;DR: I'm taking responsibility to approve posts to 
> elm-discuss until we can figure out a solution to this problem. If your 
> non-spam post to elm-discuss is rejected, I will tell you why. Please don't 
> try to re-send a modified version, since we will have a hard time knowing 
> what you actually wanted to post. If your message disappears into the void 
> and you don't hear anything, please contact me directly either here or on 
> Slack.
> 
> Brian Hicks
> -- 
> 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.

-- 
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.


Re: [elm-discuss] What build system do you prefer for Elm?

2017-10-31 Thread Dustin Farris
I’ve been using broccoli for 8 months now and very happy.

Here’s a plugin I made for elm: 
https://github.com/dustinfarris/broccoli-elm-make 


If you end up trying it I’d love your feedback!

> On Oct 31, 2017, at 10:18 AM, 'Rupert Smith' via Elm Discuss 
>  wrote:
> 
> I've been using grunt up until now. Looking into webpack at the moment as a 
> few github projects I've been looking at use it.
> 
> Anyone got any thoughts on the advantages/disadvantages of the various 
> possibility wrt Elm?
> 
> -- 
> 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 
> .

-- 
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.


[elm-discuss] Keybase elmlang team

2017-10-18 Thread Dustin Farris
Did someone here reserve it?  I tried to and it was taken.


-- 
Dustin Farris



-- 
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.


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

2017-05-04 Thread Dustin Farris
LGTM —

One thing that trips me up is deciding where to post what.

Slack/Reddit/elm-discuss/elm-dev are all super helpful (and Twitter sometimes), 
but I hit decision fatigue trying to decide which medium to reach for on a 
case-by-case basis—I suspect I'm not the only one.

The community page <http://elm-lang.org/community> briefly describes the 
options, but doesn't really emphasize any one over the other.

There is some direction in a recent post 
<https://groups.google.com/d/msg/elm-discuss/rg3fzdyG_VU/mBPkYxobFAAJ> from 
Evan suggesting that we use Reddit more.  What is the general mood on that?

IMO — if there was stronger up-front guidance/clarity on this I think it would 
be helpful for me and other newcomers.

Dustin



> On May 4, 2017, at 3:33 PM, Noah Hall  wrote:
> 
> Hi folks,
> 
> We've come up with some new rules for posting on elm-discuss. You can see 
> them here 
> <https://github.com/elm-community/discussions/blob/master/elm-discuss.md>. 
> The goal is to have a healthier, happier mailing list, with more people 
> feeling like they want to take part.
> 
> -- 
> 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 
> <mailto:elm-discuss+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
Dustin Farris



-- 
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.


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

2017-04-30 Thread Dustin Farris
Also, have you seen elm-plot?

https://terezka.github.io/elm-plot/

I haven't played with it yet, but it looks pretty neat.  Might help with some 
of your features that used highcharts?

Dustin


Sent from my iPhone

> On Apr 30, 2017, at 8:10 PM, Dwayne Crooks  wrote:
> 
> I posted here as the other thread seems to be closed off from replies.
> 
> For this particular app I'm writing/porting the SPA from scratch to Elm and 
> the formatting issue was the first small hiccup I ran into. As suggested in 
> the other thread I went ahead and wrote the code I needed in Elm.
> 
> Here it is in case anyone else is interested:
> 
>> module Format exposing (asMoney)
>> 
>> asMoney : Float -> String
>> asMoney value =
>> let
>> totalCents = round (value * 100)
>> dollars = totalCents // 100
>> cents = totalCents % 100
>> in
>> "$" ++ (groupBy 3 ',' dollars) ++ "." ++ (zeroPad 2 cents)
>> 
>> groupBy : Int -> Char -> Int -> String
>> groupBy per sep n =
>> let
>> pow10 = 10 ^ per
>> in
>> if n < pow10 then
>> toString n
>> else
>> zeroPad 3 (n % pow10)
>> |> String.cons sep
>> |> String.append (groupBy per sep <| n // pow10)
>> 
>> zeroPad : Int -> Int -> String
>> zeroPad k n = String.padLeft k '0' (toString n)
> 
> P.S. Dustin, I decided to write one for myself. But thanks.
> 
> My next task is to draw some charts using Highcharts. I expect ports would be 
> the approach here so I'm crossing my fingers and hoping it all works out. I 
> certainly won't want to be re-writing parts of Highcharts at this point.
> -- 
> 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.

-- 
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.


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

2017-04-30 Thread Dustin Farris
Ah, your version is way better!Love the groupBy function. 😄  Cheers! 

Dustin

Sent from my iPhone

> On Apr 30, 2017, at 8:10 PM, Dwayne Crooks  wrote:
> 
> I posted here as the other thread seems to be closed off from replies.
> 
> For this particular app I'm writing/porting the SPA from scratch to Elm and 
> the formatting issue was the first small hiccup I ran into. As suggested in 
> the other thread I went ahead and wrote the code I needed in Elm.
> 
> Here it is in case anyone else is interested:
> 
>> module Format exposing (asMoney)
>> 
>> asMoney : Float -> String
>> asMoney value =
>> let
>> totalCents = round (value * 100)
>> dollars = totalCents // 100
>> cents = totalCents % 100
>> in
>> "$" ++ (groupBy 3 ',' dollars) ++ "." ++ (zeroPad 2 cents)
>> 
>> groupBy : Int -> Char -> Int -> String
>> groupBy per sep n =
>> let
>> pow10 = 10 ^ per
>> in
>> if n < pow10 then
>> toString n
>> else
>> zeroPad 3 (n % pow10)
>> |> String.cons sep
>> |> String.append (groupBy per sep <| n // pow10)
>> 
>> zeroPad : Int -> Int -> String
>> zeroPad k n = String.padLeft k '0' (toString n)
> 
> P.S. Dustin, I decided to write one for myself. But thanks.
> 
> My next task is to draw some charts using Highcharts. I expect ports would be 
> the approach here so I'm crossing my fingers and hoping it all works out. I 
> certainly won't want to be re-writing parts of Highcharts at this point.
> -- 
> 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.

-- 
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.


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

2017-04-30 Thread Dustin Farris
Hi Dwayne,

I'm not sure how complex your currency formatting needs are.  But I think 
you should be able to do a lot of this yourself in Elm—especially if all 
you're looking for is commas and dollar signs.

I threw together an Ellie app to get you started.

https://ellie-app.com/34vgDLqvmd6a1/1

Would something like that help you?

Dustin

On Saturday, April 29, 2017 at 8:26:05 AM UTC-4, Dwayne Crooks wrote:
>
> I'm porting an application from React/Redux to Elm and I'm having trouble 
> figuring out how to format a value as money. In the original application we 
> used http://openexchangerates.github.io/accounting.js/. So naturally I 
> wanted to make use of that same library when writing the Elm version. Based 
> on my reading ports seem to be the solution however when I think through 
> the implications it doesn't seem natural to write my code in that way when 
> formatting is a presentation concern.
>
> Here's what I came up with:
>
> 1. I created a port module called Format.
>
> port module Format exposing (..)
>>
>> port asMoney : Float -> Cmd msg
>> port moneyFormats : (String -> msg) -> Sub msg
>
>
> 2. I originally envisioned writing the view as follows:
>
> viewSales : Float -> Html Msg
>> viewSales amount =
>> viewWidget "Gross Sales (All Time)" (Format.asMoney amount)
>
>
> But obviously, that's out the window since Format.asMoney returns a 
> command.
>
> 3. It means I now have to format in my update function and store the 
> formatted data in my model so that my view can access it. I find that very 
> inconvenient and I don't want presentation concerns in neither my update 
> function nor my model.
>
> Am I thinking through this correctly?
>
> How do I proceed?
>
> Should I consider writing an external library with a Native module like 
> for e.g. https://github.com/NoRedInk/elm-moment or 
> https://github.com/evancz/elm-graphics?
>
> Any help would be greatly appreciated.
>

-- 
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.


[elm-discuss] Re: Discovery: Model /= Database

2017-04-29 Thread Dustin Farris
I think I've just had an aha moment with this post.

I am in the process of refactoring my monolith MUV into separate modules 
with their own MUV for each "page" of my SPA.  Up to this point, I have had 
a separate Store module with its own Model and Msg types and an update 
function (no view, obviously).  This has worked well up until now, but 
after splitting off the pages of my app, it is getting more cumbersome to 
update the Store in a way that looks nice.

e.g. in my Main.elm I'm ending up with something like

update msg model =
case msg of
UserProfilePageMsg msg_ ->
let
( userProfilePageModel, userProfilePageCmd ) =
UserProfilePage.update msg_ model.userProfilePage
in
case msg_ of
UserProfilePage.StoreMsg msg__ ->
let
( storeModel, storeCmd ) =
Store.update msg__ model.store
in
{ model
| userProfilePage = userProfilePageModel
, store = storeModel
}
! [ Cmd.map UserProfilePageMsg 
userProfilePageCmd
  , Cmd.map StoreMsg storeCmd
  ]
_ ->
{ model | userProfilePage = userProfilePageModel }
! [ Cmd.map UserProfilePageMsg 
userProfilePageCmd ]


and so on for every page that invokes Store.Msg—which is most pages.

I am thinking that there is a better way, and perhaps Kasey's suggestion of 
forgoing an in-memory Store on the Model might be it.  I'm still not sure—I 
do like the snappy feel of a page loading instantly if the data is in 
memory—even if it might change after a brief consultation with the server.

Dustin


On Wednesday, April 19, 2017 at 7:28:06 PM UTC-4, Kasey Speakman wrote:
>
> I'm probably slow, but in recent months I've discovered that trying to use 
> Elm's Model like a database or cache (as I have previously seen suggested) 
> has turned out to be pretty painful for me. An example database-minded 
> model where a section could display *either* a list of employees *or* a 
> list of courses.
>
> type alias Model =
> { employees : List Employee
> , courses : List Course
> , loadingError : Maybe Http.Error
> , route : MyRoute -- employee or course
> }
>
> The problem this runs into is having to worry about state management. I 
> have to remember to "reset" or "turn off" things when they are not active. 
> As my application grew, I had a lot of problems that boiled down to tedious 
> state management details. My cached data didn't turn out to be all that 
> useful because I usually had to reload it anyway, in case something changed.
>
> Instead, I have been moving toward the model only representing the current 
> state of my UI. The big difference here is the model representing the 
> current *visual* elements and their data. This leads more to using union 
> types to represent parts of the UI. When you switch to a different case of 
> the union type, the data from the previous case is *dropped on the floor*. 
> This leaves nothing to remember to "reset". RemoteData is a good 
> micro-example of this. If there was an error fetching the data, when the 
> user requests the data again, you switch back to Loading, the error message 
> is dropped on the floor. No forgetting to hide it.
>
> type RemoteData e a
> = NotAsked
> | Loading
> | Failure e
> | Success a
>
> If it is really important to cache the data, I prefer to keep that as a 
> persistence concern, not on Model. It can be part of the process for 
> retrieving the data to first check my chosen cache before making a request 
> for fresh data. For instance, first check local storage before making an 
> HTTP call. (Currently, this scenario is easier with Native modules for lack 
> of Local Storage API or being able to wait on port subscriptions. But it's 
> still doable.)
>
> So working towards a Model reflecting the visuals on the page has been an 
> interesting challenge. I'm not claiming it's easier, but so far I've found 
> it avoids a class of problems, and has led to some interesting discoveries 
> in my own apps. One small example: I realized that my LoggedIn and 
> NotLoggedIn routes should actually be separate "apps". Attempts to model 
> this in a SPA fashion with the LoggedIn and NotLoggedIn routes as siblings 
> always came up with the conundrum: how do I make it a compiler error for 
> the model to be in LoggedIn mode but I receive a NotLoggedIn message, or 
> vice versa? Even using TEA, I could not avoid this situation. Then I 
> realized the only way to do that would be as separate apps. And that it was 
> entirely possible to separate them. My "login page" turned out to be an 
> entire

Re: [elm-discuss] Re: Moving on

2017-04-25 Thread Dustin Farris
has weighed heavily on me is the feeling that I'm 
> not a participant in the decision-making or priority-setting. I feel more 
> like a distant user, or maybe an interesting use case, from which data is 
> gathered and decisions are made (by someone else, somewhere else).
> 
> I hope that helps!
> 
> Thanks again for your reaching out. I really look up to you and eeue56.
> 
> Take care,
> Duane
> 
> On Monday, April 24, 2017 at 4:31:08 PM UTC-6, Joe Andaverde wrote:
> Duane,
> 
> I'm curious what the roadblocks were in the 2 of 3 you didn't have success 
> with? This could definitely help others when making their decision. Also, it 
> may provide helpful feedback to more appropriately prioritize future elm 
> platform development.
> 
> Thanks!
> 
> On Monday, April 24, 2017 at 8:45:57 AM UTC-5, Duane Johnson wrote:
> Hi all,
> 
> I've decided to move on from Elm. I've only been successful in 1 of 3 
> projects. I'm now in a role where I need to make an important decision 
> regarding the transition of a codebase from Angular to something else, and I 
> don't feel like I can responsibly recommend Elm as the replacement. So I need 
> to focus my time and effort elsewhere.
> 
> If someone could please remove me as a moderator of elm-discuss it would be 
> appreciated.
> 
> If anyone is interested in taking the `canadaduane/typed-svg` project over, 
> I'd be happy to help transition it to willing hands.
> 
> Thanks,
> Duane Johnson
> aka canadaduane
> 
> 
> -- 
> 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...@googlegroups.com <>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> -- 
> 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 
> <mailto:elm-discuss+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
Dustin Farris



-- 
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.


Re: [elm-discuss] Unexpected parse error for reasonable code (Bug in parser?)

2017-04-22 Thread Dustin Farris
This is because the syntax for record updates does not allow you to update 
nested records like what you are attempting.

This is part of an ongoing discussion.  There is a thread where you can post 
your specific scenario: 
https://groups.google.com/forum/#!searchin/elm-discuss/record%7Csort:relevance/elm-discuss/oWfARte8DJU/6eUvmL-jAwAJ
 
<https://groups.google.com/forum/#!searchin/elm-discuss/record|sort:relevance/elm-discuss/oWfARte8DJU/6eUvmL-jAwAJ>

Dustin


> On Apr 21, 2017, at 5:33 PM, Dwayne Crooks  wrote:
> 
> Hi,
> 
> I got the following syntax error:
> 
> I ran into something unexpected when parsing your code!
> 62| { Rating.defaultViewConfig | readOnly = model.readOnly }
>   ^
> I am looking for one of the following things:
> a closing bracket '}'
> a lower case name
> whitespace
> 
> for the following snippet of code:
> 
> view : Model -> Html Msg
> view model =
> let
> ratingViewConfig =
> { Rating.defaultViewConfig | readOnly = model.readOnly }
> in
> div []
> [ Html.map SetRatingState <|
> Rating.view ratingViewConfig model.ratingState
> , label []
> [ input
> [ type_ "checkbox"
> , checked model.readOnly
> , onClick ToggleReadOnly
> ]
> []
> , text "read only"
> ]
> ]
> 
> If however I write the following:
> 
> let
> defaultViewConfig = Rating.defaultViewConfig
> ratingViewConfig =
> { defaultViewConfig | readOnly = model.readOnly }
> in 
> ...
> 
> Then everything works fine. Is this a bug in the parser?
> 
> -- 
> 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 
> <mailto:elm-discuss+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
Dustin Farris



-- 
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.


Re: [elm-discuss] updating records syntax

2017-04-22 Thread Dustin Farris
There is ongoing discussion around this.  You might consider posting your 
specific scenario here: 
https://groups.google.com/forum/#!searchin/elm-discuss/record%7Csort:relevance/elm-discuss/oWfARte8DJU/6eUvmL-jAwAJ
 
<https://groups.google.com/forum/#!searchin/elm-discuss/record|sort:relevance/elm-discuss/oWfARte8DJU/6eUvmL-jAwAJ>

Dustin

> On Apr 20, 2017, at 5:34 AM, Samuel Walladge  wrote:
> 
> I'm new to elm, and was experimenting with updating records today. Noticed 
> something that seemed a bit strange - the elm compiler doesn't accept 
> updating a record where you specify the record you want to update with `{ 
> myRecord.myNestedRecord | ... }` (syntax error).
> 
> I've attached an example file displaying this behaviour. `example5` and 
> `example6` don't compile. What I'm wondering is, should they compile based on 
> the elm language specification? And, for example 5, when you want to update a 
> nested record, is that nested syntax a good way to go about it, or is there a 
> neater way?
> 
> For reference, this is the error I get when compiling:
> 
> -- SYNTAX PROBLEM - 
> Test.elm
> 
> I ran into something unexpected when parsing your code!
> 
> 24| example6 = { myRecord.user | name = "John" }
>  ^
> I am looking for one of the following things:
> 
>  "'"
>  "|"
>  an equals sign '='
>  more letters in this name
>  whitespace
> 
> Detected errors in 1 module.
> 
> 
> Thanks.
> 
> 
> -- 
> 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 
> <mailto:elm-discuss+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 

-- 
Dustin Farris



-- 
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.


[elm-discuss] Re: Discovery: Model /= Database

2017-04-22 Thread Dustin Farris
Interesting approach to just cache things in local storage and use the 
Model as a view "state" only.

I keep a nice store in my Model, but I think a key difference is that I'm 
using websockets to update information automatically.  Each route (page) 
has a list of channels that it cares about, and when data comes in on those 
channels, the store is updated.

WRT your issue on authenticated routes, my approach was to write a function 
that checks the model for a Maybe String which is the JWT token.  If it was 
Nothing, I'd send a Cmd to navigate to the login page.  It has worked well 
so far.


On Wednesday, April 19, 2017 at 7:28:06 PM UTC-4, Kasey Speakman wrote:
>
> I'm probably slow, but in recent months I've discovered that trying to use 
> Elm's Model like a database or cache (as I have previously seen suggested) 
> has turned out to be pretty painful for me. An example database-minded 
> model where a section could display *either* a list of employees *or* a 
> list of courses.
>
> type alias Model =
> { employees : List Employee
> , courses : List Course
> , loadingError : Maybe Http.Error
> , route : MyRoute -- employee or course
> }
>
> The problem this runs into is having to worry about state management. I 
> have to remember to "reset" or "turn off" things when they are not active. 
> As my application grew, I had a lot of problems that boiled down to tedious 
> state management details. My cached data didn't turn out to be all that 
> useful because I usually had to reload it anyway, in case something changed.
>
> Instead, I have been moving toward the model only representing the current 
> state of my UI. The big difference here is the model representing the 
> current *visual* elements and their data. This leads more to using union 
> types to represent parts of the UI. When you switch to a different case of 
> the union type, the data from the previous case is *dropped on the floor*. 
> This leaves nothing to remember to "reset". RemoteData is a good 
> micro-example of this. If there was an error fetching the data, when the 
> user requests the data again, you switch back to Loading, the error message 
> is dropped on the floor. No forgetting to hide it.
>
> type RemoteData e a
> = NotAsked
> | Loading
> | Failure e
> | Success a
>
> If it is really important to cache the data, I prefer to keep that as a 
> persistence concern, not on Model. It can be part of the process for 
> retrieving the data to first check my chosen cache before making a request 
> for fresh data. For instance, first check local storage before making an 
> HTTP call. (Currently, this scenario is easier with Native modules for lack 
> of Local Storage API or being able to wait on port subscriptions. But it's 
> still doable.)
>
> So working towards a Model reflecting the visuals on the page has been an 
> interesting challenge. I'm not claiming it's easier, but so far I've found 
> it avoids a class of problems, and has led to some interesting discoveries 
> in my own apps. One small example: I realized that my LoggedIn and 
> NotLoggedIn routes should actually be separate "apps". Attempts to model 
> this in a SPA fashion with the LoggedIn and NotLoggedIn routes as siblings 
> always came up with the conundrum: how do I make it a compiler error for 
> the model to be in LoggedIn mode but I receive a NotLoggedIn message, or 
> vice versa? Even using TEA, I could not avoid this situation. Then I 
> realized the only way to do that would be as separate apps. And that it was 
> entirely possible to separate them. My "login page" turned out to be an 
> entirely self-contained process: the user filling in info, obtaining a 
> token, and saving it to local storage.
>
> I post this in the slim hope it is helpful to someone.
>

-- 
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.