workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang
|
general
|
so mixing elm code with interpreted code in a flexible way is hard/not feasible
|
2019-01-19T08:15:35.626500
|
Virgie
|
elmlang
|
general
|
Hmm, that is discouraging but makes sense.
|
2019-01-19T08:16:07.626700
|
Danika
|
elmlang
|
general
|
So it must be connected to how Elm is batching model updates to only call `view` once per animation frame. Adding JS
```
this.addEventListener('focus', () => {
setTimeout(() => this.dispatchEvent(new CustomEvent('delayed-focus')), 5);
});
```
and subscribing to `delayed-focus` in Elm fixes the issue
|
2019-01-19T09:17:57.628100
|
Lynne
|
elmlang
|
general
|
Is anyone aware of any Github issue this could be added to?
|
2019-01-19T09:18:55.628700
|
Lynne
|
elmlang
|
general
|
Hi, I installed `NoRedInk/elm-debug-controls-without-datepicker` and now I'm consistently getting this error ```elm.exe: Map.!: given key is not an element in the map
CallStack (from HasCallStack):
error, called at libraries\containers\Data\Map\Internal.hs:603:17 in containers-0.5.10.2:Data.Map.Internal
@ ./src/index.js 2:0-33 4:0-3
@ multi ../AppData/Local/Yarn/Data/global/node_modules/create-elm-app/config/polyfills.js ../AppData/Local/Yarn/Data/global/node_modules/create-elm-app/scripts/utils/webpackHotDevClient.js ../AppData/Local/Yarn/Data/global/node_modules/react-error-overlay/lib/index.js ./src/index.js```
Removing `elm-stuff` and clearing the package cache in appdata doesn't help.
|
2019-01-19T10:17:24.629900
|
Jae
|
elmlang
|
general
|
<@Jae> it's a known bug in the compiler. If you're using the `--debug` flag with the compiler then not using that may solve the problem.
|
2019-01-19T10:20:51.632200
|
Earlean
|
elmlang
|
general
|
If you're not using the `--debug` flag and still seeing that error then you've encountered a version of the bug for which there isn't currently a work around.
|
2019-01-19T10:22:17.634100
|
Earlean
|
elmlang
|
general
|
Alright thanks, I'll try that
|
2019-01-19T10:23:43.634900
|
Jae
|
elmlang
|
general
|
Yup that works. I guess it's a little ironic that installing a package designed to help with debugging has led me to disable the debugger
|
2019-01-19T10:31:11.635900
|
Jae
|
elmlang
|
general
|
Anyone have an update on this bug :sob:
|
2019-01-19T12:15:12.636600
|
Jenice
|
elmlang
|
general
|
it has been very quiet on that front. Even if it were fixed today there are maybe some other things that it would also make sense to include in a 0.19.1 (adding/upgrading packages for instance) release so I'd guess it's not coming very soon
|
2019-01-19T12:21:27.638100
|
Virgie
|
elmlang
|
general
|
Hi everyone - are there recommendations on best Elm book that covers SPAs in detail from the ground up in 0.19?
|
2019-01-19T12:59:38.638700
|
Loyce
|
elmlang
|
general
|
Yes!
|
2019-01-19T13:39:21.639000
|
Jana
|
elmlang
|
general
|
I would say “Practical Elm for a Busy Developer” <https://korban.net/elm/book/>
|
2019-01-19T14:27:20.639500
|
Allyn
|
elmlang
|
general
|
how can I generate a random value for use in a Task? I see that <https://package.elm-lang.org/packages/elm/random/latest/Random> has a `generate` function that returns a `Cmd`, but I’m looking for a `Task`
|
2019-01-19T20:30:33.641500
|
Marlin
|
elmlang
|
general
|
I also found <https://gist.github.com/JoelQ/c93a8f6a81262ff12c93ab2ff859f8e5> but as far as I can tell that produces the same value every time, it is not actually random at all
|
2019-01-19T20:34:03.641600
|
Marlin
|
elmlang
|
general
|
<@Marlin> there isn't a way to do it as a Task and have the runtime manage the seed, but you can `step` and generator in a Task if you manage the seed yourself
|
2019-01-19T21:09:38.641800
|
Earlean
|
elmlang
|
general
|
okay, thanks
|
2019-01-19T21:18:07.642000
|
Marlin
|
elmlang
|
general
|
<@Marlin> The gist you found (written for 0.18) uses the current time as the seed. It should give you different results every time unless you've frozen you clock somehow
|
2019-01-19T21:42:14.642400
|
Carman
|
elmlang
|
general
|
Here's a working example for 0.19: <https://ellie-app.com/4vCp7Vzz5cNa1>
|
2019-01-19T21:48:35.642600
|
Carman
|
elmlang
|
general
|
Note that I'm executing it via `Task.perform`, _not_ `Random.generate`
|
2019-01-19T21:49:00.642800
|
Carman
|
elmlang
|
general
|
ah, sorry I missed the time, I must have ~called it twice in one second~ been unlucky (and obviously I didn’t read it very carefully!)
|
2019-01-19T21:53:47.643100
|
Marlin
|
elmlang
|
general
|
thanks for the updated example, this is helpful
|
2019-01-19T21:54:06.643300
|
Marlin
|
elmlang
|
general
|
for now, I’m probably going to have to leave out randomness and keep a `TODO` comment, since it doesn’t really make sense for consumers of the module I’m writing to have to worry about helping manage the seed state
|
2019-01-19T21:56:12.643600
|
Marlin
|
elmlang
|
general
|
What does the module do
|
2019-01-20T00:25:01.644300
|
Danika
|
elmlang
|
general
|
I'm musing about what pattern is this... is it an `andThen`?
```
andThen : (model -> (model, cmd)) -> (model, cmd) -> (model, cmd)
andThen modelToModelCmdTuple (model, cmd) =
let
(newModel, anotherCmd) =
modelToModelCmdTuple model
in
( newModel
, Cmd.batch [cmd, anotherCmd]
)
```
ie.
```
model
|> doStuffWithCmds
-- we have `(model, cmd)` now
-- but `doDifferentStuffWithCmds` needs a `model`
-- so we use this combinator or whatever it is
|> andThen doDifferentStuffWithCmds
```
|
2019-01-20T16:10:10.650300
|
Florencia
|
elmlang
|
general
|
<@Leoma> <@Ashton> Maybe you folks have some insight into it, given our previous cmd-related discussions? :slightly_smiling_face:
|
2019-01-20T16:11:11.651000
|
Florencia
|
elmlang
|
general
|
monadic `andThen` is `(a -> Monad b) -> Monad a -> Monad c`
ie. `Json.Decode.andThen : (a -> Decoder b) -> Decoder a -> Decoder b`
so ... the type signature probably checks out, right?
|
2019-01-20T16:13:15.652600
|
Florencia
|
elmlang
|
general
|
You seem to have extra parans in the signature
|
2019-01-20T16:13:46.653400
|
Carrol
|
elmlang
|
general
|
the right-associativity makes it a non-problem though I think
|
2019-01-20T16:14:08.654300
|
Florencia
|
elmlang
|
general
|
it's interesting there's no `Cmd.andThen` in any of our packages! :slightly_smiling_face:
|
2019-01-20T16:14:12.654500
|
Florencia
|
elmlang
|
general
|
`andThen` sounds right to me.
|
2019-01-20T16:14:13.654600
|
Carrol
|
elmlang
|
general
|
but yeah I should fix the parens
|
2019-01-20T16:14:28.655000
|
Florencia
|
elmlang
|
general
|
We have the same:
```
andThen fn ( model, cmd ) =
let
( updatedModel, newCmd ) =
fn model
in
( updatedModel, Cmd.batch [ cmd, newCmd ] )
```
|
2019-01-20T16:14:58.655600
|
Carrol
|
elmlang
|
general
|
<@Zona> How could have you missed this golden opportunity :troll:
|
2019-01-20T16:15:05.655700
|
Florencia
|
elmlang
|
general
|
I stand corrected: there's one package that does this:
<https://package.elm-lang.org/packages/the-sett/elm-update-helper/1.4.1/Update2#eval>
|
2019-01-20T16:19:23.656300
|
Florencia
|
elmlang
|
general
|
This one too <https://package.elm-lang.org/packages/Fresheyeball/elm-return/latest/Return#andThen>
|
2019-01-20T16:20:02.656500
|
Carrol
|
elmlang
|
general
|
nice
|
2019-01-20T16:21:30.656700
|
Florencia
|
elmlang
|
general
|
I wasn't good enough with the fuzzy search :upside_down_face:
|
2019-01-20T16:21:37.657100
|
Florencia
|
elmlang
|
general
|
Well, now there's one more place for it :slightly_smiling_face: <https://package.elm-lang.org/packages/Janiczek/cmd-extra/latest/Cmd-Extra#andThen>
|
2019-01-20T16:25:56.657800
|
Florencia
|
elmlang
|
general
|
Yeah looks like `andThen` to me.
|
2019-01-20T16:39:56.658200
|
Ashton
|
elmlang
|
general
|
Theres probably some fancy FP word for an `andThen` that binds back onto the same type.
|
2019-01-20T16:51:44.660800
|
Ashton
|
elmlang
|
general
|
`map`?
|
2019-01-20T16:51:59.661300
|
Agustin
|
elmlang
|
general
|
No. I mean. The model/cmd tuple goes `(m -> M m) -> M m -> M m`. Lower case `m` all the way through. Unlike the normal case of going `a -> M b`, where it goes from type `a` to type `b`
|
2019-01-20T16:53:24.662500
|
Ashton
|
elmlang
|
general
|
oh I see what you mean
|
2019-01-20T16:53:55.663200
|
Florencia
|
elmlang
|
general
|
something-something-morphism :sweat_smile:
|
2019-01-20T16:54:05.663600
|
Florencia
|
elmlang
|
general
|
Actually, I started a conversation a few months back in here asking if `(a -> a) -> M a -> M a` is still “mapping”. And there were disagreeing voices, but I think team “yes” won.
|
2019-01-20T16:54:40.664800
|
Ashton
|
elmlang
|
general
|
Yeah exactly. Haha. A something-morphism.
|
2019-01-20T16:55:05.665200
|
Ashton
|
elmlang
|
general
|
Endo-thing.
|
2019-01-20T16:55:08.665500
|
Ashton
|
elmlang
|
general
|
Is this what ordinary programmers trying to look like category theorists look like? :joy:
|
2019-01-20T16:57:15.666500
|
Florencia
|
elmlang
|
general
|
(honestly, I love this discussion)
|
2019-01-20T16:57:28.666800
|
Florencia
|
elmlang
|
general
|
Hmmm I think the term might be "monomorphic" (one shape)?
|
2019-01-20T17:01:06.667700
|
Carman
|
elmlang
|
general
|
Although I've usually seen the term used for functions that had a concrete type like `String.map : (Char -> Char) -> String -> String`
|
2019-01-20T17:01:47.668300
|
Carman
|
elmlang
|
general
|
There is this theory… of the möbius… where the types become a loop.
|
2019-01-20T17:04:39.668800
|
Agustin
|
elmlang
|
general
|
Is there a way to replace elm-community/elm-date-extra in 0.18 in preparation for 0.19? Specifically I need the utc/posix functionality in 0.18
|
2019-01-20T17:09:22.671000
|
Jeniffer
|
elmlang
|
general
|
<@Jeniffer>
I'm no Elm expert, but I spent many hours figuring out how to upgrade to 0.19 with all the date/time changes (I'm working on a calendar) as I talked about here:
<https://discourse.elm-lang.org/t/no-longer-an-official-way-to-store-zoneless-times-in-0-19/2454>
From that experience, I might suggest this library to answer your question (if I understand it correctly):
<https://package.elm-lang.org/packages/justinmimbs/time-extra/latest/Time-Extra>
|
2019-01-20T18:08:24.674600
|
Erin
|
elmlang
|
general
|
Thanks <@Erin> ! I’ll check it out!
|
2019-01-20T18:38:06.675500
|
Jeniffer
|
elmlang
|
general
|
there is a lot of attempts to try to fit monads into tea e.g. <https://package.elm-lang.org/packages/Fresheyeball/elm-return/latest/Return#andThen> but it’s imo not that practical since there are some limitations
|
2019-01-20T20:55:00.675800
|
Zona
|
elmlang
|
general
|
it’s not. it isn’t monad
|
2019-01-20T20:55:54.676100
|
Zona
|
elmlang
|
general
|
not even that. even map goes a -> b
|
2019-01-20T20:56:43.676400
|
Zona
|
elmlang
|
general
|
not really. it doesn’t have domain and co-domain. This thing is usually called `update` in elm
|
2019-01-20T21:03:59.676600
|
Zona
|
elmlang
|
general
|
hello all, has anyone added the FB group plugin embedded code into their Elm code?
|
2019-01-20T21:07:32.677500
|
Chadwick
|
elmlang
|
general
|
I’ve added the top to my index.html and the bottom to the Elm code but I can’t get it compile
|
2019-01-20T21:08:22.677600
|
Chadwick
|
elmlang
|
general
|
```
div
[ class "fb-group", "data-href" "<https://www.facebook.com/pettingzooocalafl>", "data-width" "280", "data-show-social-context" "true", "data-show-metadata" "false" ]
[]
```
|
2019-01-20T21:08:29.678000
|
Chadwick
|
elmlang
|
general
|
thanks in advance for your time! :slightly_smiling_face:
|
2019-01-20T21:10:06.678300
|
Chadwick
|
elmlang
|
general
|
<@Chadwick> do you have an HTML page that you’re inserting your Elm app info?
|
2019-01-20T21:12:15.679400
|
Yolande
|
elmlang
|
general
|
yes
|
2019-01-20T21:12:32.679800
|
Chadwick
|
elmlang
|
general
|
just the index
|
2019-01-20T21:12:42.680100
|
Chadwick
|
elmlang
|
general
|
```
view : Model -> Browser.Document Msg
```
|
2019-01-20T21:13:35.681200
|
Chadwick
|
elmlang
|
general
|
And where does the FB JS blob get pasted?
|
2019-01-20T21:13:57.681800
|
Yolande
|
elmlang
|
general
|
<https://developers.facebook.com/docs/plugins/group-plugin#configurator>
|
2019-01-20T21:14:18.682000
|
Chadwick
|
elmlang
|
general
|
some in the head and some in the place where the div is going to be rendered
|
2019-01-20T21:14:32.682600
|
Chadwick
|
elmlang
|
general
|
Got it. Hmm. Maybe there’s some obstacle between their script and the DOM nodes that Elm is managing. When you inspect the div does it look like you specified?
|
2019-01-20T21:15:54.684800
|
Yolande
|
elmlang
|
general
|
<@Chadwick> you'll need to use <https://package.elm-lang.org/packages/elm/html/latest/Html-Attributes#attribute> for those 'data-' attributes
|
2019-01-20T21:15:58.685000
|
Earlean
|
elmlang
|
general
|
eg. ```
div [ class "fb-group"
, attribute "data-href" "<https://www.facebook.com/pettingzooocalafl>"
, attribute "data-width" "280"
, attribute "data-show-social-context" "true"
, attribute "data-show-metadata" "false" ] []
```
|
2019-01-20T21:17:14.686300
|
Earlean
|
elmlang
|
general
|
that did the trick! awesine! thanks <@Earlean>, `html-attribute` was the keyword I was looking for :slightly_smiling_face:
|
2019-01-20T21:22:35.687100
|
Chadwick
|
elmlang
|
general
|
Hey, I know I’ve seen other people have this issue as well, but can’t recall what the solution was.
Just upgraded an `elm 0.18` package that was at version 1.0.1 to `elm 0.19` with a new package at version 2.0
<https://package.elm-lang.org/packages/cmditch/elm-ethereum/2.0.0/>
and getting this warning message `Warning! The latest version of this package is 1.0.1`
Any idea how to fix this?
|
2019-01-20T22:21:32.688300
|
Talisha
|
elmlang
|
general
|
<@Talisha> seems fine now, I assume it was just a cache issue.
|
2019-01-20T23:05:28.689900
|
Earlean
|
elmlang
|
general
|
ahh, thanks for checking
|
2019-01-20T23:17:40.690200
|
Talisha
|
elmlang
|
general
|
Can anyone confirm that there is indeed no way to update a record in a similar way to the .accessor methods? e.g. for record `{ name : String }` you can use `.name record` to get the string, but you'd need to define your own `updateName : String -> { name : String} -> { name : String }` if you wanted to have a simple updater for it, right?
|
2019-01-20T23:30:48.692800
|
Cletus
|
elmlang
|
general
|
Yup
|
2019-01-20T23:39:39.693100
|
Earnest
|
elmlang
|
general
|
There search isn’t good enough :slightly_smiling_face:
|
2019-01-21T02:56:54.693600
|
Jin
|
elmlang
|
general
|
so I came up with a solution to my "problem" earlier regarding setting `RemoteData` to `Loading` not actually being tied to loading the data.
instead of having the usual:
`getFolder : FileContainer.ID -> Cmd Msg`
you can have:
`loadFolder : FileContainer.ID -> ( Model, Cmd Msg ) -> ( Model, Cmd Msg )`
and then instead of doing:
`({model | folder = Loading}, getFolder folderId)`
you do:
`(model, Cmd.none) |> loadFolder folderId`
|
2019-01-21T03:41:56.697100
|
Nana
|
elmlang
|
general
|
is this a common pattern?
|
2019-01-21T03:44:04.697600
|
Nana
|
elmlang
|
general
|
I think so yes. I found it's really nice to have complex update functions implemented as a pipe of functions. You can even create a function `andThen` that abstracts the Cmd.batch mecanism.
|
2019-01-21T03:46:58.699200
|
Karissa
|
elmlang
|
general
|
Something like:
```
andThen : (Model -> (Model, Cmd msg)) -> (Model, Cmd msg) -> (Model, Cmd msg)
andThen function (model, cmds) =
let
(newModel, extraCmds) =
function model
in
(newModel, Cmd.batch [cmds, extraCmds])
```
That you can use like this: `(model, Cmd.none) |> andThen (loadFolder folderId) |> andThen otherFunction`.
|
2019-01-21T03:52:35.702500
|
Karissa
|
elmlang
|
general
|
Ah but map can also go b -> a
|
2019-01-21T05:23:37.703200
|
Agustin
|
elmlang
|
general
|
Its also my goto hack to convert things back to my global msg :joy:
|
2019-01-21T05:24:05.703400
|
Agustin
|
elmlang
|
general
|
<@Karissa> I don't like that implementation. You're somehow hinting that `andThen` is sequential, where `Cmd.batch` doesn't guarantee that one.
|
2019-01-21T06:43:44.704800
|
Niesha
|
elmlang
|
general
|
Or rather, I don't like the name.
|
2019-01-21T06:43:59.705000
|
Niesha
|
elmlang
|
general
|
Cant the domain and co-domain be the same domain? Or, cant the domain and co-domain have the same type?
|
2019-01-21T06:52:30.705100
|
Ashton
|
elmlang
|
general
|
I guess its just a matter of how you define it, but, a function can go `a -> a`. Thats not an issue. Maybe I dont understand functors enough, but I think endofunctors map back onto the sae domain.
|
2019-01-21T06:57:10.705300
|
Ashton
|
elmlang
|
general
|
no guarantees for result ordering... but i think at least they would be issued in that order?
|
2019-01-21T07:03:57.707100
|
Alysa
|
elmlang
|
general
|
IIRC they are issued in the reverse order. As in, FILO for a recursive tree structure
|
2019-01-21T07:10:19.707300
|
Bert
|
elmlang
|
general
|
Yeah the name is chosen to be consistent with Maybe.andThen etc.
|
2019-01-21T07:11:27.707500
|
Karissa
|
elmlang
|
general
|
The signature is, but the behavior isn't.
|
2019-01-21T07:51:49.707800
|
Niesha
|
elmlang
|
general
|
I'd love other name suggestions, naming is hard ^^
|
2019-01-21T07:54:27.708000
|
Karissa
|
elmlang
|
general
|
`map2` etc. sound appropriate here
|
2019-01-21T08:00:11.708200
|
Niesha
|
elmlang
|
general
|
Without changing the signature it wouldn't be consistent. And I still like to convey the idea of chaining or piping changes to Model while retaining the ability to produce Cmds. Maybe `chain` or something like that.
|
2019-01-21T08:16:56.709600
|
Karissa
|
elmlang
|
general
|
Hi, I wanted to test the export/import feature in the debugger but whenever I try using it I get ```Cannot Import History
Looks like this history file is corrupt. I cannot understand it.``` I haven't made any changes between exporting and importing the history.
|
2019-01-21T08:17:10.710100
|
Jae
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.