workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
in there, you have a list with `Html msg` inside (`mainNav ...`) and next to it `List (Html msg)` (that's the `pageContent`)
2019-03-27T15:31:46.857300
Florencia
elmlang
general
in Elm, all elements of lists have to be of the same type
2019-03-27T15:32:02.857800
Florencia
elmlang
general
think of it as `[1, [2, 3]]`
2019-03-27T15:32:24.858300
Florencia
elmlang
general
so either you can do `1 :: [2, 3]` or `[1] ++ [2, 3]`
2019-03-27T15:32:42.858700
Florencia
elmlang
general
that' too didn't work
2019-03-27T15:32:51.859200
Leopoldo
elmlang
general
to get `[1, 2, 3]`
2019-03-27T15:32:54.859300
Florencia
elmlang
general
wait, where?
2019-03-27T15:32:59.859500
Leopoldo
elmlang
general
for `1 :: [2, 3]` or `[1] ++ [2, 3]`
2019-03-27T15:33:13.859800
Leopoldo
elmlang
general
in line 188, you have to somehow cobine `mainNav ...` and `pageContent` into one list
2019-03-27T15:33:30.860400
Florencia
elmlang
general
either `mainNav ... :: pageContent` or `[mainNav ...] ++ pageContent`
2019-03-27T15:33:50.860800
Florencia
elmlang
general
ok, let me check that
2019-03-27T15:34:22.861100
Leopoldo
elmlang
general
(sorry, that metaphor with numbers probably didn't help :sweat_smile: )
2019-03-27T15:34:38.861600
Florencia
elmlang
general
i was rather coning or concatenating at other sections
2019-03-27T15:34:41.861800
Leopoldo
elmlang
general
oh, it went bad again
2019-03-27T15:36:13.862100
Leopoldo
elmlang
general
The 1st argument to `heroDiv` is not what I expect: 188| [ heroDiv [ mainNav model.route model.viewport :: pageContent ] ] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This argument is a list of type: List (List (Html Msg)) But `heroDiv` needs the 1st argument to be: List (Html Msg)
2019-03-27T15:36:28.862500
Leopoldo
elmlang
general
that's what has been happening, i have been rotating or juggling signatures and lists,
2019-03-27T15:37:07.863100
Leopoldo
elmlang
general
`mainNav ... :: pageContent` creates a list
2019-03-27T15:38:35.863700
Florencia
elmlang
general
and you're wrapping that in yet another list
2019-03-27T15:38:42.864000
Florencia
elmlang
general
so that outer one can go away
2019-03-27T15:38:46.864300
Florencia
elmlang
general
(eg. be replaced with parentheses)
2019-03-27T15:38:53.864500
Florencia
elmlang
general
OK
2019-03-27T15:39:22.864800
Leopoldo
elmlang
general
thanks a lot, it works
2019-03-27T15:48:22.865000
Leopoldo
elmlang
general
you're welcome :slightly_smiling_face: the error messages usually give you all the info you need!
2019-03-27T15:49:30.865600
Florencia
elmlang
general
some infos are tough to decrypt :slightly_smiling_face:
2019-03-27T15:52:12.865900
Leopoldo
elmlang
general
im trying to create a custom fuzzer for a union type. Say i have `Number = One | Two | Three` how can i create a function - which generates a list of all elements as in: `[One, Two, Three]` but i want this list built programmatically? I want to not think about adding `Four` to the list manually because for sure im gonna forget it. I much rather let the compiler do it for me. So how is this possible?
2019-03-27T15:58:39.868800
Yang
elmlang
general
why can't i `{ guy.address | city = "San Francisco" }`
2019-03-27T16:02:18.869700
Nery
elmlang
general
i must instead do ``` let addr = guy.address in { addr | city = "San Fran" } ```
2019-03-27T16:02:51.870400
Nery
elmlang
general
<@Nery> IIRC there"s no reason it shouldn't be technically possible, it's just language syntax decision
2019-03-27T16:04:05.872000
Florencia
elmlang
general
can't find the discussion with the rationale though
2019-03-27T16:04:28.872900
Florencia
elmlang
general
ultimately i'd like `{ guy | address = { guy.address | city = "SF" }}` thx <@Florencia> you thinking purposeful decision or incidental
2019-03-27T16:04:33.873100
Nery
elmlang
general
ah k purposeful.. thx
2019-03-27T16:04:39.873300
Nery
elmlang
general
<@Yang> you can't create it programatically (I'd also love it if that was possible). Create the list yourself and have a function nearby that pattern matches on the type and returns "Yes I've added a new element to the enumeration above" :D (The compiler will warn you when you add `Four` to the type, because of that function)
2019-03-27T16:07:07.877200
Florencia
elmlang
general
``` numCheck : Number -&gt; String numCheck num = case num of One -&gt; "I swear I did it" ... ```
2019-03-27T16:08:55.878500
Florencia
elmlang
general
yep, thanks did that for now.. hmm would be awesome to have some more meta-programming abilities in elm :smile:
2019-03-27T16:11:30.879300
Yang
elmlang
general
Hi, I wanted to as about decoding `json` to `dict`. Specifically why, when I run the decoder, there is `Dict.fromList` rather then `Dict`?
2019-03-27T16:15:02.881000
Hang
elmlang
general
You mean when using `Debug.log`?
2019-03-27T16:15:53.881600
Huong
elmlang
general
Well that was when I've noticed it, now, I've tried to replicate it in repl and it appears to still be there
2019-03-27T16:16:43.881800
Hang
elmlang
general
Right, that's just the way Dict's are shown in human readable form
2019-03-27T16:20:46.882500
Huong
elmlang
general
It's either that, or using made-up syntax which doesn't exist in Elm, or exposing the internal implementation details (which would be strange)
2019-03-27T16:21:26.882700
Huong
elmlang
general
So don't worry about it, it's just Elm trying to be helpful :slightly_smiling_face:
2019-03-27T16:21:41.882900
Huong
elmlang
general
There is one more option - if you don't mind writing an exhaustive function and calling it with a helper - <https://ellie-app.com/56jJ646mszfa1>
2019-03-27T16:22:24.883100
Huong
elmlang
general
we could potentially show a dict like this: ``` "one" | 1 "two" | 2 ``` But would b a pain in the ass to parse. If you copy paste the Dict.fromList example you endup with valid elm code. What i have above is not elm syntax .. is just something easy to see. So is not useful as code. Maybe this is part of the reason.
2019-03-27T16:22:34.883300
Yang
elmlang
general
you can still mess it up, of course, but at least the compiler can remind you
2019-03-27T16:23:10.883500
Huong
elmlang
general
Ok. thanks :slightly_smiling_face:
2019-03-27T16:31:27.883700
Hang
elmlang
general
yeah those two ways essentially just buy the compiler check
2019-03-27T16:34:51.883900
Florencia
elmlang
general
what are popular remoting / RPC alternatives for elm except JSON RPC. Preferably something that has an Interface Description Language (IDL) ?
2019-03-27T18:53:00.885700
Carter
elmlang
general
GraphQL?
2019-03-27T23:44:34.000100
Nana
elmlang
general
```&gt; x = -2175897600000 -2175897600000 : number &gt; x // 1000 2119069696 : Int &gt; x / 1000 -2175897600 : Float``` can someone please explain this output to me? the bottom number is the correct value, but I want it as an Int. Thought // was the way to do that, but it gives a different value. Don't really understand that value though. It should be the same value AFAIK.
2019-03-28T01:32:04.000800
Nga
elmlang
general
Is this an Elm bug or am I misunderstanding //?
2019-03-28T01:33:18.001100
Nga
elmlang
general
Interesting. Apparently that's causing a silent overflow wrap. Found this: <https://github.com/elm/compiler/issues/1832> ```This was "solved" by defining -2^31 to 2^31 - 1 as safe range for Int math operations. Time.posixToMillis returns larger values, so math operations on those values are not safe.``` That answers my question.
2019-03-28T01:40:51.001800
Nga
elmlang
general
Hey peeps, not sure if this is the correct channel for this but I have noticed that there is no `South African` channel on this elm slack. Any others from South Africa that would be keen to have a channel where we could post meetups and get the community together over here?
2019-03-28T03:31:53.003200
Kami
elmlang
general
I think you can request new channels in <#C3FKL0A8H|admin-help>
2019-03-28T04:32:12.003900
Earnest
elmlang
general
Is there any way to get a task from a random generator on 0.19?
2019-03-28T05:24:00.004900
Kimbery
elmlang
general
(I saw <https://package.elm-lang.org/packages/NoRedInk/elm-random-extra/latest/Random-Task> but it's 0.18)
2019-03-28T05:24:38.005300
Kimbery
elmlang
general
There is, but it's not something I'd recommend, as it essentially means the "random" result is just a function of time. The trick is to use `Time.now`, turn that into an Int (`Time.posixToMillis`), into a seed (`Random.initialSeed`) and run the generator with that
2019-03-28T05:28:34.005400
Huong
elmlang
general
0.16 even :smile:
2019-03-28T05:29:21.005600
Huong
elmlang
general
ahaha, right
2019-03-28T05:30:40.005800
Kimbery
elmlang
general
On a related note, when you land on a package via google there's currently no way of knowing which versions of elm it's compatible with (e.g. <https://package.elm-lang.org/packages/NoRedInk/elm-random-extra/latest/Random-Task>). AFAICT clicking through to the repo and checking elm-package.json or elm.json is the fastest way to find out. Has there been any discussion about adding the elm versions to the package page?
2019-03-28T05:32:50.007500
Kimbery
elmlang
general
what do folks use to write tests for json decoders? elm test (elm-explorations/test) or something else? Thx
2019-03-28T06:22:11.008700
Allie
elmlang
general
I haven’t tested my decoders, but elm-test would be my way to go.
2019-03-28T06:24:35.008800
Timika
elmlang
general
if you have matching encoder/decoder pairs, a fun test is to generate random data, encode it, decode it, and check that the decoded result is equal to the original input
2019-03-28T06:25:24.009000
Huong
elmlang
general
<@Timika> thanks
2019-03-28T06:26:27.009200
Allie
elmlang
general
<@Huong> nice idea. Don't have the (function + inverse) pattern unfortunately but thanks for suggestion
2019-03-28T06:27:21.009400
Allie
elmlang
general
<https://discourse.elm-lang.org/t/put-a-banner-on-elm-lang-packages-mentioning-0-18-version/3341/2>
2019-03-28T06:49:14.009700
Velia
elmlang
general
<https://github.com/elm/package.elm-lang.org/pull/285>
2019-03-28T06:50:06.009900
Velia
elmlang
general
Is there an easier way to do something like this? Making a function that compares two types but ignores values ```match : Route -&gt; Route -&gt; Bool match one two = case one of Home _ _ -&gt; case two of Home _ _-&gt; True _ -&gt; False Blog _ -&gt; case two of Blog _ -&gt; True _ -&gt; False ```
2019-03-28T08:41:19.010800
Nga
elmlang
general
You can match on a tuple of `one` and `two`, like ``` match : Route -&gt; Route -&gt; Bool match one two = case (one, two) of (Home _ _, Home _ _) -&gt; ... ```
2019-03-28T08:45:23.012100
Jin
elmlang
general
Home and Blog are actually values here, not types, but we get what you mean
2019-03-28T08:47:01.012700
Sharon
elmlang
general
It's a worthwhile distinction actually, because I need a value to do comparisons. Thanks <@Jin> that does help.
2019-03-28T08:48:17.013400
Nga
elmlang
general
is there a String size limit or a limit to a string size when set over the program Flags ?
2019-03-28T09:20:48.014200
Sharri
elmlang
general
I'm having a weird issue where I send a large blob of text as flags and only parts of the string get to Elm
2019-03-28T09:21:09.014700
Sharri
elmlang
general
It's just passed along, so that would be the string size limit of the JS VM. Which large enough you're exceedingly unlikely to bump into it
2019-03-28T09:24:29.014800
Huong
elmlang
general
That seems weird. Is it actual text, or ..? How are you checking the contents and noticing the difference?
2019-03-28T09:25:15.015500
Huong
elmlang
general
I'm taking some text I output from the server into a div, reading the text with .innerHTML, decoding html entities and the passing it to elm
2019-03-28T09:26:08.016400
Sharri
elmlang
general
I can print the text with `console.log` before passing it and it is exactly what I expect
2019-03-28T09:26:28.016900
Sharri
elmlang
general
probably it has to do with wrong html decoding, but I just find weird that the string is just truncated on th elm side with no warning
2019-03-28T09:27:38.017500
Sharri
elmlang
general
Elm doesn't do random string truncation, as far as I'm aware. if you could try to get a minimal example of your issue running on Ellie, I'd be happy to take a look!
2019-03-28T09:28:27.018500
Huong
elmlang
general
I need to take a break now, but I'll get to it when I'm back
2019-03-28T09:29:05.018900
Sharri
elmlang
general
thanks for your help
2019-03-28T09:29:09.019100
Sharri
elmlang
general
so uh, fun warning: Firefox 66 breaks websockets on localhost. If you find your hot reloading stop working ... that might be why. <https://support.mozilla.org/en-US/questions/1253577>
2019-03-28T10:39:53.019900
Gertrude
elmlang
general
hey everyone, im trying to make a function that counts how many digits exist after dot in a floting point number. i have 2 tests: ``` -- 8 digits , test "1.12345678 has 8 digits after dot" &lt;| \() -&gt; Utils.countDigitsAfterDot 1.12345678 |&gt; Expect.equal 8 -- 9 digits , test "1.123456789 has 9 digits after dot" &lt;| \() -&gt; Utils.countDigitsAfterDot 1.123456789 |&gt; Expect.equal 9 ``` The function is: ``` countDigitsAfterDot : Float -&gt; Int countDigitsAfterDot float = let recursiveCreature : Float -&gt; Int -&gt; Int recursiveCreature nr acc = if exactFloat nr then -- we reached the end acc else recursiveCreature (nr * 10) (acc + 1) in recursiveCreature float 0 exactFloat : Float -&gt; Bool exactFloat f = toFloat (floor f) == f ``` This is my implementation. But is not working for the 9 digit. It sais i have 14 digits. not 9. So how is this possible? I mention that it works for all cases but only up until 8. As soon as i reach 9 digits its messed up. Any insight into whats happening here?
2019-03-28T11:40:38.023600
Yang
elmlang
general
thanks:)
2019-03-28T11:40:46.023800
Yang
elmlang
general
could it be because of binary/decimal conversion?
2019-03-28T11:43:39.023900
Nana
elmlang
general
for example `0.1 + 0.2 == 0.30000000000000004`
2019-03-28T11:43:59.024100
Nana
elmlang
general
yep just tested a few of this.. is rely wired. for example - a `0.00000000000001` has 14 digits but it sais it has 30..
2019-03-28T11:45:36.024300
Yang
elmlang
general
and if you go over 15 .. elm format removes them, and doesnt let you type a higher number.
2019-03-28T11:46:33.024500
Yang
elmlang
general
actually no. over around 30 seems like. is when elm format removes it.
2019-03-28T11:47:32.024700
Yang
elmlang
general
I think recursively dividing by 10 is bound to cause problems
2019-03-28T11:47:48.024900
Nana
elmlang
general
better to convert it to a String and then count the digits
2019-03-28T11:48:52.025200
Nana
elmlang
general
need to think of a differen timplementation then.. let me know if you have a better suggestion :slightly_smiling_face:
2019-03-28T11:49:15.025400
Yang
elmlang
general
aha.. ok gonna see if that works.
2019-03-28T11:49:25.025600
Yang
elmlang
general
Hey all, I'm trying to understand how virtualized lists can work in Elm. A virtual list being a list that doesn't show all it's rows at the same time. Is there something like this (<http://bvaughn.github.io/react-virtualized/#/components/List>) that already exists for dynamically sized content? Imagine a chat room, with a bunch of messages. Basically a list with each row being a message of text. The rows are dynamically sized because we don't know the size until the browser renders it. The current virtual list implementations I've seen require knowing the size of the rows. Which doesn't work for this problem. Is there some other project I've missed, or is there another way of doing this?
2019-03-28T11:57:11.029400
Linda
elmlang
general
pff disaster, it oconverts it to floating scientific notation..: ``` &gt; 0.00000001 |&gt; String.fromFloat "1e-8" : String ```
2019-03-28T11:59:14.029500
Yang
elmlang
general
You could create a capped list, don’t you?
2019-03-28T12:01:34.030000
Ghislaine
elmlang
general
What is a capped list? Do you mean just truncating the list?
2019-03-28T12:02:03.030200
Linda
elmlang
general
Yeah
2019-03-28T12:02:29.030400
Ghislaine
elmlang
general
I mean, its not the same as having a virtualized list of components but it could do the job.
2019-03-28T12:03:42.030600
Ghislaine
elmlang
general
That's not quite what I want. The user should be able to scroll all the way up to the first message, and then all the way down to the last message. They should have access to all the items in the list. The VirtualList would do the hard work of just rendering just the visible rows.
2019-03-28T12:04:01.030800
Linda
elmlang
general
if someone scrolls to the top then u load the older messages
2019-03-28T12:04:05.031000
Ghislaine
elmlang
general
and so on
2019-03-28T12:04:27.031200
Ghislaine