« Back to channel list

#elixir-lang - 29 April 2019

« Back 1 day Forward 1 day »
[00:00:41] atk: has joined #elixir-lang
[00:07:10] tnez: has joined #elixir-lang
[00:32:27] pera: has joined #elixir-lang
[00:35:30] weird_error: has joined #elixir-lang
[00:39:45] kyrylo: has joined #elixir-lang
[00:56:46] Cthalupa: has joined #elixir-lang
[01:05:14] carldd: has joined #elixir-lang
[01:38:42] ariedler: has joined #elixir-lang
[01:58:27] brandfilt: has joined #elixir-lang
[02:00:25] orbyt_: has joined #elixir-lang
[02:04:36] tomterl: has joined #elixir-lang
[02:13:41] duaneb: has joined #elixir-lang
[03:08:51] aither: has joined #elixir-lang
[03:16:01] notzmv: has joined #elixir-lang
[03:20:37] carldd: has joined #elixir-lang
[03:20:46] lauromoura_: has joined #elixir-lang
[03:27:46] Saukk: has joined #elixir-lang
[03:37:35] harfangk: has joined #elixir-lang
[04:12:53] ariedler: has joined #elixir-lang
[04:29:09] brandfilt: has joined #elixir-lang
[04:40:33] voltone: has joined #elixir-lang
[04:44:47] gvaughn: has joined #elixir-lang
[04:58:56] puzza007: has joined #elixir-lang
[05:11:39] kapil____: has joined #elixir-lang
[05:27:50] orbyt_: has joined #elixir-lang
[05:53:31] zakora: has joined #elixir-lang
[05:55:54] gvaughn: has joined #elixir-lang
[06:13:36] ariedler: has joined #elixir-lang
[06:37:25] MuffinPimp: has joined #elixir-lang
[06:38:59] reda_: has joined #elixir-lang
[06:54:19] markmm: has joined #elixir-lang
[06:54:48] squall: has joined #elixir-lang
[06:58:43] qqwy: has joined #elixir-lang
[07:02:23] 94KAACD5W: has joined #elixir-lang
[07:37:03] infowolfe: has joined #elixir-lang
[07:37:03] infowolfe: has joined #elixir-lang
[08:13:06] reda_: has joined #elixir-lang
[08:13:40] medzin: has joined #elixir-lang
[08:14:22] ariedler: has joined #elixir-lang
[08:16:56] PragTob: has joined #elixir-lang
[08:35:20] tgrk: has joined #elixir-lang
[08:35:38] infowolfe: has joined #elixir-lang
[08:42:36] wonko7: has joined #elixir-lang
[09:01:45] gvaughn: has joined #elixir-lang
[09:43:52] mau133: has joined #elixir-lang
[09:47:07] ur5us: has joined #elixir-lang
[09:54:26] kyrylo: has joined #elixir-lang
[10:14:28] gvaughn: has joined #elixir-lang
[10:15:17] ariedler: has joined #elixir-lang
[10:22:08] lexmag: has joined #elixir-lang
[10:23:48] Havvy: has joined #elixir-lang
[10:48:10] brandfil1: has joined #elixir-lang
[10:55:07] ariedler: has joined #elixir-lang
[11:16:05] infowolfe: has joined #elixir-lang
[11:24:54] netrino: has joined #elixir-lang
[11:27:57] lexmag: has joined #elixir-lang
[11:31:35] jegaxd26: has joined #elixir-lang
[11:52:51] lexmag: has joined #elixir-lang
[11:59:05] medzin: has joined #elixir-lang
[12:00:29] craigp: has joined #elixir-lang
[12:01:23] medzin: has joined #elixir-lang
[12:07:29] hypercore: has joined #elixir-lang
[12:09:00] gvaughn: has joined #elixir-lang
[12:15:04] thurloat: has joined #elixir-lang
[12:21:01] lexmag_: has joined #elixir-lang
[12:21:29] kyrylo: has joined #elixir-lang
[12:25:00] proteusguy: has joined #elixir-lang
[12:26:25] tutti: has joined #elixir-lang
[12:36:40] Sentreen: has joined #elixir-lang
[12:37:49] lexmag: has joined #elixir-lang
[12:38:56] sentreen_: has joined #elixir-lang
[12:39:35] sentreen_: has joined #elixir-lang
[12:40:36] work_: has joined #elixir-lang
[12:46:31] medzin: has joined #elixir-lang
[13:02:08] sentreen_: has joined #elixir-lang
[13:02:43] Sentreen: has joined #elixir-lang
[13:14:10] JREB: has joined #elixir-lang
[13:15:35] duaneb: has joined #elixir-lang
[13:16:56] gvaughn: has joined #elixir-lang
[13:20:46] sparogy: has joined #elixir-lang
[13:24:14] lexmag: has joined #elixir-lang
[13:31:14] medzin: has joined #elixir-lang
[13:32:01] medzin: has joined #elixir-lang
[13:32:04] either|or: has joined #elixir-lang
[13:32:28] Sentreen: has joined #elixir-lang
[13:35:28] wonko7: has joined #elixir-lang
[13:42:47] gvaughn: has joined #elixir-lang
[13:46:48] dysfun: is there a map does not have key guard?
[13:47:20] dysfun: or does one just add a later clause without matching that key?
[13:50:22] OliverMT: (to the latter)
[13:50:44] OliverMT: it's a bit icky tbh, I've found I prefer conds
[13:50:49] micmus: dysfun: on OTP 21+ you can use the :erlang.is_map_key/2 guard
[13:50:49] OliverMT: when you need to think about not-haves
[13:50:57] dysfun: micmus: oooh
[13:51:01] OliverMT: thats a great addition
[13:51:17] micmus: it's not exposed in elixir, but you can call the erlang module directly
[13:51:18] dysfun: have we not copied that then?
[13:51:25] OliverMT: why isnt this exposed?
[13:51:37] OliverMT: ACTION grabs pitchfork and looks menacingly at josevalim 
[13:51:41] micmus: Elixir still supports OTP releases that don't have it
[13:51:57] OliverMT: don't break the build and all that
[13:52:05] dysfun: can't we conditionally have it?
[13:52:07] riddle: has joined #elixir-lang
[13:52:30] OliverMT: yeah, cant it compile to error if you're on older otp?
[13:52:40] OliverMT: ACTION hands pitchfork to dysfun 
[13:52:49] dysfun: ACTION hands flaming torch to OliverMT 
[13:53:00] OliverMT: now we're almost on a romantic date here
[13:53:33] OliverMT: I just used the is_map_key, coding tip of the day goes to micmus
[13:53:39] OliverMT: I was typing up a cond chain as we spoke :D
[13:53:47] dysfun: i was just trying to avoid lots of cases
[13:53:59] dysfun: (i'm content with default to nil on [])
[14:00:11] qqwy: @dysfun / @OliverMT there is no real reason to do so, since you can easily import it into your own code if you really need it
[14:00:23] qqwy: (which will make your code indeed fail with a compilation error on older OTP releases)
[14:01:27] qqwy: using `import :erlang, only: [is_map_key: 2]`
[14:01:43] OliverMT: could we defguard with this?
[14:01:44] qqwy: (although the order of arguments will probably be the opposite of what you'd expect in Elixir)
[14:01:59] qqwy: Yes, that's another possibility!
[14:02:21] OliverMT: map is 2nd arg?
[14:03:00] OliverMT: *that map is
[14:03:13] OliverMT: yeah, thats normal for most erlang stuff
[14:03:28] OliverMT: they don't have the joy of jesu... I mean pipe operator
[14:05:03] infowolfe: has joined #elixir-lang
[14:05:03] infowolfe: has joined #elixir-lang
[14:09:39] tnez: has joined #elixir-lang
[14:11:14] orbyt_: has joined #elixir-lang
[14:19:23] drewolson: i don't get the "harder to unit test" point in this article -- https://habr.com/en/post/449522/
[14:19:46] drewolson: if anything i've found elixir easier to unit test, as even OTP modules can be tested as "just functions"
[14:31:25] lauromoura: has joined #elixir-lang
[14:35:37] lexmag: has joined #elixir-lang
[14:58:10] qqwy: has joined #elixir-lang
[15:05:11] pera: has joined #elixir-lang
[15:05:19] pera_: has joined #elixir-lang
[15:06:02] pera: has joined #elixir-lang
[15:06:07] Phylock: has joined #elixir-lang
[15:10:44] LostKobrakai: has joined #elixir-lang
[15:12:23] LostKobrakai: @josevalim I just read over the docs for `mix release` and they're insanely well written.
[15:12:36] lauromoura_: has joined #elixir-lang
[15:19:36] nox: OliverMT: The joy of José you mean
[15:23:53] kyrylo: has joined #elixir-lang
[15:29:28] brandfil1: has joined #elixir-lang
[15:48:05] Scramblejams: has joined #elixir-lang
[16:02:59] Saukk: has joined #elixir-lang
[16:10:44] demmark: has joined #elixir-lang
[16:11:41] work_: has joined #elixir-lang
[16:19:55] wsieroci: has joined #elixir-lang
[16:33:34] serafeim: has joined #elixir-lang
[16:35:54] serafeim: hello, i've seen I could use <%= if true do "aaa" end %> in .eex templates
[16:36:24] serafeim: is it possible to output html instead of just text for "aaa" ?
[16:36:47] serafeim: i.e I want something like the {% if x %} html stuff {% endif %} of Django
[16:37:14] cschneid: has joined #elixir-lang
[16:38:46] benwilson512: serafeim: <%= if true do %> <p> yo dawg</p> <% end %>
[16:39:14] serafeim: benwilson512, oh I didn't know that was possible thanks !
[16:43:31] dimitarvp: has joined #elixir-lang
[16:44:24] inhortte: has joined #elixir-lang
[16:52:35] serafeim_: has joined #elixir-lang
[17:00:29] medzin: has joined #elixir-lang
[17:12:06] osieln: has joined #elixir-lang
[17:22:24] brandfilt: has joined #elixir-lang
[17:54:46] jmcgnh: has joined #elixir-lang
[17:55:50] drincruz: has joined #elixir-lang
[18:03:45] serafeim__: has joined #elixir-lang
[18:06:26] squall: has joined #elixir-lang
[18:10:15] lexmag: has joined #elixir-lang
[18:17:15] brandfilt: has joined #elixir-lang
[18:17:50] thomasross: has joined #elixir-lang
[18:27:41] jmcgnh: has joined #elixir-lang
[18:29:56] nageV_: drewolson: +1. he says "unit tests are less helpful ... [because] almost all Elixir functions are clean, which makes unit tests simpler". huh?
[18:30:52] lexmag: has joined #elixir-lang
[18:32:56] nageV_: maybe he thinks tests are only helpful if they cover complex/state-ridden logic
[18:34:09] nageV_: as a TDD practitioner, I feel tests are more than just a safety net for complex code: they're a design tool :)
[18:35:03] nageV_: that is to say: all code warrants tests, not just complex code. and Elixir making tests simpler is a Good Thing :)
[18:38:01] dysfun: when i was writing idris, i never bothered with tests, so does all code warrant tests?
[18:43:23] nageV_: it does if you're following Test Driven Development :) https://twitter.com/unclebobmartin/status/1030819434510745601
[18:43:52] dysfun: oh fuck uncle bob
[18:47:06] drewolson: dysfun: yeah but who unit tests your types now eh eh
[18:47:14] dysfun: the compiler
[18:47:27] drewolson: dysfun: but what about your types that are really functions that return types
[18:47:42] starbelly: hahaha "oh fuck uncle bob"
[18:48:06] drewolson: dysfun: also, idris is fascinating and i love that its creator describes it as "pacman complete"
[18:48:07] dysfun: drewolson: it's idris, that's pretty normal
[18:48:30] dysfun: drewolson: these days he follows it up with "probably. not sure, trademark issues"
[18:48:57] starbelly: the problem with how most people write tests is they write tests to see them pass, and thus there may as well be no tests.
[18:49:13] dysfun: ACTION writes tests to catch errors that the type system couldn't help him with
[18:49:19] dysfun: of course in elixir this is basically all errors that compile
[18:50:12] starbelly: I mean, I try to unit tests for all the things, then light weight integration... but if I can't write a good test in N time, then it's probably not worth doing. I'd rather have a lack of tests vs a bunch of shitty tests that deceive everyone.
[18:51:19] jnoon2: has joined #elixir-lang
[18:51:35] starbelly: property tests exemplify how hard writing _good_ tests actually is IMO... of course you can write shitty property tests too
[18:51:43] dysfun: i love property tests though
[18:52:04] dysfun: i had some great ones that took tens of minutes to run 100 iterations
[18:52:07] dysfun: that was fun
[18:52:15] starbelly: but if I heard you correct the first time... production is the real test
[18:52:44] dysfun: up to a point
[18:52:53] dysfun: i mean, i'm working on a thing right now where we don't have much option but to do that
[18:52:58] lexmag: has joined #elixir-lang
[18:53:08] starbelly: ACTION definitely not saying don't write tests, rather focus on writing good tests 
[18:53:27] lexmag: has joined #elixir-lang
[18:53:44] dysfun: make sure it's correct, somehow, end of
[18:54:03] jnoon2: in an umbrella project, im running mix test inside one app. that app uses modules from other "apps". im getting module SomeOtherApp.Lib is not available. im probably just missing some config to tell the app it depends on the other?
[18:54:04] starbelly: right, and that usually takes more time than most people/companies want to spend on tests :(
[18:54:04] dysfun: property tests are great for this
[18:54:25] dysfun: heh, so one of the projects i work on has only controller tests, because there was limited time for tests and they're the best bang for buck
[18:54:39] starbelly: you mean integration wise?
[18:54:43] ericmj: jnoon2: you should list the deps in mix.exs
[18:55:02] dysfun: no, i mean vast portions of the codebase are only tested by faking requests
[18:55:07] dysfun: because it touches the whole process
[18:55:17] ericmj: `{:sibling_app_in_umbrella, in_umbrella: true}`
[18:55:26] dysfun: they're not thorough tests, but for the time that was presumably allocated, they're good bang for buck
[18:56:11] jnoon2: ericmj: that was it, thanks
[18:56:21] starbelly: dysfun: I suppose... I dunno, I've seen plenty of bad controller tests where if a unit test had been written for well one small unit, it would have caught problems that the controller tests did not.
[18:56:42] starbelly: and it's not like anyone set out to write bad controller tests
[18:56:56] dysfun: yeah they're not amazing, but i gather it was done under extreme time pressure
[18:57:03] dysfun: some idiot i won't name decided to rewrite in elixir
[19:00:31] Benjojo: has joined #elixir-lang
[19:01:43] starbelly: well, a re-write is usually a bad idea, at least a complete re-write, though the person was probably just trying to do the right thing, and if so, would not call them an idiot
[19:02:19] starbelly: foolhardy maybe
[19:07:07] dysfun: well, i don't mind too much because i'm only working on it because it's elixir
[19:07:22] dysfun: but certainly rewriting under time pressure has limited advisability, even if it's to elixir
[19:09:09] dysfun: at a previous job, we moved to elixir, but we didn't just instantly rewrite, we had a transition strategy
[19:09:12] dysfun: crazy, i know
[19:09:14] Benjojo: has joined #elixir-lang
[19:12:41] wsieroci: has joined #elixir-lang
[19:18:41] serafeim__: i am using VS code with the vscode-elixir plugin. when I edit an elixir file I see something like "@spec call(Plug.Conn.t(), any()) :: Plug.Conn.t()" over my methods. can anybody explain what is this ?
[19:20:14] serafeim_: has joined #elixir-lang
[19:20:48] serafeim_: is this typing defined somewhere? how does vscode-elixir know that this actually *is* a Plug ?
[19:22:19] kyrylo: has joined #elixir-lang
[19:25:14] serafeim_: i.e how does it know that the first parameter of the call method (conn) is a Plug.Conn? Couldn't that be anything ?
[19:28:57] benwilson512: serafeim_: do you have @behaviour anywhere?
[19:30:02] serafeim_: i don't think so. here's the whole module: https://dpaste.de/wivU
[19:30:15] markmm: has joined #elixir-lang
[19:30:25] serafeim_: now, right over the init and call methods visual studio writes the @spec stuff I mentioned earlier
[19:30:45] serafeim_: so it seems that *somehow* it knows that this is a Plug
[19:31:38] serafeim_: or at least that the conn that I pass to call is a Plug.Conn
[19:33:02] benwilson512: oh it infers it from how you use the arg
[19:34:17] serafeim_: lol so it knows that conn is a Plug.Conn because I pass it to Plug.Conn.get_session ?
[19:37:28] benwilson512: serafeim_: yes, that's the type that Plug.Conn.get_session says it requires, so it's saying that in order for your call function to succeed, you need to pass it a conn
[19:37:48] serafeim_: wow ok this is new to me
[19:41:21] serafeim_: and is there a specific mechanism / library that supports that ?
[19:46:15] benwilson512: serafeim_: not sure what you mean
[19:47:18] serafeim_: i mean where does the VS-code plugin find this information? i.e that the parameter is a Plug.Conn?
[19:47:55] dysfun: is it not the typespecs?
[19:51:22] lexmag: has joined #elixir-lang
[19:51:28] serafeim_: hm probably
[19:51:43] benwilson512: serafeim_: dialyzer is doing all the heavy lifting here
[19:51:51] benwilson512: and yeah it's using the typespec here: https://github.com/elixir-plug/plug/blob/v1.8.0/lib/plug/conn.ex#L1399
[19:55:02] serafeim__: has joined #elixir-lang
[19:57:50] m1dnight_: has joined #elixir-lang
[20:11:11] duaneb: has joined #elixir-lang
[20:11:43] morphemass: has joined #elixir-lang
[20:11:43] serafeim_: has joined #elixir-lang
[20:13:15] serafeim_: this code works fine: <%= @user.permissions |> Enum.map(& &1.name) |> Enum.join %>
[20:13:30] serafeim_: this code <%= @user.permissions |> Enum.map (& &1.name) |> Enum.join %> throws an error. *notice the space in Enum.map.
[20:14:03] serafeim_: the error is: protocol Enumerable not implemented for #Function<0.55029995/1 in AsampleWeb.PageView."index.html"/1>, only anonymous functions of arity 2 are enumerable.
[20:25:49] duaneb: has joined #elixir-lang
[20:27:31] greengriminal: has joined #elixir-lang
[20:27:32] benwilson512: serafeim_: because it's parsed as `@user.permissions |> Enum.map((& &1.name) |> Enum.join)`
[20:28:15] serafeim_: oh well ok I didn't know that whitespace was important there
[20:28:24] serafeim_: I'd read that only parentheses were improtant
[20:30:43] lexmag: has joined #elixir-lang
[20:32:19] inhortte: has joined #elixir-lang
[20:32:32] lexmag: has joined #elixir-lang
[20:58:58] mahmudov: has joined #elixir-lang
[21:10:17] ur5us: has joined #elixir-lang
[21:30:14] jnoon21: has joined #elixir-lang
[21:33:40] greengriminal: has joined #elixir-lang
[21:38:09] wonko7: has joined #elixir-lang
[21:45:26] craigp: has joined #elixir-lang
[21:53:23] hypercore: has joined #elixir-lang
[21:56:41] brett: has joined #elixir-lang
[22:05:36] jnoon2: has joined #elixir-lang
[22:20:17] netrino_: has joined #elixir-lang
[22:23:16] Kodan: has joined #elixir-lang
[22:29:27] drincruz: has joined #elixir-lang
[22:31:35] sparogy: has joined #elixir-lang
[22:45:24] ur5us: has joined #elixir-lang
[22:46:08] ariedler: hmmm maybe I should get around to optimizing Enum.uniq
[22:46:24] ur5us: has joined #elixir-lang
[22:53:07] aalmazan: has joined #elixir-lang
[22:56:56] sms: ariedler: Do it!
[22:57:58] sms: I'd way rather use that then the whole set to list method
[23:00:13] drincruz: has joined #elixir-lang
[23:07:22] ariedler: I was wondering if I could optimize the stream version as well, but lets just do the list version for now lol
[23:10:51] pera: has joined #elixir-lang
[23:15:29] pera_: has joined #elixir-lang
[23:16:12] pera: has joined #elixir-lang
[23:20:46] duaneb: has joined #elixir-lang
[23:23:09] ariedler: sms: the whole mapset unique thing is freaking magical, no idea how it does it so fast
[23:23:38] Avinash: has joined #elixir-lang
[23:34:45] sms: I haven't looked at it ariedler!
[23:34:48] sms: What makes it so magical
[23:35:38] ariedler: so what I thought was because uniq_list (underlying implementation for List.uniq) was not using tail optimization the memory was being bloated
[23:36:03] ariedler: but i switched it to use tail optimization, and I get no performance improvement
[23:37:04] craigp: has joined #elixir-lang
[23:37:25] ariedler: however MapSet method is not ordered like Enum.uniq(_by) is ordered result
[23:39:55] ariedler: I would be surprised if the ordering cost that much; but it seems like that is the case
[23:44:09] icecreamcohen: has joined #elixir-lang
[23:45:49] jeffro: has joined #elixir-lang
[23:52:25] ariedler: I found a really funny optimization; but its so minor lol
[23:54:55] nageV: has joined #elixir-lang
[23:57:10] nageV: has joined #elixir-lang
[23:58:45] icecreamcohen: fishcakez: you around?