workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
[Not sure if this is the right channel] Hello all, I am trying to use `"mdgriffith/style-elements": "5.0.1"` package while also already using ` "mdgriffith/elm-ui": "1.1.0"` for my UI. the only reason for using ` mdgriffith/style-element` is the support for `Element.Attributes` for things like `percent` . however when I have both the packages i get the below error ```The Main module has an ambiguous import: import Element.Keyed I found multiple module with that name though: exposed by mdgriffith/style-elements 5.0.1 exposed by mdgriffith/elm-ui 1.1.0 It looks like the name clash is in your dependencies, which is out of your control. Elm does not support this scenario right now, but it may be worthwhile. Please open an issue describing your scenario so we can gather more usage information!``` Any help would be much appreciated
2019-04-15T17:00:10.228800
Mirtha
elmlang
general
You cannot use both packages, they are conflicting. Can't you use <https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest/Element#fillPortion> instead of percents?
2019-04-15T17:05:46.230100
Velia
elmlang
general
aaahhhhh. Thank you
2019-04-15T17:06:20.231000
Mirtha
elmlang
general
<@Mirtha> Isn't style-elements the old version of elm-ui? That would explain the namespace conflict.
2019-04-15T17:06:24.231100
Dayna
elmlang
general
Thanks <@Dayna>
2019-04-15T17:07:06.231700
Mirtha
elmlang
general
Yes, there are actually three versions: - elm-ui - style-elements - stylish-elephants
2019-04-15T17:09:34.231800
Velia
elmlang
general
A way of implementing “holes” a la Idris in Elm.
2019-04-15T17:21:25.232100
Jana
elmlang
general
Anyone have experience (or insight) in something like this? Clicking the various code locations in the error logs here leads me to functions like Dict.get and Dict.map. This only happens in Chrome, not in Firefox. Based on issues like <https://github.com/elm/core/issues/986> I figured it was fixed in Elm 0.19 but I’m getting this issue even after upgrading to 0.19.
2019-04-15T19:20:08.232400
Vonda
elmlang
general
<@Vonda> that issue was fixed, but you'll get this error for other things that use deep recursion
2019-04-15T19:23:52.234900
Earlean
elmlang
general
so should i just be looking through my elm code for any recursion that i can improve?
2019-04-15T19:26:40.235300
Vonda
elmlang
general
or is there a more streamlined way to find the actual source of the issue
2019-04-15T19:26:58.235600
Vonda
elmlang
general
also worth noting that i only randomly got this issue one day, when the previous day it worked fine. i’ve entered a lot of data into the database over the months, clearly on that day i reached the limit for this recursion issue
2019-04-15T19:28:06.236600
Vonda
elmlang
general
additionally worth noting that building the app and loading that built version avoids this issue. i only get it when locally deploying in dev mode
2019-04-15T19:28:48.237100
Vonda
elmlang
general
Oh, it might be the Elm debugger
2019-04-15T19:29:48.237600
Earlean
elmlang
general
It tends to struggle as your model gets larger
2019-04-15T19:30:13.238100
Earlean
elmlang
general
Try compiling without `--debug`
2019-04-15T19:30:49.238600
Earlean
elmlang
general
yeah compiling without `--debug` fixed it
2019-04-15T19:32:55.238900
Vonda
elmlang
general
good to know. should i just avoid using the debugger then? or is there a solution
2019-04-15T19:33:44.239300
Vonda
elmlang
general
If I am writing a library where I depend on a couple other libraries, but I need to expose/re-export the data types for the user, how should I go about doing that? I also don't want the user to have to manually install several libraries just to use mine, and then have to add a ton of import declarations. I thought about including a subset of these libraries in my own, or writing my own implementation to reduce dependencies and allow better integration with my library code.
2019-04-15T22:47:16.242300
Isaiah
elmlang
general
<@Isaiah> Not sure if you can re-export imported types, might need to write type aliases for them and export that. But w/ the current compiler version, I think that'll break the debugger for library consumers.
2019-04-15T22:51:18.243400
Earnest
elmlang
general
Type alias are what you want. But note that there isn't a way to re-export constructors
2019-04-15T22:52:31.244600
Earlean
elmlang
general
That's the problem then, because the user needs to have access to the constructors
2019-04-15T22:56:16.245100
Isaiah
elmlang
general
the libraries are small (single file, under 1k loc) so including them in my own should be fine, and also give me a chance to fix any issues and remove code I don't need
2019-04-15T22:57:11.246000
Isaiah
elmlang
general
I'm seeking advice on how to make a single javascript function call. Basically it needs to be done once, but it doesn't matter if it's called more often. I know you can't make javascript calls in Elm (anymore), but this library isn't likely to be package anytime soon. Any tips on how to do this with Elm 0.19?
2019-04-15T23:37:15.247800
Erlene
elmlang
general
The javascript function itself is pure. And it would be so handy if I could simply call it from Elm.
2019-04-15T23:37:44.248400
Erlene
elmlang
general
Your options are either ports, something like <https://medium.com/@jjant/making-elm-unsafe-cc6435495af2> or the proxy trick.
2019-04-15T23:38:52.249400
Kris
elmlang
general
<@Erlene> why is it called only once? Can you call it before you start Elm?
2019-04-15T23:39:44.250700
Earlean
elmlang
general
<@Earlean> yes, I possibly could, but the problem is I need its value somewhere deep inside. Passing that all the time is annoying.
2019-04-15T23:40:54.251400
Erlene
elmlang
general
Basically what this is is calculating the size of the horizontal scrollbar.
2019-04-15T23:41:10.251800
Erlene
elmlang
general
The javascript does that by inserting an element, measuring the scrollbar, and removing the element from the DOM again
2019-04-15T23:41:33.252300
Erlene
elmlang
general
Not something I can see myself doing in Elm. And it needs to be done once, not all the time I'm drawing elements that need to know this stuff.
2019-04-15T23:41:55.252800
Erlene
elmlang
general
<@Kris> hmm, replacing code won't work for me, although it's an interesting technique. What's the proxy trick?
2019-04-15T23:42:55.253500
Erlene
elmlang
general
Seems like something you compute in JS, pass as a Flag, and store on your Model so that it’s available throughout…?
2019-04-15T23:47:15.254200
Dede
elmlang
general
<@Dede> yeah, that might be the cleanest, although getting it where it needs to be isn't :slightly_smiling_face:
2019-04-15T23:51:40.254800
Erlene
elmlang
general
<@Erlene> <https://ellie-app.com/5gTZKqtg9HTa1>
2019-04-15T23:58:06.255100
Kris
elmlang
general
that's the gist of it
2019-04-15T23:58:09.255400
Kris
elmlang
general
Yeah, that's basically passing it as a flag isn't it?
2019-04-16T00:00:21.255800
Erlene
elmlang
general
I need just the value once, so the ability to call it as a function isn't needed.
2019-04-16T00:00:41.256400
Erlene
elmlang
general
Perhaps I simply need a Kernel module...
2019-04-16T00:00:49.256700
Erlene
elmlang
general
I feel like if it’s hard to get data from your Model to some part of your code, something’s gotten overly convoluted.
2019-04-16T00:02:02.257200
Dede
elmlang
general
I realize I am entirely unaware of your design constraints, however.
2019-04-16T00:02:19.257500
Dede
elmlang
general
<@Dede> normally I'd agree, but this is a library used by others. So if I can avoid having to pass this in, but have the value simply available, that would make it easiest.
2019-04-16T00:06:17.258500
Erlene
elmlang
general
Could they pass it in once?
2019-04-16T00:06:47.259200
Dede
elmlang
general
Elm really should have a system for "values that are constant for the life of the program but aren't known at compile time"
2019-04-16T00:06:56.259500
Earlean
elmlang
general
flags really should be that system
2019-04-16T00:07:21.260300
Earlean
elmlang
general
I’m thinking something very roughly where you `init` your `Widgets` library and then the API is actually returned in a record that you can store on the Model and call directly. ``` module Widgets exposing (init, Widgets) type alias Widgets = { button: ButtonOptions -&gt; Button, ... } init: Int -&gt; Widgets ... ```
2019-04-16T00:09:28.262800
Dede
elmlang
general
This goes against the advice that says never store closures on the Model, but given that the arguments are immutable, I think it’s OK.
2019-04-16T00:10:02.263600
Dede
elmlang
general
that's the common solution for things like this in functional languages, but then use lose the benefits of `import`
2019-04-16T00:10:51.264600
Earlean
elmlang
general
`import` is, "give me direct access to these global constants in this module"
2019-04-16T00:11:32.265300
Earlean
elmlang
general
it would be great if you could do the same but for runtime constants
2019-04-16T00:11:54.265700
Earlean
elmlang
general
Fair enough.
2019-04-16T00:12:03.265900
Dede
elmlang
general
eg. `import flags` and `flags` gives you access to the `flags` value passed in to `init`
2019-04-16T00:12:50.267000
Earlean
elmlang
general
yeah having to pass everything around is horrible
2019-04-16T00:15:58.268200
Kris
elmlang
general
Building a program without thinking where the facts come from and how they're passed around makes the program harder to refactor when the program grows and becomes more configurable. I'd prefer better systems for passing around information, instead of changing the way imports work or anything like that. Haskell has the Reader type, but it could be something completely different.
2019-04-16T00:25:17.270600
Rosanne
elmlang
general
but the same could be said for `import`
2019-04-16T00:26:00.271000
Earlean
elmlang
general
never use `import` only ever receive functions as parameters.
2019-04-16T00:28:08.271800
Earlean
elmlang
general
which is great advice and gives you great seams for future changes, but it's a real pain
2019-04-16T00:31:15.272600
Earlean
elmlang
general
Reader doesn’t improve the situation that much in that regards
2019-04-16T00:35:23.273800
Kris
elmlang
general
It’s still literally the same as passing a parameter, with the annoyance of having to do it even for constants
2019-04-16T00:35:52.274800
Kris
elmlang
general
Hello! Is there a way to access response headers using <https://package.elm-lang.org/packages/ohanhi/remotedata-http/latest/> by <@Bert>? My program is interacting with GitHub API (v3) and the pagination data is exposed as headers. Do I need to use plain `elm/http` with `expectStringResponse`?
2019-04-16T01:48:40.277600
Dorsey
elmlang
general
Yep, you will
2019-04-16T01:53:04.277900
Earlean
elmlang
general
Thanks!
2019-04-16T01:57:24.278200
Dorsey
elmlang
general
Can elm import JS files?
2019-04-16T03:13:41.278500
Carrie
elmlang
general
Not really; you can interact with native JS lib through ports
2019-04-16T03:14:45.279100
Allyn
elmlang
general
<https://guide.elm-lang.org/interop/ports.html>
2019-04-16T03:15:17.279300
Allyn
elmlang
general
Oh, I see.thanks
2019-04-16T03:23:05.280000
Carrie
elmlang
general
But I saw the phrase "import Native. Ace" at <https://github.com/DenisKolodin/elm-ace/blob/master/src/Ace.elm>. Isn't he importing the Ace. JS file?
2019-04-16T03:26:59.280300
Carrie
elmlang
general
There used to be so called native modules - specially written JS files which one could "import" and use within Elm app, but they are gone in 0.19
2019-04-16T03:34:51.281400
Lynne
elmlang
general
The example you found will only work in Elm 0.18
2019-04-16T03:35:07.281700
Lynne
elmlang
general
Oh, that's it.
2019-04-16T03:37:13.281900
Carrie
elmlang
general
thanks
2019-04-16T03:37:25.282200
Carrie
elmlang
general
This discussion is relevant: <https://discourse.elm-lang.org/t/how-to-re-export-values-and-types-from-a-module/3142>
2019-04-16T03:39:29.282300
Velia
elmlang
general
Hey! I'm using `AssocList` imported as `Dict`, but then one of the other modules (Http) returns a standard `Dict`. How can I avoid naming clashes? Preferably I would just convert the `Dict` into `AssocList.Dict`. Is there something like `AssocList.fromDict`?
2019-04-16T04:44:44.285600
Dorsey
elmlang
general
For the name clash, you cannot import it as `Dict` if you already use `Dict` in the same module. For the conversion: ``` Dict.toList dict |&gt; AssocList.fromList ```
2019-04-16T04:47:04.286200
Velia
elmlang
general
Yeah. That's where I'm coming from.
2019-04-16T04:47:31.286400
Dorsey
elmlang
general
I thought there may be some clever way to avoid importing `Dict` at all.
2019-04-16T04:48:04.286600
Dorsey
elmlang
general
I think you can put the conversion function in a another module, so you can directly convert without importing Dict (if you don't need it in signatures)
2019-04-16T04:50:08.286800
Velia
elmlang
general
But it's not included in `AssocList` itself.
2019-04-16T04:51:05.287000
Velia
elmlang
general
Sure. I'll just do `import Dict as StandardDict` for now. It adds to the noise, but separate module would add even more IMO.
2019-04-16T04:51:06.287200
Dorsey
elmlang
general
I changed to using it like `import AssocList as Assoc` and `Assoc.get` etc.
2019-04-16T04:51:29.287400
Nana
elmlang
general
Oh, that's nice! I'll do it too <@Nana>.
2019-04-16T04:52:05.287600
Dorsey
elmlang
general
I found it a bit confusing to "impersonate" a data type like that, not very explicit
2019-04-16T04:53:16.287800
Nana
elmlang
general
Yeah, good point. I hope in some future realease of Elm standard Dict will have the same properties as AssocList.Dict and the whole confusion will go away.
2019-04-16T04:54:21.288200
Dorsey
elmlang
general
Hey all, I'm writing a parser for template strings (for example `there are {numberOfPeople} online`) and I want to extract the placeholder name, what I've come up is: ``` succeed identity |. chompUntil "{" |. symbol "{" |= getChompedString (chompWhile (\c -&gt; c /= '}')) ``` but it seems kind of convoluted. Is there any way to make it simpler?
2019-04-16T05:03:15.290100
Dayna
elmlang
general
What can I do to convert my current 0.19 version of elm to 0.18 version?
2019-04-16T05:33:59.290400
Carrie
elmlang
general
look at the docs for npm install
2019-04-16T05:40:41.290900
Rosario
elmlang
general
`npm install [email protected]` or someting
2019-04-16T05:41:11.291200
Rosario
elmlang
general
Hello! Would you mind sharing the slackbot (the one that prompts us to be inclusive in the way we communicate) settings? :slightly_smiling_face:
2019-04-16T05:43:44.293000
Cyndy
elmlang
general
`npm show elm` shows you the tags. You want `npm install [email protected]`
2019-04-16T05:43:47.293300
Rosario
elmlang
general
It does not look convoluted to me, why do you think so? You could use: ``` succeed identity       |. chompUntil "{"       |. symbol "{"       |= getChompedString (chompUntil "}") |. symbol "}" ``` But it's not that different. As an aside, beware this bug (position is consumed, not the string): <https://github.com/elm/parser/issues/20>
2019-04-16T05:49:36.293400
Velia
elmlang
general
You could use identity as well, something like that : ``` [ "element" ] |&gt; if bool then (::) "plus" else identity ```
2019-04-16T05:54:23.293700
Syble
elmlang
general
I think <#C3FKL0A8H|admin-help> is where you might get it
2019-04-16T08:33:50.294700
Bert
elmlang
general
hi, does anyone here run `npm audit`? currently seeing all of these issues:
2019-04-16T08:52:15.295600
Nancy
elmlang
general
Yeah, the team's aware. It's due to a dependency of `binstall`, so the solution needs to bubble up
2019-04-16T09:07:39.296000
Huong
elmlang
general
will this need a new release of the affected packages?
2019-04-16T09:13:14.296300
Nancy
elmlang
general
Morning folks. If I have a bunch of html that is not really changing except for a very small, almost single div (think removing a class from one span and adding the class to another), would making everything else keyed have a useful impact on the performance of the vdom diffing? Say if the keys were at the highest level, so it would know it didn’t have to go further down to compare?
2019-04-16T10:26:56.298200
Hoyt
elmlang
general
Is it a function that returns HTML or is a literal?
2019-04-16T10:28:13.298500
Sabra
elmlang
general
function
2019-04-16T10:29:09.298800
Hoyt
elmlang
general
Returning `Html msg`
2019-04-16T10:29:16.299000
Hoyt
elmlang
general
Thanks!
2019-04-16T10:29:39.299300
Cyndy