workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
Same. And at least few others here as well. <@Simon> Suggested a workaround here: <https://discourse.elm-lang.org/t/browser-application-doesnt-work-with-popular-analytics-approaches/2659/7>
2019-03-11T05:52:30.786500
Lynne
elmlang
general
I wouldn't say totally undocumented, as it uses ``` type alias Document msg = { title : String , body : List (Html msg) } ``` and the guide says "This gives you control over the &lt;title&gt; and the &lt;body&gt; of the document"
2019-03-11T05:53:12.787100
Nana
elmlang
general
and the docs also link to this post: <https://github.com/elm/browser/blob/1.0.0/notes/navigation-in-elements.md>
2019-03-11T05:55:30.787500
Nana
elmlang
general
Thanks
2019-03-11T06:19:34.788000
Monty
elmlang
general
well `body` is a bit ambiguous in development, but sure. I must say it feels a bit counter-intuitive when you still run your application from JS like this: ``` var app = Elm.Main.init({ node: mountNode, }) ```
2019-03-11T06:24:27.789500
Kitty
elmlang
general
let me read that link
2019-03-11T06:25:27.789900
Kitty
elmlang
general
Ah I guess I dont need that node argument anymore :slightly_smiling_face:
2019-03-11T06:26:36.790500
Kitty
elmlang
general
This is really good! :clap: :clap: :clap: thank u!
2019-03-11T08:36:05.799500
Al
elmlang
general
I’ll need to see at least some of your code to understand what’s going on. Did you copy the `PortFunnels.elm` module from the example? Did you call `PortFunnels.makeFunnelDict` to create a table with your `socketHandler`? Seeing that function may help me. Of course, it would also help to know that your websocket server, at `<ws://localhost:3000/ws/ui>` is actually getting the connection request and properly connecting. Can you add some print statements there to see what’s going on? Do you have another client, perhaps written in Node.js that can successfully connect?
2019-03-11T10:02:14.799700
Granville
elmlang
general
It can also be useful to aim your client code at an echo server, e.g. <wss://echo.websocket.org>, or the simple JS echo server I included with the example. You may also not have the ports configured properly. You should be able to set breakpoints in `site/js/PortFunnel/WebSocket.js` to see the commands come in, e.g. the `dispatcher` function.
2019-03-11T10:05:18.799900
Granville
elmlang
general
And you can instrument the values coming back from the port code. In the example, this would be the `update` branch for the `Process` message, adding `Debug.log`: ``` Process value -&gt; case PortFunnels.processValue funnelDict (Debug.log "Process" value) model.state model ```
2019-03-11T10:09:15.800300
Granville
elmlang
general
So, with fresh eyes I’m thinking the following. my AST looks like: ``` type Style = Bold | Italic | Underline type Styled = Text String (Set Style) | URL String (Set Style) ``` Yes, I have a Set implementation that works on `==`. Ok, so, something like `&lt;whitespace&gt;/&lt;not-whitespace&gt;` will always add Italic to my styles. It’s not a stack, so the next `&lt;not-whitespace&gt;/&lt;whitespace&gt;` pops it off. All styles are popped off at a newline.
2019-03-11T11:06:41.800800
Leoma
elmlang
general
It’s much simpler and more forgiving (I think). I’ll play with this and see how it goes.
2019-03-11T11:07:00.801000
Leoma
elmlang
general
I feel like I can more easily tokenize this with some simple regexps, then parse the output, but can I easily make elm/parser work with tokens instead of strings?
2019-03-11T11:18:59.801300
Leoma
elmlang
general
If you use elm parser for the tokenization, you can just do ``` star = symbol "*" ``` and then use star as a "token"
2019-03-11T11:37:32.801600
Dede
elmlang
general
hmm, I don’t think I did PortFunnels.makeFunnelDict so I’ll see if that helps
2019-03-11T11:57:11.801900
Lynn
elmlang
general
Thinking more -- `run` is defined specifically w.r.t. a String, so you have to tokenize within the Parser framework to use it.
2019-03-11T12:16:40.802100
Dede
elmlang
general
:wave: Where are the docs regarding creating a elm-package.json for a package? I remember seeing a while ago, but can't seem to find it now.
2019-03-11T13:43:26.803400
Maura
elmlang
general
Ah, it's called `elm.json` now isn't it.
2019-03-11T13:44:49.803800
Maura
elmlang
general
I found it! Sorry for the noise. <https://github.com/elm/compiler/blob/master/docs/elm.json/package.md>
2019-03-11T13:45:58.804400
Maura
elmlang
general
My approach is pretty much getting some other project's elm.json and copying it. Then keep fixing stuff while trying to publish until it works...
2019-03-11T13:46:29.805000
Lindsey
elmlang
general
There's a gadget out there for viewing your generated docs before publishing, but I forget what it was. A good thing to do before publishing.
2019-03-11T13:47:30.806000
Lindsey
elmlang
general
here it is: <https://elm-doc-preview.netlify.com/>
2019-03-11T13:47:56.806300
Lindsey
elmlang
general
Oh, that's cool.
2019-03-11T14:07:13.806900
Maura
elmlang
general
That kind of seem like a limitation, but, whatever…
2019-03-11T15:41:57.807400
Leoma
elmlang
general
Has anyone seen something like Prolog’s DCG parsing ported to a pure functional language?
2019-03-11T16:56:12.808300
Leoma
elmlang
general
Oh I'm glad. I was really worried it was going to confuse the stuffing out of you.
2019-03-11T21:16:44.808500
Carlota
elmlang
general
You might want to investigate parsers and pretty printers — two sides of the same coin. There are quite a few articles about such things... seems also related to recursions schemes (with catamorphisms &amp; anamorphisms utilising Algebras and Coalgebras). <http://hackage.haskell.org/package/syntax>
2019-03-11T21:32:12.808700
Carlota
elmlang
general
hey everyone .. an architecture question here. I keep having this need in elm to create an an object and a container of objects. I would like to keep them separate. For example i have An Exchange module.. and I want to create a container that will keep a bunch of this Exchanges in a container of some sort. It can be a list or dict or what not. In some projects i done the equivalent of `module Exchange.Container exposing(..` and in others `module Excahges` in the previous case i have the normal folder structure `/Exchange/Container.elm` and in the other one i have `/Main.elm`, `Exchange.elm` and `Exchanges.elm` The name-spacing works but conceptually is misleading. Is like having the container of exchanges inside the Exchange.. when in fact the Exchange data structure is a child of this container. On the other hand in big apps having all this Exchange, and Exchanges in the main folder starts feeling clunky.. there are usually many such named data structures that live in containers of some kind. What are some good ways you people figured out to structure this conceptual parent child relation at module level? Im thinking is possible there is no right answer but maybe someone has a nicer way of dealing with this which is better then mine.
2019-03-12T02:05:55.817500
Yang
elmlang
general
thanks:)
2019-03-12T02:06:51.817900
Yang
elmlang
general
`module Exchange.Container` seems fine to me
2019-03-12T02:08:39.818200
Earlean
elmlang
general
I don't find it misleading at all, the name spacing of modules as nothing to do with how you use the values of types defined in those modules
2019-03-12T02:09:38.819000
Earlean
elmlang
general
hmm ok, i like it better as well just worried other people might think diferently.
2019-03-12T02:14:00.820500
Yang
elmlang
general
for me is about finding all things related to something in 1 folder.
2019-03-12T02:14:39.821400
Yang
elmlang
general
increases discovery
2019-03-12T02:14:51.821800
Yang
elmlang
general
`module Exchange` is a module that contains code to do with `Exchanges`, It's not strange at all to find code in there that relates to collections of `Exchanges`
2019-03-12T02:15:57.822800
Earlean
elmlang
general
ok, thanks for insight.
2019-03-12T02:16:25.823000
Yang
elmlang
general
Finally started using the `elm/file` package. Feels good to delete all the js we used to have :smile:
2019-03-12T05:15:24.825400
Leonore
elmlang
general
Hello everybody, you still have 2 days to do a CFP to elmeurope
2019-03-12T06:27:38.826800
Valeria
elmlang
general
<https://checkout.eventlama.com/#/events/elm-europe-2019/cfp>
2019-03-12T06:27:51.827000
Valeria
elmlang
general
We are looking for weird stuff (webrtc / maths / realtime explorations for example) as well as real world companies running on elm and how teams work with elm
2019-03-12T06:29:40.828400
Valeria
elmlang
general
Reactionary hacks are the best hacks
2019-03-12T07:05:48.828600
Teri
elmlang
general
Hi people, I am new with ELM and need a help from the community. I have definitions: ``` type Form a = Form FormData type alias FormData = List ( Field, String ) type Field = FirstName String | LastName String | Gender String | Address { street : String, city : String } ... initialFormData : FormData initialFormData = [ ( FirstName "", "" ) , ( LastName "", "" ) , ( Gender "male", "" ) ] init : () -&gt; ( Model, Cmd Msg ) init _ = ( { form = Form initialFormData }, Cmd.none ) ... ``` view: ``` ... [ renderFormInput "First name" &lt;| Html.input [ Attr.type_ "text" , Events.onInput (UpdateFormField &lt;&lt; FirstName) ] [] ... ``` ``` updateFormField : Field -&gt; Form a -&gt; Form a updateFormField field form = case field of FirstName value -&gt; Debug.log "updateFormField" { form | field = value } &lt;------------------------------------HERE IS THE QUESTION LastName value -&gt; form Gender value -&gt; form Address value -&gt; form ``` How can I update the model form state in marked place????? Please help
2019-03-12T07:36:51.831200
Sueann
elmlang
general
``` updateFormField : Field -&gt; Form a -&gt; Form a updateFormField field (Form form) = case field of FirstName value -&gt; Form { form | firstName = value } -- ... ```
2019-03-12T08:03:11.832100
Bert
elmlang
general
Wait, your form data was a list and not a record
2019-03-12T08:04:53.833200
Bert
elmlang
general
I don't understand what the `( Field, String )` means.
2019-03-12T08:06:04.833700
Bert
elmlang
general
What does the string hold?
2019-03-12T08:06:17.834000
Bert
elmlang
general
Anyways, the code I posted would work had your FormData been like this: ``` type alias FormData = { firstName : String , lastName : String , gender : String } ```
2019-03-12T08:08:44.835600
Bert
elmlang
general
May be String holds an error message of the validation function
2019-03-12T08:13:08.836300
Sueann
elmlang
general
So you advise to move from tuples to the records in defenitions?
2019-03-12T08:14:19.836800
Sueann
elmlang
general
Elm europe is not a standard conference. We love emotion, people, and deep feelings. Don’t hesitate if you have something you are passionate about that you want to share with us.
2019-03-12T09:27:27.837900
Valeria
elmlang
general
The $400 travel budget is sadly quite restrictive for many of us
2019-03-12T09:32:31.838700
Kris
elmlang
general
I understand, but we can’t afford more, sorry
2019-03-12T09:36:25.838900
Valeria
elmlang
general
So I totally got sniped by this little challenge problem.
2019-03-12T10:40:51.839200
Dede
elmlang
general
I have written something which is mostly working for bold and italics.
2019-03-12T10:40:59.839500
Dede
elmlang
general
I'm not particularly happy with it.
2019-03-12T10:41:02.839700
Dede
elmlang
general
Yet.
2019-03-12T10:41:05.839900
Dede
elmlang
general
What I wound up doing, at least so far, is using Elm Parser just to tokenize, and then hand-writing the parsing functions that consume the tokens to produce the document.
2019-03-12T10:41:39.840100
Dede
elmlang
general
You can do a lot without backtracking given one token of lookahead, but if you work entirely in the Elm framework chomping the first character of that lookahead token immediately puts you in backtracking land.
2019-03-12T10:43:31.840300
Dede
elmlang
general
I went down a HUGE rabbit hole and read <http://www.cs.nott.ac.uk/~pszgmh/monparsing.pdf> and started implementing my own parser from scratch. I was starting to parse the kind of stuff I wanted but performance was abysmal even for small bits of text. Back to elm/parser with some ideas I got form the process.
2019-03-12T10:44:04.840500
Leoma
elmlang
general
I’m very much in agreement (now) that I can avoid backtracking.
2019-03-12T10:44:34.840700
Leoma
elmlang
general
I'm not sure you can using just elm-parser, is the thing :wink:
2019-03-12T10:44:58.841000
Dede
elmlang
general
What a thread, dudes :slightly_smiling_face:
2019-03-12T10:46:57.841200
Hoa
elmlang
general
Maybe I should go back to optimizing my monadic parsers. :man-facepalming:
2019-03-12T10:48:25.841400
Leoma
elmlang
general
elm/parser is a monadic parser. Are there advantages to looking at the internals?
2019-03-12T10:48:58.841700
Virgie
elmlang
general
Right, it has andThen. Which I can build a bunch of other stuff with. Maybe I need more primitives to make expressing my grammar easier. I just feel like I’m going in circles.
2019-03-12T10:50:29.842100
Leoma
elmlang
general
It seems there are the right pieces in elm/parser, I just can’t seem to fit them together in a way that gets me what I need. Honestly, I’d just pay someone for the right solution so I can get on with the rest of my work.
2019-03-12T10:54:06.842300
Leoma
elmlang
general
So here's what I have in progress: <https://github.com/jhbrown94/elmish-minimarkdown>
2019-03-12T10:55:08.842500
Dede
elmlang
general
pull, run elm reactor, navigate to src/Main.elm
2019-03-12T10:55:20.842700
Dede
elmlang
general
I put it all under MIT license.
2019-03-12T10:55:24.842900
Dede
elmlang
general
Maybe it'll at least give you ideas.
2019-03-12T10:55:30.843100
Dede
elmlang
general
I have a strong urge to refactor the hell out of it, so it will change quickly if I don't abandon it :wink:
2019-03-12T10:55:54.843300
Dede
elmlang
general
Thanks. Getting a 404. Is the repo private?
2019-03-12T10:56:40.843500
Leoma
elmlang
general
So what is the problem exactly? what is the minimal grammar that has the problem? does this still have it? ``` bold ::= '**' (text | italic)* '**' italic ::= '*' (text | bold)* '*' text ::= (\c -&gt; c /= '*')* ```
2019-03-12T11:01:56.843800
Virgie
elmlang
general
It was private, I made it public
2019-03-12T11:02:39.844200
Dede
elmlang
general
I'm getting weird 404s on and off.
2019-03-12T11:02:46.844400
Dede
elmlang
general
<@Virgie> I want to correctly parse stuff like `/italic *and bold* and just italic/ and 4/2=2 and here is a url: <http://foo.bar.com>`
2019-03-12T11:02:54.844600
Leoma
elmlang
general
I'm not sure if there's a settling period, if github's having trouble, or if there's some data issue with my specific repo.
2019-03-12T11:03:18.844800
Dede
elmlang
general
In any case, <@Virgie>, for whatever reason, I’m having trouble putting my thoughts into Elm + elm/parser code.
2019-03-12T11:06:29.845200
Leoma
elmlang
general
The hard part isn't the grammar for correctly formatted code.
2019-03-12T11:06:59.845400
Dede
elmlang
general
The hard part is tolerating malformatted code cleanly.
2019-03-12T11:07:08.845600
Dede
elmlang
general
"*hello world*" is easy
2019-03-12T11:07:15.845800
Dede
elmlang
general
"*hello world /how are you/" is less so
2019-03-12T11:07:23.846000
Dede
elmlang
general
Can you try the repo again?
2019-03-12T11:08:14.846200
Dede
elmlang
general
I just had to flush my github cookies and log in again and things settled down.
2019-03-12T11:08:23.846400
Dede
elmlang
general
changing private-&gt;public may be rare enough that they cache some bad state?
2019-03-12T11:08:37.846600
Dede
elmlang
general
I don't know.
2019-03-12T11:08:38.846800
Dede
elmlang
general
I can see it. Thanks.
2019-03-12T11:10:44.847000
Leoma
elmlang
general
Awesome.
2019-03-12T11:11:30.847600
Dede
elmlang
general
It is not pretty at all. I have ideas, but feedback is always welcome.
2019-03-12T11:11:55.848000
Dede
elmlang
general
Hi! I found a bug in a package, and was able to fix it by modifying the downloaded package source. I forked the project on github to create a pull request. But I can’t figure out how to get my main Elm project to use the forked version of the package to test that my fix actually works. Is there a way to do this?
2019-03-12T11:14:44.849900
Shavonda
elmlang
general
Ya, I have similar-ish ideas. ``` type Style = Bold | Italic | Underline type Styles = Set Style ``` then ``` parseText : Styles -&gt; Parser Styled ``` so if parseText encounters a ` close italic/` but Italic isn’t in Styles, then it’s treated as text. Then, if I see an openItalic, and I’m not italic, then do one of (parse openItalic, parse Styled content, parse close italics) OR (parse the open italic as text, parse styled content)
2019-03-12T11:16:37.852000
Leoma
elmlang
general
The only way is to remove the original package from the `elm.json` and manually add the forked package into your source directory. You can use the `"source-directories"` field there to e.g. to add a `"vendor"` directory.
2019-03-12T11:17:21.853000
Jin
elmlang
general
But I don’t have compiling code at the moment. Just a pile of half-coded thoughts.
2019-03-12T11:17:50.853600
Leoma
elmlang
general
Or you could publish your fork as a package, but that would clutter the ecosystem.
2019-03-12T11:18:25.855200
Jin
elmlang
general
Ok, thanks. I suspected that might be the answer, but I couldn’t find any documentation about this.
2019-03-12T11:18:26.855400
Shavonda
elmlang
general
Yes, I don’t want to do that, I just want to check my work before creating the pull request.
2019-03-12T11:18:58.855800
Shavonda
elmlang
general
Thanks.
2019-03-12T11:19:30.856000
Shavonda
elmlang
general
Anyone know why `Elm.main.init({})`might return an empty object every time (and thus `app.ports is undefined`)? I'm using 0.19, Webpack 4 and a few plugins, `Browser.application`...
2019-03-12T11:19:36.856200
Corinne
elmlang
general
Do you actually use the port in you Elm code?
2019-03-12T11:20:15.856900
Jin