Re: [elm-discuss] Offtopic Choo Framework

2016-10-17 Thread Fed Reggiardo
I agree that Elm is in some ways not as easy as it is made out to be, for some 
people at least.  Especially newer programmers that have been working chiefly 
in JavaScrip for a while.  Not that it is a problem with the language...just 
very different from JS in many ways.

The great thing (and bad thing) about JS is that you can get away with almost 
anything.  If it doesn't work you use the dev console or toss in some 
console.logs, figure out what it is spitting out, and fix it.  

Elm doesn't allow that so sometimes it can be tricky to reason about the 
compiler messages; friendly though they might be.  For me personally it would 
be great to have a "beginner mode" where the program is allowed to compile 
(with warnings included) so that you could see the actual results of your code. 
 Until you wrap your brain around the type system seeing something like:

...is expecting
String -> Html Msg

But is getting 
String -> { a | Html Msg }. (off the top of my head, not an actua error 
message)

Is not always the most helpful.   I'm sure it will be great eventually; just 
not at first.  

The other issue is that there just aren't as many examples out there.   Nice as 
the community is sometimes you feel dumb asking questions to things that are so 
simple in another language but getting you in Elm.  I don't know anyone in my 
area learning Elm so no one nearby to get you unstuck when you can't find a 
solution.

So I can sympathize with Antonio and I've also looked at libraries such as choo 
to help me reason about Elm in a language I'm more familiar with.  It's still 
an amazing language and I'm loving learning it, just very different from the C, 
Java, JS background many of us have.  

I will say this, since starting to work on Elm I've written some of the best JS 
code I've ever done.  It absolutely is a great intro into functional 
programming and very easy to take some of that into JS.  I'm sure as more 
resources become available it will be even easier to learn.  Can't wait until I 
become fluent in it




On Monday, October 17, 2016 at 1:21:31 PM UTC-5, Nick H wrote:
> What do you find hard about learning Elm? We want Elm to be friendly to 
> beginners. It would be helpful to hear about your experience!
> 
> 
> 
> On Mon, Oct 17, 2016 at 9:08 AM, António Ramos  wrote:
> 
> Hello guys just trying to learm Elm but its not easy.
> I just found this js framework
> 
> 
> https://github.com/yoshuawuyts/choo
> 
> 
> 
> i has the same concept as TEA
> 
> 
> subscriptions , model, update and messages
> 
> 
> Maybe i just learn it too, because i just feel that going back to 
> angular/react/vue is giving up in good and simple  ideas from ELM
> 
> 
> 
> 
> Regards
> António
> 
> 
> 
> 
> -- 
> 
> 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.

-- 
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] Standard practices for dynamic extension/plugins in Elm?

2016-10-17 Thread Mario T. Lanza
Greetings, Everyone.  I had been puzzling over something for a while and my 
search eventually led me here.

What I was hoping to see demonstrated in Elm -- and have not found in my 
searches -- is how one would accommodate a plugin architecture that allows 
modules to be installed, activated, and deactivated in the same way that 
browser extensions are.  That is, once you load the module/extension it is 
present and can be activated or deactivated.  I have good ideas for how to 
do these things in languages I am more familiar with like JavaScript and 
Clojure, but I wonder how the same might be accomplished in an ML language 
like Elm.  I am sure I could make something work, but I believe an 
experienced Elm programmer would end up with a more elegant solution.  I am 
wondering if there are idioms the community uses for this kind of thing.

So I will make an example of the kind of thing I am after.  Given the existing 
Elm todo app , how would one modify 
it to allow plugins such as the following where different concerns can be 
added in per the user:

1) due-dates: installing and activating this plugin causes a due date field 
to be added to the Todo model.  The interface still provides only the text 
input field for providing the next "What needs to be done?" entry.  In the 
list portion of the view a due date column appears.  When the user types in 
an @ followed by a date (e.g. @2016-11-01) the value is parsed out of the 
text and included in the due date field in the list below.

2) tags: installing and activating this plugin causes a tags field to be 
added to the Todo model.  The interface still provides only the text input 
field for providing the next "What needs to be done?" entry.  In the list 
portion of the view a tags column appears.  When the user types in a # 
followed by a contiguous word or group of words (e.g. #finance #2016-taxes) 
the values are parsed out of the text and included in the tags field in the 
list below.

When a plugin is deactivated the columns are simply dropped from the model. 
 I am not worried about persistence.

If you have any repos that address this, please point the way.  Thanks for 
any insight.

This post originally originated here:
https://groups.google.com/forum/#!topic/elm-dev/wymnXbZy5wA

-- 
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] Support for binary data

2016-10-17 Thread W. Brian Gourlie
My use-case:  I'm creating a debugger front-end for a NES emulator I'm 
writing.  Having to serialize binary data (in particular, 16KB of address 
space) to be consumed by elm is inefficient in about every way possible.  I 
currently pack it into an array of 32-bit signed ints before serialization 
and use a port to convert that to a UInt8Array.

Also, I wrote the disassembler in typescript because I could operate on 
UInt8Array (again integrated via port).  It would be possible in elm, but 
would have felt a bit hacky.  ArrayBuffer would fix that!

Brian

On Monday, January 11, 2016 at 6:32:43 PM UTC-6, Evan wrote:
>
> I have been drafting Blob and ArrayBuffer APIs, but I wasn't sure who 
> needed them.
>
> What is your particular use case?
>
> On Mon, Jan 11, 2016 at 4:55 AM, John Watson  > wrote:
>
>> Can anyone tell me what the plans are for supporting binary data in elm?  
>> I'm thinking of a Byte (and some sort of Byte Array) type and also 
>> implementing Blob in HTTP responses. 
>>
>> -- 
>> 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.
>>
>
>

-- 
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] Why aren't doc PRs merged?

2016-10-17 Thread Eric Thomas
At both https://github.com/evancz/guide.elm-lang.org/pulls 
and https://github.com/elm-lang/elm-lang.org/pulls there's a decent number 
of PRs that would be useful if merged.
A lot of these are simple gotchas that can save a beginner a lot of time.

-- 
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] Outgoing port event ordering

2016-10-17 Thread Kasey Speakman
Or how about adding an incoming subscription port when the localStorage 
save finishes. Then you could put something in the model to indicate you 
are waiting to close. Once the save message comes back, check to see if you 
were waiting to close before sending the close message out the other port.

On Monday, October 17, 2016 at 1:50:18 PM UTC-5, Leroy Campbell wrote:
>
> Ahh...I see. Assuming you have some sort of autosave logic, how about two 
> messages: Save and SaveAndQuit? It seems reasonable to me to split the 
> actions this way...Save could be scheduled using Time.every and 
> SaveAndQuit could be both an explicit user interaction and an incoming 
> port message triggered by window.onbeforeunload().
>
> On Monday, October 17, 2016 at 2:26:20 PM UTC-4, David Andrews wrote:
>>
>> The problem initially arose when I had two ports, one of which wrote to 
>> local storage and the other of which closed the window.  Nothing was ever 
>> written to local storage because the window closed first.  The reason I 
>> went with two ports is because those actions are so conceptually different, 
>> and if it were actually just for local storage I would have used a single 
>> port.  If it were not for the fact that JavaScript processing ceases after 
>> calling window.close, the current port implementation would have worked for 
>> me.
>>
>> On Oct 17, 2016 2:03 PM, "Leroy Campbell"  wrote:
>>
>>> From what I can tell, port communication uses Cmd because interop with 
>>> JavaScript isn't necessarily a request-response communication pattern 
>>> (instead, port are pubsub).
>>>
>>> But I do have a question: *Is the underlying problem a need to 
>>> coordinate access to a shared resource in JavaScript? *I ask because 
>>> you mentioned localStorage in your initial message. I imagine you'd instead 
>>> want to leave the coordination in Elm to take advantage of Elm's 
>>> concurrency model (immutable data + message-passing) and have a single port 
>>> to talk to JavaScript.
>>>
>>> On Monday, October 17, 2016 at 3:03:14 AM UTC-4, David Andrews wrote:

 In another discussion, I was pointed to 
 http://faq.elm-community.org/17.html#what-is-the-difference-between-cmd-and-task,
  
 which sheds some light on the issue, but also raises a few questions.

 Specifically:

1. The article mentions that APIs generally expose Task in favor of 
Cmd. Why is the port API a -> Cmd msg instead of a -> Task Never () 
or something like that?
2. Is there a recommended way to pass data to ports in order? I've 
come up with the workaround of sending over only one port per update 
 and 
using Cmd.Extra.message to trigger additional updates immediately, 
but I don't think it's very clean.


 On Monday, October 17, 2016 at 2:39:01 AM UTC-4, Peter Damoc wrote:
>
> On Mon, Oct 17, 2016 at 8:02 AM, Janis Voigtländer <
> janis.voi...@gmail.com> wrote:
>
>> Peter, the problem in David’s case is that the actions he wants to 
>> order execution of are port data sending, and there is no “something 
>> lower 
>> level, like Tasks” for that. The only API available for port data 
>> sending is Cmd-based.
>>
> Ooops... my bad. I should have looked more carefully. 
>
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>
 -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "Elm Discuss" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/elm-discuss/cSzJT2-g8Ss/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> elm-discuss...@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: Identity continuity for views

2016-10-17 Thread Mark Hamburg
Per the discussion on the Html.Keyed thread, this problem can be addressed
using Html.Keyed. In particular, here is a solution that adds an After with
Keyed case that doesn't exhibit the problems of the After case:

https://gist.github.com/markhamburg/b17b6d0ecb19d73ab10f015f693c4a6b

The basic lesson of this is that if the children of a node are dynamic
rather than static and if any of those children or their further
descendants have state that is outside of Elm's control, you want to build
the node using Html.Keyed.node rather than using the somewhat simpler Html
APIs (and you want to be careful to construct the keys so as to preserve
identity correctly).

Mark

On Sun, Sep 25, 2016 at 12:34 PM, Mark Hamburg 
wrote:

> There's been a discussion of what it would take to support Web Components
> well in Elm and one of the primary issues that has come up has been
> problems with the virtual DOM not preserving component DOM elements during
> an update or preserving them when it should not. This matters because these
> are elements that often are being used because they keep state outside of
> Elm and spurious destruction/construction or reuse leads to state resetting
> when it shouldn't or being "preserved" when it shouldn't.
>
> This problem, however, already exists for text fields which have notions
> of focus and selection which exist outside of Elm. The following gist
> demonstrates the problem. Typing into the field should capture all of the
> successive text strings. It works fine in Before mode in which the text
> field sits at the same spot in the virtual DOM throughout. But in After
> mode, every time you type, the text field moves in the DOM and gets
> destroyed and re-created.
>
> https://gist.github.com/markhamburg/874a2dc5e92d233415cbe9cbe0e8e5d6
>
> Some cases, could be handled using Html.Keyed but this is really built for
> handling lists — imagine instead of the example I just provided one where
> we pop an error field into view ahead of the text entry — and in fact
> requires that concern be paid all the way up the tree — the error field
> might be several levels up from the text field in the view hierarchy.
>
> Basically, with care and attention, we can get the virtual DOM to do the
> right thing most of the time, but what we have is a lurking source of
> difficult to reproduce bugs where if the virtual DOM changes in the wrong
> way at the wrong time, the state for an element will get messed up.
>
> How could we fix this? This is where my limited knowledge of browser
> behavior and of what the key decisions are in the virtual DOM that lead to
> improved performance impairs my ability to say anything definitive. But
> essentially what it seems like we want is a return of an optional identity
> attribute for views that should be used on any view that involves external
> state. The virtual DOM update code should sweep through the old tree and
> collect up a map of identity strings to DOM elements and look in this map
> to find the right DOM element for any item in the new virtual DOM tree.
> Basically, the identity attribute means "preserve the external DOM element".
>
> Are there better solutions that don't just involve saying "avoid writing
> code like that" (though a solution that said "write code like this instead"
> would also be an option).
>
> Mark
>
>

-- 
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] [ANN] elm-graphql 1.0 released

2016-10-17 Thread John Hewson
Hi All,

Version 1.0 of elm-graphql is out. It's a build tool which, given a live 
GraphQL endpoint, allows you to run:

elm graphql

And it will generate a typesafe client for any .graphql files in your Elm 
project!

Note that the client simply executes the GraphQL queries (and decodes the 
results), this isn't an attempt to build a Relay-style framework.

-- John

-- 
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: Another case of functions in the model

2016-10-17 Thread Mark Hamburg
Thanks for the pointer. We hadn't dug into Phoenix deeply enough to see
that it has a request/response architecture at the channel level already,
so that was useful news. On the other hand, what that basically does is
says that for the special case of Phoenix channels where the need for a
callback is already defined and where the effects manager supports it, we
can move the need to store functions out of the model and into the effects
manager. Great for that special case. But what if I needed to use web
sockets instead of Phoenix? My general point is that one doesn't have to
dig that deeply to find places where storing functions in the model is
useful. On the other hand, many of those use cases do look like effects
managers which might suggest that the answer is to write effects managers —
except the the documentation also discourages doing that.

On Sat, Oct 15, 2016 at 2:38 AM, Oliver Searle-Barnes 
wrote:

> Have you had a look at (the currently not released) https://github.com/
> saschatimme/elm-phoenix? Phoenix channels have request/response semantics
> built in which you can use in elm-phoenix via Phoenix.push -
> https://github.com/saschatimme/elm-phoenix/blob/master/src/Phoenix.elm#L85.
> See Push.ok for adding a response handler https://github.com/
> saschatimme/elm-phoenix/blob/master/src/Phoenix/Push.elm#L69.
>
>
> On Saturday, 15 October 2016 01:04:32 UTC+2, Mark Hamburg wrote:
>>
>> We have an app based on making multiple HTTP requests to a server for
>> various pieces of information. All of these requests get implemented as
>> tasks that more or less immediately become commands which then get routed
>> via tagging functions as they flow up through the model. Pretty standard
>> stuff. (I think in 0.18, we get to ignore the task aspect.)
>>
>> We're interested in exploring using web sockets or Phoenix channels as an
>> alternative. Now, the request would go upstream on the socket with a tag
>> (probably just a number) and the response would come back down bearing the
>> same tag.
>>
>> To keep the same general style of coding as in the HTTP case, it seems
>> like the best implementation would be to use the
>> Requests-as-alternatives-to-Cmds approach. Rather than building a
>> command directly, we would build requests that could be similarly mapped
>> with routing functions as they propagated up through the model from update
>> functions. At the top level, we would maintain a dictionary mapping request
>> ID's to decode-and-route functions and turn the request itself into a
>> command to post to the upstream channel. The listener on the socket would
>> see the responses coming back and look in the dictionary for a
>> corresponding entry.
>>
>> That all seems pretty straightforward. But note that the model now
>> contains a dictionary of decode-and-route functions. Is there a solution
>> that avoids this and doesn't gum things up significantly in other ways?
>>
>> Mark
>>
>> --
> 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] Structure for large Elm apps

2016-10-17 Thread Eric G
I'm no expert, and would like clarification on this as well, but "pages of 
an app" seems like the main place where using nested modules makes sense -- 
unless your pages can be modeled more easily as variants of each other, as 
sometimes happens. 

My experience* has been that just about everywhere else it's easier to have 
flat modules, using helper update functions, view functions with generic 
msg types, config records, etc., and extracting common bits as needed into 
separate modules. Sometimes I have nested msg types, and do the 
Html.App.map / Cmd.map  internally, within one module. Richard Feldman had 
a list of "steps to take before breaking code out into separate modules" 
awhile back that I thought was helpful.

As for that article you linked to, it seems overkill, esp. for what is 
mostly a static site. All of the static pages can just be functions in 
Main, just split out the ones that have actual actions like the Contact 
page, and then only if it seems unwieldy to handle those in Main too.  

Basically my advice is start with Main, or Main and one page module, and 
see how far you get, rather than planning ahead what your file structure is 
going to look like.

(*My experience is limited to business-y company-internal applications, 
someone else will have to say what works for games and other kinds of 
applications.)


On Monday, October 17, 2016 at 2:41:23 PM UTC-4, Marcus Roberts wrote:
>
> Is this article (and the one it refers to) taking a good or bad approach 
> to program structure?
>
> http://7sharpnine.com/2016/10/03/building-an-spa-with-elm/ 
> 
>
> I copied the structure as a way of seeing how a program might perhaps be 
> broken down, but it feels like a very component based approach, given each 
> level has its own update function.  I learnt a fair bit about mapping 
> between message types, so it was useful.
>
> I've broken my app down into pages using this structure, and so each page 
> has a view, model, etc.  Then the top level model has a model record for 
> each page.  This seems to work as it means the page doesn't need to know 
> how it's being used at the level above.  But the general conversations I 
> see suggests this is not the right way to go and to break things down more 
> into modules of related code.So I guess back to the original question, 
> is this structure a good way to work? 
>
>
>
>
> On Mon, Oct 17, 2016 at 7:50 AM, Peter Damoc  > wrote:
>
>> update is a function that takes a message and a model and produces the 
>> updated version of the model. In some cases, update also can produce some 
>> requests for more input (http requests, requests for random numbers, ports 
>> requests) this is why the top level update has (Model, Cmd Msg) as return. 
>> Internal updates however, might not need these requests and can be 
>> simpler. 
>> What you see in the repository you linked is a pattern of nesting 
>> "components" that is currently passively discouraged.  (there use to be a 
>> set of examples around this but they are gone). 
>>
>> The official recommendation around scaling is to focus on breaking the 
>> functionality into functions:
>> https://guide.elm-lang.org/reuse/
>>
>>
>>
>>
>> On Mon, Oct 17, 2016 at 12:00 AM, clouddie > > wrote:
>>
>>> Hi, are there official guidelines for structuring large scale apps ? For 
>>> instance, what is the community take on things like 
>>> https://github.com/rogeriochaves/structured-elm-todomvc/tree/modular ?
>>> This is quite neat although I cannot quite m'y head round the fact the 
>>> Update fonctions in TaskList deal with messages for Task ans TaskList, and 
>>> they do not respect thé standard (Model, Cmd Msg) signatures ?
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> -- 
>> There is NO FATE, we are the creators.
>> blog: http://damoc.ro/
>>
>> -- 
>> 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.
>>
>
>

-- 
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: http "middleware" options

2016-10-17 Thread Mark Hamburg
On the one hand, yes, an effects manager seems like the way to do this. On
the other hand, effects manager documentation is largely absent and the
guide basically says that effects managers are only expected to be written
by a handful of people and therefore probably aren't a general purpose
solution.

Mark

On Mon, Oct 17, 2016 at 3:25 AM, Fa Qing  wrote:

> It seems (I could be wrong; I often am)  like creating an Effects manager
> is the proper way to efficiently handle side state management.
>
> https://github.com/elm-lang/core/blob/master/src/Platform.elm
>
> An example:
>
> https://gist.github.com/maxhoffmann/240574e892bf9118aeb2dd1e8a645e0a
>
> Just a quick glance at these really helped the Elm platform come into
> better focus (namely the dispatch/routing mechanism).
>
>
> --
> 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] Outgoing port event ordering

2016-10-17 Thread Leroy Campbell
Ahh...I see. Assuming you have some sort of autosave logic, how about two 
messages: Save and SaveAndQuit? It seems reasonable to me to split the 
actions this way...Save could be scheduled using Time.every and SaveAndQuit 
could be both an explicit user interaction and an incoming port message 
triggered by window.onbeforeunload().

On Monday, October 17, 2016 at 2:26:20 PM UTC-4, David Andrews wrote:
>
> The problem initially arose when I had two ports, one of which wrote to 
> local storage and the other of which closed the window.  Nothing was ever 
> written to local storage because the window closed first.  The reason I 
> went with two ports is because those actions are so conceptually different, 
> and if it were actually just for local storage I would have used a single 
> port.  If it were not for the fact that JavaScript processing ceases after 
> calling window.close, the current port implementation would have worked for 
> me.
>
> On Oct 17, 2016 2:03 PM, "Leroy Campbell"  > wrote:
>
>> From what I can tell, port communication uses Cmd because interop with 
>> JavaScript isn't necessarily a request-response communication pattern 
>> (instead, port are pubsub).
>>
>> But I do have a question: *Is the underlying problem a need to 
>> coordinate access to a shared resource in JavaScript? *I ask because 
>> you mentioned localStorage in your initial message. I imagine you'd instead 
>> want to leave the coordination in Elm to take advantage of Elm's 
>> concurrency model (immutable data + message-passing) and have a single port 
>> to talk to JavaScript.
>>
>> On Monday, October 17, 2016 at 3:03:14 AM UTC-4, David Andrews wrote:
>>>
>>> In another discussion, I was pointed to 
>>> http://faq.elm-community.org/17.html#what-is-the-difference-between-cmd-and-task,
>>>  
>>> which sheds some light on the issue, but also raises a few questions.
>>>
>>> Specifically:
>>>
>>>1. The article mentions that APIs generally expose Task in favor of 
>>>Cmd. Why is the port API a -> Cmd msg instead of a -> Task Never () 
>>>or something like that?
>>>2. Is there a recommended way to pass data to ports in order? I've 
>>>come up with the workaround of sending over only one port per update and 
>>>using Cmd.Extra.message to trigger additional updates immediately, 
>>>but I don't think it's very clean.
>>>
>>>
>>> On Monday, October 17, 2016 at 2:39:01 AM UTC-4, Peter Damoc wrote:

 On Mon, Oct 17, 2016 at 8:02 AM, Janis Voigtländer <
 janis.voi...@gmail.com> wrote:

> Peter, the problem in David’s case is that the actions he wants to 
> order execution of are port data sending, and there is no “something 
> lower 
> level, like Tasks” for that. The only API available for port data 
> sending is Cmd-based.
>
 Ooops... my bad. I should have looked more carefully. 



 -- 
 There is NO FATE, we are the creators.
 blog: http://damoc.ro/

>>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Elm Discuss" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/elm-discuss/cSzJT2-g8Ss/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> elm-discuss...@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] Structure for large Elm apps

2016-10-17 Thread Marcus Roberts
Is this article (and the one it refers to) taking a good or bad approach to
program structure?

http://7sharpnine.com/2016/10/03/building-an-spa-with-elm/

I copied the structure as a way of seeing how a program might perhaps be
broken down, but it feels like a very component based approach, given each
level has its own update function.  I learnt a fair bit about mapping
between message types, so it was useful.

I've broken my app down into pages using this structure, and so each page
has a view, model, etc.  Then the top level model has a model record for
each page.  This seems to work as it means the page doesn't need to know
how it's being used at the level above.  But the general conversations I
see suggests this is not the right way to go and to break things down more
into modules of related code.So I guess back to the original question,
is this structure a good way to work?




On Mon, Oct 17, 2016 at 7:50 AM, Peter Damoc  wrote:

> update is a function that takes a message and a model and produces the
> updated version of the model. In some cases, update also can produce some
> requests for more input (http requests, requests for random numbers, ports
> requests) this is why the top level update has (Model, Cmd Msg) as return.
> Internal updates however, might not need these requests and can be
> simpler.
> What you see in the repository you linked is a pattern of nesting
> "components" that is currently passively discouraged.  (there use to be a
> set of examples around this but they are gone).
>
> The official recommendation around scaling is to focus on breaking the
> functionality into functions:
> https://guide.elm-lang.org/reuse/
>
>
>
>
> On Mon, Oct 17, 2016 at 12:00 AM, clouddie 
> wrote:
>
>> Hi, are there official guidelines for structuring large scale apps ? For
>> instance, what is the community take on things like
>> https://github.com/rogeriochaves/structured-elm-todomvc/tree/modular ?
>> This is quite neat although I cannot quite m'y head round the fact the
>> Update fonctions in TaskList deal with messages for Task ans TaskList, and
>> they do not respect thé standard (Model, Cmd Msg) signatures ?
>>
>> --
>> 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.
>>
>
>
>
> --
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>
> --
> 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] Outgoing port event ordering

2016-10-17 Thread David Andrews
The problem initially arose when I had two ports, one of which wrote to
local storage and the other of which closed the window.  Nothing was ever
written to local storage because the window closed first.  The reason I
went with two ports is because those actions are so conceptually different,
and if it were actually just for local storage I would have used a single
port.  If it were not for the fact that JavaScript processing ceases after
calling window.close, the current port implementation would have worked for
me.

On Oct 17, 2016 2:03 PM, "Leroy Campbell"  wrote:

> From what I can tell, port communication uses Cmd because interop with
> JavaScript isn't necessarily a request-response communication pattern
> (instead, port are pubsub).
>
> But I do have a question: *Is the underlying problem a need to coordinate
> access to a shared resource in JavaScript? *I ask because you mentioned
> localStorage in your initial message. I imagine you'd instead want to leave
> the coordination in Elm to take advantage of Elm's concurrency model
> (immutable data + message-passing) and have a single port to talk to
> JavaScript.
>
> On Monday, October 17, 2016 at 3:03:14 AM UTC-4, David Andrews wrote:
>>
>> In another discussion, I was pointed to http://faq.elm-community.or
>> g/17.html#what-is-the-difference-between-cmd-and-task, which sheds some
>> light on the issue, but also raises a few questions.
>>
>> Specifically:
>>
>>1. The article mentions that APIs generally expose Task in favor of
>>Cmd. Why is the port API a -> Cmd msg instead of a -> Task Never ()
>>or something like that?
>>2. Is there a recommended way to pass data to ports in order? I've
>>come up with the workaround of sending over only one port per update and
>>using Cmd.Extra.message to trigger additional updates immediately,
>>but I don't think it's very clean.
>>
>>
>> On Monday, October 17, 2016 at 2:39:01 AM UTC-4, Peter Damoc wrote:
>>>
>>> On Mon, Oct 17, 2016 at 8:02 AM, Janis Voigtländer <
>>> janis.voi...@gmail.com> wrote:
>>>
 Peter, the problem in David’s case is that the actions he wants to
 order execution of are port data sending, and there is no “something lower
 level, like Tasks” for that. The only API available for port data
 sending is Cmd-based.

>>> Ooops... my bad. I should have looked more carefully.
>>>
>>>
>>>
>>> --
>>> There is NO FATE, we are the creators.
>>> blog: http://damoc.ro/
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Elm Discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/elm-discuss/cSzJT2-g8Ss/unsubscribe.
> To unsubscribe from this group and all its topics, 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] Offtopic Choo Framework

2016-10-17 Thread Nick H
What do you find hard about learning Elm? We want Elm to be friendly to
beginners. It would be helpful to hear about your experience!

On Mon, Oct 17, 2016 at 9:08 AM, António Ramos  wrote:

> Hello guys just trying to learm Elm but its not easy.
> I just found this js framework
>
> https://github.com/yoshuawuyts/choo
>
> i has the same concept as TEA
>
> subscriptions , model, update and messages
>
> Maybe i just learn it too, because i just feel that going back to
> angular/react/vue is giving up in good and simple  ideas from ELM
>
>
> Regards
> António
>
> --
> 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] Outgoing port event ordering

2016-10-17 Thread Leroy Campbell
>From what I can tell, port communication uses Cmd because interop with 
JavaScript isn't necessarily a request-response communication pattern 
(instead, port are pubsub).

But I do have a question: *Is the underlying problem a need to coordinate 
access to a shared resource in JavaScript? *I ask because you mentioned 
localStorage in your initial message. I imagine you'd instead want to leave 
the coordination in Elm to take advantage of Elm's concurrency model 
(immutable data + message-passing) and have a single port to talk to 
JavaScript.

On Monday, October 17, 2016 at 3:03:14 AM UTC-4, David Andrews wrote:
>
> In another discussion, I was pointed to 
> http://faq.elm-community.org/17.html#what-is-the-difference-between-cmd-and-task,
>  
> which sheds some light on the issue, but also raises a few questions.
>
> Specifically:
>
>1. The article mentions that APIs generally expose Task in favor of Cmd. 
>Why is the port API a -> Cmd msg instead of a -> Task Never () or 
>something like that?
>2. Is there a recommended way to pass data to ports in order? I've 
>come up with the workaround of sending over only one port per update and 
>using Cmd.Extra.message to trigger additional updates immediately, but 
>I don't think it's very clean.
>
>
> On Monday, October 17, 2016 at 2:39:01 AM UTC-4, Peter Damoc wrote:
>>
>> On Mon, Oct 17, 2016 at 8:02 AM, Janis Voigtländer <
>> janis.voi...@gmail.com> wrote:
>>
>>> Peter, the problem in David’s case is that the actions he wants to order 
>>> execution of are port data sending, and there is no “something lower level, 
>>> like Tasks” for that. The only API available for port data sending is 
>>> Cmd-based.
>>>
>> Ooops... my bad. I should have looked more carefully. 
>>
>>
>>
>> -- 
>> There is NO FATE, we are the creators.
>> blog: http://damoc.ro/
>>
>

-- 
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] Elm Test building custom generators

2016-10-17 Thread Zachary Kessin
Yes I did

Zach
ᐧ

On Mon, Oct 17, 2016 at 2:31 AM, Max Goldstein 
wrote:

> Fuzz.map4, which I think was only added in 2.1.0 so that's why Zachary
> didn't see it in August.
>
> --
> 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.
>



-- 
Zach Kessin
SquareTarget 
Twitter: @zkessin 
Skype: zachkessin

-- 
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] Structure for large Elm apps

2016-10-17 Thread clouddie
Hi, thanks for your answer, I also got the impression that component 
approach was being discouraged as the notorious "dual counters" and "list 
of counters" relying on the component approach have been withdrawn from 
documentation as it seems...

To be fair I have already read the docs, but my model, messages and update 
functions are becoming wy too unwieldy (> 1,000 lines), and Evan's 
footnote is not that helpful (I understand he must be the busiest man on 
earth) :

Note: I plan to fill this section in with more examples of growing your 
> Model and update functions. It is roughly the same ideas though. If you 
> find yourself repeating yourself, maybe break things out. If a function 
> gets too big, make a helper function. If you see related things, maybe move 
> them to a module. But at the end of the day, it is not a huge deal if you 
> let things get big. Elm is great at finding problems and making refactors 
> easy, so it is not actually a huge deal if you have a bunch of entries in 
> your Model because it does not seem better to break them out in some way. 
> I will be writing more about this!


 

Le lundi 17 octobre 2016 08:50:23 UTC+2, Peter Damoc a écrit :
>
> update is a function that takes a message and a model and produces the 
> updated version of the model. In some cases, update also can produce some 
> requests for more input (http requests, requests for random numbers, ports 
> requests) this is why the top level update has (Model, Cmd Msg) as return. 
> Internal updates however, might not need these requests and can be 
> simpler. 
> What you see in the repository you linked is a pattern of nesting 
> "components" that is currently passively discouraged.  (there use to be a 
> set of examples around this but they are gone). 
>
> The official recommendation around scaling is to focus on breaking the 
> functionality into functions:
> https://guide.elm-lang.org/reuse/
>
>
>
>
> On Mon, Oct 17, 2016 at 12:00 AM, clouddie  > wrote:
>
>> Hi, are there official guidelines for structuring large scale apps ? For 
>> instance, what is the community take on things like 
>> https://github.com/rogeriochaves/structured-elm-todomvc/tree/modular ?
>> This is quite neat although I cannot quite m'y head round the fact the 
>> Update fonctions in TaskList deal with messages for Task ans TaskList, and 
>> they do not respect thé standard (Model, Cmd Msg) signatures ?
>>
>> --
>> 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.
>>
>
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
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: Offtopic Choo Framework

2016-10-17 Thread OvermindDL1
Cool little library, but the main thing that makes me use Elm is not TEA, 
but rather the functional language.  Having types removes entire classes of 
bugs and immutability makes it easy to reason about a program flow.  It is 
just too easy to break both of those aspects in Javascript, even with 
layers on top.


On Monday, October 17, 2016 at 10:09:27 AM UTC-6, António Ramos wrote:
>
> Hello guys just trying to learm Elm but its not easy.
> I just found this js framework
>
> https://github.com/yoshuawuyts/choo
>
> i has the same concept as TEA
>
> subscriptions , model, update and messages
>
> Maybe i just learn it too, because i just feel that going back to 
> angular/react/vue is giving up in good and simple  ideas from ELM
>
>
> Regards
> António
>

-- 
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] Offtopic Choo Framework

2016-10-17 Thread António Ramos
Hello guys just trying to learm Elm but its not easy.
I just found this js framework

https://github.com/yoshuawuyts/choo

i has the same concept as TEA

subscriptions , model, update and messages

Maybe i just learn it too, because i just feel that going back to
angular/react/vue is giving up in good and simple  ideas from ELM


Regards
António

-- 
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] Catch Elm.Main.fullscreen "unexpected argument" error?

2016-10-17 Thread Kevin Berridge
Thanks!  I'll try your version suggestion.  I also understand why I 
couldn't catch the error now too from this 
post: https://groups.google.com/forum/#!topic/elm-discuss/vk4w_Ei8A84

Thanks,
Kevin
(Also, sorry for double posting!)

On Saturday, October 15, 2016 at 5:19:01 PM UTC-4, Peter Damoc wrote:
>
> You can check for a version of the storage schema and patch the data 
> before sending it to Elm (or just drop it). In your case, you could also 
> work with the fact that you know that the new version has comments: 
>
> 
> const storedState = localStorage.getItem('model');
> var startingState = storedState ? JSON.parse(storedState) : null;
> if (! "comment" in startingState) {
> startingState = null;
> }
> try {
> elmApp = Elm.Main.fullscreen(startingState);
> }
> catch (e) {
> throw "it caught!";
> }
> elmApp.ports.setStorage.subscribe(function (state) {
>   localStorage.setItem('model', JSON.stringify(state));
> })
> 
>
>  
> Alternatively, you could pass the data as Value in your program and use 
> multiple decoders to extract the data but that would be a little bit more 
> complicated. 
>
>
>
> On Thu, Oct 13, 2016 at 10:31 PM, Kevin Berridge  > wrote:
>
>> Is there a way to catch the "You are trying to initialize module `Main` 
>> with an unexpected argument." error when calling Elm.Main.fullscreen({}) 
>> with out of date arguments?  I tried wrapping it in a try/catch, but the 
>> catch is not running.
>>
>> What I'm really trying to do is pass in state that was persisted in local 
>> storage as described here 
>> https://medium.com/wunder-nerds/storing-and-restoring-the-state-in-elm-0-17-94874429dc1d#.gmkt7hrwu.
>>   
>> But I changed my model, so now it errors.  I'm happy to just forget the 
>> state and start over when that happens, so if I could catch the error in JS 
>> I could do that.
>>
>> Here's the JS I'm using.  The throw in that catch block doesn't run.
>> 
>> const storedState = localStorage.getItem('model');
>> const startingState = storedState ? JSON.parse(storedState) : 
>> null;
>> try {
>> elmApp = Elm.Main.fullscreen(startingState);
>> }
>> catch (e) {
>> throw "it caught!";
>> }
>> elmApp.ports.setStorage.subscribe(function (state) {
>>   localStorage.setItem('model', JSON.stringify(state));
>> })
>> 
>>
>> And the JS error that is being thrown (but not being caught) is:
>> Uncaught Error: You are trying to initialize module `Main` with an 
>> unexpected argument.
>> When trying to convert it to a usable Elm value, I run into this problem:
>>
>> I ran into the following problems:
>>
>> Expecting null but instead got: {...}
>> Expecting an object with a field named `comment` at _.distractions[4] but 
>> instead got: {...}
>>
>> I truncated the object properties in that message.  That error is 
>> correct, 'comment' was added to my elm model and therefore does not exist 
>> in the previously stored state that it is trying to deserialize.
>>
>> Thanks in advance,
>> Kevin
>>
>> -- 
>> 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.
>>
>
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
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: trying to draw a diagram about elm-architecture

2016-10-17 Thread Charles Scalfani
Here's my version (so far) that includes Effects Managers:

https://www.facebook.com/photo.php?fbid=10154586193039127=gm.1771231996493568=3


On Monday, May 30, 2016 at 8:14:38 PM UTC-7, 大魔头 wrote:
>
> hi,
>
> I've tried out examples in http://guide.elm-lang.org/  , now I want to 
> prepare myself to share what I've learnt to my team mates.  
>
> since there isn't an official diagram about the elm-architecure(maybe 
> there is?), so I draw my own.
> https://raw.githubusercontent.com/notyy/learn_elm/master/elm_arch.png
>
> review is very much welcome. I hope my diagram won't be miss leading 
> others.
>

-- 
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: Catching error in fullscreen/App.programWithFlags

2016-10-17 Thread Kevin Berridge
Thanks for the explanation!  Now that I understand what is happening I 
think I'll go with the fix described 
here https://groups.google.com/forum/#!topic/elm-discuss/F_oLy4PUF2o.  

Thanks,
Kevin
(Also, sorry for double posting!)

On Saturday, October 15, 2016 at 7:59:15 PM UTC-4, OvermindDL1 wrote:
>
> You will not be able to do that as Elm has its own scheduler that uses 
> `setTimeout(0, ...)` to do the event loops, including the very first init, 
> and that errors causes that event loop to die.  I'd probably recommend 
> changing your flags to handle this case differently or you might be able to 
> do it by setting up a port and messaging into it and maybe seeing if the 
> port exists (if it does not exist it all then the app may not have loaded, 
> I've not tested this to see 'when' the ports are setup in the setup but you 
> could always have the program message back 'out' if it was successful, 
> though I'd go with changing how the data is passed in).
>
> On Saturday, October 15, 2016 at 11:20:11 AM UTC-6, Kevin Berridge wrote:
>>
>> I'm using App.programWithFlags to initialize the state of my model from 
>> local storage (as described in this blog article 
>> ).
>>  
>>  But when the schema of my model changes (ex: I added a new field to a 
>> record type) it will correctly error out when Elm.Main.fullscreen is called 
>> with error: "You are trying to initialize module `Main` with an unexpected 
>> argument."
>>
>> I am OK with throwing away the state from local storage and starting from 
>> scratch when this happens, so I tried to add a try catch in the JavaScript 
>> but surprisingly (to me) the catch doesn't fire.
>>
>> try {
>> elmApp = Elm.Main.fullscreen(startingState);
>> }
>> catch (e) {
>> elmApp = Elm.Main.fullscreen(null); // this never gets called
>> }
>>
>> Is there a way that I can catch this error?  Or do I need to use a 
>> different approach?
>>
>> Thanks,
>> Kevin
>>
>

-- 
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] #PolymerSummit

2016-10-17 Thread Peter Damoc
The components mentioned in that page of the guide have more to do with the
Elm Components, the old nesting structure that was present in the elm
architecture tutorial before 0.17

Web components/ polymer integration is actually something very interesting
and a rather new topic to be explored:
https://groups.google.com/forum/#!topic/elm-discuss/8Q2xwRh6UYc




On Mon, Oct 17, 2016 at 5:31 PM, António Ramos  wrote:

> sorry my lack of knowledge...
> after i read
> https://guide.elm-lang.org/reuse/
>
> i understood that  components are the same as web components and are not
> the path offered by elm.
> Also elm is an alternative to polymer/angular/vue/react and as such i dont
> understand why are you trying to put them together.
> What piece of the puzzle am i missing here?
>
> Regards
>
>
> 2016-10-17 13:21 GMT+01:00 Ed Ilyin :
>
>> Anybody at the #PolymerSummit in London? Maybe let's discuss Elm with Web
>> components?
>>
>> --
>> 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.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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] #PolymerSummit

2016-10-17 Thread António Ramos
sorry my lack of knowledge...
after i read
https://guide.elm-lang.org/reuse/

i understood that  components are the same as web components and are not
the path offered by elm.
Also elm is an alternative to polymer/angular/vue/react and as such i dont
understand why are you trying to put them together.
What piece of the puzzle am i missing here?

Regards


2016-10-17 13:21 GMT+01:00 Ed Ilyin :

> Anybody at the #PolymerSummit in London? Maybe let's discuss Elm with Web
> components?
>
> --
> 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] Re: This week, we hit 5000+ users on Slack

2016-10-17 Thread Duane Johnson
Wow, that's incredible!

On this mailing list, I approve messages from newcomers at a rate of about
3 per day. (Once the first message is approved, they can send messages
without mod approval thereafter). It's neat to see how vibrant the growth
of this community is.

On Sun, Oct 16, 2016 at 6:09 PM, Robin Heggelund Hansen <
skinney...@gmail.com> wrote:

> This is awesome! Way to go, team :D
>
>
> mandag 17. oktober 2016 01.33.47 UTC+2 skrev Noah Hall følgende:
>>
>> From our Slack weekly update:
>>
>> > In total there are 5190 people on your team (up 210 from last week)
>> (that's not including 11 disabled accounts).
>>
>> I think that's pretty cool. Lots of people to help and be helped!
>>
>> Here's a link for anyone unfamiliar -> http://elmlang.herokuapp.com/
>>
> --
> 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] #PolymerSummit

2016-10-17 Thread Ed Ilyin
Anybody at the #PolymerSummit in London? Maybe let's discuss Elm with Web 
components? 

-- 
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] Uncaught TypeError: Cannot read property 'style' of null

2016-10-17 Thread Peter Damoc
This looks like an error in Ghostery browser extension not in your elm
code.
Disable the extension and try again. :)



On Mon, Oct 17, 2016 at 11:03 AM, kees Bleijenberg <
k.bleijenb...@lijbrandt.nl> wrote:

> I started my first Elm project. It compiles without errors. If I load the
> index.html in Chrome I get:
> Uncaught TypeError: Cannot read property 'style' of null in ghostery.js
> line 3
> At all places I use div [] []  So the first arg is empty.
> I'am using elm-reactor 0.17.1 on Windows.
> What can I do?
>
> Kees
>
> --
> 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.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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] Uncaught TypeError: Cannot read property 'style' of null

2016-10-17 Thread Duane Johnson
I believe ghostery.js is a Firefox plugin? What happens if you disable it
in your browser?

On Mon, Oct 17, 2016 at 2:03 AM, kees Bleijenberg <
k.bleijenb...@lijbrandt.nl> wrote:

> I started my first Elm project. It compiles without errors. If I load the
> index.html in Chrome I get:
> Uncaught TypeError: Cannot read property 'style' of null in ghostery.js
> line 3
> At all places I use div [] []  So the first arg is empty.
> I'am using elm-reactor 0.17.1 on Windows.
> What can I do?
>
> Kees
>
> --
> 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] Uncaught TypeError: Cannot read property 'style' of null

2016-10-17 Thread kees Bleijenberg
I started my first Elm project. It compiles without errors. If I load the 
index.html in Chrome I get:
Uncaught TypeError: Cannot read property 'style' of null in ghostery.js 
line 3
At all places I use div [] []  So the first arg is empty.
I'am using elm-reactor 0.17.1 on Windows.
What can I do?

Kees

-- 
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] Featured users - elm.lang page

2016-10-17 Thread Mateusz Wit
Hi there :)

I noticed that* "Want to get featured? Let us know how your company uses 
Elm on elm-discuss or twitter!"* from elm-lang.org has vanished. Wandering 
if this was done on purpose or if it is just something that was forgotten 
to be added on the new landing page. Does anyone know if it is still 
possible for a company to get featured, and if so, how best to do it?

Cheers

-- 
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] D3js for 0.17??

2016-10-17 Thread António Ramos
hello i dont find any d3js library to use with elm 0.17

Any ideas?

thank you

-- 
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: http "middleware" options

2016-10-17 Thread Fa Qing
It seems (I could be wrong; I often am)  like creating an Effects manager 
is the proper way to efficiently handle side state management.

https://github.com/elm-lang/core/blob/master/src/Platform.elm

An example:

https://gist.github.com/maxhoffmann/240574e892bf9118aeb2dd1e8a645e0a

Just a quick glance at these really helped the Elm platform come into 
better focus (namely the dispatch/routing mechanism). 


-- 
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: Integrating Elm with Web Components / Polymer

2016-10-17 Thread 'Rupert Smith' via Elm Discuss
On Monday, October 17, 2016 at 10:29:52 AM UTC+1, Rupert Smith wrote:
>
> On Friday, October 14, 2016 at 2:50:44 PM UTC+1, Peter Damoc wrote:
>>
>> On Fri, Oct 14, 2016 at 1:35 PM, 'Rupert Smith' via Elm Discuss <
>> elm-d...@googlegroups.com> wrote:
>>
>>> 1. Build some support into the Elm compiler for webcomponents. 
>>>
>>
>> There could also be a direction where Elm compiler only implements 
>> support for  Custom Elements. 
>>
>> It would be awesome if someone more knowledgeble in JS could research 
>> what is the minimal amount of change needed to support that in a nice way. 
>>
>> Ideally, it would be some library that would allow the implementation of 
>> the custom elements without ports or need for extra JS so that custom 
>> elements could be implemented and shared through the official package 
>> repository. 
>>
>> This could simplify a lot of things, if taken in a 5 years perspective 
>> where Elm has even better tools take advantage of all the extra information 
>> that the language brings in order to create highly efficient deliverables.  
>>
>
> The thing is... custom elements are only part of what makes a component. 
> Indeed in Elm, you don't even really need custom components, since you are 
> not working in Html directly but writing functions to generate Html. For 
> example, from the elm-mdl library I can do  "Card.view ..." to add a card 
> component to my UI. Already the limited pallete of Html has been overcome 
> by a library of functions.
>
> The ports are used to receive updates or to set state on the component. In 
> a modular sense, a component encapsulates some state and provides a set of 
> 'methods' to read and write that state in a carefully controlled manner, 
> with the intention of providing a nice abstraction for working with a 
> component, that cannot be put into an illegal state by reading or writing 
> private state.
>
> So in terms of compiler/langauge support that is what is missing - a way 
> for one Elm program to include another as a module, but to only be able to 
> access that module through a restricted set of events and writeable state.
>
> It is Parnas principles of modular design really.
>

Looking at this elm meetup presentation on elm-mdl:

https://www.dailydrip.com/topics/elm-remote-meetup/drips/implementing-a-ui-library-in-elm-the-good-the-bad-the-ugly-by-soren-debois
 

elm-mdl had similar consideration about private state and private update 
events that are not really meant to be exposed to the consumer of it. The 
presentation shows how this could be done within the TEA framework, all it 
requires from the consumer is that they include the Mdl model in their 
model, and hook up to an Mdl event to pass along internal events.

I suspect this approach might be more appealing for Elm than the more OO 
apporach to modularisation that I describe above. webcomponents written 
this way, would not have their own main Program though, so could not stand 
alone as components outside of an Elm consumer.

-- 
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: Integrating Elm with Web Components / Polymer

2016-10-17 Thread 'Rupert Smith' via Elm Discuss
On Friday, October 14, 2016 at 2:50:44 PM UTC+1, Peter Damoc wrote:
>
> On Fri, Oct 14, 2016 at 1:35 PM, 'Rupert Smith' via Elm Discuss <
> elm-d...@googlegroups.com > wrote:
>
>> 1. Build some support into the Elm compiler for webcomponents. 
>>
>
> There could also be a direction where Elm compiler only implements support 
> for  Custom Elements. 
>
> It would be awesome if someone more knowledgeble in JS could research what 
> is the minimal amount of change needed to support that in a nice way. 
>
> Ideally, it would be some library that would allow the implementation of 
> the custom elements without ports or need for extra JS so that custom 
> elements could be implemented and shared through the official package 
> repository. 
>
> This could simplify a lot of things, if taken in a 5 years perspective 
> where Elm has even better tools take advantage of all the extra information 
> that the language brings in order to create highly efficient deliverables.  
>

The thing is... custom elements are only part of what makes a component. 
Indeed in Elm, you don't even really need custom components, since you are 
not working in Html directly but writing functions to generate Html. For 
example, from the elm-mdl library I can do  "Card.view ..." to add a card 
component to my UI. Already the limited pallete of Html has been overcome 
by a library of functions.

The ports are used to receive updates or to set state on the component. In 
a modular sense, a component encapsulates some state and provides a set of 
'methods' to read and write that state in a carefully controlled manner, 
with the intention of providing a nice abstraction for working with a 
component, that cannot be put into an illegal state by reading or writing 
private state.

So in terms of compiler/langauge support that is what is missing - a way 
for one Elm program to include another as a module, but to only be able to 
access that module through a restricted set of events and writeable state.

It is Parnas principles of modular design really.

-- 
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] Outgoing port event ordering

2016-10-17 Thread David Andrews
In another discussion, I was pointed to 
http://faq.elm-community.org/17.html#what-is-the-difference-between-cmd-and-task,
 
which sheds some light on the issue, but also raises a few questions.

Specifically:

   1. The article mentions that APIs generally expose Task in favor of Cmd. 
   Why is the port API a -> Cmd msg instead of a -> Task Never () or 
   something like that?
   2. Is there a recommended way to pass data to ports in order? I've come 
   up with the workaround of sending over only one port per update and using 
   Cmd.Extra.message to trigger additional updates immediately, but I don't 
   think it's very clean.
   

On Monday, October 17, 2016 at 2:39:01 AM UTC-4, Peter Damoc wrote:
>
> On Mon, Oct 17, 2016 at 8:02 AM, Janis Voigtländer  > wrote:
>
>> Peter, the problem in David’s case is that the actions he wants to order 
>> execution of are port data sending, and there is no “something lower level, 
>> like Tasks” for that. The only API available for port data sending is Cmd
>> -based.
>>
> Ooops... my bad. I should have looked more carefully. 
>
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
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] Structure for large Elm apps

2016-10-17 Thread Peter Damoc
update is a function that takes a message and a model and produces the
updated version of the model. In some cases, update also can produce some
requests for more input (http requests, requests for random numbers, ports
requests) this is why the top level update has (Model, Cmd Msg) as return.
Internal updates however, might not need these requests and can be simpler.
What you see in the repository you linked is a pattern of nesting
"components" that is currently passively discouraged.  (there use to be a
set of examples around this but they are gone).

The official recommendation around scaling is to focus on breaking the
functionality into functions:
https://guide.elm-lang.org/reuse/




On Mon, Oct 17, 2016 at 12:00 AM, clouddie 
wrote:

> Hi, are there official guidelines for structuring large scale apps ? For
> instance, what is the community take on things like https://github.com/
> rogeriochaves/structured-elm-todomvc/tree/modular ?
> This is quite neat although I cannot quite m'y head round the fact the
> Update fonctions in TaskList deal with messages for Task ans TaskList, and
> they do not respect thé standard (Model, Cmd Msg) signatures ?
>
> --
> 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.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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] control structure

2016-10-17 Thread Patricia Nicole Benedicto
yes thankyou :)


On Wednesday, October 12, 2016 at 6:55:15 PM UTC+8, Duane Johnson wrote:
>
> Recursion is the basic principle on which repetition is based in 
> functional languages like Elm. However, in most cases, recursion is not 
> needed for day to day programming, because functions such as List.map and 
> List.foldr will accept functions, and repeat the application of the 
> passed-in function over each element of a list. Does that help?
>
> On Oct 12, 2016 6:52 PM, "Patricia Nicole Benedicto" <
> patriciab...@gmail.com > wrote:
>
> hi can i ask what is the repetiton control structucture of this 
> programming languages?
>
> -- 
> 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.
>
>
>

-- 
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] Outgoing port event ordering

2016-10-17 Thread Peter Damoc
On Mon, Oct 17, 2016 at 8:02 AM, Janis Voigtländer <
janis.voigtlaen...@gmail.com> wrote:

> Peter, the problem in David’s case is that the actions he wants to order
> execution of are port data sending, and there is no “something lower level,
> like Tasks” for that. The only API available for port data sending is Cmd
> -based.
>
Ooops... my bad. I should have looked more carefully.



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

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