workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang | general | Hey beautiful people!
I have a parser that happens to parse urls. Given a sentence I would like to get all urls in the sentence. Similar to `regex.match` in JS
How would I go about doing that? | 2019-03-05T12:43:03.511700 | Tawnya |
elmlang | general | I'd start by picking a parser library via <https://package.elm-lang.org/> | 2019-03-05T12:46:02.512100 | Niesha |
elmlang | general | There is an official regex package: <https://package.elm-lang.org/packages/elm/regex/latest/> | 2019-03-05T12:47:16.512400 | Carman |
elmlang | general | You can also write a parser with <https://package.elm-lang.org/packages/elm/parser/latest> | 2019-03-05T12:47:40.512900 | Carman |
elmlang | general | Are you looking to do something like:
```
parseUrls : String -> List Url
```
or something more like:
```
type Content
= Text String
| Link Url
parseContent : String -> List Content
``` | 2019-03-05T12:49:07.514200 | Carman |
elmlang | general | The second | 2019-03-05T12:49:41.514400 | Tawnya |
elmlang | general | The second one is exactly what I need. | 2019-03-05T12:50:03.514900 | Tawnya |
elmlang | general | I have a `Parser Url` | 2019-03-05T12:50:15.515300 | Tawnya |
elmlang | general | How could I implement a function `parseMayTimes: Parser a -> String -> List a`? | 2019-03-05T12:50:50.516100 | Tawnya |
elmlang | general | You may want `Parser.loop` | 2019-03-05T12:52:30.516400 | Carman |
elmlang | general | does it happen if you cache `node_modules` as well between builds? | 2019-03-05T12:52:32.516600 | Alicia |
elmlang | general | <https://package.elm-lang.org/packages/elm/parser/latest/Parser#loop> | 2019-03-05T12:52:32.516800 | Carman |
elmlang | general | Probably with one of the chomp functions to consume non-url strings | 2019-03-05T12:53:00.517300 | Carman |
elmlang | general | and `backtrackable` so you can try to parse a url, but then if the first character looks like a url but then it actually isn't, you can fall back to chomping | 2019-03-05T12:53:53.518100 | Virgie |
elmlang | general | Thanks guys. I will give it a try. | 2019-03-05T12:55:34.518800 | Tawnya |
elmlang | general | Sorry, late reply but thanks for the explanation. I personally think that `Array.slice` behaves unintuitively but at least it's not a bug. | 2019-03-05T13:35:06.519000 | Jae |
elmlang | general | <@Tawnya> This talk might help. <https://www.youtube.com/watch?v=suSAfow2rmM> | 2019-03-05T13:56:34.519500 | Jin |
elmlang | general | I just finished migrating to elm/http 2.0, phew! Once you get your head around it, it is much easier. | 2019-03-05T14:08:33.520600 | Salvador |
elmlang | general | But it was a lot of work. | 2019-03-05T14:08:48.520900 | Salvador |
elmlang | general | Hello! Hopefully this is the right place to ask this.
I have just been working with the elm-form library and once I fixed all the errors in my code, the compilation seems to fail with no errors. Its rather confusing.
I've uploaded it to Ellie here: <https://ellie-app.com/4Tw5fDwx8v6a1>
If anyone has any ideas I would be thankful! | 2019-03-05T14:34:28.523500 | Rufina |
elmlang | general | So based on the Ellie it seems the compilation succeeds, but the generated JS is not good. It's that what's happening? | 2019-03-05T14:38:49.525600 | Bert |
elmlang | general | Ellie reports the compilation as succeeding but it doesn't seem to actually succeed :thinking_face: | 2019-03-05T14:39:23.526000 | Carman |
elmlang | general | I notice most functions don't have signatures | 2019-03-05T14:39:37.526300 | Carman |
elmlang | general | adding those is usually my first step to debugging compiler weirdness | 2019-03-05T14:39:48.526600 | Carman |
elmlang | general | That's a great point | 2019-03-05T14:41:06.527200 | Bert |
elmlang | general | ok, I will try to figure those out :stuck_out_tongue: | 2019-03-05T14:41:08.527300 | Rufina |
elmlang | general | Sometimes the compiler can come up with super strange types that technically would work but aren't what I meant at all, if I have no type annotations in the code. | 2019-03-05T14:42:55.529700 | Bert |
elmlang | general | And those super strange types might be grounds for unexplored bugs in the compiler | 2019-03-05T14:44:10.531200 | Bert |
elmlang | general | interesting. It's probably a good habit to get into anyway | 2019-03-05T14:44:22.531400 | Rufina |
elmlang | general | is there a way to tell `elm/parser` it has to parse two lines besides using `|. symbol "\n"` in the place where the line change is expected? | 2019-03-05T15:08:24.532400 | Vilma |
elmlang | general | <@Rufina> You dont have a main | 2019-03-05T15:09:37.532700 | Kris |
elmlang | general | so the code compiles yielding nothing | 2019-03-05T15:10:08.533100 | Kris |
elmlang | general | <@Vilma> how do you mean, just "fast-forward" until two newlines have been encountered, or stop at the second newline, or something else? | 2019-03-05T15:28:06.534100 | Virgie |
elmlang | general | Now I feel stupid. Thanks for finding the problem! | 2019-03-05T18:01:18.535000 | Rufina |
elmlang | general | Is there a way to make a `<script>` tag in Elm? For Algolia with InstantSearch, I need a `<script>` tag with a specific `type` and `id`:
```
Html.node "script" [ attribute "type" "text/html", attribute "id" "hit-template" ] [...]
```
However, that creates a `<p>` tag instead of a `<script>` for some reason… | 2019-03-05T18:35:04.537300 | Jacquelyn |
elmlang | general | <@Jacquelyn> the virtual dom package intentionally prevents the creation of script tags | 2019-03-05T18:37:40.538200 | Earlean |
elmlang | general | I see… hmm, so I can’t use InstantSearch then? | 2019-03-05T18:38:18.538600 | Jacquelyn |
elmlang | general | I can try to make it work as a custom element | 2019-03-05T18:39:09.538900 | Jacquelyn |
elmlang | general | I've realised that, more than once, I've done something badly in Elm because I've not fully understood TEA. Is there a particularly good in-depth explanation anywhere that is worth watching before creating large elm apps? | 2019-03-05T19:00:38.540200 | Adrian |
elmlang | general | <@Cammy> that works? i was looking for an attribute based approach but they didn't seem to work. i'll look again. btw, loved your oslo talk. i wish your discourse thread wasn't locked (10 days idle) | 2019-03-05T20:24:21.540700 | Jarvis |
elmlang | general | anyone gotten this before? | 2019-03-05T20:33:28.541000 | Euna |
elmlang | general | elm: 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 | 2019-03-05T20:33:28.541200 | Euna |
elmlang | general | that’s a known issue, `rm -rf elm-stuff/` and rebuild | 2019-03-05T20:43:33.541800 | Ruthann |
elmlang | general | Yes, it does work. If memory serves there’s a volume attribute in html.attributes, and muted can be created. If needed, hit me up later in the week and I’ll make the custom attributes. You can also find them in my 0.18 elm-media package and can copy and paste. | 2019-03-05T21:08:09.544100 | Cammy |
elmlang | general | am i going to get in trouble if i cross post? i have a very simple question in beginners and no one around | 2019-03-05T22:43:17.544900 | Lupita |
elmlang | general | general has more :eyes:s what’s the question <@Lupita> | 2019-03-05T22:51:48.545400 | Ruthann |
elmlang | general | i want to put in logic to change the color when > 0 or < 0 sorry , i know my color logic is wrong, complete noob | 2019-03-05T22:55:57.546400 | Lupita |
elmlang | general | <https://ellie-app.com/4TFLKgyyvKNa1> | 2019-03-05T22:55:59.546600 | Lupita |
elmlang | general | geesh, no one on general either:
```
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [style "color" model.color] [ text (String.fromInt model.count) ]
, button [ onClick Increment ] [ text "+" ]
, button [ onClick Reset ] [ text "Reset" ]
]
-- change the second div
let
textColor =
if model.count > 0 then
model.color
else
model.otherColor
in
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [style "color" textColor] [ text (String.fromInt model.count) ]
, button [ onClick Increment ] [ text "+" ]
, button [ onClick Reset ] [ text "Reset" ]
]
```
<@Lupita> | 2019-03-05T23:56:10.548400 | Ruthann |
elmlang | general | tx | 2019-03-05T23:58:07.548600 | Lupita |
elmlang | general | was an interesting beginner exercise. | 2019-03-05T23:58:22.549000 | Lupita |
elmlang | general | should there be an in in that statement? | 2019-03-05T23:58:59.549600 | Lupita |
elmlang | general | in general, anything that does not rely on changing the state of your app will go into the `view` function | 2019-03-05T23:59:03.549800 | Ruthann |
elmlang | general | yes, hang on… added, thx | 2019-03-05T23:59:08.550000 | Ruthann |
elmlang | general | computed values go into view | 2019-03-05T23:59:30.550600 | Lupita |
elmlang | general | so used to c#, js which i code in that it's hard to come back to functional | 2019-03-06T00:00:02.551600 | Lupita |
elmlang | general | yep, views cannot mutate your state, they get the read only version | 2019-03-06T00:00:05.551700 | Ruthann |
elmlang | general | been watch richard feldman on youtube. he's great | 2019-03-06T00:00:36.552500 | Lupita |
elmlang | general | took me a while to get comfortable with it, if you ever get to the point in C# where you’re declaring static classes and static methods… then you know you need functional in your life | 2019-03-06T00:01:03.553500 | Ruthann |
elmlang | general | such a simple plan for the web. have to laugh tbh, i've seen some dozies | 2019-03-06T00:01:07.553700 | Lupita |
elmlang | general | our app is dependency injected to hell | 2019-03-06T00:01:46.554500 | Lupita |
elmlang | general | :smile: | 2019-03-06T00:01:51.554800 | Ruthann |
elmlang | general | his video on ‘impossible state’ is pretty good | 2019-03-06T00:02:08.555600 | Ruthann |
elmlang | general | makes me SMH everytime i see it. and the thing is that it's only one depencency, it never changes | 2019-03-06T00:02:23.556000 | Lupita |
elmlang | general | i mean i sort of get it on parameters from config file for different environments. but if you only have one path from message received to database, what's the point | 2019-03-06T00:03:52.557500 | Lupita |
elmlang | general | off soap box | 2019-03-06T00:04:21.557700 | Lupita |
elmlang | general | i did ask about let and in and now i understand. what a good night | 2019-03-06T00:04:51.558100 | Lupita |
elmlang | general | Is there a way to replace portions of a string with <span> tags? Specifically, I get a piece of valid HTML from the server, and I want to embed that in the page. Previously one could use `Html.Attributes.property "innerHTML" (Json.Encode.string displayText`, but not in 0.19. | 2019-03-06T06:41:35.560800 | Chaya |
elmlang | general | Essentially three ways to handle this:
- use `Markdown` (since html is valid markdown)
- parse and convert to `Html` in Elm, using `hecrj/html-parser`
- use a custom element that can (validate and) render html string literals | 2019-03-06T06:43:27.560900 | Huong |
elmlang | general | Hi!
I am using a _dynamic_ `subscriptions` (I subscribe to different things depending on the model), and I was wondering when are the subscriptions _updated_?
I expected the subscriptions to update right after `update` is done just when the new model is accessible from the app's point of view, but that doesn't seem to be the case. | 2019-03-06T06:56:46.564400 | Genesis |
elmlang | general | Thank you <@Huong>, the html-parser worked perfectly! I'll explore the third option as well | 2019-03-06T06:58:24.564500 | Chaya |
elmlang | general | I'd say the parse/convert is probably the safer one - you can create a `validate : List Node -> Result Whatever (List Node)` function to throw in the pipeline and do validation of the content (allowed tags, attributes, etc) | 2019-03-06T06:59:52.564700 | Huong |
elmlang | general | That _should_ be the case, however... <https://github.com/elm/compiler/issues/1776> might be biting you? | 2019-03-06T07:02:13.566300 | Huong |
elmlang | general | In short - if subscriptions change in response to a command from `init`, things go wrong | 2019-03-06T07:02:35.566500 | Huong |
elmlang | general | Interesting! It might be similar, it is right after `init` but I'm doing something else right after.
I am using a _fake_ `Cmd Msg` (no effects, just a pure `Msg`), and the subscriptions still don't update then. | 2019-03-06T07:06:47.566700 | Genesis |
elmlang | general | I'll try to write a small Ellie to show what I'm doing | 2019-03-06T07:08:23.566900 | Genesis |
elmlang | general | <https://ellie-app.com/4TPqzg9L9dya1> | 2019-03-06T07:17:59.567100 | Genesis |
elmlang | general | That's actually a lot more similar to the issue you linked to than I first thought. Thanks! I'll follow the issue! | 2019-03-06T07:40:25.567600 | Genesis |
elmlang | general | easy workaround (for your Ellie) is to ensure the task is "asynchronous": <https://ellie-app.com/4TPZjWDyrcLa1> | 2019-03-06T07:57:03.567800 | Huong |
elmlang | general | i'm not sure how to do that in our (old) jenkins build setup. i think an issue is that our maven build installs its own npm version, so the global `.npm` doesn't contain elm either... | 2019-03-06T07:59:59.568000 | Emilee |
elmlang | general | okay, to install the job cacher plugin we'd need to update our jenkins install, which is postponed to next wednesday because of the associated risk^^' | 2019-03-06T08:13:47.568200 | Emilee |
elmlang | general | Oh, I didn't know about this trick! Thanks :slightly_smiling_face: | 2019-03-06T08:13:51.568400 | Genesis |
elmlang | general | Hi. Any reason the Elm (0.19) runtime might complain that
```
Error: What node should I take over? In JavaScript I need something like:
Elm.Main.init({
node: document.getElementById("elm-node")
})
You need to do this with any Browser.sandbox or Browser.element program.
```
even though it's clearly injecting itself into the page (successfully). I'm using Webpack 4 and a few plugins... | 2019-03-06T08:37:54.569600 | Corinne |
elmlang | general | Initialising normally with a `Browser.element` on the Elm side and
```
const app = Elm.Main.init({
node: document.getElementById('main')
});
```
on the JS side | 2019-03-06T08:39:07.570500 | Corinne |
elmlang | general | Does node with ID 'main' exist on the page? | 2019-03-06T08:39:44.571200 | Lynne |
elmlang | general | Yep - and it's filling the view succesfully | 2019-03-06T08:39:58.571600 | Corinne |
elmlang | general | Maybe a second Elm.Main.init somewhere? | 2019-03-06T08:40:47.572200 | Salvador |
elmlang | general | Yep, seems like it is initialized twice and can't find the node after first initialization | 2019-03-06T08:41:11.573100 | Lynne |
elmlang | general | Interesting <@Salvador>, this sounds like the kind of thing WebPack could do :slightly_smiling_face: | 2019-03-06T08:41:20.573300 | Corinne |
elmlang | general | Bingo! A leftover manual `<script>` tag (pre-Webpackification I guess). Thanks <@Lynne> <@Salvador> | 2019-03-06T08:42:29.574300 | Corinne |
elmlang | general | I would not blame on Webpack. I use Webpack 4 and have not ever seen this problem | 2019-03-06T08:42:32.574400 | Lynne |
elmlang | general | (no - it's my _knowledge_ of Webpack that's the problem :slightly_smiling_face: ) | 2019-03-06T08:42:50.574800 | Corinne |
elmlang | general | in fairness I think it's the move to `HtmlWebpackPlugin` that did it | 2019-03-06T08:43:21.575300 | Corinne |
elmlang | general | Well, it depends on how it was performed. So the issue has been addressed, hasn't it? | 2019-03-06T08:44:10.576200 | Lynne |
elmlang | general | Yep (see above). Thanks | 2019-03-06T08:44:40.576500 | Corinne |
elmlang | general | Great :+1: | 2019-03-06T08:44:49.576700 | Lynne |
elmlang | general | :slightly_smiling_face: | 2019-03-06T08:44:54.576900 | Corinne |
elmlang | general | Hey everybody, im confused about why is tupple not considered a type here?
```
decoder : JD.Value -> Decoder ( ChunkId, Chunk )
x = JD.decodeValue Chunk.decoder val
``` | 2019-03-06T09:23:28.577900 | Yang |
elmlang | general | None | 2019-03-06T09:23:39.578000 | Yang |
elmlang | general | The issue is that `decodeValue` excepts the argument to be a `Decoder`, you pass it a function which returns a `Decoder` | 2019-03-06T09:26:31.578800 | Huong |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.