Re: [elm-discuss] Add css classes to existing html nodes

2017-06-08 Thread Peter Damoc
Hi Eike and welcome to Elm.

You could add some kind of a class to the div that's holding the markdown
generated html and use that as a selector.

If you need something more complex than that, you might need to use html
inside the markdown

Here is how to do both:
https://ellie-app.com/3r5tc7YsmmCa1/1




On Fri, Jun 9, 2017 at 2:13 AM,  wrote:

> Hallo Elm users,
>
> I'm creating my first app with Elm, and I'm really enjoying it. I'm using
> the markdown package to generate html from user input. I'd like to add css
> classes to certain (i.e. to tables) elements generated by this library. I
> didn't find a way to do this. Is this possible?
>
> Thank you and regards
> Eike
>
> --
> 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] Re: Adding CSS produced by a view function to the document's

2017-06-08 Thread Francesco Orsenigo

The idea is to keep a set of all the rules added to the header, add only 
those that are missing and never remove any.
This will not work for for rules whose definitions are changed dynamically, 
but seems like an acceptable trade off.

The ability to calculate all the styles that *might* appear would have the 
same limitation.


On Friday, June 9, 2017 at 2:41:32 PM UTC+10, Aaron VonderHaar wrote:
>
> I experimented with some ways to have view functions that return both Html 
> and the necessary styles.  I found I could make it work, but I ultimately 
> abandoned the idea because of a fundamental problem:
>
> view model =
> if model.showWidget then
> Widget.view model.widgetData
> else
> text ""
>
> In the code above, depending on the model, you may or may not call 
> Widget.view.  If your view functions are some new type that includes the 
> necessary styles, then you now have a problem that you will only know about 
> the styles for views that are currently visible, which means that your 
> final stylesheet will constantly be changing as the model changes.
>
> What we really want is to get all the styles for all Html that *might* 
> appear, not for all Html that currently appears.  I suspect an API could be 
> designed that would allow such Html+styles views to be composed in a way 
> that could provide *all*possible*styles*, but I expect it would probably be 
> a significant departure from how Html-only views work, so I haven't pursued 
> that idea further.
>
> At NoRedInk, we have an idea for a way to look at an entry point Elm file 
> and traverse all of the imported modules, collect all of the top-level 
> Stylesheets (similar to what the latest elm-test does for Test 
> definitions), and compile a .css file that we can reference in the  
> (but this would be done outside of Elm).  However, that idea is also 
> currently in a state of haven't-yet-pursued-further.
>
> On Thu, Jun 8, 2017 at 4:38 AM, Kevin Yank  > wrote:
>
>> The style-elements 
>>  
>> package introduced at Elm Europe today needs to solve this problem too. For 
>> now, it too is just rendering an invalid 

Re: [elm-discuss] Re: Adding CSS produced by a view function to the document's

2017-06-08 Thread Aaron VonderHaar
I experimented with some ways to have view functions that return both Html
and the necessary styles.  I found I could make it work, but I ultimately
abandoned the idea because of a fundamental problem:

view model =
if model.showWidget then
Widget.view model.widgetData
else
text ""

In the code above, depending on the model, you may or may not call
Widget.view.  If your view functions are some new type that includes the
necessary styles, then you now have a problem that you will only know about
the styles for views that are currently visible, which means that your
final stylesheet will constantly be changing as the model changes.

What we really want is to get all the styles for all Html that *might*
appear, not for all Html that currently appears.  I suspect an API could be
designed that would allow such Html+styles views to be composed in a way
that could provide *all*possible*styles*, but I expect it would probably be
a significant departure from how Html-only views work, so I haven't pursued
that idea further.

At NoRedInk, we have an idea for a way to look at an entry point Elm file
and traverse all of the imported modules, collect all of the top-level
Stylesheets (similar to what the latest elm-test does for Test
definitions), and compile a .css file that we can reference in the 
(but this would be done outside of Elm).  However, that idea is also
currently in a state of haven't-yet-pursued-further.

On Thu, Jun 8, 2017 at 4:38 AM, Kevin Yank  wrote:

> The style-elements
> 
> package introduced at Elm Europe today needs to solve this problem too. For
> now, it too is just rendering an invalid 

[elm-discuss] What is the Elm equivalent of a Data Specification Language (EDN in Closure, ADTs, etc)?

2017-06-08 Thread Gaurav Rampal
Hi,

I am new to Elm, and thank you for your patience with my questions.

Since the emphasis in functional languages is on keeping functions pure it 
seems that an equivalent emphasis must be placed on structuring data. 

Formal computer science has ADT, Lisp has S-expressions, Clojure has EDN. 
So what is the equivalent in Elm? Or should I emphasize understanding the 
basic data structures and Union Types.

Thanks

Gaurav

-- 
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] Is it possible to write a general tree-fold function?

2017-06-08 Thread Vlad GURDIGA
Hi! 

I’m trying to get through the exercises in the Binary Tree example here: 
http://elm-lang.org/examples/binary-tree.

I’ve got to the 4-th and it seems to me like it’s impossible to solve (with 
the understanding I have now).  樂

So, here it goes:

(4) Write a general fold function that acts on trees. The fold
> function does not need to guarantee a particular order of
> traversal.
>
>fold : (a -> b -> b) -> b -> Tree a -> b


…and here is my attempt to solve it:

fold : (a -> b -> b) -> b -> Tree a -> b
> fold f z tree =
> case tree of
>   Empty -> 

z
>   

  Node v left right ->
> let
>   z_ = f v z
>   l_ = fold f z left
>   r_ = fold f z right
> in
>   {- TODO: figure out how to combine the 3 values of type b -}
>   f v z_


The issue I’m stuck with in the last case —​ Node v left right -> — is that 
I now got 3 values of type b which I can’t fold into the final result: f has 
the type of (a -> b -> b), so if the only value of type a here is z, the 
most I can do is one folding operation, but I get another b as a result. 

My question is: How can I fold the 3 values? Or is this approach workable 
at all? What am I missing? 樂

Cheers! 

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Status update and multiple application servers

2017-06-08 Thread machinelearningspeed
Sorry I'm only a beginner and I need to understand this thing at the level of 
software architecture. 

If I'm not wrong, status management (or more generally application logic) is 
implemented in Elm on server side (as opposite to other JavaScript frameworks 
running on client side).

Then how is status consistency guaranteed in a professional enterprise 
environment, in case of load balancing, multiple application servers, etc... 
What if the previous message hits a server and the next another one?

-- 
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] explain how Task works

2017-06-08 Thread machinelearningspeed
Can you explain, at a beginner's level, how Task works in the following 2 
lines under Process.sleep ?


delay : Time.Time -> msg -> Cmd msg
delay time msg =
Process.sleep time
|> Task.andThen (always <| Task.succeed msg)
|> Task.perform identity

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.


[elm-discuss] Add css classes to existing html nodes

2017-06-08 Thread eike . kettner
Hallo Elm users,

I'm creating my first app with Elm, and I'm really enjoying it. I'm using 
the markdown package to generate html from user input. I'd like to add css 
classes to certain (i.e. to tables) elements generated by this library. I 
didn't find a way to do this. Is this possible?

Thank you and regards
Eike

-- 
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: Adding CSS produced by a view function to the document's

2017-06-08 Thread Kevin Yank
The style-elements 
 
package introduced at Elm Europe today needs to solve this problem too. For 
now, it too is just rendering an invalid