workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
essentially you're after: `(a -> b) -> (Maybe a -> a) -> (Maybe b -> b)`
2019-04-10T00:01:10.972600
Ruthann
elmlang
general
so first i'd solve the simpler problem: `(a -> b) -> ( a -> a ) -> ( b -> b)`
2019-04-10T00:01:49.973700
Ruthann
elmlang
general
which i don't know if you can...
2019-04-10T00:02:09.973900
Ruthann
elmlang
general
<@Earlean> I don't think I have default planned for that - if I had some message that did nothing would that solve the issue?
2019-04-10T00:02:37.974600
Kenny
elmlang
general
if you take the output `(b -&gt; b)`, you'll need something that did `(b -&gt; a)` at a minimum
2019-04-10T00:03:12.975500
Ruthann
elmlang
general
<@Kenny> You probably want to return a `Maybe` in that case
2019-04-10T00:03:27.975800
Earlean
elmlang
general
you could even have your build script replace it automatically :smile:
2019-04-10T03:13:35.976600
Nana
elmlang
general
You can just use a single codebase and multiple entry points into that codebase. You don’t need to make your life harder by splitting the code into multiple repositories or multiple folders.
2019-04-10T03:29:25.976900
Maida
elmlang
general
compiling each entry point will give you optimized bundles with only what is needed to run the functionality that the entry point implements.
2019-04-10T03:31:42.977100
Maida
elmlang
general
So, instead of having one `Main.elm` you will have `PublicMain.elm` and `PrivateMain.elm` altho, 14kLOC is rather small. I would expect that your gzipped minified bundle is probably bellow 100kb
2019-04-10T03:36:09.977300
Maida
elmlang
general
Is there such a possibility? I pass a JS object to the elm file and can use the method of JS object in the elm file
2019-04-10T03:55:39.977600
Carrie
elmlang
general
<@Carrie> no
2019-04-10T04:04:00.977800
Nana
elmlang
general
Oh, I see.
2019-04-10T04:06:56.978100
Carrie
elmlang
general
you can read values like Numbers and Strings though if you want to call a JS function you have to use ports
2019-04-10T04:08:16.979000
Nana
elmlang
general
Yes, I just want to use a JS function in elm, but there are too few cases on <https://guide.elm-lang.org/interop/ports.html>. I can't find the way I want to use it.
2019-04-10T04:19:24.979500
Carrie
elmlang
general
here's a basic example I made <https://ellie-app.com/4RDRLzDsrFDa1> it's a JS function that waits 1 sec and then returns whatever you sent it
2019-04-10T04:20:54.980100
Nana
elmlang
general
Thanks very much
2019-04-10T04:24:34.980300
Carrie
elmlang
general
That's great, it's the first time I see a useful usage of never/Never
2019-04-10T04:52:45.980700
Syble
elmlang
general
So I’m watching Luke’s talk about custom elements and Elm here: <https://dev.to/lukewestby/talk-when-and-how-to-use-web-components-with-elm-f85> If I understand correctly I can use the same technique to wrap a straight HTML element with `contenteditable=true` into a custom element? From what I read `contenteditable` is starting to be usable for very simply in place editing. Anybody has experience in that regard ?
2019-04-10T06:25:34.984300
Hoa
elmlang
general
Basically the custom element allows Elm VDOM not to be confused by the changes happening in the content editable element.
2019-04-10T06:26:39.985500
Hoa
elmlang
general
what kind of editing are you planning on though? Surely it'll be easier to use any existing rich editor.
2019-04-10T06:40:19.985600
Nana
elmlang
general
and if it's plain text, a textarea should be more reliable, plus no need for a web component
2019-04-10T06:41:21.985800
Nana
elmlang
general
I am writing my own editor and using custom element + contenteditable
2019-04-10T06:52:39.986300
Lynne
elmlang
general
So far, so good, though handling selection is a pain <@Hoa>
2019-04-10T06:52:56.986700
Lynne
elmlang
general
but why? :stuck_out_tongue:
2019-04-10T06:54:14.986800
Nana
elmlang
general
because why not?
2019-04-10T06:54:33.987000
Lynne
elmlang
general
I am adding additional logic and DOM elements to the text, so textarea is not suitable by definition
2019-04-10T06:55:17.987200
Lynne
elmlang
general
just since there's already so many editors to choose from
2019-04-10T07:05:07.987400
Nana
elmlang
general
Well, I am not writing yet another WYSIWIG editor and not really sure why you are questioning what I am doing
2019-04-10T07:07:45.987600
Lynne
elmlang
general
You have zero information about my needs
2019-04-10T07:08:07.987900
Lynne
elmlang
general
hey, I have a question regarding elm-live and proxy prefixes
2019-04-10T07:09:06.988900
Kiana
elmlang
general
sorry heh :sweat_smile:
2019-04-10T07:09:25.989200
Nana
elmlang
general
I need to have to proxy prefixes defined (one for the REST API, and one for the /login endpoint)
2019-04-10T07:09:44.989800
Kiana
elmlang
general
but I can't get it to work
2019-04-10T07:09:52.990100
Kiana
elmlang
general
is there a way to do that? wildcard support or something?
2019-04-10T07:10:04.990500
Kiana
elmlang
general
<@Kiana> I have no experience with `elm-live` myself but the docs mention `-x` and `-y` cmd args. Did you try them?
2019-04-10T07:21:59.991300
Lynne
elmlang
general
<https://github.com/wking-io/elm-serve/blob/master/lib/elm-reload-server.js#L41> It seems wildcards are not supported (because it is just using `String.startsWith` to test if an URL should be proxied)
2019-04-10T07:28:52.992100
Lynne
elmlang
general
Anyone know of a date/time library that can get the week number from a Time.Posix?
2019-04-10T07:29:04.992400
Gertrude
elmlang
general
`justinmimbs/date`
2019-04-10T07:29:26.992600
Lynne
elmlang
general
I found 2 Elm example of SPA (<https://github.com/rtfeldman/elm-spa-example> and this one : <https://github.com/levelhq/level/tree/master/assets/elm>), do you know any other?
2019-04-10T07:57:03.994600
Ismael
elmlang
general
<https://github.com/ohanhi/elm-shared-state>
2019-04-10T08:02:07.994800
Allyn
elmlang
general
Nice, thanks
2019-04-10T08:04:53.994900
Ismael
elmlang
general
You’re welcome. This one is simpler than <https://github.com/rtfeldman/elm-spa-example>, and the principle is documented.
2019-04-10T08:06:26.995100
Allyn
elmlang
general
I see that <https://github.com/NoRedInk/elm-assets-loader> is deprecated. What do you suggest using for handling assets in Webpack / Elm?
2019-04-10T08:11:59.996100
Mimi
elmlang
general
I often have a central Log module where log.debug serves that purpose. Then I only need to swap one item, if needed. Most often, I end up weighing whether to log them to a service or not, which I think is a good prompt.
2019-04-10T08:13:54.996200
Dane
elmlang
general
Days ago I was watching this: <https://www.youtube.com/watch?time_continue=63&amp;v=TWAMr72VaaU> and wondering how to tackle that in Elm. At least the editor part, let’s set aside the Elm block evaluation for now. So to me it seems there’s two kind of editors here: a simple block-level editor where basically let’s you do simple inline formatting (bold, Italics, link) and the code (Elm) editor part - which could really implemented with CodeMirror custom element. One could argue to use CodeMirror for both block types. Just evaluating possibilities here. The overall environment can be quite easily done with Elm. I have the the basics already written. Consider this as a project to test out Elm on a real-world UI with some no obvious challenges :slightly_smiling_face:
2019-04-10T08:30:16.996400
Hoa
elmlang
general
<@Lynne> yes, I've tried those, the problem is that I have two paths that need to be proxied, and share no common prefix
2019-04-10T08:36:42.997300
Kiana
elmlang
general
I've solved it by actually changing the paths
2019-04-10T08:36:59.997700
Kiana
elmlang
general
hey <@Millie> I ended up using a list with a generator for the supported characters (I wanted to generate strings which were both non-empty and only had certain characters), using `Fuzz.list`and `Random`
2019-04-10T08:45:59.997900
Vilma
elmlang
general
Here’s my evolving take on the SPA genre: <https://github.com/jhbrown94/experimental-elm-spa-skeleton/>
2019-04-10T09:08:05.998100
Dede
elmlang
general
What is your opinion about it?
2019-04-10T09:26:57.998500
Kent
elmlang
general
sorry, my text is missing...
2019-04-10T09:27:27.998900
Kent
elmlang
general
The compiler reports that the title function actually has two parameters, but from the way that I am used to reading the function type definition I initially assumed one (i.e. text), but could not understand Elm processed the second (i.e. schema). Is it technically correct to state the following: Elm expands (?) the function signature from [String -&gt; BaseSchemaProperty extras] to [String -&gt; BaseSchema extras -&gt; BaseSchema extras] at compilation time? Can you help me clarify my confusion.
2019-04-10T09:27:46.999100
Kent
elmlang
general
Nice, I like the example on how to redirect to login when not authenticated
2019-04-10T09:31:07.999200
Ismael
elmlang
general
From what I’ve read from the docs `type alias` are expanded at compilation time. That’s why you can’t define a type alias in term of itself, compiler would end up with a infinite recursion
2019-04-10T09:37:20.001100
Hoa
elmlang
general
So I believe you are correct in your assumption: the function signature gets expanded and gains a parameter
2019-04-10T09:38:49.002400
Hoa
elmlang
general
Regardless of type alias expansion, consider currying. Whenever you write `add : Int -&gt; Int -&gt; Int`, that's the exact same thing as writing `add : Int -&gt; (Int -&gt; Int)`, though you can still write `add a b` as the function head
2019-04-10T09:42:43.004300
Huong
elmlang
general
How did you get Slack to format your snippet as Elm? :slightly_smiling_face:
2019-04-10T09:45:15.004400
Timika
elmlang
general
I told it was Haskell...using the + button Code or Snippet
2019-04-10T09:46:50.004800
Kent
elmlang
general
...elm and Haskell look similar
2019-04-10T09:47:27.005000
Kent
elmlang
general
Ah, I mistook the “Elm snippet” as actual, real Elm highlighting. But it was the name you gave it. :slightly_smiling_face:
2019-04-10T09:48:01.005200
Timika
elmlang
general
I almost got a bit excited that Slack acknowledged Elm :slightly_smiling_face:
2019-04-10T09:48:20.005400
Timika
elmlang
general
I use `style-loader` during development and `mini-css-extract-plugin` for prod build. Plus `html-webpack-plugin` which bakes everything into an HTML page
2019-04-10T09:59:36.005600
Lynne
elmlang
general
I’ll check that thanks!
2019-04-10T10:03:36.005800
Mimi
elmlang
general
maybe something like Slatejs for the text blocks and CodeMirror for the code
2019-04-10T10:22:21.006100
Nana
elmlang
general
At the moment, it won't properly update the URL when that redirect happens. I'll fix that eventually but it's not the most critical thing on the list :wink:
2019-04-10T10:23:04.006300
Dede
elmlang
general
or if you want to get really fancy, Monaco, the editor part of VSCode, is available as a package :smile:
2019-04-10T10:23:08.006500
Nana
elmlang
general
<https://microsoft.github.io/monaco-editor/index.html>
2019-04-10T10:23:56.006800
Nana
elmlang
general
presumably it'd be possible to use the VSCode Elm plugin with it, probably a lot of work though
2019-04-10T10:24:51.007000
Nana
elmlang
general
Didn’t know Monaco. It is indeed a possibility :slightly_smiling_face:
2019-04-10T10:49:55.007500
Hoa
elmlang
general
Hey Sergey, I'm still not sure how you reference images from inside the elm app. Could you please elaborate a bit more?
2019-04-10T14:04:28.008100
Mimi
elmlang
general
~I mean do you have any mechanism to fingerprint the images? Or do you reference them without any added digest to the filename~ Opened a thread in Discourse <https://discourse.elm-lang.org/t/assets-fingerprinting-with-webpack-and-elm/3466> (edited)
2019-04-10T14:37:13.008700
Mimi
elmlang
general
~I guess I should have added that I'd like the images to be fingerprinted (<https://elmlang.slack.com/archives/C0CJ3SBBM/p1554898319996100>)~ Opened a thread in Discourse <https://discourse.elm-lang.org/t/assets-fingerprinting-with-webpack-and-elm/3466>
2019-04-10T14:37:17.008900
Mimi
elmlang
general
we wrote a webpack plugin that looks in our compiled JS for image paths and rewrites them to `/path/to/img.ext?&lt;the hash&gt;`
2019-04-10T16:43:29.010400
Alicia
elmlang
general
I have an issue that is more on the algorithmic side: given a list which contains a variable nr of numbers `list = [ 1, 2, -4, 10]` i want to be able to solve the following system of 2 equations by algorithm. I can do this on paper but i dont know how to do it in elm. ``` x0 + 1 = x1 + 2 = x2 - 4 = x3 + 10 x0 + x1 + x2 + x3 = 0 ``` the api i imagine being something like: solve [ 1, 2 -4, 10 ] == [ x0, x1, x2, x3 ] I don't know the actual solutions, since this is a made up example.. but in the resulting list - i want to have the corresponding solutions in the proper order. note the term `x0 + 1` is formed from the first element of the given list. So 1 and x0 are related - x0 being the first in the resulting list. I'm quite confused about how to approach this problem. how to even represent something like x0 in elm? Any insights into how to approach this? Thanks :slightly_smiling_face:
2019-04-10T17:02:59.019800
Yang
elmlang
general
<@Yang> don't know about the equation but couldn't that just be a function like `List Float -&gt; List Float` ?
2019-04-10T17:08:23.020900
Nana
elmlang
general
yep. `solve: List Float -&gt; List Float ` or `solve: List Rational -&gt; List Rational` I plan to move floats to rationals and back if i observe precision problems.
2019-04-10T17:12:25.023500
Yang
elmlang
general
hang on :thinking_face: wouldn't the solution always just be that xN is the inverse?
2019-04-10T17:12:27.023600
Nana
elmlang
general
not sure what you mean at this point
2019-04-10T17:13:11.024000
Yang
elmlang
general
or wait nvm :sweat_smile:
2019-04-10T17:15:08.025300
Nana
elmlang
general
let me take a look again. something is fishy here :))
2019-04-10T17:15:19.025600
Yang
elmlang
general
You’re looking for solving a system of equations, it looks like
2019-04-10T17:15:42.026300
Kris
elmlang
general
<https://en.m.wikipedia.org/wiki/Gaussian_elimination> is the standard way.
2019-04-10T17:15:50.026600
Kris
elmlang
general
yep, the issue is that to create the adjency matrix.. i need to organize this x0, x1.. and get their coefficients. But that process alone is something i don't know how to approach. How to get to the coefficients part? How i would know that x0 has coeficient 1? or 10? on paper is easy.. you can see the coeficients. Here in elm i dont know how to even sum it up.
2019-04-10T17:18:45.030000
Yang
elmlang
general
Variable size matrices are a pain to work with in elm though.
2019-04-10T17:18:46.030100
Kris
elmlang
general
Do you need to parse the equation from plain text? That _is_ a pain
2019-04-10T17:19:43.031100
Kris
elmlang
general
no actually. this is part of a system i am building.. and if i find the solutions .. i have what i need to move forward. I derived that equation form the system constraints. Is not text based.
2019-04-10T17:21:58.033200
Yang
elmlang
general
Really interesting question and answer: "Is it possible to write a package where you can construct a `Decoder a` and a function `a -&gt; Encode.Value` all at once, without having to repeat yourself when specifying the JSON structure?" <https://www.reddit.com/r/elm/comments/bbk6hb/interesting_puzzle_elm_decoders_and_encoders/?utm_medium=android_app&amp;utm_source=share>
2019-04-10T17:31:27.034500
Velia
elmlang
general
got an idea. Gonna try to represent it in elm as: `type Var = Var Index (Maybe Float)` Where `Var 1 Nothing` is x1 and is unsolved.
2019-04-10T17:31:31.034800
Yang
elmlang
general
<@Velia> those are known as bidirectional parsers
2019-04-10T17:40:13.036000
Kris
elmlang
general
Thanks for the pointer :+1:
2019-04-10T17:41:08.036200
Velia
elmlang
general
A package exists that does this but it hasn’t been upgraded to 0.19 <https://package.elm-lang.org/packages/jamesmacaulay/elm-json-bidirectional/latest/>
2019-04-10T17:56:00.036700
Jae
elmlang
general
Oh nice, never noticed it. Thanks!
2019-04-10T17:56:59.036900
Velia
elmlang
general
<https://gist.github.com/miniBill/cf1698087a9dacaf7c49c60d972ecdf2>
2019-04-10T17:57:16.037100
Raylene
elmlang
general
My module works for 0.19
2019-04-10T17:57:27.037300
Raylene
elmlang
general
Is it that useful in practice once you are used to them from your experience?
2019-04-10T17:57:47.037500
Velia
elmlang
general
<@Raylene> yes it's cool, that's what started the discussion: <https://elmlang.slack.com/archives/C0CJ3SBBM/p1554931887034500>
2019-04-10T17:59:34.037700
Velia
elmlang
general
Yeah, the package Martin linked is very similar. Mine also has support for ADTs tho (something I haven't found elsewhere). The key insight was that to support them you need to ask the user for a destructor (for example a destructor for `Result x y` is `(x-&gt;a) -&gt; (y-&gt;a) -&gt; Result x y -&gt; a`)
2019-04-10T18:03:16.038000
Raylene
elmlang
general
And the types sometimes get gnarly in the implementation (again, in particular for ADTs), but it's one of those "it compiles it works" areas. I'm particularly proud of the `recursive` method signature
2019-04-10T18:05:48.038200
Raylene
elmlang
general
Also, the same method can generate CRUD forms and type descriptions, but it does require yet another destructor (identical to the first, but Elm lacks hkp)
2019-04-10T18:09:00.038600
Raylene