workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
thanks <@Niesha>
2019-01-04T19:34:58.617200
Ron
elmlang
general
Yeah.
2019-01-04T19:38:34.617400
Niesha
elmlang
general
Sure.
2019-01-04T19:38:42.617600
Niesha
elmlang
general
I tried to do this
2019-01-04T19:40:13.617800
Ron
elmlang
general
funcListx = [ filterBySalesStatus ,filterByYear ,filterByMake ,filterByModel ,filterBySleeperRoof ,filterBySleeperBunk ] upx = foldl (&gt;&gt;) (model.truckList) funcListx
2019-01-04T19:40:16.618100
Ron
elmlang
general
that elm search is really useful, thanks for sharing it
2019-01-04T19:40:18.618200
Lucilla
elmlang
general
Just a heads up, if you surround your code in three backticks ( ` ) then it’ll format in a nice monospaced code block
2019-01-04T19:41:11.619500
Danika
elmlang
general
I am getting compiler error, I guess I need to learn the signatures clearly
2019-01-04T19:41:37.619700
Ron
elmlang
general
oh, ok. thx.
2019-01-04T19:41:56.620100
Ron
elmlang
general
I use this, it works but it’s probably not the most efficient way to do it. ``` filters : List (a -&gt; Bool) -&gt; List a -&gt; List a filters predicates list = List.foldl List.filter list predicates ``` I suppose composing the filters instead would only require a single pass instead doing one for each filter as I do here?
2019-01-04T20:22:56.622300
Lizabeth
elmlang
general
Something like this? ``` filters : List (a -&gt; Bool) -&gt; List a -&gt; List a filters fs = List.filter (\i -&gt; List.all (\filter -&gt; filter i) fs) ```
2019-01-04T21:13:19.625300
Earnest
elmlang
general
does anybody know if this is possible? - given a union type where all tag data have the same extensible record base - extract the extensible record tag data without a case statement
2019-01-04T21:19:03.626500
Tu
elmlang
general
(made a union type so i could cram heterogenous form types into a single collection; hoped to avoid case statements using extensible records; seems impossible)
2019-01-04T21:20:07.627600
Tu
elmlang
general
Don't think so, I'd try putting the tag as a field in the extensible record
2019-01-04T21:21:12.627900
Earnest
elmlang
general
``` type NotThis a = MyS { a | field : String } MyI { a | field : String } type alias ButThis a = { a | field : String, type_ : MyType } type MyType = MyS | MyI ``` ?
2019-01-04T21:22:31.630000
Earnest
elmlang
general
hm, that sounds interesting and something i hadn't considered, but in this case it would push the heterogenous data the the tag is hiding up into the record, making the collection items polymorphic
2019-01-04T21:22:39.630200
Tu
elmlang
general
Ah, you mean you want somethng like this? ``` type This a b = MyS { a | field : String } | MyI { b | field : String } ```
2019-01-04T21:23:19.630800
Earnest
elmlang
general
yeah i think so but this syntax is new to me
2019-01-04T21:24:01.631400
Tu
elmlang
general
i'm using type aliases with arguments
2019-01-04T21:24:12.631800
Tu
elmlang
general
whew
2019-01-04T21:24:38.632100
Tu
elmlang
general
thank you
2019-01-04T21:24:40.632300
Tu
elmlang
general
yeah that's a nicer way of expressing what i've done (so thanks for that)
2019-01-04T21:25:12.632900
Tu
elmlang
general
I haven't played with anything like that yet but I imagine you'd still need to case match
2019-01-04T21:25:44.633500
Earnest
elmlang
general
yeah.. it's just a little irritating b/c each branch has the same value
2019-01-04T21:26:48.634400
Tu
elmlang
general
I guess the benefit of the alias is that you don't have to case match until you get to the `MyType` specific fields. Like `type MyType = MyS { stringSpecificField : String } | MyI { intSpecificField : Int }`
2019-01-04T21:27:58.635500
Earnest
elmlang
general
along with the above `ButThis` type. then you can access shared fields normally but have to case when you get to the `MyType` fields
2019-01-04T21:29:03.636700
Earnest
elmlang
general
interesting — but i don't think you can make a `List ButThis a`, can you? as soon as you try to, say, create a literal instance `[ {field = "asdf", intField = 1}, {field = "wert", floatField = 2.0}]`, the compiler will :face_vomiting:
2019-01-04T21:32:37.638700
Tu
elmlang
general
No it'd be more like: ``` myList = [ { someField = "9001", fieldType = IntField 1 } , { someField = "42", fieldType = FloatField 2.0 } ] ```
2019-01-04T21:34:00.639900
Earnest
elmlang
general
So you encode the differences in it's own type, and then that type can be a field of the more general record
2019-01-04T21:34:41.640800
Earnest
elmlang
general
that's neat
2019-01-04T21:34:43.640900
Tu
elmlang
general
:tada:
2019-01-04T21:35:03.641400
Earnest
elmlang
general
thanks a million :slightly_smiling_face: super handy to have y'all smarties around here to help me expand my type imagination...
2019-01-04T21:35:34.642200
Tu
elmlang
general
No problem, abstract modeling is fun :stuck_out_tongue:
2019-01-04T21:35:56.642500
Earnest
elmlang
general
it is! i had a rough handful of evenings but as soon as i got the hang of combining unions and extensible records i started to get excited
2019-01-04T21:36:36.643400
Tu
elmlang
general
<@Earnest>this may not come as a surprise to anyone but me, but now that i've finally solved the problem i set out to solve (defining a list of form inputs with associated types), i've just about decided i should move the heterogeneous values out of the input records altogether and convert the strings to the appropriate type wherever i access those fields (seems like less code than case statements in the same places)
2019-01-04T22:05:09.645500
Tu
elmlang
general
hi <@Lizabeth>, do you have a working sample of this code ?
2019-01-04T23:23:21.645900
Ron
elmlang
general
I am really having hardtime to understand this, any help would be greatly appreciated
2019-01-04T23:25:33.646100
Ron
elmlang
general
`applyFilters filterCategory filters = List.foldl executeFilterFunc (uiModel.selectedFilterBullets, model.truckList) (List.filter (\(fltrCategory, fn) -&gt; fltrCategory /= filterCategory ) funcList) |&gt; rebuildFilters filterCategory filters executeFilterFunc (fnCategory, fn) (sfBullets, trks) = fn (sfBullets, trks) --asdf = Debug.log "ppppppppppppppppppppppp " [finalTruckList] updatedSalesStatusFitlerList = applyFilters SalesStatus uiModel.salesStatusFilters`
2019-01-05T00:50:50.646400
Ron
elmlang
general
I got that working
2019-01-05T00:51:05.646600
Ron
elmlang
general
thx for pointing me to foldl func
2019-01-05T00:51:16.646800
Ron
elmlang
general
` applyFilters filterCategory filters = List.foldl executeFilterFunc (uiModel.selectedFilterBullets, model.truckList) (List.filter (\(fltrCategory, fn) -&gt; fltrCategory /= filterCategory ) funcList) |&gt; rebuildFilters filterCategory filters executeFilterFunc (fnCategory, fn) (sfBullets, trks) = fn (sfBullets, trks) --asdf = Debug.log "ppppppppppppppppppppppp " [finalTruckList] updatedSalesStatusFitlerList = applyFilters SalesStatus uiModel.salesStatusFilters `
2019-01-05T00:53:37.647300
Ron
elmlang
general
I finally got this stuff working
2019-01-05T00:53:51.647600
Ron
elmlang
general
Wow, would you mind sharing it? :slightly_smiling_face:
2019-01-05T03:48:03.648000
Lynne
elmlang
general
Has this been posted before? I don’t care. It’s Christmass time here. <https://www.youtube.com/watch?v=slMZJtnsD2A>
2019-01-05T06:49:52.648700
Shelli
elmlang
general
<https://package.elm-lang.org/packages/zwilias/elm-rosetree/latest/Tree-Zipper#fromForest>
2019-01-05T07:45:26.648800
Huong
elmlang
general
Have you actually released new version of the library?! :slightly_smiling_face:
2019-01-05T07:47:29.649100
Lynne
elmlang
general
Yeah, changed how a zipper is modeled so it keeps track of siblings of the current focus, rather than having the siblings be part of the "breadcrumbs", which enables having siblings without a parent at the "root" level
2019-01-05T07:48:48.649300
Huong
elmlang
general
So `Zipper.backward` will traverse from "second" to "first" as if there was no root, right?
2019-01-05T07:49:29.649500
Lynne
elmlang
general
Interestingly, the API didn't actually need to change, and it made behaviour of `prepend` and `append` more consistent, too, so I'm quite happy with it
2019-01-05T07:49:34.649700
Huong
elmlang
general
Yeah, that sounds right
2019-01-05T07:50:37.649900
Huong
elmlang
general
And my program still compiles after upgrading
2019-01-05T07:50:37.650100
Lynne
elmlang
general
Thank you so much!
2019-01-05T07:50:48.650300
Lynne
elmlang
general
I also thought about posting an issue at Github with a proposal to add `Zipper.isRoot` function, though it seems I won't need it anymore
2019-01-05T07:52:09.650500
Lynne
elmlang
general
Yeah, as far as the API is concerned, 2 new functions were added and everything should still behave the way it did before
2019-01-05T07:52:26.650700
Huong
elmlang
general
Heh, for some reason that function actually exists, but isn't exposed :thinking_face:
2019-01-05T07:53:42.650900
Huong
elmlang
general
Oh yeah, that's why I thought it was there! I saw it in the source but could not use as it is not exposed
2019-01-05T07:54:09.651100
Lynne
elmlang
general
Anyway, if you run into any issues, feel free to poke me (here or on github :slightly_smiling_face: )
2019-01-05T07:55:04.651400
Huong
elmlang
general
Sure, thanks again!
2019-01-05T07:55:14.651600
Lynne
elmlang
general
I will now change to the upgraded API and tell you if I run into any concern
2019-01-05T07:55:39.651800
Lynne
elmlang
general
Oh I see you changed `map` as well. It used to be `(a-&gt;a) -&gt; Tree a -&gt; Tree a` and I was wondering why
2019-01-05T07:56:56.652000
Lynne
elmlang
general
Hm, I didn't change the `Tree` module, though perhaps you were looking at `mapLabel` before? (which only changes the current label and doesn't touch the children)
2019-01-05T07:59:06.652200
Huong
elmlang
general
I am pretty sure it was `map`, let me check
2019-01-05T08:00:01.652400
Lynne
elmlang
general
Hm, apparently it was `mapLabel`
2019-01-05T08:01:14.652600
Lynne
elmlang
general
Oh well ¯\_(ツ)_/¯
2019-01-05T08:02:02.652800
Huong
elmlang
general
I wonder whether `mapLabel` is all that useful
2019-01-05T08:02:36.653000
Huong
elmlang
general
Good luck, and you know where to find me :slightly_smiling_face:
2019-01-05T08:03:42.653200
Huong
elmlang
general
It might be. I used (and still do it until I finish transition) another rosetree implementation where this function is called `updateItem`
2019-01-05T08:03:47.653400
Lynne
elmlang
general
I utilized it in my code :slightly_smiling_face:
2019-01-05T08:04:01.653600
Lynne
elmlang
general
Thanks again!
2019-01-05T08:04:04.653800
Lynne
elmlang
general
```./src/Main.elm Error: Compiler process exited with error Compilation failed elm.exe: not enough bytes CallStack (from HasCallStack): error, called at libraries\binary\src\Data\Binary.hs:212:21 in binary-0.8.5.1:Data.Binary``` I've gotten this error a few times today when compiling my code. Does anyone know how to fix this? My solution for now is to delete elm-stuff and compile again but it's kind of tedious.
2019-01-05T14:09:53.655700
Jae
elmlang
general
I worked on a medium sized PROD app for searching trucks inventory with lots of search filters, and I have encountered this issues quite a few time and I had to do the same thing you did and it seems like that is the only way to solve that problem
2019-01-05T14:12:10.657600
Ron
elmlang
general
Its a bug in the compiler, don’t compile with `--debug`
2019-01-05T19:37:32.657800
Rosalee
elmlang
general
Delete the `elm-stuff` folder from your project and you should be good to go
2019-01-05T23:27:03.658100
Renay
elmlang
general
I'm porting a 0.18 app to 0.19.. the app was created using <https://github.com/halfzebra/create-elm-app> having trouble importing .elm files in .js file more specifically ``` import { App } from './App.elm'; import { Welcome } from "./Welcome.elm" ``` both `App` and `Welcome` are `undefined`.. any hints?
2019-01-05T23:29:31.660100
Renay
elmlang
general
later in the code ``` let welcomeApp = Welcome.Main.init({ node: document.getElementById('root'), flags: logoPath }); . . . let app = App.Main.init({ node: document.getElementById('root') }); ```
2019-01-05T23:30:47.660800
Renay
elmlang
general
getting error ``` index.js:38 Uncaught TypeError: Cannot read property 'Main' of undefined at Module../src/index.js (index.js:38) ```
2019-01-05T23:32:56.661200
Renay
elmlang
general
<@Renay> what version of `elm-webpack-loader` is configured in your package.json
2019-01-05T23:36:36.661700
Nery
elmlang
general
you may need to upgrade that
2019-01-05T23:36:40.661900
Nery
elmlang
general
I have `"elm-webpack-loader": "^5.0.0"`
2019-01-06T00:08:10.662100
Renay
elmlang
general
I've created a stupid ellie app (<https://ellie-app.com/4nt65mz53Mga1>) to demonstrate what I need. When X or Y boxes are clicked they switch to the other div. I'm trying to have animation when they move between the divs. Looked at <https://github.com/mdgriffith/elm-style-animation>, but it only supports (from what I understand) elements appearing/disappearing from within a div not moving elements across divs. In effect, I'm trying to achieve animations like <https://media1.tenor.com/images/451f5d8c8b78e1726dd730d7e491d472/tenor.gif> Any ideas/hints?
2019-01-06T02:12:34.666900
Renay
elmlang
general
I looked in the elm compiler repo and saw this issue which looks like it’s the problem I’m having <https://github.com/elm/compiler/issues/1853>
2019-01-06T02:46:54.669300
Jae
elmlang
general
is anybody up to date on the contenteditable cursor position issue? afaict from a mailing list thread and some recent blog posts that google turned up, it's unsolved (that is, elm doesn't maintain cursor position in contenteditable elements when re-rendering like it does w/inputs)
2019-01-06T04:10:58.673200
Tu
elmlang
general
In my app I solve it by adding a `data-` attribute to the element where cursor is located and having a mutation observer which invokes `document.setSelection` according to value of that attribute. Works pretty smooth.
2019-01-06T04:17:49.673400
Lynne
elmlang
general
Could you please give me a link to the thread you were referring to? I am curious to know what people are saying about this issue.
2019-01-06T04:18:58.673600
Lynne
elmlang
general
The property generated by `elm-webpack-loader` is called Elm despite on the module name, you may try writing `import {Elm as App} from './App.elm'`
2019-01-06T04:21:01.673800
Lynne
elmlang
general
You can look into CSS transitions to achieve this. You will need to keep DOM node in the tree until transition is done so your model will need to become more sophisticated.
2019-01-06T04:24:51.674000
Lynne
elmlang
general
it's a couple of years old, and all they say is "yup, doesn't work w/o hacks": <https://groups.google.com/forum/#!topic/elm-discuss/YKz8rgffoWc>
2019-01-06T04:32:19.674300
Tu
elmlang
general
(and they don't get into specifics about their solutions)
2019-01-06T04:32:50.674600
Tu
elmlang
general
Ok, I see. Thanks anyway :slightly_smiling_face:
2019-01-06T04:32:59.674800
Lynne
elmlang
general
thank you!
2019-01-06T04:33:04.675000
Tu
elmlang
general
oh wow so you're not even using ports huh
2019-01-06T04:33:24.675200
Tu
elmlang
general
I had however hard time implementing selection (and dropped it for now in favor of other issues) so you may need consider this on beforehand
2019-01-06T04:34:25.675400
Lynne
elmlang
general
ah
2019-01-06T04:34:40.675600
Tu
elmlang
general
thanks
2019-01-06T04:34:42.675800
Tu
elmlang
general
yeah, i'm going to stick w/input for now
2019-01-06T04:34:47.676000
Tu
elmlang
general
Then it should be fine
2019-01-06T04:34:55.676200
Lynne
elmlang
general
it's a minor aesthetic benefit i get of having a "$" prefix on the field render closer to the input value if i can make contenteditable work
2019-01-06T04:35:23.676400
Tu
elmlang
general
so it's the difference between "$ 4,000" and " $4,000"
2019-01-06T04:35:47.676600
Tu
elmlang
general
nbd for now
2019-01-06T04:36:04.676800
Tu
elmlang
general
Is user supposed typing in $ himself/herself?
2019-01-06T04:36:31.677000
Lynne