Re: [elm-discuss] Compiling down to webassembly on the mid/long term horizon?

2016-09-08 Thread ivanceras

I am using elm on the front-end, and rust on the backend for this complex 
webapp

Checkout it out

https://github.com/ivanceras/curtain


On Wednesday, March 23, 2016 at 8:38:59 AM UTC+8, Andrea Cabral wrote:
>
> Hey Lance thanks for your answer. I feel like that might give elm a push. 
>
> Would love to see elm being chosen more often among devs for building web 
> apps.  
>
> Andrea
>
> On 20 March 2016 at 18:32, Lance Halvorsen  > wrote:
>
>> Hi Andrea,
>>
>> As I understand it, WebAssembly currently has no garbage collection. 
>> Until that changes, its use will be limited to languages that do their own 
>> memory management. Elm is not one of those languages.
>>
>> Cheers,
>> .L
>>
>> On Sun, Mar 20, 2016 at 6:05 PM, Andrea Cabral > > wrote:
>>
>>> Hi,
>>>
>>> Just wanted to know where Elm stands regarding to webAssembly? Anyone 
>>> aware of development work in that direction? 
>>>
>>> Maybe it is a stupid question, sorry about that if it is. Still new to 
>>> the field.
>>> Love Elm by the way, amazing job and my thanks to the community!
>>>
>>> Best,
>>> Andrea 
>>>
>>> -- 
>>> 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 a topic in the 
>> Google Groups "Elm Discuss" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/elm-discuss/htUtzdcWky0/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: elm-mdl only one dialog per application?

2016-09-08 Thread 'Rupert Smith' via Elm Discuss
On Thursday, September 8, 2016 at 8:24:01 PM UTC+1, OvermindDL1 wrote:
>
> > I also notice in the Elm demo that the dialog gets hoisted out of the 
> Dialog tab and placed at the top of the page, something to do with the 
> limitations of the dialog polyfill. 
>
> Polyfill stuff yep, dialogs need to be 'global'.  HTML5 dialogs are odd, 
> and would be less odd if browsers followed the spec, but eh...
>

Not sure it really needs to be 'global' at the top of the page. The 
limitations also say you can set "position: fixed" on it:

https://github.com/GoogleChrome/dialog-polyfill#limitations

But yeah, thanks for your input, just changing the contents of the one 
dialog sounds like what I should try next.

-- 
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: Elm Runtime Exceptions

2016-09-08 Thread Max Goldstein
I mentioned Maybe.map in my post but did not explain it. Thank you Joey for 
having the patience and insight to do so. 

I'm excited to see if these functions change OP's opinion. 

-- 
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: elm-mdl only one dialog per application?

2016-09-08 Thread OvermindDL1
On Thursday, September 8, 2016 at 12:47:33 PM UTC-6, Rupert Smith wrote:
>
> On Thursday, September 8, 2016 at 7:44:39 PM UTC+1, Rupert Smith wrote:
>>
>> On Thursday, September 8, 2016 at 6:50:30 PM UTC+1, OvermindDL1 wrote:
>>>
>>> It is because you should 'switch' the interface within your dialog to be 
>>> whatever it needs to be at the time.  It is in my opinion a design 
>>> consideration to prevent multiple dialogs from even being capable of 
>>> appearing at the same time, which often breaks sites that do that.
>>>
>>> But yeah, just inside the dialog just draw whatever type of interface is 
>>> appropriate at the time.
>>>
>>
>> Ok, could try that. I suspect that it was not a deliberate design choice 
>> though - just something awkward about implementing dialogs?
>>
>
> Perhaps I am wrong about that: 
>
>
> http://stackoverflow.com/questions/19051408/jquery-dialog-opening-multiple-dialogs
>  
>

Unrelated, that is pure class based not element based.  :-)

`mdl` (and thus `elm-mdl`) uses real html5 dialog: 
 http://www.w3schools.com/tags/tag_dialog.asp

However many browsers are crappy enough to not support html5 that well yet, 
so there is a polyfill you can add (which you probably should), and the 
polyfill has some limitations: 
 https://github.com/GoogleChrome/dialog-polyfill#limitations

And elm-mdl would have to connect a dialog with its id somehow, which is 
'string'y and easy to break (much more easy to break with more than one elm 
app too, hard problem to solve), however the elm style already has the 
concept of 'views' of a single thing that mutate, so they went the realm of 
that you mutate the dialog to contain whatever it should contain.  :-)

> I also notice in the Elm demo that the dialog gets hoisted out of the 
Dialog tab and placed at the top of the page, something to do with the 
limitations of the dialog polyfill. 

Polyfill stuff yep, dialogs need to be 'global'.  HTML5 dialogs are odd, 
and would be less odd if browsers followed the spec, but eh...

-- 
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: elm-mdl only one dialog per application?

2016-09-08 Thread 'Rupert Smith' via Elm Discuss


On Thursday, September 8, 2016 at 7:44:39 PM UTC+1, Rupert Smith wrote:
>
> On Thursday, September 8, 2016 at 6:50:30 PM UTC+1, OvermindDL1 wrote:
>>
>> It is because you should 'switch' the interface within your dialog to be 
>> whatever it needs to be at the time.  It is in my opinion a design 
>> consideration to prevent multiple dialogs from even being capable of 
>> appearing at the same time, which often breaks sites that do that.
>>
>> But yeah, just inside the dialog just draw whatever type of interface is 
>> appropriate at the time.
>>
>
> Ok, could try that. I suspect that it was not a deliberate design choice 
> though - just something awkward about implementing dialogs?
>

Perhaps I am wrong about that: 

http://stackoverflow.com/questions/19051408/jquery-dialog-opening-multiple-dialogs
 

-- 
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: elm-mdl only one dialog per application?

2016-09-08 Thread 'Rupert Smith' via Elm Discuss
On Thursday, September 8, 2016 at 6:50:30 PM UTC+1, OvermindDL1 wrote:
>
> It is because you should 'switch' the interface within your dialog to be 
> whatever it needs to be at the time.  It is in my opinion a design 
> consideration to prevent multiple dialogs from even being capable of 
> appearing at the same time, which often breaks sites that do that.
>
> But yeah, just inside the dialog just draw whatever type of interface is 
> appropriate at the time.
>

Ok, could try that. I suspect that it was not a deliberate design choice 
though - just something awkward about implementing dialogs?

I also notice in the Elm demo that the dialog gets hoisted out of the 
Dialog tab and placed at the top of the page, something to do with the 
limitations of the dialog polyfill. 

So instead I just recode that as hoisting out some fragment of the 
interface and placing that within this top-of-the-page dialog instead? 

-- 
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: elm-mdl only one dialog per application?

2016-09-08 Thread 'Rupert Smith' via Elm Discuss
On Thursday, September 8, 2016 at 6:07:49 PM UTC+1, Rupert Smith wrote:
>
> On Thursday, September 8, 2016 at 4:59:59 PM UTC+1, Rupert Smith wrote:
>>
>> On Thursday, September 8, 2016 at 4:43:24 PM UTC+1, Rupert Smith wrote:
>>>
>>> I noticed this in the package docs:
>>>
>>>- The elm-mdl library currently support only one dialog pr. 
>>>application. Installing more than one dialog will result in a random one 
>>>showing.
>>>
>>> http://package.elm-lang.org/packages/debois/elm-mdl/7.6.0/Material-Dialog
>>>
>>> Is this still true? Is there a workaround, I am planning on using quite 
>>> a few dialogs...
>>>
>>
>> Actually, in this case I just wanted a delete / are you sure ? type of 
>> interaction. A better way might be to add a div below the delete control 
>> that shows something like "delete 5 items are you sure ? confirm" where the 
>> confirm is a button, but to just make that part of the page and not a modal 
>> dialog. Or just make the  "delete" button change to "are you sure?" but 
>> that runs the risk of an accidental double click.
>>
>> Anyway, it would still be nice to have >1 dialog in an application. 
>>
>
> I suppose the question is, is this some inherent limit because of the way 
> Elm works? or is it just because something was hacked together for dialogs 
> that is not really complete yet?
>
> I notice the way to open a dialog is:
>
> Dialog.openOn "click"
>
> I'd expected to find something more like
>
> Button.onClick DialogMsg dialog1
>
> to create a Msg for opening the dialog and then in the 'update' function 
> to respond to that by opening the particular dialog that was selected, 
> something like this
>
> DialogMsg ->
>Dialog.open dialog
>

Or perhaps it would be better if Dialog had properties for 'open' and 
'closed' and they could be chosen appropriately from the model when 
rendering the view:

dialog
 [ if model.showDialog then Dialog.open else Dialog.close ]
 [ ... ]

?

-- 
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: elm-mdl only one dialog per application?

2016-09-08 Thread OvermindDL1
It is because you should 'switch' the interface within your dialog to be 
whatever it needs to be at the time.  It is in my opinion a design 
consideration to prevent multiple dialogs from even being capable of 
appearing at the same time, which often breaks sites that do that.

But yeah, just inside the dialog just draw whatever type of interface is 
appropriate at the time.


On Thursday, September 8, 2016 at 11:07:49 AM UTC-6, Rupert Smith wrote:
>
> On Thursday, September 8, 2016 at 4:59:59 PM UTC+1, Rupert Smith wrote:
>>
>> On Thursday, September 8, 2016 at 4:43:24 PM UTC+1, Rupert Smith wrote:
>>>
>>> I noticed this in the package docs:
>>>
>>>- The elm-mdl library currently support only one dialog pr. 
>>>application. Installing more than one dialog will result in a random one 
>>>showing.
>>>
>>> http://package.elm-lang.org/packages/debois/elm-mdl/7.6.0/Material-Dialog
>>>
>>> Is this still true? Is there a workaround, I am planning on using quite 
>>> a few dialogs...
>>>
>>
>> Actually, in this case I just wanted a delete / are you sure ? type of 
>> interaction. A better way might be to add a div below the delete control 
>> that shows something like "delete 5 items are you sure ? confirm" where the 
>> confirm is a button, but to just make that part of the page and not a modal 
>> dialog. Or just make the  "delete" button change to "are you sure?" but 
>> that runs the risk of an accidental double click.
>>
>> Anyway, it would still be nice to have >1 dialog in an application. 
>>
>
> I suppose the question is, is this some inherent limit because of the way 
> Elm works? or is it just because something was hacked together for dialogs 
> that is not really complete yet?
>
> I notice the way to open a dialog is:
>
> Dialog.openOn "click"
>
> I'd expected to find something more like
>
> Button.onClick DialogMsg dialog1
>
> to create a Msg for opening the dialog and then in the 'update' function 
> to respond to that by opening the particular dialog that was selected, 
> something like this
>
> DialogMsg ->
>Dialog.open dialog
>

-- 
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: Elm Runtime Exceptions

2016-09-08 Thread Dave Ford
Joey. Yours was the best answer. And you already stated it. Sorry for 
making you repeat yourself. Thank you. I will need to 
checkout Maybe.andThen, Result.andThen, Maybe.map and Result.map.

And then see if I still have anything to complain about :)

On Thursday, September 8, 2016 at 10:24:12 AM UTC-7, Joey Eremondi wrote:
>
> @Dave Ford: that's literally what Maybe.andThen and Result.andThen are 
> for. See also Maybe.map, and Result.map.
>
> They let you chain together several computations that may throw an 
> exception. You can take a computation which throws an exception, and a 
> computation which expects a non-exception argument, and compose them into a 
> new computation that throws an exception. Use map when the computation 
> taking the argument throws no exception, and use andThen when it can itself 
> throw an exception.
>
> Using these, you can handle your exceptions as high or as low in the 
> program logic as you'd like. You can let the exceptions bubble up using 
> andThen and map.
>

-- 
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: Elm Runtime Exceptions

2016-09-08 Thread Dave Ford
On Wednesday, September 7, 2016 at 6:26:58 PM UTC-7, Max Goldstein wrote:
>
> Maybe is not an exception, as has been pointed out. *Maybe is a data 
> structure.* It just so happens that it's a data structure that can hold 
> at most one element.
>

Again, I completely understand that Maybe is a data structure and not 
*literally* an exception (like a java exception). And I also get that there 
are many use cases where maybe should really be checked. But their also 
many case where the Nothing case represents the *exception *(not the norm). 
The net result is that exception handling code ends up interleaved within 
my main logic flow.
 

> OP seems to think that bubbled exceptions are a good thing. 
>

I think interleaving exception handling throughout the main business logic 
flow makes code hard to read and is generally an anti-pattern.

Not everyone likes every programming language and you're entitled to your 
> opinion. 
>
I love Elm. I just noticed that I seem to have a lot of exception handling 
interleaved with my primary business logic and am trying to learn how Elm 
addresses this. 

-- 
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: Elm Runtime Exceptions

2016-09-08 Thread Joey Eremondi
@Dave Ford: that's literally what Maybe.andThen and Result.andThen are for.
See also Maybe.map, and Result.map.

They let you chain together several computations that may throw an
exception. You can take a computation which throws an exception, and a
computation which expects a non-exception argument, and compose them into a
new computation that throws an exception. Use map when the computation
taking the argument throws no exception, and use andThen when it can itself
throw an exception.

Using these, you can handle your exceptions as high or as low in the
program logic as you'd like. You can let the exceptions bubble up using
andThen and map.

On Thu, Sep 8, 2016 at 10:21 AM, Dave Ford  wrote:

> The analogous part is the fact you end with "exception handling" code
> interspersed throughout your main logic flow. That part seems very much
> like C to me.
>
> On Wednesday, September 7, 2016 at 1:23:24 PM UTC-7, Nick H wrote:
>>
>> I don't think the comparison to C is accurate at all. Error codes in C
>> are a programming convention. As far as the compiler is concerned, all ints
>> are created equal. Nothing is reminding the programmer to check for error
>> codes.
>>
> --
> 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: Elm Runtime Exceptions

2016-09-08 Thread Dave Ford
The analogous part is the fact you end with "exception handling" code 
interspersed throughout your main logic flow. That part seems very much 
like C to me.

On Wednesday, September 7, 2016 at 1:23:24 PM UTC-7, Nick H wrote:
>
> I don't think the comparison to C is accurate at all. Error codes in C are 
> a programming convention. As far as the compiler is concerned, all ints are 
> created equal. Nothing is reminding the programmer to check for error codes.
>

-- 
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: Elm Runtime Exceptions

2016-09-08 Thread Dave Ford

On Wednesday, September 7, 2016 at 12:49:23 PM UTC-7, Charlie Koster wrote:
>
> Your description of Maybe isn't correct. When a function returns a Maybe 
> it's not throwing an exception. Maybe is a separate type (like String) so 
> when a function returns a Maybe String that is the type of the returned 
> value. It's saying the returned value is one of two things. It's a Nothing, 
> or it's an actual String that you can use.
>

I understand that. That's why I used the phrase "But I would argue that Elm 
does in fact have Runtime Exceptions, even if you don't call it that.". I 
get how Elm works and that Maybe and Result are types. What I mean is that 
Maybe and Result, in some ways, represent the same purpose as an Exception. 
Really more like checked exceptions than runtime exceptions.

-- 
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: html-to-elm

2016-09-08 Thread OvermindDL1
https://github.com/pzavolinsky/elmx is a nice jsx-style pre-compiler for 
elm files too.  Currently the elm compiler does not support plugins so you 
have to call it yourself, but easy to add in to a normal build system.


On Thursday, September 8, 2016 at 7:34:48 AM UTC-6, Rupert Smith wrote:
>
> On Thursday, September 8, 2016 at 1:17:06 PM UTC+1, Wouter In t Velt wrote:
>>
>> Nice tool!
>> Do you plan on adding "style" and other odd shaped Elm attributes like 
>> "disabled" too?
>>
>
> I'm not the author of the html-to-elm tool, just thought I'd post it up 
> here as I didn't see it mentioned in other threads.
>

-- 
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] Inherit function comment

2016-09-08 Thread Janis Voigtländer
I think we are galaxies away from a world where this issue should be a
priority for work on the compiler or other Elm language tools. :-)

2016-09-08 15:31 GMT+02:00 'Thomas Henley' via Elm Discuss <
elm-discuss@googlegroups.com>:

> Browsing the source of the Html.App module in order to see the signature
> of Html.App.map and how it works I read the documentation
> to get a good understanding of the function, which can be seen below
>
> https://github.com/elm-lang/html/blob/1.1.0/src/Html/App.elm#L52
>
>
>> {-| This function is useful when nesting components with [the Elm
>> Architecture](https://github.com/evancz/elm-architecture-tutorial/). It
>> lets
>> you transform the messages produced by a subtree.
>>
>>
>> Say you have a node named `button` that produces `()` values when it is
>> clicked. To get your model updating properly, you will probably want to
>> tag
>> this `()` value like this:
>>
>>type Msg = Click | ...
>>
>>update msg model =
>>  case msg of
>>Click ->
>>  ...
>> view model =
>>  map (\_ -> Click) button
>>
>> So now all the events produced by `button` will be transformed to be of
>> type
>> `Msg` so they can be handled by your update function!
>> -}
>> map : (a -> msg) -> Html a -> Html msg
>> map =
>>   VirtualDom.map
>
>
> I then went and checked out the implementation of VirtualDom.map and
> noticed the comment being identical
> https://github.com/elm-lang/virtual-dom/blob/master/src/VirtualDom.elm#L79
>
> I couldn't help but think, keeping comments between packages in sync has
> to be a pointless task and a waste
> of time, even worse if one updates without the other we have two identical
> functions with different sets of
> documentation.
>
> I'm proposing we have a way of inheriting comments from another function,
> two (maybe possible) ways I could
> think off were
>
> *Alternative version of special doc comment*
>
>> {-> VirtualDom.map -}
>
>
> Instead of a pipe character, using an arrow pointing to the function which
> is being documented
>
> *Version similar to @docs keyword*
>
>> {-| @inherit VirtualDom.node -}
>
>
>
> I'm galaxies away from being experienced in compiler/language design so
> forgive me if this is sounds like
> a ridiculous idea.
>
> --
> 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: Draft blog post - "How to Use Elm at Work" - looking for feedback

2016-09-08 Thread 'Rupert Smith' via Elm Discuss

On Tuesday, September 6, 2016 at 4:08:29 PM UTC+1, Janis Voigtländer wrote:
>
> Thinking about how this might be updated to Elm 0.17, it seems almost 
> impossible to do. Not because of any signal vs. not-signal problems, but 
> simply because of the lack of a declarative graphics API like Graphics 
> that also enables attaching event handlers. That’s what disappeared from 
> elm-graphics when Graphics.Input.* disappeared. Anyway, a Graphics 
> replacement done via SVG would probably address this, because I assume it 
> would support attaching event handlers like onclick and onmouseover to 
> the created graphics nodes just as it works for “normal” (html and svg) 
> nodes now?
>

+1 for getting Graphics ported to SVG + Elm 0.17. 

I'm pretty sure I will go with SVG for the graphical portion of my 
application and not canvas. I also need to combine text + graphics. Not 
sure how I will achieve this yet...

-- 
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] Inherit function comment

2016-09-08 Thread 'Thomas Henley' via Elm Discuss
Browsing the source of the Html.App module in order to see the signature of 
Html.App.map and how it works I read the documentation
to get a good understanding of the function, which can be seen below

https://github.com/elm-lang/html/blob/1.1.0/src/Html/App.elm#L52
 

> {-| This function is useful when nesting components with [the Elm
> Architecture](https://github.com/evancz/elm-architecture-tutorial/). It 
> lets
> you transform the messages produced by a subtree.
>
>
> Say you have a node named `button` that produces `()` values when it is
> clicked. To get your model updating properly, you will probably want to tag
> this `()` value like this:
>
>type Msg = Click | ...
>  
>update msg model =
>  case msg of
>Click ->
>  ...
> view model =
>  map (\_ -> Click) button
>
> So now all the events produced by `button` will be transformed to be of 
> type
> `Msg` so they can be handled by your update function!
> -}
> map : (a -> msg) -> Html a -> Html msg   
> map =
>   VirtualDom.map


I then went and checked out the implementation of VirtualDom.map and 
noticed the comment being identical
https://github.com/elm-lang/virtual-dom/blob/master/src/VirtualDom.elm#L79

I couldn't help but think, keeping comments between packages in sync has to 
be a pointless task and a waste
of time, even worse if one updates without the other we have two identical 
functions with different sets of
documentation.

I'm proposing we have a way of inheriting comments from another function, 
two (maybe possible) ways I could
think off were

*Alternative version of special doc comment*

> {-> VirtualDom.map -}


Instead of a pipe character, using an arrow pointing to the function which 
is being documented

*Version similar to @docs keyword*

> {-| @inherit VirtualDom.node -}



I'm galaxies away from being experienced in compiler/language design so 
forgive me if this is sounds like
a ridiculous idea.

-- 
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: Image navigation and interaction

2016-09-08 Thread Jan Weidner
Thanks for all the suggestions. I skimmed over svg and found out how build 
an image from scratch by drawing circles and polygons etc. However I did 
not spot a function to load an image from file, am I missing something?

On Wednesday, September 7, 2016 at 8:49:08 PM UTC+2, John Bugner wrote:
>
> The old graphics library is here: 
> http://package.elm-lang.org/packages/evancz/elm-graphics/1.0.0
>
> I say 'old' though, because it's been deprecated (and (re)moved from 
> elm-lang's account to Evan's personal account). You should use svg instead. 
> (Also, a warning if you insist on trying to use the canvas: The coordinate 
> system is different from vanilla JS; (0,0) is in the *center* of the canvas 
> instead of the top-left corner.) (The coordinate system of svg is still 
> standard though.)
>
> On Wednesday, September 7, 2016 at 8:29:21 AM UTC-5, Jan Weidner wrote:
>>
>> Thanks! How do I use canvas from elm? Is there a canvas elm example 
>> somewhere?
>>
>> On Wednesday, September 7, 2016 at 3:03:59 PM UTC+2, Charlie Koster wrote:
>>>
>>> The first thing I'll mention is writing your own map application is a 
>>> huge undertaking. But it doesn't hurt to try with Elm :)
>>>
>>> Have you considered rendering that huge map image on a canvas? Image 
>>> manipulation on a canvas might give you better performance.
>>>
>>

-- 
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: html-to-elm

2016-09-08 Thread Wouter In t Velt
Nice tool!
Do you plan on adding "style" and other odd shaped Elm attributes like 
"disabled" too?

-- 
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: Elm Runtime Exceptions

2016-09-08 Thread Wouter In t Velt
Interesting post, but I tend to disagree on a couple of points:

According to the oracle Java tutorial 
, 
an exception is 

> *Definition:* An *exception* is an event, which occurs during the 
> execution of a program, that disrupts the normal flow of the program's 
> instructions.


In Elm, there are types for special cases, such as the Maybe type, which 
can be "nothing". Whether or not we call these "exceptions" is beside the 
point IMHO.

What does matter is IF and HOW the language makes you deal with them.

With Elm, the compiler will tell you if you fail to handle these special 
cases. Elm is built in such a way that 99,999% of the time, your exceptions 
are not allowed to go unchecked to runtime.

In many other languages, handling these special cases is optional, which is 
a bad thing:
If these exceptions show up in tests, it is often harder to locate the 
source, and harder to fix.
Any exceptions which are not covered in tests (a very common scenario), 
lowers the quality of the products we ship and our users suffer.

In my experience, Elm does not force me to handle all special cases at the 
lowest possible level. You are free to pass around Maybe types and Result 
types to wherever you want to handle them,

Or, put another way, if one day Java decided to make *all* exceptions 
> checked, then Java, too, could claim “*no runtime exception”*. But it 
> would make programming much more difficult.


Forcing exceptions to be checked = more code, agreed. But programming 
difficulty = code + debugging + fixing. 
One could easily make the claim that forcing checked exception handling = 
easier programming.
Any ease of programming from unchecked exceptions is really deferred work 
to testing and/or lower quality of shipped product.

-- 
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] html-to-elm

2016-09-08 Thread 'Rupert Smith' via Elm Discuss
I've developed some styling with some static html to demo it. Now finding 
his very useful to turn that HTML into Elm:

http://mbylstra.github.io/html-to-elm/

Rupert

-- 
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: Elm Runtime Exceptions

2016-09-08 Thread Janis Voigtländer
If that is the case, http://elm-lang.org/try has not yet benefitted from
that fix (which is strange, after a couple of months).

2016-09-08 10:30 GMT+02:00 José Lorenzo Rodríguez :

> > String.indices "" "Goodbye, Cruel World!"
>
> Nathan, that's not a error anymore, I submitted a pull request to fix it
> and it was merged a couple months ago.
>
> On Thursday, September 8, 2016 at 10:27:04 AM UTC+2, Nathan Schultz wrote:
>>
>> A run-time error that stung me today is if you accidentally pass an empty
>> string to String.indices. i.e.:
>>
>>
>> String.indices "" "Goodbye, Cruel World!"
>>
>>
>> I would have expected it simply returned a [] rather than just crashing.
>>
> --
> 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: Elm Runtime Exceptions

2016-09-08 Thread Janis Voigtländer
https://github.com/elm-lang/core/issues/708

2016-09-08 10:27 GMT+02:00 Nathan Schultz :

> A run-time error that stung me today is if you accidentally pass an empty
> string to String.indices. i.e.:
>
>
> String.indices "" "Goodbye, Cruel World!"
>
>
> I would have expected it simply returned a [] rather than just crashing.
>
> --
> 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: Elm Runtime Exceptions

2016-09-08 Thread José Lorenzo Rodríguez
> String.indices "" "Goodbye, Cruel World!"

Nathan, that's not a error anymore, I submitted a pull request to fix it 
and it was merged a couple months ago.

On Thursday, September 8, 2016 at 10:27:04 AM UTC+2, Nathan Schultz wrote:
>
> A run-time error that stung me today is if you accidentally pass an empty 
> string to String.indices. i.e.:
>
>
> String.indices "" "Goodbye, Cruel World!"
>
>
> I would have expected it simply returned a [] rather than just crashing.
>

-- 
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: Elm Runtime Exceptions

2016-09-08 Thread Nathan Schultz
A run-time error that stung me today is if you accidentally pass an empty 
string to String.indices. i.e.:


String.indices "" "Goodbye, Cruel World!"


I would have expected it simply returned a [] rather than just crashing.

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