workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang
|
general
|
Haha so far it does seem really nice!!
|
2019-02-13T14:58:15.242100
|
Renda
|
elmlang
|
general
|
Im trying to imagine what I would do in OOP if I want to add some AI logic to my game next. Here I just add a few new functions to the pipeline :stuck_out_tongue: :clap::skin-tone-2:
|
2019-02-13T14:59:26.243200
|
Renda
|
elmlang
|
general
|
<https://i.imgur.com/1AraF4i.jpg>
|
2019-02-13T15:04:27.243600
|
Earnest
|
elmlang
|
general
|
Yes, game "AI" = which is just dumb if statement stuff indeed. :stuck_out_tongue:
|
2019-02-13T15:15:29.244000
|
Renda
|
elmlang
|
general
|
well I'll be damned, my shrinker really works. in the last week I conquered parsers and shrinkers, two things I usually avoided :muscle:
|
2019-02-13T15:33:51.245100
|
Florencia
|
elmlang
|
general
|
Can anyone point me to the best place to ask a question about Json.Decode.Pipeline?
|
2019-02-13T16:38:36.247200
|
Jude
|
elmlang
|
general
|
Basically, I have a model where I want to decode `buildNumber` but it might be in Json as `build` or `buildNumber` and I'm struggling to figure out how to do that.
|
2019-02-13T16:39:48.247900
|
Jude
|
elmlang
|
general
|
<#C192T0Q1E|beginners> :slightly_smiling_face:
|
2019-02-13T16:41:05.248100
|
Noelle
|
elmlang
|
general
|
<@Jude> what kind of value are you trying to parse this as? Are they both integers?
|
2019-02-13T16:42:04.248700
|
Carman
|
elmlang
|
general
|
Do you know what situations lead it to being in one place or another?
|
2019-02-13T16:42:32.249400
|
Carman
|
elmlang
|
general
|
string or null. basically I'm hitting an API that has versioned and not all data has updated. what we had before when it was just `buildNumber` was this:
|
2019-02-13T16:43:13.250000
|
Jude
|
elmlang
|
general
|
`|> Json.Decode.Pipeline.optional "buildNumber" (Decode.nullable Decode.string) Nothing`
|
2019-02-13T16:43:16.250200
|
Jude
|
elmlang
|
general
|
but now the property might be at `build` instead of `buildNumber` so I want to check both before using `Nothing`
|
2019-02-13T16:43:39.250700
|
Jude
|
elmlang
|
general
|
Are there any rules that guide whether it might be in one place or another? Is it random? Can both be present?
|
2019-02-13T16:45:04.251500
|
Carman
|
elmlang
|
general
|
one or the other, or neither
|
2019-02-13T16:45:30.251800
|
Jude
|
elmlang
|
general
|
Old data will have `buildNumber`, or nothing, new data will have `build` or nothing
|
2019-02-13T16:46:09.252500
|
Jude
|
elmlang
|
general
|
When you make a request do you know if you're dealing with old or new data?
|
2019-02-13T16:46:39.252800
|
Carman
|
elmlang
|
general
|
no
|
2019-02-13T16:47:04.253000
|
Jude
|
elmlang
|
general
|
You can build a decoder that uses the first location that works:
```
oldOrNewBuildNumber : Decoder String
oldOrNewBuildNumber =
Decode.oneOf
[ Decode.field "buildNumber" Decode.string
, Decode.field "build" Decode.string
]
```
|
2019-02-13T16:50:27.254500
|
Carman
|
elmlang
|
general
|
You can then plug this into a pipeline using `Json.Decode.Pipeline.custom`
|
2019-02-13T16:50:47.255000
|
Carman
|
elmlang
|
general
|
```
|> Json.Decode.Pipeline.custom oldOrNewBuildNumber
```
|
2019-02-13T16:51:09.255400
|
Carman
|
elmlang
|
general
|
hey that got me really close! thanks!
|
2019-02-13T16:58:55.255700
|
Jude
|
elmlang
|
general
|
I needed nullables to match up, but that's it
|
2019-02-13T16:59:05.256000
|
Jude
|
elmlang
|
general
|
```
Decode.oneOf
[ Decode.field "buildNumber" (Decode.nullable Decode.string)
, Decode.field "build" (Decode.nullable Decode.string)
]
```
|
2019-02-13T16:59:14.256300
|
Jude
|
elmlang
|
general
|
You may want to move the nullable out one level
|
2019-02-13T17:04:36.257000
|
Carman
|
elmlang
|
general
|
```
|> Json.Decode.Pipeline.custom (Decode.nullable oldOrNewBuildNumber)
```
|
2019-02-13T17:04:49.257300
|
Carman
|
elmlang
|
general
|
This allows the `oldOrNewBuildNumber` decoder to be used in both nullable and non-nullable contexts
|
2019-02-13T17:05:15.257900
|
Carman
|
elmlang
|
general
|
That makes sense, thanks.
|
2019-02-13T17:05:52.258600
|
Jude
|
elmlang
|
general
|
I really appreciate the help
|
2019-02-13T17:05:58.258900
|
Jude
|
elmlang
|
general
|
Hi All. Is there a know best way to scroll to an anchor on an elm SPA?
|
2019-02-13T17:06:56.259100
|
Kayleigh
|
elmlang
|
general
|
Hello. Here are some functions to work with the dom <https://package.elm-lang.org/packages/elm/browser/latest/Browser-Dom>
|
2019-02-13T17:10:06.259300
|
Noelle
|
elmlang
|
general
|
Maybe this is what you are looking for? <https://package.elm-lang.org/packages/elm/browser/latest/Browser-Dom#setViewportOf>
|
2019-02-13T17:10:25.259500
|
Noelle
|
elmlang
|
general
|
A quick-and-easy approach is to focus on it: <https://package.elm-lang.org/packages/elm/browser/latest/Browser-Dom#focus>
|
2019-02-13T17:16:37.261100
|
Lorilee
|
elmlang
|
general
|
Hi, i have been slowly trying to go through the spa example (<https://github.com/rtfeldman/elm-spa-example>) by implementing one myself and I cannot figure out a user gets redirected after Login. Anyone can explain me ?
|
2019-02-13T17:17:30.261900
|
Hiedi
|
elmlang
|
general
|
Thanks <@Lorilee>! That will get me what I need.
|
2019-02-13T17:18:21.262000
|
Kayleigh
|
elmlang
|
general
|
Is because of the subscription. Is subscribed to session changes with a message `GotSession`
|
2019-02-13T17:18:22.262200
|
Noelle
|
elmlang
|
general
|
I saw that but how is the session changed after Login ?
|
2019-02-13T17:18:52.262400
|
Hiedi
|
elmlang
|
general
|
If the log in is success, you have a CMD that communicates to the port that is defined in the html/index.js (elm initialization)
|
2019-02-13T17:20:00.262600
|
Noelle
|
elmlang
|
general
|
That port sends back the session through a port. And the Login page is subscribed to listen to those changes
|
2019-02-13T17:20:35.262900
|
Noelle
|
elmlang
|
general
|
``` CompletedLogin (Ok viewer) ->
( model
, Viewer.store viewer
)```
|
2019-02-13T17:22:08.263300
|
Noelle
|
elmlang
|
general
|
Viewer: ```store : Viewer -> Cmd msg
store (Viewer avatarVal credVal) =
Api.storeCredWith
credVal
avatarVal```
|
2019-02-13T17:22:29.263500
|
Noelle
|
elmlang
|
general
|
Oh ok so that's that, I read the code and I didn't get it triggered a sub
|
2019-02-13T17:22:32.263700
|
Hiedi
|
elmlang
|
general
|
Thx a lot <@Noelle>!
|
2019-02-13T17:24:19.264000
|
Hiedi
|
elmlang
|
general
|
No problem!
|
2019-02-13T17:24:38.264200
|
Noelle
|
elmlang
|
general
|
What's the best option for defining CSS in elm and in general in styling the page?
|
2019-02-13T18:44:15.268400
|
Bernardina
|
elmlang
|
general
|
<@Bernardina> best option for defining CSS in Elm : elm-css
best option for styling/layout in general: probably elm-ui
<https://package.elm-lang.org/packages/rtfeldman/elm-css/latest>
<https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest>
|
2019-02-13T18:51:14.269400
|
Nana
|
elmlang
|
general
|
I like to work with something like Tailwind.css as much as I can <https://tailwindcss.com/docs/what-is-tailwind/>
|
2019-02-13T18:57:34.270500
|
Carrol
|
elmlang
|
general
|
Then use `elm-css` for special cases
|
2019-02-13T18:57:41.270900
|
Carrol
|
elmlang
|
general
|
But I haven't use `elm-ui`, I hear great things about it all the time
|
2019-02-13T18:58:14.271600
|
Carrol
|
elmlang
|
general
|
I’m learning tailwind. Seems good so far
|
2019-02-13T18:59:00.271900
|
Noelle
|
elmlang
|
general
|
I liked BassCSS
|
2019-02-13T18:59:03.272100
|
Noelle
|
elmlang
|
general
|
Yeah, BassCss is great too, but tailwind improves on that idea
|
2019-02-13T18:59:30.272300
|
Carrol
|
elmlang
|
general
|
Yes, bass stopped to being developed :disappointed:
|
2019-02-13T19:01:20.272500
|
Noelle
|
elmlang
|
general
|
I’m making a pokedex with elm lol
|
2019-02-13T19:01:40.272700
|
Noelle
|
elmlang
|
general
|
I am actually struggling with changing button background color on mouse hover
|
2019-02-13T19:19:17.273300
|
Bernardina
|
elmlang
|
general
|
is this possible to do with elm's Html.Attributes style?
|
2019-02-13T19:20:03.273900
|
Bernardina
|
elmlang
|
general
|
<@Bernardina> `Html.Attributes style` is just like setting inline CSS styles, which doesn't support things like hover
|
2019-02-13T19:21:25.274900
|
Nana
|
elmlang
|
general
|
So in this case I either include external .css file, or I use `elm-css`?
|
2019-02-13T19:22:38.275800
|
Bernardina
|
elmlang
|
general
|
if you're not a CSS expert I would highly recommend elm-ui, it's way easier
|
2019-02-13T19:22:40.275900
|
Nana
|
elmlang
|
general
|
but yes elm-css or external css file also works
|
2019-02-13T19:23:03.276200
|
Nana
|
elmlang
|
general
|
Well, I have something based on `elm-bootstrap`
|
2019-02-13T19:23:37.276600
|
Bernardina
|
elmlang
|
general
|
<http://elm-bootstrap.info/>
|
2019-02-13T19:23:41.276900
|
Bernardina
|
elmlang
|
general
|
I am not sure if I can use with it `elm-ui`
|
2019-02-13T19:23:59.277300
|
Bernardina
|
elmlang
|
general
|
ah no elm-ui shouldn't really be combined with a css framework like Bootstrap
|
2019-02-13T19:27:48.277800
|
Nana
|
elmlang
|
general
|
though I'm also not sure how well elm-css would interact with Bootstrap - that's kind of the problem with CSS, when you start layering styles on top of each other
|
2019-02-13T19:30:15.278800
|
Nana
|
elmlang
|
general
|
Morning Everyone. I'm implementing a kind of i18n into an elm application. I have a question that could seems dumb. I am storing the formatting for a currency in the main Elm object. Now everytime someone wants to use CurrencyFormat needs to pass the main model. Is there a best practise to avoid passing the main model around ?
|
2019-02-14T04:32:33.281300
|
Anderson
|
elmlang
|
general
|
You don't have to pass the whole model to functions which need only currency format. Write functions accepting your CurrencyFormat record and pass only that field when calling them
|
2019-02-14T04:38:24.281400
|
Lynne
|
elmlang
|
general
|
Something like:
```
displayCurrency : CurrencyFormat -> Float -> String
displayCurrency = ...
...
displayCurrency model.currencyFormat value
```
|
2019-02-14T04:39:29.281700
|
Lynne
|
elmlang
|
general
|
Thanks, I believe I still need to pass the model to who is using displayCurrency
|
2019-02-14T04:41:54.282700
|
Anderson
|
elmlang
|
general
|
Well, it depends on your app structure. The point is you can structure it the way when you pass only relevant data to helper functions
|
2019-02-14T04:42:56.282900
|
Lynne
|
elmlang
|
general
|
You can't have global variables, so properly structuring your app is the only way to avoid passing the complete model everywhere
|
2019-02-14T04:44:09.283100
|
Lynne
|
elmlang
|
general
|
Unless your format is constant, of course. Then you can just have another module with function returning it
|
2019-02-14T04:45:01.283300
|
Lynne
|
elmlang
|
general
|
I am just not used to depends on a main model.
|
2019-02-14T04:48:26.285000
|
Anderson
|
elmlang
|
general
|
Thanks for the info.. ill try to pass the correct data in the right function
|
2019-02-14T04:48:53.286000
|
Anderson
|
elmlang
|
general
|
I understand that, and, I believe, it is not a super good practice to pass it everywhere as it complicates refactoring
|
2019-02-14T04:49:05.286200
|
Lynne
|
elmlang
|
general
|
there is a structure that goes by various names but in essence implies that there is a Context in which things happen. This context data is held in a record or some Custom Type and is passed around.
|
2019-02-14T04:49:11.286400
|
Maida
|
elmlang
|
general
|
you can take a look at <https://github.com/ohanhi/elm-shared-state>
|
2019-02-14T04:51:43.286600
|
Maida
|
elmlang
|
general
|
for inspiration
|
2019-02-14T04:51:47.286800
|
Maida
|
elmlang
|
general
|
in my example I have a Main with Locale that contains { Translations, Formatting }
|
2019-02-14T04:52:00.287000
|
Anderson
|
elmlang
|
general
|
ill have a look
|
2019-02-14T04:52:02.287200
|
Anderson
|
elmlang
|
general
|
that's was really interesting! thanks! And I believe you can create multiple different sharedState based on the module you are in.
|
2019-02-14T05:02:59.287500
|
Anderson
|
elmlang
|
general
|
so you only have the dependencies you need in the right place
|
2019-02-14T05:03:17.287700
|
Anderson
|
elmlang
|
general
|
I think the point of SharedState is that it is shared between all modules
|
2019-02-14T05:03:49.287900
|
Lynne
|
elmlang
|
general
|
So you should not need different shared states
|
2019-02-14T05:04:12.288100
|
Lynne
|
elmlang
|
general
|
Only if your app is split into groups of modules but that's most likely an overkill
|
2019-02-14T05:04:35.288300
|
Lynne
|
elmlang
|
general
|
Yes, the idea of the SharedState is that it acts like a context for all the places of the app. You can have partitions within this state that handle various aspects.
|
2019-02-14T05:15:55.289900
|
Maida
|
elmlang
|
general
|
Howdy everyone!
I wanted to inspect the VirtualDom Kernel code because I am getting it to crash. I would like to make some modifications to it locally in order to fix it.
The problem is - I can not find the source code that actually gets compiled. I am using `elm/[email protected]`. In the chromium inspector it shows me the line that crashed to be right below
```
// tag must be 1 or 2 at this point
var vKids = vNode.e;```
|
2019-02-14T05:18:46.291300
|
Teri
|
elmlang
|
general
|
But in the source code of virtualDominside `~/.elm/___/virtual-dom/1.0.2/` it says
```
// tag must be __2_NODE or __2_KEYED_NODE at this point
var vKids = vNode.__kids;
```
And when I try modifying this file it does not arrive in the browser when using elm-make.
|
2019-02-14T05:20:03.292600
|
Teri
|
elmlang
|
general
|
While googling for `tag must be 1 or 2 at this point` I only got three hits on google which seems really weird.
|
2019-02-14T05:20:39.293000
|
Teri
|
elmlang
|
general
|
the hits on google are the compiled results from elm-make.
|
2019-02-14T05:21:51.293700
|
Teri
|
elmlang
|
general
|
It seems like that first excerpt is an optimized version of the second (constants are replaced with values, field name is shortened)
|
2019-02-14T05:22:30.295100
|
Lynne
|
elmlang
|
general
|
I grepped everything for the comment that virtualdom is crashing on. I can also confirm that the [email protected] is the one in my elm.json plus the only one installed in the local ~/.elm directory
|
2019-02-14T05:22:33.295300
|
Teri
|
elmlang
|
general
|
I was thinking that too - but does it optimize comments?
|
2019-02-14T05:22:58.295400
|
Teri
|
elmlang
|
general
|
Well, it depends on the optimizer. It can just replace by regex and don't care if it is comment or not
|
2019-02-14T05:23:22.295700
|
Lynne
|
elmlang
|
general
|
I am wondering if the optimized code is cached somewhere.
|
2019-02-14T05:23:55.295900
|
Teri
|
elmlang
|
general
|
I am wondering that also
|
2019-02-14T05:24:05.296200
|
Lynne
|
elmlang
|
general
|
Because that's what I would need to clear then. I tried clearing `elm-stuff` and also `~/.elm`
|
2019-02-14T05:24:18.296600
|
Teri
|
elmlang
|
general
|
<@Teri> maybe there is some minification going on
|
2019-02-14T05:24:24.297000
|
Florencia
|
elmlang
|
general
|
That should be enough
|
2019-02-14T05:24:29.297200
|
Lynne
|
elmlang
|
general
|
ie. `__kids` -> `e` and `__2_NODE` and `__2_KEYED_NODE` (which are also variable names, not just parts of the comment) -> `1` and `2`?
|
2019-02-14T05:25:08.298200
|
Florencia
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.