[elm-discuss] Embed external HTML into elm

2016-05-24 Thread Zachary Kessin
What I want to do is have a chunk of HTML that is not controlled by elm
inside an elm full page application. Specifically, I want to use Vega to
create graphs in a div on my site.
But when I tried to do that with a port if flickered and generally was
unusable. I think some of the issue was that the update action sent the
commands out to vega, but that the div was not refreshed yet due to the
view code not having been run.


What is the suggested way to do this?

-- 
Zach Kessin
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] interesting article

2016-05-24 Thread Peter Damoc
Aligning Elm with TLA+ will make it even more solid from a theoretical
point of view.

SAM sounds very intriguing. I'm wondering if SAM couldn't be implemented in
terms of TEA using a tagged union as Model.

something like this:
https://gist.github.com/pdamoc/c96714479d9f531fbc7468d5670ef576




On Tue, May 24, 2016 at 8:51 AM, Stefan Houtzager <
stefan.houtza...@gmail.com> wrote:

> I am interested in learning elm. I just read an article from Jean-Jacques
> Dubray. He thinks an alignment with "SAM" would make elm stronger:
> https://www.infoq.com/articles/no-more-mvc-frameworks#anch133142.
> Discussions: https://gitter.im/jdubray/sam.
> What do you think? Might it be interesting to start a discussion
> with Jean-Jacques Dubray?
>
> --
> Kind regards,
>
> Stefan Houtzager
>
> Houtzager ICT consultancy & development
>
> www.linkedin.com/in/stefanhoutzager
>
> --
> 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.


[elm-discuss] Create an alert that disappears after 5 seconds

2016-05-24 Thread TheGryzor123
I'm still pretty new to Elm so I prefer to ask.

I'm creating a typical alert that says "Action successful!" and want it to 
disappear automatically after 5 seconds.

Should I use Time.every for that?

-- 
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] Create an alert that disappears after 5 seconds

2016-05-24 Thread Peter Damoc
You should use Process.sleep

dismissCmd =
Process.sleep (2 * second)
|> Task.perform (\_ ->  NoOp) (\_ -> DismissAlert)



On Tue, May 24, 2016 at 11:56 AM, TheGryzor123  wrote:

> I'm still pretty new to Elm so I prefer to ask.
>
> I'm creating a typical alert that says "Action successful!" and want it to
> disappear automatically after 5 seconds.
>
> Should I use Time.every for that?
>
> --
> 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] Create an alert that disappears after 5 seconds

2016-05-24 Thread Janis Voigtländer
My standard objection:

Replace Task.perform (\_ -> NoOp) by Task.perform never, using:

http://package.elm-lang.org/packages/elm-community/basics-extra/1.0.0/Basics-Extra#never
​

2016-05-24 11:21 GMT+02:00 Peter Damoc :

> You should use Process.sleep
>
> dismissCmd =
> Process.sleep (2 * second)
> |> Task.perform (\_ ->  NoOp) (\_ -> DismissAlert)
>
>
>
> On Tue, May 24, 2016 at 11:56 AM, TheGryzor123  wrote:
>
>> I'm still pretty new to Elm so I prefer to ask.
>>
>> I'm creating a typical alert that says "Action successful!" and want it
>> to disappear automatically after 5 seconds.
>>
>> Should I use Time.every for that?
>>
>> --
>> 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.


[elm-discuss] Re: Looking for people experienced with elm-html's "key" function

2016-05-24 Thread Kris Jenkins
I've just run into this too, but for me it causes a runtime exception. I've 
added a demo to reproduce (based on Gera's code) to the same issue:

  https://github.com/elm-lang/html/issues/21

On Monday, 23 May 2016 13:41:56 UTC+1, ge...@theoldmonk.net wrote:
>
> I'm not sure if the lazyDict approach applies, but I'm hitting a much 
> simpler (IMO) issue that I've reported at 
> https://github.com/elm-lang/html/issues/21.
>
> I'm honestly surprised that no one has run into it yet, specially since 
> the documentation for `key` in 0.16 specifically provides this exact issue 
> as the reason for its existence.
>
> It's entirely possible and highly likely that I'm missing something basic. 
> I would be glad to receive any pointers, but I would also argue that the 
> documentation could be improved in that case.
>
> Cheers,
> --gera.
>
> On Monday, February 29, 2016 at 7:38:56 PM UTC+1, Evan wrote:
>>
>> You use Html.Attribute.key 
>> 
>>  
>> when you have a sequence of items where you may be inserting and removing 
>> from the middle. I took this API pretty much directly from the virtual-dom 
>> implementation that backs the currently released version of elm-html. I am 
>> doing a rewrite for various reasons, and realized that the current API 
>> clashes with the laziness optimizations.
>>
>>
>> Problem
>>
>> If you have a big list, you’d likely want to make each entry lazy. It 
>> would suck to have to build 1000 virtual nodes. If you want keys, you need 
>> to add them as an attribute, but lazy takes no attributes! This means 
>> you need to add an extra DOM node with a key where it has one child that’s 
>> lazy.
>>
>>
>> Alternative
>>
>> I am considering getting rid of Html.Attribute.key entirely and 
>> replacing it with this function:
>>
>> lazyDict
>>   : String
>>   -> List Attribute
>>   -> (a -> Html)
>>   -> Dict comparable a
>>   -> Html
>> lazyDict tagName attributes viewItem items = ...
>>
>> It is somewhat similar to the normal Html.node 
>>  
>> function in that it is just about creating virtual DOM nodes, but in this 
>> case you give a Dict instead of a List. You might create a news feed 
>> like this:
>>
>> viewNewsFeed : Dict Time Story -> Html
>> viewNewsFeed stories =
>>   lazyDict "div" [class "news-feed"] viewStory stories
>>
>> Each entry would also be done lazily, so you only need to create the Html 
>> if the dictionary entries are not reference equal.
>>
>> This means it would be easy to treat the stories as a dictionary in your 
>> model. When you want to add something, you add it with a timestamp. If it's 
>> sorted by name, you have a (Dict String Person) or whatever.
>>
>>
>> Question
>>
>> If you have personally used keys for a specific scenario, would this new 
>> API cover things as well? Would it be better or worse? Can you elaborate on 
>> the details of your case?
>>
>> *Note:* I am looking for *specific* experience. *If you don't have a 
>> concrete example, you are off-topic.* Take it to another thread. If you 
>> are reading this and the thread is long, feel free just to respond to my 
>> initial question. The goal here is to gather data, not opinions.
>>
>

-- 
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] Create an alert that disappears after 5 seconds

2016-05-24 Thread Peter Damoc
I would love to have `never` in core and available on elm-lang.org/try

Or have

performSafe: (a -> Cmd msg) -> Task Never a -> Cmd msg

Until then, I prefer the universality of NoOp.





On Tue, May 24, 2016 at 12:49 PM, Janis Voigtländer <
janis.voigtlaen...@gmail.com> wrote:

> My standard objection:
>
> Replace Task.perform (\_ -> NoOp) by Task.perform never, using:
>
>
> http://package.elm-lang.org/packages/elm-community/basics-extra/1.0.0/Basics-Extra#never
> ​
>
> 2016-05-24 11:21 GMT+02:00 Peter Damoc :
>
>> You should use Process.sleep
>>
>> dismissCmd =
>> Process.sleep (2 * second)
>> |> Task.perform (\_ ->  NoOp) (\_ -> DismissAlert)
>>
>>
>>
>> On Tue, May 24, 2016 at 11:56 AM, TheGryzor123 
>> wrote:
>>
>>> I'm still pretty new to Elm so I prefer to ask.
>>>
>>> I'm creating a typical alert that says "Action successful!" and want it
>>> to disappear automatically after 5 seconds.
>>>
>>> Should I use Time.every for that?
>>>
>>> --
>>> 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.
>



-- 
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] Create an alert that disappears after 5 seconds

2016-05-24 Thread Janis Voigtländer
Yeah, I’m thinking of adding that version of perform to a task-extra
package. Actually wondering about the name. Maybe performUnfailing, because
the standard perform is not really “unsafe” either.
​

2016-05-24 13:17 GMT+02:00 Peter Damoc :

> I would love to have `never` in core and available on elm-lang.org/try
>
> Or have
>
> performSafe: (a -> Cmd msg) -> Task Never a -> Cmd msg
>
> Until then, I prefer the universality of NoOp.
>
>
>
>
>
> On Tue, May 24, 2016 at 12:49 PM, Janis Voigtländer <
> janis.voigtlaen...@gmail.com> wrote:
>
>> My standard objection:
>>
>> Replace Task.perform (\_ -> NoOp) by Task.perform never, using:
>>
>>
>> http://package.elm-lang.org/packages/elm-community/basics-extra/1.0.0/Basics-Extra#never
>> ​
>>
>> 2016-05-24 11:21 GMT+02:00 Peter Damoc :
>>
>>> You should use Process.sleep
>>>
>>> dismissCmd =
>>> Process.sleep (2 * second)
>>> |> Task.perform (\_ ->  NoOp) (\_ -> DismissAlert)
>>>
>>>
>>>
>>> On Tue, May 24, 2016 at 11:56 AM, TheGryzor123 
>>> wrote:
>>>
 I'm still pretty new to Elm so I prefer to ask.

 I'm creating a typical alert that says "Action successful!" and want it
 to disappear automatically after 5 seconds.

 Should I use Time.every for that?

 --
 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.
>>
>
>
>
> --
> 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] Re: Sublime Text 3 highlighting in 0.17

2016-05-24 Thread 'Laszlo Pandy' via Elm Discuss
Noah, can you elaborate on (or link to) the problems getting the sublime
plugin accepted to package control?

On Mon, May 23, 2016 at 7:53 PM, kgashok  wrote:

> There is a quick fix for this -
> https://github.com/deadfoxygrandpa/Elm.tmLanguage/issues/99
>
>
> On Monday, 23 May 2016 22:53:24 UTC+5:30, kgashok wrote:
>>
>> Specifically after the changeover from
>> *module XXX where  *
>> to
>> *module XXX exposing (..) *
>>
>> the highlighting in Sublime Text 3 is all screwed up. How do I
>> update/upgrade the Elm support settings in Sublime Text 3?
>>
> --
> 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] interesting article

2016-05-24 Thread surfncode


> This is not the first time I read about SAM. The decoupling between model 
and actions seems a bit artificial. Just putting them into different 
functions doesn't mean the coupling magically disappear in my opinion. 
There still must be an implicit contract between those two, so that the 
model is able to interpret the action data format isn't it ? This just seem 
to create an hidden dependency inside the model update function instead of 
in plain sight as we have in elm now. Not sure it would really improve 
anything.

-- 
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] Create an alert that disappears after 5 seconds

2016-05-24 Thread Peter Damoc
performUnfailing sounds more descriptive indeed.





On Tue, May 24, 2016 at 2:29 PM, Janis Voigtländer <
janis.voigtlaen...@gmail.com> wrote:

> Yeah, I’m thinking of adding that version of perform to a task-extra
> package. Actually wondering about the name. Maybe performUnfailing,
> because the standard perform is not really “unsafe” either.
> ​
>
> 2016-05-24 13:17 GMT+02:00 Peter Damoc :
>
>> I would love to have `never` in core and available on elm-lang.org/try
>>
>> Or have
>>
>> performSafe: (a -> Cmd msg) -> Task Never a -> Cmd msg
>>
>> Until then, I prefer the universality of NoOp.
>>
>>
>>
>>
>>
>> On Tue, May 24, 2016 at 12:49 PM, Janis Voigtländer <
>> janis.voigtlaen...@gmail.com> wrote:
>>
>>> My standard objection:
>>>
>>> Replace Task.perform (\_ -> NoOp) by Task.perform never, using:
>>>
>>>
>>> http://package.elm-lang.org/packages/elm-community/basics-extra/1.0.0/Basics-Extra#never
>>> ​
>>>
>>> 2016-05-24 11:21 GMT+02:00 Peter Damoc :
>>>
 You should use Process.sleep

 dismissCmd =
 Process.sleep (2 * second)
 |> Task.perform (\_ ->  NoOp) (\_ -> DismissAlert)



 On Tue, May 24, 2016 at 11:56 AM, TheGryzor123 
 wrote:

> I'm still pretty new to Elm so I prefer to ask.
>
> I'm creating a typical alert that says "Action successful!" and want
> it to disappear automatically after 5 seconds.
>
> Should I use Time.every for that?
>
> --
> 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.
>>>
>>
>>
>>
>> --
>> 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.
>



-- 
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] Integer / String Input in HTML

2016-05-24 Thread Herwig Habenbacher
Hello Together,

just stumbled about this in Elm 0.17:

If I only use Strings everything is fine, but as soon as I use an Integer 
in my Model I can't compile...
Shouldn't Elm handle this easily?

Cordially,

Herwig

(See attached file...)



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


DemoInt.elm
Description: Binary data


Re: [elm-discuss] Integer / String Input in HTML

2016-05-24 Thread Thomas Coopman
The Elm compiler is telling you what is wrong.

onInput wants a string (
http://package.elm-lang.org/packages/elm-lang/html/1.0.0/Html-Events#onInput)
instead of an Int.
So the compile gives an error, because your program would break otherwise.
If you want to use an Int, you must transform the int to a string.

On Tue, 24 May 2016 at 14:44 Herwig Habenbacher <
herwig.habenbac...@gmail.com> wrote:

> Hello Together,
>
> just stumbled about this in Elm 0.17:
>
> If I only use Strings everything is fine, but as soon as I use an Integer
> in my Model I can't compile...
> Shouldn't Elm handle this easily?
>
> Cordially,
>
> Herwig
>
> (See attached file...)
>
>
>
> --
> 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] Chrome extension Content Security Policy

2016-05-24 Thread Cezar Halmagean
Hi guys,

  I am trying to write an extension for Chrome and I've stumbled into a 
security issue. I get the following error message:

  Refused to execute inline script because it violates the following 
Content Security Policy directive: "script-src 'self' https://lvh.me:3000";. 
Either the 'unsafe-inline' keyword, a hash 
('sha256-eSfQRhteSlQwLyblZBiFx4pdpvFSsfB22IDT2h2qtWM='), or a nonce 
('nonce-...') is required to enable inline execution.

  If I add the hash to the "content_security_policy" section in the 
manifest.json file, everything is fine but that makes it really hard to 
develop. I would like to find an easier way.

  Note that I am loading the extension into chrome via the local file 
system (not the store).

Thanks,
Cezar

-- 
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: Create an alert that disappears after 5 seconds

2016-05-24 Thread TheGryzor123
Thanks for the answer. How could a task fail for things like getting a 
random number or getting the current date?

-- 
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: Create an alert that disappears after 5 seconds

2016-05-24 Thread Janis Voigtländer
How could a task fail for things like getting a random number or getting
the current date?

It can’t. And that’s what the never in Task.perform never expresses, and
lets the type-checker confirm.
​

2016-05-24 15:41 GMT+02:00 TheGryzor123 :

> Thanks for the answer. How could a task fail for things like getting a
> random number or getting the current date?
>
> --
> 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] Integer / String Input in HTML

2016-05-24 Thread Herwig Habenbacher
Thanks - I was aware of that...

>If you want to use an Int, you must transform the int to a string.
But how to do that and where?

On the view side? How?
>input [ type' "number", placeholder "1", onInput AID ] []

Or on the update side?

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.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Integer / String Input in HTML

2016-05-24 Thread Thomas Coopman
Sorry, I misinterpreted your question.

I would probably do it like this:
The int in your model is fine. The Msg type should still be of AID String
and then you can parse the string to an Int(or Maybe Int) in your update
function.

On Tue, 24 May 2016 at 17:09 Herwig Habenbacher <
herwig.habenbac...@gmail.com> wrote:

> Thanks - I was aware of that...
>
> >If you want to use an Int, you must transform the int to a string.
> But how to do that and where?
>
> On the view side? How?
> >input [ type' "number", placeholder "1", onInput AID ] []
>
> Or on the update side?
>
> 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.
> 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] Integer / String Input in HTML

2016-05-24 Thread Herwig Habenbacher
Thanks!

The Solution just don't look that nice ;-)

update : Msg -> Applications -> Applications
>>
>> update action model =
>>
>>   case action of
>>
>> AID app ->
>>
>>   { model | appID = String.toInt app |> Result.toMaybe |> 
>>> Maybe.withDefault 0 }
>>
>>
>>> Name nname ->
>>
>>   { model | name = nname }
>>
>>
>>> ClientID cid ->
>>
>>   { model | clientID = cid }
>>
>>
>>

-- 
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: Union type list

2016-05-24 Thread Mark Hamburg
Whenever you accessed the list, you would get an element of type A | B. To use 
if further, you would need to type case it, pass it to something that wanted A| 
B or A | B | C etc, or put it through some sort of type cast operator that 
could give you a Maybe A or a Maybe B. Elm, of course, doesn't do any of those 
things, so this note is just to say that one could design a language that did. 
The "win" in this case would be to make it easier to create composite types — 
e.g., a value, an error, or nothing which isn't really quite the same in usage 
as either a Maybe (Result e t) or a Result e (Maybe t).

Mark

> On May 22, 2016, at 1:59 PM, Leroy Campbell  wrote:
> 
> I assume if it were possible to have lists with mixed types, you'd lose some 
> algebraic guarantees. How would you use such a list? There's probably another 
> way to accomplish the same thing while retaining type safety.
> 
>> On Friday, May 20, 2016 at 1:41:38 PM UTC-4, John Orford wrote:
>> Why isn't something like
>> 
>> List (A | B)
>> 
>> possible?
> 
> -- 
> 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] Integer / String Input in HTML

2016-05-24 Thread Thomas Coopman
I do not completely agree that the solution is not so nice.
The app can return an invalid string and here you are enforced to do
something with it explicitly.

You do have to check if this implementation is acceptable for you, because
now, when the user enters an invalid string, you will change his text to 0.
So if the user types 123a, you will revert his input to 0. It's probably
better to keep his input and put a parsed Int in the model too.


On Tue, 24 May 2016 at 17:43 Herwig Habenbacher <
herwig.habenbac...@gmail.com> wrote:

> Thanks!
>
> The Solution just don't look that nice ;-)
>
> update : Msg -> Applications -> Applications
>>>
>>> update action model =
>>>
>>>   case action of
>>>
>>> AID app ->
>>>
>>>   { model | appID = String.toInt app |> Result.toMaybe |>
 Maybe.withDefault 0 }
>>>
>>>
 Name nname ->
>>>
>>>   { model | name = nname }
>>>
>>>
 ClientID cid ->
>>>
>>>   { model | clientID = cid }
>>>
>>>
>>> --
> 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] Elm 0.16 access

2016-05-24 Thread Mark Hamburg
I was talking with coworkers about my team's experiments with Elm and I found 
myself having to blunt their interest because of the current state of Elm 0.17 
— documentation still has holes, tutorials haven't had a chance to arise, some 
functionality is still missing relative to 0.16, etc. This wouldn't have been a 
problem in some other languages I've advocated for in the past — e.g., Lua — 
because I could have said "Elm 0.17 is out and it looks like a big step 
forward. However, some pieces are missing and there isn't a lot of material 
about it yet, so depending on what you want to do, you may find it easier right 
now to start with 0.16 while the community transitions." Except I can't really 
say that because access to 0.16 has become much harder. For example, one can no 
longer just go to the web site and browse the documentation for 0.16. (Or if 
one can, it's pretty buried.) Contrast this with Lua where the 5.1 (released in 
2006) reference manual is available at online at lua.org and older versions are 
available as archives. This leaves me with a problem when it comes to 
advocating for Elm and when I explain the situation to people their response is 
along the lines of suggesting that the Elm community can't be trusted not to 
pull the rug out from under one.

So, while I'm mostly interested in seeing 0.17 get fleshed out, I think having 
a link on the front page of elm-lang.org that would take one back to the 0.16 
world would be a good thing while 0.17 matures.

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] Trigger child action from parent

2016-05-24 Thread TheGryzor123
I created a child component that is supposed to display notifications 
coming from the parent.

I know how to initialize and listen to a child but here I would like to 
tell him to execute actions for me.

What do you suggest me to do?

-- 
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] Making new Cmds

2016-05-24 Thread Wil C
It's just an aside, in case someone searches for it. Here's how to make new 
commands:

Cmd.map (\_ -> NewMsg) Cmd.none

It wasn't obvious to me.

Wil

-- 
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] Integer / String Input in HTML

2016-05-24 Thread Nick H
Result has its own withDefault function. You do not need to convert the
Result to a Maybe.

On Tue, May 24, 2016 at 9:15 AM, Thomas Coopman 
wrote:

> I do not completely agree that the solution is not so nice.
> The app can return an invalid string and here you are enforced to do
> something with it explicitly.
>
> You do have to check if this implementation is acceptable for you, because
> now, when the user enters an invalid string, you will change his text to 0.
> So if the user types 123a, you will revert his input to 0. It's probably
> better to keep his input and put a parsed Int in the model too.
>
>
> On Tue, 24 May 2016 at 17:43 Herwig Habenbacher <
> herwig.habenbac...@gmail.com> wrote:
>
>> Thanks!
>>
>> The Solution just don't look that nice ;-)
>>
>> update : Msg -> Applications -> Applications

 update action model =

   case action of

 AID app ->

   { model | appID = String.toInt app |> Result.toMaybe |>
> Maybe.withDefault 0 }


> Name nname ->

   { model | name = nname }


> ClientID cid ->

   { model | clientID = cid }


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

-- 
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] Making new Cmds

2016-05-24 Thread Janis Voigtländer
This is not doing what you almost certainly think it does.
​

2016-05-24 18:44 GMT+02:00 Wil C :

> It's just an aside, in case someone searches for it. Here's how to make
> new commands:
>
> Cmd.map (\_ -> NewMsg) Cmd.none
>
> It wasn't obvious to me.
>
> Wil
>
> --
> 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] Static Tzpe Checking in Elm vs Java

2016-05-24 Thread John Orford
Can someone /wittily/ sum up the experience of type checking in Java vs
something pure like Elm?

I feel purity, preciseness and descriptiveness is the main difference
somehow...

Java is too long in the distant past for me, but it's something I love
about Elm and never really cared for in languages like Java etc.

-- 
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] interesting article

2016-05-24 Thread Nick H
Peter's description is very close to how I manage states in my code. It
never occurred to me that it might have its own name; it just seemed the
most natural way to manage states within the Elm Architecture.

The model is a union type. The action is a union type. The update function
is just a case statement, so actions that are nonsensical for the model
state can be easily ignored.

As far as I can tell, Dubray's criticism of the Elm Architecture is
summarized in this quote:

"That assertion is erroneous. You would be missing a couple of important
parts:
- the logic that decides which state you are in so you can properly compute
the view and enable the actions associated to the state
- the next action predicate"

The first point of complaint is that both the update and view functions
need a case statement.
The second point of complaint is that ... I am not sure. It seems to me
that Elm's Effects are filling the role of Dubray's next action predicate
just fine.

These seem like aesthetic differences, so I am sure there is some point
that I am missing. What would need to change in the Elm architecture for it
to match SAM?

On Tue, May 24, 2016 at 1:22 AM, Peter Damoc  wrote:

> Aligning Elm with TLA+ will make it even more solid from a theoretical
> point of view.
>
> SAM sounds very intriguing. I'm wondering if SAM couldn't be implemented
> in terms of TEA using a tagged union as Model.
>
> something like this:
> https://gist.github.com/pdamoc/c96714479d9f531fbc7468d5670ef576
>
>
>
>
> On Tue, May 24, 2016 at 8:51 AM, Stefan Houtzager <
> stefan.houtza...@gmail.com> wrote:
>
>> I am interested in learning elm. I just read an article from Jean-Jacques
>> Dubray. He thinks an alignment with "SAM" would make elm stronger:
>> https://www.infoq.com/articles/no-more-mvc-frameworks#anch133142.
>> Discussions: https://gitter.im/jdubray/sam.
>> What do you think? Might it be interesting to start a discussion
>> with Jean-Jacques Dubray?
>>
>> --
>> Kind regards,
>>
>> Stefan Houtzager
>>
>> Houtzager ICT consultancy & development
>>
>> www.linkedin.com/in/stefanhoutzager
>>
>> --
>> 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] interesting article

2016-05-24 Thread Stefan Houtzager
> What would need to change in the Elm architecture for it to match SAM?

I'm just someone interested in learning elm, so I cannot answer. Are the 
architects of elm, following these messages, who can? Evan Czaplicki? And 
is this interesting enough to contact Jean-Jacques Dubray, Evan?


Op dinsdag 24 mei 2016 20:30:55 UTC+2 schreef Nick H:
>
> Peter's description is very close to how I manage states in my code. It 
> never occurred to me that it might have its own name; it just seemed the 
> most natural way to manage states within the Elm Architecture.
>
> The model is a union type. The action is a union type. The update function 
> is just a case statement, so actions that are nonsensical for the model 
> state can be easily ignored. 
>
> As far as I can tell, Dubray's criticism of the Elm Architecture is 
> summarized in this quote:
>
> "That assertion is erroneous. You would be missing a couple of important 
> parts:
> - the logic that decides which state you are in so you can properly 
> compute the view and enable the actions associated to the state 
> - the next action predicate"
>
> The first point of complaint is that both the update and view functions 
> need a case statement.
> The second point of complaint is that ... I am not sure. It seems to me 
> that Elm's Effects are filling the role of Dubray's next action predicate 
> just fine.
>
> These seem like aesthetic differences, so I am sure there is some point 
> that I am missing. What would need to change in the Elm architecture for it 
> to match SAM?
>
> On Tue, May 24, 2016 at 1:22 AM, Peter Damoc  > wrote:
>
>> Aligning Elm with TLA+ will make it even more solid from a theoretical 
>> point of view. 
>>
>> SAM sounds very intriguing. I'm wondering if SAM couldn't be implemented 
>> in terms of TEA using a tagged union as Model.
>>
>> something like this:
>> https://gist.github.com/pdamoc/c96714479d9f531fbc7468d5670ef576 
>>
>>
>>
>>
>> On Tue, May 24, 2016 at 8:51 AM, Stefan Houtzager > > wrote:
>>
>>> I am interested in learning elm. I just read an article from 
>>> Jean-Jacques Dubray. He thinks an alignment with "SAM" would make elm 
>>> stronger:  
>>> https://www.infoq.com/articles/no-more-mvc-frameworks#anch133142. 
>>> Discussions: https://gitter.im/jdubray/sam. 
>>> What do you think? Might it be interesting to start a discussion 
>>> with Jean-Jacques Dubray?
>>>
>>> -- 
>>> Kind regards,
>>>
>>> Stefan Houtzager
>>>
>>> Houtzager ICT consultancy & development
>>>
>>> www.linkedin.com/in/stefanhoutzager
>>>
>>> -- 
>>> 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] Static Tzpe Checking in Elm vs Java

2016-05-24 Thread Joey Eremondi
Are you interested in the actual type checking algorithms, or just the type
systems?

Big differences of the type systems:

* Elm has tagged union types, meaning that you can make a value that many
have one of many types, and pattern match on its possible variants.

* Elm has type inference, Java does not. When you declare a variable in
Java, you need to know what type it is. There's no such need in Elm.

* Elm has first-class functions, so variables can have type a -> b, and you
can build arbitrarily complicated types using function types, put them in
tuples, etc.

* Java has classes, subtyping, inheritance, etc. Elm doesn't have that,
because subtyping gets in the way of inference, and because it's not nearly
as necessary when you don't have mutable data.

There are many other differences between the languages, but they're not
necessarily differences in the type system. For example, Java has mutable
variables and Elm does not, but there are strongly typed functional
languages, like ML, which have mutable variables.

As for the actual typechecking algorithms, Elm uses something like Algorithm
W
,
but a more advanced, constraint-based version which helps with speed and
can actually accept a few more programs.
 Typechecking is based on unification.
I can't speak too much about Java, but I imagine they're using something
like abstract interpretation to typecheck.

On Tue, May 24, 2016 at 10:49 AM, John Orford  wrote:

> Can someone /wittily/ sum up the experience of type checking in Java vs
> something pure like Elm?
>
> I feel purity, preciseness and descriptiveness is the main difference
> somehow...
>
> Java is too long in the distant past for me, but it's something I love
> about Elm and never really cared for in languages like Java etc.
>
> --
> 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] interesting article

2016-05-24 Thread James Wilson
My impression from a brief discussion on the gitter chat room 
(https://gitter.im/jdubray/sam) about SAM with the creator is that 
basically if you turn:

update msg model = case msg of 
   Increment -> (model + 1, Cmd.none) 
   Decrement -> (model - 1, someEffect)

into

updateModel msg model = case msg of
   Increment -> model + 1
   Decrement -> model - 1

makeActions model =
  if model == 1 then someEffect else Cmd.none

-- the same signature as my last example so it wires
-- into the elm architecture exactly as it would have before:
update model =
  let newModel = updateModel model
  in (newModel, makeActions newModel)

Thereby decoupling the actions we want to perform from the messages/events 
that led the model to be modified, you'd be on the right track for doing 
SAM in Elm.

To quote Jean-Jacques Dubray re the initial snippet:

"When I look at the code you provided, I see a direct line of sight between 
the events and the effects, and that's what SAM is trying to break."

I'm sure that there's more to it than just this, but other bits (eg that 
actions do all the hard work of turning data into something ready for your 
update function (or model.present in some of his examples) rather than the 
update function doing all of the hard work) basically seem to be the case 
already in Elm. I do wonder about the distinction between the component 
state in Elm (what we call the model) and the application wide state (React 
would call this a Store) and how this relates/tallies up with SAM (and more 
generally how best to structure this into an Elm app, though I have some 
thoughts I'm playing with on this). 


On Tuesday, 24 May 2016 19:47:56 UTC+1, Stefan Houtzager wrote:
>
> > What would need to change in the Elm architecture for it to match SAM?
>
> I'm just someone interested in learning elm, so I cannot answer. Are the 
> architects of elm, following these messages, who can? Evan Czaplicki? And 
> is this interesting enough to contact Jean-Jacques Dubray, Evan?
>
>
> Op dinsdag 24 mei 2016 20:30:55 UTC+2 schreef Nick H:
>>
>> Peter's description is very close to how I manage states in my code. It 
>> never occurred to me that it might have its own name; it just seemed the 
>> most natural way to manage states within the Elm Architecture.
>>
>> The model is a union type. The action is a union type. The update 
>> function is just a case statement, so actions that are nonsensical for the 
>> model state can be easily ignored. 
>>
>> As far as I can tell, Dubray's criticism of the Elm Architecture is 
>> summarized in this quote:
>>
>> "That assertion is erroneous. You would be missing a couple of important 
>> parts:
>> - the logic that decides which state you are in so you can properly 
>> compute the view and enable the actions associated to the state 
>> - the next action predicate"
>>
>> The first point of complaint is that both the update and view functions 
>> need a case statement.
>> The second point of complaint is that ... I am not sure. It seems to me 
>> that Elm's Effects are filling the role of Dubray's next action predicate 
>> just fine.
>>
>> These seem like aesthetic differences, so I am sure there is some point 
>> that I am missing. What would need to change in the Elm architecture for it 
>> to match SAM?
>>
>> On Tue, May 24, 2016 at 1:22 AM, Peter Damoc  wrote:
>>
>>> Aligning Elm with TLA+ will make it even more solid from a theoretical 
>>> point of view. 
>>>
>>> SAM sounds very intriguing. I'm wondering if SAM couldn't be implemented 
>>> in terms of TEA using a tagged union as Model.
>>>
>>> something like this:
>>> https://gist.github.com/pdamoc/c96714479d9f531fbc7468d5670ef576 
>>>
>>>
>>>
>>>
>>> On Tue, May 24, 2016 at 8:51 AM, Stefan Houtzager >> > wrote:
>>>
 I am interested in learning elm. I just read an article from 
 Jean-Jacques Dubray. He thinks an alignment with "SAM" would make elm 
 stronger:  
 https://www.infoq.com/articles/no-more-mvc-frameworks#anch133142. 
 Discussions: https://gitter.im/jdubray/sam. 
 What do you think? Might it be interesting to start a discussion 
 with Jean-Jacques Dubray?

 -- 
 Kind regards,

 Stefan Houtzager

 Houtzager ICT consultancy & development

 www.linkedin.com/in/stefanhoutzager

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

Re: [elm-discuss] interesting article

2016-05-24 Thread Nick H
Cool, thanks for that example. I can see the advantage of decoupling the
actions from the effects.

Even without being enforced by the core platform, I think an Elm programmer
could follow this pattern without too much trouble. Much in the same way
that the current platform architecture was originally built on top of the
old Signal.foldp, I bet SAM could be implemented as a library. Would be an
interesting experiment :-)

On Tue, May 24, 2016 at 12:42 PM, James Wilson  wrote:

> My impression from a brief discussion on the gitter chat room (
> https://gitter.im/jdubray/sam) about SAM with the creator is that
> basically if you turn:
>
> update msg model = case msg of
>Increment -> (model + 1, Cmd.none)
>Decrement -> (model - 1, someEffect)
>
> into
>
> updateModel msg model = case msg of
>Increment -> model + 1
>Decrement -> model - 1
>
> makeActions model =
>   if model == 1 then someEffect else Cmd.none
>
> -- the same signature as my last example so it wires
> -- into the elm architecture exactly as it would have before:
> update model =
>   let newModel = updateModel model
>   in (newModel, makeActions newModel)
>
> Thereby decoupling the actions we want to perform from the messages/events
> that led the model to be modified, you'd be on the right track for doing
> SAM in Elm.
>
> To quote Jean-Jacques Dubray re the initial snippet:
>
> "When I look at the code you provided, I see a direct line of sight
> between the events and the effects, and that's what SAM is trying to break."
>
> I'm sure that there's more to it than just this, but other bits (eg that
> actions do all the hard work of turning data into something ready for your
> update function (or model.present in some of his examples) rather than the
> update function doing all of the hard work) basically seem to be the case
> already in Elm. I do wonder about the distinction between the component
> state in Elm (what we call the model) and the application wide state (React
> would call this a Store) and how this relates/tallies up with SAM (and more
> generally how best to structure this into an Elm app, though I have some
> thoughts I'm playing with on this).
>
>
> On Tuesday, 24 May 2016 19:47:56 UTC+1, Stefan Houtzager wrote:
>>
>> > What would need to change in the Elm architecture for it to match SAM?
>>
>> I'm just someone interested in learning elm, so I cannot answer. Are the
>> architects of elm, following these messages, who can? Evan Czaplicki? And
>> is this interesting enough to contact Jean-Jacques Dubray, Evan?
>>
>>
>> Op dinsdag 24 mei 2016 20:30:55 UTC+2 schreef Nick H:
>>>
>>> Peter's description is very close to how I manage states in my code. It
>>> never occurred to me that it might have its own name; it just seemed the
>>> most natural way to manage states within the Elm Architecture.
>>>
>>> The model is a union type. The action is a union type. The update
>>> function is just a case statement, so actions that are nonsensical for the
>>> model state can be easily ignored.
>>>
>>> As far as I can tell, Dubray's criticism of the Elm Architecture is
>>> summarized in this quote:
>>>
>>> "That assertion is erroneous. You would be missing a couple of important
>>> parts:
>>> - the logic that decides which state you are in so you can properly
>>> compute the view and enable the actions associated to the state
>>> - the next action predicate"
>>>
>>> The first point of complaint is that both the update and view functions
>>> need a case statement.
>>> The second point of complaint is that ... I am not sure. It seems to me
>>> that Elm's Effects are filling the role of Dubray's next action predicate
>>> just fine.
>>>
>>> These seem like aesthetic differences, so I am sure there is some point
>>> that I am missing. What would need to change in the Elm architecture for it
>>> to match SAM?
>>>
>>> On Tue, May 24, 2016 at 1:22 AM, Peter Damoc  wrote:
>>>
 Aligning Elm with TLA+ will make it even more solid from a theoretical
 point of view.

 SAM sounds very intriguing. I'm wondering if SAM couldn't be
 implemented in terms of TEA using a tagged union as Model.

 something like this:
 https://gist.github.com/pdamoc/c96714479d9f531fbc7468d5670ef576




 On Tue, May 24, 2016 at 8:51 AM, Stefan Houtzager <
 stefan.h...@gmail.com> wrote:

> I am interested in learning elm. I just read an article from
> Jean-Jacques Dubray. He thinks an alignment with "SAM" would make elm
> stronger:
> https://www.infoq.com/articles/no-more-mvc-frameworks#anch133142.
> Discussions: https://gitter.im/jdubray/sam.
> What do you think? Might it be interesting to start a discussion
> with Jean-Jacques Dubray?
>
> --
> Kind regards,
>
> Stefan Houtzager
>
> Houtzager ICT consultancy & development
>
> www.linkedin.com/in/stefanhoutzager
>
> --
> You received this message because you are subscribed to the Goog

[elm-discuss] program crashes when standalone but not within elm-reactor

2016-05-24 Thread Fernando Alegre
Is this a known issue? I have some code that works fine when I run it with 
elm-reactor, but when I try to compile it with elm-make and load the 
index.html file into the browser I get a blank screen and a couple of 
JavaScript console errors:

index.html:8729 Uncaught TypeError: Cannot read property 'appendChild' of 
nullrealHtmlHeight @ index.html:8729(anonymous function) @ index.html:8706
_user$project$Plot$vbounds
@index.html:11093(anonymous function) @ index.html:11514(anonymous 
function) @ index.html:11677

index.html:11678 Uncaught ReferenceError: Elm is not defined

The error seems to be produced by the "evancz/elm-graphics" package, as 
there is where the "realHtmlHeight" is located. It could be because I am 
trying to read the height of an empty element, but what is puzzling me is 
that it works with elm-reactor.

Should not both the standalone and elm-reactor either succeed or fail?

-- 
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] Static Tzpe Checking in Elm vs Java

2016-05-24 Thread Zachary Kessin
A major issue is the "Maybe". In Java a type can be null so you always have
to check for that. WHile in Elm there is difference between "Maybe User"
and "User". So the type system will prevent any form of null pointer
exception.

Zach
ᐧ

On Tue, May 24, 2016 at 10:06 PM, Joey Eremondi 
wrote:

> Are you interested in the actual type checking algorithms, or just the
> type systems?
>
> Big differences of the type systems:
>
> * Elm has tagged union types, meaning that you can make a value that many
> have one of many types, and pattern match on its possible variants.
>
> * Elm has type inference, Java does not. When you declare a variable in
> Java, you need to know what type it is. There's no such need in Elm.
>
> * Elm has first-class functions, so variables can have type a -> b, and
> you can build arbitrarily complicated types using function types, put them
> in tuples, etc.
>
> * Java has classes, subtyping, inheritance, etc. Elm doesn't have that,
> because subtyping gets in the way of inference, and because it's not nearly
> as necessary when you don't have mutable data.
>
> There are many other differences between the languages, but they're not
> necessarily differences in the type system. For example, Java has mutable
> variables and Elm does not, but there are strongly typed functional
> languages, like ML, which have mutable variables.
>
> As for the actual typechecking algorithms, Elm uses something like Algorithm
> W
> ,
> but a more advanced, constraint-based version which helps with speed and
> can actually accept a few more programs.
>  Typechecking is based on unification.
> I can't speak too much about Java, but I imagine they're using something
> like abstract interpretation to typecheck.
>
> On Tue, May 24, 2016 at 10:49 AM, John Orford 
> wrote:
>
>> Can someone /wittily/ sum up the experience of type checking in Java vs
>> something pure like Elm?
>>
>> I feel purity, preciseness and descriptiveness is the main difference
>> somehow...
>>
>> Java is too long in the distant past for me, but it's something I love
>> about Elm and never really cared for in languages like Java etc.
>>
>> --
>> 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.
>



-- 
Zach Kessin
Your CRM Link

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.


[elm-discuss] what's the preferred way to implement the submit mentioned in elm guide?

2016-05-24 Thread 诺铁
hi,

in http://guide.elm-lang.org/architecture/user_input/forms.html , there is
an exercise:

   - Add a "Submit" button. Only show errors *after* it has been pressed.

I tried and find it not as easy as I thought. I have to put color and
message in the model, I put the result code here:
https://gist.github.com/notyy/d2f9fb4087e26d42e450a956c51f054d

it works, but...
would anyone please help me review the code and give me some hints?

-- 
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: what's the preferred way to implement the submit mentioned in elm guide?

2016-05-24 Thread Magnus Rundberget
I was about to write up in detail how you could do it, but that would take 
away some learning from you so here are some ideas:

- Putting color in the model strikes me as a bad idea, that should be a 
view concern that should be possible to derive from the model
- Maybe you could try to define a type describing a validation result 
(maybe containing None, Error String and OK). Look at your Msg type for a 
little inspiration
- Have a validation function that takes the model as input and return a 
validation result (type) 
- Have a viewValidation function that based on the current value of 
validationResult in your model displays either an error with color or ok 
(or nothing in the case of not having validated anything yet).

give it a try, and if you are stuck we can go from there !

cheers
-magnus



On Wednesday, 25 May 2016 05:01:17 UTC+2, 大魔头 wrote:
>
> hi, 
>
> in http://guide.elm-lang.org/architecture/user_input/forms.html , there 
> is an exercise:
>
>- Add a "Submit" button. Only show errors *after* it has been pressed.
>
> I tried and find it not as easy as I thought. I have to put color and 
> message in the model, I put the result code here: 
> https://gist.github.com/notyy/d2f9fb4087e26d42e450a956c51f054d
>
> it works, but...
> would anyone please help me review the code and give me some hints?
>

-- 
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 0.16 access

2016-05-24 Thread Peter Damoc
Hi Mark,

Elm is in development and minor releases can still break things in a big
way.
This is what happened with the switch from 0.16 to 0.17.
This release got rid of Signals which have been with Elm since its
conception.

Lua's development is in a different stage where you can do minor releases
without big changes and you can still use most of the old code unchanged.

I empathize with the sensation of someone puling the rug from under you
and, having gone through several porting sessions I can tell you that it
looks worst than it actually is.
I'm grateful for the changes made with 0.17 and I personally believe that
something of this magnitude will never happen again in Elm.

Keeping 0.16 available risks delaying further development because resources
would have to be split and allocated to maintaining that branch. Elm is way
too young to afford that kind of split.

That being said, the guide is getting better every day, Evan's tutorials
 already describe a
lot of the functionality in the new paradigm and tutorials/examples from
other people keep popping up.

0.17 is a good time to board the Elm train. :)



On Tue, May 24, 2016 at 7:26 PM, Mark Hamburg  wrote:

> I was talking with coworkers about my team's experiments with Elm and I
> found myself having to blunt their interest because of the current state of
> Elm 0.17 — documentation still has holes, tutorials haven't had a chance to
> arise, some functionality is still missing relative to 0.16, etc. This
> wouldn't have been a problem in some other languages I've advocated for in
> the past — e.g., Lua — because I could have said "Elm 0.17 is out and it
> looks like a big step forward. However, some pieces are missing and there
> isn't a lot of material about it yet, so depending on what you want to do,
> you may find it easier right now to start with 0.16 while the community
> transitions." Except I can't really say that because access to 0.16 has
> become much harder. For example, one can no longer just go to the web site
> and browse the documentation for 0.16. (Or if one can, it's pretty buried.)
> Contrast this with Lua where the 5.1 (released in 2006) reference manual is
> available at online at lua.org and older versions are available as
> archives. This leaves me with a problem when it comes to advocating for Elm
> and when I explain the situation to people their response is along the
> lines of suggesting that the Elm community can't be trusted not to pull the
> rug out from under one.
>
> So, while I'm mostly interested in seeing 0.17 get fleshed out, I think
> having a link on the front page of elm-lang.org that would take one back
> to the 0.16 world would be a good thing while 0.17 matures.
>
> 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.
>



-- 
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] Making new Cmds

2016-05-24 Thread Wil C
It turns out it doesn't. What's the correct way to do this?

Wil

On Tuesday, May 24, 2016 at 10:48:33 AM UTC-7, Janis Voigtländer wrote:
>
> This is not doing what you almost certainly think it does.
> ​
>
> 2016-05-24 18:44 GMT+02:00 Wil C >:
>
>> It's just an aside, in case someone searches for it. Here's how to make 
>> new commands:
>>
>> Cmd.map (\_ -> NewMsg) Cmd.none
>>
>> It wasn't obvious to me.
>>
>> Wil
>>
>> -- 
>> 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] Making new Cmds

2016-05-24 Thread Peter Damoc
succeed : Msg -> Cmd Msg
succeed msg =
Task.perform never (Task.succeed msg)


with `never` from elm-community/basics-extra




On Wed, May 25, 2016 at 9:53 AM, Wil C  wrote:

> It turns out it doesn't. What's the correct way to do this?
>
> Wil
>
> On Tuesday, May 24, 2016 at 10:48:33 AM UTC-7, Janis Voigtländer wrote:
>>
>> This is not doing what you almost certainly think it does.
>> ​
>>
>> 2016-05-24 18:44 GMT+02:00 Wil C :
>>
>>> It's just an aside, in case someone searches for it. Here's how to make
>>> new commands:
>>>
>>> Cmd.map (\_ -> NewMsg) Cmd.none
>>>
>>> It wasn't obvious to me.
>>>
>>> Wil
>>>
>>> --
>>> 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.
>



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