<    June 2018     >
Su Mo Tu We Th Fr Sa  
                1  2  
 3  4  5  6  7  8  9  
10 11 12 13 14 15 16  
17 18 19 20 21 _2_2 23  
24 25 26 27 28 29 30
00:00 atk joined
00:01 bydo joined
00:02 oisdk joined
00:04 zfnmxt joined
00:05 <zfnmxt> Why is foldl' written with seq instead of deepseq? Can't you still get massive thunks with reduction to only WHNF?
00:05 <zfnmxt> I suppose it must be the NFData constraint on deepseq.
00:06 ozataman joined
00:07 twandy1 joined
00:08 pera joined
00:08 <mud> zfnmxt: You don't always want deepseq either
00:08 <jmcarthur> deepseq isn't always the fastest or the most appropriate
00:09 <zfnmxt> Hm. Can you guys give me an example of something that wouldn't have an NFData instance?
00:09 <jmcarthur> deepseq would force a traversal of the whole accumulator every time
00:10 <jmcarthur> (except for specific types that I guess could avoid it with a specialized instance)
00:10 <zfnmxt> Ah, right. So if the accumulator is made from some complex series of constructors it could get bad, right?
00:10 <jmcarthur> yup
00:10 <jmcarthur> Also, maybe I actually don't want the whole thing to be strictly evaluated anyway.
00:10 <zfnmxt> And re: the specialized instance: maybe you could have a flag that indicates it's in normal form already, preventing the need for traversal?
00:11 <jmcarthur> I was thinking that if the entire data structure is known to be strictly evaluated anyway then you can just define it as seq
00:12 <zfnmxt> Ah, true!
00:12 <zfnmxt> Or, const :P
00:12 exarkun joined
00:12 <zfnmxt> I think?
00:13 beka joined
00:13 <jmcarthur> :t seq
00:14 <lambdabot> a -> b -> b
00:14 <jmcarthur> :t const
00:14 <lambdabot> a -> b -> a
00:14 <jmcarthur> And it's not just argument order that matters. They have different strictness properties, too.
00:14 <zfnmxt> :t flip . seq
00:14 <lambdabot> a -> b -> (b -> c) -> c
00:14 <jmcarthur> You would need it to be seq, at least, because it can only be in NF if it is in at least WHNF
00:15 <zfnmxt> Uhh...ignore that.
00:15 <zfnmxt> Right, but don't we "know" that is fully evaluated?
00:15 <zfnmxt> If it's fully evaluated seq won't evaluate it any further
00:15 <jmcarthur> Not if it has never been evaluated at all.
00:15 YongJoon joined
00:16 <jmcarthur> Nothing in Haskell is evaluated by construction. It's evaluated by evaluation.
00:16 <zfnmxt> But if something has never been evaluated at all it's not in NF
00:16 <jmcarthur> Even strict data types.
00:16 <jmcarthur> I mean even an Int isn't evaluated just because it's an Int.
00:17 <Welkin> is there a way to configure the colors in haskell-mode?
00:17 <jmcarthur> You still have to evaluate it, but once it's evaluated you know it's actually in normal form.
00:17 <jmcarthur> Even if you only "tried" to evaluated it to WHNF.
00:17 kmurphy4 joined
00:18 <Welkin> it only uses less than half of my themes colors
00:18 <Welkin> and chooses subpar ones ta that
00:18 <zfnmxt> let x = 5 :: Int ; :sprint x returns x = 5
00:18 <Welkin> and I would like more to be highlighted in distinct colors
00:18 <zfnmxt> But maybe that's my confusion
00:18 <zfnmxt> Doesn't Haskell not thunk things that consist of a constructor applied to expressions in NF?
00:18 <zfnmxt> Or something like that....?
00:19 <zfnmxt> x = [1,2,3] :: Int wouldn'
00:19 <zfnmxt> Wouldn't be thunked, right**
00:19 <jmcarthur> zfnmxt: Try 5+5 or something. A raw constructor is going to be already evaluated, as an optimization, and maybe numeric literals for primitive types are the same way.
00:19 <zfnmxt> ::[Int]**
00:19 kmurphy4 joined
00:19 <geekosaur> Welkin, probably with normal customize-faces commands
00:19 <Welkin> geekosaur: how does that work?
00:19 <geekosaur> which dont interact well with themes in my experience
00:20 <zfnmxt> I see.
00:20 <Welkin> I've been looking through the haskell-mode source and can't find any place where colors are set
00:20 <zfnmxt> So the raw constructor bit is just GHCi optimizations.
00:20 <zfnmxt> What exactly is there rule there that GHCi applies?
00:20 <jmcarthur> It may not even be an optimization as much as it is "just the way it works", because constructors are primitive.
00:20 <zfnmxt> When does it go ahead and just fully evaluate something?
00:21 <jmcarthur> What I said earlier about not being evaluated on construction was imprecise.
00:21 <geekosaur> actually it doesn;t seem to have its own colors, just the standard font-lock colors
00:22 <jmcarthur> Something which is constructed directly may happen to already be evaluated. Something which is computed will not be, without optimizations.
00:22 <zfnmxt> Right
00:22 <Welkin> geekosaur: so is there a way to customize it in my .emacs?
00:22 <Welkin> hook anywhere?
00:23 <geekosaur> I use the standard customize-face stuff, which will save to .emacs
00:23 <geekosaur> M-x customize-face RET RET
00:23 gestone joined
00:23 kefin_ joined
00:24 mnoonan joined
00:24 gregberns joined
00:25 <jmcarthur> It's only *allowed* to evaluate eagerly if doing so doesn't prevent a normally-terminating program from terminating, but it's even less frequently a good idea, and even less frequently than that will the compiler decide to do it. And I don't have a good notion of how the strictness analyzer actually works.
00:26 <zfnmxt> That makes sense
00:26 <Welkin> geekosaur: this looks promising. Thanks. Will this work without causing any issues with the mode?
00:26 <zfnmxt> Eagerly evaluating undefined would surely be bad
00:26 <zfnmxt> :)
00:26 <jmcarthur> I guess theoretically sometimes the compiler could decide to eagerly evaluate something that makes the program slower, but I haven't really run into that as far as I can remember.
00:26 <jmcarthur> Usually it's because the program was written with unnecessary strictness using seq.
00:26 <zfnmxt> I think I read in HFFP that GHCi evaluates all expressions consisting exclusively of data constructors
00:27 <Welkin> I actually see a lot of "haskell-*-face-*" faces in the display list
00:27 <jmcarthur> I think that is true, or perhaps more accurately, inherent to how constructors work in GHC.
00:27 <geekosaur> Welkin, I don''t know what you're uing, so can;t say. I have changed several of the font lock faces locally, to make them more visible on my monitor especially when f.lux is active
00:27 <jmcarthur> *more precisely
00:28 <geekosaur> hm, I may noit actually have haskell mode loaded in the session I checked; it's mostly text files
00:28 <zfnmxt> Cool.
00:28 <zfnmxt> Thanks for the discussion, jmcarthur :)
00:29 plugin joined
00:32 beka joined
00:33 <Welkin> geekosaur: is there a way to set them to the colors supplied by my theme instead of setting the colors directly?
00:33 <geekosaur> I have no idea; I don;t use any theme stuff
00:36 progfun joined
00:37 night joined
00:38 conal_ joined
00:39 progfun joined
00:39 wollw joined
00:39 twandy joined
00:41 freeman42]NixOS joined
00:41 andyhuzhill joined
00:44 ma489 joined
00:45 Kundry_Wag joined
00:45 sytherax joined
00:49 taumuon joined
00:49 mounty joined
00:51 logzet_ joined
00:51 justaguest joined
00:51 cjreynolds joined
00:52 progfun joined
00:54 justanotheruser joined
00:55 tijko joined
00:56 ericsagn1 joined
00:56 tijko joined
01:00 Linter joined
01:00 initiumdoeslinux joined
01:00 haskell_noob1 joined
01:01 gregberns joined
01:01 bbrodriguez joined
01:03 nuncanada joined
01:05 burp joined
01:06 gregberns joined
01:09 cyphase joined
01:09 nighty- joined
01:09 kasrasadeghi joined
01:09 <kasrasadeghi> hello
01:11 twandy joined
01:11 sytherax joined
01:19 Luke joined
01:19 kasra joined
01:19 vurtz joined
01:19 <kasra> can anyone help me with an import issue?
01:20 conal_ joined
01:22 andreabe_ joined
01:22 Kundry_Wag joined
01:22 Yuras joined
01:24 carlomagno joined
01:24 <lyxia> kasra: just ask your question
01:25 <kasra> lyxia: I'm trying to import another file in a stack project. They're both located in the same directory. There's a module declaration in the file I'm trying to include.
01:26 <kasra> https://github.com/kasrasadeghi/cornerstone-haskell/blob/master/test/Test.hs
01:26 <kasra> here's the link to the file i'm trying to import in
01:26 <kasra> it complains about "import TestUtil" on line 15
01:27 night joined
01:28 <mud> kasra: What's the error? The hs-source-dirs on line 34 in the .cabal file looks odd to me. I don't know what that does, having multiple, especially overlapping with the other component
01:29 <kasra> https://paste.gnome.org/pttoqw5bi
01:30 <kasra> mud: that part was working in the previous version of the project, so I think it's fine
01:30 <kasra> mud: I think it just tells it to look in multiple subdirectories
01:32 patbecich joined
01:33 <mud> Ah
01:33 sdothum joined
01:34 <mud> kasra: Usually one just depends on the library in the test-suite component (and the executable component)
01:34 <mud> I'm not really sure how that works
01:34 gregberns joined
01:35 <kasra> how would I make it depend on the test-suite library?
01:37 falafel joined
01:37 <mud> I don't think I understand the question. I meant the test-suite depends on the library. The library is named cornerstone-haskell, which would go in the build-depends on line 38 in the .cabal file, if that's what you meant
01:38 <kasra> do I still say "other-modules" in that case?
01:38 jfredett joined
01:39 Khisanth joined
01:40 carafe joined
01:40 <mud> Only the stuff that's in test/ for the test-suite part
01:40 lassulus_ joined
01:40 <mud> Note that I have no idea if this is going to fix your issue. It's just the only thing I see different than I expect.
01:41 Linter joined
01:42 patbecich joined
01:43 twandy joined
01:44 <kasra> mud: doing that made it work, so thank you!
01:45 <mud> Ah, cool. You're welcome, glad it worked
01:46 <kasra> god bless I don't even know what happened
01:46 xcmw joined
01:46 <kasra> I've been trying to fix that for hours
01:49 <mud> Building errors suck :-/
01:51 haskell_noob1 joined
01:54 dented42 joined
01:54 tzemanovic joined
01:54 exarkun joined
01:58 night_ joined
02:00 hucksy joined
02:03 Zipheir joined
02:04 SenasOzys joined
02:07 MP2E joined
02:15 twandy joined
02:16 theDon joined
02:17 banc joined
02:18 rcdilorenzo left
02:18 eschnett joined
02:20 MarcelineVQ joined
02:21 alx741 joined
02:23 Sgeo__ joined
02:25 mizu_no_oto_work joined
02:27 beka joined
02:28 gregberns joined
02:28 beka joined
02:30 xcmw joined
02:30 woodson joined
02:34 plugin joined
02:35 Nokurn joined
02:37 Luke joined
02:39 amirpro joined
02:39 yahb joined
02:40 amar joined
02:40 jedws joined
02:40 lagothri1 joined
02:41 xcmw joined
02:42 canaria joined
02:43 xcmw joined
02:43 cjreynolds joined
02:46 twandy joined
02:47 cobreadmonster joined
02:48 initiumdoeslinux joined
02:50 nicht joined
02:51 XorSwap joined
02:52 progfun joined
02:53 jfredett joined
02:54 AetherWind joined
02:55 Kundry_Wag joined
02:56 jfredett joined
02:56 progfun_ joined
02:57 gregberns joined
03:00 canaria joined
03:01 progfun_ joined
03:01 Taneb joined
03:03 canaria joined
03:06 beka joined
03:07 progfun_ joined
03:08 progfun joined
03:08 <jared-w> building errors are pretty useful; haskell's are unfortunately decently useless unless you're trained in the art of deciphering idiosyncratic incantations
03:09 <rotaerk> using haskell trains you in the art of deciphering idiosyncratic incantations
03:09 <jared-w> pffh
03:09 progfun__ joined
03:09 <jared-w> `foldl (flip (:)) []` is a perfectly cromulent and readable expression /s
03:09 <rotaerk> I just completed implementing the Vulkan up through the last step before actually rendering a triangle
03:09 <rotaerk> it's almost 1000 lines of code, and still no triangle
03:10 <rotaerk> the Vulkan tutorial *
03:10 <jared-w> nice!
03:10 <* jared-w> wonders if it needs more cowbell
03:10 haskell_noob1 joined
03:10 <LiaoTao> If only we had some sort of nice high-level API for that stuff
03:10 <rotaerk> do we?
03:10 <jared-w> We have great high level APIs for drawing stuff inefficiently; we have zero for making vulkan things ;)
03:11 <jared-w> (unless someone sneakily wrote a package I'm completely unaware of...)
03:11 <rotaerk> only thing I'm aware of is lambdacube, but I don't have any idea how good it is
03:12 <LiaoTao> I was referring to OpenGL and the irony of doing a 180 on the abstraction stuff after 20 years of moving the other direction
03:12 <rotaerk> oh, I see
03:12 <LiaoTao> s/moving/moving in/
03:12 <* boj> looks up "cromulent"
03:12 <jared-w> eh, I've always thought of the 20 years of "higher abstraction" as really being the wrong kind of abstraction and moving towards "ghost paths in the GPU and magical fast-fast happy paths"
03:13 justaguest joined
03:13 <jared-w> like the fact that no modern 3D AAA game runs well on any GPU until it's shipped over to specialized GPU experts (from what I've heard) should tell volumes of how easy and user-friendly making fast code with our current APIs is...
03:13 <rotaerk> as I understand it, one of the problems with the level of abstraction that GL and D3D11- have is that game-specific optimizations end up having to be done at the driver level
03:13 <LiaoTao> To be sure, OpenGL wasn't the best solution. I was just being glib.
03:14 <rotaerk> whereas vulkan exposes those details so you can do it in your own code
03:14 <rotaerk> and really, that seems appropriate; abstractions can be built on top of vulkan
03:14 <LiaoTao> The hardware underneath OpenGL has evolved in such a way that it is impossible to keep going
03:14 <jared-w> rotaerk: iirc it was that driver optimizations end up working around shitty code in the AAA games because the difference between shitty code and code that hits the GPU fast path is almost nothing with most modern library APIs that are "high level and nice to work with"
03:15 <jared-w> Essentially a case of "x can't see y's closed source code and y can't see x's closed source code so neither can get to the root of each other's problem", among other issues
03:16 <rotaerk> yeah that might be a more accurate description of the problem
03:16 <jared-w> But I could be misremembering the talks I listened to a while ago; it /was/ a while ago and I am deaf... :p
03:16 <justaguest> what's the best way to work with 3D in haskell, now that OpenGL is being deprecated on Macs? Does haskell have bindings to the more modern stuff?
03:16 <jared-w> (deaf-ish, rather; meh)
03:16 <rotaerk> GL is only deprecated on macs; it's still relevant elsewhere
03:16 <rotaerk> and if you want to target macs, I think you need to use metal?
03:17 <rotaerk> but vulkan has bindings in haskell if you want to use that
03:17 <rotaerk> I like: https://hackage.haskell.org/package/vulkan-api
03:17 <justaguest> are the vulkan bindings as good as the OpenGL binding? eg. "gl" or "OpenGLRaw"
03:18 <LiaoTao> justaguest: After a lot of searching, I found only the raw bindings work sufficiently well
03:18 <LiaoTao> All other abstractions are missing tons of stuff
03:18 <rotaerk> I don't have a lot of experience with gl, but these bindings seem good and low-level
03:18 twandy joined
03:18 <rotaerk> https://github.com/Rotaerk/vulkanTest/blob/master/main/src/Main.hs
03:19 <rotaerk> my vulkan-tutorial.com -based code so far
03:20 <justaguest> awesome, I might skip OpenGL and learn Vulkan instead
03:20 <rotaerk> (definitely some abstractable code duplication in there, but not worried about that just now)
03:20 <rotaerk> justaguest, bear in mind, that's 1000 lines and I still don't have a triangle :P vulkan is verbose, at least the setup is
03:21 <rotaerk> really close to the triangle step though
03:21 <justaguest> oh wow...
03:22 <rotaerk> also these bindings do a bunch of low-level things I'm not familiar with; reading the implementation is informative
03:23 <rotaerk> s/informative/educational/
03:23 codyw joined
03:24 <LiaoTao> "The Vulkan API is designed around the idea of minimal driver overhead and one of the manifestations of that goal is that there is very limited error checking in the API by default. Even mistakes as simple as setting enumerations to incorrect values or passing null pointers to required parameters are generally not explicitly handled and will simply result in crashes or undefined behavior. "
03:24 <LiaoTao> Just like back in the old days
03:24 <rotaerk> that's handled by validation layers
03:24 <jared-w> LiaoTao: although to be fair, the fact that the GPU hasn't had a 'sane' and standardized "unsafe but fast AF" API to target has been a bit of an annoyance to say the least
03:25 <rotaerk> which only run when you're debugging, ideally
03:25 <LiaoTao> Indeed
03:25 <jared-w> CUDA is ridiculous since it's very specialized, locked down to NVIDIA, etc., openGL isn't nearly fast enough and it's horrible to program in, and every other graphics API is either worse or broken in other ways
03:25 shafox joined
03:26 <jared-w> I'm excited to see what higher level medium targeted IRs come out for Vulkan if it takes off
03:26 <LiaoTao> Yes, those are what makes the switch worth it
03:26 <rotaerk> IR?
03:27 <jared-w> intermediate representation
03:27 <rotaerk> oh
03:27 <jared-w> think LLVM vs x86 assembly
03:28 <jared-w> LLVM is much nicer to work in and is an IR to x86 (and other assemblies). Hopefully Vulkan becomes the "LLVM of the GPU"
03:28 <rotaerk> oh, I guess that's what the shader language that vulkan takes refers to
03:28 <rotaerk> SPIR-V
03:28 <LiaoTao> rotaerk: Actually, I like this validation layer stuff more than the OpenGL error handling API
03:29 <LiaoTao> Which is a horrendous mess that's plain painful to use
03:29 <rotaerk> I wonder if it'd be useful to make a haskell, statically typed, eDSL shader language that compile to SPIR-V
03:33 <rotaerk> compiles *
03:34 <juri_> rotaerk: yes. accelerate could use help.
03:34 exarkun joined
03:35 <juri_> rotaerk: I've been familiarizing myself with accelerate so i can add spir-v nouveau support to it.
03:36 <jared-w> either accelerate or repa, whichever one is the one that does the compiling an AST method of generating code
03:36 <jared-w> but yeah I'd probably just extend accelerate to generate Vulkan woohoo instead of making you rown eDSL, rotaerk; you get to piggy back off of their optimizations that way :)
03:45 progfun joined
03:48 otto_s_ joined
03:49 isenmann joined
03:49 twandy joined
03:49 codyw joined
03:51 keepLearning512 joined
03:55 daniel-s joined
03:57 <haskell_noob1> a question about ffi that initializes static variables. if i need threadsafety, should these calls be inside something like stm?
03:58 igqg joined
03:59 Linter joined
03:59 takuan joined
04:00 <rotaerk> jared-w, oh, I hadn't heard of accelerate
04:00 <jared-w> It's pretty badass :)
04:00 <jared-w> most of the data haskell work is pretty badass, actually; that's where we got our vector library from
04:00 <jared-w> and a lot of our research into stream fusion iirc
04:01 <rotaerk> interesting
04:02 <rotaerk> oh juri_ was the one who initially mentioned it; thanks
04:04 language_agnosti joined
04:04 <rotaerk> i'll need to dig into this; so far I don't really see how it's usable as a shader language
04:05 justanotheruser joined
04:05 danso joined
04:07 SpinTensor joined
04:07 lbhdc joined
04:08 <rotaerk> looks like a monster, too
04:15 krone_ joined
04:15 jfredett joined
04:15 kasra joined
04:16 progfun joined
04:16 oisdk joined
04:16 pwnz0r joined
04:17 <jared-w> It's an eDSL for compiling to efficient code; think of it more as an eDSL for generating low level and efficient numeric code
04:18 <jared-w> It should be decently easy to extend it to generate shader code by extending the eDSL and then allowing it to target Vulkan, I think? It does emphasize numerics and number crunching atm though
04:18 dodong joined
04:19 <rotaerk> yeah, what I don't get is ... well, I don't really know shader languages very well, but I thought they had all these idiosyncratic aspects to them, like uniforms and positioned input/output variables, and distinctions between types of shaders (fragment, vertex, geometry, etc)
04:19 <rotaerk> and I don't see how all of that would be accounted for in an abstract ... array-computation library
04:20 <rotaerk> but I'm sure it'll make sense once I get more familiar with both accelerate and shaders
04:21 <jared-w> I've always thought of shaders as specialized linear algebra calculations that are all essentially matrices and stencils eventually... I could be wrong? If I am, accelerate might not be the best fit, but its ideas and how it uses designs its eDSL would still be quite fruitful to study for making your own if you want to go down that route
04:21 <jared-w> edwardk: do you know anything about shaders for 3D graphics engines? Am I wrong in thinking they're basically just applied matrices and stencils?
04:22 hellozee joined
04:23 <rotaerk> as I understand it, shaders do involve linear algebra computations, but they also involve channeling the data in and out through the right variables, with restrictions on what data is allowed in/out based on the type of the shader
04:23 twandy joined
04:24 `Guest00000 joined
04:24 hellozee joined
04:24 tauta joined
04:26 progfun joined
04:27 <jared-w> isn't that the stencil bit? :p
04:27 <rotaerk> no idea
04:27 <rotaerk> not sure what those even are
04:28 <jared-w> https://en.wikipedia.org/wiki/Stencil_(numerical_analysis)
04:28 <jared-w> (I've only learned the term by osmosis so this'll be a better reference than I)
04:28 <rotaerk> k
04:29 <jared-w> https://research.ncl.ac.uk/game/mastersdegree/graphicsforgames/scissorsandstencils/Tutorial%205%20-%20Scissors%20and%20Stencils.pdf more about scissors and stencils :)
04:30 <rotaerk> so this "stencil buffer" and the numerical analysis "stencil" refer to the same thing?
04:30 <rotaerk> or, at least, are rooted in the same thing
04:30 mizu_no_oto joined
04:31 <rotaerk> I'm inclined to think not, that a stencil buffer is actually more like a literal physical stencil
04:32 <rotaerk> though the numerical analysis stuff is way over my head
04:32 <rotaerk> I've never studied the subject
04:35 <taumuon> it's my understanding that a shader is a subroutine in a specialized language that uses the limited instruction set on a shader unit (the small CPU's in your GPU)
04:35 <rotaerk> basically, yeah
04:37 gregberns joined
04:37 conal_ joined
04:38 beka joined
04:38 danthemyth joined
04:38 energizer joined
04:39 gestone joined
04:40 Immune joined
04:41 Immune left
04:41 dim1tri joined
04:41 sytherax joined
04:45 martinga_ joined
04:49 carlomagno1 joined
04:53 progfun joined
04:55 twandy joined
04:56 lastmanstanding joined
04:57 dim1tri joined
04:57 <jared-w> rotaerk: yeah, stencil buffer and "stencils" should be the same thing iirc
04:57 <jared-w> Also, never made the connection that there's an actual shader unit for some reason lol
04:58 <jared-w> yeah you'd want to extend the code genreation of accelerate to target the shader units if it doesn't already if you're going to use that for shaders then :)
04:58 <jared-w> But you should be able to incorporate the rest of accelerate for "free" if you merely extend it to generate shader code as well, if I'm understanding everything else right
04:59 <rotaerk> haskell is a rabbit hole of nested rabbit holes...
04:59 robstr joined
05:00 <tdammers> nah... it's just a convenient system for assembling your own domain-specific rabbit holes
05:02 Lowl3v3l joined
05:03 <rotaerk> hehe
05:07 dim1tri joined
05:08 albel727 joined
05:08 altjsus joined
05:09 slomo joined
05:09 slomo joined
05:13 pera joined
05:14 exarkun joined
05:16 jeltsch joined
05:17 blankhart joined
05:18 kvothe joined
05:19 rkrishnan joined
05:19 language_agnosti joined
05:19 xtreak joined
05:20 lastmanstanding joined
05:22 vmandela joined
05:22 dim1tri joined
05:22 vlatkoB joined
05:24 keepLearning512 joined
05:25 fmixing_ joined
05:26 Kundry_Wag joined
05:27 twandy joined
05:28 <kvothe> I'm trying to write a simple client server architecture using sockets. To test it out, I was trying to send a file from the client and receive it on the server side. This works for files of size around 1mb
05:29 dim1tri joined
05:29 <kvothe> If I try increasing the size of the file to send, I am not receiving the full file on the receiver
05:29 <kvothe> https://lpaste.net/359415000906858496
05:29 <kvothe> How can I do better?
05:29 rofl_ joined
05:32 andreabe_ joined
05:32 davr0s joined
05:33 fmixing joined
05:37 <tdammers> Data.ByteString.Lazy.readFile is, as the name suggests, lazy
05:38 <tdammers> unfortunately that means the IO it does is also lazy - by the time it "returns", only the first buffer has been read from the file, and under "normal" circumstances the handle is kept open to read the rest of the file as the bytestring is evaluated
05:39 <tdammers> but "normal" circumstances are easily broken; the typical situation is passing the file contents into a context in which the file handle doesn't exist or is closed
05:39 <tdammers> like another thread
05:39 <glguy> No, passing a Handle to another thread doesn't create an issue with lazy readFile
05:39 kefin_ joined
05:39 <tdammers> hmm
05:39 <tdammers> I've run into that though
05:39 <glguy> That would have been something else then
05:39 <tdammers> although the thread itself may not have been the problem
05:41 slaznick joined
05:42 <kvothe> should it work fine if I do all the operations in strict bytestrings?
05:42 <glguy> It would work just the same
05:43 justaguest joined
05:43 <tdammers> oh, or maybe the explanation is much simpler
05:43 <pavonia> What would be a proper solution to keep the handle open?
05:43 ccomb joined
05:44 plutoniix joined
05:44 iAmDecim joined
05:44 krone joined
05:45 <tdammers> pavonia: use strict IO, explicitly read chunks, and explicitly manage the file handle
05:45 <glguy> kvothe: it looks like you're assuming that recv returns as many bytes as you asked for
05:45 plutoniix joined
05:45 <glguy> The Handle will stay open just fine, using manual open and reads is not necessary
05:46 <glguy> kvothe: But that's not the behavior of recv, the number you provide is the maximum number of bytes you'll get back
05:46 <kvothe> glguy: Yes I am. I am preappending the length of the msg with every msg I'm sending
05:47 <glguy> kvothe: OK, so you'll need to check the result of recv and then call it repeatedly until you get all the bytes you wanted
05:49 <tdammers> or maybe it's even simpler than that
05:49 <tdammers> https://lpaste.net/8096286658908913664
05:49 <tdammers> this is a simplified version of the structure of your program
05:49 <* hackage> sensu-run - A tool to send command execution results to Sensu http://hackage.haskell.org/package/sensu-run- (MitsutoshiAoe)
05:49 <glguy> I'd also recommend explicitly closing the socket so that it ensures that the data finishes transmitting
05:49 dim1tri joined
05:50 <dminuoso> Is there some general form to lift some `(R -> IO a) -> IO a` into a monad transformer stack?
05:50 jchia joined
05:50 <glguy> Yes, you should *also* ensure that main doesn't exist before you're done. The program will terminate when main finishes
05:50 xtreak joined
05:50 <kvothe> glguy: Is there a better way? The first 2 bytes of every msg is the length of the the message I sent. I consequently want to read the full length of the msg
05:50 <glguy> kvothe: You need to implement logic to repeatedly call recv until you get all the bytes for that frame
05:51 <glguy> You probably won't notice the different when going through the loopback device
05:52 <* hackage> influxdb - Haskell client library for InfluxDB http://hackage.haskell.org/package/influxdb- (MitsutoshiAoe)
05:52 <glguy> https://hackage.haskell.org/package/network-
05:52 <glguy> "This function may return fewer bytes than specified."
05:52 <jared-w> glguy: would the untilM function be nice for that? (from the monad loops package)
05:53 <glguy> I think that'd make a mess. I'd recommend just writing the recursive function instead of using an IORef with untilM to accumulate all the chunks
05:53 <jared-w> ah right, forgot untilM woul dneed the IORef and all that extra stuff
05:53 <jared-w> Also, it probably would be worth it extracting all the usage of recv into a function that does the logic of "figure out how large the message is, then call recv repeatedly until I get the entire message"
05:54 <jared-w> then your actual logic of the rest of the program would stay the same
05:54 <glguy> I agree; naming a "recvAll" would be a good idea
05:55 mac10688 joined
05:55 <jared-w> honestly, I'm not sure why there isn't a recvN or something in that library. "Given a size of n bytes, keep calling recv until that much data is returned" seems like it'd be generally useful
05:55 tzemanovic joined
05:56 <mac10688> lol damn jared you still going strong
05:56 hamishmack joined
05:56 <mac10688> I haven't been on here for a few months
05:56 <jared-w> oh hey mac10688 what's up; yeah I don't hate haskell yet if that's what you're asking :p
05:58 jchia joined
06:00 jchia joined
06:01 WhatisRT joined
06:02 twandy joined
06:03 jchia_1 joined
06:04 dim1tri joined
06:05 lastmanstanding joined
06:08 gregberns joined
06:10 jchia joined
06:11 dim1tri joined
06:11 kasra joined
06:12 errst joined
06:14 jchia joined
06:17 kapil___ joined
06:17 <* pdxleif> wishes there was a "recursive" option for "ghc-pkg unregister"
06:18 language_agnosti joined
06:19 language_agnosti joined
06:22 zzq joined
06:23 enterprisey joined
06:23 dim1tri joined
06:23 obi_jan_kenobi_ joined
06:24 krone joined
06:24 enterprisey joined
06:24 krone joined
06:25 ninegrid joined
06:26 initiumdoeslinux joined
06:27 dtoma joined
06:30 Linter joined
06:31 Kacia joined
06:31 twandy joined
06:32 earthy joined
06:32 <tdammers> pdxleif: there is: rm ~/.ghc :X
06:36 encod3 joined
06:37 <dminuoso> TIL. This is allowed: a,b,c::Int
06:37 <Myrl-saki> I defined factorial as
06:37 <Myrl-saki> fac 0 = 1; fac n = n * fac (n - 1)
06:37 <Myrl-saki> ... I regressed.
06:37 <tdammers> dminuoso: the GHC codebase itself has quite a few of those, which I find somewhat annoying
06:39 <dminuoso> tdammers: I suppose it threw me off my rhythm because I wasn't used to it heh.
06:39 phenoble joined
06:39 sdrodge joined
06:39 <MarcelineVQ> dminuoso: you can even do it in records
06:40 amar joined
06:40 <MarcelineVQ> er gadts I mean, including records
06:40 <dminuoso> MarcelineVQ: How would that look in GADTs? :o
06:40 <Myrl-saki> I mean, some people write \forall x, y \in S.
06:41 <pdxleif> In Idris you can define function args with (x, y, z : Int) -> ..., instead of Int -> Int -> Int -> ...
06:42 chele joined
06:43 <liste> pdxleif: does that result in a curried or uncurried function?
06:43 johnw_ joined
06:43 <Myrl-saki> pdxleif: That looks like a consequence of dependent types.
06:44 <Myrl-saki> Idk.
06:44 <MarcelineVQ> dminuoso: data T a where T1,T2 :: b -> T b
06:45 <MarcelineVQ> some examples stashed away in https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#declaring-data-types-with-explicit-constructor-signatures
06:46 <pdxleif> liste: uncurried. It's just short for (x : Int) -> (y : Int) -> (z : Int) -> ...
06:46 <MarcelineVQ> Myrl-saki: it's just a different notation
06:46 <pdxleif> which has no effect unless the names are used somehow to the right; otherwise it's just the same as Int -> Int -> Int -> ...
06:46 <Myrl-saki> MarcelineVQ: It's specifically syntactic sugar, or?
06:47 <pdxleif> That the arguments can have names at the type level is a DT thing, but the thing with commas isn't particularly DT - just syntax sugar.
06:48 <Myrl-saki> pdxleif: Right. If I have another type ... -> Foo x y z, then the 3 arguments can be implied, right?
06:48 acidjnk joined
06:48 <Myrl-saki> Or is there a special notation for implied arguments? Forgot, been a year or two since I touched it. :/
06:49 hphuoc25 joined
06:49 language_agnosti joined
06:50 <pdxleif> There's implicit arguements - unbound lowercase variables in a type sig become implicit "foralls" sort of - and they have to be implicitly resolvable
06:50 language_agnosti joined
06:50 <Myrl-saki> pdxleif: Oh, I think I was thinking of {}
06:50 <Myrl-saki> index : {a:Type} -> {n:Nat} -> Fin n -> Vect n a -> a
06:50 xkapastel joined
06:50 <Myrl-saki> pdxleif:
06:50 <Myrl-saki> According to this. http://docs.idris-lang.org/en/latest/tutorial/miscellany.html
06:51 <dminuoso> Myrl-saki: Does {} turn them into implicit arguments in the same way that forall introduces them into (usually) inferrable argumens?
06:52 <Myrl-saki> dminuoso: I honestly have no idea. Installing Idris was a bit difficult back when I wanted to try it out.
06:54 <pdxleif> Myrl-saki: Yeah, "Fin len -> Vect len elem -> elem" is equivalent to "{elem : Type} -> {len : Nat} -> Fin len -> Vet len elem -> elem" thanks to that "Auto implicit rule" on that page.
06:55 <pdxleif> Just you you can write type sigs that look like Haskell, e.g. "a -> a", and not force you to write e.g. "{a : Type} -> (x : a) -> a"
06:55 exarkun joined
06:55 <pdxleif> err, "{a : Type} -> a -> a"
06:55 <Myrl-saki> Write.
06:55 <Myrl-saki> Right*
06:55 <Myrl-saki> Ugh. And I thought sleeping would help me with my typos.
06:56 <Myrl-saki> Oh cool, Idris has uniqueness types.
06:57 <pdxleif> dminuoso: I think of "{a : Type} ->" similar to "forall a." in Haskell
06:57 <MarcelineVQ> it also has linear types, though they're somewhat limited currently iirc
06:57 <pdxleif> But in Idris it's Pi, not a forall - not limited to types, so a little different wrt parametricity
06:58 <dminuoso> pdxleif: So I guess the equivalent of a Rank2Type would be something like `Thing -> ( { a : Type } -> F a -> G ) -> G` ?
06:58 <pdxleif> MarcelineVQ: This? http://docs.idris-lang.org/en/latest/reference/uniqueness-types.html
06:58 <MarcelineVQ> no
06:59 sQVe joined
06:59 sQVe joined
06:59 <MarcelineVQ> there's an extention you enable called LinearTypes
06:59 <MarcelineVQ> some examples here https://github.com/clayrat/idris-linear I've not seen these before so ymmv
06:59 sQVe joined
07:00 <MarcelineVQ> it's this notation (1 x : elem)
07:01 <MarcelineVQ> which is you constraining that type binding to be used exactly once, iirc
07:01 ammazza joined
07:01 guessWho joined
07:02 <guessWho> how can i extract hash table from this newtype MyHt k v = MyHt (H.CuckooHashTable k v )
07:02 woodson joined
07:02 <pdxleif> dminuoso: Yeah I guess so - it didn't used to support implicits in nested scopes like that: https://stackoverflow.com/questions/22880309/doing-rank-n-quantification-in-idris
07:02 twandy joined
07:03 <liste> guessWho: myFunc (MyHt table) = .. do stuff with table ..
07:03 nighty- joined
07:03 <liste> guessWho: or (\(MyHt table) -> ... do stuff with table ...) myHt
07:03 cgfbee joined
07:04 language_agnosti joined
07:06 epsilonhalbe joined
07:06 sdrodge joined
07:07 dim1tri joined
07:07 borkr joined
07:07 andyhuzhill joined
07:09 ddellacosta joined
07:11 fujiy joined
07:11 zakora joined
07:12 andyhuzhill joined
07:14 nickolay_ joined
07:16 thc202 joined
07:17 <kvothe> what happens if multiple threads are calling sendAll function from http://hackage.haskell.org/package/network-
07:17 <kvothe> Does sendAll block till the entire message has been sent?
07:18 raichoo joined
07:18 zdenal joined
07:20 amar joined
07:20 vilu joined
07:21 osa1 joined
07:21 <pavonia> The Haskell wrapper doesn't seem to add any additional thread safety
07:22 tzemanovic joined
07:23 zdenal joined
07:23 Ariakenom joined
07:23 connrs joined
07:24 dim1tri joined
07:25 hphuoc25 joined
07:25 zdenal joined
07:26 Ariakenom joined
07:27 <[exa]> kvothe: why would it block?
07:29 saurabhnanda joined
07:29 piark_ joined
07:29 amar joined
07:30 sword865 joined
07:32 guessWho joined
07:32 <guessWho> how do i extract hashtable from this newtype MyHt k v = MyHt (H.CuckooHashTable k v )
07:32 <kvothe> <[exa]>: To ensure thread safety
07:34 <[exa]> kvothe: like that no one accesses the socket before writing is finished?
07:34 <[exa]> hmm good point
07:35 Kundry_Wag joined
07:35 raichoo joined
07:35 <kvothe> <[exa]>: correct
07:35 twandy joined
07:36 <kvothe> If I have multiple threads calling sendAll simaltaneously, the message is sent in mangled order
07:36 <kvothe> https://github.com/lpeterse/haskell-socket/issues/51
07:38 <[exa]> OTOH I can't imagine a reasonable piece of code that would share the socket this way
07:38 <[exa]> (I know I'm coming from the dangerous C++ world, but a socket is a byte stream, not a magical transactional delimited-data transport)
07:39 amar joined
07:39 hackebeilchen joined
07:40 zero_byte joined
07:40 Folkol_ joined
07:41 ogrady joined
07:41 fendor joined
07:41 amirpro joined
07:46 amirpro joined
07:46 language_agnosti joined
07:46 yoneda joined
07:47 languag__ joined
07:47 FabM joined
07:47 hphuoc25 joined
07:49 igqg joined
07:50 <cjay-> is there a monadic.party channel? ^^
07:50 zargoertzel joined
07:52 <Ariakenom> [exa]: It's a magically continuous reliable byte stream?
07:54 asheshambasta joined
07:57 <shiona_> cjay- sure. Every /join is a monadic operation
07:58 dim1tri joined
07:58 zdenal joined
07:58 <gentauro> Does the usage of "bind" remove the "streamable" part of a list? Example -> https://gitlab.com/gentauro/gists/snippets/1723434
07:59 <bwe> Hi, I want to understand type parameters. Would someone mind to show me how I would consider `data TrafficLight a` in the instance definition?
07:59 <bwe> https://bpaste.net/show/59f030455bc9
08:00 <pavonia> bwe: What would that parameter denote?
08:01 <dminuoso> bwe: You can write an instance declaration: `instance YesNo (TrafficLight a) ...`
08:01 <dminuoso> which means it's valid for every choice of some type `a`
08:01 dddddd joined
08:02 curious_corn joined
08:02 fmixing joined
08:02 <dminuoso> Alternatively you can constrain it further if you need some other information about the type parameter: instance Eq a => YesNo (TrafficLight a)
08:04 dim1tri_ joined
08:04 <gentauro> dim1tri: TrafficLight doesn't have a type param "a" ...
08:04 <gentauro> ups
08:04 <gentauro> dminuoso: the msg was for you :)
08:05 keepLearning512 joined
08:06 zincy_ joined
08:07 Boomerang joined
08:07 beauby joined
08:08 ZeuPiark joined
08:08 danza joined
08:09 <gentauro> btw, update the link for my example -> https://gitlab.com/gentauro/snippets/snippets/1723434
08:09 Mattias left
08:10 twandy joined
08:10 <zincy_> How would I manually define an instance of Arbitrary for my Game type such that randomly generated games can be made with some constraints for quickcheck tests. Hitting some beginner compiler issues https://lpaste.net/3153234232738840576
08:11 amar joined
08:11 kuribas joined
08:11 amar joined
08:11 amirpro joined
08:11 freeman42x]NixOS joined
08:11 xtreak joined
08:12 <kuribas> how portable is reflex? I read that it doesn't work on older android devices?
08:12 <kuribas> Also, doesn't the arm-only output restrict it even more?
08:12 curious_corn joined
08:13 davr0s joined
08:14 julius joined
08:14 <pavonia> zincy_: You never use maxPlayers, so it doesn't know what instance the corresponding arbitrary use should resolve to
08:16 lastmanstanding joined
08:16 amirpro joined
08:16 <ZeuPiark> hello
08:16 khilan joined
08:16 <phz_> hi
08:16 <zincy_> ah yes and same for board
08:16 buzo joined
08:16 <zincy_> which is now changed to the correct variable name however _deck <- arbitrary gves me
08:17 <zincy_> • Ambiguous type variable ‘a0’ arising from a use of ‘arbitrary’ prevents the constraint ‘(Arbitrary a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. These potential instances exist: instance (Arbitrary a, Arbitrary b) => Arbitrary (Either a b) -- Defined in ‘Test.QuickCheck.Arbitrary’ instance forall k a (b :: k). Arbitrary
08:18 Yuras joined
08:18 <kuribas> ZeuPiark: bonjour
08:18 mfukar joined
08:18 <pavonia> zincy_: Are you sure this line produces the error?
08:18 kefin_ joined
08:19 <zincy_> the line I updated to _deck <- arbitrary produces that err
08:19 <phz_> edwardk: it was nice meeting you at Zurihac, a bit a pity not having taken that coffee because of my flight… I hope we can catch up later :)
08:19 <kuribas> is reflex suitable for a commercial app?
08:19 <kuribas> is it more than a toy?
08:19 <zincy_> oh
08:19 <pavonia> zincy_: Could you repaste your current version with full error message?
08:20 <zincy_> it works now thanks
08:20 language_agnosti joined
08:20 curious_corn_ joined
08:20 sdrodge joined
08:21 <zincy_> one more question tho
08:21 ozzymcduff joined
08:21 fishythefish joined
08:21 language_agnosti joined
08:22 Solonarv joined
08:23 xtreak joined
08:23 <edwardk> phz_: hopefully next time you’ll have more time :)
08:23 <phz_> yeah, I hope so
08:24 latk joined
08:24 <phz_> I’d be very pleased to have a talk with you about runtime performance in graphics applications in Haskell
08:24 Foritus joined
08:24 <phz_> whe I was still writing luminance in Haskell, the performance were great and the GC not used that much, but still, I decided to migrate it to Rust because of the overhead
08:24 <phz_> I still struggle with that kind of concepts :)
08:25 merijn joined
08:25 <zincy_> edwardk: Do you do paid one to one tutoring sessions?
08:25 hphuoc25 joined
08:26 <edwardk> zincy_: my consulting rate would be a bit prohibitive :) I’m generally happy to answer questions and point to resources though
08:27 <zincy_> Go on you can tell me :P
08:27 <zincy_> my email is tomw08@gmail.com
08:28 <bwe> dminuoso: Then, how would I access in Car's instance definition its records? https://bpaste.net/show/6ef29432e4a9
08:28 <edwardk> I am doing one on er.. 150 twitch streaming lately though. I’ve been trying to so so on Sundays but my travel schedule hasnt been conducive the 3-4 weeks
08:28 danza joined
08:28 <zincy_> edwardk: oh cool
08:28 xtreak joined
08:29 <edwardk> currently those are mostly focused on writing libraries and giving folks insight into how i work
08:30 <ventonegro> phz_: What's luminance?
08:30 <zincy_> edwardk: I see there are Q and As they look like fun
08:31 <phz_> ventonegro: a type-safe and type-level graphics API over OpenGL
08:31 progfun joined
08:31 <phz_> I migrated it to Rust
08:31 <phz_> so the current Haskell implementation is a bit messy
08:31 <phz_> but I’m still struggling with “should I just get back to Haskell?”
08:31 <ventonegro> phz_: Ah, interesting! Could you give me a link or is it private?
08:31 <phz_> Rust has the advantage of not having a GC, so performance and memory consumption is easy to predict
08:32 <phz_> ventonegro: https://github.com/phaazon/luminance
08:32 <phz_> ventonegro: https://github.com/phaazon/luminance-rs
08:32 <ventonegro> phz_: Thanks!
08:33 <phz_> the dilemna problem I’m facing is that Haskell comes in with a little bit of overhead, and there are some things that I really don’t like to express in Rust
08:33 <phz_> dammit! :P
08:33 <ventonegro> phz_: Did you consider the EDSL route?
08:33 <phz_> yep
08:33 <phz_> I have a few EDSL around
08:34 nickolay_ joined
08:34 <phz_> I even have a DSL in Rust
08:34 curious_corn joined
08:34 <phz_> called Cheddar, that is a functional programming version of GLSL
08:34 <edwardk> zincy_: the q&a session was because so many people asked for one during the first session
08:34 <phz_> (though it’s not ready to be released in public :D)
08:34 <phz_> edwardk: you seemed overwhelmed at the openspace :D
08:34 <phz_> so many people around you
08:34 exarkun joined
08:35 fishythefish joined
08:35 simba_ joined
08:35 <edwardk> the hallway track is what i come to these events for
08:35 <ventonegro> phz_: Sadly OpenGL seems to be on its way out, though
08:35 <phz_> ventonegro: are you talking about the macOSX bullshit thing?
08:35 <simba_> what's wrong with this simple type declaration ? https://lpaste.net/5708692988780085248
08:35 <ventonegro> phz_: yep
08:35 <phz_> ventonegro: they’re going to lose money on this
08:36 <edwardk> it was a lot of fun fielding questions over such a wide array of topics though
08:36 <phz_> simba_: s/newtype/data
08:36 <phz_> oh wait no
08:36 <phz_> hm
08:37 <ventonegro> phz_: So a DSL could generate either Metal or Vulkan and bypass this bullshit
08:37 <zincy_> What problem do Arrows solve?
08:37 keepLearning512 joined
08:37 <ventonegro> simba_: What's the error?
08:37 hphuoc25 joined
08:37 <merijn> zincy_: Arguably not that many :p
08:38 <edwardk> it is fairly typical post jobs apple. it is the sort of thing that sounds like a “bold” move that just alienates more developers
08:38 <zincy_> oh nevermind :)
08:38 <merijn> zincy_: Arrows never took off as much as people seem to expect it
08:38 Foritus joined
08:38 <edwardk> zincy_: they mostly exist because people didnt know about applicatives :)
08:38 <merijn> phz_, edwardk: otoh, stuff like Rosetta was deprecated nearly a decade before dying
08:38 <zincy_> That brings me onto my next question
08:39 <zincy_> It has kind of escaped me how to succinctly describe in plain english why applicatives are useful, anyone care to help?
08:39 <merijn> So, the fact that they deprecate OpenGL doesn't really mean it's gone anytime soon
08:39 <merijn> As for not updating OpenGL, they weren't really doing that anyway
08:39 tijko joined
08:39 <phz_> well
08:39 <phz_> they’ve been doing it for a while
08:39 <edwardk> i think it is more laughable to think that what they’d been doing constituted “support” for opengl for the last few years ;)
08:39 <phz_> lagging behind for years
08:39 chat joined
08:40 <phz_> moving to vulkan is going to make people bleed
08:40 <phz_> vulkan + molten vk for macOSX
08:40 <edwardk> moving to vulkan finally gives me a crossplatform way to do compute shading
08:40 bo joined
08:41 <phz_> yeah, it’s a good thing
08:41 <phz_> though it’s not trivial
08:41 <simba_> ventonegro : when i do this let a = Dummy 10 20; i get this https://lpaste.net/781405338854227968
08:41 <edwardk> sadly. moltenvk setup is a bit involved
08:41 hphuoc25 joined
08:41 <ventonegro> simba_: let a = Dummy (10, 20)
08:42 <phz_> zincy_: applicative functors give you function application inside functors
08:42 <fishythefish> zincy_: there are probably a number of ways to approach this, but my initial intuition is that applicatives are useful because fmap isn't sufficient to lift functions with more than one argument
08:42 <phz_> so that you can compose them more naturally
08:42 <ventonegro> simba_: The thing next to "newtype" is the type constructor, the thing on the right side of the (=) is the data constructor
08:43 <fishythefish> simba_: if you ignore the record syntax, you have `newtype Dummy n p = Dummy (n, p)`
08:43 <zincy_> good answers
08:43 twandy joined
08:43 WhatisRT joined
08:44 <phz_> lambdabot: newtype Dummy n p = Dummy { getDummy :: (n, p) }
08:44 <fishythefish> @let newtype Dummy n p = Dummy { getDummy :: (n, p) }
08:44 <lambdabot> Defined.
08:44 <phz_> lambdabot: Dummy (1, "hello")
08:44 <phz_> fishythefish: thanks :D
08:44 <simba_> fishythefish : i wan't to avoid record syntax but then in this case how do i extract value newtype Dummy n p = Dummy (n, p)
08:44 <fishythefish> > let a = Dummy (10, 20) in a
08:44 <lambdabot> error:
08:44 <lambdabot> • No instance for (Show (Dummy Integer Integer))
08:44 <lambdabot> arising from a use of ‘show_M738454854852482755917908’
08:44 <fishythefish> @undefine
08:44 <lambdabot> Undefined.
08:44 <fishythefish> @let newtype Dummy n p = Dummy { getDummy :: (n, p) } deriving (Show)
08:44 <lambdabot> Defined.
08:44 <fishythefish> > let a = Dummy (10, 20) in a
08:44 <lambdabot> Dummy {getDummy = (10,20)}
08:45 <phz_> do you really need the let binding here?
08:45 <phz_> > Dummy (3, 2)
08:45 <Ariakenom> kuribas: Have you tried #reflex-frp ?
08:45 <lambdabot> Dummy {getDummy = (3,2)}
08:45 <fishythefish> simba_: you can manually define `getDummy (Dummy d) = d`
08:45 <fishythefish> phz_: no, but I was trying to preserve the spirit of the original let binding
08:46 <phz_> :)
08:46 jfredett joined
08:47 <kuribas> Ariakenom: ok, thanks
08:47 <zincy_> :t join
08:47 <lambdabot> Monad m => m (m a) -> m a
08:49 xtreak joined
08:49 curious_corn_ joined
08:52 <zincy_> How does the continuation monad work?
08:52 reactormonk joined
08:55 oish joined
08:55 <fishythefish> newtype Cont r a = Cont { runCont :: (a -> r) -> r }
08:55 <fishythefish> IMO the best place to start is with `return` - what should its implementation be?
08:56 <edwardk> I believe it was forged from the souls of thousands of innocent lisp users. Alas, its secrets are forever lost to antiquity.
08:57 <fishythefish> surely you're not an antique just yet, edwardk
08:58 <pavonia> zincy_: https://en.wikibooks.org/wiki/Haskell/Continuation_passing_style
08:58 Folkol_ joined
08:58 <* edwardk> disappears into Zurich in search of pants.
08:58 fendor joined
08:59 yuuki_ joined
09:00 Linter joined
09:00 <dminuoso> gentauro: The question was asked how an instance would need to be written if the data type was `data TrafficLight a`
09:01 <bwe> dminuoso: Then, how would I access in Car's instance definition its records? https://bpaste.net/show/6ef29432e4a9
09:02 <dminuoso> fishythefish: I was kind of stunned to see that Cont was just isomorphic to (Yoneda Identity) :)
09:02 <pavonia> bwe: It's not different from the usual record usage
09:03 dhil joined
09:04 jao joined
09:04 <merijn> bwe: That typeclass looks like it combines two classic bad design choices into one :)
09:04 <fishythefish> dminuoso: heh, Yoneda is everywhere
09:05 <dminuoso> fishythefish: Yeah. I could even see resemblences of it in LogicT
09:05 <merijn> bwe: CarType looks like it's trying to do OO style-classing for which typeclasses are a bad fit, and it's only function right now is a poster child for boolean blindness
09:05 <fishythefish> dminuoso: basically, anytime I see a "concrete value" being represented as a function, I expect there to be a yoneda (or at least a right kan extension?) lurking somewhere
09:05 <edwardk> dminuoso: its close. there is an extra quantifier
09:06 thevishy joined
09:06 <edwardk> that quantifier matters as with the yoneda bit you cant callCC
09:07 <edwardk> fishythefish: every such beast in lens has been an application of yoneda in the functor category, on prof, etc. almost always spotted after the fact, so i think that is a pretty safe bet.
09:07 <bwe> merijn: You are right. I lack a good example to understand it. That's the real thing here. By which example would you explain to me the use of type parameters in instance definitions to me?
09:08 initiumdoeslinux joined
09:08 language_agnosti joined
09:08 <* hackage> nix-diff 1.0.3 - Explain why two Nix derivations differ http://hackage.haskell.org/package/nix-diff-1.0.3 (GabrielGonzalez)
09:09 ozzymcduff joined
09:09 <merijn> bwe: Usage of typeclasses tends to go as follows: "I don't know typeclasses" -> "Typeclass all the things!" -> "Rarely implement your own typeclass"
09:10 <fishythefish> edwardk: yeah, I should probably try to rigorously convince myself of that sometime, but my initial motivation was that CPS, Church encodings, and Yoneda all smelled the same
09:10 <fishythefish> Codensity, too, I guess
09:10 <merijn> bwe: Typeclasses make the most sense when they contan some completely abstract operations with laws (consider Monoid, Functor, Applicative, Monad, etc.) because then it becomes possible to write general code
09:10 isovector joined
09:11 <bwe> merijn: What did I try? I tried to abstract the instance definition with type parameter from https://bpaste.net/show/307fbb91671c. Yay! No typeclass.
09:11 <merijn> bwe: For basically every other scenario you're better off with either 1) just an algebraic datatype or 2) what I call "OO Haskell"
09:11 _bo joined
09:12 <merijn> bwe: That code is saying that "Train a" for *any* can return a location of "EncodedLocation 100 200", which is obviously nonsense
09:12 <merijn> Because that's an EncodedLocation, not, say, Int
09:12 <merijn> bwe: So you have to options to make it sensible
09:13 <dminuoso> edwardk: Mmm, what is the relationship between Cont and Yoneda?
09:13 <merijn> bwe: 1) "instance FromJSON (Train EncodedLocation) where" (i.e. only allow decoding Trains with an EncodedLocation location)
09:14 <merijn> bwe: 2) "instance FromJSON a => FromJSON (Train a) where" (i.e. allow decoding trains whose location is some decodable type)
09:14 philippD joined
09:14 python476 joined
09:14 <fishythefish> dminuoso: you said it yourself - CPS is what you get from applying yoneda to the identity functor
09:14 twandy joined
09:15 <edwardk> diminuoso: Yoneda f = Ran Identity f; but you seem to be talking about Yoneda Identity. Cont r = Codensity (Const r) = Ran (Const r) (Const r)
09:16 <bwe> merijn: Sounds reasonable to me. Here is what my ghci complains for both paths: https://bpaste.net/show/797f290abe26
09:16 <edwardk> Yoneda Identity and Cont r are both (a -> r) -> r, but Yoneda sticks a forall r in front as evidenced by it not showing up in the type
09:16 <edwardk> this is just enough to rule out callCC
09:16 eliasr joined
09:18 gestone joined
09:18 <[exa]> what's the best way to read a line from a socket (e.g. for implementing something similar to SMTP)
09:18 <[exa]> (using the System.Socket library)
09:20 jfredett_ joined
09:20 cloudhead joined
09:20 <merijn> bwe: Ah, for the first just enable "{-# LANGUAGE FlexibleInstances #-}"
09:21 <merijn> bwe: The report is overly conservative when it comes to instance definitions
09:21 <merijn> bwe: The 2nd is obviously wrong since it's still using EncodedLocation as return, rather then decoding the returned location from the JSON
09:21 <merijn> [exa]: You can turn a Socket into a Handle
09:22 <merijn> [exa]: Then you can just use hGetLine
09:22 arianvp2 joined
09:22 <arianvp2> yo, is there a way to let GHC show you the discovered constraints when you have a typed hole inside a GADT pattern match?
09:24 <bwe> merijn: 1.) the first compiles: https://bpaste.net/show/be794d00f831
09:25 hphuoc25 joined
09:25 <Ariakenom> :t Network.Socket.socketToHandle
09:26 <lambdabot> network- -> GHC.IO.IOMode.IOMode -> IO GHC.IO.Handle.Types.Handle
09:26 <bwe> merijn: 2.) I would need to parametrize the location assignment. Instead of EncodedLocation I would use a. But I feel `a 100 200` would be wrong here. What's the right way here?
09:26 python476 left
09:27 <butterthebuddha> https://hackage.haskell.org/package/ListZipper
09:27 <butterthebuddha> What should I be importing to use the package above after installing it?
09:27 <butterthebuddha> import Data.List.Zipper isn't doing the tric
09:27 <butterthebuddha> trick*
09:28 <[exa]> merijn: oh nice, thanks
09:30 sdothum joined
09:30 <fishythefish> butterthebuddha: how have you installed it and how are you loading that package?
09:30 <butterthebuddha> Added "- ListZipper-" to my extra-deps in package.yaml and then ran stack build
09:30 pagnol joined
09:32 latk joined
09:33 <fishythefish> butterthebuddha: what error do you get?
09:34 ziyourenxiang joined
09:35 <butterthebuddha> "Could not find module ‘Data.List.Zipper’"
09:35 sdothum joined
09:36 <butterthebuddha> fishythefish: it does seem like ListZipper was not installed correctly, but i"m not sure what I'm doing wrong
09:36 <butterthebuddha> I could probably run stack instal ..., but that would install it globally right?
09:36 <fishythefish> butterthebuddha: do you have it *only* under extra-deps? You still need to list it as a dependency
09:36 osa1_ joined
09:37 asheshambasta joined
09:38 sdothum joined
09:38 <dminuoso> arianvp2: What constraints do you refer to?
09:38 a3Dman joined
09:38 beauby joined
09:39 <fishythefish> butterthebuddha: you can `stack build` it
09:40 LKoen joined
09:44 zakora joined
09:44 kmelva joined
09:44 juri2mol joined
09:45 emilypi joined
09:45 danza joined
09:46 <[exa]> merijn: oh that only seems to work for the second socket library (Network.Socket). Guess I should switch to that one
09:46 RegEchse joined
09:46 ub joined
09:47 julius joined
09:47 twandy joined
09:50 piark_ joined
09:50 humanoyd joined
09:52 WhatisRT joined
09:53 earendel joined
09:54 Folkol_ joined
09:54 a3Dman joined
09:54 carafe joined
09:55 hphuoc25 joined
09:57 xtreak joined
09:58 sdothum joined
09:59 <* hackage> tintin 1.9.0 - A softer alternative to Haddock http://hackage.haskell.org/package/tintin-1.9.0 (NickSeagull)
10:00 twandy joined
10:00 curious_corn joined
10:01 thevishy joined
10:01 Folkol_ joined
10:03 machinedgod joined
10:04 Kundry_Wag joined
10:07 Yuras joined
10:09 hellozee joined
10:10 julius joined
10:11 progfun joined
10:12 zzq joined
10:14 Folkol_ joined
10:14 exarkun joined
10:15 ssarah joined
10:15 jesyspa joined
10:15 ssarah joined
10:16 yeevy joined
10:16 Solonarv joined
10:16 lumm joined
10:18 rad_ joined
10:19 twandy1 joined
10:20 carafe joined
10:22 earendel2 joined
10:22 language_agnosti joined
10:24 mreh joined
10:26 <mreh> Is it possible to transform a value :: Rand StdGen [Integer] into :: RandT StdGen [] Integer?
10:26 <mreh> I'm trying to do some recursive backtracking with random choices
10:27 <dminuoso> mreh: Mmm, I wonder whether you can rig RandT with LogicT
10:27 hphuoc25 joined
10:28 <mreh> dminuoso: Maybe
10:32 <mreh> dminuoso: do you know how it works conceptually?
10:32 <dmwit> mreh: Sure, should be possible with enough mucking with liftRandT/runRandT.
10:33 <dmwit> \base -> liftRandT (\g -> runIdentity (runRandT base g)) -- perhaps
10:34 <dminuoso> mreh: LogicT is a church encoded ListT of sorts.
10:34 connrs joined
10:35 gestone joined
10:35 <dmwit> Now checked with an actual type-checker instead of my brain: `\m -> liftRandT (\g -> let (vs, g') = runIdentity (runRandT m g) in map (flip (,) g') vs)`
10:35 <philippD> dminuoso: I have never used Logic or LogicT but have seen it pop up now and then. How useful is it?
10:35 <dmwit> mreh: ^
10:36 simukis joined
10:39 <mreh> :t \m -> liftRandT (\g -> let (vs, g') = runIdentity (runRandT m g) in map (flip (,) g') vs)
10:39 <lambdabot> error:
10:39 <lambdabot> Variable not in scope: liftRandT :: (t0 -> [(a0, b0)]) -> t1
10:39 <lambdabot> error:
10:39 epsilonhalbe joined
10:40 <mreh> dmwit: it works :)
10:42 slackman joined
10:43 ethan0x24 joined
10:44 <dmwit> mreh: Well, it type-checks. Whether it does what you want is another question. =)
10:44 <dmwit> mreh: You might want to `split` once for each cons cell in `vs` so that you have different generators for the continuations.
10:45 <mreh> dmwit: I was just thinking that, it has the same g' for each
10:45 tzemanovic joined
10:45 <mreh> dmwit: I wish I had more transformer exerperience
10:45 <mreh> pretty impressive
10:46 silver joined
10:46 <dmwit> :t split
10:46 <lambdabot> Splitter a -> [a] -> [[a]]
10:47 <dmwit> oh =P
10:47 thevishy joined
10:47 <dmwit> Anyway it's not hard to code up.
10:47 <mreh> dmwit: this is it shuffling numbers [[1,2],[1,3],[1,1],[3,2],[3,3],[3,1],[2,2],[2,3],[2,1]]
10:47 HarveyPwca joined
10:48 <mreh> it picks a number from [1..3] then another from [1..3] and pairs them up
10:48 <mreh> you can see the second choices are all the same
10:48 <mreh> so yes, I'll split g'
10:50 zzq joined
10:51 curious_corn joined
10:51 <mreh> any recommendations for a better education on transformers?
10:51 <dmwit> I liked "All About Monads".
10:52 <dmwit> ?where aam
10:52 <lambdabot> http://www.haskell.org/haskellwiki/All_About_Monads
10:52 <mreh> dmwit: thanks
10:52 Folkol_ joined
10:53 twandy joined
10:55 muddywatt joined
10:57 ian_andrich joined
10:58 <simon> mreh, doesn't shuffling usually imply that the same element can't be picked twice?
11:00 <mreh> simon: yeah
11:01 <mreh> simon: I'm generating complete sudokus so eventually I'll have to have a StateT transformer in there to remember what I've used already
11:01 <mreh> dmwit: zipWith (,) vs . unfoldr (Just . split) $ g'
11:01 <mreh> wasn't hard :)
11:03 <mreh> there are probably better ways of generating them, like transforming an existing one
11:04 <mreh> but I understand the brute force method better
11:04 <mreh> s/better//
11:05 <tdammers> it's not immediately obvious whether a given set of transformation rules could generate all possible sudoku
11:05 <tdammers> a properly randomized brute force algorithm trivially can
11:06 WhatisRT joined
11:06 <mreh> tdammers: yes, doesn't need to be randomized either, but I wan't to generate seemingly unique sudoku quickly :)
11:07 <simon> mreh, have you looked at sudoku generator algorithms?
11:07 Gurkenglas joined
11:08 <mreh> simon: just browser the wikipedia page, there's not much there for generating complete sudoku
11:08 <mreh> well, you could see the problem as a sudoku with zero clues
11:09 <mreh> dancing links is recommended
11:12 encod3 joined
11:12 <simon> mreh, that rings a bell.
11:15 emilypi joined
11:15 ethan0x24 joined
11:15 ericsagn1 joined
11:16 <* hackage> HNumeric - Haskell Numeric Library with pure functionality, R & MATLAB Syntax. http://hackage.haskell.org/package/HNumeric- (edeftg)
11:18 CurryWurst joined
11:19 siraben joined
11:19 <tdammers> mreh: but depending on the solver algorithm, this would always produce the same "solution"
11:19 lortabac joined
11:19 <tdammers> then again, if the solver uses nondeterminism, you'll just get the set of all possible sudoku as the solution
11:22 wonko7 joined
11:22 <simon> mreh, https://hackage.haskell.org/package/exact-cover-
11:24 lostman joined
11:25 <lostman> hi folks. anyone here with experience with bindings-dsl? I'm trying to figure out how to use the standalone_deriving feature
11:26 vurtz joined
11:26 <simon> mreh, it looks like https://hackage.haskell.org/package/set-cover is downloaded more, but not by a huge margin.
11:26 Kundry_Wag joined
11:27 tzemanovic joined
11:28 twandy joined
11:28 tzemanovic joined
11:28 HarveyPwca joined
11:29 __monty__ joined
11:30 <simon> mreh, strategies for generating sudoku puzzles from scratch seem to involve, at some point, the addition or removal of a cell value and subsequent check if there's still any/exactly one solution, in which case you'd need a fast solver, which you wouldn't have to write from scratch.
11:30 Linter joined
11:32 <siraben> simon: So backtracking?
11:32 <siraben> If you want to get fancy, encode the sudoku as a boolean satisfiability problem and write a SAT solver
11:36 <merijn> simon: You could also check the constraints on each cell and ensure that every time you remove a cell at least 1 cell with only 1 possible option remains
11:36 <merijn> simon: That might not be able to generate ALL possible sudoku's, but will at least only generate valid ones
11:36 encod3 joined
11:37 rcdilorenzo joined
11:39 beauby joined
11:40 bbear joined
11:41 <simon> siraben, the library I most recently linked to advertises that you can encode various set-cover problems and use their solver.
11:43 <simon> merijn, yeah, that seems pretty neat. I suppose that if you start by creating a fully-fitted sudoku board and then remove cell values, you can shift the responsibility of reaching more puzzles on the way the board is initially filled. I don't know.
11:45 jhrcek joined
11:48 epsilonhalbe joined
11:50 nruebwbae joined
11:53 <nruebwbae> Hi! I'm trying to implement a compiler for the System F language. First of all, I've searched like mad, if there are any tutorials on System F which you know, please let me know! But for my true question: In the Simon Peyton Jones talk Into the Core (https://youtu.be/uR_VzYxvbxg) he shows the Core type declaration for Expression in the Core language. I'm wondering, where in the Git repo one can find this? In which fil
11:53 <nruebwbae> this defnition available? Thanks for reading my question!
11:54 zzq joined
11:54 <nruebwbae> This slide is the one I'm thinking about https://youtu.be/uR_VzYxvbxg
11:54 <nruebwbae> sorry: https://youtu.be/uR_VzYxvbxg?t=17m49s
11:55 exarkun joined
11:55 <lyxia> nruebwbae: https://github.com/ghc/ghc/blob/master/compiler/coreSyn/CoreSyn.hs#L270
11:55 dsh joined
11:55 rcdilorenzo_ joined
11:55 <nruebwbae> lyxia: beautiful. Thank you very much
11:55 <lyxia> you might also find this interesting https://github.com/ghc/ghc/blob/master/docs/core-spec/core-spec.pdf
11:57 <butterthebuddha> Is 0 a function from Int -> Int?
11:57 <butterthebuddha> Because ghc is inferring [0]'s type to be [Int -> Int]
11:57 <philippD> :t 0
11:57 asheshambasta joined
11:57 <lambdabot> Num p => p
11:58 brent80_plow joined
11:58 <butterthebuddha> Nvm, there was another type error
11:58 <dmwit> butterthebuddha: It can be, if you work hard.
11:58 twandy joined
11:59 alexteves_ joined
11:59 slaznick joined
11:59 <philippD> butterthebuddha, dmwit: only if you provide a Num instance for `Int -> Int` ... Don't do that
12:00 zzq joined
12:00 davr0s joined
12:00 <dmwit> ?let instance Num b => Num (a -> b) where (+) = liftA2 (+); (-) = liftA2 (-); (*) = liftA2 (*); negate = fmap negate; abs = fmap abs; signum = fmap signum; fromInteger = pure . fromInteger -- TRY TO STOP ME
12:00 <lambdabot> Defined.
12:01 justaguest joined
12:01 <dmwit> > (0 :: Int -> Int) 3
12:01 <lambdabot> 0
12:01 zargoertzel joined
12:01 <merijn> dmwit: In case no one answered you friday after I left: The flag filtering stuff is about making new-build less paranoid about whether it should rebuild the entire freaking world just because you decided to add "--ghc-option=-j2" :)
12:01 <dmwit> merijn: Thanks, that sounds nice!
12:02 <merijn> dmwit: That stuff's already in HEAD atm, now I'm just fixing the local/in-place packages
12:02 <dmwit> I look forward to it landing -- and I hope that the current niggling details about how it's done get resolved to everybody's satisfaction. =)
12:02 <merijn> dmwit: For non-local dependencies it's already landed :)
12:02 nschoe joined
12:03 <Ariakenom> > (const 1 + (+1)) 2
12:03 <lambdabot> 4
12:03 <dmwit> Yeesh, you cabal developers think `master` is the only version of cabal to exist. =D
12:03 <Ariakenom> great
12:03 <merijn> dmwit: Yes!
12:03 <dmwit> > (sin + cos) 2
12:03 <lambdabot> 0.4931505902785393
12:03 <dmwit> > (sin^2 + cos^2) 2
12:03 <lambdabot> 1.0
12:04 <tdammers> oy vey
12:04 <hpc> > (sin^2 + cos^2) <$> [0..]
12:04 <lambdabot> [1.0,1.0,1.0,0.9999999999999999,1.0,0.9999999999999999,0.9999999999999999,0....
12:04 <dmwit> tdammers: I've got my Tylenol handy, come visit my desk.
12:05 <tdammers> dmwit: it's fine, I've slept maybe 10 hours since thursday, at this point I'm not even 100% sure anymore whether I'm on IRC or typing into a pink unicorn that jumped out of my left ear
12:06 TCZ joined
12:06 <merijn> ugh...
12:06 <hpc> that's perfectly normal, it's probably in lens
12:08 <dmwit> tdammers: Yikes. I hope whatever's keeping you up gets resolved soon one way or another and you can return to taking care of yourself.
12:08 jle` joined
12:09 <cocreature> zurihac has sadly been resolved :(
12:09 <Ariakenom> :k Word8
12:09 <lambdabot> *
12:10 <dmwit> cocreature: Did you do any fun hacks during?
12:10 <Ariakenom> > let eqfn f g = all (\x-> f x ==g x) [minBound..maxBound] in eqfn (sin^2 + cos^2) (1::Word8->Word8)
12:10 <lambdabot> error:
12:10 <lambdabot> • No instance for (Floating Word8) arising from a use of ‘sin’
12:10 <lambdabot> • In the first argument of ‘(^)’, namely ‘sin’
12:10 <cocreature> dmwit: yeah did some work on llvm-hs
12:10 <* dmwit> . o O ( Word :: Nat -> * )
12:10 emilypi joined
12:10 <dmwit> cocreature: Cool, what new feature does it have?
12:10 Folkol_ joined
12:10 <hpc> > minBound :: FLoat
12:10 <lambdabot> error:
12:10 <lambdabot> Not in scope: type constructor or class ‘FLoat’
12:10 <lambdabot> Perhaps you meant ‘Float’ (imported from Prelude)
12:10 <cocreature> it’s now harder to accidentally execute null pointers \o/ :)
12:10 Kundry_Wag joined
12:10 <hpc> > minBound :: Float
12:10 <lambdabot> error:
12:10 <lambdabot> • No instance for (Bounded Float) arising from a use of ‘minBound’
12:10 <lambdabot> • In the expression: minBound :: Float
12:10 <merijn> Whoo! I broke everything while rebasing >.>
12:11 <* merijn> kicks git
12:11 <Boomerang> ZuriHac was awesome! Thanks everyone who was there for making it so great :D
12:11 <hpc> Ariakenom: i don't think there's a data type that makes that work
12:11 <dmwit> cocreature: Whoa, rad!
12:12 <dmwit> > let eqfn f g = all (\x -> f x == g x) [minBound..maxBound]; fi = fromIntegral in eqfn ((sin.fi)^2 + (cos.fi)^2) (1 :: Word8 -> Double)
12:12 <lambdabot> False
12:12 <dmwit> > let fi=fromIntegral in ((sin.fi)^2 + (cos.fi)^2) (3 :: Word8)
12:12 <lambdabot> 0.9999999999999999
12:12 <hpc> dmwit: try giving eqfn some epsilon bounds
12:13 <dmwit> no =(
12:13 <hpc> haha, fair enough
12:13 <Ariakenom> hpc: no because sin is in Floating. Ratio Word8 should work
12:13 <dmwit> % :!cabal install universe
12:13 <yahb> dmwit: /bin/sh: 1: cabal: not found
12:13 <dmwit> aww =D
12:14 <dmwit> I guess I'd have to restart ghci for it to pick up the new package anyway, and at that point it would be wiped out.
12:14 <cocreature> Boomerang: see you again at munihac hopefully! :)
12:14 <dmwit> Ariakenom: I don't think there's a Floating instance for Ratios.
12:14 <Boomerang> cocreature: Yeah I'll try to come! :D
12:14 <dmwit> I *hope* there's no Floating instance for Ratios.
12:14 beefjoe joined
12:14 <Ariakenom> There isn't
12:14 <tdammers> you can make one like the one for String in Acme.PHP
12:15 <Ariakenom> dmwit: But sin doesn't have to be for Floating. Too narrow really
12:16 perspectival joined
12:16 rotcev joined
12:16 ZeuPiark joined
12:18 progfun joined
12:18 <phz_> is there anyone willing to explain me as quickly as possible what hom-sets are?
12:18 danthemyth joined
12:18 <phz_> I think I get what an adjoint functor is, though I don’t get what a Hom functor is
12:18 vurtz joined
12:19 <phz_> (seems like a mapping between a category and a set, though I don’t get why it’s bicovariant)
12:19 beka_ joined
12:20 <lieven> a hom-set for objects a and b is the set of morphism between a and b
12:20 <phz_> I guess edwardk must have some kind of doc simple somewhere
12:20 <phz_> well, “simple” :P
12:20 <phz_> lieven: why two then?
12:20 <phz_> why do you write it hom(–, –) ?
12:21 <lieven> hom(a,b)
12:21 <lieven> hom(from, to) if you want
12:21 <lieven> so a different set for every pair of objects
12:21 dim1tri joined
12:21 <phz_> oh
12:22 <phz_> so Hom(A, B) is the set of morphisms that go from A to B?
12:22 <lieven> yeah
12:22 <phz_> it’s pretty simple then
12:22 <phz_> thanks!
12:22 rcdilorenzo joined
12:22 dim1tri joined
12:24 curious_corn joined
12:25 hellozee joined
12:26 louispan joined
12:27 language_agnosti joined
12:28 knupfer joined
12:31 drets joined
12:31 sQVe joined
12:31 nesqi joined
12:32 slaznick1 joined
12:32 <drets> Hi, I use : -fwarn-incomplete-patterns -fwarn-incomplete-uni-patterns but it doesn't war when I do [Only xmlPath] <- query conn qstr (Only jobid) inside IO monad. What will happen if query returns empty array?
12:33 <drets> warn*
12:33 acarrico joined
12:34 saurabhnanda joined
12:34 Linter joined
12:34 <dmwit> It will call `fail` with a suitable `String`. For `IO`, this throws an exception.
12:34 <dmwit> (catchable)
12:34 beka_ joined
12:34 <dmwit> I'm a bit surprised it doesn't warn, though.
12:35 language_agnosti joined
12:36 <dmwit> Further discussion here: https://ghc.haskell.org/trac/ghc/ticket/5813
12:37 language_agnosti joined
12:39 <drets> dmwit, thank you.
12:39 jchia_ joined
12:39 <Cale> Yeah, due to the desugaring, it's debatable whether that actually counts as an incomplete pattern match.
12:39 <Cale> -fwarn-incomplete-uni-patterns affects lambdas and pattern bindings
12:40 whaletechno joined
12:40 Psybur joined
12:41 ub joined
12:42 <Boomerang> If it was in the list monad as opposed to IO, a `[x] <- ...` pattern would be a valid way to fail. So the incomplete pattern warning needs to know what monad it's in. Might be doable :)
12:42 <dmwit> I think all are agreed it would be sensible to have a flag for this. Debatable whether it should be implied by -Wall, but I would be very surprised to see a patch to add the flag get rejected.
12:42 dhil joined
12:42 <dmwit> Just... nobody's written the patch.
12:42 <Boomerang> Oh wait nevermind what I said
12:43 <Boomerang> If the checks are done after desugaring it should be good enough :)
12:43 <cocreature> I don’t see it getting rejected outright, but I could certainly see it dying in a see of bikeshedding
12:44 <dminuoso> Is there a particular reason Predicate exists? Is it any more useful than (Op Bool)?
12:44 initiumdoeslinux joined
12:44 xtreak joined
12:45 <cocreature> it takes less time figuring out what a type called Predicate is supposed to do than Op Bool :)
12:45 <dminuoso> Oh well. I guess there's that =)
12:46 carafe joined
12:47 dim1tri_ joined
12:47 <merijn> cocreature: I think I might actually be done with cabal \o/
12:47 language_agnosti joined
12:48 <drets> What the proper way to refactor [Only xmlPath] <- query conn qstr (Only jobid) so I can through the error in case of []?
12:48 language_agnosti joined
12:49 <merijn> drets: "paths <- query ...; case paths of {- handle cases here -}"
12:49 nschoe joined
12:49 <drets> Danke.
12:49 <merijn> Might be better ways depending on the details, but that'd work
12:49 pfurla joined
12:49 <Boomerang> Or "query connqstr (Only jobid) >>= \case [x] -> ...; _ -> error ..."
12:50 <merijn> Boomerang: LambdaCase requires an extension, though
12:50 <Boomerang> It does
12:50 <merijn> Also, using "error" is no better than the partial match already there
12:50 andreabedini joined
12:50 <merijn> Worse, actually
12:50 <merijn> Because adding an explicit error adds all the verbosity of doing it properly, but without improving anything
12:51 <drets> kk, so the proper way is wrap everything in error monad and do throwError MyTypedError?
12:51 <drets> and have a handler at the top of the program.
12:53 <merijn> drets: throwIO + Control.Exception also works
12:53 <AWizzArd> Do existential types in a data declaration only make sense in combination with a class constraint? So that a user can at least do _something_ with a value of type `a`?
12:54 <merijn> drets: The problem with error is that it raises an exception *lazily*, so the exception throw can escape any handlers you install
12:54 <merijn> drets: If you use throwIO the exception is guaranteed to not escape surrounding handlers from Control.Exception
12:54 <drets> Interesting, thanks.
12:54 <merijn> drets: Alternatively depending on the exact "error" you might of course not throw an error at all and just provide a "default" instead
12:55 <merijn> AWizzArd: Mostly, yes. An existential without constraints is fairly useless, with one exception
12:55 <merijn> AWizzArd: You could have a function using the existential type inside your datatype
12:55 <Ariakenom> crashing can be correct though.
12:56 <merijn> AWizzArd: "data Foo = forall a . Foo a (a -> a -> Bool)" might make sense
12:56 <merijn> Actually that one is still kinda useless
12:56 <merijn> "data Foo r = forall a . Foo a (a -> r -> Bool)" would be slightly less so
12:57 <merijn> But then, you might as well use "data Foo r = Foo (r -> Bool)"
12:57 <AWizzArd> merijn: yes, we could give that function access to the `a` value via a closure.
13:00 kapil___ joined
13:00 <zincy_> What are existential types?
13:01 <dminuoso> zincy_: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#existentially-quantified-data-constructors
13:02 mfukar_ joined
13:02 sdothum joined
13:03 <maerwald> I'm confused of the fact that the documentation is understandable and not esoteric :>
13:03 Big_G joined
13:03 <cocreature> AWizzArd: there is one other option where existentials are fine (and in fact that’s pretty much the only case where I actually recommend using them) and that’s GADTs
13:03 <merijn> Time for my montly poll of: Who's using new-build and willing to help test shit? ;)
13:03 <cocreature> since you can recover the type parameter in that case
13:03 <veverak> can I reasonably execute "cabal build" outside of the folder of the project?
13:04 <dminuoso> merijn: I was unwillingly forced to the other day.
13:04 <veverak> like I have folder with a project (.cabal in the root of the folder)
13:04 codesoup joined
13:04 <merijn> cocreature: You can't recover the type parameter from existential with GADTs...
13:04 <veverak> and I would like to create a cabal sandbox, and build project there, outside of the source folder
13:04 <merijn> cocreature: If the type parameter is in the GADT type it's not an existential. And if it isn't in the GADT type you can't recover it (at least not in ways that don't work for regular ADTs)
13:05 <merijn> dminuoso: How so? :)
13:05 <cocreature> merijn: I’m talking about the SomeX existentials that wrap GADTs
13:05 <dminuoso> merijn: Well there was this non-stack project I wanted to fix.. but they didn't use stack, and I didn't like the idea of *not* having a sandbox..
13:06 <merijn> veverak: Not really, but you can specify a different build dir to "cabal build"
13:06 curious_corn joined
13:06 <merijn> dminuoso: I don't understand the concept of "unwillingly" using new-build ;)
13:07 <dminuoso> merijn: How's the tooling with new-build? How do you spacemacs?
13:07 <veverak> merijn: hmmm, I am using "cabal install" now, however that seems hackish
13:08 <merijn> veverak: cabal install is...probably not the way to go :)
13:08 <veverak> merijn: (I create new sandbox, add-source my original project, and install it)
13:08 <veverak> thing is
13:08 <veverak> for some reason
13:08 <merijn> dminuoso: Tooling, sadly is not great yet. My recent cabal patches mostly exist because I'm working on making tooling less shit :p
13:08 <veverak> the install command is much more customizable and has much more options
13:08 <veverak> than the build one
13:08 <veverak> :)
13:09 zakora joined
13:09 <merijn> dminuoso: I have a prototype ghcid based checker for doing error/warning highlighting in vim. Which I'll work on a bit again in the near future
13:09 <merijn> dminuoso: That should be easy enough to adapt to emacs
13:09 <veverak> it's a cmake script more or less
13:09 <merijn> dminuoso: But new-build itself is so nice that I'm using it despite the tooling still sucking :p
13:09 <veverak> truth to be told, I am thinking about simply copying the source project, and executing build on the copy
13:10 <cocreature> haskell tooling sucks regardless of whether you use new-buildu or not
13:10 <merijn> cocreature: It worked great before new-build for me, because I only want simple things
13:10 <merijn> cocreature: i.e. highlighting errors/warnings, querying types of an expression
13:10 <dminuoso> Those are the two only things I care about =)
13:10 drets joined
13:10 <merijn> cocreature: And with a bit of luck I should have all that working in a few weeks
13:11 <cocreature> I’m sure I’ll manage to break it :)
13:11 curious_corn joined
13:11 <merijn> Actually I already have the error/warning highlighting working. I'm just making it faster/nicer. Type querying and jump to definition should work too without too much work
13:11 <merijn> veverak: Which version of cabal-install do you have?
13:11 saurabhnanda joined
13:12 <veverak> I have 2.2
13:12 <veverak> (archlinux)
13:12 nruebwbae joined
13:12 <veverak> to the point: I have bigass project (ROS - ros.org) that has custom package system and build system (cmake overlay), ROS tries to be "multiple language friendly"
13:12 <merijn> veverak: You might wanna try new-build instead of sandboxes :)
13:12 <veverak> I am trying to get haskell into that
13:12 <cocreature> merijn: are you using new-repl for that or do you actually have something that’s useful with multi-package projects?
13:12 <veverak> merijn: hmm, how stable it is?
13:13 <drets> After enabling incomplete-patterns and unit-patterns I used "error" everywhere as a quick fix. Next, I'd like to refactor the whole app to run inside ExceptT. Sounds reasonable? Or I made the situation really worse by using “
13:13 <merijn> cocreature: new-repl, but with logic that makes it actually work with multiple packages/components
13:13 <drets> “error”.
13:13 <cocreature> merijn: oh nice!
13:13 <merijn> cocreature: I use cabal-plan to discover the local packages/components and store mappings between components and files
13:13 <cocreature> I’ve basically stopped using new-repl because it’s mostly just useless without that
13:14 <merijn> cocreature: So if you have *a* component that contains said file it should manage to repl it
13:14 kefin_ joined
13:14 <butterthebuddha> Is it possible to specify a file input directory with stack?
13:14 <merijn> cocreature: Of course if you're daft and have multiple components using the same file you don't get a deterministic result for loaded component, but that's someone else's problem
13:15 <veverak> merijn: actual goal is to: copy source of each package, create cabal sandbox, add 'project specific' dependencies as add-source, cabal build, next();
13:15 <merijn> cocreature: I already have it working for "single invocation" so what I'm working on now is a daemon setup that keeps file-component mappings in memory so it spends less time reloading components
13:15 <zincy_> dminuoso: thanks :)
13:15 <merijn> veverak: new-build is plenty stable, although some new-X commands aren't completely finished/polished
13:15 <cocreature> merijn: I don’t care about that part. what I need is the ability to reload each file in a multi-package project. instead of being limited to a single component
13:16 <merijn> cocreature: For what?
13:16 <merijn> veverak: Yeah, new-build will probably drastically simplify your life
13:16 <cocreature> because restarting the repl is really fucking annoying?
13:16 <merijn> cocreature: Right, but in my case my code takes care of that
13:17 <veverak> merijn: will look into that than
13:17 <merijn> cocreature: So in vim if you hit ":w" on a file it will just reload the component for that file and check for any errors/warnings and highlight
13:17 <cocreature> does it take care of restarting the repl or do a fast reload?
13:17 Math22232 joined
13:17 <merijn> cocreature: reload if the repl already has the right component, restart if not
13:17 <cocreature> that sounds slow if you’re switching between components often
13:18 <merijn> veverak: Basically, you can define a cabal.project file with directories to local packages to use
13:18 <merijn> cocreature: Maybe, depends how slow the components are to compile
13:18 <veverak> merijn: https://www.haskell.org/cabal/users-guide/nix-local-build-overview.html is proper doc?
13:18 <merijn> veverak: yeah
13:18 zdenal joined
13:18 <veverak> merijn: cool, will look into that, thanks
13:18 <veverak> :)
13:18 <cocreature> I just use raw ghci and a .ghci file so I can get proper reloads across components
13:18 <Math22232> How do I fix this? : foreign export ccall keyGenerator :: String -> Int
13:18 <Math22232> keyGenerator :: String -> Int https://puu.sh/ADaJb/80978402db.png
13:18 <merijn> veverak: See here for an example: https://github.com/merijn/broadcast-chan/blob/master/cabal.project
13:19 zdenal joined
13:19 mnoonan joined
13:19 nwf joined
13:20 DwarfMaster joined
13:20 zdenal joined
13:20 <cocreature> Math22232: use CString in the ffi declaration and then use something like withCString to marshall the String
13:20 <Math22232> how do I fix this error? : https://pastebin.com/bZFGvfP0
13:20 <Math22232> k
13:20 <merijn> cocreature: I could actually cache the loading by loading object-code, but that means you'd lose any warnings from the last time you build the code...
13:20 zdenal joined
13:21 <merijn> veverak: Basically, you replace all the sandbox init/add-source/etc. commands with a static project file and then just use "new-build" and it "Just Works (TM)"
13:21 <merijn> veverak: So then you'd only have to copy/checkout the individual dependencies and run a single command
13:21 ccomb joined
13:22 <veverak> and generate the file :)
13:23 <veverak> but that's detaily, will look into that, thanks
13:23 <merijn> veverak: Well, generally you'd keep a static copy of the file somewhere
13:23 <Math22232> cocreature, I don't get it how I can convert a CString -> String
13:23 <merijn> veverak: i.e. if this inside some repo you'd generally commit the cabal.project as part of your repo/build system
13:23 <veverak> hmm, I see
13:24 <cocreature> Math22232: why do you want to convert from a CString to a String? you’re code is using the string as an argument not as a return value so you need to convert from a String to a CString
13:24 <veverak> merijn: I have to think about that
13:24 <merijn> cocreature: If you have an example of your .ghci script and a bit of explanation how it works I can see what I can do with that
13:25 <merijn> I'd love to make it as fast as possible, but this was the most robust way I've found
13:25 <cocreature> merijn: there is not much to it, it’s just a few ":set -iXXX", sets default extensions and flags according to what I have in my cabal file and then ":l Main.hs"
13:25 <cocreature> it sucks that I have to duplicate this info but it’s worth it for me
13:25 initiumdoeslinux joined
13:26 <merijn> cocreature: ah, right, but duplicating that stuff is exactly what I didn't/don't want to do
13:26 dbmikus joined
13:26 <merijn> As I don't think that's remotely automatable
13:27 <cocreature> new-repl should really just stop insisting that loading multiple components is always impossible because it can cause problems in a few cases
13:27 xcmw joined
13:27 <Math22232> cocreature, Sorry, but I stills don't get it, I get an CString as an Input Value so I wanna pass the CString into the keyGenerator function which takes a String as an Input but CString != String so I can't call the keyGenerator function, that's why I wanna convert the CString -> String so I can pass it to the function
13:27 <merijn> cocreature: That would be nice, yes, but I'm not going to fight that battle
13:27 <cocreature> but I looked at how one could implement this (and hide it behind some --i-know-what-im-doing" flag to avoid the fight) but the current state is baked very deeply into cabal
13:28 <cocreature> Math22232: where do you get the CString from?
13:28 <zincy_> How does one get the ordinal position of a data constructor as a number?
13:28 <dysfun> an Enum instance?
13:28 <Math22232> cocreature, I wanna call that function from a C++ project
13:29 <merijn> zincy_: That...doesn't necessarily make sense?
13:29 iAmerikan joined
13:29 sdothum joined
13:29 <cocreature> Math22232: it might be helpful if you show us more context. your code has a single function called keyGenerator. I’m proposing changing the FFI declaration of that to CString -> Int, and then have a wrapper of type String -> Int that uses withCString
13:30 <zincy_> data Foo = One | Two | Three
13:30 <cocreature> > constrRep (toConstr Nothing)
13:30 <merijn> cocreature: Alternatively I could launch one repl per component, but that might eat through your RAM *quick* :)
13:30 <lambdabot> error:
13:30 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘toConstr’
13:30 <lambdabot> prevents the constraint ‘(Data a0)’ from being solved.
13:30 <zincy_> I want a function such that when I pass the One it will return the integer 1
13:30 <merijn> zincy_: So, why not just write that?
13:31 <cocreature> merijn: that also doesn’t help with reloading if component B depends on component A and you change A
13:31 <merijn> cocreature: Why not?
13:32 <merijn> cocreature: Ah, you mean because reloading won't be affected by the A changes?
13:32 <cocreature> exactly
13:32 <cocreature> that’s the main reason why I’m doing this .ghci crap :)
13:32 <merijn> cocreature: Luckily, I have logic to detect whether a dependency that's changed :)
13:32 <zincy_> merijn: hehe
13:32 <merijn> cocreature: And I restart the repl in that scenario
13:32 <cocreature> merijn: right but then you’re back to having to restart
13:32 <merijn> True
13:32 <Math22232> cocreature, yeah how do I create a wrapper?
13:33 <merijn> cocreature: But I'll take "robust, working, but slow" tooling over "no tooling" any day :)
13:33 <cocreature> merijn: if new-repl takes a minute to start, you’ll get a lot more conscious about these things :)
13:33 epsilonhalbe joined
13:33 asheshambasta joined
13:33 <merijn> cocreature: That could be fixed with -fobject-code if you're willing to miss some warnings
13:33 knupfer joined
13:33 Mysterious_Light joined
13:34 <merijn> cocreature: I've played with that and -fobject-code is super fast when restarting the REPL. It's just that you only get warnings once, so starting the REPL after manually running "new-build" might cause you to miss/lose some warnings
13:35 codesoup joined
13:35 <merijn> I could definitely add an option for using -fobject-code, though
13:35 bodisiw joined
13:35 <cocreature> Math22232: \s -> withCString s keyGenerator should be of type String -> IO Int. you can then use unsafePerformIO (FFI calls are pretty much the only place where unsafePerformIO is fine) to get to String -> Int
13:35 language_agnosti joined
13:36 <cocreature> merijn: good point, I’m already using that for some other projects but I seem to recall that for that one project I ran into problems but I forgot what they were
13:36 <cocreature> I’ll have to try it again
13:37 <merijn> cocreature: Anyway, I need to get back to writing, but I'll ping you once I get a bit further and you can play around a bit
13:37 <cocreature> merijn: sounds good, have fun writing :)
13:37 <merijn> cocreature: Writing is never fun >.>
13:37 <cocreature> merijn: tell me about it, I should be working on my master’s thesis
13:38 <cocreature> but I just got back from zurihac so my brain is kind of fried and my motivation is even lower than usual :)
13:39 mfukar joined
13:39 davr0s joined
13:39 Linter joined
13:40 beauby joined
13:44 crobbins joined
13:45 csauce joined
13:46 csauce left
13:49 forell joined
13:50 whenamI joined
13:50 emilypi joined
13:50 <whenamI> any ceo or cto here ?
13:50 vukasink joined
13:50 zar joined
13:50 <shapr> whenamI: why so?
13:50 <shapr> whenamI: do you want to learn Haskell?
13:51 <whenamI> shapr: I wonder if any programmer can be a ceo or cto
13:51 <juri_> CEO here. hacking haskell for great justice.
13:51 <whenamI> juri_: which company ?
13:51 <juri_> give up your preconceptions. ;)
13:52 <juri_> my own. only up to three people. ;)
13:52 <shapr> juri_: I'm still sad I didn't get to meet you
13:52 <juri_> shapr: miss me at the CCC? :)
13:52 Gurkenglas joined
13:52 <whenamI> juri_: I work for very big company and I see daily lot of emails on promotions to VPs and all I feel so bad When and how can I become cto/ceo atleast some VP
13:52 <merijn> I'm sad everyone comes to Zurich, but skips NL-FP :p
13:53 <shapr> juri_: when I visited HacDC recently
13:53 tsoernes joined
13:53 <juri_> shapr: ah! how'd i miss you?
13:54 <juri_> whenamI: to lead, get some practice leading. go join your local hackerspace. :)
13:54 <shapr> juri_: I visited the day before the basement cleaning
13:54 Skami joined
13:54 <shapr> whenamI: why do you want to be a cto/ceo ?
13:54 <juri_> oh! goodness. that was a lot of work.
13:54 Boomerang joined
13:54 <ventonegro> merijn: Have you seen the photos of the lake? :)
13:54 <whenamI> juri_: but politics around I am still at carrer begining position..I applied many big position and no one selects me :(
13:55 Gurkenglas joined
13:55 <philippD> juri_ where you at the CCC haskell table last year?
13:55 <juri_> whenamI: seriously, go volunteer to teach some classes.
13:55 <juri_> philippD: i started haskell table two.
13:55 <whenamI> juri_: how does it help ?
13:55 mfukar joined
13:56 <juri_> whenamI: learning to build others builds yourself. leadership skills come from that. :)
13:56 <shapr> whenamI: cto/ceo needs people organization skills, teaching and organizing helps much.
13:56 ystael joined
13:56 Orbstheorem joined
13:56 <whenamI> I am a teacher yes but who gives me opportunity
13:56 <whenamI> how can I get into it
13:56 <shapr> start teaching!
13:57 <whenamI> I am very young just 26
13:57 <shapr> I teach lunchtime classes at my workplace
13:57 <shapr> you don't have to be old to teach!
13:57 <juri_> use that platform to run for office in the hackerspace.
13:57 sighingnow joined
13:57 <whenamI> shapr: I do teach
13:57 language_agnosti joined
13:57 <juri_> i took over a space at 30. :)
13:57 <shapr> figure out how to get more people and teach more things
13:57 <whenamI> I say I want to to become V atleast but they ask 14/15 years experience
13:57 <whenamI> I feel frustrated what to do
13:58 <whenamI> shapr: you teach for free?
13:58 <shapr> I do, yes
13:58 <shapr> I also have a day job
13:58 <juri_> shapr: i'm sad we missed each other, too. ;)
13:58 <whenamI> shapr: are you atleast VP/EVP in your company ?
13:58 <juri_> you dropping by town, or by the CCC anytime soon? i'm in baltimore this weekend...
13:59 vurtz joined
14:00 Yuras joined
14:00 progfun joined
14:00 amar joined
14:00 <whenamI> shapr: there ? I am asking because programmers just become architects in my place
14:00 mfukar joined
14:00 <whenamI> and then noting that too take 10/12 years
14:00 <whenamI> with heavy politics in pleasing the manager
14:01 <shapr> whenamI: no, I don't want to be management. I prefer to write code and build things.
14:01 <shapr> whenamI: this channel is really for learning Haskell, do you want to move this discussion to #haskell-offtopic ?
14:01 <shapr> or, do you want to learn Haskell?
14:01 <whenamI> sure
14:01 <whenamI> I wnt to learn haskell
14:01 justaguest joined
14:01 mounty joined
14:01 <dmwit> ?where tutorials
14:01 <lambdabot> http://haskell.org/haskellwiki/Tutorials
14:01 <shapr> ooh, such reflexes
14:01 <shapr> many link
14:02 <dmwit> Too many, I think.
14:02 exarkun joined
14:02 amelliaa joined
14:02 <juri_> heck, i should probably go through all of those again.
14:02 <dmwit> Picking 3-4 of the best (and writing a paragraph or two about what makes them stand out) from that enormous list would be a huge community service.
14:02 <whenamI> most of them outdated
14:03 <ysangkok> just buy Haskell From First Principles
14:03 hellozee joined
14:03 <ysangkok> it's current, and exhaustive, and not hard
14:04 <whenamI> ysangkok: finished long back
14:04 <whenamI> anyway thanks everyone
14:04 aarvar joined
14:04 rcdilorenzo joined
14:05 <dminuoso> whenamI: CIS194 is also a frequently mentioned resource. It's in depth and high quality.
14:05 <whenamI> dminuoso: thank you I finished 2013 and 16 fall both
14:06 <whenamI> I am thankful to haskell community though
14:06 <shapr> whenamI: I suggest http://www.cis.upenn.edu/~cis194/spring13/
14:06 <shapr> oh, same thing dminuoso said
14:06 ddellacosta joined
14:07 <whenamI> Yup
14:09 lastmanstanding joined
14:09 fluxit joined
14:09 <juri_> shapr: sadly, i am the only haskeller at hacdc.
14:09 mbrock joined
14:10 kamog joined
14:10 <shapr> :-(
14:10 mfukar joined
14:11 <whenamI> I love haskell and no one uses haskell :(
14:11 <shapr> I know lots of people who use Haskell
14:11 hellozee joined
14:11 <shapr> It's not (yet) as popular as Python or C
14:11 <shapr> but if you look around, you'll find people who do use it
14:11 <whenamI> c is not popular anymore too
14:12 plutoniix joined
14:12 <whenamI> python is only popular along with java
14:12 <Rembane> It depends on where you look
14:12 <whenamI> I even wonder why even clojure have more jobs than haskell
14:13 plutoniix joined
14:13 <shapr> whenamI: someone in my city offered me Haskell contract work last week
14:13 <shapr> it's not rare if you can use it and people know that
14:13 yuvali joined
14:13 <veverak> it get's more popular
14:13 <shapr> whenamI: so, go through cis194, put things on github, join the community, you will get Haskell work!
14:13 <veverak> and I believe that a lot of codes really like it, it's just that don't find a job with haskell
14:13 <whenamI> shapr:
14:13 <whenamI> no more github
14:13 <whenamI> though icrosoft funded haskell
14:14 <veverak> seems like we are only waiting for managers to pick that up ;)
14:14 <juri_> i use my own kallithea instance.
14:14 <alp> _microsoft research_, to be precise :)
14:14 <whenamI> I dotn like the way github getting sold to microsoft
14:15 pagnol joined
14:15 mbrock left
14:16 mkoenig joined
14:16 <shapr> whenamI: there's a mustard watch in cis194
14:16 <shapr> tell me when you find it...
14:17 zzq joined
14:17 <zincy_> When using quickcheck how do we impose extra constraints on the random generation of data types on top of the constraints defined in our Arbitrary instance for the ADT?
14:18 eschnett joined
14:19 mfukar joined
14:20 hellozee joined
14:20 <philippD> zincy_ with newtypes with specific Aribitrary instances
14:20 <philippD> take a look at Positive https://hackage.haskell.org/package/QuickCheck-2.11.3/docs/Test-QuickCheck.html#t:Positive
14:21 <shapr> zincy_: if you want to use a small range of values for the type, hedgehog is popular.
14:22 matsurago joined
14:22 ozataman joined
14:22 zdenal joined
14:23 whenamI left
14:23 dfeuer joined
14:24 mfukar joined
14:25 <zincy_> thanks
14:25 <dmj`> zincy_: there’s also (==>) which can filter values further
14:25 <zincy_> property based testing is verry different to unit tests
14:26 <zincy_> Whats tricky is even getting all random instances of a nested record ADT representing a game to be valid games
14:26 ogrady_ joined
14:26 keepLearning512 joined
14:27 carlomazzaferro joined
14:27 <zincy_> dmj` - cant find the documentation for that operator?
14:27 camsbury joined
14:27 ogrady_ joined
14:28 curious_corn joined
14:28 hellozee joined
14:28 <philippD> @hoogle (==>)
14:28 <lambdabot> Test.QuickCheck (==>) :: Testable prop => Bool -> prop -> Property
14:28 <lambdabot> Test.QuickCheck.Property (==>) :: Testable prop => Bool -> prop -> Property
14:28 <lambdabot> Test.SmallCheck (==>) :: (Testable m c, Testable m a) => c -> a -> Property m
14:28 slaznick joined
14:29 zdenal joined
14:29 <zincy_> has anyone here used property based testing for production systems and did they find it useful for real world code?
14:30 <shapr> I've used it to test work code here, found piles of problems.
14:30 <philippD> yep and yep. I even use it for java code at work.
14:30 <zincy_> ah cool
14:30 <shapr> stuff as simple as "we never thought about unicode in this form submisson" and "floating point numbers have infinity and NaN?"
14:31 <shapr> yeah, I've used QuickCheck to test java/python/C++
14:31 <shapr> and rails websites
14:31 <shapr> zincy_: I like to bet the authors a single beverage that I can find a pile of problems.
14:31 <shapr> I only make bets I know I will win :-P
14:32 <dmwit> shapr: minBound is another fun pain point for a lot of code (even more than maxBound).
14:32 <dmwit> e.g. abs minBound is not positive, etc.
14:33 iAmerikan joined
14:33 <shapr> My favorite starting property is x == (load . save) x
14:34 <dmwit> oh, very good one
14:34 <shapr> whether that's a database, textfile, or whatever you're using to get data from memory to disk.
14:34 <* hackage> hapistrano - A deployment library for Haskell applications http://hackage.haskell.org/package/hapistrano- (juanpaucar)
14:34 <philippD> zincy_ property based testing also forces you to think more about the contracts of your components which is in itself a huge win.
14:34 <AWizzArd> cocreature: do you have a link to some tutorial that demonstrates what you mean by „you can recover the type parameter”?
14:34 <AWizzArd> (gadts, existentials)
14:35 <shapr> zincy_: if you want to see some incomplete code: https://github.com/shapr/schrabble/blob/master/test/Spec.hs
14:35 <shapr> line 33 has the load . save test
14:36 hellozee joined
14:36 ventonegro left
14:36 Mysterious_Light joined
14:37 <jchia_> Does breaking up a big project into multiple packages improve build time?
14:37 <shapr> last I heard, stack can build multiple packages at the same time, but will only use one core per package
14:38 <shapr> I also heard that cabal new-build will use one core per module
14:38 <shapr> I haven't tested that, but I do know cabal new-build compiles take less time and more battery on my quad Xeon laptop.
14:38 <shapr> that is, compared to using stack to build the same project
14:38 <jchia_> shapr: Do you mean that stack can't build multiple modules in the same package at the same time so that breaking them up into multiple packages helps?
14:39 <shapr> I heard that a year ago, it may not still be true
14:39 hellozee joined
14:39 <shapr> jchia_: try it out?
14:40 <* hackage> versioning - Type-safe data versioning. http://hackage.haskell.org/package/versioning- (lortabac)
14:40 <zincy_> shapr: thanks
14:40 tzemanovic joined
14:40 <shapr> I'm thinking of upgrading to the six core Xeon ThinkPad when that's released this month.
14:40 <zincy_> shapr: Do you find the quickcheck is much easier to use with simpler types rather than record types?
14:41 <shapr> zincy_: once you get familiar with property based testing there's a pile of cool tricks
14:41 tzemanovic joined
14:41 <shapr> zincy_: doesn't matter, just call arbitrary
14:41 Kundry_Wag joined
14:41 <jchia_> I organized my big project (12k LOC) into multiple packages and find that I have to rebuild packages a lot when I make a small change in a small module in a package that the other packages depend on. I'm thinking if I don't use multiple packages, the dependency can be more granular.
14:41 <shapr> or liftMx arbitrary for a sum type
14:41 HarveyPwca joined
14:41 tzemanovic joined
14:41 <shapr> jchia_: wow, what does it do?
14:42 <shapr> 12k lines is nice
14:42 <jchia_> basically the codebase for the whole company
14:42 <jchia_> for the haskell part
14:42 tzemanovic joined
14:42 <shapr> are you using stack or cabal new-build?
14:42 <zincy_> https://lpaste.net/5851988336318611456
14:42 <zincy_> Does that look like sane use of quickcheck?
14:43 <jchia_> Using stack right now, haven't really learnt cabal
14:43 <jchia_> got scared by the term 'cabal hell'
14:43 <dmwit> lortabac: Neat, this looks very nice. I've used essentially this idea (without the fancy type parameter and class-upgrading mechanism) in a couple projects; I'm glad to see it mechanized.
14:43 tzemanovic joined
14:43 <shapr> jchia_: it's not a problem if you use cabal new-* commands
14:43 hellozee joined
14:44 <zincy_> btw with that pastebin ignore the fact the two tests cases do essentially the same thing :)
14:44 <shapr> jchia_: "cabal hell" came from globally installed packages, and cabal new-build and friends don't do that
14:44 <jchia_> shapr: What are those, in a nutshell? How do they determine package versions to use?
14:44 <shapr> same old search, but without being limited to a curated slice of the versions
14:44 davr0s joined
14:45 <dmwit> It uses the solver, as usual, to decide which package versions to use. The difference is that it now tracks dependency trees more carefully, and allows you to have multiple copies of the same version of the same library (but with different dependency trees) installed at once, and automates selecting the right one.
14:45 <shapr> stack is a wrapper around cabal, where each 'release' is a subset of the full hackage, tested to ensure they all work together
14:45 <cocreature> AWizzArd: sry, don’t really have a link handy but the basic idea is that if you have something like "data X a where IntX :: X Int; BoolX :: X Bool" and "data SomeX = forall a. SomeX (X a)" pattern matching on SomeX IntX tells you that the type parameter must have been Int
14:46 <shapr> jchia_: so, if your package bounds are polite, you can run "cabal new-build" in the same dir where you'd normally call stack build or whatever
14:46 <shapr> The downside to stack is that library authors who only use stack can end up with package bounds that don't work outside of tsack
14:46 <dmwit> (cabal hell came from demanding that a given package-version pair determined the full dependency tree of that pair)
14:46 <robstr> jchia_: stack has a flat file with version / lts, check https://www.stackage.org/lts-10.10/cabal.config for example
14:46 <shapr> mind you, I use stack when I'm teaching newbies, because cabal doesn't download GHC for you
14:47 <shapr> both stack and cabal have their own good points
14:47 hellozee joined
14:48 <[exa]> I like how every packaging system has its own version of hell but all are basically isomorphic
14:48 yuvali joined
14:48 <dmwit> Turns out: package management is a hard problem.
14:48 <dmwit> Who knew?
14:49 ogrady joined
14:49 <zincy_> What do you guys consider a medium sized project in terms of LoC?
14:49 Sampuka joined
14:49 <dmj`> zincy_: 5-10k ?
14:49 XorSwap joined
14:49 <lortabac> dmwit: thanks! it is still largely untested, but I think this solution should help me cut hundred of lines in a project I'm working on. And also fix a subtle bug on the passage
14:49 mounty joined
14:50 <jchia_> robstr: I suppose I could use the cabal.config from stackage and use it with cabal new-build?
14:50 <zincy_> dmj` wow thats low compared to other langs
14:50 <[exa]> zincy_: depends on the language. The effort needed for implementation is usually a better measure. Small-sized is something you can reimplement in a week when coding in the afternoon freetime
14:50 <robstr> jchia_: i would suggest using nix with cabal new-*, gabriel has a great series about it, https://github.com/Gabriel439/haskell-nix
14:51 <shapr> zincy_: you can do big things in Haskell
14:51 <zincy_> whats javascript 20k?
14:51 <dmj`> zincy_: there’s been stories of 5M LOC java project turning into 1M LOC haskell
14:51 amirpro joined
14:51 <shapr> I can read 20 pages of Python in hour, but 20 pages of Haskell could take me all day.
14:51 bodisiw joined
14:51 hellozee joined
14:51 xcmw joined
14:52 <zincy_> haskell is great for people with poor working memory
14:52 <shapr> zincy_: I agree
14:53 <shapr> zincy_: purity lets me reduce the amount of stuff I have to keep in my head when writing code
14:53 inkbottle joined
14:54 <jchia_> I find the hardest Haskell code to write is code that needs to interface with things written in other languages, like Python. If everything is Haskell, it's quite nice.
14:54 <merijn> jchia_: Even that can be quite easy if you use process
14:54 <cocreature> interfacing with other languages is great. now you can have segfaults in two languages
14:54 <jchia_> You have to mess with FFI, libraries that bind to those languages, specific config file formats, etc
14:54 <robstr> cocreature: haha
14:55 enterprisey joined
14:55 <[exa]> interfacing is hard in almost all languages if you don't some unixy abstraction
14:55 <jchia_> merijn: Running the process is not the hardest part.
14:55 <cocreature> related: https://twitter.com/cocreature/status/708347812082278401 :)
14:55 <dmj`> jchia_: that’s why you get someone to implement the dirty bits and expose it to you as a clean type-safe API. newtyping FFI types is powerful, and cheap af.
14:56 <dmj`> then parameterize your newtypes by some poly-kinded type and use closed type familes w/ TypeError to make it even safer / more user-friendly.
14:56 ogrady joined
14:56 dim1tri joined
14:57 sdothum joined
14:57 hellozee joined
14:57 <jchia_> dmj`: I mean cases where the Python project already has some config file format and intermediate files and I'm trying to migrate to Haskell and have to write stuff to process those and sharing the work with the Python code that hasn't been migrated.
14:58 <dmj`> jchia_: yea probably fastest to use process as a stop gap until you rebuild the logic in Haskell.
15:00 mounty joined
15:00 <jchia_> For example, previously, we used Python as config files, literally .py files. Now, to use those config files, I need a python script to convert the config into a format that the Haskell can read, so I wrote a script to convert the .py config to .json.
15:00 <jchia_> That was tedious.
15:00 <zincy_> dumb quickcheck question - how do I enforce that y is greater than x
15:00 <zincy_> property $ \(Positive x) (Positive y) -> y < x || (x `modInc` y) < y
15:01 amirpro joined
15:01 <dmj`> jchia_: you could parse the python, traverse the AST
15:01 <dmj`> @package language-python
15:01 <lambdabot> http://hackage.haskell.org/package/language-python
15:01 LiaoTao joined
15:01 <lyxia> zincy_: y > x ==> (x `modInc` y) < y
15:01 lastmanstanding joined
15:02 <lyxia> or you could generate x and the positive difference between x and y
15:02 <zincy_> lyxia: awesome thanks
15:02 Folkol_ joined
15:03 <jchia_> dmj: I'd have to interpret the python also to get the config value.
15:03 Zipheir joined
15:03 hellozee joined
15:03 <shapr> jchia_: which company?
15:03 <jchia_> dmj`: The use of python for config file makes config files flexible but basically unusable by Haskell.
15:03 <jchia_> shapr: Small company you haven't heard of.
15:04 <shapr> aw, ok
15:04 <* hackage> bdcs-api 0.1.1 - BDCS API Server http://hackage.haskell.org/package/bdcs-api-0.1.1 (clumens)
15:04 <shapr> I'm just curious what your 12k of Haskell actually does
15:04 <dmwit> zincy_: property $ \(Positive x) (Positive dx) -> let y = x+dx in y < x || (x `modInc` y) < y
15:04 <jchia_> not public libraries, just our private code for the business
15:04 raichoo joined
15:05 <shapr> yeah, but .. CRUD web apps? modbus or scada automation? any vague hand wavy thing?
15:05 <jchia_> basically trying to automate as much as possible in our line of work where another business might hire more people
15:05 saurabhnanda joined
15:06 <shapr> There are at least two companies in the Atlanta area that do a bunch of web app stuff with Haskell
15:06 kvothe joined
15:06 <dmj`> shapr: layer 3 is one of them
15:06 <shapr> yup
15:06 <jchia_> not web stuff, roughly finance-related
15:07 <shapr> dmj`: and seller labs is the other
15:07 <zincy_> Are there any cases of a one man band running a business on haskell?
15:07 <zincy_> or one woman :)
15:07 <shapr> sure, several
15:07 <shapr> you get a bunch of amplification writing Haskell
15:07 <zincy_> which ones
15:07 <shapr> um, I think bitemyapp was doing that for awhile
15:07 <shapr> I know some of the russian devs are doing that
15:08 logzet joined
15:08 <shapr> zincy_: I spent seven years doing mostly Python and some Haskell self-employed
15:09 <shapr> Lots of people want work done, and they do not care at all how you do it. They give you the inputs, and they want particular outputs.
15:09 hellozee joined
15:09 ian_andrich joined
15:09 <jchia_> We have a hard time hiring competent developers, especially Haskellers.
15:09 <zincy_> shapr: what kind of self-employed work?
15:10 <zincy_> jchia: why?
15:10 <shapr> I've written Haskell code to convert ms.doc files to custom xml formats, rip off a pile of NNTP newsgroups and do collation, generate web pages, etc
15:10 <zincy_> jchia: specifically towards hiring competent haskellers
15:10 <* hackage> iso8601-time 0.1.5 - Convert to/from the ISO 8601 time format http://hackage.haskell.org/package/iso8601-time-0.1.5 (NiklasHambuechen)
15:10 <dmwit> lortabac: Oh, beware: aeson doesn't handle nested `Maybe`'s well. I see your `type NA = Maybe`. So an `NA (Maybe Foo)` might not work the way you want it to.
15:10 <shapr> jchia_: I'd also like to hear your definition of competent :-)
15:10 knupfer joined
15:10 <maerwald> I don't believe it's hard to hire competent haskell devs. People are just too picky and don't want to provide an environment for employees to grow
15:10 <jchia_> zincy_: Maybe because we're a small company and people like to work in big ones. Also because there are not that many Haskellers locally to start with.
15:11 hellozee joined
15:11 XorSwap joined
15:11 <dmwit> lortabac: You might want to consider making `NA` a new type that is more careful with its `FromJSON`/`ToJSON` instances.
15:11 <shapr> if I knew the name of your company, I could at least stalk your location :-)
15:11 <maerwald> haskellers are amongst the most learning-willing people, so if you have a hard time hiring them, you are doing something wrong
15:11 DSM joined
15:11 jibby_ joined
15:11 <lortabac> dmwit: unfortunately this is impossible at the moment
15:12 <lortabac> dmwit: I hope it will work with -XDerivingVia
15:12 raingloom joined
15:12 <dmwit> lortabac: Oh, and now I see I misread because `type NA = Maybe Bare`, and so there should be no problem.
15:12 <zincy_> maerwald: yes I don't think the beginner stage lasts very long in haskell. Its a brick wall
15:12 <jchia_> shapr: Competent enough to work on one of our medium projects independently without close supervision, able to design a solution and think of most of the important details.
15:12 <lortabac> dmwit: Bare = Void + aeson instances
15:12 <dmwit> lortabac: Errr... you should definitely test this.
15:13 <shapr> jchia_: do you have enough Haskellers to do pairing? That's how I learn fastest, not sure about others.
15:13 <dmwit> lortabac: `Maybe`'s aeson instances use null for `Nothing` and the bare value for `Just`.
15:13 <shapr> like, train up your own devs?
15:13 <maerwald> the people I've met would give up all sorts of well-paid jobs just to get to work with haskell
15:13 initiumdoeslinux joined
15:13 <maerwald> because in the end, you're also losing your sanity when you do mainstream languages
15:14 <dmwit> lortabac: Ugh, I keep waffling. I don't know whether I expect this to work as-is or not. =P
15:14 <lortabac> dmwit: it works
15:14 <lortabac> dmwit: but unfortunately it's a hack
15:14 <jchia_> shapr: There are at most 2 Haskellers here, including myself, so maybe we can do pairing. I haven't done pairing before. So, what happens during pairing? Somebody writes code and the other watches and ask questions if he doesn't understand or disagrees or have other thoughts?
15:14 jibby_ joined
15:14 <shapr> I'd take a pay cut to write Haskell full time, but I don't know if I have the necessary skills
15:14 hellozee joined
15:14 earendel joined
15:15 woodson joined
15:15 <shapr> jchia_: yeah, best approach is for the learner to 'drive' most of the time, but you do have to switch out
15:15 <shapr> I've learned much watching how someone navigates a codebase
15:15 <shapr> or what they assume and what they have to check
15:15 sharno joined
15:15 <shapr> different companies have different ... cultural codebase assumptions
15:15 urodna joined
15:15 <lortabac> dmwit: Maybe is the only type that can be parsed generically when a field is missing
15:16 <lortabac> dmwit: since it is hard-coded in the Generic instances, this behavior cannot be extended to other type
15:16 <lortabac> s
15:17 <dmwit> bummer
15:17 <lortabac> dmwit: if you write the instances manually, you have to use .:? otherwise it will not work
15:18 GodotMisogi joined
15:18 xkapastel joined
15:19 hellozee joined
15:19 jibby_ joined
15:19 fmixing joined
15:20 <dmj`> lortabac: what are you trying to do?
15:20 fmixing joined
15:21 <benzrf> edwardk: yo, i was thinking about mtl's issues again today (quadratic growth of instances, orphan instances) and thinking that a lot of it is *obviously* automatically inferrable even if that's not possible to express directly in typical ghc haskell
15:21 <lortabac> dmj`: https://github.com/lortabac/versioning Look at the NA type in the Base module
15:21 <benzrf> is there any experimental stuff that i havent heard of that tries to fix that problem or anything?
15:22 hellozee joined
15:22 keepLearning512 joined
15:22 Mysterious_Light joined
15:22 <dmwit> benzrf: Lightweight Monadic Programming in Haskell proposes an alternate type system that infers returns, binds, and (crucially to your question) lifts.
15:22 <dmwit> ugh
15:22 <edwardk> no
15:22 <dmwit> s/Haskell/OCaml/
15:23 <dmwit> My wishful thinking fired up there. =(
15:23 rblaze joined
15:23 hellozee joined
15:23 <benzrf> lol
15:23 <dmwit> Anyway that would cut out the need for `MonadWriter` and friends entirely.
15:23 <benzrf> edwardk: aww :(
15:24 <benzrf> looking at this just makes me sad https://i.imgur.com/ZSPfmFA.png
15:24 <edwardk> in theory you could switch 90% of the code to default signatures instead of the current (better) defaults and “help” a bit for some definition of help
15:24 FreeBirdLjj joined
15:24 atmospherian joined
15:24 <benzrf> yeah i feel like the primary issue isnt even having to copy/paste definitions but just the necessity of adding instances
15:24 <lortabac> dmj`: basically I have a type that is isomorphic to (). I would like to be able to decode this type with generics when this field is missing
15:24 <dmj`> lortabac: Ah, yea I remember when aeson changed its default behavior so attempting to parse into a Maybe a when a field is missing causes an error to be thrown instead of returning a Nothing. Is that the issue
15:25 <benzrf> i guess avoiding that would require significant extensions/modifications to the entire notion of typeclasses...
15:25 <benzrf> :{
15:25 hellozee joined
15:25 <edwardk> e.g default get = lift get; put = lift . put
15:25 <edwardk> no
15:25 <benzrf> cant there be a coherent way to write "instance (MonadState s m, MonadTrans t) => MonadState s (t m)"
15:25 <benzrf> :(
15:25 <benzrf> oh?
15:25 <dmwit> Yes indeed. The paper I proposed adds a whole new class of constraint with a new solver.
15:25 <lortabac> dmj`: ideally I would use data NA = NA
15:25 <edwardk> just way shittier code for the interesting instances
15:25 <lortabac> dmj`: but I cannot extend the behavior of Maybe to other types
15:26 <edwardk> dmwit: paper?
15:26 <dmwit> edwardk: Lightweight Monadic Programin in OCaml. I'd love to see an analog for Haskell worked out in detail.
15:26 hellozee joined
15:26 <dmwit> Programming. typing is hard
15:27 <edwardk> walking and typing on my phone in the rain. i feel ya
15:27 <cjay-> carter: what was that name again that you told us to google about linear types?
15:27 <dmj`> lortabac: You mean using generics? Why not unwrap and call the parseJSON instance on the underlying Maybe type, or am I missing something
15:27 xcmw joined
15:27 <[exa]> MLs are strict by default, that simplifies the situation quite a lot
15:27 hellozee joined
15:28 <lortabac> dmj`: I tried, it doesn't work
15:28 <dmwit> Doesn't really make a difference. It's easy enough to say "inside this block where we infer all the binds and stuff for you, argument order is left-to-right for monadic actions".
15:28 <dmj`> lortabac: can you show me what you tried, or better yet, can we repro a tiny example
15:28 <edwardk> fortunately as a haskeller i was able to infer what you didnt type
15:28 bbrodriguez joined
15:28 <carter> cjay-: the mike shulman linear logic thing?
15:28 <lortabac> dmj`: oh wait, I am not sure I understood what you told me :)
15:29 <carter> Ask me more tomorrow. Or any time this week.
15:29 <dmwit> And I don't really think anybody would complain about that. You can always let-bind something if you want it to happen in a non-default order.
15:29 pagnol joined
15:29 <lortabac> dmj`: my goal is to avoid using Maybe
15:29 progfun joined
15:29 DSM joined
15:29 <edwardk> dmwit: ml is damaging your brain ;)
15:29 <dmj`> lortabac: you want to avoid Maybe, but in the case a field is missing you’d like to return a default value ?
15:29 XorSwap joined
15:30 <cjay-> carter: yep thanks I think that was what I meant
15:30 <lortabac> dmj`: yes, exactly
15:30 <dmj`> `o .: “could-be-missing-field” .!= someDefaultValue`
15:30 <lortabac> dmj`: I think the only way to achieve that is to wait for -XDerivingVia
15:30 <lortabac> dmj`: it works with manual instances, but not with Generic
15:31 <carter> cjay-: honestly only the first few pages and or maybe some of the examples are needed.
15:31 Lears joined
15:31 <carter> I’ll have some better notes tomorrow after I’ve rested
15:31 <lortabac> dmj`: that's why I had to define that weird type-synonym
15:32 jcjf joined
15:32 <lortabac> dmj`: which is basically Maybe Void
15:32 fendor joined
15:32 ccomb joined
15:33 <benzrf> after reading a few posts by bob harper im starting to become slightly more uncertain about ML vs haskell :>
15:33 <benzrf> i should probably try ml at some point
15:33 <dmj`> lortabac: afaik DerivingVia seems to be taking instances as long as you can `coerce` into a representationally equalivalent type. This means some other newtype would have the behavior you’re looking for, and I’m not sure that exists.
15:33 <benzrf> well, probably ocaml
15:33 progfun joined
15:34 <lortabac> dmj`: so I guess I have to keep the hack :(
15:34 progfun joined
15:35 progfun joined
15:35 <butterthebuddha> Is there a function in the library that maps a list like [1,2,1,2,1] to ([1,1,1], [2,2])
15:35 <butterthebuddha> I splits the list by alternating elements
15:35 <dmj`> lortabac: nah, I got you
15:36 <dmj`> lortabac: https://gist.github.com/a81a4a838e2c3654498da89fe487dc89
15:36 progfun joined
15:36 progfun joined
15:37 veryuniqkname joined
15:38 <lortabac> dmj`: ok, it works for manually written instances
15:39 <lortabac> dmj`: but I want the same behavior for all records with fields of a given type
15:41 <lortabac> dmj`: I mean, whenever there is a field of type NA, and you derive a FromJSON instance generically, if that field is missing it should be decoded with a default value
15:41 beauby joined
15:41 <dmwit> edwardk: I dunno. I do think it's kind of dumb that all monadic actions in Haskell have to be essentially hand-compiled to A-normal form.
15:41 <veryuniqkname> Hello everyone. I have a C function that fills array with some data. I allocate array with mallocBytes. Then i have to send this data over a socket, so i need to convert the array to ByteString. How can i do this?
15:42 Kundry_Wag joined
15:42 <dmwit> edwardk: The vast majority of the time *for monadic things*, top-to-bottom lets and left-to-right argument order is what you want/expect to happen anyway.
15:42 brandly joined
15:42 doyougnu joined
15:42 reactormonk joined
15:44 <dmj`> lortabac: afaik, there’s no way to provide a default value for generic instances in the case a field is missing. Let me try an idea though real quick...
15:45 errst joined
15:46 <edwardk> dmwit: my dig probably read as way more adversarial than intended. i was mostly just trying to tease about evaluating your arguments before calling your functions, etc.
15:46 Skami joined
15:46 <dmwit> yeah =)
15:46 <dmwit> v. unhaskelly
15:46 zdenal joined
15:47 <edwardk> i pretty much think the whole idea is a non-starter in an inference heavy world though, especially one like haskell where we tend to like to pass monadic actions to monadic combinators for things like pass/listen etc. where they _aren't_ being sequenced
15:49 XorSwap joined
15:50 <dmwit> I'm not sure I see why that would be a problem. You're probably assuming that it would see `listen m` and turn that into `m >>= listen`, but that isn't how it works; if `m` is already the right type it would actually desugar to something like `return m >>= listen`.
15:50 <dmwit> Which is less than ideal, obviously (there's an extra `return` and `bind`), but they discuss optimizations that rewrite away that kind of thing according to the monad laws.
15:51 FreeBirdLjj joined
15:53 <[exa]> dmwit: btw there's lazy lifting as well
15:54 Mysterious_Light joined
15:54 raingloom joined
15:54 bergle joined
15:55 <nruebwbae> Does anyone know some good resources for learning to understand System F? Book, video, tutorial, anything. Searching the web gives a lot of music and ford cars stuff...
15:55 [Leary] joined
15:56 <dmwit> ?where TaPL
15:56 <lambdabot> "Types and Programming Languages" by Benjamin C. Pierce in 2002-02-01 at <https://www.cis.upenn.edu/~bcpierce/tapl/>
15:56 XorSwap joined
15:57 detrumi joined
15:57 <nruebwbae> holy shit that's a great bot feature
15:57 <dmj`> lortabac: The issue is that a field can’t know the name of its selector without the meta data of the parent object present (SelName from GHC.Generics). Unless you rewrote GFromParseJSON to account for that. You’d want some kind of default type class (Def) that would provide a value during GParseJSON in the event a field is missing.
15:58 lastmanstanding joined
15:58 XorSwap joined
15:59 oisdk joined
16:00 louispan joined
16:00 ozzymcduff joined
16:02 <nshepperd> dmwit: special syntax for do blocks that rewrites 'func ~arg1 ~arg2' to 'a <- arg1; b <- arg2; func a b'?
16:02 Big_G joined
16:02 blankhart joined
16:03 language_agnosti joined
16:03 <lortabac> dmj`: I talked to phadej yesterday about this. The idea in the last comment could provide a solution: https://github.com/bos/aeson/issues/614
16:04 <lortabac> dmj`: basically the idea is to have a FromJSONField class to describe this kind of behavior
16:04 <dmj`> lortabac: yea, alternatively, we could provide a helper function that would allow us to configure custom generics instances for aeson, that would be great imo
16:04 <benzrf> nshepperd: i'm pretty sure ?where only retrieves things that people have taught the bot, unfortunately
16:04 <dmj`> lortabac: brb lunch
16:04 <lortabac> dmj`: I have to go too, I'll be back tomorrow
16:05 <edwardk> dmwit: "already the right type" in a world where so much stuff is tucked behind typeclasses is pretty nebulous.
16:05 oisdk joined
16:05 <edwardk> :t get
16:05 <lambdabot> MonadState s m => m s
16:06 Welkin joined
16:06 <edwardk> did i want that in the current monad i'm working in? is it an action i'm passing around to do something else? who knows.
16:06 elfets joined
16:06 Gurkenglas joined
16:06 <benzrf> er
16:06 <benzrf> sorry, not nshepperd
16:06 <benzrf> nruebwbae: i'm pretty sure ?where only retrieves things that people have taught the bot, unfortunately
16:07 crobbins joined
16:07 Snircle joined
16:08 djbeau joined
16:08 saurabhnanda joined
16:09 Luke joined
16:09 Mysterious_Ligh1 joined
16:09 rcdilorenzo joined
16:10 Linter joined
16:11 <nruebwbae> benzrf: still, I now have 600 pages of type theory to read all thanks to the bot :-)
16:12 <benzrf> ^_^
16:13 <Zemyla> I wonder if there's a way to make it so IntSet has a complement function.
16:14 epsilonhalbe joined
16:14 rcdilorenzo joined
16:14 <butterthebuddha> Is lpaste down or is it just me?
16:15 <infinisil> Zemyla: A flag that signals the complement should work
16:15 <Welkin> butterthebuddha: it's been messed up recently
16:15 <cocreature> butterthebuddha: which url are you trying to use?
16:15 <Zemyla> I was actually thinking more like a sequence of intervals.
16:15 <butterthebuddha> lpaste.net
16:16 <cocreature> are you sure you’re not trying lpaste.net/new/haskell?
16:16 <butterthebuddha> Yep
16:16 <infinisil> Zemyla: You mean a multi-interval?
16:16 <cocreature> lpaste.net is working for me but the codebase got rewritten and the /new/haskell links no longer work
16:16 <Welkin> what happened to the code anyway?
16:16 Yuras joined
16:16 <Welkin> it worked fine before, and now it looks like files are missing
16:17 <butterthebuddha> https://i.imgur.com/U5bik45.png
16:17 iAmDecim joined
16:17 <Welkin> why rewrite something that works
16:17 <cocreature> butterthebuddha: try without the www maybe?
16:17 <butterthebuddha> no dice :(
16:18 languag__ joined
16:18 <butterthebuddha> Regardless, can someone help me debug the code for part 2 here -> https://pastebin.com/raw/qH6EfWQX
16:18 <cocreature> hm no idea then, sry
16:18 <butterthebuddha> https://adventofcode.com/2015/day/3 <- for this challenge
16:18 <butterthebuddha> The correct answer is 2360, but the code is giving me 2333
16:19 rcdilorenzo joined
16:19 inad922 joined
16:20 allenj12 joined
16:20 <butterthebuddha> I'm getting the right answer for part 1, so I can't imagine visited is incorrect
16:21 suk joined
16:22 <glguy> butterthebuddha: Your visited processes the list in the wrong order
16:23 <butterthebuddha> Do I need to fold left?
16:23 conal_ joined
16:23 <butterthebuddha> That doesn't sound right :/
16:23 Kundry_Wag joined
16:23 <glguy> spend some time pondering that function then until it starts to make more sense
16:24 <butterthebuddha> If I fold left, won't I be processing the directions from the end?
16:24 rcdilorenzo joined
16:25 <cocreature> no, that’s what foldr does
16:25 <glguy> foldr and foldl both process the list from left to right. It's the only way you can process a list
16:26 <glguy> where it "starts from" isn't the right way to think about those two functions
16:27 oisdk joined
16:27 x1ddos joined
16:28 HarveyPwca joined
16:29 ixxie joined
16:29 hphuoc25 joined
16:30 fujiy joined
16:31 <glguy> butterthebuddha: Once you fix your implementation of visited, you might find this use of scanl neat: https://github.com/glguy/advent2015/blob/master/Day3.hs
16:31 amar joined
16:32 <osa1> does stack install have a parameter to specify where to install the binary? I think there was a parameter for this but I can't see it in --help
16:32 brocoli joined
16:32 twandy joined
16:33 kmurphy4 joined
16:34 <butterthebuddha> glguy: that's _very_ nice
16:35 woodson joined
16:35 zdenal joined
16:36 conal_ joined
16:36 obi_jan_kenobi_ joined
16:37 Paks joined
16:37 Sonarpulse joined
16:38 ozzymcduff joined
16:39 <jared-w> reddit's down as I'm trying to procrastinate on studying for finals. Hmmph
16:40 <cocreature> osa1: iirc it’s --local-bin-path
16:40 <matsurago> jared-w: is redit that great for procrastination?
16:40 xpycm joined
16:40 <jared-w> matsurago: It's basically where I spend 80% of my internet time, for better or worse
16:40 <osa1> cocreature: that's it, thanks
16:40 <osa1> it's not in --help for some reason
16:41 valentinbuza joined
16:41 <matsurago> jared-w: sounds good, need to try that too ._.
16:41 <jared-w> I don't recommend it; wasting time is far less useful than doing useful stuff with your time :p
16:42 <* hackage> HNumeric - Haskell Numeric Library with pure functionality, R & MATLAB Syntax. http://hackage.haskell.org/package/HNumeric- (edeftg)
16:42 <cocreature> jared-w: doing useful stuff is useful? that’s absurd!
16:42 <* cocreature> goes back to wasting his time
16:42 <jared-w> cocreature: absolutely mad
16:42 <* jared-w> goes back to not studying
16:42 lastmanstanding joined
16:42 rzp joined
16:43 davr0s joined
16:44 earendel joined
16:44 <infinisil> jared-w: Hah! I still have about 50 tabs of reddit open when it was up
16:44 <sm> osa1: it's in stack -h, not stack install -h
16:45 <osa1> oh, OK
16:46 <jared-w> no fair :(
16:46 <jared-w> it's a good thing, though. I restricted myself to basically only lurking r/haskell now and it's helped me waste less time. Need to stop going to reddit entirely and just read taylor's weekly haskell digests instead; far more efficient :)
16:48 hvr joined
16:49 Big_G joined
16:51 nckx joined
16:51 silver joined
16:51 paidnode joined
16:53 wildlander joined
16:54 hellozee joined
16:54 connrs joined
16:55 netheranthem joined
16:55 mbwgh joined
16:56 cjreynolds joined
16:57 <mbwgh> Does the `directory` package and functions like `listDirectory :: FilePath -> IO [FilePath]` rely on lazy-io?
16:58 <cocreature> mbwgh: iirc it doesn’t. it will only return once it has fetched all directories
16:58 <maerwald> https://hackage.haskell.org/package/directory-
17:00 DSM joined
17:01 Paks joined
17:01 zdenal joined
17:02 saurabhnanda joined
17:02 <bwe> Currently I perform 23 HTTP GET requests with https://github.com/mrkkrp/req sequentially (by mapping over the expressions). How can I save time by executing more than one at a time?
17:03 drewr joined
17:04 t7 joined
17:04 twandy joined
17:04 mnoonan_ joined
17:05 <[exa]> bwe: forkIO and collect the results using MVars? (wild guess)
17:05 <cocreature> bwe: use async’s mapConcurrently
17:06 <cocreature> if you want to limit the number of concurrent requestsr, either wrap the requests in a semaphore or take a look at async-pool
17:06 davr0s joined
17:06 <dmwit> edwardk: In this world, MonadState does not exist. There is only `get :: StateT s m s`, and inference takes care of lifting it to the appropriate monad if necessary.
17:07 <edwardk> mempty then. anything that might happen to be instantiated by a thing that happens to be a monad rather than is definitely some concrete monad.
17:08 <dminuoso> Regarding async - when I have an infinite loop acting as a dispatcher between TQueues inside an `Async Void`, is it fine to pass this `dispatcher :: Async Void` around to wherever I implicitly use this dispatcher for the sole purpose of propagating exceptions correctly with waitAny?
17:08 <* dmwit> nods
17:08 <dmwit> edwardk: It's a tradeoff I'd be interested in having the ability to make.
17:08 beauby joined
17:08 SpinTensor joined
17:08 vurtz joined
17:09 <edwardk> fair. feels clunky to me, but ymmv. i look forward to our new haskml overlords.
17:11 krone_ joined
17:11 language_agnosti joined
17:12 fendor joined
17:13 Mysterious_Light joined
17:16 <bwe> cocreature: mapConcurrently just works out of the box! limiting it to four simultaneous threads would be wrapping it into `withTaskGroup 4 $ \g -> do ...` (untested yet) from async-pool. Thanks for your advice.
17:16 <* shapr> dances cheerfully
17:17 Psybur joined
17:18 pfurla joined
17:19 amar_ joined
17:19 <khilan> Hello! I need to convert an `int` to `Pixel`. Something along the lines of the type : `toNew :: ToY cs e => Int -> Pixel Y Word16`. I know it is a bit silly but I'm unable to so. Can someone plz help me out?
17:20 Kundry_Wag joined
17:20 <cocreature> khilan: which Pixel type are you referring to?
17:20 <khilan> Pixel as in for images
17:21 <cocreature> I’m asking about the package that it comes from, there are probably quite a few packages that define a type called Pixel
17:21 <khilan> Oh sorry. I'm working with HIP (Haskell Image Processing) Package
17:22 <khilan> http://hackage.haskell.org/package/hip-
17:23 pera joined
17:23 <cocreature> looks like PixelY (fromIntegral i) should typecheck. whether it does what you want it to, I don’t know. you’ll have to provide more information for that :)
17:25 c1b01r3 joined
17:26 louispan joined
17:26 brocoli joined
17:27 <khilan> Well, actually I'm trying some basic operations. In an array defined with `Image arr Y Word16` , I want to write some expression like `write arr (i,j) px` where px is `(rank * 255) / 900`
17:27 <khilan> But, I'm getting some type errors which I unable to resolve :-)
17:28 <khilan> And rank is a mutable reference, int
17:28 wildlander joined
17:29 iAmDecim joined
17:29 allenj12 joined
17:29 <khilan> https://lpaste.net/988494338151415808
17:30 keepLearning512 joined
17:30 fmixing joined
17:31 fujiy joined
17:31 <cocreature> khilan: can you also show us the full type error?
17:31 <khilan> yes sure, 1 min
17:32 <khilan> https://lpaste.net/5676380034256863232
17:33 iAmDecim joined
17:33 dedgrant joined
17:33 hiptobecubic joined
17:35 <* hackage> bdcs-api 0.1.2 - BDCS API Server http://hackage.haskell.org/package/bdcs-api-0.1.2 (clumens)
17:36 emilypi joined
17:36 <cocreature> khilan: alright, so have you tried using PixelY (fromIntegral px) as I suggested?
17:37 <khilan> No sir, 1 min plz
17:38 <[exa]> any favorite method to parse really simple stuff, like SMTP commands? ( "RCPT TO:<some.mail@domain>" )
17:38 Kundry_Wag joined
17:38 hellozee joined
17:38 <[exa]> I'd patternmatch it, but there's some ambiguity on whether there are the <angle brackets> around, whitespace, and possibly some ignored stuff
17:38 <cocreature> [exa]: I’d still use some parser combinator lib (e.g. megaparsec). ime they don’t get in the way even for simple stuff so there is not really a reason to avoid them
17:39 Luke joined
17:39 allenj12 joined
17:40 <Psybur> is there a more concise way of doing: f <$> a <*> b <|> a <|> b ?
17:40 <khilan> Yes, It worked! Thank u so much! I was trying some stupid things earlier...Getting some more type errors. Will try to resolve them. Thank u!
17:40 <* hackage> digestive-functors-aeson 1.1.25 - Run digestive-functors forms against JSON http://hackage.haskell.org/package/digestive-functors-aeson-1.1.25 (OliverCharles)
17:41 Philonous joined
17:42 bodisiw joined
17:44 fujiy joined
17:44 <[exa]> cocreature: I didn't want to pull the dependency because of something as simple, but yeah it will probably be easiest
17:45 cjwelborn joined
17:46 <cocreature> [exa]: with the exception of trifecta, the parser combinator libs that we have in Haskell are fairly light on dependencies so I wouldn’t really worry about that
17:46 DSM joined
17:46 <glguy> Psybur: probably not, but another possibility to consider is: \f a b -> (\x -> maybe x (f x)) <$> a <*> optional b <|> b
17:47 <* hackage> ekg-bosun 1.0.14 - Send ekg metrics to a Bosun instance http://hackage.haskell.org/package/ekg-bosun-1.0.14 (OliverCharles)
17:48 <glguy> Psybur: just depending on what types you're working with that could avoid some "effects" of a being duplicated
17:48 <[exa]> cocreature: that's the megaparsec problem, it sounds too mega
17:48 <[exa]> btw isn't there SMTP server-side protocol implementation somewhere?
17:48 woodson joined
17:49 iAmerikan joined
17:49 XorSwap joined
17:49 fujiy joined
17:49 <[exa]> oh wow ofc it is. </problem>
17:50 giraffe joined
17:50 Kundry_Wag joined
17:51 <* hackage> json-assertions 1.0.12 - Test that your (Aeson) JSON encoding matches your expectations http://hackage.haskell.org/package/json-assertions-1.0.12 (OliverCharles)
17:52 Durbley joined
17:52 Guest87 joined
17:54 fujiy joined
17:55 <Psybur> glguy: thanks
17:55 nruebwbae joined
17:56 allenj12 joined
18:00 SomeGuy joined
18:00 ski joined
18:00 kritzefitz joined
18:02 <SomeGuy> hi all, recently did a migration to stack lts-11.12 and I now having an issue compiling test where it finds a data type defined twice. It seems to me that stack is compiling a lib twice and then having a resolution issue. Has anyone seen this?
18:02 oisdk joined
18:03 <kritzefitz> Writing string literals over multiple lines doesn't seem to work when compiling with stack build, while stack ghci is able to load the file without problems. Can anyone enlighten me what I'm doing wrong?
18:04 replay joined
18:04 <[exa]> kritzefitz: does it produce an error message or something?
18:04 <Psybur> glguy I get an infinite type error with that
18:04 <glguy> I can't see your screen
18:05 <kritzefitz> [exa]: I get this error: lexical error in string/character literal at character 'P'
18:05 <kritzefitz> 'P' is the first character on the second line of the continued string.
18:05 <Psybur> I'm on IRC on my phone and ghci in my laptop :(
18:05 <kritzefitz> s/first/first after the initial backslash/
18:06 <glguy> Psybur: OK, you'll have to fuss with it then and see where your error is. I don't have a good guess about what you did
18:06 <[exa]> kritzefitz: can you pastebin a tiny bit of that? we've seen this error when C preprocessor was enabled
18:06 <Psybur> ops forgot f
18:06 <cocreature> Psybur: an infinite type error? that sounds interesting …
18:06 valentinbuza joined
18:07 <kritzefitz> [exa]: Sure, give me a moment to prepare something minimal that still fails.
18:07 <[exa]> kritzefitz: but I don't think that running inside/outside of ghci should affect the outcome
18:08 <Psybur> nvm glguy I rigged up the params
18:08 <dmwit> kritzefitz: Is stack using CPP?
18:08 <dmwit> kritzefitz: We discovered a few days ago that CPP eats Haskell-style string gaps.
18:08 <kritzefitz> dmwit: I haven't told it to. I don't know if it does use CPP by itself.
18:08 <infinisil> OHhhhh
18:09 <shapr> zincy_: if you want more property test adventure, there's hedgehog, smallcheck, fitspec, speculate, and more!
18:09 <glguy> dmwit: Is that something that can be fixed by adding a trailing space to the first \ (so that it's not the last character on the line)
18:09 <glguy> ?
18:09 <infinisil> I finally get why CPP is talked so much about with Haskell
18:09 <dmwit> glguy: Hey, good idea!
18:09 <[exa]> dmwit: do you remember if it ate the terminating backslash or misinterpreted the backslash on the next line?
18:09 <dmwit> glguy: I don't know the answer, but I bet it's "yes".
18:09 connrs joined
18:10 <cocreature> the annoying part about that is that I have my editor configured to delete trailing spaces :)
18:10 <infinisil> CPP = C Pre-processor, it's run on Haskell code to enable you to add these #if things for conditional compilation! Right?
18:10 <dmwit> [exa]: It ate the backslash at the end of the line, causing GHC to have trouble with the backslash on the next line.
18:10 <[exa]> infinisil: yes
18:10 <dmwit> infinisil: right
18:10 <infinisil> It all makes sense now
18:10 <glguy> cocreature: time to fix your editor :)
18:10 Jesin joined
18:10 <zincy_> shapr: Which one is the most convenient and easiest to use?
18:11 <cocreature> glguy: well usually I’m quite happy that it does that :)
18:11 <zincy_> Also do they all rely on the Arbitrary typeclass?
18:11 <glguy> Delete all trailing spaces except those that are important
18:11 <dmwit> cocreature: Don't worry, after you fix your editor you can still add a macro that does it on purpose when you ask for it.
18:12 <cocreature> I’ll just be lazy and keep using unlines or mconcat in those cases :)
18:12 <cocreature> luckily I don’t have that many cases where I need multiline strings and CPP in the same file
18:12 <shapr> zincy_: I'm not sure which is easiest, but QuickCheck is the most popular, and hedgehog is gaining popularity: https://teh.id.au/posts/2017/04/23/property-testing-with-hedgehog/index.html
18:14 <orion> Hi. I am interacting with a the Gmail API. Some calls are paginated with a "page token" appended to the result. I have three different designs to handle this: https://gist.github.com/centromere/4da0ef7b209fcccfb3797b99a6c4b713
18:14 <orion> I am having trouble evaluating which design is best.
18:15 jbalint joined
18:15 jbalint joined
18:15 Skami joined
18:16 <orion> Designs A and B are very similar, and they *seem* elegant to me. However, I am unsure whether or not it'll have long term negative consequences in terms of complexity.
18:16 mizu_no_oto joined
18:17 Ariakenom joined
18:17 johnw joined
18:17 bendo joined
18:18 Insanity1 joined
18:18 <dmwit> orion: I like B the best.
18:18 motching joined
18:19 <shapr> zincy_: we have a whole ruby library at work for generating packets and pcaps for testing, it's pretty hacky. Then there's people using wireshark: http://www.petecorey.com/blog/2018/06/11/generating-test-fixtures-with-wireshark/
18:19 <orion> dmwit: Why?
18:19 <shapr> I'd like to yell "PROPERTY BASED TESTING" at them all, but I usually get "old man yells at cloud" emojis when I do that.
18:20 fujiy joined
18:20 motching left
18:21 <[exa]> there's an emoji of that now?
18:21 <maerwald> property testing isn't that amazing
18:21 attilak joined
18:22 enterprisey joined
18:22 lortabac joined
18:22 <shapr> maerwald: it's better than static unit tests
18:22 nuncanada joined
18:22 <maerwald> there is no "better" here
18:22 <shapr> why so?
18:22 <maerwald> unit tests have a different use case
18:22 <maerwald> it makes no sense to say they are worse than a different approach, which has a different use case
18:22 <cocreature> I should probably yell more at people while I’m sufficiently young for the “old man yells at cloud” to be inappropriate
18:22 <shapr> why not both?
18:23 <orion> cocreature: How old are you?
18:23 <shapr> maerwald: I had a prototype quickcheck that saved failing test inputs
18:23 <cocreature> orion: 23
18:23 MarcelineVQ joined
18:23 <orion> Oh, nice.
18:23 <shapr> ooh, I'm exactly twice that!
18:23 <orion> dmwit: Why do you perfer design B over A and C?
18:23 <johnw> shapr: same!
18:23 <shapr> johnw: september?
18:23 <* cocreature> high-fives johnw and shapr
18:23 <johnw> feb
18:23 <shapr> whew
18:24 <shapr> If the birthday paradox showed up, I'm be entertained.
18:24 sepp2k joined
18:24 <dmwit> orion: Because 1. it hides the particular implementation but 2. it still gives the programmer control over exactly when requests to gmail's site happen.
18:25 amar joined
18:25 <shapr> maerwald: but srsly, what do you think about property based testing that saves failing inputs?
18:25 <shapr> does that cover the unit test use case?
18:25 iAmerikan joined
18:26 Kundry_Wag joined
18:26 <dmwit> The birthday paradox: in which two humans will talk inanely at each other until they find something in common, at which point they will declare "wow! what a small world".
18:28 krone_ joined
18:29 <[exa]> concurrency question: I have a program that does 2 things at once using forkIO, and both need some initialization/deinitialization, done by bracket
18:29 <orion> dmwit: All the designs listed give you full control over when the requests to gmail happen.
18:29 <[exa]> ...so it's basically forkIO (bracket .....) >> bracket .....
18:29 <kritzefitz> [exa]: I think I found the problem myself, while trying to make an uploadable example.
18:29 <[exa]> Q: when the program is interrupted, only the main-thread bracket is "released", the forked one does not. Why is that so?
18:29 <kritzefitz> I'm using a nonstandard Setup.hs that seems to enable CPP.
18:29 <orion> dmwit: Point #1 is a good one.
18:30 ZeuPiark joined
18:30 <orion> dmwit: Why is Design B superior to design A?
18:30 <orion> Both A and B hide the implementation detail.
18:30 <[exa]> kritzefitz: well at least you didn't find any new weird thing. Does the fix that glguy suggested work?
18:30 fmixing joined
18:31 scampbell joined
18:31 <cocreature> [exa]: when the main thread is dead all other threads are killed immediately without running finalizers
18:31 cybai joined
18:31 <[exa]> cocreature: so I should kill them manually in the main thread's finalizer?
18:31 jao joined
18:31 <cocreature> [exa]: I would use something like async’s waitAnyCatchCancel for that
18:32 fmixing joined
18:32 connrs joined
18:32 zdenal joined
18:32 nruebwbae joined
18:32 <kritzefitz> [exa]: Huh, the fix doesn't work. But that the Setup.hs uses CPP was just a guess. I will try to find out what it actually does.
18:32 brocoli joined
18:34 <[exa]> cocreature: seems exactly like what I needed, thanks! :]
18:36 <kritzefitz> It actually is CPP that is breaking the syntax for me, it just seems to have become “smarter“ and warns about spaces between backslashes and line breaks before ignoring them completely.
18:36 cjreynolds joined
18:37 <geekosaur> CPP knows C, not Haskell. there' a fair number of Haskellisms that will confuse it
18:37 <geekosaur> it actually is the C preprocessor, not a Haskell speciifc one
18:38 <kritzefitz> Yeah. I will probably have to fix the library that provides my Setup.hs to not use CPP.
18:38 <[exa]> I'm kindof wondering why there's no Haskell-specific preprocessor (#commands aren't that hard to implement, right?)
18:38 <geekosaur> unmatched single quotes, # with MagicHash in effect, etc. and more problems if the cpp in question came form clang, because you can;t fully turn off its knowledge of ANSI C
18:38 <geekosaur> there's cpphs, but it's gpl and various folks won;t touch it as a result. (corporate lawyers really distrust gpl3)
18:39 alexteves_ joined
18:39 <[exa]> corporate lawyers should burn
18:39 <[exa]> nevermind. :]
18:40 mmhat joined
18:40 Linter joined
18:40 obi_jan_kenobi_ joined
18:40 <[exa]> so if I #define a parametrized macro and have parentheses in the code after the macro name, I guess it gets expanded as well?
18:41 <[exa]> ...ok now this makes an interesting language combo
18:41 cloudhead joined
18:42 jbalint joined
18:42 jbalint joined
18:44 altjsus joined
18:45 inad922 joined
18:45 yuuki joined
18:46 <geekosaur> yes. its not a smart macro processor
18:46 <jared-w> edwardk: what felt clunky to you?
18:47 bbrodriguez joined
18:50 initiumdoeslinux joined
18:50 <* hackage> diagrams-lib - Embedded domain-specific language for declarative graphics http://hackage.haskell.org/package/diagrams-lib- (BrentYorgey)
18:52 sdothum joined
18:53 <butterthebuddha> What's the best way to filter a list based on predicates that rely on adjacent elements?
18:53 <butterthebuddha> Can I filter a list two elements at a time?
18:53 <cocreature> butterthebuddha: zip the list with the tail of the list
18:53 darjeeling_ joined
18:54 <butterthebuddha> Ah
18:54 <ski> > (zip `ap` tail) [0,1,2,3]
18:54 <lambdabot> [(0,1),(1,2),(2,3)]
18:54 <johnw> then filter, then map fst
18:54 fmixing joined
18:55 <shapr> @tell maerwald I want to hear about the different use cases for unit testing vs property testing!
18:55 <lambdabot> Consider it noted.
18:56 allenj12 joined
18:57 DSM joined
18:57 cjreynolds joined
19:02 <jared-w> shapr: for me, unit testing is almost always about preventing specific bug regressions
19:02 <jared-w> Every bug report in the repo should have a fix and then ideally a unit test making sure that particular regression doesn't happen again
19:02 amar joined
19:02 weird_error joined
19:03 <jared-w> property testing doesn't do that and it's particularly bad at testing pathological cases
19:03 <shapr> what about failing prop inputs being saved as unit tests?
19:03 jbalint joined
19:03 jbalint joined
19:03 <jared-w> You can do that too and it's probably a good idea for a lot of things (depending on the use case)
19:04 <jared-w> failing prop units are, in my mind, just a special case of a bug report
19:04 alexteves__ joined
19:05 <shapr> I read a neat blog post recently, someone was reducing the crashes afl was finding, and while all the reduced values also failed, many of them were unique bugs
19:05 <exarkun> Hypothesis (for Python) has a case database where it will remember failing cases and an API for selecting specific cases (same idea in each case, one data driven and the other code driven).
19:06 <jared-w> something like that would be pretty easy to extend over quickcheck or hedgehog actually
19:06 <shapr> I think test-framework can do that, but I'm not sure
19:06 a3Dman joined
19:06 filwisher joined
19:07 <shapr> I know one of the meta-testing libs could grab the failing (seed,size) from quickcheck and use that to regenerate the failing input
19:08 <* hackage> hslua-aeson - Allow aeson data types to be used with lua. http://hackage.haskell.org/package/hslua-aeson- (tarleb)
19:08 inad922 joined
19:12 <dmwit> orion: My read of design A is that it would do an extra request to gmail to decide whether there was a next page or not. So creating the pager actually causes two requests to gmail.
19:12 <dmwit> orion: Whereas with design B you only do one request up front, and then the user can decide whether they care if there's another page to look at and whether to incur the cost of a second request.
19:12 <dmwit> orion: So point #2 is my distinguisher between A and B.
19:12 <Welkin> doesn't gmail makes thousands of requests?
19:13 <Welkin> it's an example of a bloated, poorly designed app
19:13 t7 joined
19:13 karlguy joined
19:14 <jared-w> No reason to pile shit on top of shit if you can help it, though :)
19:14 Deide joined
19:15 cjreynolds joined
19:17 Wuzzy joined
19:17 <dmwit> orion: (By the way, there's no need to ask twice, and doing so won't change my probability of answering you or my timing.)
19:17 <exarkun> world would be a better place if google engineers were restricted to hardware and networks 5 years out of date
19:17 rblaze1 joined
19:19 <jared-w> world would be a better place if modern hardware, networks, and protocols weren't so expensive and monopolized in much of the first world and outright unaccessable in a lot of the rest of the world :)
19:19 inkbottle joined
19:20 fishythefish joined
19:21 <monochrom> The web would be more efficient if web "designers" were restricted to the OLPC laptop.
19:22 <hc> haha, true
19:22 <dminuoso> jared-w: It's quite amazing. If you look at post-QC crypto, some of the most promising contenders to make the better place have been... patented.
19:22 dbmikus joined
19:22 iAmerikan joined
19:23 DSM joined
19:23 <monochrom> I mean, the only reason I block ads is because some ads are pointless Flash/gif that take 100% CPU time. This is hostile to even the most classy laptops if you're one of the most classy take-laptop-to-Starbucks people.
19:24 <Welkin> also, no one wants to see ads
19:24 <MarcelineVQ> the only reason I block ads is that time is all you have
19:24 <dminuoso> monochrom: You could also look at it differently: Why do you visit garbage websites in the first place? It's almost as if you download shitty software and then complain about all the poor algorithms and solutions the developers employed. :P
19:24 johnvonneumann joined
19:25 <johnw> is this still relevant to Haskell?
19:25 <monochrom> Oops.
19:25 <Welkin> yes
19:25 <Welkin> haskell against ads
19:25 <johnw> I don't have non-Haskell-chatter blocking enabled
19:25 Psybur joined
19:25 initiumdoeslinux joined
19:26 mnoonan joined
19:29 nruebwbae joined
19:29 nruebwbae left
19:30 vurtz joined
19:30 cjreynolds joined
19:32 saep joined
19:32 alexteves_ joined
19:33 whiteline joined
19:33 fujiy joined
19:36 rblaze joined
19:38 sz0 joined
19:40 megaTherion joined
19:42 Arcaelyx_ joined
19:42 mnoonan joined
19:42 alx741 joined
19:43 <butterthebuddha> I can't actually quite map using fst after zipping though :/
19:43 <butterthebuddha> I will lose the last element of the list in the case I don't filter anything
19:44 <butterthebuddha> (johnw)
19:44 <butterthebuddha> Unless I'm being daft
19:44 <Welkin> or a punk?
19:45 <butterthebuddha> Or both?
19:45 <cocreature> butterthebuddha: how would you like to filter the last element? should it just always be included?
19:45 <butterthebuddha> I suppose I could just always include it
19:45 <monochrom> butterthebuddha: Show a concrete example of what you mean?
19:45 allenj12 joined
19:46 mcmuru joined
19:46 cjreynolds joined
19:46 <cocreature> if you’re filtering based on the neighbor than dropping either the last or the first element doesn’t seem unreasonable but the right way to handle this depends on your application
19:47 <butterthebuddha> monochrom: I'm taking a string, transforming it to a list of all adjacent pairs (i.e. "xyz" -> ["xy", "yz"] for eg.)
19:48 <butterthebuddha> but I want to get rid of adjacent pairs like "xx", "xy"
19:48 <dmwit> What makes "xx" and "xy" similar?
19:48 <butterthebuddha> Or, the first element in such a pair
19:48 mortum5 joined
19:48 <butterthebuddha> where the first pair has the same characters, and the first character of the second pair is also that character
19:49 Luke joined
19:49 <monochrom> How does adjacent pair happen? By starting with "xxyz"?
19:50 <butterthebuddha> Well, "xxxyz"
19:50 benjamin-l joined
19:50 <dmwit> I'm hecking confused.
19:50 initiumdoeslinux joined
19:50 <dmwit> Your input/output pairs don't some coherent to me.
19:50 <dminuoso> butterthebuddha: Didn't ski give you the answer already?
19:51 <monochrom> I think you need to explain like you're doing TDD. List 5 interesting pairs of inputs and correct answers.
19:51 Wamanuz joined
19:51 <dminuoso> > (zip `ap` tail) "xxyz"
19:51 <lambdabot> [('x','x'),('x','y'),('y','z')]
19:55 cjreynolds joined
19:55 Wamanuz2 joined
19:55 mnoonan joined
19:57 <dmwit> Specifically: I can't reconcile ("xyz" -> ["xy","yz"]) with ("xxyz" does not result in a list that has "xx", "xy" in it).
19:57 ClaudiusMaximus joined
19:57 <dmwit> I mean I can, but every reconciliation has higher Kolmogorov complexity than I believe is intended.
19:57 bobakk3r joined
19:59 conal_ joined
19:59 knupfer joined
20:01 chaosmasttter joined
20:01 zdenal joined
20:01 pasukon_ joined
20:07 rblaze joined
20:08 son0p_ joined
20:09 fujiy joined
20:10 emilypi joined
20:10 kderme joined
20:10 HZun joined
20:11 ljhms joined
20:12 carafe joined
20:14 m0rphism joined
20:15 masse joined
20:16 connrs joined
20:16 oisdk_ joined
20:17 <jle`> butterthebuddha: you want to take a string, transform it to a list of all adjacent pairs, and then get rid of all adjacent pairs?
20:17 <jle`> sounds like just makeAdjacentPairsAndGetRidOfThem _ = []
20:17 <dmwit> Pfft, slowpoke. I was confused way before you were.
20:19 <jle`> sounds to me like "i want to decompose an integer into all its factors, and then get rid of all the factors in the list", heh
20:19 <jle`> maybe there was a typo
20:20 zenspider joined
20:20 carafe joined
20:20 zenspider left
20:21 mizu_no_oto joined
20:22 epsilonhalbe joined
20:22 ljhms joined
20:23 oisdk joined
20:23 nadare joined
20:23 codesoup joined
20:23 alexteves_ joined
20:24 alexteves joined
20:24 zdenal joined
20:24 bobakk3r joined
20:25 seanparsons joined
20:27 fujiy joined
20:28 oo_miguel joined
20:32 Luke joined
20:32 davr0s joined
20:35 acidjnk joined
20:35 zar joined
20:36 carafe joined
20:40 bobakk3r joined
20:42 pagnol joined
20:43 fujiy joined
20:43 atmospherian joined
20:45 <dminuoso> Mmmm. ... `catchIO` (\_ -> die' verbosity notFound)
20:45 <dminuoso> Or rather some: ... `catchIO` (\_ -> return [])
20:45 <dminuoso> This looks like a bad idea
20:47 enkhill joined
20:47 epsilonhalbe joined
20:49 zdenal joined
20:49 DSM joined
20:53 iLike joined
20:54 kmurphy4 joined
20:54 replay joined
20:56 henriksod joined
20:57 dented42 joined
20:59 kefin_ joined
21:00 cloudhead joined
21:04 woodson joined
21:05 dhil joined
21:08 <* hackage> alex-tools 0.3.1 - A set of functions for a common use case of Alex. http://hackage.haskell.org/package/alex-tools-0.3.1 (IavorDiatchki)
21:09 Linter joined
21:12 Nitroghez joined
21:12 <Nitroghez> https://tinyurl.com/ya79dnx5
21:14 epsilonhalbe left
21:16 <* hackage> primitive-indexed - http://hackage.haskell.org/package/primitive-indexed- (andrewthad)
21:21 XorSwap joined
21:23 soupladler joined
21:23 karlguy_ joined
21:24 <soupladler> Hey, does anybody know of an offline reference for haskell? Something that I can feed into vim?
21:24 <soupladler> I'm used to being about to press K over a symbol
21:24 <soupladler> then getting the reference directly
21:26 reactormonk joined
21:28 <amx> I found something that queries Hoogle when you press K
21:29 <philippD> plus you can host hoogle locally and have it index your own stuff
21:29 <amx> https://github.com/Twinside/vim-hoogle not sure if that helps
21:29 blankhart joined
21:29 plugin joined
21:30 <soupladler> That's probably great, actually
21:30 <amx> (from: https://sillybytes.net/2016/08/vim-haskell_11.html )
21:31 <philippD> I found this episode of haskell cast pretty informative on this topic http://www.haskellcast.com/episode/012-neil-mitchell-on-development-tools
21:31 numarkaee joined
21:32 <soupladler> Also, is there any special trick to using cabal?
21:32 <soupladler> I've been typing 'cabal install x'
21:32 <soupladler> and usually it fails
21:34 DSM_ joined
21:35 cloudhead joined
21:35 iAmerikan joined
21:36 <aweinstock> is there a way to get (runFunPtr :: forall a. GHC.Ptr.FunPtr a -> a) with the correct semantics, or is the monomorphization enforced by `foreign import ccall "dynamic"` inevitable?
21:38 <philippD> soupladler: tl;dr: try using stack instead of installing stuff globaly through cabal https://docs.haskellstack.org/en/stable/README/
21:38 <sclv> Or use a cabal sandbox
21:38 <sclv> Or use new-build
21:39 <sclv> And some things just fail because they’re not maintained
21:39 <sclv> https://www.haskell.org/cabal/users-guide/nix-local-build-overview.html
21:40 <philippD> sclv: In my opinion stack is the most intuitive way for beginners. I haven't looked at new-build though
21:40 <amx> soupladler: FWIW, new-build works really well if you just try to build your own project.
21:40 <mitchellsalad__> is there a way of telling cabal new-build to use the global package database? (for example when dependencies are provided by nix)
21:40 <sclv> The advantage of new-build is that you don’t have to learn a new tool
21:40 <sclv> Just a modified workflow
21:41 <soupladler> Hmm, OK. Cabal is the vanilla tool, right?
21:41 <sclv> mitchellsalad__: not really
21:41 <soupladler> I kinda prefer to learn the most mainstream thing if possible.
21:41 WhatisRT joined
21:41 <mitchellsalad__> sclv: How's nix+cabal meant to work once cabal old-build goes away, then?
21:41 <sclv> For actual integration with nix the standard build is still the typical workflow
21:42 fujiy joined
21:42 <mitchellsalad__> That's unfortunate as old-build has no backpack support
21:42 <sclv> A bunch of people like elvish are looking to fix things for new-build with nix
21:42 <sclv> Its just not there yet
21:42 codesoup joined
21:42 <sclv> soupladler: yes, cabal is “vanilla”
21:43 <mitchellsalad__> Gotcha :)
21:43 <sclv> although both tools are widely used
21:43 LKoen joined
21:43 <sclv> So neither is “exotic” either
21:43 DSM joined
21:43 <EvanR> the tool being cabal-install right
21:43 <sclv> yes
21:43 <EvanR> that and stack both use cabal the build system
21:44 <sclv> yes.
21:44 hph^ joined
21:44 cybai joined
21:44 <sclv> I just thought i’d explain it as simply as possible
21:44 <sclv> Omitting details to not overwhelm beginners
21:44 <* EvanR> ruins everything
21:45 <sclv> Lol
21:45 <soupladler> :)
21:45 <monochrom> stack is intuitive if you phrase everything as a "project".
21:46 <monochrom> It becomes an unintuitive just-memorize-it magic spell if you don't have a "project" and therefore you have to fake it by a "global project".
21:46 zdenal joined
21:47 <monochrom> Oh it is also unintuitive when and when not it suddenly downloads one more copy of GHC.
21:49 <soupladler> To be honest I'm at the level where I feel like I'm fumbling my way through fog when I'm doing Haskell. I've done a bunch of C and C-derrived languages, so I'm kinda used to imagining what the machine is doing
21:49 TCZ joined
21:49 <soupladler> So I'm trying to keep everything else as simple as possible
21:49 <monochrom> Yes, with Haskell you have to imagine what the math is doing instead.
21:49 <jle`> yeah, it's good to detach yourself from the idea of a machine when working with haskell
21:49 <jle`> it'll only confuse you more
21:49 Skami joined
21:50 <soupladler> Yeah, that's what interested me. I'm not much of a mathematician, so I thought it would be nice to learn a mathsy language while I'm learning maths
21:50 <EvanR> you still have the same surface as in C, there is an executable, statically linked, and a runtime is linked
21:50 <dminuoso> In a funny way its what programming languages were designed to do in the first place. Folks write C or C++ because they dont want to think what the machine does.
21:50 fujiy joined
21:50 <EvanR> yes in some sense C isnt about the real machine
21:51 <monochrom> I am teaching my students to come up with recursive code by attempting the induction proof first.
21:52 <monochrom> That's right, you write the proof even before you have code. The proof will help you discover the code.
21:52 <koala_man> which other languages cause experienced programmers to struggle to do simple things? Prolog is even less C-like than Haskell, and I had a lot of fun trying to wrap my brain around it
21:52 hiratara joined
21:53 <soupladler> I think hardware description languages are interesting for this
21:53 <sm> APL
21:53 <EvanR> brainfuck
21:53 <ystael> koala_man: J
21:53 <soupladler> I mean, I'm not sure if they're exactly programming language
21:53 <dminuoso> EvanR: I found brainfuck surprisingly easy.
21:53 <EvanR> malbolge
21:53 <ystael> (a descendant of APL cited by sm)
21:53 <dminuoso> And malbolge is not turing complete :<
21:54 <monochrom> Because the biggest hurdle is you don't trust the induction hypothesis, therefore you micromanage instead of just letting the recursive call do the job for you. With the proof, you write down the induction hypothesis carefully, so you trust the recursive call now.
21:54 <EvanR> good
21:54 LKoen joined
21:54 <srk> koala_man: this, but then I've realized the importance of tail recursion and accumulators :)
21:55 fmixing joined
21:55 oisdk joined
21:56 <koala_man> I should try J or APL then. Brainfuck is mostly just tedious
21:58 yuuki___ joined
21:58 fujiy joined
22:02 <ZeuPiark> bye
22:02 amar joined
22:03 mizu_no_oto joined
22:04 epsilonhalbe joined
22:04 scampbell joined
22:06 woodson joined
22:07 fujiy joined
22:08 piark_ joined
22:08 nuknown joined
22:08 desperek joined
22:11 zdenal joined
22:13 WhatisRT joined
22:13 codesoup joined
22:13 blonkhart joined
22:15 tzemanovic joined
22:16 yuuki_ joined
22:17 <phz_> argh, damn you stack
22:18 typo_ joined
22:19 Achylles joined
22:20 danso joined
22:20 detrumi left
22:21 sudden joined
22:21 plugin joined
22:22 averell joined
22:22 lortabac joined
22:23 <typo_> I wonder if ConstraintKinds can be used to define a datatype such as (,) which can be used to pair Constraints together.
22:23 <phz_> typo_: sure
22:24 <phz_> you can go with data Pair (a :: *) (b :: *)
22:24 <phz_> a :: k / b :: q
22:24 fujiy joined
22:24 <phz_> but that’d be PolyKinds though
22:25 bbrodriguez joined
22:26 exarkun joined
22:27 <glguy> typo_: Like: type Both (a :: Constraint) (b :: Constraint) = (a,b) ?
22:28 pagnol joined
22:31 <typo_> ok, so if (,) has Kind * -> * -> * then its a datatype rather than a type, as required, but it needs its arguments to have Kind Constraint rather than * to be used as a Constraint. Maybe there is a way to make it work using Dict?
22:31 hiratara joined
22:32 <jle`> yeah you can just write a Dict c -> Dict d -> Dict (c, d)
22:32 <jle`> as a function
22:32 <jle`> no need for a data type really
22:33 hamishmack joined
22:33 <jle`> you could make an "curred" dict type i suppose
22:33 <jle`> data Dict2 c d = (c, d) => Dict2 c d
22:33 leothrix joined
22:33 <jle`> *curried
22:33 <jle`> * data Dict2 c d = (c, d) => Dict2
22:34 c1b01r3 joined
22:35 conal_ joined
22:35 weird_error joined
22:36 zdenal joined
22:37 jfredett joined
22:38 <glguy> typo_: I don't know what different you have in mind between type and datatype, but with the ConstraintKinds extension (,) gets magic overloading so you can use it at kind * -> * -> *, or Constraint -> Constraint -> Constraint
22:38 <glguy> difference*
22:38 Gurkenglas_ joined
22:39 <typo_> the idea was to apply this "magic" to a synonym
22:39 <glguy> (I suppose it has the magic overloading even without the extension)
22:40 <glguy> What was the idea?
22:41 iAmerikan joined
22:42 <jle`> and with DataKinds you can even use it as a kind k -> k -> (k, k)
22:42 <jle`> er, k -> j -> (k, j) :)
22:43 <glguy> Though to get that to work you have to use the similarly named type '(,)
22:43 dan_f joined
22:44 <typo_> to make a datatype to use as a Constraint which could distribute an argument over its values, so that Constraints for values of kind * -> * could be combined
22:44 <jle`> oh hm, i guess you can't use it without that?
22:44 slack1256 joined
22:45 <jle`> typo_: what do you mean to use a datatype as a constraint?
22:45 <glguy> values don't have kinds
22:45 <glguy> Do you just mean something like: type C f = (Read1 f, Show1 f) ?
22:45 <typo_> as in a Functor Constraint as opposed to e.g. Ord
22:46 <glguy> type C f = (Functor f, Applicative f)
22:46 <jle`> hm, that doesn't quite explain what you mean by 'using a datatype as a constraint'
22:47 <glguy> typo_: Can you show an example of what you'd want to be able to write. I don't understand how you're using some of these terms
22:54 jfredett_ joined
22:55 MP2E joined
22:55 <typo_> well using (a::Constraint,b::Constraint) to the left of => is ok, but ((PairF Ord Eq) a) => does not work
22:56 epsilonhalbe left
22:57 <jle`> ah yes that does not sound like a data type
22:57 <jle`> there are a couple of ways to do something similar
22:57 Khisanth joined
22:58 <jle`> one is using a type family, and the other is using a dummy typeclass
22:58 <glguy> type PairF c1 c2 a = (c1 a, c2 a)
22:58 <jle`> *type synonym :)
22:58 <glguy> but with the right kind signature
22:59 floryst joined
22:59 <glguy> With ConstraintKinds, PolyKinds, and KindSignatures you can write: type PairF (c1 :: k -> Constraint) (c2 :: k -> Constraint) (a :: k) = (c1 a, c2 a)
22:59 <glguy> If you just want it to work for types with kind (* -> *), you don't need poly kinds
23:00 <typo_> yes, c1 :: * -> Constraint not * -> *
23:00 Skami joined
23:01 <glguy> f :: PairF Ord Eq a => a -> Bool; f x = x < x
23:01 jmcarthur joined
23:04 <typo_> ok, so a datatype is completely out, it must be the type synonym of (,)
23:05 StoneToad joined
23:06 louispan joined
23:06 crestfallen joined
23:06 <typo_> fine. thanks
23:07 WhatisRT joined
23:07 ddellacosta joined
23:07 DSM joined
23:08 enterprisey joined
23:10 carafe joined
23:11 urdh joined
23:12 jedws joined
23:14 <crestfallen> people keep telling me to take a break from textbooks and start a project (my programmer friends) . What do you think about this idea ? .... :
23:15 ziyourenxiang joined
23:15 <fishythefish> sounds like a good idea
23:15 <Tuplanolla> The only thing I know about you is that message, so I'm going with "definitely", crestfallen.
23:16 bergle joined
23:16 <crestfallen> Tuplanolla: thanks, I was aka crucify_me and received your kind assitance . thanks fishythefish so its this:
23:17 <crestfallen> preface: I'm sick of textbooks. they suck
23:17 Achylles joined
23:18 <fishythefish> textbooks can be good and useful, but if you only read them and never do exercises or play with code, it's easy to convince yourself you know the fundamentals and then suddenly find yourself in over your head in something way too advanced
23:18 rasusto joined
23:20 <crestfallen> I was thinking of doing various math exercises in haskell, and figuring out a way to relate some "exemplary" math problems to how category theory ties them together. Part of the goal would be to have it as an educational device, to teach myself and others basic category theory and haskell.
23:20 typo_ joined
23:20 <crestfallen> Like for example:
23:20 <fishythefish> category theory in the context of haskell's type system is not the same as doing value-level computations
23:20 gestone joined
23:21 <crestfallen> please rephrase
23:22 <fishythefish> e.g. a math exercise might be to solve a quadratic, but just because it's math doesn't mean it has anything to do with category theory as we usually discuss it in the context of haskell
23:22 jle` joined
23:22 jle` joined
23:22 <Tuplanolla> If you would enjoy number theory with a bit of Haskell on the side, try Project Euler, crestfallen.
23:22 <fishythefish> +1, was gonna recommend project euler
23:23 <glguy> Though very quickly with Project Euler you'll be spending more time on the number theory than on the Haskell
23:24 <crestfallen> right, yes it wouldn't necessarily need to be math, but anything exemplary that could illustrate how cat theory works. project euler is tough I tried some in ruby way back. but..
23:24 <fishythefish> crestfallen: why are you so keen to do category theory?
23:24 <glguy> It's probably best to forget about category theory and just learn how to write programs in Haskell, if you want to learn Haskell
23:24 <fishythefish> with all due respect, the last time we talked, you seemed confused about the euclidean algorithm, so I'm not sure CT is the right thing to study for you
23:24 <crestfallen> idk it keeps coming up. I realize it doesn't map to haskell seamlessly
23:25 <fishythefish> it keeps coming up because this channel has plenty of nerds with the right background for it
23:25 mud joined
23:25 <fishythefish> you don't need it to write haskell
23:25 <crestfallen> extended euclidean algorithm. well, I know what it does, and I really enjoyed that process when we did the evaluations
23:25 <geekosaur> haskell is a nice place to play with ct concepts
23:25 <geekosaur> that doesn;t mean you need to know ct to use haskell
23:26 <crestfallen> word
23:26 <crestfallen> I don't know, I'm just having a hell of a time getting through books. I stopped enjoying it.
23:26 <fishythefish> moreover, if you don't have a strong background in either subject, trying to learn both of them together is just gonna be extra painful
23:26 <fishythefish> crestfallen: don't make your goal to get through a book as quickly as possible
23:26 <geekosaur> in fact I;d argue the opposite because you need pretty good ct chops and pretty good haskell chops, because ct doesn't map *that* seamlessly
23:26 <fishythefish> make your goal to understand what was in it
23:27 zdenal joined
23:28 fujiy joined
23:28 tzemanovic joined
23:28 lassulus joined
23:28 <crestfallen> geekosaur: I wrote above that it doesn't map seamlessly. that is just what a friend told me.
23:29 urdh joined
23:31 chao-tic joined
23:31 <crestfallen> I watched a cool video on how relations between objects become geometric . It was on entitlement of white males, non-white males , non-male non-whites etc. the geometry of the relations keep changing with various implications, etc. I really like the idea there.
23:31 tsoernes joined
23:32 <Tuplanolla> She has a full lecture series on YouTube, crestfallen.
23:32 <crestfallen> so if I could understand that and write something basic for educational purposes. yeah Tuplanolla she is cool
23:32 <Tuplanolla> Just watching it won't do much, though. You need to work it to understand it.
23:33 kasra joined
23:33 <crestfallen> so if you have a function, if you add variety to the functionality of it, you are going to change its position in a spatial sense as it relates to other functions.
23:35 <crestfallen> you add subtle functionality to it, say by changing the type of numerics it can use, that can be expressed in a category or switch to a different cat.
23:35 taumuon joined
23:36 Solonarv joined
23:36 <crestfallen> is that a load of crap or is that partially true?
23:37 jackdk joined
23:37 <Tuplanolla> If by spatial you mean metric structure, then no, category theory has very little of that.
23:37 <c_wraith> jle`, typo in your lens article.. you talk about split and join being inverses at one point, but I think you meant split and unsplit.
23:38 carafe joined
23:39 oisdk joined
23:39 <fishythefish> you can probably represent a metric space as a category by enriching over the reals or something
23:39 <crestfallen> reading about metric structure...music...astrology...
23:40 <jle`> c_wraith: ah, thanks :)
23:40 <jle`> yeah i actually originally used join but switched to unsplit because of possible confusion with Control.Monad.join
23:40 Linter joined
23:40 <crestfallen> but as I understand it , it would be relational like in an abstract algebra sense.
23:40 <c_wraith> jle`, quite enjoying the article. nice work, again. :)
23:41 <Tuplanolla> Sure, you can put almost anything into a category, but that doesn't mean category theory is about that thing.
23:41 hphuoc25 joined
23:41 <fishythefish> certainly
23:41 sillyotter joined
23:41 fujiy joined
23:41 <jle`> c_wraith: thanks! really appreciate it :)
23:42 <fishythefish> I understood the question not as "is CT a useful tool for studying this?" but rather "can we express these relations in a category if I really want?"
23:42 <jle`> good to know that it's also enjoyable for people who already understand lenses too, haha :)
23:44 <c_wraith> jle`, yeah. I never saw the connection with the existential representation before. It's fun to think about.
23:45 <crestfallen> but that thing goes in and out of focus based on what is being emphasized at the moment ; is that correct?
23:45 Gurkenglas joined
23:45 <fishythefish> crestfallen: er, if you're studying that thing, it should probably remain in focus
23:46 <fishythefish> this is all getting pretty hand-wavey though
23:47 <crestfallen> well, I just thought it would be a cool project to think about.
23:47 YongJoon joined
23:48 <crestfallen> back to earth, I get caught up with writing out the evaluation order, because frankly I can't imagine understanding haskell without two things: understanding evaluation order and type unification.
23:50 coeus joined
23:50 ammazza joined
23:51 fujiy joined
23:51 megaTherion joined
23:52 pfurla joined
23:54 <fishythefish> crestfallen: a good way to get started on those two things is to write haskell
23:54 <crestfallen> but to form a question, obviously fishythe*fish and company gets the eval order stuff, but my sense is that some people consider this overly theoretical
23:55 <crestfallen> correct? :)
23:55 <fishythefish> I think you might be overestimating how much anyone here understands the evaluation order of actual code without looking at the results of compilation
23:55 <typo_> the problem is in trying to use -> as the product rather than (,)
23:56 Tesseraction joined
23:56 pavonia joined
23:57 LeaChim joined