[elm-discuss] Re: port module for JS interop.. without main/view ?

2016-07-24 Thread Jörg Winter
Hey thanks for that blog-post about this use-case, exactly what I aimed for 
initially.

Meanwhile I discovered that the Elm.embed(node) interop-variant actually 
makes sense for me so I can use Elm's view afterall.
Works great so far.

-- 
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: port module for JS interop.. without main/view ?

2016-07-24 Thread art yerkes
You do need a main, at the very least to pass init, update and 
subscriptions to the runtime that will iterate your app.  View can return a 
single DOM node and be satisfied.  It won't actually be displayed, but 
needs to be there.

Elm works well in this scenario.  Here's an example I did a while back:

https://medium.com/@prozacchiwawa/the-im-stupid-elm-language-nugget-10-3a9c119ed6f9#.k0ywnnh2f

On Saturday, July 23, 2016 at 3:20:26 PM UTC-7, Jörg Winter wrote:
>
> So I have this port module which lets me invoke elm-actions from JS and 
> get back results into JS
> (Basically I just want to use this elm module like a library of elm 
> functions, no Html rendering needed!)
>
> It seems I have to give it a main function and use Html.App.program, which 
> in turn requires me to define a view function.
>
> Is there any way to expose ports to JS -without- defining a full blown 
> main + view ?
> Just using Elm for implementing a library ?
>
>

-- 
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] port module for JS interop.. without main/view ?

2016-07-24 Thread Jörg Winter
That is exactly what I did in Js ... I calLed that worker() function, assuming 
there was no requirement to have a view.
Yet elm was complaining when I removed the view function from my (port) module.

view is required in Html.App.program

Removing main entirely does not work either.. elm just won't run anything in 
that case.


-- 
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] Why can 'main' have several types?

2016-07-24 Thread Peter Damoc
Elm has parametric polymorphism so, functions can work over types that have
one or more type variables.
The type variables are unrestricted BUT, there are three restricted type
variables: number, comparable, appendable.
For example, `number` is restricted to Float and Int.

Maybe it is easier to understand the type of main as one of these
restricted type variables that is restricted to `Html a` and `Program a`.



On Sun, Jul 24, 2016 at 8:58 AM, Duane Johnson 
wrote:

> I was working through Elm in Action (first 2 chapters) today and I
> realized I don't understand how `main` can be of type `Html.Html`:
>
> main =
>>   div [ class "content" ] [ text "Photo Groove" ]
>
>
> In the documentation for `Platform
> `
> it says:
>
> Every Elm project will define main to be some sort of `Program`.
>
>
> Is `Html.Html` a kind of `Program`? Is there some kind of magic going on
> here? Thanks!
>
> Duane
>
> --
> 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] Why can 'main' have several types?

2016-07-24 Thread Janis Voigtländer
No, Html.Html is not related to Program. That Html.Html is permitted as
type of main is special-cased “magic”. It’s useful, for example, to give
SSCCE s when writing bug reports.
​

2016-07-24 7:58 GMT+02:00 Duane Johnson :

> I was working through Elm in Action (first 2 chapters) today and I
> realized I don't understand how `main` can be of type `Html.Html`:
>
> main =
>>   div [ class "content" ] [ text "Photo Groove" ]
>
>
> In the documentation for `Platform
> `
> it says:
>
> Every Elm project will define main to be some sort of `Program`.
>
>
> Is `Html.Html` a kind of `Program`? Is there some kind of magic going on
> here? Thanks!
>
> Duane
>
> --
> 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.