workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang
|
general
|
we have some common params emerging (Sorts, filters etc) & pages obviously have specific ones
|
2019-02-27T15:38:55.353500
|
Simon
|
elmlang
|
general
|
we have our Route’s take a record of the appropriate type and the URL parser populates accordingly
|
2019-02-27T15:39:09.353900
|
Simon
|
elmlang
|
general
|
conversely, the “toRoute” function takes optional params, if not provided, comes up w/ sensible defaults (usually no query params) otherwise populates
|
2019-02-27T15:39:36.354600
|
Simon
|
elmlang
|
general
|
and the pages themselves continuously update URL accordingly as page state changes
|
2019-02-27T15:39:51.355100
|
Simon
|
elmlang
|
general
|
Any examples on of really simple but good Elm in use?
|
2019-02-27T21:31:26.356500
|
Brittney
|
elmlang
|
general
|
I'm a fan of <https://package.elm-lang.org>
|
2019-02-27T21:39:01.356800
|
Lizabeth
|
elmlang
|
general
|
hey there,
did someone ever modeled the filters? I am looking for a filter model that supports
- multiple values selected per filter
- tracking which values are in fact selected in order to get them displayed on the top of all filters
|
2019-02-28T00:35:04.001500
|
Floy
|
elmlang
|
general
|
Have you seen this one? <https://www.youtube.com/watch?v=XpDsk374LDE>
|
2019-02-28T01:39:46.001600
|
Lea
|
elmlang
|
general
|
I think the examples used throughout the talk will be useful for designing something you need
|
2019-02-28T01:41:25.001800
|
Lea
|
elmlang
|
general
|
is there a way to show only packages compatible with 0.19?
|
2019-02-28T03:22:44.002800
|
Adrian
|
elmlang
|
general
|
on <http://packages.elm-lang.org|packages.elm-lang.org>
|
2019-02-28T03:22:50.003000
|
Adrian
|
elmlang
|
general
|
<@Amee> if you go to <http://packages.elm-lang.org|packages.elm-lang.org> the list of packages are all only 0.19 packages
|
2019-02-28T03:24:07.004400
|
Earlean
|
elmlang
|
general
|
You can only find 0.18 package via Google searches or accessing their page directly
|
2019-02-28T03:24:44.005200
|
Earlean
|
elmlang
|
general
|
oh :slightly_smiling_face:
|
2019-02-28T03:37:09.005400
|
Adrian
|
elmlang
|
general
|
Or here for those that have not migrated yet:
<https://dmy.github.io/elm-0.18-packages/>
|
2019-02-28T03:39:32.005700
|
Velia
|
elmlang
|
general
|
I find `Html.Lazy` (and `Element.Lazy`) hard to use in some situations, because they rely on referential equality. I would like an alternative with deep (value-based) equality checks on the input arguments instead. Is that possible?
|
2019-02-28T04:25:56.008000
|
Lucius
|
elmlang
|
general
|
can anyone explain this?
```
minus3 a = a -3
```
gives
```
<function> : (number -> a) -> a
```
But ``` minus3 a = a - 3 ``` gives ```<function> : number -> number```.
|
2019-02-28T04:27:52.009000
|
Yolando
|
elmlang
|
general
|
in `elm repl`
|
2019-02-28T04:28:05.009200
|
Yolando
|
elmlang
|
general
|
`-3` is a number, so `a` must be a function of type `number -> a` since you apply the number `-3` to (the function) `a`.
|
2019-02-28T04:29:02.009900
|
Lewis
|
elmlang
|
general
|
but `a - 3` is the result of subtracting 3 from `a`, so `a` must be a number in that case.
|
2019-02-28T04:29:20.010500
|
Lewis
|
elmlang
|
general
|
```
> 3
3 : number
> -3
-3 : number
```
|
2019-02-28T04:31:24.011100
|
Lewis
|
elmlang
|
general
|
Yep, the first one might be clearer written as:
```
applyToNeg3 f = f (-3)
```
|
2019-02-28T04:35:01.012000
|
Velia
|
elmlang
|
general
|
What's shadowing?
```
> a bb = bb + 4
<function> : number -> number
> minus3 aa = a -3
<function> : a -> number
> minus3 5
1 : number
> minus4 a = a -4
-- SHADOWING --------------------------------------------------------------- elm
The name `a` is first defined here:
3| a bb = bb + 4
^
But then it is defined AGAIN over here:
5| minus4 a = a -4
^
Think of a more helpful name for one of them and you should be all set!
Note: Linters advise against shadowing, so Elm makes “best practices” the
default. Read <https://elm-lang.org/0.19.0/shadowing> for more details on this choice.
```
|
2019-02-28T04:36:07.012100
|
Yolando
|
elmlang
|
general
|
I tried making `a` a function.
But `a` cannot be taken as input to another function `minus4`.
|
2019-02-28T04:36:48.012400
|
Yolando
|
elmlang
|
general
|
i.e. I cannot write `minus4 a = a -4`.
|
2019-02-28T04:37:04.012600
|
Yolando
|
elmlang
|
general
|
Thanks mate!
|
2019-02-28T04:37:23.012800
|
Yolando
|
elmlang
|
general
|
can you please have a look at this?
<
(<https://elmlang.slack.com/archives/C0CJ3SBBM/p1551346567012100?thread_ts=1551346142.009900&cid=C0CJ3SBBM>)>
|
2019-02-28T04:38:56.013000
|
Yolando
|
elmlang
|
general
|
shadowing is when you redefine a function or constant already defined previously.
|
2019-02-28T04:39:22.013300
|
Velia
|
elmlang
|
general
|
```
> myFunction x = x + 4
<function> : number -> number
> minus4 a = a -4
<function> : (number -> a) -> a
> minus4 myFunction
0 : number
```
|
2019-02-28T04:39:35.013500
|
Lewis
|
elmlang
|
general
|
`a` is already a function defined as:
```
a bb = bb + 4
```
so you cannot use it again as a parameter in
```
minus4 a = a -4
```
|
2019-02-28T04:40:14.013700
|
Velia
|
elmlang
|
general
|
you can do `:reset` to clear previous definitions in `elm repl`. See `:help`.
|
2019-02-28T04:40:41.013900
|
Velia
|
elmlang
|
general
|
_shadowing_ means that you “hide” another name. since you already had the name `a` in your scope, when you also declare a parameter named `a` for a function, the outer `a` will be hidden (“shadowed”) within that function.
|
2019-02-28T04:41:24.014100
|
Lewis
|
elmlang
|
general
|
No, it is not possible. The point of `Html.Lazy` is to avoid calculations when input does not change. Doing value-based equality partially defeats the purpose. I think it is more beneficial to put effort into refactoring so using `Html.Lazy` won't be hard.
|
2019-02-28T04:43:27.014400
|
Lynne
|
elmlang
|
general
|
hi everyone
|
2019-02-28T04:46:11.014700
|
Sherill
|
elmlang
|
general
|
i'm using this library (<https://package.elm-lang.org/packages/ryannhg/date-format/2.3.0/>) to format dates
|
2019-02-28T04:46:51.015000
|
Sherill
|
elmlang
|
general
|
and I'm having difficulties in passing a custom timezone for formatting purposes
|
2019-02-28T04:47:05.015500
|
Sherill
|
elmlang
|
general
|
it seems like the only zones we can have using the official `Time` package are `utc` and the local one (using the task `now`)
|
2019-02-28T04:47:29.016100
|
Sherill
|
elmlang
|
general
|
am I getting this correctly? thanks
|
2019-02-28T04:47:35.016400
|
Sherill
|
elmlang
|
general
|
That is correct <@Sherill>
|
2019-02-28T04:48:41.016600
|
Lynne
|
elmlang
|
general
|
You can build your own `Zone` objects using `Time.customZone` however
|
2019-02-28T04:49:10.017400
|
Lynne
|
elmlang
|
general
|
okay so for example, if I am developing a finance webapp that shows different times/dates from different timezones all over the world
|
2019-02-28T04:49:45.017800
|
Sherill
|
elmlang
|
general
|
I have to develop a `customZone`, which seems intended for package developers only
|
2019-02-28T04:50:07.018300
|
Sherill
|
elmlang
|
general
|
am I right?
|
2019-02-28T04:50:08.018500
|
Sherill
|
elmlang
|
general
|
It is not that you have to develop a `customZone` it is that Elm currently does not have built-in support for such use case
|
2019-02-28T04:50:44.019200
|
Lynne
|
elmlang
|
general
|
You can however use <https://package.elm-lang.org/packages/isaacseymour/deprecated-time/latest> until an official package appears
|
2019-02-28T04:51:24.020100
|
Lynne
|
elmlang
|
general
|
<https://package.elm-lang.org/packages/justinmimbs/timezone-data/latest/>
|
2019-02-28T04:51:33.020300
|
Huong
|
elmlang
|
general
|
Oh great, I did not know about it :slightly_smiling_face:
|
2019-02-28T04:51:52.020600
|
Lynne
|
elmlang
|
general
|
It's (predictably) rather large, though, but it also lists alternatives :slightly_smiling_face:
|
2019-02-28T04:52:39.021100
|
Huong
|
elmlang
|
general
|
I think if one wants playing with different time zones there is no alternative to loading IANA db (be it this package or something like moment-tz). Or is there extended support in JS for such cases?
|
2019-02-28T04:53:44.021900
|
Lynne
|
elmlang
|
general
|
There are a few things in the proposal stage, but I don't think the TC39 committee have committed to anything yet
|
2019-02-28T04:57:54.022100
|
Huong
|
elmlang
|
general
|
oh. Okay. Thanks!
|
2019-02-28T04:59:19.022300
|
Yolando
|
elmlang
|
general
|
Ok, thank you! I've already started refactoring :slightly_smiling_face:
|
2019-02-28T05:06:46.022600
|
Lucius
|
elmlang
|
general
|
Hey! I'm trying to preview docs, as described here: <https://elm-doc-preview.netlify.com/> . I'm running `elm make --docs=docs.json src/Spring.elm` and the output is `Success! Compiled 1 module.`, but I can't find the `docs.json` file anywhere. Am I missing something?
|
2019-02-28T05:56:37.024000
|
Dorsey
|
elmlang
|
general
|
Oh, wait. I think I'm missing the docs markup. Silly me.
|
2019-02-28T06:02:48.024700
|
Dorsey
|
elmlang
|
general
|
Assuming this is a package:
- add the module to the exposed-modules field in your elm.json
- add docs (elm will complain if you don't :wink: )
- `elm make --docs=docs.json` should do the trick, it's intelligent enough to pick up the exposed modules
|
2019-02-28T06:03:59.025000
|
Huong
|
elmlang
|
general
|
Aha. So I can't export docs for application?
|
2019-02-28T06:04:59.025200
|
Dorsey
|
elmlang
|
general
|
Unfortunately not yet.
```
$ elm make --help
...
--docs=<json-file>
Generate a JSON file of documentation for a package. Eventually it will
be possible to preview docs with `reactor` because it is quite hard to
deal with these JSON files directly.
```
Note the *`for a package`*.
Also see this:
<https://github.com/elm/compiler/issues/1835#issuecomment-440080525>
|
2019-02-28T06:26:49.025400
|
Velia
|
elmlang
|
general
|
Hey all! What do you think would be the advantage of using a `Request` instead of a `Task` when making Http requests? You can chain, map tasks much easier.
|
2019-02-28T08:02:04.028200
|
Leonore
|
elmlang
|
general
|
The latest incarnation of `elm/http` did away with the `Request` type :slightly_smiling_face: <https://package.elm-lang.org/packages/elm/http/latest/Http>
|
2019-02-28T08:03:09.028700
|
Huong
|
elmlang
|
general
|
Ok sure but you can still create a `request` instead of a `task`
|
2019-02-28T08:04:39.029100
|
Leonore
|
elmlang
|
general
|
Well, you can either create a `Cmd` or a `Task`
|
2019-02-28T08:05:32.029500
|
Huong
|
elmlang
|
general
|
The advantage being that most requests have no benefit from going through the extra step of being a `Task` first, since they need to be executed eventually
|
2019-02-28T08:06:16.030600
|
Huong
|
elmlang
|
general
|
I guess I don't understand why that is an advantage
|
2019-02-28T08:07:22.031000
|
Leonore
|
elmlang
|
general
|
Let's make sure we're on the same page, though. The current API allows (very straightforwardly) to create a simple request to get/post/whatever something over HTTP by means of a `Cmd msg`. Sometimes, more complex scenarios are required, where requests need to be chained. For that scenario, it also allows creating a lower level `Task x a`. Does that make sense?
|
2019-02-28T08:11:13.034100
|
Huong
|
elmlang
|
general
|
Yes
|
2019-02-28T08:11:41.034300
|
Leonore
|
elmlang
|
general
|
Alright, so can you re-frame your question with that information in mind? I'm having a hard time understanding what the question means, right now :sweat_smile:
|
2019-02-28T08:12:44.035900
|
Huong
|
elmlang
|
general
|
Haha. Well, ok an example might make more sense. Let's say I have a request that grabs some element `Item` depending on an `id`. Some parts of the code I know what the `id` is so I just use that. In some other cases I have to grab the `ids` from another request and then sequence the requests to grab each `Item`. I can only do that with `task`s. Now, I have an `Api` module that contains all the get/post etc. There, I have to add new ones just for the tasks and write `Resolver`s just for them instead of `Expect`s. My question was that what if I just scrap that and use tasks for everything? What are the reasons not to do that if any? Note that I have to write some type of `expect` anyways because we also lose data on the errors with the new api.
|
2019-02-28T08:19:44.041300
|
Leonore
|
elmlang
|
general
|
It's quite possible that for your use-case, using `Tasks` for all requests and converting to `Cmd` as required is more convenient. In my experience, chaining requests isn't a very common requirement (it sounds like the API isn't really making it easy to work with it :sweat_smile: ), so I definitely see the advantage in the "make the simple things easy, make complex things possible" approach that was used for the 2.0.0 version of the library. The main difference between a `Resolver` and an `Expect` (in the lower level interface you have to use if you need the body from a failed request) is that you have to provide the `(Result x a -> msg)` when setting up the `Expect`, while you only supply that same function to `Task.attempt` when dealing with a `Resolver`. So the building blocks are the same, the difference is in where you need to supply them
|
2019-02-28T08:29:58.047600
|
Huong
|
elmlang
|
general
|
Yes, but there are also some other cases like maybe you want to make the call after some delay.
|
2019-02-28T08:31:16.048900
|
Leonore
|
elmlang
|
general
|
Then you need a Task again
|
2019-02-28T08:31:20.049100
|
Leonore
|
elmlang
|
general
|
Thanks, I was just wondering if there was an advantage to using the `request`s
|
2019-02-28T08:31:51.050100
|
Leonore
|
elmlang
|
general
|
Upgrading to 2.0.0 increased the code for me :sweat_smile:
|
2019-02-28T08:32:31.051100
|
Leonore
|
elmlang
|
general
|
Yeah, or using 2 messages, for people who prefer to stick to `Cmd`'s. Fair question, though!
|
2019-02-28T08:32:37.051300
|
Huong
|
elmlang
|
general
|
I think you may be able to refactor that quite a bit by sharing the `(Response String -> Result x a)` functions, and setting up some higher level helper functions for constructing your requests as tasks or as commands as you see fit. I'll be honest, I haven't upgraded our primary project to elm/[email protected] yet, because I know it'll be quite a bit of work :smile:
|
2019-02-28T08:34:25.053400
|
Huong
|
elmlang
|
general
|
Yeah, fair enough
|
2019-02-28T08:37:57.053600
|
Leonore
|
elmlang
|
general
|
:smile:
|
2019-02-28T08:38:04.053800
|
Leonore
|
elmlang
|
general
|
hey everybody. Im confused about the polimorfic type of the error here:
`
|
2019-02-28T10:53:48.054700
|
Yang
|
elmlang
|
general
|
<https://package.elm-lang.org/packages/elm/time/latest/Time#here>
|
2019-02-28T10:53:49.054900
|
Yang
|
elmlang
|
general
|
it sais: `here : Task x Zone`
|
2019-02-28T10:54:04.055100
|
Yang
|
elmlang
|
general
|
i want to know exactly what x is
|
2019-02-28T10:54:13.055500
|
Yang
|
elmlang
|
general
|
such that in my Msg i have: TimeZoneFailed x
|
2019-02-28T10:54:27.056100
|
Yang
|
elmlang
|
general
|
It's polymorphic because it can't fail
|
2019-02-28T10:54:31.056300
|
Kris
|
elmlang
|
general
|
where x is not polimorfic
|
2019-02-28T10:54:32.056400
|
Yang
|
elmlang
|
general
|
hmm..
|
2019-02-28T10:54:42.056700
|
Yang
|
elmlang
|
general
|
You don't need to handle a failure
|
2019-02-28T10:54:43.056800
|
Kris
|
elmlang
|
general
|
You can use <https://package.elm-lang.org/packages/elm/core/latest/Task#perform> for that
|
2019-02-28T10:55:04.057300
|
Kris
|
elmlang
|
general
|
`Time.here
|> Task.attempt (\result ->
case result of
Ok timeZone ->
TimeZoneSuceeded timeZone
Err error ->
TimeZoneError error
)`
|
2019-02-28T10:55:11.057500
|
Yang
|
elmlang
|
general
|
aha ok
|
2019-02-28T10:55:22.057800
|
Yang
|
elmlang
|
general
|
so is like never
|
2019-02-28T10:55:25.058100
|
Yang
|
elmlang
|
general
|
Yep
|
2019-02-28T10:55:29.058400
|
Kris
|
elmlang
|
general
|
As an analogy, `res : Result x Int` means the same thing, that it can't be an `Err`
|
2019-02-28T10:56:02.059200
|
Kris
|
elmlang
|
general
|
im gonna test it but i think it will not compile since `x` is not `Never`
|
2019-02-28T10:57:08.059700
|
Yang
|
elmlang
|
general
|
it supposed to be a Never such that it mapps the type asked by Task.attempt
|
2019-02-28T10:57:29.060200
|
Yang
|
elmlang
|
general
|
i think
|
2019-02-28T10:57:32.060500
|
Yang
|
elmlang
|
general
|
Well, it's polymorphic, so you can specialise the type variable to whatever you want
|
2019-02-28T10:59:31.061200
|
Kris
|
elmlang
|
general
|
I.e, ```myHere : Task Never Time
myHere = Time.here``` should compile just fine
|
2019-02-28T11:00:03.062000
|
Kris
|
elmlang
|
general
|
aha so hmm.. ok we are going form general to specific that why. Ok thanks for explaining :smile:
|
2019-02-28T11:00:34.062500
|
Yang
|
elmlang
|
general
|
:hugging_face:
|
2019-02-28T11:00:38.062700
|
Yang
|
elmlang
|
general
|
No problem!
|
2019-02-28T11:01:03.062900
|
Kris
|
elmlang
|
general
|
Hi, is there a reason why it's not possible to do the following?
```
someConstantValue = 5
foo a =
case a of
someConstantValue -> "5"
_ -> ""
```
I'm wondering if there is some theoretical reason behind disallowing this or if it's just low priority to add it.
|
2019-02-28T11:57:07.065300
|
Jae
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.