workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
thanks a lot. I will give a try
2019-01-28T10:48:58.133500
Phoebe
elmlang
general
omg it worked! thanks a lot
2019-01-28T10:53:37.133700
Phoebe
elmlang
general
hello everyone I’m having some issues javascript stuff I think
2019-01-28T11:12:03.135100
Karrie
elmlang
general
I include `<.script src="./assets/scripts/modules/reservations.js"></script>` and straight below I initialise my Elm app: `Elm.Main.init({node: ….})`
2019-01-28T11:13:00.136100
Karrie
elmlang
general
the issue is I get the following error: `ReferenceError: Elm is not defined`
2019-01-28T11:13:28.136600
Karrie
elmlang
general
is this something you every came across?
2019-01-28T11:15:07.137000
Karrie
elmlang
general
<@Karrie> Do you mean that you've put the `Elm.Main.init(...)` in your `reservations.js` file or in your html file?
2019-01-28T11:15:54.137900
Antonette
elmlang
general
Elm.Main.init is my html file
2019-01-28T11:16:10.138200
Karrie
elmlang
general
Is it possible that you show your `reservations.js` file? (like on a pastebin or something)
2019-01-28T11:17:17.139500
Antonette
elmlang
general
<@Antonette> sure: here you go: <https://pastebin.com/JiZULbDJ>
2019-01-28T11:18:57.139800
Karrie
elmlang
general
Thanks :slightly_smiling_face:
2019-01-28T11:19:06.140200
Antonette
elmlang
general
if I try to import the file into my main `theme.js` file I get the following error: `TypeError: scope is undefined`
2019-01-28T11:23:23.140900
Karrie
elmlang
general
What are you using to compile your JavaScript?
2019-01-28T11:27:44.141400
Antonette
elmlang
general
the “normal” javascript or the Elm app?
2019-01-28T11:28:51.141800
Karrie
elmlang
general
I’m trying to integrate my Elm app into a shopify template
2019-01-28T11:29:37.142400
Karrie
elmlang
general
this is done via Slate (<https://github.com/Shopify/slate/>) which uses babel
2019-01-28T11:30:34.142900
Karrie
elmlang
general
Ok ; I'm sorry but I'm about to have to leave my keyboard. Anyone else can help debug?
2019-01-28T11:33:13.144100
Antonette
elmlang
general
<@Antonette> no worries! the elm file is created with `elm make src/Main.elm` and everything else is done using slate
2019-01-28T11:34:28.145400
Karrie
elmlang
general
any help from anyone would be great!
2019-01-28T11:34:38.145700
Karrie
elmlang
general
Good luck :slightly_smiling_face:
2019-01-28T11:35:02.146200
Antonette
elmlang
general
Where is your script tag and where are is your `Elm.init` script <@Karrie>?
2019-01-28T12:23:15.147800
Ashton
elmlang
general
I havent had a problem like that in a while, but I remember when I did I usually found the solution by fiddling with where the script tags are.
2019-01-28T12:23:44.148500
Ashton
elmlang
general
Have you tried like ``` &lt;head&gt; &lt;script src="./reservations.js"/&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; Elm.init() &lt;/script&gt; &lt;/body&gt; ```
2019-01-28T12:24:27.149400
Ashton
elmlang
general
?
2019-01-28T12:24:30.149600
Ashton
elmlang
general
With the Elm initialization in the body.
2019-01-28T12:25:05.150100
Ashton
elmlang
general
it could it be related to <https://github.com/elm/core/issues/993> if the subscription is conditional
2019-01-28T12:41:26.150300
Alicia
elmlang
general
Can anyone explain to me what the exact difference between `Parser.keyword`, `Parser.symbol` and `Parser.token` is?
2019-01-28T13:25:08.151400
Freda
elmlang
general
I think from looking at the code in `Parser.Advanced` symbol and keyword are the same.
2019-01-28T13:25:37.152000
Freda
elmlang
general
```symbol : Token x -&gt; Parser c x () symbol = token```
2019-01-28T13:25:50.152300
Freda
elmlang
general
But what is the difference to `keyword` then?
2019-01-28T13:26:01.152600
Freda
elmlang
general
I think `keyword` peeks ahead a littlebit to ensure there’s whitespace afterwards.
2019-01-28T13:27:07.153100
Cornell
elmlang
general
Or rather “not a letter, number, or underscore”
2019-01-28T13:28:07.153400
Cornell
elmlang
general
Ah ok, so it makes sure that it is what you were looking, and not more than that. Thanks :slightly_smiling_face:
2019-01-28T13:31:04.154600
Freda
elmlang
general
Any idea why there is a `token` and a `symbol` if they seem to be the same thing?
2019-01-28T13:31:27.155200
Freda
elmlang
general
I think it’s the same except it will give a different `Problem`: <https://package.elm-lang.org/packages/elm/parser/latest/Parser#Problem>
2019-01-28T13:33:56.155700
Cornell
elmlang
general
I think `token` corresponds to `Expecting String`, while `symbol` corresponds to `ExpectingToken`
2019-01-28T13:35:24.156900
Cornell
elmlang
general
Which could be useful for error reporting.
2019-01-28T13:35:33.157200
Cornell
elmlang
general
Ah ok, so apart from errors they are the same. Thanks Matt
2019-01-28T13:38:41.157700
Freda
elmlang
general
No problemo!
2019-01-28T13:39:03.157900
Cornell
elmlang
general
after a long debugging session I found out that the problem wasn’t with my Elm component but with the stupid Shopify!
2019-01-28T13:47:36.158000
Karrie
elmlang
general
Just got it fixed but thank you all! <@Ashton> <@Antonette>
2019-01-28T13:47:58.158200
Karrie
elmlang
general
anyone have any good idea on how to refresh short term access tokens and have it propogate down to children?
2019-01-28T14:20:53.159200
Euna
elmlang
general
also: is this explanation still relevant in .19?
2019-01-28T14:21:32.159800
Euna
elmlang
general
<https://www.reddit.com/r/elm/comments/48pqsh/updated_nested_child_components/d0n3n0v/>
2019-01-28T14:21:32.159900
Euna
elmlang
general
I feel like the most Elm-ish thing to do would be to keep the tokens at the top level of model and have the children just grab them from there, no?
2019-01-28T14:45:49.160700
Dede
elmlang
general
There is no such thing as "component state" in Elm. All state lives on a single top-level model.
2019-01-28T14:50:57.161300
Carman
elmlang
general
you may be passing different sub-chunks of that model into various view functions
2019-01-28T14:51:45.162000
Carman
elmlang
general
which may feel like "component state" from other frameworks
2019-01-28T14:51:58.162400
Carman
elmlang
general
but it's important to remember that at the end of the day it's a single big state
2019-01-28T14:52:34.162900
Carman
elmlang
general
You generally want to keep that state DRY (Elm folks might say "make impossible states impossible")
2019-01-28T14:52:59.163300
Carman
elmlang
general
So you'd want to avoid duplicating tokens all over your model. Ideally the token lives in a single place
2019-01-28T14:53:33.163900
Carman
elmlang
general
guys, I mean that the whole point. What I'm saying is there a way to take the top level Msg (Result Err a) and update the child components without have to pattern match every sub model
2019-01-28T15:03:33.164800
Euna
elmlang
general
I would like to avoid pattern matching two different Msg to every submodel
2019-01-28T15:04:20.165900
Euna
elmlang
general
If you do have pages with their own Model and Msg types, this example app I have may be helpful: <https://github.com/ohanhi/elm-shared-state>
2019-01-28T15:04:46.166600
Bert
elmlang
general
I've been using feldman's SPA app as reference, but as far as I can tell he doesn't update tokens during the session
2019-01-28T15:04:52.166800
Euna
elmlang
general
<@Euna> Store the token in your top-level `Model`, pass the token to the child `update` functions when you call them. Then you only have to update a single field when it changes.
2019-01-28T15:08:40.168000
Earnest
elmlang
general
<@Euna> When you say "component" -- do you mean pages in an SPA, or something more like datepickers?
2019-01-28T15:15:05.168800
Dede
elmlang
general
Or something else?
2019-01-28T15:15:18.169100
Dede
elmlang
general
<@Dede> i mean children/page sure
2019-01-28T15:16:21.169500
Euna
elmlang
general
None
2019-01-28T15:17:29.169800
Euna
elmlang
general
the reason this is coming up is that I have refreshing the tokens on a timed task, so its a top level subscription
2019-01-28T15:18:26.170800
Euna
elmlang
general
In the rtfeldman SPA, I think you'd have the top level update function call `toSession` (is that right? This is from memory) to get the session, update the token in the session, and then re-build the current page (probably another big `case` statement) passing in the new session.
2019-01-28T15:20:23.172400
Dede
elmlang
general
Hi, there there a way to send a Cmd that doesn't do anything other than trigger a new update? I know I can just call my `update` function directly but what I want is for the message to appear in the debugger history
2019-01-28T15:21:46.173800
Jae
elmlang
general
<@Jae> you can make a cmd that takes in nothing, the NoOp causes a refresh iirc
2019-01-28T15:23:05.174700
Euna
elmlang
general
* the NoOp from the elm-tutorial
2019-01-28T15:23:19.175000
Euna
elmlang
general
``` send : msg -&gt; Cmd msg send msg = Task.succeed msg |&gt; Task.perform identity ``` This is not good practice though.
2019-01-28T15:24:31.175500
Velia
elmlang
general
<@Jae> `Task.succeed () |&gt; Task.perform (always &lt;| myActualMsg)`
2019-01-28T15:24:39.175800
Earnest
elmlang
general
hot damn that's good
2019-01-28T15:28:26.176100
Euna
elmlang
general
Yeah, making it a `NoOp` won't do anything... I think they want to call the code from a specific update branch
2019-01-28T15:29:49.177000
Earnest
elmlang
general
oooo
2019-01-28T15:30:07.177500
Euna
elmlang
general
Well a proper NoOp at least, `NoOp -&gt; (model, Cmd.none)`
2019-01-28T15:30:23.177900
Earnest
elmlang
general
That said, I usually refactor the branch into a separate function and call it from both branches instead of recursive updates or sending Cmds.
2019-01-28T15:30:59.178500
Earnest
elmlang
general
Yup, that works. Thanks! (Don't worry, I plan to use it for debugging only)
2019-01-28T15:34:30.179900
Jae
elmlang
general
That works, thanks!
2019-01-28T15:34:49.180100
Jae
elmlang
general
<@Dede> he batches session changes as a subscription to each page in order to not redraw it
2019-01-28T15:42:02.180900
Euna
elmlang
general
I think I might do that too
2019-01-28T15:42:08.181100
Euna
elmlang
general
I don't think I'm fluent enough to come up with a more elegant solution
2019-01-28T15:42:27.181600
Euna
elmlang
general
¯\_(ツ)_/¯
2019-01-28T15:42:31.181700
Euna
elmlang
general
I'm trying to install "elm/bytes", but I get the error: "WARNING: I normally check &lt;https://package.elm-lang.org&gt; for new packages here, but my request failed. Are you offline? I will try to continue anyway."
2019-01-28T18:15:15.182800
Raylene
elmlang
general
<@Raylene> are you behind a proxy server?
2019-01-28T18:21:38.183400
Earlean
elmlang
general
I have a quick scaling/decomposition question. I have an app that does search. It allows a user to build a query and then it shows the results. The file is huge (several thousand lines), so I'm breaking it up into some modules. Specifically, I'm going to move the search results type into its own module, along with the decoders, http method, etc.
2019-01-28T22:10:20.186300
Marcus
elmlang
general
My question is this. Getting the results depends upon the model in my Main file. I don't want to set up a circular dependency. Can I just be careful with my `exposings` and include `Main` in `SearchResults`, or do I need to move my model into its own file also?
2019-01-28T22:11:31.187700
Marcus
elmlang
general
<@Marcus> if you've got code that depends on the Main model then it should probably be in the Main module.
2019-01-28T22:17:33.188400
Earlean
elmlang
general
Well, everything is in the Main module now.
2019-01-28T22:18:02.189300
Marcus
elmlang
general
But, if your model is a record type alias you could use the 'extensible record' syntax to depend only on the fields you need to
2019-01-28T22:18:38.189900
Earlean
elmlang
general
Good point. I underuse that feature.
2019-01-28T22:18:58.190500
Marcus
elmlang
general
<@Marcus> another way to see it is to decouple your model from your `Main` module, so it's accessible by both the `Main` module and the `SearchResults` without circular dependencies.
2019-01-29T03:51:03.191600
Antonette
elmlang
general
Hi! Do you know of any REPL in the browser solution?
2019-01-29T04:12:33.196400
Dorsey
elmlang
general
If I understand correctly Ellie compiles Elm code on the client side. Is there something like that for REPL? The only thing I could find is this <http://elmrepl.cuberoot.in/>, but it seems to connect to some server to evaluate the code. Also I don't know what the terms of use are, is there a source code available, etc.
2019-01-29T04:12:37.196500
Dorsey
elmlang
general
I just use <https://ellie-app.com>, even though it's not exactly a REPL
2019-01-29T04:14:02.196700
Nana
elmlang
general
Me too, but I need something where I can evaluate simple expressions for teaching.
2019-01-29T04:14:56.196900
Dorsey
elmlang
general
We will be using Ellie to build the app, but we also need REPL.
2019-01-29T04:15:26.197100
Dorsey
elmlang
general
`main = myExpression |&gt; Debug.toString |&gt; text`
2019-01-29T04:15:33.197300
Nana
elmlang
general
:thinking_face:
2019-01-29T04:15:48.197500
Dorsey
elmlang
general
That's something worth considering.
2019-01-29T04:16:01.197700
Dorsey
elmlang
general
You don't get type inference though.
2019-01-29T04:16:17.197900
Dorsey
elmlang
general
that's true, hey that would be cool to have as a Debug function!
2019-01-29T04:17:11.198100
Nana
elmlang
general
Yes it would :smile:
2019-01-29T04:17:26.198300
Dorsey
elmlang
general
like `Debug.type`
2019-01-29T04:17:29.198500
Nana
elmlang
general
I think it may be difficult. The types don't make it to the runtime, AFAIK.
2019-01-29T04:17:59.198700
Dorsey