[elm-discuss] Correctly Integrate Elm with Template Engine Backend

2017-02-21 Thread Kiswono Prayogo
Hi, i have a backend service that I wrote in Golang, something like this:

func PageA_RequestHandler(ctx *W.Context) {
  // init things
  if is_ajax {
// handle the API request, render the JSON
return
  }
  // query the initial rows
  values := M.SX{
`rows`: model1.GetRows(10),
  }
  // render the html
  ctx.Render(`page_a_template`,values)
}

then the template file `page_a_template.html` (that loaded at the first 
time it rendered), is a html file, with content something like this:



  var rows = {/* rows */};
  new GridBuilder('grid',rows);


Where's:

{/* rows */} is my javascript-friendly template syntax, there are some 
other syntax like: [/* foo */] or /*! bar */ or #{yay}
new GridBuilder is my custom javascript component that creates something 
like datatables.net or editablegrid.net

The question is, if I use Elm, what's the correct way to inject the {/* 
rows */} into the compiled html?

-- 
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: Is Elm weekly still up?

2017-02-21 Thread Vlad GURDIGA
Nice! Thank you! 8-)

-- 
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: Divide by zero?

2017-02-21 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, February 21, 2017 at 11:43:49 AM UTC, Jakub Hampl wrote:
>
> If you have such a case where correctness is much more important than 
> ergonomics, nothing is stopping you from creating your own type that 
> performs maths safely and using it through out your app. 
>
> For many apps the ergonomic impact of that would be too large, so this is 
> not done.
>

Fair enough. I had a look in the github issues and divide by zero and some 
other mathematical quirks are already there. These issues are inherited 
from javascript.   

-- 
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: Divide by zero?

2017-02-21 Thread Jakub Hampl
If you have such a case where correctness is much more important than 
ergonomics, nothing is stopping you from creating your own type that 
performs maths safely and using it through out your app. 

For many apps the ergonomic impact of that would be too large, so this is 
not done.

On Tuesday, 21 February 2017 11:22:54 UTC, Rupert Smith wrote:
>
> On Tuesday, February 21, 2017 at 2:19:33 AM UTC, Max Goldstein wrote:
>>
>> I don't think anyone likes that 2 // 0  == 0, but no one has a better 
>> idea.
>>
>
> I have a better idea. Make it a runtime error and halt the program. 
>

-- 
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: Divide by zero?

2017-02-21 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, February 21, 2017 at 2:19:33 AM UTC, Max Goldstein wrote:
>
> I don't think anyone likes that 2 // 0  == 0, but no one has a better idea.
>

I have a better idea. Make it a runtime error and halt the program. 

-- 
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] Is type inference in Elm fully decideable?

2017-02-21 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, February 21, 2017 at 2:16:55 AM UTC, Max Goldstein wrote:
>
> Records can still be useful in union types if you have more than a few 
> fields, or multiple fields of the same type. Often you write a function 
> that updates a record by looking at a select few fields and it never needs 
> to know about others. Occasionally you will have multiple records of this 
> sort. So you can pipe the different records in different cases to the same 
> function to handle that part of the update, and then other logic to handle 
> whatever else needs to happen.
>

Yes, I think that is what I was trying to say with "except for the simple 
case where you want to write a function that projects the fields of a 
record onto a sub set". It is handy to be able to write a function like 
this:

justNeedSomeFields { field1, field2 } = ..

and for the compiler to accept that function in all the obvious places that 
it should be allowed. 

Beyond that though, I don't see extensible records as being of any use at 
all. In particular declarations like this:

type alias WithPosition = { a | rect: Rectangle, yOffset: Float }

are just leading to problems and making things harder than they should be.

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