workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang | general | I think this is a known bug (?) | 2019-01-21T08:18:11.710300 | Danika |
elmlang | general | Yep, it is not working | 2019-01-21T08:18:22.710500 | Lynne |
elmlang | general | It's basically about Applicative <=> Monad congruence. <https://github.com/facebook/Haxl/issues/58> - you're defining an `andThen` which doesn't follow the rules. | 2019-01-21T08:19:22.710600 | Niesha |
elmlang | general | Is there a work around? | 2019-01-21T08:26:14.711000 | Jae |
elmlang | general | I checked the github issue for it and it doesn't look like there is. | 2019-01-21T08:32:03.711100 | Jae |
elmlang | general | it can but than it’s not general enough right? | 2019-01-21T08:53:22.711300 | Zona |
elmlang | general | that was the meaning of comment. that even map has independent domain and co-domain. Anyway there is a lot of things in stdlib which do `a -> a` - those functions are called `update`. | 2019-01-21T08:55:13.711500 | Zona |
elmlang | general | ``` Message ->
( model, Debuglog)``` | 2019-01-21T09:56:55.711900 | Tashina |
elmlang | general | How can I do something like this? | 2019-01-21T09:57:04.712200 | Tashina |
elmlang | general | So I guess my question is actually: how can I create `Cmd Msg` that logs something | 2019-01-21T10:03:17.713000 | Tashina |
elmlang | general | `Debug.Log` is the only API for logging currently | 2019-01-21T10:04:34.714300 | Shenita |
elmlang | general | but you can make your own fairly straightforwardly using ports | 2019-01-21T10:04:56.714800 | Shenita |
elmlang | general | e.g. `port log : String -> Cmd msg` and then in JS `app.ports.log.subscribe(msg => console.log(msg))` | 2019-01-21T10:06:04.715600 | Shenita |
elmlang | general | Ah okay, thanks! | 2019-01-21T10:09:05.716000 | Tashina |
elmlang | general | The only time you’d really do this is if you wanted to build with `--optimize` right? | 2019-01-21T10:37:22.716800 | Danika |
elmlang | general | Also if you send your logs to some other system and follow 12-factor approach | 2019-01-21T10:40:59.717500 | Lynne |
elmlang | general | Ah i’d not heard of that before :slightly_smiling_face: | 2019-01-21T10:47:52.717800 | Danika |
elmlang | general | asking again, anyone else going to go to fosdem? it's free and at the start of feburary | 2019-01-21T11:57:48.718900 | Desire |
elmlang | general | Is there an established pattern for having a kind of manifest file for a directory?
If I have something like `src/functions/`, I want to do something like:
```
-- src/functions/Index.elm
module Index exposing (..)
import Function.Increment exposing (increment)
import Function.StartsWithH exposing (startsWithH)
```
And then import like
```
-- src/Main.elm
...
import Functions.Index exposing (..)
``` | 2019-01-21T14:33:02.720900 | Forrest |
elmlang | general | <@Forrest> It's more like `src/Functions/Submodules.elm` w/ a top-level `src/Functions.elm` | 2019-01-21T15:08:37.721800 | Earnest |
elmlang | general | in js there is a common pattern of
```
functions/
someFuncs.js
someMoreFuncs.js
index.js
// in index.js
import someFuncs from 'someFuncs.js'
import someMoreFuncs from 'someMoreFuncs.js
export default {
someFuncs,
someMoreFuncs
}
// somewhere else in the codebase
import { someFuncs } from '/functions'
```
I think they're asking if there is something similar in elm. There is not, afaik modules cant "export" things they import. | 2019-01-21T15:14:05.724700 | Danika |
elmlang | general | If you're finding that you want this sort of functionality in elm, it might be because you've prematurely split your code into modules when you don't need to. Elm files are naturally very tall; having seperate files for `Function.Increment` and `Function.StartsWithH` would be a code smell imo | 2019-01-21T15:15:31.725900 | Danika |
elmlang | general | You can use ports to send basic types or anything you can convert to a JSON Value to the JS side and log there. | 2019-01-21T15:30:50.726100 | Leoma |
elmlang | general | The, possibly confusing thing, is that if you batch a bunch of Cmd Msg together, you have no guarantees about execution order. So your logs can become shuffled up. This may not be a concern based on your needs. | 2019-01-21T15:31:59.726300 | Leoma |
elmlang | general | That’s great, thank you! | 2019-01-21T16:29:07.727000 | Forrest |
elmlang | general | I dont understand. Not general enough for what? | 2019-01-21T16:34:12.727100 | Ashton |
elmlang | general | Does anyone have a recommended pattern for Attributes that are conditional? e.g.:
```
div (HtmlA.class "blah"
:: (if model.hasStartedInteraction then
[]
else
[ HtmlE.onClick FirstInteraction ]
)
) []
```
In other words, if I have a list of objects, what's a good way to make the _presence_ of an element conditional? | 2019-01-21T16:40:36.728500 | Sofia |
elmlang | general | Does anyone know what the documentation for the old 0.18 Focus library means when it says a Focus is not bidirectional? (<https://package.elm-lang.org/packages/evancz/focus/2.0.2>) | 2019-01-21T16:49:56.729900 | Lavon |
elmlang | general | This is kind of a hack, but it's pretty easy to make a "no op" attribute. `nullAttr = Html.Attributes.attribute "" ""`, iirc | 2019-01-21T16:55:57.732000 | Beau |
elmlang | general | Yeah, that's what I was thinking about -- just making a `none` for any time I need to do this | 2019-01-21T16:58:28.734200 | Sofia |
elmlang | general | Another option would be to do a filter on a list of `Maybe Attribute`. Something like `List.filterMap identity [Just (HtmlE.onClick FirstInteraction), Nothing]`. Not sure how well that would actually work, but you could probably define a function to make it more succinct. | 2019-01-21T16:59:52.734400 | Lavon |
elmlang | general | is there someone who could add types to functions `andMap` and `end` <https://ellie-app.com/4wqVkRRnMyta1> | 2019-01-21T17:19:36.735300 | Liza |
elmlang | general | or maybe there is some editor / tool that can add those anototation | 2019-01-21T17:21:11.735800 | Liza |
elmlang | general | ANY… | 2019-01-21T17:21:13.736000 | Liza |
elmlang | general | if you load the module into the elm repl | 2019-01-21T17:21:27.736600 | Danika |
elmlang | general | because it compils.. | 2019-01-21T17:21:29.736800 | Liza |
elmlang | general | and just call the function with no arguments | 2019-01-21T17:21:31.736900 | Danika |
elmlang | general | it will show you the inferred type annotation | 2019-01-21T17:21:36.737200 | Danika |
elmlang | general | how to do that ? | 2019-01-21T17:22:42.737500 | Liza |
elmlang | general | <@Beau> that actually produces a runtime error though
`Uncaught DOMException: Failed to execute 'setAttribute' on 'Element': '' is not a valid attribute name.` | 2019-01-21T17:23:07.737600 | Nana |
elmlang | general | None | 2019-01-21T17:23:30.737800 | Danika |
elmlang | general | run `elm repl` wherever your elm.json is | 2019-01-21T17:24:20.738400 | Danika |
elmlang | general | tnx for hint .. | 2019-01-21T17:25:27.738600 | Liza |
elmlang | general | kind of got that hell. | 2019-01-21T17:25:33.738900 | Liza |
elmlang | general | now need to clean up.. | 2019-01-21T17:25:37.739100 | Liza |
elmlang | general | Yeah, `attribute "" ""` breaks everything. Ive heard `class ""` makes for a good `none` `Attribute` tho. | 2019-01-21T17:25:38.739200 | Ashton |
elmlang | general | Havent tried it myself however. | 2019-01-21T17:25:47.739400 | Ashton |
elmlang | general | hmm if it is so easy.. why non of IDE uses that tool.. | 2019-01-21T17:26:29.739900 | Liza |
elmlang | general | or im missing something | 2019-01-21T17:26:34.740100 | Liza |
elmlang | general | The elm extension for vscode shows function signature on hover, but I’m not sure whether it infers it if you haven’t already annotated it. | 2019-01-21T17:28:06.740900 | Danika |
elmlang | general | I think these look pretty nice:
```
attrIf : Bool -> Attribute msg -> Attribute msg
attrIf condition ifTrue =
if condition then
ifTrue
else
Attributes.classList []
nodeIf : Bool -> Html msg -> Html msg
nodeIf condition ifTrue =
if condition then
ifTrue
else
text ""
```
<https://ellie-app.com/4wr3TWdWcrva1> | 2019-01-21T17:28:40.741400 | Nana |
elmlang | general | and yeah I've been struggling a bit with making "elm html" readable too | 2019-01-21T17:31:44.741600 | Nana |
elmlang | general | 0.18 had way to add annotations… | 2019-01-21T17:32:28.742200 | Liza |
elmlang | general | now it just reads it | 2019-01-21T17:32:37.742600 | Liza |
elmlang | general | hmm? | 2019-01-21T17:36:58.742800 | Danika |
elmlang | general | None | 2019-01-21T17:44:15.743200 | Liza |
elmlang | general | Dang, didn't know that blows up, might be new 0.19 behavior | 2019-01-21T17:55:20.744900 | Beau |
elmlang | general | I'd definitely go for `class ""` then | 2019-01-21T17:55:51.746000 | Beau |
elmlang | general | Probably because the 0.18 compiler would spit out warnings and inferred types for functions without annotations | 2019-01-21T18:18:10.748100 | Earnest |
elmlang | general | And yes- I’m fighting with this function already week - and tip about repl, will save me other week - already found what is wrong.. | 2019-01-21T18:18:50.749000 | Liza |
elmlang | general | Maybe we can vsc plugin can just use elm analyze, or simple regexp to find unannotation function and use repl to autocomple | 2019-01-21T18:21:18.751400 | Liza |
elmlang | general | Is there a way to concatenate two `Html` ? | 2019-01-21T20:13:21.754300 | Bernardo |
elmlang | general | (without wrapping them in another container node) | 2019-01-21T20:13:52.754600 | Bernardo |
elmlang | general | <@Bernardo> put them in a list | 2019-01-21T20:25:31.755300 | Earlean |
elmlang | general | <@Earlean> but then I’d get `List Html`, not an `Html`, no? | 2019-01-21T20:27:38.756000 | Bernardo |
elmlang | general | Yep, a `Html msg` describes a single node in the DOM tree | 2019-01-21T20:28:44.757200 | Earlean |
elmlang | general | Ah, yeah, I suppose that wouldn’t really make sense :slightly_smiling_face: | 2019-01-21T20:30:29.757700 | Bernardo |
elmlang | general | (to have multiple nodes under one `Html`) | 2019-01-21T20:30:40.758000 | Bernardo |
elmlang | general | Yep, that's what a list is for. | 2019-01-21T20:32:16.758500 | Earlean |
elmlang | general | Can anyone recommend a good way to do input masking? | 2019-01-21T21:23:03.758900 | Jeanene |
elmlang | general | My go-to would be to use `onInput` update function and regex/parser, but I’m running up against a deadline…thinking I’ll dip over to JS. :neutral_face: | 2019-01-21T21:23:54.759800 | Jeanene |
elmlang | general | <https://package.elm-lang.org/packages/indicatrix/elm-input-extra/latest/> ? | 2019-01-21T21:48:43.759900 | Leoma |
elmlang | general | It’s not up to date with 0.19. :( | 2019-01-21T21:59:21.760400 | Jeanene |
elmlang | general | It is updated for 0.19, what are you seeing that makes you think otherwise? | 2019-01-21T22:23:03.760600 | Earlean |
elmlang | general | <https://github.com/abadi199/elm-input-extra> | 2019-01-21T22:30:52.760900 | Jeanene |
elmlang | general | That’s the main package. I thought he was referencing that one. :) | 2019-01-21T22:31:22.761800 | Jeanene |
elmlang | general | You can also add the wrong annotation, the compiler will tell you the right one :slightly_smiling_face: . Not sure if this always works though, | 2019-01-22T01:39:34.762300 | Lea |
elmlang | general | I usually just deal with lists, and concatenate them | 2019-01-22T01:49:10.762500 | Bert |
elmlang | general | Especially if you consider that `Html a` is actually `VirtualDom.Node` underneath | 2019-01-22T01:51:54.762700 | Bert |
elmlang | general | it will - but if you have 2 arguments where second is big record, that is kind of recursion, it not really can correct you.. | 2019-01-22T03:01:15.763200 | Liza |
elmlang | general | K right, I’ve only done it for some large records that don’t have a type alias | 2019-01-22T03:10:36.763500 | Lea |
elmlang | general | Some of my colleagues are, and I _might_ hop by as well, since I live in Belgium anyways | 2019-01-22T04:28:24.763800 | Huong |
elmlang | general | nice, if you do go, let me know | 2019-01-22T04:44:49.764100 | Desire |
elmlang | general | Hello dear friends | 2019-01-22T10:02:53.765000 | Sadie |
elmlang | general | Once more I am seeking your precious advices | 2019-01-22T10:03:16.765500 | Sadie |
elmlang | general | I am building a SPA with Richard Feldman Elm Architecture (and the benefits of elm-kitchen) | 2019-01-22T10:03:42.766000 | Sadie |
elmlang | general | I have a url router | 2019-01-22T10:04:02.766500 | Sadie |
elmlang | general | In my session I have a bearer token | 2019-01-22T10:04:09.766700 | Sadie |
elmlang | general | I don't know exactly when to fetch the user profile related to this bearer token | 2019-01-22T10:04:29.767600 | Sadie |
elmlang | general | Shall I do it in all pages init command in case it is missing ? | 2019-01-22T10:04:49.768200 | Sadie |
elmlang | general | That's an option. An alternative might be to fetch it in your root `Main.elm` and store on that level, passing to `init` functions of each page | 2019-01-22T10:07:00.769900 | Lynne |
elmlang | general | Yes that kind what I wanted to do | 2019-01-22T10:09:05.772100 | Sadie |
elmlang | general | But then I need to add a step before using setRoute, right? | 2019-01-22T10:09:17.772600 | Sadie |
elmlang | general | Hello. I started using <@Freda>’s I18Next, and followed the given example (<https://github.com/ChristophP/elm-i18next/tree/4.0.0>) to pass the translations to the app using flags. It works well. Now I want to pass more than the translations to the app, so the translations would become a property of the flags (something like { translations : { english : ... }, user : { ... } }). It implies I write a Decoder, which will invoke I18Next’s provided one (translationsDecoder). My problem is I can’t say my decoder produces I18Next.Translations, because the Translations type is opaque (constructors are not exposed). So I can’t write something like :
```Decode.succeed Translations
|> requiredAt ["translations"] translationsDecoder ...``` | 2019-01-22T10:16:30.777600 | Allyn |
elmlang | general | Do you want to just decode the translations? or both the translations and the user? | 2019-01-22T10:18:35.778700 | Carman |
elmlang | general | both | 2019-01-22T10:18:42.778900 | Allyn |
elmlang | general | Then you want a function that can take a translation and a user and return some other structure such as a tuple | 2019-01-22T10:19:21.780300 | Carman |
elmlang | general | ```
Decode.succeed (\translations user -> (translations, user))
|> required "translations" traslationDecoder
|> required "user" userDecoder
``` | 2019-01-22T10:20:03.782200 | Carman |
elmlang | general | Glad your using the package. You'd have to do `Decode.succeed Model` instead of `Decode succeed Translations` | 2019-01-22T10:20:09.782400 | Freda |
elmlang | general | The important thing to understand with pipeline decoders is that the argument to `succeed` is a function that will build some structure out _n_ arguments from each of the piped lines below it | 2019-01-22T10:21:49.784000 | Carman |
Subsets and Splits