<    April 2017    >
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 22  
23 24 25 26 27 28 29  
30
00:00 featherlessbiped joined
00:01 a3Dman joined
00:02 nbro left
00:02 ocramz joined
00:04 alienbot joined
00:04 mda1 joined
00:05 Rodya_ joined
00:06 JeanCarloMachado joined
00:07 stevenxl joined
00:13 <mniip> dfeuer, okay this is tough
00:15 RyanGlScott joined
00:16 <RyanGlScott> Does hlint-2.0 no longer look in HLint.hs for custom settings?
00:17 stevenxl joined
00:17 swalladge joined
00:18 <fizbin> Huh. Maybe I shouldn't insert 3.9 million edges at once.
00:19 ericshortcut joined
00:20 Koterpillar joined
00:23 filterfish joined
00:24 Kundry_Wag joined
00:24 eacameron joined
00:25 <robkennedy> Is there a tutorial for starting a blog with a Haskell backend? I've never deployed anything but static pages to hosting before.
00:26 <Koterpillar> robkennedy: static blog or an actual server?
00:26 <robkennedy> I'd guess I'm trying to learn servers. Something where I can deploy a database would be amazing
00:27 <Koterpillar> deploying a database is orthogonal to haskell
00:28 binaryplease joined
00:28 <Koterpillar> I wrote a blog server (can't be static for reasons), but the content isn't in the database
00:29 <robkennedy> Is it? I've accessed a few databasi in my time, and no two are alike - accessing a particular database would be part of a lesson in starting a blog, I'd think
00:29 <Koterpillar> accessing, not deploying
00:29 <robkennedy> So not "deploying a predetermined database"
00:30 <robkennedy> We may be describing the same problem
00:30 <jmcarthur> Type l
00:30 <jmcarthur> oops
00:30 eacameron joined
00:30 <jmcarthur> Sorry, disregard.
00:31 <Koterpillar> robkennedy: OK, so you want to build a blog that stores its content in the database?
00:31 <robkennedy> I suspect that any reasonable blog infrastructure would use a database
00:31 <robkennedy> Yes
00:31 steeze joined
00:31 <Koterpillar> robkennedy: or do you want to _deploy_ it, as in, you have it and you want to put it on a server?
00:31 <geekosaur> type l 8, what, is this tenex? :p
00:32 Welkin joined
00:33 ericshortcut joined
00:33 <jmcarthur> I had started typing something intended to actually go here, typoed, forgot about it, came back, then accidentally hit enter.
00:34 andyhuzhill joined
00:34 <robkennedy> No, sorry, I want to in general learn about using Haskell as a backend for web application with changing data over time. I say database to imply that the data is not completely knowable to the compiler.
00:34 e14 joined
00:34 plutoniix joined
00:34 jbiesnecker joined
00:35 <robkennedy> In my job I have tons of experience with private data stores, as file servers and databases. I'd expect databases as the normal solution to this problem
00:35 <Sonolin> robkennedy a quick google search resulted in http://yannesposito.com/Scratch/en/blog/Yesod-tutorial-for-newbies/
00:35 <Sonolin> no idea how good/bad it is
00:36 <Sonolin> there's also the standard Yesod tutorial but it seems their site is having issues..
00:36 <jmcarthur> Yesod seems like such a difficult way to get familiar with Haskell.
00:36 eacameron joined
00:36 hexagoxel joined
00:37 <Sonolin> well he asked about creating a blog & database in haskell
00:37 <robkennedy> Sololin: that's why I said "deploy" (I don't mean to imply you should understand me). I know plenty about Yesod and Servant, I use them daily. But I've only work on our intranet
00:38 <Sonolin> oh I see, so you really are seeking help with the deployment step
00:38 path[l] joined
00:38 <robkennedy> Yeah 100%, although I don't have content to deploy yet so I'm open to formats
00:38 <Sonolin> sorry I don't have much production haskell experience.. but I'd imagine "stack" would be useful here, and the DB setup would be the least related to haskell
00:39 <Koterpillar> robkennedy: Haskell is easy to deploy, it's typically one binary
00:40 <robkennedy> But I've never deployed any binary to any server hosting service - all I've ever done is put HTML and JS on a webserver
00:40 <ertes> if you want to learn haskell, don't learn yesod though
00:40 <ertes> yesod is mostly magic (not in the good sense)
00:40 RyanGlScott left
00:41 HugoDaniel joined
00:41 <Sonolin> ertes curious but can you recommend any full stack web frameworks for Haskell?
00:41 <Sonolin> i.e. for when Servant is too low level
00:42 <ertes> the ones i have experience with are happstack, snap, yesod
00:42 eacameron joined
00:42 <robkennedy> Yesod makes my code segfault and makes GHC take 4GB, I'm no fan. It was a good way to learn Haskell though - the lore of "babby's first Haskell app is a Yesod CRUD website" held true for me
00:42 <ertes> each with different trade-offs
00:42 jgt1 joined
00:42 andyhuzhill joined
00:42 ocramz joined
00:43 lambda-11235 joined
00:44 <ertes> Sonolin: but of course most frameworks in haskell are "full stack", as we have framework-agnostic libraries for pretty much everything
00:44 <ertes> yesod is perhaps the only odd one
00:44 <Sonolin> yea sure, I guess I'm just looking for something with session support, maybe some forms, and other such web-related stuff
00:44 <Sonolin> that doesn't rely on oodles of TH...
00:45 <robkennedy> So I'm in the somewhat odd position of (relative) resourcefulness in Haskell, but with no idea how the internet works
00:45 taktoa joined
00:45 louispan joined
00:45 MarioBranco joined
00:46 <ertes> Sonolin: pretty much all of them can do that, except for your last requirement, which disqualifies yesod
00:46 <Sonolin> well I'll check out the other two then, thanks
00:47 <ertes> Sonolin: also check out scotty and spock… i'm quite fond of the former
00:48 <Sonolin> thank you! I've actually been looking for that one
00:50 <Jello_Raptor> huh, shit :/
00:50 armyriad joined
00:50 eacameron joined
00:52 adolby joined
00:54 <Sornaensis> I read somewhere that ghc is "good at optimizing recursion that does is not explicit"
00:54 <Sornaensis> in the context of catamorphisms
00:54 <Sornaensis> does anyone know if this is true
00:54 nighty-- joined
00:54 MarioBranco joined
00:55 mda1 joined
00:56 a3Dman joined
00:57 <Cale> Sornaensis: I can't quite parse that sentence
00:57 ryxai joined
00:57 dan_f joined
00:58 MarioBranco joined
00:58 <Sornaensis> Cale: sorry, "recursion that doesn't look like recursion"
00:58 <Sornaensis> something to that effect
00:58 <Cale> What does that mean?
00:59 <Cale> Something either looks like recursion or is not recursion.
00:59 <Sornaensis> hmmm
01:01 eacameron joined
01:01 <Sornaensis> ohh, he said that ghc does a terrible job of optimizing recursive code
01:02 <dolio> That's also untrue.
01:03 MarioBranco joined
01:03 nshepperd joined
01:04 Stanley00 joined
01:11 texasmynsted joined
01:12 MP2E_ joined
01:14 eacameron joined
01:16 MP2E joined
01:17 Ferdirand joined
01:17 silver joined
01:18 <robkennedy> What algorithm would you use to find if a Vector Bool had only one true? Mine is 100x slower than the same word formula
01:18 MarioBranco joined
01:20 <ertes> robkennedy: Vector Bool is a bad choice as a bit field
01:21 louispan joined
01:21 JeanCarloMachado joined
01:21 lambdafan joined
01:21 <ertes> robkennedy: if you use a Vector Word instead, skip over all zeroes, and check the popCount of non-zero words
01:21 <ertes> > popCount 0b1000101110
01:21 <lambdabot> error:
01:21 <lambdabot> • Couldn't match expected type ‘t0 -> t’ with actual type ‘Int’
01:21 <lambdabot> • The function ‘popCount’ is applied to two arguments,
01:22 eacameron joined
01:22 <ertes> > popCount 0xF0F0
01:22 <lambdabot> 8
01:22 ocramz joined
01:23 <robkennedy> Yeah, so far Word and Set are the only decent options I've found is Word
01:23 P1RATEZ joined
01:23 Goplat joined
01:23 DataComputist joined
01:23 <ertes> Integer works, too
01:24 edvorg joined
01:26 oisdk joined
01:26 takle joined
01:26 eacameron joined
01:26 pera joined
01:27 <ertes> robkennedy: of course if you want to see if there is exactly one bit set in a bit field, depending on how the field is constructed you could get away without actually constructing it
01:27 adolby joined
01:27 <Sornaensis> dolio: cool
01:29 vaibhavsagar joined
01:29 Jannoo joined
01:30 <Jannoo> good evening
01:30 <Jannoo> i do not understand this signature: (Fractional a, Ord a) => a -> Char
01:30 <Jannoo> isn
01:30 <Jannoo> isn't a fractional already ordered?
01:31 <ski> complex numbers aren't ordered
01:31 <geekosaur> no, because ^
01:33 <Jannoo> you guys are smart
01:33 <Jannoo> thanks
01:35 HugoDaniel joined
01:35 <rotaerk> yea well, complex numbers aren't real numbers, so there
01:35 <ertes> rotaerk: there are more counterexamples to that statement than i can list
01:36 <rotaerk> lol
01:36 <Jannoo> learning haskell = relearning math
01:39 connrs joined
01:39 takle joined
01:41 tosun joined
01:43 FjordPrefect joined
01:44 andyhuzhill joined
01:44 lambdafan joined
01:44 Kundry_Wag joined
01:44 markus1189 joined
01:44 edvorg joined
01:47 lambda-11235 joined
01:49 Ferdirand joined
01:49 path[l] joined
01:49 exferenceBot joined
01:50 e14 joined
01:51 SimpleL joined
01:53 tomboy64 joined
01:53 hamishmack joined
01:53 Rodya_ joined
01:53 Supersonic112_ joined
01:54 takle joined
01:55 mkoenig joined
01:55 sleffy joined
01:57 deadend joined
01:57 <deadend> kk
01:59 <dfeuer> mniip: I'm not surprised it's tough. I would also not be surprised if it turned out to be utterly impossible.
02:00 hucksy_ joined
02:01 xall joined
02:02 darjeeling_ joined
02:02 <dfeuer> mniip: I haven't (yet) even come up with a way to fake it up with plain binary numbers standing in for the heaps.
02:02 ocramz joined
02:03 <dfeuer> I conjecture that adding the heaps to the mix will be a hard slog but not conceptually difficult.
02:03 e_svedang joined
02:03 Rodya_ joined
02:04 <jchia> I'm trying to use a directed-acyclic graph at run-time for job scheduling that I define at compile-time. Each vertex has a name (label) and some properties. The graph is specified by specifying each vertex together with its predecessor vertices (by name) (implying incoming arcs). An arc can also be explicitly added after its vertices have been defined. The graph specification has an error if an explicit arc or implied arc names an unknown vertex name. Another
02:05 texasmynsted joined
02:07 ChaiTRex joined
02:07 filterfish joined
02:07 Lemmata joined
02:08 coltfred joined
02:09 takle joined
02:09 <dfeuer> mniip: the part that seems really hard, BTW, is the analogue of liftSort. I'm not sure how the arithmetic operations have to be structured to make that work, if it's possible at all.
02:12 edvorg joined
02:12 exferenceBot joined
02:13 <Jannoo> is there a chart of the hierchies of the different types and their type classes?
02:13 <Jannoo> i believe i searched in the past but found stuff that was missing a lot of stuff
02:14 <Jannoo> sorry for the novice questions
02:14 <dmwit> The report has one, and there's the Typeclassopedia.
02:15 <MarcelineVQ> jchia: your client failed to multline your message, soit ended at "unknown vertex name. Another"
02:15 <dmwit> Jannoo: https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1270006.3
02:15 <dmwit> ?where typeclassopedia
02:15 <lambdabot> http://www.haskell.org/haskellwiki/Typeclassopedia
02:15 <jchia> MarcelineVQ: Thanks
02:15 <jchia> ... Another type of error is that the graph turns out to have a loop. Currently, I'm defining the graph at run-time using some data structures and discovering graph errors also at run-time, which is undesirable. How can I express/model the graph so that it's built at compile-time so that if it compiles, I know it has no errors?
02:16 <dmwit> Jannoo: But the open world assumption means no such chart can ever really be complete.
02:16 <dmwit> Jannoo: There's also `:i` in ghci to learn what GHC thinks are a type's or class' current instances.
02:16 brynedwardz joined
02:17 hexagoxel joined
02:18 louispan joined
02:18 <glguy> and then there's :info! to find them out even if they are out of of scope (but the package is loaded)
02:19 <dfeuer> glguy: I had no idea about that!
02:19 <Jannoo> thanks dmwit and glguy
02:19 <dfeuer> That sounds super-useful.
02:19 <Jannoo> the chart in the report doesn't make sense to me
02:19 <Jannoo> im sure im reading it wrong
02:20 <Jannoo> but why isnt num under the hierchy of ord
02:20 <dfeuer> Jannoo: it's not the best visual in the world. Also, a couple bits are out of date.
02:20 <dfeuer> Jannoo: complex numbers aren't ordered. Indeed, GHC no longer makes Num a subclass of even Eq.
02:20 <Jannoo> damn, keep forgetting about complex numbers
02:20 infinity0 joined
02:20 sleffy joined
02:20 Ferdirand joined
02:21 <dfeuer> Jannoo: be especially careful about Num and Enum. They're horribly unprincipled :(
02:21 DataComputist joined
02:21 <Jannoo> thanks dfeuer
02:21 <Jannoo> its still to click
02:21 ericsagnes joined
02:22 <glguy> dfeuer: We added it about 5 years ago after some frustration with some lens code :)
02:23 infinity0 joined
02:24 Koterpillar joined
02:24 <lpaste> Jannoo pasted “Do not understanding the type signature for output” at http://lpaste.net/354389
02:24 <Jannoo> why is the type for the output: number :: (Ord a, Num a, Num t) => a -> t
02:24 takle joined
02:24 <Jannoo> shouldn't it be Integer?
02:25 <geekosaur> because negative numeric literals are weird in haskell
02:25 <glguy> No, the type of integer literals is: Num a => a
02:25 pavonia joined
02:25 <Jannoo> why is that? shouldnt it give us the most concrete type?
02:26 <geekosaur> although actually I think that one ought work...
02:26 infinity0 joined
02:26 <glguy> No, it tries to give us the most general type
02:26 <dfeuer> glguy: I'd love to talk to you about binary numbers sometime soon, but I can't right now.
02:27 steeze joined
02:27 <glguy> Um, OK :)
02:27 <Jannoo> but isn't that haskell kind of lying to us? 1 is not a double for example
02:27 <geekosaur> hm, nope, not negatove shenanigans
02:27 <glguy> Jannoo: Yes, 1 can be a Double
02:27 <Jannoo> but making 1 a Num means 1 can be a double
02:28 <glguy> > 1 :: Double
02:28 <Jannoo> isnt' 1.0 a double
02:28 <lambdabot> 1.0
02:28 nathyong joined
02:28 <geekosaur> ahm, right, not thinking...
02:28 <geekosaur> ok
02:28 <glguy> 1 :: Num a => a, and there's a Num instance for Double (this is great because it means we can do things like add Doubles)
02:28 infinity0 joined
02:29 <glguy> 1.0 :: Fractional a => a
02:29 HugoDaniel joined
02:29 <geekosaur> Jannoo, all numeric literals are polymorphic. one with a decimal can be any Num instance. if it has a decimal point, it can be any Fractional instance
02:29 <glguy> so we can use that at type double, too
02:29 <glguy> but not at type Int
02:29 <glguy> Jannoo: In some programming languages you can determine what type a number literal has from the literal itself
02:29 <glguy> like 1 might always be an int, 1L might always be a long int
02:29 <glguy> That's not Haskell, though
02:30 nathyong joined
02:30 <Jannoo> i thnk that is exactly what is tripping me up glguy
02:30 <Jannoo> im thinking of literals in Java
02:30 JoshS joined
02:30 nathyong joined
02:30 Rodya_ joined
02:31 <Jannoo> and thank you geekosaur as well
02:31 <Jannoo> this clears it up
02:31 <Jannoo> but im affraid im gonna make this mistake again
02:31 infinity0 joined
02:32 <Jannoo> and be back with the questions in the same vein
02:32 <Jannoo> ;/
02:33 JoshS joined
02:33 sword865 joined
02:34 infinity0 joined
02:34 Swizec joined
02:35 <glguy> Jannoo: That's fine, you can come back and ask more questions
02:35 JoshS joined
02:35 <Jannoo> :)
02:35 louispan joined
02:36 marsam joined
02:37 Argue__ joined
02:37 JoshS joined
02:38 Koterpillar left
02:42 ocramz joined
02:45 Kundry_Wag joined
02:45 xkapastel joined
02:46 gfixler joined
02:49 justan0theruser joined
02:52 shoopaloop joined
02:53 louispan joined
02:53 Ferdirand joined
02:54 Argue_ joined
02:55 SimpleL joined
02:58 eh_eff joined
02:58 alienbot joined
03:00 takle joined
03:06 eklavya joined
03:07 shafox joined
03:08 <dfeuer> glguy: I'm wondering if it's possible to do something like https://www.reddit.com/r/haskell/comments/63a4ea/fast_total_sorting_of_arbitrary_traversable/ efficiently without resorting to erasure. That requires doing no more than O(log n) proof work per element, which seems like it might or might not be just barely possible.
03:09 <dfeuer> (Replacing the pairing heap with something more structured, of course, like a binomial heap)
03:09 louispan joined
03:10 tput joined
03:10 <dfeuer> This seems to require some efficient proofs of basic properties of binary representations, but the forms of proof are rather limited....
03:11 xall joined
03:13 plutoniix joined
03:13 kayrub joined
03:13 kayrub left
03:14 refold joined
03:14 takle joined
03:18 <glguy> dfeuer: I worked on some proofs about binary numbers in a fixed width context in Agda in the past https://github.com/copumpkin/bitvector/blob/master/Data/BitVector/Properties.agda#L88-L122
03:18 <glguy> We could look to see if things work out nicer before porting any of that to Haskell
03:19 <dfeuer> glguy: fixed-width? That doesn't seem too useful for my particular purpose; does it generalize well?
03:20 dsh joined
03:20 <dfeuer> glguy: BTW, I tried "faking up" the sort of thing I want to do with plain binary numbers in place of heaps, and the spot that I found hardest to approach was actually the "liftSort" function at https://gist.github.com/treeowl/9621f58d55fe0c4f9162be0e074b1b29#file-hstrav-hs-L41
03:21 <dfeuer> (well, the analogue of that, I mean)
03:21 <dfeuer> Things like associativity and properties of zero and commutativity all look like a horrible but straightforward slog.
03:22 <glguy> Would it be hard to make this a full repository instead of a list of pastes?
03:22 <dfeuer> [Oh, and depending on how things are arranged, I have concerns about runSort too)
03:22 moet joined
03:22 ocramz joined
03:23 HugoDaniel joined
03:23 etehtsea joined
03:23 <dfeuer> glguy: actually, michaelt made a repo of it (without my permission and without giving me any credit in the commits, which rankles a bit). https://github.com/michaelt/traversable-sort/
03:24 <lpaste> moet pasted “which maybe effect is best?” at http://lpaste.net/354392
03:24 <glguy> dfeuer: Send him a message letting him know he's posting your code without permission
03:25 felixsch__ joined
03:25 <dfeuer> glguy: I don't want to be too big a jerk, but I'll put up my own repo when I get a chance and let him know his isn't required any more.
03:25 Ferdirand joined
03:25 <glguy> Someone taking your code and releasing it under their own name as author and providing a license ot other people make him the jerk
03:26 <glguy> https://github.com/michaelt/traversable-sort/blob/master/LICENSE
03:26 <dfeuer> Yes, I saw that.
03:26 <dfeuer> I'm going to assume he wasn't paying attention....
03:26 <glguy> Maybe, but that's his problem
03:26 <dfeuer> Yes.
03:27 <moet> hi #haskell, just pasted to ask about what convention is preferred to run an effect only when the Maybe _ arg is present?
03:27 <dfeuer> I'll take care of it soon.
03:27 <dfeuer> Have you any thoughts about the challenge?
03:27 bollu joined
03:28 <dmj`> moet: Data.Foldable.forM_ maybeValue ioAction
03:29 <moet> dmj`: hmm.. forM_ seems almost intentionally misleading :P
03:29 <moet> but it's cute
03:30 <dfeuer> moet: misleading?
03:30 <dmj`> @typ forM_ (undefined :: Maybe a) (undefined :: a -> IO ())
03:30 <lambdabot> IO ()
03:30 doomlord joined
03:30 <dfeuer> Speaking of such things, I realized that traverse_ is actually quite different from traverse.
03:31 <moet> dfeuer: for is associated with loops :)
03:31 <moet> dmj`: yeah, it's correct, it's just less readable than i want
03:31 <moet> thanks tho :)
03:31 <dfeuer> moet: yes, in Haskell we conflate data structures with control structures, which is great for programmers and horrible for compiler writers.
03:32 Wuzzy joined
03:33 <ski> moet : think of it as looping over a collection that contains at most one element
03:33 <moet> hahaa.. don't tell the lispers that. they'll get jealous
03:33 <moet> ski: yeah, i get it.. it's cute
03:34 <Cale> moet: Perhaps forEachM would be clearer? But it's common enough to deserve a really short name.
03:34 <glguy> dfeuer: I haven't wrapped my head around all of this yet. Why is liftSort challenging in the binary context?
03:34 xall joined
03:35 <Cale> moet: Oh, you're talking about the way we can use it with Maybe types...
03:35 <dmj`> moet: runIOIfJust = forM_, problem solved
03:35 <Cale> moet: Yeah, the original setting where it was defined was just for lists.
03:35 <dfeuer> glguy: I don't really quite understand why, TBH. I just know I was struggling :-/
03:35 <Cale> moet: But we've generalised a bunch of things like that to operate over other sorts of collections
03:35 <dfeuer> Things not reducing, or maybe reducing too much?
03:36 <dfeuer> And I couldn't wrap my mind around what was going on there.
03:36 <dfeuer> And then I tried to fix it up and just made it worse.
03:37 <dfeuer> My current code is a godawful mess that probably needs to be thrown out (again).
03:40 <* nshepperd> suggests throwing a skew binary number system at the problem
03:41 <nshepperd> that seems to be the solution to all asymptotic complexity problems, from haskell talks i've seen :)
03:41 <dfeuer> Hah!
03:42 raycoll joined
03:42 otto_s_ joined
03:42 <dfeuer> Well, the skew binomial heap Okasaki presents seems too "flexible" to make it seem likely to be easy in this context.
03:42 <dfeuer> Maybe there's another form?
03:43 teggi joined
03:45 eh_eff joined
03:46 Koterpillar joined
03:47 Koterpillar joined
03:47 Koterpillar left
03:47 <dfeuer> glguy: it's quite possible that these struggles are just because I haven't developed much intuition about building formal proofs.
03:47 <dfeuer> And setting up operations to make those proofs easier.
03:47 <nshepperd> I don't actually understand any of these data structures, unfortunately
03:48 <glguy> That could be, or maybe it's just hard. I was just wondering about the particular type struggle you were encountering
03:48 Kundry_Wag joined
03:48 <dfeuer> nshepperd: the skew stuff is complicated. A plain binomial heap is actually quite straightforward. Okasaki's explanation is very readable.
03:48 andyhuzhill1 joined
03:49 <dfeuer> glguy: this is one of those cases where I know that I do not know but I do not know *what* I do not know :-(
03:49 takle joined
03:49 <dfeuer> I'll try to write up something sort of readable and come back with it and point to the troubles.
03:52 glguy__ joined
03:53 ubsan_ joined
03:53 glguy_ joined
03:53 LnL joined
03:56 eacameron joined
03:58 plutoniix joined
04:00 <adarqui> anyone have any favorite xml parsing library? i've never parsed xml in haskell.. not sure which library to use. i'm used to aeson/applicative parsers.
04:00 ryxai joined
04:02 <MarcelineVQ> I had some luck with HXT, my use was quite limited though, just reading info from an imageboard
04:02 eacameron joined
04:02 ocramz joined
04:04 <adarqui> cool
04:04 e_svedang joined
04:05 Edith joined
04:06 johnmendonca joined
04:08 des_ joined
04:09 mada joined
04:10 eacameron joined
04:10 <adarqui> i think im just going to convert the xml file to json, and parse the json file
04:10 <adarqui> seems easier hehe
04:12 LnL joined
04:14 peterbec` joined
04:15 ubsan_ joined
04:16 eacameron joined
04:16 takle joined
04:17 HugoDaniel joined
04:18 {emptyset} joined
04:19 <dmj`> what’s the best way to combine two Symbols into one
04:20 Rodya_ joined
04:21 JeanCarloMachado joined
04:21 Micamo joined
04:21 <glguy_> dmj`: with vim
04:22 <dmj`> glguy_: I was afraid of that :)
04:22 aarvar joined
04:22 <dmj`> we need type level Chars
04:22 jrm joined
04:23 vlatkoB joined
04:23 adolby joined
04:23 <dmwit> Do the python thing. Who needs Char when you have String?
04:24 <glguy_> Yeah, type lists of single character symbols
04:24 mbuf joined
04:24 eddie2pc joined
04:26 <dmj`> glguy_, dmwit: yea, seems that will have to do for now. Oh the verbosity.
04:29 shafox joined
04:29 thimoteus left
04:30 thimoteus joined
04:31 MrWoohoo joined
04:34 takle joined
04:35 <dmj`> Had this idea about using the Generic Rep of a data type to create SQL DDL statements. Would have been cool to see the SQL as a single Symbol, but alas.
04:36 jhrcek joined
04:37 eh_eff joined
04:37 pwnz0r joined
04:38 <jhrcek> Could someone please explain to me what Monad instance is getting used in the following do block? http://lpaste.net/354395 Is it reader by any chance?
04:38 <jhrcek> I mean "(->) r"
04:39 <ski> @type randomR
04:39 <lambdabot> (RandomGen g, Random a) => (a, a) -> g -> (a, g)
04:39 ddere joined
04:39 <jhrcek> I know i can write it more succintly, this is just simplified example from haskellbook.com. I'm just unsure about the do block
04:39 <ski> yeah, `(StdGen ->)'
04:40 <ski> the `do'-expression could be abbreviated to just `randomR (1,6)', by the right neutral element law
04:41 dan_f joined
04:41 <jhrcek> I'm wondering, Is there a way to tell in general what instance of monad is going to be resolved to in the do block?
04:42 lambdafan joined
04:42 <ski> looking at the types
04:42 ocramz joined
04:42 <ski> the type of `randomR (1,6)' there is `StdGen -> (Int,StdGen)'
04:43 <ski> which is `(StdGen ->) (Int,StdGen)', so `(StdGen ->)'s the monad
04:43 path[l] joined
04:44 <Jello_Raptor> hmm, does anyone know how I should generate a random (ideally uniform) sample from "Set of lists of nats with length L and sum N"?
04:44 <jhrcek> ski: ok, thanks
04:44 <MarcelineVQ> > do { (x,y) <- randomR (1,6); _; } -- holes can help if it's too inscrutable
04:44 <lambdabot> error:
04:44 <lambdabot> • Found hole: _ :: t -> b
04:44 <lambdabot> Where: ‘b’ is a rigid type variable bound by
04:44 <MarcelineVQ> > do { putStrLn "foo"; _; }
04:44 <lambdabot> error:
04:44 <lambdabot> • Found hole: _ :: IO b
04:44 <lambdabot> Where: ‘b’ is a rigid type variable bound by
04:44 <Jello_Raptor> getting that distribution sorta right isn't obvious to me
04:45 <ski> @type do { (x,y) <- randomR (1,6); ?hole }
04:45 <lambdabot> (?hole::t -> b, RandomGen t) => t -> b
04:45 connrs joined
04:46 cschneid_ joined
04:46 <ski> hm, if it was just lists with length and sum, it'd be multinomial ..
04:46 jbiesnecker joined
04:47 Xanather joined
04:47 <* ski> presumes Jello_Raptor is thinking of finite (sub)sets
04:48 <monochrom> ski, I think it is just that. The "set of" is there because "a random sample from that set". This means a programmer should strip the "set of" and just produce one list.
04:48 <dmj`> well well then https://ghc.haskell.org/trac/ghc/ticket/12162
04:49 <MarcelineVQ> dmj`: neat
04:51 dan_f joined
04:51 Jackoe joined
04:51 pera joined
04:53 significance joined
04:57 dan_f joined
04:57 BartAdv joined
04:57 jbiesnecker_ joined
05:00 raycoll joined
05:02 lambda-11235 joined
05:03 <dmj`> te3 :: Proxy (AppendSymbol "type" "level") -> Proxy "typelevel"
05:03 <dmj`> coming to a GHC near you
05:04 lithie joined
05:04 <nshepperd> dmj`: you could probably add that today, by writing a ghc type checker plugin similar to the ones for Nat
05:05 <nshepperd> manufacturing evidence that "type" ++ "level" ~ "typelevel"
05:05 dec0n joined
05:05 <nshepperd> and KnownSymbol instances for these things
05:06 <dmj`> nsheppard: nixpkgs might have the latest ghc
05:06 <* dmj`> checks
05:06 steeze joined
05:06 <dmj`> by latest I mean head
05:06 osa1 joined
05:06 osa1 joined
05:07 jbiesnecker joined
05:09 eklavya joined
05:10 Argue__ joined
05:10 takle joined
05:11 HugoDaniel joined
05:11 codesoup joined
05:12 dan_f joined
05:14 howdoi joined
05:18 tripped joined
05:19 <dmj`> heh, https://gist.github.com/dmjio/8ce1b87611aca8cdccc863c73e60cd8d
05:21 Rodya_ joined
05:21 Sh4rPEYE joined
05:22 darjeeling_ joined
05:22 connrs joined
05:22 fakenerd joined
05:22 ocramz joined
05:25 <mikeplus64> is there a way to get stack runghc to actually compile a hs file then run it? i think at the moment it simply uses runghc which runs the bytecode interpreter
05:28 plutoniix joined
05:28 takle joined
05:29 utdemir joined
05:29 Argue_ joined
05:29 <cocreature> mikeplus64: it seems like at that point you just want ghc. maybe write a wrapper script for "ghc File.hs -o out && ./out" or something like that
05:30 harfangk joined
05:32 danvet joined
05:33 Argue joined
05:34 insitu joined
05:36 jbiesnecker joined
05:37 eh_eff joined
05:38 piyush-kurur joined
05:38 takle joined
05:41 athan joined
05:42 sz0 joined
05:42 kritzcreek_ joined
05:42 iqubic joined
05:42 <iqubic> Hello guys.
05:43 jgt1 joined
05:43 SimpleL joined
05:43 jbiesnecker joined
05:44 joe9 joined
05:46 mstruebing joined
05:47 jbiesnecker_ joined
05:48 <joe9> I am trying to figure out how a bytestring is internally represented. For example, Is there a size at the beginning of the memory? How big is this size byte? Is there a null character at the end?
05:48 <joe9> any suggestions, please?
05:48 <joe9> I cannot find anything in the Data.ByteString hackage module about it.
05:48 sanett joined
05:49 <dmj`> joe9: did you check the source
05:49 <joe9> no. Data.ByteString.pack? it is calling packBytes. Let me check that.
05:50 steeze joined
05:50 Kundry_Wag joined
05:50 <pacak> joe9: It's a raw block of memory + two ints - one for offest to beginning, one for length
05:50 <pacak> joe9: There's no null character
05:50 <pacak> http://hackage.haskell.org/package/bytestring-0.10.8.1/docs/src/Data-ByteString-Internal.html#ByteString
05:50 <joe9> Thanks. pacak
05:51 <johnw> joe9: hi
05:51 <johnw> joe9: internally, ByteString use a data structure called PS
05:51 <johnw> it has three fields: Ptr into a block of pinned, allocated memory; an offset into this region, and a length of bytes used
05:52 ThomasLocke joined
05:52 ThomasLocke joined
05:53 <joe9> johnw: Thanks.
05:53 robotroll joined
05:53 meandi_2 joined
05:56 takle joined
05:56 <cocreature> is there any particular reason why bytestring uses a ForeignPtr instead of a ByteArray#?
05:56 _sg joined
05:56 <cocreature> it does use ByteArray# for short bytestrings which makes this even more confusing
05:57 Unode joined
05:57 <pacak> cocreature: I suspect historical reasons.
05:59 <cocreature> pacak: it’s slightly disappointing how every time I expect that there is some deep reason for how something it is implemented, it turns out it’s just due to historical reasons :)
05:59 <johnw> it uses ForeignPtr, but it's a very special kind
05:59 <johnw> it contains no finalizer
05:59 <johnw> it's just there so that the GC gets involved once the ByteString is unreferenced
05:59 <cocreature> right, but GC also collects ByteArray#
06:00 <johnw> it allocates the ForeignPtr using mallocPlainForeignPtrBytes, which has some very specialized behavior
06:00 Rodya_ joined
06:00 quchen joined
06:01 <johnw> internally, this function calls newPinnedByteArray#
06:01 <johnw> so, I believe it *is* a ByteArray#
06:01 <cocreature> oh ok
06:01 thatguy joined
06:01 <iqubic> What is ByteString?
06:01 <cocreature> iqubic: https://hackage.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString.html
06:01 plutoniix joined
06:02 hurkan joined
06:02 <johnw> if you ever want to deal with "chunks of bytes" in Haskell, you often use ByteString
06:02 <pacak> A pinned one which might result in memory fragmentation if you are not careful.
06:02 <johnw> yes, quite true
06:02 ocramz joined
06:02 raichoo joined
06:03 <cocreature> that’s why there is ShortByteString :)
06:03 plutoniix joined
06:03 Ornedan_ joined
06:04 Croniamental joined
06:05 zeroed joined
06:05 HugoDaniel joined
06:06 itachi joined
06:07 e_svedang joined
06:09 jluttine joined
06:10 cur8or joined
06:10 fizruk joined
06:10 benl23 joined
06:11 Unode joined
06:14 takle joined
06:14 jbiesnecker joined
06:15 e_svedang joined
06:16 thatguy joined
06:17 raycoll joined
06:17 takuan joined
06:18 <* ski> looks at Jello_Raptor
06:18 <* MarcelineVQ> looks at niteria
06:20 uuplusu joined
06:21 JeanCarloMachado joined
06:22 harfangk joined
06:23 Croniamental joined
06:23 Jackoe joined
06:25 jbiesnecker joined
06:25 zeroed joined
06:25 eacameron joined
06:25 adolby joined
06:25 <* pacak> looks around
06:32 volhovm joined
06:32 juhp__ joined
06:32 takle joined
06:33 <volhovm> Hello everyone. Does servant have any out-of-box support of multipart form data except for the `servant-multipart` package?
06:33 <volhovm> Why is `servant-multipart` so unpopular then?
06:33 warlock joined
06:34 jbiesnecker joined
06:34 stevenxl joined
06:34 <cocreature> volhovm: what makes you think it’s unpopular?
06:34 <johnw> if anyone is willing, I'd appreciate comments on some slides meant to show practical uses of lenses: https://github.com/jwiegley/putting-lenses-to-work
06:35 <volhovm> 17 downloads on hackage
06:35 <volhovm> http://hackage.haskell.org/package/servant-multipart-0.10
06:35 <johnw> i'll be presenting it Saturday at BayHac, so open an issue if you have comments and I'll integrate them tomorrow
06:35 mda1 joined
06:35 <pacak> Thu Mar 2 01:25:19 UTC 2017
06:35 <cocreature> iirc the download numbers are mostly broken atm. they don’t track stack and I think the hackage cdn also isn’t counted
06:36 jbiesnecker_ joined
06:36 <volhovm> cocreature: got it, thanks :)
06:36 ubsan_ joined
06:36 infinity0 joined
06:37 <cocreature> volhovm: also speaking from personal experience, I usually just have APIs that send and receive json and don’t do any file uploads. but then again I also do very little webdev :)
06:37 AndreasK joined
06:38 <Jello_Raptor> ski: oh cool, let me see if I can figure out how turn this into a function I can use :)
06:38 <wavewave> pinned bytearray cannot be used in compact region.
06:39 Salih joined
06:39 <cocreature> wavewave: compact region as in the fancy stuff we get in 8.2?
06:39 <wavewave> yes.
06:39 yoneda joined
06:40 <wavewave> cocreature: you can see some examples here: https://github.com/ezyang/compact
06:41 <wavewave> it allows for manual memory management in a sense.
06:42 <cocreature> luckily I’m rarely in the position where I need that :)
06:42 takle joined
06:42 ocramz joined
06:43 <wavewave> it should be very useful if a program hold a large long-running resource in the heap.
06:45 <MarcelineVQ> johnw: Getter Iso and Setter show up suddenly in the vocabulary review but they aren't mentioned previously in slide form so I assume it's review of verbal items. This is really quite nice btw, first time seeing most of these and makes a good case for them
06:45 <cocreature> yeah I can definitely see it being useful. I just doubt that I personally need it :)
06:52 <wavewave> i also doubted that i needed it until when I had to parse ~100GB JSON file. ;-)
06:52 edsko joined
06:52 alfredo joined
06:52 takle joined
06:52 Jackoe joined
06:52 <MarcelineVQ> what about compact regions assists that sort of task?
06:53 oish joined
06:54 fotonzade joined
06:54 nick_h joined
06:55 ragepandemic joined
06:55 prophile joined
06:55 eatman joined
06:55 insitu joined
06:56 <cocreature> MarcelineVQ: you can put the parsed json value in a compat region and avoid the GC tracing through it
06:56 <wavewave> cocreature: yes
06:57 <wavewave> I think it can reduce GC overhead significantly especially when doing parallel processing.
06:57 magneticduck joined
06:57 MoALTz joined
06:58 <cocreature> wavewave: I’m confused. how is the compact region freed? the examples don’t seem to free explicitely and I don’t see anything in the API for that.
06:58 <cocreature> oh it’s still GCed
06:58 <wavewave> my program used almost over 80% of time doing GC when i used 20 CPUs. I want that GC time waste to be reduced.
06:59 <cocreature> but then calling it “Non-GC'd, contiguous storage for immutable data structures.” seems confusing
06:59 <cocreature> it’s just gced all at once or not at all if I understand this correctly
07:00 HugoDaniel joined
07:00 <wavewave> it's only one-time GCed, i think
07:01 <cocreature> I guess I should read the paper at some point :)
07:01 <Cale> Oh, interesting
07:01 <Cale> Does this thing mean we can serialise IO actions?
07:01 <wavewave> when there are no compact pointer remained.
07:01 hololeap joined
07:01 <wavewave> Cale: does it mean that?
07:02 takle joined
07:02 <Cale> oh, apparently not
07:02 <Cale> "The object in question must not contain any functions or mutable data; if it does, compact will raise an exception"
07:02 <wavewave> ah. yeah. it gives run-time error.
07:02 <ski> how about `Handle's ?
07:03 <wavewave> for example, if one uses pinned bytearray.
07:03 <ski> are they considered mutable here ?
07:03 <cocreature> it is still pretty neat to be able to serialize data structures without functions
07:03 <cocreature> ski: they contain an mvar somewhere, don’t they?
07:03 <cocreature> or am I confusing that with some socket type
07:04 <cocreature> nope they do
07:04 <cocreature> I doubt that’ll work
07:04 raichoo joined
07:04 <Cale> Yeah, still pretty neat, though one thing I've always thought would be really cool is if a program could "pause" by essentially writing its continuation to disk, and reloading it on next run.
07:06 <wavewave> compact region cannot contain thunks.
07:06 <* ski> . o O ( "FPL Marshalling Survey" by Joachim Durchholz in 2004-05-03 at <https://web.archive.org/web/20070706205236/http://durchholz.org/jo/fpl-marshalling-survey/index.html> )
07:06 <wavewave> it's kinda alternative to deepseq in terms of evaluation.
07:07 <Cale> yeah
07:08 <wavewave> I think compact region will have great impact on parallel computing in haskell.
07:09 cspollard joined
07:10 <ski> cocreature : like `exportML' and `exportFn' in SML/NJ at <http://www.smlnj.org/doc/SMLofNJ/pages/smlnj.html> ?
07:10 <ski> er
07:10 <ski> Cale ^
07:10 thc202 joined
07:10 <peddie> johnw: if I'm not mistaken, slide 37, wrong example for map with an absent key?
07:11 vlatkoB_ joined
07:11 <Cale> ski: Yeah, a lot like that :)
07:11 Croniamental joined
07:11 HugoDaniel joined
07:12 jennyrgb joined
07:12 <jennyrgb> can I see the definition of a function?
07:12 <ski> (also in MLton <http://www.mlton.org/MLtonWorld>. and i believe in some lisp systems)
07:13 <jennyrgb> I want to add two patterns for a function in ghci, can that be done?
07:13 ventonegro joined
07:13 orbifx joined
07:13 <Cale> jennyrgb: You can put semicolons between them to smush the whole definition on to one line, or use :{ and :} to make a multiline definition
07:14 eklavya joined
07:14 <Cale> However, if you're making multiline definitions, usually just put that stuff in a file and load it
07:14 <* ski> suspects jennyrgb wants to adapt (extend ?) an existing definition
07:14 <Cale> It's really easy to lose the contents of your ghci session, so don't put stuff in there which it would be even mildly irritating to lose
07:14 Cogitabundus joined
07:15 ocramz joined
07:15 <Cale> oh, extend an existing definition? Not really, though you could define a new function which uses the original one.
07:15 ccomb joined
07:15 albertid joined
07:15 <ski> so i suppose the question then is whether open recursion would be required
07:16 raichoo1 joined
07:17 <ski> jennyrgb : there's no mechanism to adapt a definition in general, nor to see the source. the package docs often has links to source. which function in particular would you like adapted (and how) ?
07:17 <tsahyt> I just noticed that maxCommutes from the constraints package is wrong
07:17 <tsahyt> https://github.com/ekmett/constraints/blob/master/src/Data/Constraint/Nat.hs#L206
07:17 <tsahyt> unless I'm much mistaken
07:17 <cocreature> tsahyt: make a PR to fix it :)
07:18 <tsahyt> cocreature: Should I just go and make a PR straight away or post it as an issue first?
07:18 <cocreature> tsahyt: just go for a PR straight away
07:19 takle joined
07:20 Gothmog_ joined
07:21 Gothmog_ joined
07:21 Rodya_ joined
07:25 dmwit_ joined
07:25 fizruk joined
07:25 eh_eff joined
07:26 mattyw joined
07:26 <nak> :t runContT
07:26 <lambdabot> forall k a (m :: k -> *) (r :: k). ContT r m a -> (a -> m r) -> m r
07:27 guiben joined
07:27 mohsen_ joined
07:28 <nak> so if i had a ContT r Identity a, runContT would return an Identity a ?
07:28 Elish joined
07:28 alfredo joined
07:28 <nak> is that normal for monad transformers to return a monad of the transformed type (m) from their run* function ?
07:28 prophile joined
07:29 <Cale> nak: assuming you gave it a continuation of type (a -> Identity a)
07:29 free_beard joined
07:29 <Cale> yes, that's normal
07:29 Gothmog_ joined
07:29 <Cale> also, don't say "return a monad", because the monad is a type level thing -- they return an action in the monad m
07:30 <nak> ok ^^
07:30 Gothmog_ joined
07:30 <Cale> e.g. IO, Maybe, State s, are examples of monads, but getLine, Just 4 and put "hello" aren't.
07:30 <nak> Cale i'm lookin at: runCont m k = runIdentity (runContT m (Identity . k))
07:30 bennofs joined
07:31 <Cale> right
07:31 Gothmog_ joined
07:31 <nak> so here I see it's manually handling the runIdentity stuff because runCont is aware of Identity as an implementation detail
07:31 <Cale> That's because Cont is defined in terms of ContT, yeah
07:32 Gothmog_ joined
07:32 <nak> Cont r = ContT r Identity)
07:32 <nak> yeah
07:33 takle joined
07:33 <nak> ok so ContT handles removing its outer box (in runContT) and the derived monad (Cont) handles removing the inner box (in runCont)
07:33 <nak> is this pattern sort of normal too?
07:34 <Cale> box?
07:34 <phadej> quite common yes, we define `FooT` and `type Foo = FooT Identity`
07:34 Edith joined
07:34 <nak> cale i just mean the monad container
07:34 <nak> sorry i don't know the words very well
07:34 <Cale> Are you talking about which data constructor is being pattern matched?
07:35 <nak> Cale i guess i' trying to get at the monad transformer *interface*, as some sort of generic template
07:36 javjarfer joined
07:36 <nak> Monad is so nicely defined with return and >>=
07:36 _sras_ joined
07:36 <Cale> A monad transformer is a type level function of kind (* -> *) -> (* -> *) which, given a monad, produces another monad
07:37 <_sras_> Is there any way to stop GHCI from displaying all the loaded modules in repl?
07:37 <Cale> and moreover, it has an instance of MonadTrans
07:37 <Cale> which provides just a single method called lift
07:37 <Cale> :t lift
07:37 <lambdabot> (Monad m, MonadTrans t) => m a -> t m a
07:37 <Cale> lift turns an action in some monad m, into an action in the transformed monad t m
07:38 <Cale> and it needs to do this in a way which is compatible with return and bind
07:38 <nak> ah MonadTrans is what I was looking for ^_^
07:39 <nak> lift . return = return ?
07:39 <Cale> Yeah, lift (return v) = return v, and lift x >>= (\v -> lift (f v)) = lift (x >>= f)
07:39 <nak> i've never seen (lift . return) on the left of an =
07:39 <nak> or (f . g) = ...
07:39 Itkovian joined
07:39 <nak> even `lift (m >>= f) = lift m >>= (lift . f)` is confusing
07:39 <Cale> Well, this is a mathematical equation which needs to be true, rather than Haskell syntax proper
07:39 <nak> ah! so a contract of sorts
07:40 <nak> or a law?
07:40 <Cale> yes
07:41 alfredo_ joined
07:41 <Cale> Basically, what it amounts to is that if you take a bunch of actions in the original monad, lift them all separately and put the results together using the monad operations, the result will be the same as if you put them together in the original monad and lift the result.
07:41 <nak> is there a reason i'm not seeing an IOT transformer?
07:42 <Cale> For a few reasons.
07:42 permagreen joined
07:43 <nak> ah makes sense (re: "Basically, what it amounts to ...") - it reminds me of function composition laws or the regular monad laws. the notation was just screwing with me
07:43 <Cale> One is that IO is opaque and implemented in terms of low level hackery, rather than being defined as some sort of free monad with an interpreter.
07:43 bollu joined
07:43 itsu joined
07:44 oish joined
07:44 <_sras_> Is there any way to stop GHCI from displaying all the loaded modules in repl?
07:44 <Cale> _sras_: why?
07:44 <cocreature> _sras_: :set prompt "> "
07:44 <Cale> oh
07:45 <Cale> Yeah those modules :)
07:45 <cocreature> put that in your ~/.ghci if you want ghci to always behave this way
07:45 <Cale> you may also want to set prompt2, which is the prompt used for continuation lines
07:46 <nak> Cale: interesting re: IO. how does one go about something like IO (Either e a) then ?
07:46 <Cale> EitherT e IO ?
07:46 <_sras_> Cale: cocreature Yes. It works. Thanks guys.
07:47 <magthe> any clever way to take the two first values from a list and pass them to a function (foo :: a -> a -> b)? (besides pattern matching)
07:47 itsu left
07:47 <nak> Cale isn' Either of IO different than IO of Either ?
07:47 <Cale> nak: The other reason is that it wouldn't make a very useful transformer anyway, because running it would be weird
07:48 <Cale> It is.
07:48 <Cale> Either e (IO a) is quite different
07:48 <Cale> newtype EitherT e m a = EitherT { runEitherT :: m (Either e a) }
07:49 <Cale> So, internally, an EitherT e IO a action consists of an IO (Either e a) action.
07:49 <nak> ... very weird ...
07:49 <Cale> Not that weird.
07:49 <Cale> This is the only way around that it actually makes sense to define a transformer :)
07:50 <Cale> If you try to do it the other way, then in some cases you just wouldn't have an action in the base monad at all.
07:50 <nak> ok so like ContT r Identity
07:51 <nak> how can i picture them?
07:51 <nak> Cont of Identity? or Identity of Cont?
07:51 takle joined
07:51 <Cale> I guess both, but only because it's the same as Cont
07:52 <Cale> and composing with Identity doesn't do much
07:52 <nak> MaybeT Foo => Foo of Maybe? or Maybe of Foo?
07:52 <Cale> But otherwise neither
07:52 detrumi joined
07:52 <Cale> ContT r [] a is neither [Cont r a] nor Cont r [a]
07:53 <nak> ah right
07:53 <nak> does that make ContT exceptional in this regard?
07:53 <Cale> and in general you shouldn't expect that to work -- composing monads that way tends not to produce a monad except in fairly special cases
07:53 chaosmasttter joined
07:53 <Cale> However, EitherT and MaybeT both work like that
07:54 <nak> interesting. i always thought the transformers were named after the outer type, not the inner type
07:54 <Cale> ReaderT and WriterT actually just happen to as well, so I guess it's easy to get misled :)
07:54 CurryWurst joined
07:55 <Cale> ReaderT affects the outside though, and WriterT affects the result
07:55 <Cale> newtype ReaderT e m a = ReaderT { runReaderT :: e -> m a }
07:55 <Cale> newtype WriterT w m a = WriterT { runWriterT :: m (w,a) }
07:55 <Cale> (or (a,w))
07:56 <Cale> StateT does both:
07:56 <Cale> newtype StateT w m a = StateT { runStateT :: s -> m (s,a) }
07:56 <jennyrgb> isn't there a reload command for the file I just loaded?
07:56 <Cale> :r
07:57 <Cale> oops, that w was meant to be an s :)
07:57 <Cale> also, while I prefer (s,a) as the order, the mtl and transformers libraries use (a,s), I should probably just be writing it that way :)
07:58 <Cale> The reason I prefer (s,a) is that (,) s is itself a functor
07:58 <tsahyt> Cale: but what if you want to map over the state
07:58 <Cale> heh
07:58 <bartavelle> glguy, about the haskeline + commands stuff you showed me last time in your IRC client, it turns out that integrating optparse-applicative into haskeline isn't too hard!
07:59 <nak> cale all very useful information thank you :)
07:59 <Cale> tsahyt: Then you want (,) to be a functor Hask -> (Hask -> Hask)
07:59 <phadej> bartavelle: it isn't; but last time I checked wasn't trivial either
07:59 <Cale> tsahyt: and then you can use the resulting natural transformation ;)
07:59 <nak> i'm reading a category theory book right now. i'm hoping it helps me with some fundamentals of fp in general
07:59 <tsahyt> Cale: I think I'll stick with Bifunctor for practical reasons
07:59 <Cale> tsahyt: :D
08:00 <Cale> nak: Some for sure.
08:00 <bartavelle> phadej, well, the main problem is that the help message very much looks like that of a command line program (go figure), but now I realized that both libraries have auto-complete capabilities, so I'll see if it is easy to use
08:00 <Cale> nak: It's a definite sidetrack if your interest is just to be an excellent Haskell programmer.
08:00 MejGun joined
08:01 Prutheus joined
08:02 <Cale> nak: But especially if you have interests in other areas of mathematics as well, it can be very worthwhile, and there's lots of stuff in there which helps to find the "right" definitions when approaching some new area of study.
08:04 dbecvarik left
08:04 Beetny joined
08:04 <phadej> bartavelle: you can modify the optparse-applicative quite a lot, but (last time I checked) not all building blocks were exported
08:04 <phadej> e.g. I did tab-completion to editline input
08:05 <phadej> but had to copy&paste some internals to run optparse-applicative Parser in pure context
08:05 <bartavelle> ah :(((
08:05 <bartavelle> I don't really mind running it in IO, this is quick'n'dirty interface
08:05 <phadej> but it was in optparse-applicative-0.11 or so time; so I have no idea about current state of affairs
08:05 <phadej> bartavelle: IIRC editline tab-completion wants pure function
08:06 Yuras joined
08:06 <bartavelle> alright, that sucks
08:06 <bartavelle> thanks for the feedback though!
08:07 <phadej> or no, it doesn't make sense; how you could fill the files from the fs
08:07 __main__ joined
08:07 <phadej> completionMatches :: String -> (String -> IO [String]) -> IO (Maybe (String, [String]))
08:07 <phadej> maybe the reason was exactly that I don't want the "Usage: ..." printed if match fails
08:07 <phadej> sorry, I cannot find my experiments anymore ;(
08:08 nathyong joined
08:09 thebored joined
08:09 takle joined
08:10 <bartavelle> np
08:10 cspollard joined
08:11 <jennyrgb> so patterns are matched in the order they're defined?
08:12 mstruebing joined
08:12 nathyong joined
08:13 CurryWurst joined
08:13 <cocreature> jennyrgb: yep, the pattern that comes first in a definition/case clause will be tried first and so on
08:13 lep-delete joined
08:14 yellowj joined
08:14 oish joined
08:16 grillon_ joined
08:17 oisdk joined
08:21 xall joined
08:21 marr joined
08:22 CurryWurst joined
08:23 marfoldi joined
08:23 ph88^ joined
08:24 mekeor joined
08:25 <ph88^> hi guys, can anyone sport opportunities to refactor this code any further? https://bpaste.net/show/f15dc955f7ce
08:25 refold joined
08:25 pushp0p joined
08:26 lithie joined
08:26 gregman_ joined
08:27 ogrady joined
08:27 free_beard joined
08:27 Swizec joined
08:28 <dysfun> ph88^: you could use 'maybe' from Data.Maybe to shorten it a bit
08:28 <dysfun> oh no, it's an Either, so 'either' from Data.Either
08:28 fizruk joined
08:29 <dysfun> ah no, you can't, my mistake
08:33 <cocreature> ph88^: you could replace eitherLookup by "maybe (Left errorMessage) Right (HL.lookup key table)" but it’s questionable whether that’s more readable
08:33 litchblade joined
08:33 daniel-s joined
08:34 <cocreature> ph88^: using otherwise in the last case of a case statement is slightly weird. you probably want to use _ here. -Wall will show you that the variable "otherwise" is unused
08:35 stevenxl joined
08:35 Gurkenglas joined
08:37 CurryWurst joined
08:37 doubleleft joined
08:38 juhp__ joined
08:38 <doubleleft> forever (do
08:38 <doubleleft> putStr "λ> "
08:38 <doubleleft> input <- getLine
08:38 <doubleleft> interprete input
08:38 <doubleleft> )
08:38 <geekosaur> @paste
08:38 <lambdabot> Haskell pastebin: http://lpaste.net/
08:39 <geekosaur> please don't paste code into the channel
08:39 r0073r joined
08:39 <doubleleft> sorry, http://lpaste.net/354402
08:40 dni joined
08:41 <doubleleft> Why does the action 'putStr "\> " work unexpected ?
08:41 <doubleleft> But in ghci it works well
08:41 <cocreature> doubleleft: what do you mean by "works unexpected"?
08:42 mfukar joined
08:42 <geekosaur> at a guess, you are in default buffering mode when you compile but ghci runs unbuffered
08:42 <doubleleft> I want it will print "\> " before input something but it won't
08:43 <geekosaur> hSetBuffering stdout NoBuffering
08:43 Swizec joined
08:43 takle joined
08:43 aarvar joined
08:44 eacameron joined
08:45 Lemmata joined
08:45 dawehner joined
08:45 xdqioh joined
08:46 <adarqui> hey, anyone experiencing this with haskell-persistent: when i store a [Text] array in the db, my strings have an 's' prepended to them. i could just be losing my mind though.. but, before the values go into the db, i dont have an 's' prepended.. in the db i have ["sblah"] .. when i pull the entry out of the db via select etc, it doesn't have the 's' prepended, iget the expected ["blah"]
08:47 <doubleleft> geekosaur: thx, it works well
08:49 jeltsch joined
08:49 Gurkenglas_ joined
08:49 <geekosaur> adarqui, persistent type-tags things it stores. it's not a quick and dirty way to store data that other things can use
08:50 <adarqui> ah so, persistent is definitely type-tagging and adding that 's' then
08:50 <adarqui> i'll double check the docs but, if that's the case, it makes sense
08:50 <adarqui> i've just been trying to figure it out for 30 minutes and started to think, this has to be something with persistent
08:51 rzl__ joined
08:51 cspollard joined
08:52 patbecich joined
08:52 Einwq joined
08:54 govg joined
08:55 <geekosaur> I suspect it always uses varchar columns for db storage because database column types don't necessarily map to haskell types, even for "atomic" types. so it needs to tag the data it stores
08:56 slomo joined
09:00 tobhe joined
09:02 patbecich joined
09:03 <adarqui> thanks!
09:03 vaibhavsagar joined
09:04 sepp2k joined
09:05 koneko joined
09:05 jaspervdj joined
09:05 locallycompact joined
09:06 cspollard joined
09:07 jasondockers_ joined
09:09 mmn80 joined
09:12 shafox joined
09:12 bennofs joined
09:12 richi235 joined
09:13 tobhe joined
09:15 tobhe joined
09:20 mtesseract joined
09:20 jgertm joined
09:20 t0by joined
09:20 t0by joined
09:21 LiaoTao joined
09:22 MindlessDrone joined
09:22 louispan joined
09:23 unK_ joined
09:24 darjeeling_ joined
09:25 takle joined
09:30 _sg joined
09:30 gyaresu joined
09:33 oaao joined
09:33 mtesseract joined
09:33 eacameron joined
09:34 ub joined
09:34 soLucien joined
09:35 mlehmk joined
09:36 dhil joined
09:39 kuribas joined
09:40 nighty-- joined
09:41 <kuribas> If an operation has O(log n) amortized time, but O(n) worse case, isn't it possible to have worst case repeatedly when reusing the datatype?
09:42 <kuribas> Like in not using the modified structure?
09:42 eacameron joined
09:45 augur joined
09:45 <pacak> Depends. O(n) might be caused by having to evaluate a bunch of thunks and even if you ignore modified structure you will still get updates in your original one.
09:46 <kuribas> hm right
09:46 Einwq joined
09:47 sphinxo joined
09:47 <jennyrgb> do the haskell project suffer from SJW-ism or is it safe to contribute?
09:47 thatguy joined
09:48 Ferdirand joined
09:48 <jennyrgb> gave ghci a look. I'm sure they don't want to refactor it, but there are great improvements to be done without changing the specs
09:48 dni joined
09:48 <jennyrgb> if it's hosted on github though, I'm out. Not touching that SJW place ever again.
09:49 Alex____ joined
09:50 <pacak> jennyrgb: What would you improve?
09:51 <kuribas> what's SJW?
09:52 aidalgol joined
09:52 markus1189 joined
09:52 mtesseract joined
09:52 eacameron joined
09:53 azahi joined
09:54 Kundry_Wag joined
09:54 <jennyrgb> kuribas: first result on google (sjw github) https://github.com/opal/opal/issues/941 we've had massive such spam lately, our bug report system got clogged up with stuff like that
09:55 <jennyrgb> kuribas: in the end github decided to remove one of our projects because it had the word "retard" in the comment somewhere in our 10M line of code, so we had to move it all.
09:55 <jennyrgb> kuribas: think I'm bullshitting? Maybe that thought should give you an estimate on how crazy it has become.
09:56 <kuribas> that's insane
09:56 <pacak> jennyrgb: I don't think I saw discussion like that in Haskell projects. But coming back to ghci - what would you improve?
09:57 <jennyrgb> there are github users with staff status that does nothing else than ask random projects to add a feminist CoC to their projects.
09:57 <zomg> I'm not hugely inclined to think that a project where one of the maintainers uses the anonymous logo as their avatar is particularily impartial on matters such as this
09:57 <kuribas> jennyrgb: my rule no 1 is, keep it to technical issues.
09:58 <zomg> at least as far as this irc channel goes, I've never seen any big issues with anything like that
09:58 <kuribas> jennyrgb: I don't see how it relates to haskell though...
09:58 <jennyrgb> good to hear
09:58 <kuribas> Most of the people here are friendly and tolerant.
09:59 <kuribas> Much more tolerant the me actually :-O
09:59 <zomg> a lot of places are tolerant but the way they deal with people perceived to... shall we say push the envelope... is sometimes problematic
10:00 <kuribas> I am often surprised in other irc channels
10:00 <zomg> the issues I've seen here have always been resolved in a sensible manner which is more than what I can say about some other places
10:01 <jennyrgb> I raelly don't care about race, sex, gender, orientation, color, identity, culture or whether someone is a nazi or eat dogs and babies. It has nothing to do with haskell. Problem with SJWs is that they find racism and "problems" in everything though. They used to fill up 70% of the mails in the mailinglists with long threads about changing "problematic" UNIX terminology in Linux such as "kill". Linus just banned them and told them to F off.
10:01 <zomg> Linus may be a dick but on that I would agree with him
10:01 <zomg> lol
10:02 <aidalgol> jennyrgb: you don't happen to have a link handy to that in the archives, do you?
10:02 <jennyrgb> off topic, but just a taste https://github.com/nodejs/node/issues/3721
10:02 <zomg> lol yeah nodejs is the worst when it comes to this...
10:03 <jennyrgb> aidalgol: it's a never ending shitlist https://hacked.com/sjws-trying-frame-linux-creator-linus-torvalds-fake-sexual-assault-charges/ I could talk about this all day :D but I don't want to be ot
10:03 <kuribas> zomg: he may be a dick, but it's only when people push him...
10:04 <kuribas> zomg: I think his rants are quite funny
10:04 <* ski> . o O ( "The idea of anathematising all of a person’s good works because of something else they said or did .." <https://medium.com/@maradydd/when-nerds-collide-31895b01e68c>)
10:05 mda1 joined
10:05 <zomg> it will be interesting to see what happens with this stuff tbh
10:05 <kuribas> jennyrgb: but I think they will appreciate contributions if they are substantial, not just cosmetic...
10:06 <zomg> with the nodejs community, there's almost an air of terror there
10:06 <zomg> you're constantly being watched for slipping up and someone is compiling a list of it
10:06 uglyfigurine joined
10:06 <zomg> I'm not even joking, I had this done on me, and I know of others too
10:07 <zomg> and I'm not even a contributor, just some random guy who was on their irc channel helping people solve their problems :P
10:07 <reactormonk[m]> zomg: the internet never forgets?
10:07 nbro joined
10:07 eacameron joined
10:07 <zomg> reactormonk[m]: Tolerance-KGB gonna knock on your door
10:07 <zomg> :P
10:07 <geekosaur> could someone explain to me when this channel became the trump zone?
10:08 <zomg> don't get me wrong, I think the ideas are good
10:08 <nbro> reading this article "https://wiki.haskell.org/Do_notation_considered_harmful" it says "Newcomers might think that IO is somehow special…" isn’t that true? IO operations are special with respect to other type of computations!
10:08 <zomg> it's the people enforcing them who are the problem, just like in any system like that
10:08 <aidalgol> oh good, an on-topic question.
10:08 <Taneb> nbro, IO is special because it's the type of main
10:09 <kuribas> nbro: they are, but do notation isn't
10:09 <geekosaur> take the politics elsewhere
10:09 <Taneb> And when the program is ran, "main" is what is executed
10:09 <Taneb> However, they are semantically values just like everything else
10:09 <kuribas> nbro: it's (>>=) and (return) which are special
10:09 flaviodesousa joined
10:09 ubsan joined
10:09 <Taneb> You can have a list [print 1, print 2] just fine and nothing will be printed
10:09 <Taneb> > length [print 1, print 2]
10:09 <lambdabot> 2
10:10 <kuribas> their implementation is magic
10:10 <pacak> Do notation is just a syntactic sugar that gets desugared to Monad or Applicative typeclass.
10:10 <reactormonk[m]> mostly Monad. For Applicative, you need the ApplicativeDo language extension.
10:11 <Iceland_jack> nbro: Mentally Separate "Monad" / "do-notation" / "IO" and consider the question for each of those
10:11 <pacak> That is (>>=) / return / join for Monad or (<*>) / pure for Applicative
10:11 <nbro> So I would say the do notation is also special in the sense that it’s a syntactic sugar construct to allow to handle monadiac opeations..
10:11 <geekosaur> > do 5
10:11 <lambdabot> 5
10:11 <geekosaur> not that special...
10:11 <pacak> > do (return 5) :: Maybe Int
10:11 <lambdabot> Just 5
10:12 <pacak> No IO, but do.
10:12 <Iceland_jack> > do (return 5) :: [Int]
10:12 <lambdabot> [5]
10:12 <mlehmk> that way IO isn't special
10:12 <mlehmk> it's just like Maybe etc.
10:12 <nbro> I think the problem now is what we consider special
10:12 <nbro> lol
10:13 <Iceland_jack> good observation
10:13 <pacak> You need IO if you want to launch missiles or feed a cat.
10:13 <Alex____> I am pretty new to Haskell, I'd appreciate some help regarding my small question ^^ https://pastebin.com/BLh8HwTD
10:13 phaji joined
10:13 <kuribas> IO isn't special in that it operates outside of the language, like ($)
10:13 coot joined
10:13 <mlehmk> IO could have been called World, as being the state machine
10:14 <ski> Alex____ : use `case' rather than `head'
10:14 <mlehmk> input output to world state
10:14 <pacak> Alex____: pattern match. Or listToMaybe
10:15 <kuribas> Alex____: you want find instead of filter
10:15 <kuribas> :t find
10:15 <lambdabot> Foldable t => (a -> Bool) -> t a -> Maybe a
10:15 <Alex____> Feels like everyone is saying different things ^^
10:16 <geekosaur> pattern match and case are the same thing
10:16 <mlehmk> or they are saying the same things from a differen pov
10:16 <geekosaur> the others are alternative approaches
10:16 <pacak> listToMaybe + filter is the same as find
10:17 <kuribas> Alex____: find p = listToMaybe . filter p
10:18 tomboy64 joined
10:19 sphinxo joined
10:20 <Alex____> You mean like this; https://pastebin.com/pPhN3yuN ?
10:20 uuplusu joined
10:20 VKIND joined
10:20 <pacak> find will give you Maybe
10:21 cchalmers joined
10:21 <pacak> so if you want to use that with zip you need to convert it back to list O_O
10:21 <pacak> :t maybe [] (:[])
10:21 <lambdabot> Maybe t -> [t]
10:21 <pacak> Hmmm...
10:21 <pacak> :t lookup
10:21 <lambdabot> Eq a => a -> [(a, b)] -> Maybe b
10:22 <pacak> lookup is a slightly specialized find
10:22 <pacak> snd $ head $ filter (\(a,b) -> a == startVertex)
10:22 <pacak> this is
10:22 merijn joined
10:22 <pacak> lookup startVertex
10:23 infinity0 joined
10:23 <pacak> Just shorter and with less explosions
10:23 jeltsch joined
10:23 <pacak> @src lookup
10:23 <lambdabot> lookup _key [] = Nothing
10:23 <lambdabot> lookup key ((x,y):xys) | key == x = Just y
10:23 <lambdabot> | otherwise = lookup key xys
10:23 thomas-oneill joined
10:23 <thomas-oneill> hey I'm wondering where my cabal binaries are going, there's no bin/ in my .cabal/ :s
10:24 <oherrala> $HOME/.local/bin ?
10:24 oish joined
10:24 <Alex____> pacak: But how do I handle the Maybe value?
10:24 <Alex____> Expected type [(Char, a)] Actual type: [(Char, Maybe a)]
10:25 <nbro> I’ve just read that arrows are apparently are even a more general concept than monads and that monads in category theory were believed to be equivalent to arrows: https://en.wikipedia.org/wiki/Arrow_(computer_science)… could this be an example where a concept introduced in cs was then adopted in math?
10:25 <thomas-oneill> oherrala: I don't have one of those either.
10:25 VKIND left
10:26 <pacak> Alex____: What kind of list do you expect to see there?
10:26 <thomas-oneill> my .cabal/config says my extra-prog-path is $HOME/.cabal/bin but it doesn't exist
10:27 <pacak> nbro: Arrows is what you get when you combine Category and Profunctor. I think they are a bit more restricted than Monad
10:27 <thomas-oneill> there are some other bindirs but they have $prefix in them, I'm not sure what $prefix is
10:27 <pacak> mkdir ~/.cabal/bin
10:28 eacameron joined
10:28 <aidalgol> My Haskell is a bit rusty. ghc doesn't like the example program in the readme from https://github.com/jaspervdj/websockets
10:28 <aidalgol> server.hs:1:1: The function `main' is not defined in module `Main'
10:28 mattyw joined
10:29 <pacak> aidalgol: Which example program? I see server and client. Both seems to be valid
10:29 <MasseR> pacak: "server.hs:1:1:"
10:29 <aidalgol> pacak: The one that is inline in the readme.
10:29 <pacak> But there are no server.hs in repo. There is server.lhs
10:30 <aidalgol> MasseR: that's not from the repo
10:30 <aidalgol> I mean the filename
10:30 <MasseR> oh that's true
10:30 <geekosaur> I'm pretty sure that's intended to be loaded into ghci
10:30 <aidalgol> The readme has this bit: "The following program echoes messages back after appending meow:" and then what appears to be a complete program.
10:30 <aidalgol> geekosaur: ohhhh...
10:30 <pacak> aidalgol: One from readme is not a real example
10:30 <geekosaur> as noted, it does not define "main" so it is not a standalone program
10:31 <Alex____> pacak: What exactly do you mean by, what type of list?
10:31 <aidalgol> What does the "LANGUAGE OverloadedStrings" line do?
10:32 <pacak> Alex____: Well.. What context will be there? With filter and head it will be at most one element
10:32 <pacak> Alex____: If it's only 0 or 1 elements - you don't really need zip
10:32 <geekosaur> aidalgol, it lets you not have to wrap literal strings in T.pack to make them valid Data.Text values
10:32 <cocreature> aidalgol: OverloadedStrings is an extension that results in string literals having type "IsString a => a" instead of String
10:33 <pacak> aidalgol: That allows you to use string literals ("Blah") to define something like Text or ByteString
10:34 pita joined
10:35 <kuribas> I am looking at weight balanced kd-tree's. It appears the balancing can be amortized so insert is O(log n). I'm surprised there is no literature for this...
10:37 ogrady joined
10:37 hc_ joined
10:38 mtesseract joined
10:39 k0001 joined
10:40 augur joined
10:40 <Alex____> pacak: Maybe I am approaching my problem from the wrong way. https://pastebin.com/5cUgULnS
10:40 <kuribas> I probably haven't look well enough though...
10:41 <Alex____> Or for anyone who could help me
10:41 VKIND joined
10:41 <pacak> > repeat 0
10:41 <lambdabot> [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...
10:41 <pacak> That gives you infinite list
10:41 <pacak> :t (:[])
10:41 <lambdabot> a -> [a]
10:42 <pacak> That takes one element and gives a list containing just one element
10:42 <pacak> Alex____: What exactly are you trying to write?
10:43 LnL joined
10:43 <k0001> Does anybody know how to write `type family ReverseList (xs :: [k]) = (sx :: [k]) | sx -> xs` respecting the injectivity stated there using `TypeFamilyDependencies`?
10:43 <geekosaur> Alex____, I think the best you can do there is possibly a Monoid constraint and use mempty. But if this is a list of distances, why would a distance be a String?
10:43 <Alex____> pacak: Acyclic directed graph, that part should calculate the distance between the vertices
10:43 <Iceland_jack> k0001: Not possibly I believe, TypeFamilyDependencies is very restrictive
10:44 <Alex____> Or, create a list of it rather
10:44 welh0 joined
10:44 <Alex____> geekosaur: I want the vertices to be able to have strings or numbers as weights
10:44 <k0001> Iceland_jack :'(
10:44 cpennington joined
10:45 <Iceland_jack> k0001: This is due to non-covering type synonyms
10:45 <Iceland_jack> this will be fixed in the future, probably
10:45 <pacak> So... That's collecting all the vertices between points A and B?
10:45 <Iceland_jack> Richard Eisenberg just released a pre-print of a paper for constrainted typed families which addresses this
10:45 IRCFrEAK joined
10:45 <geekosaur> hm. I think you need Monoid, or pass in a "null" value to use
10:46 <Alex____> pacak: Yes, I mean, I got it working for numbers
10:46 <Iceland_jack> sorry, *draft
10:46 <Iceland_jack> http://cs.brynmawr.edu/~rae/papers/2017/partiality/partiality.pdf
10:46 Aruro joined
10:46 arpl joined
10:46 <geekosaur> hm, no, Monoid doesn't work either because you'd need the Sum newtype. sigh
10:47 <geekosaur> I think you'll have to pass in the null weight value to use
10:47 <k0001> Iceland_jack: Very nice! Thanks for the pointers!
10:47 <Iceland_jack> Simple injectivity annotations like (type instance ListElem [a] = a) is not actually injective
10:47 <Iceland_jack> because of horrible families like (type family Loop where Loop = [Loop])
10:47 <Iceland_jack> *Simple type functions like
10:47 IRCFrEAK left
10:48 <Alex____> geekosaur: Hmm, how do I pass in a null value weight?
10:48 insitu joined
10:48 <geekosaur> add an additional parameter of type a, use it as the parameter of repeat
10:49 augur joined
10:50 bennofs joined
10:51 <osa1> give a package on hackage is there a way to get the full dependency tree? I'm wondering if a package is already a dependency of another package
10:51 <osa1> given*
10:55 alfredo joined
10:55 tomboy64 joined
10:55 <Alex____> geekosaur: I see what you mean, but what would be the null value? For numbers it would be 0, what would it be for [Char]? Or am I on the wrong path here?
10:56 <geekosaur> "" presumably, but it's your algorithm, I presume you know what the weights should be
10:56 <geekosaur> (if you don't, you likely have bigger problems than just how to code it)
10:56 thatguy joined
10:57 teggi joined
10:58 cic joined
10:59 augur joined
10:59 <geekosaur> osa1, not from hackage, and not that I can see via packdeps.haskellers.com. iirc stack has a 'dot' command that will generate a dependency graph, but you'd have to download the package to use it
10:59 mmhat joined
11:00 subttle_ joined
11:00 welh0 left
11:00 <geekosaur> (aside: now I'm wishing more commands had an "apropos" subcommand to search the help text for a particular string/option...)
11:00 Wizek joined
11:01 <osa1> geekosaur: wow stack dot is great. thanks
11:01 fotonzade joined
11:01 electrocat joined
11:02 danza joined
11:03 louispan joined
11:04 zero_byte joined
11:04 louispan joined
11:06 detrumi joined
11:07 HugoDaniel joined
11:08 augur joined
11:10 ziocroc2 joined
11:10 Aruro joined
11:11 cpup joined
11:12 fendor joined
11:17 Aruro joined
11:17 augur joined
11:18 VKIND left
11:19 Wizek_ joined
11:22 insitu joined
11:23 fakenerd joined
11:24 uyptva joined
11:26 augur joined
11:26 silver joined
11:30 nbro joined
11:30 sujeet joined
11:31 fendor joined
11:34 insitu joined
11:35 azahi joined
11:35 augur joined
11:36 Charitos joined
11:36 Itkovian joined
11:36 Rainb joined
11:37 Fairy joined
11:38 baldrick joined
11:38 _sg2 joined
11:39 JeanCarloMachado joined
11:40 louispan joined
11:42 asmyers joined
11:43 nex1200 joined
11:44 dgonzo joined
11:44 Yuras joined
11:44 augur joined
11:48 jao joined
11:49 mtesseract joined
11:50 jonatan joined
11:51 <jonatan> Might I borrow someone's superior haskell-reasoning in getting a hint about the memory usage of a trial-divison factorization program? https://gist.github.com/CookiesBestDinner/584ef62c06c92c44892dc6f8b045af01
11:51 <jonatan> It's doing trial division and I'd like to think it should use near-to-no memory. But it's using 2.5GB for my test-data
11:52 <cocreature> jonatan: 2.5gb max residency or 2.5gb allocation?
11:52 <jonatan> res, I believe
11:52 <cocreature> how are you measuring memory usage?
11:52 <jonatan> time -v says res, and my monitor-program-thing climbs
11:52 <cocreature> ok
11:53 jdnavarro joined
11:53 infinity0 joined
11:53 <jonatan> I've tried running the expression that's doing all the work in ghci. THAT doesn't use memory. So .. not sure how to continue my reasoning about it
11:53 <cocreature> jonatan: so the first thing you might want to try is explicitely call factorize at type Int
11:53 augur joined
11:53 <cocreature> jonatan: GHC defaults to Integer which generally uses more memory
11:53 <cocreature> but 2.5gb sounds like a bug
11:54 <jonatan> Then I will try that. Though measuring might get trickier with a smaller number.
11:55 <cocreature> jonatan: you can run your program with "+RTS -s" and it will tell you max residency
11:55 <cocreature> but 999998727899999 is smaller than 2^64 so on a 64bit system you should be fine even with Int
11:55 <cocreature> eh I guess it needs to be smaller than 2^63-1 but that’s still the case
11:55 Kundry_Wag joined
11:56 <electrocat> cocreature: yeah, Int is signed
11:56 ccomb joined
11:56 <cocreature> jonatan: oh are you using runghc instead of compiling your program?
11:56 <Myrl-saki> Where do I read on evaluation of programming languages?
11:56 <jonatan> Oh, right. Thought it'd be 32-bit but I suppose that could be machine specific (did some sloppy googling) -- anyway, still uses all that memory
11:56 infinity0 joined
11:56 <jonatan> I am!
11:56 <cocreature> don’t :)
11:57 <jonatan> Yeah, okay. That fixed the memory. But shouldn't ghci then also be using memory?
11:57 <cocreature> I get 44,384 bytes max residency which seems quite reasonable
11:58 <Aruro> just when stack people wanted to advertise portable scripts
11:58 nex1200 left
11:58 Yuras joined
11:58 huajie-hu joined
11:59 <jonatan> So my bad assumption here was that runghc would be roughly equivalent to ghci.
11:59 <Aruro> its not bad assumption, bad to make runghc available :)
12:00 <cocreature> jonatan: yeah that’s usually a fairly reasonable assumption afaik
12:00 soLucien joined
12:00 <cocreature> jonatan: if I load that file in ghci and execute ":main" I’m also seeing a lot of memory usage
12:00 <Aruro> cocreature: u just said dont :)
12:01 mmn80 joined
12:01 <cocreature> Aruro: I said you shouldn’t use it to judge if a program is using too much memory. just like you shouldn’t be using ghci for that
12:01 <jonatan> cocreature: yeah me too. But that expression itself doesn't. So.. some kind of memoization-ish thing going on?
12:02 <jonatan> Well. Okay. Don't judge based on ghci or runghc. Probably don't use runghc for any substatial amount of computing. Got it. Thanks :>
12:03 HoierM joined
12:03 SimpleL joined
12:03 <cocreature> jonatan: not sure why the expression itself doesn’t use that much memory
12:03 <Aruro> is there a library which recompiles binary when there is newer source? for single file scripts
12:04 JoelMcCracken joined
12:04 <ph88^> is it possible to combine the IO monad with the Either monad here? https://bpaste.net/show/10df0bc9339a
12:04 <ph88^> so that i can use do notation
12:05 <cocreature> jonatan: oh I know why I think. it’s not garbage collecting "potentialFactors" because you might use it in the next iteration.
12:05 <cocreature> ah no ignore that
12:05 <jonatan> :<
12:05 <jonatan> It might just not be important at all - something that isn't promised to me and that I shouldn't rely on. I'm fine with that
12:06 ericshortcut joined
12:06 MindlessDrone joined
12:07 augur joined
12:07 <Aruro> ph88^: there is either monad transformer
12:08 Fairy joined
12:09 <merijn> jonatan: Yeah, as a rule of thumb always actually use ghc to compile and then run to benchmark things (ideally using -O or -O2)
12:09 jeltsch joined
12:09 <merijn> jonatan: ghci is actually a bytecode interpreter that can't use all fancy optimisation and doesn't produce binary at all
12:10 <merijn> Not sure about runghc
12:10 <merijn> In most case you probably want to use cabal to build your code anyway :)
12:10 <Aruro> are there a lot of fancy optimisations?
12:10 <merijn> Aruro: In GHC? Yes
12:11 <Aruro> yes in ghc.
12:11 <merijn> pure languages invite lots of optimisation, since it's simpler for the compiler to reason about code
12:11 fotonzade joined
12:12 <Myrl-saki> merijn: (imagine if only we had linear types)
12:12 <Aruro> i hear only about sream fusion, apparently very important thing
12:12 <Aruro> t*
12:12 <hpc> this is true to a limited extent in gcc (with const) as well, but haskell's combination of language features is particularly suited to taking advantage of it
12:12 obijankenobi joined
12:13 <Aruro> what are other important optimisations?
12:13 baldrick joined
12:13 <hpc> having a good garbage collector probably counts as optimization
12:13 <merijn> Aruro: So we just finished our compiler lecture and most optimisations discussed are as follows: "here's a neat idea for an optimisation" -> "explain why it becomes unsafe/impossible in an impure language" -> "spend tons of research to determine whether some code is pure enough for said optimisation"
12:14 <Aruro> hpc: heh, perhaps
12:14 fendor joined
12:14 <hpc> ghc's gc competes with java's for the most advanced in a production language
12:14 <hpc> merijn: haha
12:15 <hpc> sounds about right
12:15 coot joined
12:15 <Aruro> gc is not optimisation, its runtime
12:15 <Aruro> written in what, c? :)
12:16 lithie joined
12:19 PennyNeko joined
12:19 fizbin joined
12:19 codesoup joined
12:19 <Aruro> 50000 lines of c code
12:19 <Aruro> sounds like good optimisation to me.
12:20 danthemyth joined
12:20 insitu joined
12:24 asthasr joined
12:25 mda1 joined
12:25 thatguy joined
12:25 benl23 joined
12:26 presiden joined
12:27 Marumarsu joined
12:28 Salih joined
12:30 benl23 joined
12:35 HugoDaniel joined
12:37 thomas-oneill left
12:37 Uneliasmarsu joined
12:38 Marumarsu joined
12:39 gawen joined
12:41 sdothum joined
12:42 fendor joined
12:42 nh2 joined
12:43 <nh2> phadej: ping
12:43 Iceland_jack joined
12:43 Yuras joined
12:44 Wuzzy joined
12:45 fakenerd joined
12:45 Itkovian joined
12:48 eacameron joined
12:49 <doomlord> how is Haskell for GPU programming,
12:49 <merijn> doomlord: Honestly, not relevant
12:49 <doomlord> not relevant in what way,
12:49 <doomlord> not relevant to the channel?
12:49 <merijn> doomlord: Then again, neither is anything besides CUDA
12:50 <doomlord> or are you saying haskell is not a good option
12:50 <merijn> doomlord: No, I meant "if you care about GPU performance, don't use haskell (or anything other than CUDA)"
12:50 <doomlord> ok fair enough.
12:50 <nh2> opencl also works
12:50 <merijn> nh2: Honestly not really
12:50 <cocreature> and if you don’t care about gpu performance, don’t use gpus :)
12:50 <merijn> doomlord: Accelerate seems it might do "ok" if you have regular/dense algorithms
12:51 <merijn> doomlord: But if your goal is "squeeze the last bit of performance" I'd skip it
12:51 meba joined
12:51 <nh2> merijn: I've built a KinectFusion (3D reconstructon by voxel integration) ported from CUDA to OpenCL so that it runs on Android phones, and it worked
12:51 MejGun joined
12:51 <doomlord> well there is a middle ground, 'getting code in a form that is suitable for GPU stream processing', which will still exceed the CPU
12:52 <doomlord> i was just curious if there were libraries out there that attempt to extract expressions from haskell and insert them into GPU kernel code
12:52 <merijn> nh2: OpenCL is an incredibly unwieldy language, the portability is questionable (given how buggy most implementations are). OpenCL2.0 is slightly more usable in terms of features, but still lagging behind CUDA, so the only reason would be "portability", except all non-NVidia GPUs are pretty trash in terms of performance, so portability to them isn't very relevant :p
12:52 <nh2> doomlord: accelerate works, but there are restrictions. Not the same performance as writing CUDA or OpenCL directly, and it lacks a key feature to keep state on the GPU memory between Haskell IO actions. If you don't need that feature, you can give accelerate a shot
12:52 <doomlord> if the haskell language itself gives you the tools to construct such a library
12:53 <merijn> doomlord: I don't think such a tool really exists, but mostly because building it would be very time consuming and tedious
12:53 <hodapp> nh2: what was your KinFu port to OpenCL & Android?
12:53 <hodapp> I was writing one at one point
12:53 eacameron joined
12:53 <nh2> merijn: I agree that opencl is not as ergonomic, but it is more portable simply because most phones dont have nvidia gpus
12:54 <merijn> nh2: I'm doing GPGPU from a performance background, and no one is going to run HPC code on phones anyway ;)
12:54 <hodapp> plenty of reason to do it there
12:55 <nh2> merijn: live 3D scanning and reconstruction on your phone requires GPGPU on your phone, so no choice but opencl there
12:57 buglebudabey joined
12:57 <buglebudabey> has anyone set up tensorflow for haskell before?
12:57 sea_wulf joined
12:59 <Athas> doomlord: Obsidian gives you a lot more GPU control than Accelerate.
13:00 <Athas> Accelerate is more of a platform-neutral high-performance library. In principle it can run on many different platforms. I'm not even sure their GPU/CUDA backend is their best one anymore.
13:01 subttle_ joined
13:01 <hodapp> interesting, haven't looked at Obsidian
13:02 cyborg-one joined
13:02 <nh2> hodapp: I improved the OpenCL version of https://github.com/pamela-project/slambench (which itself is a port from kFusion); later completely rewrote it to use surfel fusion instead of voxels (but that's a different topic)
13:02 noam_ joined
13:03 bjz joined
13:03 <hodapp> I had wanted to reimplement KinFu using some kind of spatial subdivision data structure since it was so inefficient with the dense voxels but I never did end up progressing here
13:03 eacameron joined
13:03 ljhms joined
13:03 <nh2> hodapp: some people did that in their papers, integrating into octrees and reported it worked (but did not publish code)
13:04 <hodapp> nh2: OctoMaps and the like?
13:04 dhil joined
13:05 <doomlord> r.e. 'suitability of haskell' - it seems to me it should be possible to seperate out the code that manages how state sits in GPU buffers, vs passing in lambda functions that specify what operations you perform (e.g. 'what activation function to perform in a neural net', etc)
13:05 <nh2> hodapp: doing a quick google it seems that somebody actually did release some code: https://github.com/dkotfis/Octree-SLAM (but that is not the paper I had in mind)
13:05 <merijn> doomlord: I think using Haskell as CPU-side boilerplate to call CUDA from would be perfectly reasonable
13:06 <hodapp> nh2: ahh, I haven't read that one but I read most of the papers it cited
13:06 <doomlord> i guess that sounds similar to how i've used GPUs so far with C++ /OpenCL
13:06 <hodapp> it was late 2012, early 2013 that I worked with KinectFusion on a work project
13:06 <merijn> doomlord: The only reason I'm not is because I couldn't invest the time to make good library to do that (also, I was worried about the library being slightly unpredictable in terms of runtime, which would mess up my benchmarks)
13:06 <Athas> doomlord: Haskell at its core is probably not very suitable. Lazy evaluation and pointer structures are generally a no-go for GPU performance. But Haskell is sometimes useful for embedding DSLs, which is what Accelerate takes advantage of.
13:06 bennofs joined
13:07 <nh2> doomlord: that definitely works, I do exactly that with inline-c (which can do C++ too)
13:07 <merijn> Athas: Hell, just having a high level Haskell binding around, e.g., CUDA streams would make haskell much nicer to work from than C :)
13:07 <doomlord> Athas that makes sense, my hope was 'lazy evaluation' actually means 'a framework or library can choose the best time and place to evaluate something'
13:08 <doomlord> i'm really just experimenting and actually building or adapting a library is a valid excercise
13:08 <Athas> merijn: definitely; Haskell is good for libraries of all sorts. It's a great meta-language. But running Haskell *directly* on a GPU, not a chance.
13:08 <doomlord> if i actually needed to get something done, sure i'd just use tried and tested CUDA.
13:08 <Athas> Accelerate goes through massive pains.
13:08 <nh2> doomlord: IIRC just make sure that if you use multithreading on the Haskell side, do the CUDA part in forkOn so that it runs on the same thread (cuda-malloc and functions that use those buffers running on the same thread)
13:08 <merijn> Athas: Sure
13:09 <merijn> nh2: I don't think that's required? Pretty sure all main CUDA functions are thread safe
13:10 Destol joined
13:10 <doomlord> i guess i hoped that with the amount of inference going on with Haskell (comparing the experience to lazy-expression templates/TMP in C++) , you might be able to write sane looking expressions, but which get instantiated intelligently into GPU code.. hence with the lambda-friendly syntax of haskell you'd have something very pleasant to use
13:11 <doomlord> zipping buffers together etc
13:11 <doomlord> tree-like 2D fold
13:11 eacameron joined
13:11 <nh2> merijn: my knowledge may be outdated; a quick google gives me "However, since CUDA 4.0, multiple CPU threads can share context. You can use cuCtxSetCurrent to tie the context of the kernel to the current thread"
13:11 <Athas> doomlord: Haskell is too powerful a language. Many seemingly-simple expressions are hard to instantiate. Especially if you want to preserve the lazy semantics.
13:12 <Athas> It's worth remembering that GPUs are really bad at control flow, and the main power of Haskell is the ease of powerful control flow.
13:13 <nh2> Athas: I don't think doomlord wants to run vanilla haskell; his last message implied to me that he wants to writ eexpressions that happen to infer first-class data types to bring to the GPU, like accelerate does
13:13 fizruk joined
13:13 <doomlord> ok, i just saw the basic functional idea as looking very GPU friendly (applying functions to buffers)
13:13 cspollard joined
13:13 cpennington joined
13:14 <Athas> nh2: oh, that does work. But it's still difficult (witness the trouble Accelerate goes through with recovering sharing and handling nested parallelism).
13:14 <Athas> doomlord: it definitely is. functional array programming is a great model for GPUs.
13:14 <doomlord> nh2 Athas Correct. i dont want *to port haskell programs to the GPU* .. i'm asking if its possible to utilize haskell as a tool for writing new code that is still *GPU specific*
13:15 <Athas> Look at Obsidian.
13:15 <merijn> doomlord: Sure, haskell is great for things like "write a DSL that generates GPU code"
13:15 groscoe joined
13:15 <Athas> In my experience, however, embedded DSLs have terrible ergonomics. Horrible type errors and hard to debug. Haskell may be the *best* language for such things (maybe excepting Lisp), but it's still not very good IMO.
13:16 <nh2> doomlord: the approach you have in mind (e.g. writing `2 * sin 0.5` and having it turn into an inspectable data structure) definitely works. I believe it is simply that people haven't gone all the way to the end to make it totally awesome and ergonomic. E.g. the lack of state in accelerate forbids many great applications, but there is no technical reason for its lack; just lack of developer time so far
13:16 <buglebudabey> im trying ti install a package with stack but i'm getting an error saying 'Could not parse '/Users/davidanekstein/.stack/global-project/stack.yaml':
13:16 <buglebudabey> InvalidYaml (Just (YamlParseException {yamlProblem = "could not find expected ':'"'
13:16 <buglebudabey> anyone know how to address this?
13:17 huajie-hu joined
13:17 <nh2> buglebudabey: paste that yaml file
13:17 <reactormonk[m]> Yeah, looks like a faulty yaml file. I suggest posting it.
13:17 <nh2> buglebudabey: probably you forgot a : after a dictionary key
13:17 thatguy joined
13:18 <doomlord> nh2 ok it sounds like 'an open problem', and worth experimenting, I do indeed want to play around with actually constructing such a library.. i'm not here with a problem to solve,looking for a dependable library
13:18 redpoppies joined
13:18 <buglebudabey> http://lpaste.net/462994772974370816
13:18 <redpoppies> hello, @everyone
13:18 <buglebudabey> nh2 ^
13:18 <redpoppies> can anyone help with a quick servant problem?
13:19 <buglebudabey> nh2 i never wrote this file, it already existed in my stack build
13:19 <redpoppies> don't know how to accept an octet-stream body
13:19 <nh2> buglebudabey: you need to make a space after "extra-deps:"
13:21 <Athas> doomlord: the problem is that libraries like Accelerate can't access the original AST, and some things (e.g. lambdas) have to be represented awkwardly. It's an open problem indeed, and not an easy one.
13:22 <Athas> Other languages use macros to solve the problem, but they have typing issues.
13:22 <* ski> . o O ( typed macros )
13:24 ljhms joined
13:26 cpup joined
13:27 daniel-s joined
13:27 BlueRavenGT joined
13:28 <merijn> typed macros, isn't the lame way of saying Typed TH? ;)
13:29 <Iceland_jack> Athas: using lambdas isn't very awkward depending on your solution
13:29 <Iceland_jack> it's not ideal but things like patterns and cases are worse
13:30 `^_^v joined
13:30 <Athas> Iceland_jack: the body of a lambda can be complicated, if it contains further bindings. E.g., Accelerate requires you to use special functions if you want to have loops.
13:31 coot joined
13:31 soLucien joined
13:31 edsko joined
13:33 chlong joined
13:33 mattyw joined
13:34 gk_1wm_su joined
13:35 jathan joined
13:36 sellout- joined
13:37 SpaceGazebo joined
13:38 mda1 joined
13:39 iAmerikan joined
13:41 ystael joined
13:42 e_svedang joined
13:42 augur joined
13:42 meba joined
13:42 skeuomorf joined
13:44 <sea_wulf> Hey guys, I see the lens library as a dependency in a lot of packages but haven'
13:44 <sea_wulf> t gotten around to using it. What's the use case for it?
13:45 <kgadek> sea_wulf: it's used as a helper. Esp. in larger programs, it makes accessing/modifying the value of deeply-nested structures quite readable
13:47 <Iceland_jack> sea_wulf: More interestingly in my opionion, it takes the vocabulary of Foldable and Traversable and lifts it to much richer structures
13:47 <kgadek> e.g. you could write `some_counter += 1` if you are in State monad and you have a `some_counter` lens to access a part of the state
13:47 plutoniix joined
13:48 e14 joined
13:48 <Iceland_jack> It provides "sumOf" which is a generalisation of Data.Foldable's "sum = sumOf folded"
13:48 plutoniix joined
13:48 _sg joined
13:49 <Iceland_jack> Which means you can sum the first component of a tuple (sumOf _1), the second (sumOf _2) or both (sumOf both)
13:49 itachi joined
13:49 <Iceland_jack> > sumOf each (1, 10, 100, 1000)
13:49 <lambdabot> 1111
13:49 <Iceland_jack> > sumOf each (1, 10, 100, 1000, 10000)
13:49 <lambdabot> 11111
13:50 buglebudabey joined
13:50 <mniip> coercions are erased at runtime, right?
13:50 <Iceland_jack> > toListOf each (1, 10, 100, 1000, 10000)
13:50 <lambdabot> [1,10,100,1000,10000]
13:50 beckyconning joined
13:50 <sea_wulf> Thanks! That sounds pretty helpful for dealing with not so nice states.
13:50 <buglebudabey> thanks nh2, that worked
13:51 <mniip> :t folded
13:51 <lambdabot> (Applicative f1, Foldable f, Contravariant f1, Indexable Int p) => p a (f1 a) -> f a -> f1 (f a)
13:51 takle joined
13:51 eschnett joined
13:52 coltfred joined
13:52 <sshine> that certainly isn't abstract!
13:53 theelous3 joined
13:54 plutoniix joined
13:56 erisco joined
13:56 al-damiri joined
13:57 mitchty joined
13:58 Einwq joined
13:58 Kundry_Wag joined
13:59 <Iceland_jack> sea_wulf: If you want, you can even sum "every other" component of a tuple
13:59 <Iceland_jack> > sumOf (traversed. Control.Lens.indices even) [1, 10, 100, 1000, 10000, 100000]
13:59 <lambdabot> 10101
13:59 <Iceland_jack> > sumOf (each. Control.Lens.indices even) (1, 10, 100, 1000, 10000, 100000)
13:59 <lambdabot> error:
13:59 <lambdabot> • Couldn't match type ‘Indexed Integer a (Const (Endo (Endo a)) a)’
13:59 <lambdabot> with ‘Integer -> Const (Endo (Endo a)) Integer’
13:59 plutoniix joined
14:00 capuk joined
14:00 <Iceland_jack> Of a list anyway ;)
14:00 <sea_wulf> Iceland_jack: Can you sum over arbitrary integer equivalence classes (e.g. [3], [5], ...)?
14:01 <Iceland_jack> Can you give me example input / output
14:01 <nbro> can we say that JS is like milk for people that do not digest lactose? lol
14:01 mada joined
14:01 <Iceland_jack> You can easily write
14:01 <Iceland_jack> > sumOf (folded.folded) [[3], [5]]
14:01 <lambdabot> 8
14:03 <frontendloader> nbro: why you taking shots at JS?
14:03 <mniip> ye not like it can defend itself
14:03 <nbro> frontendloader: shots, I think, is the right term
14:04 <nbro> this should answer your question
14:04 <sea_wulf> [1, 10, 100, 1 000, 10 000, 100 000, 1 000 000] over [3] goes to 1 001 001
14:04 plutoniix joined
14:05 <sea_wulf> Iceland_Jack: I assume it should look something like sumOf (each. Control.Lens.indices 5) or something
14:05 <nbro> JS is the worse language ever created, even my cat I don’t have could have created it
14:05 <nbro> *worst
14:05 <merijn> nbro: This isn't particularly on topic here
14:05 <nbro> merijn: and?
14:06 <Iceland_jack> You can write
14:06 <Iceland_jack> > sumOf (folded.Control.Lens.indices (\n -> n `mod` 3 == 0)) [1, 10, 100, 1000, 10000, 100000, 1000000]
14:06 <lambdabot> 1001001
14:06 <nbro> this is irc
14:06 <nbro> not stack overflow
14:06 <frontendloader> this is #haskell
14:06 <Iceland_jack> sea_wulf: That what you want?
14:06 <sea_wulf> Hahaha, I should have though of that, thats perfect Iceland_jack
14:06 <mniip> nbro, this is a topical channel
14:06 <merijn> nbro: off-topic, i.e. not haskell related discussion/conversation should go in #haskell-offtopic
14:06 dsh joined
14:07 <nbro> ok, I will not further continue this dicussion ;) just take a break(dance)
14:07 <Iceland_jack> sea_wulf: the cool part is that it works between list boundaries
14:08 <sea_wulf> What, really? So over something such as [[1,2,3],[4,5,6]]? Or am I misinterpreting "list boundaries"?
14:08 <mniip> "even my cat I don’t have could have created it" - ex falso quodlibet :p
14:09 <nbro> are emoticons on topic here?
14:09 <nbro> ahah
14:09 <nbro> maybe we need to generalize everything, even arrows
14:09 <mniip> no, haskell and haskell accessories only
14:09 <Iceland_jack> sea_wulf: I actually forgot how to do that atm
14:10 <Iceland_jack> There is a way to do it, some other #haskell denizen will help me out
14:10 <Iceland_jack> > toListOf (folded.folded.Control.Lens.indices even) [[0], [1, 2], [], [3, 4, 5]]
14:10 <lambdabot> [0,1,3,5]
14:10 <Iceland_jack> I wanted [0,2,4]
14:10 <ph88> is that right when i use EitherT with IO that i need to do liftIO to access IO functions ?
14:10 <nbro> > map (\x -> x + 1) [1, 2, 3]
14:11 <lambdabot> [2,3,4]
14:11 <mniip> > toListOf (folded.Control.Lens.indices even.folded) [[0], [1, 2], [], [3, 4, 5]]
14:11 <lambdabot> [0]
14:11 <cocreature> ph88: yes
14:11 <mniip> maybe not
14:11 <cocreature> ph88: unless they are already written in terms of MonadIO, then it should work out of the box
14:11 <nbro> : > do "something"
14:11 <sea_wulf> It's cool, I have an internet connection, so I can just google it. Thanks for all hte help Iceland_jack!
14:11 <mniip> Iceland_jack, wait, [0,2,4] ?
14:11 <mniip> what's the logic behind that
14:11 <nbro> > do "something"
14:11 <nbro> lol
14:11 <lambdabot> "something"
14:12 <Iceland_jack> mniip: Same as flattening the list [0, 1, 2, 3, 4, 5] and picking every other [0, 2, 4]
14:12 <mniip> ah
14:12 augur joined
14:12 <nbro> you caught in flagrant
14:13 <nbro> *me
14:13 <nbro> > do "something else"
14:13 <lambdabot> "something else"
14:13 <Iceland_jack> Lens Can Do It®, I just forgot how
14:13 Argue joined
14:13 <nbro> > do "drugs"
14:13 <lambdabot> "drugs"
14:14 acarrico joined
14:14 <Iceland_jack> nbro: -XMagicHash
14:14 <nbro> Iceland_jack: is that the command prompt of a Prolog shell?
14:14 <ph88^> cocreature, when i use EitherT and do notation how can i specify what to do (putStrLn) on the Left situation? like on line 5 here https://bpaste.net/show/10df0bc9339a
14:14 <itachi> In functor defination "class Functor f where" f should always be able to take one input(parameter) right?
14:15 <Iceland_jack> itachi: Yes, its kind should be "Type -> Type" (* -> *)
14:15 <itachi> so if f takes zero are more than one input it can not be a functor
14:15 <cocreature> ph88^: if you want to react different to Left at different points in your do block, you don’t want EitherT
14:15 fendor joined
14:15 <cocreature> ph88^: EitherT just exits when it encounters a Left
14:15 <Iceland_jack> itachi: Yes, but keep in mind that (Either a) is a Functor
14:16 <ph88^> cocreature, is there any other way i can refactor this christmas tree of Left and Right ?
14:16 <itachi> thanks
14:16 <Iceland_jack> Either itself is (Type -> Type -> Type), so it has to be partially applied
14:16 <cocreature> ph88^: sry I have to go, I might be back in a bit
14:16 <nbro> > do "a functor inside a tractor"
14:16 <lambdabot> "a functor inside a tractor"
14:17 <Iceland_jack> > do do do "bee doo"
14:17 <lambdabot> "bee doo"
14:17 <ph88^> ok
14:17 <hc_> hi all, i'm looking for some usage examples for ed25519 crypto
14:17 <rotaerk> ...
14:17 eacameron joined
14:17 <itachi> One more thing for what functions can we use ":t" type or ":k" kind?
14:17 cpennington joined
14:18 <Iceland_jack> itachi: Explain?
14:18 <Gurkenglas> > toListOf (to concat.folded.Control.Lens.indices even) [[0], [1, 2], [], [3, 4, 5]]
14:18 <lambdabot> [0,2,4]
14:18 bjz joined
14:18 <Iceland_jack> Gurkenglas: eh, I believe it's possible without concat-ing it first
14:18 <itachi> What is the basic difference between a type of a function and a kind of a function?
14:18 Itkovian joined
14:19 fizruk joined
14:19 <* shapr> hops randomly
14:19 <shapr> GOOD MORNING!
14:19 HugoDaniel joined
14:19 <mniip> itachi, that doesn't make sense
14:19 <shapr> It's a beautiful day for Haskell code!
14:19 <mniip> functions don't have kinds
14:19 <Iceland_jack> itachi: Functions don't have kinds
14:19 <Iceland_jack> Types have kinds
14:19 raichoo joined
14:19 <mniip> the funtion type has a kind however
14:19 <rotaerk> :t (+5)
14:19 <lambdabot> Num a => a -> a
14:20 <itachi> what is a function type?
14:20 <rotaerk> :k Num a => a -> a
14:20 <lambdabot> error: Not in scope: type variable ‘a’
14:20 <lambdabot> error: Not in scope: type variable ‘a’
14:20 <lambdabot> error: Not in scope: type variable ‘a’
14:20 plutoniix joined
14:20 <Iceland_jack> itachi: (->) is the function type (constructor)
14:20 <mauke> itachi: the type of a function :-)
14:21 <itachi> ohh so what does "kind" tell us?
14:21 <Iceland_jack> Which has the kind ((->) :: Type -> Type -> Type) (please don't correct)
14:21 SpaceGazebo joined
14:21 <mauke> itachi: the "type" of a type
14:21 <Iceland_jack> itachi: for (->) it tells us you can apply 2 types to it
14:21 <mauke> more like you can apply it to two types
14:22 <Iceland_jack> ((->) Int) :: Type -> Type
14:22 <Iceland_jack> ((->) Int Bool) :: Type
14:22 <itachi> k
14:22 <Iceland_jack> itachi: This means that (->) and (Int -> Bool) cannot be a Functor
14:22 plutoniix joined
14:22 <Iceland_jack> but ((->) Int) can be (and is)
14:22 carlomagno joined
14:23 <nbro> > do "hey ya"
14:23 <lambdabot> "hey ya"
14:24 <mniip> hc, what do you mean usage examples
14:24 <Iceland_jack> itachi: Same with (Either :: Type -> Type -> Type), you can apply it to two types just like (->)
14:24 <Iceland_jack> itachi: Does that make sense?
14:24 <mniip> I use ed25519 to sign into servers over ssh
14:24 <Gurkenglas> Iceland_jack, is there some other application for which the way you want works better than cobbling it together using to?
14:24 <itachi> Yup
14:24 Einwq joined
14:24 gk_1wm_su joined
14:25 <itachi> Either :: Type -> Type -> Type takes two types and returns a type?
14:25 <Iceland_jack> itachi: yes
14:25 <Iceland_jack> Gurkenglas: In this case it doesn't, but once you start using Traversals it starts mattering right
14:26 <Iceland_jack> itachi: Can you guess the kind of (,)
14:26 <shapr> Has anyone used https://github.com/pfq/PFQ ?
14:26 alienbot joined
14:26 <Gurkenglas> Ah, like doubling every other number in that list of lists
14:26 <hc> mniip: specifically, i'm trying to use 25519 crypto with cryptonite... i've gotten as far as generating a DhSecret (https://hackage.haskell.org/package/cryptonite-0.22/docs/Crypto-PubKey-Curve25519.html#t:DhSecret), but I don't know which functions to use for encryption/decryption
14:26 <Iceland_jack> Gurkenglas: Yeah
14:26 <hc> so i was wondering if there are some usage examples for cryptonite/25519
14:26 <itachi> it take two types and returns a tuple?
14:26 <ski> god eftermiddag, shapr
14:26 <Iceland_jack> Takes two types and returns a type (of tuples)
14:26 <shapr> hejsan ski!
14:26 <shapr> god morgon!
14:27 <Iceland_jack> So same kind as Either: (,) :: Type -> Type -> Type
14:27 <itachi> yup makes sense now thank you very much
14:27 sgflt joined
14:27 oish joined
14:28 capuk joined
14:28 <hc> mniip: i don't just want to sign/verify payloads, but also encrypt them
14:30 takle joined
14:31 <Gurkenglas> > indexing (traverse . traverse) . Control.Lens.indices even *~ 2 $ [[0], [1, 2], [], [3, 4, 5]]
14:31 <lambdabot> [[0],[1,4],[],[3,8,5]]
14:32 <Iceland_jack> Ah thanks!
14:32 JeanCarloMachado joined
14:32 <Gurkenglas> (Found via seeing how itraversed -> traversed was implemented)
14:32 buglebudabey joined
14:33 marsam joined
14:34 plutoniix joined
14:34 tput joined
14:35 Mon_Ouie joined
14:35 cdg joined
14:35 <itachi> is there any test library which checks that functor instances I have written is right?
14:36 azahi joined
14:37 <Iceland_jack> itachi: checkers is used for that (https://hackage.haskell.org/package/checkers-0.4.6/docs/Test-QuickCheck-Classes.html)
14:37 HarveyPwca joined
14:37 <Cale> itachi: Just check that fmap id = id
14:37 dfeuer joined
14:37 <erisco> does fmap (f . g) = fmap f . fmap g come for free?
14:37 <Iceland_jack> itachi: Usually you don't write your own Functor instance
14:37 <Cale> Yes, due to parametricity
14:38 plutoniix joined
14:38 <itachi> parametricity?
14:38 SpaceGazebo joined
14:38 <erisco> Cale, you given given fmap id = id ? because it is easy to see how an implementation wouldn't hold for that law only
14:39 <erisco> you mean given*
14:39 <Cale> yeah, given that fmap id = id, it follows that fmap (f . g) = fmap f . fmap g
14:39 <Cale> @free (Functor f) => (a -> b) -> (f a -> f b)
14:39 <lambdabot> Try `free <ident>` or `free <ident> :: <type>`
14:39 <Cale> @free fmap :: (Functor f) => (a -> b) -> (f a -> f b)
14:39 <lambdabot> Extra stuff at end of line
14:39 dni joined
14:39 <Cale> @free fmap :: (a -> b) -> (f a -> f b)
14:39 <lambdabot> Plugin `free' failed with: src/Lambdabot/Plugin/Haskell/Free/Type.hs:(152,17)-(160,45): Non-exhaustive patterns in case
14:39 <nbro> > do "do you believe in the law of excluded middle?"
14:39 <lambdabot> "do you believe in the law of excluded middle?"
14:39 <Cale> fine, maybe @free isn't as strong as I thought :)
14:40 <Cale> @free fmap :: (a -> b) -> [a] -> [b]
14:40 <lambdabot> g . h = k . f => $map g . fmap h = fmap k . $map f
14:40 gk_1wm_su joined
14:40 <Cale> @free fmap :: (a -> b) -> Maybe a -> Maybe b
14:40 <lambdabot> g . h = k . f => $map_Maybe g . fmap h = fmap k . $map_Maybe f
14:40 gk_1wm_su left
14:40 <Cale> Ah, right
14:41 <Sornaensis> @premium fmap :: (a -> b) -> [a] -> [b]
14:41 <lambdabot> Unknown command, try @list
14:41 <Sornaensis> I want some premium theorems
14:41 <erisco> @unleaded fmap :: (a -> b) -> [a] -> [b]
14:41 <lambdabot> Unknown command, try @list
14:42 <Cale> Here, $map_Maybe stands in for a real law-abiding fmap, while fmap was just the arbitrary name that I gave the thing
14:42 <Cale> @free f :: (a -> b) -> Maybe a -> Maybe b
14:42 <lambdabot> h . k = p . g => $map_Maybe h . f k = f p . $map_Maybe g
14:42 <Cale> maybe that'll make it more obvious
14:43 <Cale> So, now suppose we pick k = id
14:43 <nbro> > do "we like order because we can’t understand otherwise"
14:43 <lambdabot> "we like order because we can\8217t understand otherwise"
14:43 <Cale> We get h = (p . g) => $map_Maybe h . f id = f p . $map_Maybe g
14:45 <Cale> If f id = id, then we get $map_Maybe (p . g) = f p . $map_Maybe g
14:45 <nbro> > do "you made it up? oh yes, but that wasn’t that good anyways!"
14:45 <lambdabot> "you made it up? oh yes, but that wasn\8217t that good anyways!"
14:45 <Cale> nbro: ???
14:45 rizary joined
14:45 crobbins joined
14:46 <nbro> idk
14:46 <Sornaensis> Cale do you have a blog where you talk about haskell stuff
14:46 <Cale> Sornaensis: no
14:46 <Cale> I basically talk about Haskell stuff here.
14:46 <Cale> and occasionally on reddit
14:47 Lord_of_Life joined
14:48 <Sornaensis> ah
14:51 <nbro> can you imagine that h a k?
14:51 <Cale> nbro: Please try to remain on topic here.
14:52 <nbro> Cale: I will try harder ;)
14:52 infinity0_ joined
14:52 infinity0_ joined
14:53 plutoniix joined
14:54 markasoftware joined
14:54 detrumi joined
14:54 cchalmers joined
14:56 infinity0 joined
14:56 <nbro> is the only real (ever done) application of <|> to implement parsers in Haskell?
14:56 cosmodanger joined
14:57 <Cale> Not the *only* one, but pretty close.
14:57 <cocreature> it’s sometimes convenient for Maybe
14:57 <Cale> Or other monads with nondeterminism
14:58 bjz joined
14:58 m2_teknix joined
14:58 Luke joined
14:58 uglyfigurine joined
14:59 <Cale> You might use it in some cases where you were doing some other sort of combinatorial search
14:59 infinity0 joined
14:59 <nbro> can you be more specific of why?
14:59 cchalmers joined
15:00 <reactormonk[m]> nbro: ExceptT is also pretty useful.
15:00 <Cale> Well, it would typically express a similar thing to what it does for parsers -- combining the possible results of the actions involved.
15:00 dawehner joined
15:00 etehtsea joined
15:00 <Cale> In cases like Maybe, it's just if the first thing is Nothing, you get the second thing
15:00 <Cale> > Nothing <|> Just 4
15:00 <lambdabot> Just 4
15:00 <Cale> > Just 1 <|> Just 4
15:00 <lambdabot> Just 1
15:01 <Cale> > Nothing <|> Nothing
15:01 <lambdabot> Nothing
15:01 <Cale> For lists, it's concatenation
15:01 <cocreature> > asum [Nothing, Nothing, Just 1, Just 4]
15:01 <Cale> > [1,2,3] <|> [4,5]
15:01 <lambdabot> Just 1
15:01 <lambdabot> [1,2,3,4,5]
15:02 infinity0 joined
15:03 <Cale> One of my favourite monads is StateT s [], you could specialise s to something like String and then tie your hands a bit about how the state changes to get parsers, but you can also not do that, and use it for search algorithms more generally
15:04 <Cale> and so there, you have both state, and a way to select between many different options to try, and <|> gives you the latter
15:04 jmelesky joined
15:04 <ongy> I wonder how weird that sentence would be to haskell newbies "my favourite monad is...."
15:04 soLucien joined
15:04 infinity0 joined
15:05 <nbro> ongy: ahah :D
15:05 liyang joined
15:05 <dolio> One of my favorite monads is the completion of the rationals to the reals.
15:05 <Cale> The completion for metric spaces generally ;)
15:06 <cocreature> huh I’ve never thought of that as a monad
15:06 <nbro> I proved the language {i, j, k, for i, j, k in N} to be countable by using the fact that the rationals are countable
15:06 <nbro> but ok
15:06 <nbro> it’s off-topic
15:06 <dolio> Cale: Yeah, good point. I don't like the reals.
15:06 cschneid_ joined
15:07 <Cale> dolio: Well, also, if you specialise it, I'm not sure there's a way to think of just that one mapping as a monad.
15:07 <dolio> Yeah, that's true.
15:07 <Cale> It's sort of a trivial monad though, in that join is an isomorphism.
15:07 <Sornaensis> monads are really general
15:08 <* ski> . o O ( `MonoMonad' )
15:08 eazar001 joined
15:08 JeanCarloMachado joined
15:09 <Sornaensis> MonoMonad?
15:09 etehtsea joined
15:09 <Cale> hehehe
15:09 infinity0 joined
15:10 jbiesnecker joined
15:10 tqswkk joined
15:10 plutoniix joined
15:11 <Cale> Sornaensis: Like MonoTraversable (which operates on monomorphic containers, who only have some specific type of elements), but for Monad.
15:11 <Sornaensis> is that like (>>=) :: m a -> (a -> m a) -> m a ?
15:11 <hc> mniip: so basically my problem is how to get the secret key out of the DhSecret class. And I found out I can just convert it to a bytestring or directly pass it to a function accepting a scrubbedbytearray. since the length is 32 bytes i'm going to assume it's the full secret and no other bytes...
15:11 <Sornaensis> oh
15:11 boombanana joined
15:11 jeltsch joined
15:11 <Cale> (>>=) :: m -> (Element m -> m) -> m
15:11 coot joined
15:12 <Sornaensis> ah
15:12 SpaceGazebo joined
15:12 <Cale> Please nobody actually write this
15:12 <Sornaensis> lol
15:13 Luke joined
15:13 <ph88^> does anyone know how i can put errors in a list while checking Either clauses? https://bpaste.net/show/023ddc62fe47
15:13 <ph88^> i like to give the users all the errors back instead of error by error as he fix the mistakes
15:13 <* ski> . o O ( `(>>=) :: forall n. MonoMonad n => m -> (Element m -> n) -> n' )
15:14 acarrico joined
15:15 tobhe joined
15:15 osa1 joined
15:17 bennofs joined
15:18 descender joined
15:18 <lyxia> ph88^: use Writer?
15:19 <cocreature> ph88^: but what do you do if you encounter an error? you need the value you get in the case of "Right something" to continue
15:21 Argue_ joined
15:21 <nbro> so apparently IO in Haskell was originally implemented using lists...
15:21 <Sornaensis> nbro: source?
15:21 <cspollard> I wonder if someone here could help me understand how to think about types with shape (m a) which are monoids forall a.
15:21 <nbro> Sornaensis: let me think I read it
15:22 plutoniix joined
15:22 <cspollard> like Map has mempty = empty and mappend = union
15:22 tobhe joined
15:22 <cspollard> i.e. there is no constraint on a.
15:23 <Iceland_jack> cspollard: The canonical example of that are lists: (Monoid [a])
15:23 <cspollard> I posted a similar Q on reddit: https://www.reddit.com/r/haskellquestions/comments/63z52o/parameterized_monoids/
15:23 <cspollard> yep that's a good example. what if I want to use the monoid instance without referencing the "a"?
15:23 Marumarsu joined
15:23 <Iceland_jack> cschneid: It is possible
15:23 <Iceland_jack> You can use Data.Constraint.Forall
15:24 <ph88^> cocreature, if i get any error i return Left, if i didn't get any error i should have all the values
15:24 <nbro> https://en.wikipedia.org/wiki/Monad_(functional_programming)
15:24 <nbro> "Early versions of Haskell used a problematic "lazy list" model for I/O, and Haskell 1.3 introduced monads as a more flexible way to combine I/O with lazy evaluation."
15:24 <cocreature> ph88^: so you want to put all values in a list instead of all errors?
15:24 dmwit joined
15:24 <Iceland_jack> ForallF Monoid [] is the same as (forall a. Monoid [a])
15:24 <Iceland_jack> https://hackage.haskell.org/package/constraints-0.9.1/docs/Data-Constraint-Forall.html
15:24 <Iceland_jack> It's quite rare that this is useful, but when you need it you need it
15:24 tobhe joined
15:25 <Iceland_jack> an example is (data Box f where Box :: f a -> Box f)
15:25 <cspollard> Iceland_jack: thanks. Is there a reason we don't have a type class for this?
15:25 <Iceland_jack> cspollard: It shouldn't be its own type class, it's a construction *on* type classes
15:25 augur joined
15:25 <Iceland_jack> which is exactly what ForallF is
15:25 <* ski> . o O ( s/Box/Exists/ )
15:25 <lyxia> Forall is a bit annoying to use though.
15:26 <Iceland_jack> Ideally we would be able to write this as (forall a. Monoid [a])
15:26 <cspollard> Iceland_jack lyxia: if you take a look at the reddit post maybe it makes more sense
15:26 <cspollard> https://www.reddit.com/r/haskellquestions/comments/63z52o/parameterized_monoids/
15:26 Itkovian joined
15:26 jeltsch joined
15:26 <ph88^> cocreature, no i like to put all the errors in a list, and also i would like the syntax to be something like https://bpaste.net/show/9e790a86b087
15:27 <cspollard> Iceland_jack lyxia: it seems to me this is similar to Alternative without any Applicative requirement
15:27 tobhe joined
15:27 <cspollard> Iceland_jack lyxia: and many mapping types don't have Applicative instances
15:27 <ph88^> cocreature, so when it hit return in the last line it should check if there are any error in the list and then return Left [errors, in, list] otherwise right the return clause
15:27 <ski> Iceland_jack : .. did you mean for `Box' to be an existential or a universal ?
15:28 <cocreature> ph88^: which list are you talking about?
15:28 <ph88^> cocreature, lyxia mentioned WriterT, but how can i make it so that if an error occurs here (Left situation) port <- getPort table that writer puts it in a list ?
15:28 <ph88^> cocreature, there isn't a list yet .. i want to make one for the errors
15:28 <Iceland_jack> existential
15:28 plutoniix joined
15:29 <Iceland_jack> double :: (forall a. Monoid (f a)) => Box f -> Box f; double (Box xs) = Box (xs ++ xs)
15:29 <Iceland_jack> (type checking done in my head, assume qualified contexts)
15:29 skeet70 joined
15:29 <cocreature> ph88^: sorry I’m still not following. could you name two operations that can return Left and from which you want the errors in a list?
15:29 <ski> ok
15:30 coot joined
15:30 <ph88^> cocreature, line 9 and line 11 https://bpaste.net/show/9e790a86b087
15:31 <cocreature> ah ok so there it actually works because you don’t use "port" in "getDBURI table"
15:31 <ph88^> cocreature, if i only have 2 values i check in my config file .. imagine how this code would like like with 30 values
15:31 eacameron joined
15:32 <ph88^> cocreature, yes i don't require to know port when i check the uri .. also i could swap the order around and it doesn't matter
15:32 JuPaname joined
15:33 <ph88^> maybe i run all the functions in a list and do a fold to check if there are any Left values ?
15:34 <ph88^> hhmm no that's not possible i think, because the function signatures are not the same
15:34 <ph88^> [Left "error 1", Right Int, Left "error 2", Right String] not gonna work i think
15:34 <cocreature> ph88^: https://hackage.haskell.org/package/validation-0.5.4/docs/Data-Validation.html#t:AccValidation might be what you are looking for
15:35 <cocreature> but it looks like there is no transformer version
15:35 <cspollard> Iceland_jack: I'm not sure how to use (forall a. Monoid (f a)) in a class instance declaration
15:35 <ph88^> cocreature, ah that looks very interesting !
15:35 <Iceland_jack> cspollard: It's not valid syntax yet
15:36 <cspollard> Iceland_jack: so is there any reason *not* to define
15:36 <cocreature> it seems like you should be able to make a transformer version. I’m not quite sure why there is none
15:36 <Iceland_jack> You would have to write it as "ForallF Monoid f"
15:36 <cocreature> maybe it violates some laws
15:36 coltfred joined
15:36 <cspollard> class PMonoid m where; pmempty :: m a; pmappend :: m a -> m a -> m a ?
15:36 jbiesnecker joined
15:37 Meow-J joined
15:37 tobhe joined
15:37 <Iceland_jack> cschneid: If you are okay with Functor as a superclass, you can look into https://hackage.haskell.org/package/semigroupoids-5.0.0.1/docs/Data-Functor-Alt.html#t:Alt
15:37 <cspollard> Iceland_jack: this seems like it could be quite useful, but maybe I am missing the bigger Q
15:37 <cspollard> Iceland_jack: bigger picture*
15:37 <ph88^> cocreature, what would i need a transformer version for ?
15:38 plutoniix joined
15:38 <cocreature> ph88^: to be able to combine it with things like IO
15:38 <ph88^> cocreature, you mean this? https://hackage.haskell.org/package/validation-0.5.4/docs/Data-Validation.html#t:ValidationT
15:39 <cocreature> ph88^: nah that’s just ExceptT
15:39 meoblast001 joined
15:39 <cocreature> which for some silly reason is included in this package
15:39 <cocreature> https://github.com/NICTA/validation/issues/3
15:39 <ph88^> then i don't understand what kind of transformer you mean
15:39 <cocreature> AccValidation is the interesting type
15:39 <cocreature> and that doesn’t have a transformer
15:41 <Iceland_jack> cspollard: This seems like the right use case for ForallF, making your own type class is not a decision you make lightly
15:41 filterfish joined
15:41 serendependy joined
15:41 tobhe joined
15:41 Dunearhp joined
15:41 Mon_Ouie joined
15:42 <ph88^> cocreature, can i do this with Either? Validation seems to have bad support for GHC 8 too
15:42 augur joined
15:42 adir joined
15:42 cavariux joined
15:42 <cocreature> ph88^: I don’t think it does. the release on hackage should support GHC 8. it looks like just nobody bothered to close the issue
15:42 insitu joined
15:42 JeanCarloMachado joined
15:43 <ph88^> cocreature, will it be difficult to write a transformer for AccValidation? i never worked with monad transformers before
15:43 <cocreature> ph88^: I’m honestly wondering that myself :)
15:43 sssilver joined
15:44 filterfish_ joined
15:44 <cocreature> ph88^: if it doesn’t exist I suspect there might be some problems but I haven’t tried it :)
15:44 <cspollard> Iceland_jack: ok thanks. I just worry that using these fancier type gymnastics make the code harder to understand and/or maintain.
15:44 yellowj joined
15:44 <cspollard> Iceland_jack: will read up on constraints.
15:45 <Iceland_jack> It does, but this honestly doesn't come up /that/ often
15:45 <cspollard> Iceland_jack: thanks very much for your help!
15:45 randomclown joined
15:45 <Iceland_jack> all it requires you to do is some \\ instF ... gymnastics to bring Monoid (f a) into scope for some a
15:45 <ph88^> cocreature, ok thanks for the help, i will leave the code as a pyramid right now, i'm a bit dissapointed not because of you but i thought this would be easier to do in haskell
15:46 <Iceland_jack> No problem, maybe someone has a better solution for ya
15:46 <Cale> cspollard: You might consider whether you actually want Alternative, in that particular case
15:46 jbiesnecker joined
15:46 <ph88^> feeling incompetent -___-
15:47 eacameron joined
15:47 fkurkowski joined
15:47 <cspollard> Cale: yeah unfortunately there aren't sensible Applicative instances for mapping types, which is primarily what I have in mind
15:47 <cspollard> Cale: seems to be a superclass of Alternative in some way.
15:48 <nbro> "This is a short tutorial on the state monad. Emphasis is placed on intuition. The types have been simplified to protect the innocent."
15:48 <nbro> "to protect the innocent"
15:48 <nbro> ahahah
15:48 Luke joined
15:48 <Cale> cspollard: ah, okay
15:48 <cocreature> ph88^: there is no reason to feel incompetent. there are just some cases that don’t fit into a particular scheme and you actually have to handle the logic yourself (which can involve nesting) instead of relying on some monad instance :)
15:49 plutoniix joined
15:49 <Cale> cspollard: Another thing I might consider vs. using constraint hackery is just defining a new type class.
15:49 <ph88^> cocreature, one question though .. why do i need it to work with IO ? I don't have IO in the type signature
15:49 <cocreature> ph88^: oh indeed!
15:49 <cocreature> ph88^: well then you don’t need a transformer version :)
15:49 <cspollard> Cale: haha that's what I originally tried, but Iceland_jack thought it was a bit heavy.
15:49 <ph88^> ok great :D
15:49 <Cale> I would tend to see the constraints stuff as heavier :)
15:50 <Iceland_jack> ;) perspective perspective
15:50 <cspollard> Cale Iceland_jack: class PMonoid m where; pmempty :: m a; pmappend :: m a -> m a -> m a
15:50 Boomerang joined
15:51 <cspollard> Cale Iceland_jack: I'm trying to grok how map types play into this. there's another obvious Monoid instance of maps that requires (Ord k, Semigroup a) => Monoid (Map k a)
15:51 IndigoTiger_ joined
15:51 <cspollard> Cale Iceland_jack: where mempty = empty; mappend = zipWith (<>)
15:52 plutoniix joined
15:52 <ph88^> cocreature, wouldn't a Free monad solve these kinds of things ? i heard Free is like magic
15:52 <Cale> cspollard: Also known as "the instance that everyone always wants almost 100% of the time"
15:52 <cocreature> ph88^: I don’t see how it would
15:52 IndigoTiger_ joined
15:52 <Iceland_jack> cspollard: zipWith?
15:52 <cspollard> Iceland_jack: uniontWith ;-)
15:52 <ph88^> cocreature, just noticed that Free is a dependency of validation
15:52 <cspollard> Cale Iceland_jack: but there's something deeper going on here...
15:53 wildlander joined
15:53 <cspollard> Cale Iceland_jack: those two instances seem to correspond to Monoid [a], Monoid (ZipList a)
15:53 <Cale> cspollard: Where I work, we have a newtype wrapper of Map, together with a complete module implementing all of Map's operations for the newtype (except some like union which use the old Monoid instance's behaviour)
15:54 <cspollard> Cale Iceland_jack: I'm pretty sure someone has thought carefully about this but I'm not sure who ;)
15:54 <Iceland_jack> cspollard: (you may be interested in the Alternative for ZipList, that was JUST added)
15:54 <Iceland_jack> https://ghc.haskell.org/trac/ghc/ticket/13520
15:54 <Iceland_jack> ZL xs <|> ZL ys = ZL (xs ++ drop (length xs) ys)
15:55 <cspollard> Cale: the same idea shows up in ekmett's Linear.Vector as liftI2 and liftU2...
15:55 bjz joined
15:55 <Cale> Iceland_jack: :(
15:55 plutoniix joined
15:55 <Iceland_jack> Cale: It's not too late if you disagree
15:55 significance joined
15:55 <cspollard> Iceland_jack: yeah but again, no Alternative for maps ;)
15:55 robertkennedy joined
15:56 <Cale> Iceland_jack: I think it probably ought to be the one which uses Semigroup's (<>) to combine corresponding elements.
15:56 itachi joined
15:56 <significance> If I write newtype Pair b a = Pair { getPair :: (a,b) }, does newtype just match up the arguments to getPair by type?
15:56 filterfish joined
15:56 <Cale> Iceland_jack: Then you can recover the instance there by using the First semigroup
15:56 <cocreature> ph88^: give me a few minutes and I’m done with my work and I’ll show you a largely pyramid-free version
15:56 <significance> What happens if I write newtype Pair a a = Pair { getPair :: (a,a) }?
15:56 <robertkennedy> Is WHNF for newtypes the same as the underlying type, or the data constructor for the newtype?
15:56 <Iceland_jack> Cale: Not a bad idea
15:57 <nshepperd> significance: you can't write 'newtype Pair a a'
15:57 <Cale> i.e. it ought to correspond with the Monoid instance everyone would like to have for Data.Map, but can't for purely political reasons
15:57 <significance> nshepperd: why is that?
15:57 pera joined
15:57 <cspollard> Iceland_jack> Cale: I guess my pmonoid is somehow a "Free Monoid"?
15:57 <Cale> (well, not *purely* political -- it would be the ugliest transition ever)
15:57 <Cale> cspollard: List types are free monoids
15:58 <dolio> No they aren't. :P
15:58 <nshepperd> significance: the same reason you can't define an ordinary function with 'f a a = _'
15:58 <Iceland_jack> ssh
15:58 <cspollard> Cale: yes I'm trying to see how this generalizes to maps
15:58 <significance> nshepperd: derp, I'm an idiot -- thank you
15:58 plutoniix joined
15:59 <cspollard> Cale: I actually find the current Monoid instance of Map more "fundamental" in a sence
15:59 thvu joined
15:59 <dolio> Which one is current? Union?
15:59 <cspollard> Cale: sense*. it has no Monoid a constraint...
15:59 <cspollard> dolio: yes
15:59 jao joined
16:00 <Cale> cspollard: The current one can be recovered from the Semigroup-requiring one by picking the First semigroup
16:01 <cspollard> Cale: true.
16:02 <cspollard> Cale Iceland_jack: I will see where I get... thanks!
16:02 <ph88^> anyone know how ApplicativeDo works ? i get an error when i try to use do notation https://bpaste.net/show/87375effab5a
16:02 <Iceland_jack> ph88: It is particular about the final expression (can't open bpaste)
16:02 <dolio> If only we could make First and Last semigroup-based instead of monoid based.
16:02 eklavya joined
16:02 <Iceland_jack> it has to be of a certain form, (return x) originally and then it gets more permissive in later versions
16:02 <nshepperd> is Semigroup a => Monoid a ever going to be in base
16:03 <lyxia> ph88^: this code is not applicative
16:03 <Iceland_jack> nshepperd: in a few releases I believe (https://prime.haskell.org/wiki/Libraries/Proposals/SemigroupMonoid)
16:03 <ph88^> lyxia, what's not applicative about it ?
16:03 <lyxia> ph88^: you are failing depending on the value of an intermediate computation
16:04 dustmote joined
16:04 sleffy joined
16:04 <ph88^> lyxia, yes, isn't the do-notation suppose to handle that ?
16:04 <dolio> The rules for being applicative are the same as the rules for ordinary 'let' in scheme.
16:04 oleks joined
16:04 <dolio> If you use something that would only be allowed by let*, it's monad.
16:05 <ph88^> i don't know scheme
16:05 <lyxia> ph88^: ApplicativeDo doesn't make any code using do work with any Applicative...
16:05 <dmwit> ApplicativeDo can't write some Applicative code that you can't write yourself. It's just a syntax sugar.
16:05 <nshepperd> Iceland_jack: sweet
16:05 <ph88^> lyxia, what's special about this applicative that it doesn't work with do ?
16:06 _sg2 joined
16:06 alx741 joined
16:06 eklavya joined
16:06 <nbro> just to make sure, the difference between >>= and >> in a monadiac context is that the latter ignores the value of the previous action, right? Or is there any other difference?
16:07 <lyxia> ph88^: the last action (AccSuccess or AccFailure) depends on the intermediate value "p"
16:07 <Cale> nbro: Nope, x >> y = x >>= const y
16:07 plutoniix joined
16:07 <dmwit> ph88^: Have you tried writing this logic with just the Applicative combinators? If not, I encourage you to give it a shot.
16:07 <Cale> nbro: I mean "there's no other difference"
16:07 <dmwit> ph88^: Like, without do.
16:07 MitchW joined
16:07 <lyxia> dmwit++
16:07 <Cale> nbro: However, it's still possible to define (>>) differently in case there's a more efficient way of doing the same thing
16:08 <dolio> Alternately, the GHC documentation for ApplicativeDo has examples for which do expressions allow Applicative constraints instead of Monad.
16:08 <ph88^> ok dmwit
16:09 Sonolin joined
16:09 <nbro> Cale: what should you example actually represent?
16:09 esssing joined
16:10 <Cale> nbro: example?
16:10 <Cale> nbro: You mean the definition of (>>) there?
16:10 capuk joined
16:10 cdg_ joined
16:10 <cocreature> ph88^: http://lpaste.net/354404 there you go
16:10 plutoniix joined
16:10 <nbro> Cale: x >> y = x >>= const y
16:11 DataComputist joined
16:11 hybrid joined
16:11 <Cale> Yeah, that's a general definition for (>>)
16:11 <Cale> you can always expect x >> y to behave the same way as x >>= const y would
16:11 urodna joined
16:11 <dolio> Some things will override it to be more efficient.
16:11 <dolio> But it should still be equivalent.
16:14 markasoftware joined
16:14 <cocreature> ph88^: ignore the stubs at the top. I just added those to be able to load it into ghci
16:14 wraithm joined
16:16 <nshepperd> Iceland_jack, Cale: 'SemiGroup a => Monoid (ZipList a)' works, but I don't think that would work for Alternative
16:16 SimpleL joined
16:16 <nshepperd> cos of parametricity
16:16 <ph88^> thanks a lot cocreature !!
16:16 <nshepperd> s/G/g/
16:16 marr joined
16:17 <Cale> nshepperd: ah, yes, that's true
16:17 <ph88^> i need to take the train but i will try the code this evening
16:17 joe9 joined
16:18 plutoniix joined
16:18 augur joined
16:18 <nbro> ok
16:19 dni joined
16:20 <Iceland_jack> nshepperd: right thanks
16:20 trism joined
16:20 <ph88^> cocreature, by the way .. https://github.com/NICTA/validation/issues/3#issuecomment-292576113
16:20 plutoniix joined
16:20 <cocreature> ph88^: ah thanks. so I wasn’t being stupid in that I didn’t see a _technical_ reason for why there can’t be an AccValidationT
16:21 justin2 joined
16:22 carlosda1 joined
16:22 <ph88^> be back later
16:22 plutoniix joined
16:23 phyrex1an joined
16:23 shane joined
16:24 plutoniix joined
16:24 oisdk joined
16:26 steeze joined
16:26 <itachi> If I am defining a Applicative instance is it also necessay to define a Functor instance for the same function
16:26 significance joined
16:26 <itachi> ?
16:26 aries_liuxueyang joined
16:26 plutoniix joined
16:27 dni joined
16:27 baldrick joined
16:27 raichoo joined
16:27 sssilver joined
16:28 <Cale> yes, but you can use fmap = liftA to define it
16:28 <Cale> Also, if you can define a Monad instance, you can get pure = return and (<*>) = ap
16:29 <itachi> ap?
16:29 <Cale> Control.Monad.ap
16:29 <itachi> k
16:29 <Cale> ap mf mx = do f <- mf; x <- mx; return (f x)
16:29 shayan_ joined
16:29 <itachi> hmm
16:30 {emptyset} joined
16:31 <Cale> and if you start with the Monad instance, you probably would rather use liftM to define fmap rather than liftA
16:31 <itachi> k
16:31 <itachi> I was defining applicative instance for data Pair a = Pair a a deriving Show
16:31 plutoniix joined
16:31 <itachi> instance Functor Pair where
16:32 <itachi> fmap f (Pair a a') = Pair (f a) (f a')
16:32 <Cale> ah, right
16:32 <* dmwit> . o O ( `type Pair a = Bool -> a` )
16:32 <itachi> why so I need to use a and a'
16:32 <itachi> why can't I use (Pair a a)?
16:33 <dmwit> itachi: Would you be okay writing `add a a = a + a`? If not, why not?
16:33 <Cale> ... because the two arguments to the Pair data constructor might not be the same? Also, Haskell just doesn't support testing for equality that way.
16:33 <dmwit> (And if so, what would you expect it to mean?)
16:34 <Cale> @let data Pair a = P a a
16:34 <lambdabot> Defined.
16:34 SpaceGazebo joined
16:34 <Cale> @let instance Functor Pair where fmap f (P x y) = P (f x) (f y)
16:34 <lambdabot> Defined.
16:34 <Cale> > fmap (*10) (P 2 3)
16:34 <lambdabot> error:
16:34 <lambdabot> • No instance for (Show (Pair b0))
16:34 <lambdabot> arising from a use of ‘show_M555821134055307050519143’
16:34 cpennington joined
16:34 <itachi> when i write Pair a = Pair a a does not in mean that a and a' will be same
16:34 <Cale> @let deriving instance Show a => Show (Pair a)
16:34 <lambdabot> Defined.
16:34 <Cale> > fmap (*10) (P 2 3)
16:34 <lambdabot> P 20 30
16:35 <Cale> itachi: It means they will have the same type
16:35 <Cale> That's not the same thing as being the same value
16:35 <itachi> Ohhh I always get confused :/
16:35 justin2 joined
16:35 <Sornaensis> :t unsafePerformIO
16:35 <itachi> Cale I get you now
16:35 <lambdabot> error: Variable not in scope: unsafePerformIO
16:36 <Cale> :t System.IO.Unsafe.unsafePerformIO
16:36 <lambdabot> IO a -> a
16:36 <Sornaensis> O:
16:36 <itachi> Thanks
16:36 plutoniix joined
16:36 jbiesnecker joined
16:36 Banana_ joined
16:36 Lord_of_Life joined
16:37 dawehner joined
16:37 <Banana_> Given foo :: Foo f => f -> IO (), what is the overhead of storing a [IO ()] that are the result of applying a bunches of `f` ?
16:37 ziocroc2 joined
16:38 <dmwit> A few (O(1)) pointers per entry in the list.
16:38 <Banana_> I'm assuming the IO () computation in itself is just going to be a shared pointer, but then something is probably captured for that `Foo f => f` ?
16:39 <Cale> Banana_: Well, you're also going to store the expressions that the function was applied to
16:39 tomboy64 joined
16:39 <Cale> If they were already evaluated, then it's the cost of storing the resulting values.
16:39 <Banana_> Let me give a better example by bringing ToJSON up. Would it store a bunch of IO computations with a bit of type information to know how to encode said value to JSON?
16:39 <Cale> If they weren't it's the cost of storing the thunks which represent those expressions at runtime.
16:40 <Banana_> I can expose my original problem to shed some light.
16:40 kiltzman joined
16:41 <Cale> Banana_: It's probably going to depend on what state of evaluation things are in, but it may retain a reference to the appropriate instance dictionary
16:41 <Banana_> I'm storing various values of different types in a in-memory store using Dynamic for the purpose of caching entities in a game that generates network calls.
16:41 <Cale> That's not too bad, because it's not like that's likely to ever be garbage collected in a typical case
16:41 kiltzman joined
16:41 <itachi> Do I have to import something to use liftA?
16:41 <Cale> Control.Applicative
16:42 kiltzman joined
16:42 <ggVGc> itachi: you can use Hoogle for things like that
16:42 <Banana_> The problem is that these sometimes need to be sent back over the network encoded as JSON, but this isn't possible since Dynamic looses type information, you need a monomorphic type for the inference to work.
16:42 <Banana_> So I was thinking, instead of just storing the Dynamic, I'll store (Dynamic, IO ()), which will include the network call prepared to be sent.
16:43 Apocalisp joined
16:43 <Cale> Banana_: You could do that, or just (Dynamic, Value)
16:43 <itachi> k
16:43 <jasondockers_> what exactly is wrong with this code: https://gist.github.com/anonymous/ecdadd332c874032458c735044b4518a ?
16:43 <Cale> Banana_: which would amount to about the same thing, in terms of space
16:43 <jasondockers_> syntactically, I guess
16:44 <Banana_> Cale: I wasn't able to decouple effects. So back to the question, what's the cost of storing a large amounts of IO () like that?
16:44 Ferdirand joined
16:44 kiltzman joined
16:44 <Cale> jasondockers_: ([]:_) is necessarily a list of lists
16:44 l3dx joined
16:44 <Cale> jasondockers_: but the type of next says it operates on a list of values of any type
16:44 <Banana_> Cale: They're all doing the same operation, just on different `ToJSON a => a` essentially. (And ToJSON is another simplification)
16:44 kiltzman joined
16:45 <jasondockers_> Cale, oh, that makes sense. thank you
16:45 <sshine> with Hspec, is there a neat way to specify that something must be Right and also propagate a potential Left error to the test output?
16:45 <jasondockers_> Cale, I am an oblivious person
16:45 kiltzman joined
16:45 <Cale> Banana_: If all you know about something is that it's an instance of ToJSON, then it might as well already be an aeson Value.
16:45 kiltzman joined
16:46 <Cale> Banana_: and if you're going to perform the same IO with that Value, there's not a whole lot of either benefit or harm in pre-applying the function to construct the IO action.
16:46 <Cale> (it's a constant amount of extra space, and restricts what you can do with it thereafter)
16:46 Apocalisp joined
16:47 jbiesnecker joined
16:47 <Banana_> Cale: Since the purpose of that system is an optimization (of the network calls), I feel like I'd be taking a step back if I store the values in cache in a json format. Now I have to pay the cost of unserializing on each lookup to that cache.
16:47 <Cale> Banana_: Note that the "might as well already be a Value" there is in part due to the fact that Haskell evaluation is mostly lazy, and will only actually compute the Value once it's needed.
16:47 abysslurker joined
16:48 <Cale> Banana_: Even if you were to write it as an IO action, the first time that IO action is performed, the Value inside will get computed and retained so long as the IO action itself isn't GC'ed
16:48 <Banana_> Cale: Thing is, json is only only for the communication between client and server, the cache on the client side using Dynamic avoid network calls, but storing Value instead would slow down every lookup again.
16:48 takle_ joined
16:48 <Cale> Why would it be any better with IO ()?
16:49 <Banana_> Oh you meant (Dynamic, Value)
16:49 <Cale> yes
16:49 <Banana_> I thought you mean (Value, IO ())
16:49 eacameron joined
16:49 <Cale> right
16:49 <Banana_> Cale: We're on the same page then.
16:49 <Banana_> I'll try that, see how it goes.
16:49 <Banana_> Cale: Is the resistance agaisn't it because storing lots of IOs is not idiomatic or because it has a serious cost?
16:50 <Cale> Banana_: There's not likely to be a serious difference either way
16:50 <Cale> and I wouldn't say it's unidiomatic
16:50 stevenxl joined
16:50 <Cale> You can do it either way
16:50 <Banana_> Style :P
16:50 <Banana_> Cale-style :P
16:50 <Cale> The Dynamic is the unidiomatic part :)
16:51 pwnz0r joined
16:51 <abysslurker> I'm looking for some literature on implementing type inference. I'm trying to implement a system which separates constraint generation, from constraint solving. I've read the chapter by Pottier and Remy, but it is not quite clear to me how to turn their trs into an algorithm. Does anyone here have some hints?
16:51 <Banana_> Cale: What until you see the Proxys and categories :p
16:51 <Cale> Banana_: One thing you might want to further consider is which operations you really need on the things which are stored as Dynamics
16:51 plutoniix joined
16:52 <Cale> Banana_: If you can determine that, then you might instead replace that with a record type containing those operations, pre-applied to the given values
16:52 <Cale> i.e. an "object" as the industry likes to call them
16:52 <Cale> :D
16:53 <Banana_> That can't be anything else than Dynamic, promise. They do not have any operation in common, other than being able to be json encoded/decoded, and it seems rediculous to me to do that encoding/decoding on every insert/lookup for an in-memory cache.
16:53 sleffy joined
16:53 <Cale> If all you know about something is that it is possible to JSON encode it, there's no difference between that and Value.
16:53 <Banana_> I'll show you the result for feedbacks; I'd be glad to get a different perspective on it.
16:54 <Cale> Well, if you prefer, you might like to use:
16:54 augur joined
16:54 <Banana_> Cale: Doesn't Value add a cost to convert back to `FromJSON f => f` ?
16:55 <Banana_> I'm not sure what Value is, but it's probably some map of key/value of all the fields.
16:55 <Banana_> Heck it's probably using some Dynamic mechanic underneath :P
16:55 <Cale> Value is just the Haskell representation of JSON
16:55 gillesmajor joined
16:55 gillesmajor left
16:55 iAmerikan joined
16:55 <Cale> It's a simple sum type with constructors for the various bits of JSON syntax.
16:56 <Banana_> Cale: That means it wont be parsed of every lookups, but it'll still be decoded :/
16:56 plutoniix joined
16:56 cspollard joined
16:56 <Cale> It might not yet be decoded
16:56 fendor joined
16:56 eacameron joined
16:56 <Cale> It might be a chunk of Text with decode applied to it, waiting.
16:56 significance joined
16:57 <Banana_> *it'll be decoded on every lookup......
16:57 <Cale> lookup?
16:57 Uneliasmarsu joined
16:57 <Cale> I thought you said there were no other operations :)
16:57 <Banana_> Sorry, backtracking.
16:57 <Cale> What do you do with the Dynamics?
16:58 <Cale> Do you convert them back to their original types and do random things based on what you find?
16:58 <Banana_> Cale: If I store Value instead of Dynamic in my cache data structure, wont I have to pay that conversion cost from Value to some `FromJSON a => a` everytime I obtain something from that cache?
16:58 nepiktaz joined
16:58 <Cale> I don't understand
16:58 <Cale> You're certainly never going to convert something of type Value to something of type (forall a. FromJSON a => a)
16:58 insitu joined
16:59 <Banana_> I do not do dynamic typing introspection stuff; merely using it as a way to get an homogeneous data structure at a small cost than encoding/decoding back to JSON.
16:59 stevenxl joined
16:59 <Cale> If you just mean that you're applying a function which polymorphically can use anything of a type which has an instance of FromJSON, then Value is an instance of FromJSON, so no conversion is needed there.
16:59 dni joined
16:59 jbiesnecker joined
17:00 <Cale> You might prefer to use an existential, at least
17:00 buglebudabey joined
17:00 steeze joined
17:00 fizruk joined
17:01 <Cale> data JSONable where JSONable :: ToJSON a => a -> JSONable
17:01 <Banana_> Cale: existential on which type class? They have nothing in common, other than that they can be JSON serialized for when they're sent over the network, that's the very problem.
17:01 <Cale> ToJSON of course.
17:01 eh_eff joined
17:01 <Cale> But that's basically the same thing as using Value instead, due to laziness.
17:02 <Banana_> But every lookup of my cache, I have to decode that json, it's silly.
17:02 <Cale> I... I don't understand.
17:02 obadz joined
17:02 bab joined
17:02 dmwit_ joined
17:02 <Cale> What information are you using to do the cache lookup?
17:03 <Cale> Dynamic isn't an instance of Ord or anything, so you can't be using that as the key
17:03 <Cale> What keys are you using for your cache?
17:03 <Banana_> Cale: Fine, let's use a basic `Map Id JSONable`, (assuming JSONable is (ToJSON a, FromJSON a) => a), every lookup from that cache, you have to decode, every insert, you must encode.
17:04 plutoniix joined
17:04 raynold joined
17:04 <Banana_> Cale: Why are the keys relevant?
17:04 ljhms joined
17:04 <Banana_> Cale: The data structure on its own shouldn't even matter.
17:04 <Cale> Because a lookup in a key/value store usually only requires evaluation of the key
17:05 <Cale> You don't have to do anything with the value just to do a lookup.
17:05 <Banana_> I see. Then yeah, only the key is needed for the lookups. It's some LRU cache.
17:06 <Cale> You can pull an unevaluated expression out of the Map, pass it around, shove it into another Map, and stash it somewhere else, without ever actually computing what the expression's value is -- you only need to do that if you pattern match the value somehow.
17:06 b4ff3r joined
17:06 stevenxl joined
17:06 <Cale> (like when you actually need to serialise it)
17:06 des_ joined
17:06 <Banana_> Cale: But don't you think it's silly to encode to json and decode it just to have an homogeneous data structure? I know you can just existantial quantification, but you're still introducing a serialization cost that's not needed
17:07 richi235 joined
17:07 <Cale> When though?
17:07 <Banana_> And additionally, the ToJSON and FromJSON constraints, which I happen to luckily already have, but normally that'd be a problem too.
17:07 <Cale> When do you incur that cost?
17:07 <barrucadu> Banana_: Why do you need a homogeneous cache in the first place?
17:07 <Cale> You only pay for what you use
17:07 <Banana_> barrucadu: Storing all the entities in a game, of various types.
17:08 <Banana_> As well as settings, as well as everything in the game.
17:08 <Banana_> All are serializable and exchangeable with the server.
17:08 eacameron joined
17:09 <Banana_> They get cached to avoid asking the server the same information twice unnecessarily.
17:09 warlock joined
17:09 gienah_ joined
17:09 <Banana_> As you move around the world, some information becomes uneeded. Let's say, players, guilds, buildings, monsters, routes, stats, channels, items, so on.
17:09 aarvar joined
17:10 <Banana_> These unloads and gets reloaded again later on if they're needed again. They're all kept in that memory cache under a Dynamic.
17:10 plutoniix joined
17:10 jbiesnecker joined
17:10 <Cale> Okay, what do you do after you fromDyn/fromDynamic the things?
17:10 merijn joined
17:11 <Banana_> Cale: I use it.
17:11 <Banana_> Cale: Since I always know the monomorphic type of what it was and what it will be, it's just merely temporarily stored in cache.
17:12 fendoer joined
17:12 <Cale> okay, so you *do* need arbitrary operations on these values
17:12 <Cale> which are specific to their original types
17:12 soLucien joined
17:12 <Cale> Not just conversion to JSON
17:12 <Banana_> The only issue, is that when it gets unloaded from the cache, the server gets notified and telling the server about it is a problem, since Dynamic looses type information, so I decided to store an extra IO () with it.
17:12 takle joined
17:13 Swizec joined
17:13 <sshine> using Megaparsec, I get an 'Either (ParseError (Token String) Dec) AST', and I wonder how to pretty-print that ParseError thingy.
17:13 plutoniix joined
17:14 <Cale> sshine: Have you tried just printing it? Does it not already prettyprint?
17:14 <sshine> ah, parseErrorPretty
17:14 ludat joined
17:14 <sshine> Cale, nah, its show isn't that nice.
17:14 <Cale> parseErrorTextPretty
17:15 <Cale> oh, yeah, and that
17:15 <sshine> thanks :)
17:16 jdnavarro joined
17:16 plutoniix joined
17:17 infinity0 joined
17:17 magneticduck joined
17:17 preyalone joined
17:18 dan_f joined
17:18 dni joined
17:21 melop joined
17:22 cpennington joined
17:23 plutoniix joined
17:23 fotonzade joined
17:24 <itachi> Every monad instance also hass a applicative instance right?
17:24 <ski> you can easily build one
17:25 <itachi> What is a example of an applicative instance which does not have a monad instance
17:25 <ski> `pure = return' and `(<*>) = ap'
17:25 <Cale> itachi: ZipList
17:25 <ski> and with `Monad' now being a subclass of `Applicative', it's enforced that an `Applicative' instance exists, if a `Monad' instance does
17:26 <Cale> oh, and there's a more important example now too... Validation
17:26 <glguy> itachi: Const
17:26 <Cale> and yeah, fine, Const
17:26 deech joined
17:26 <itachi> k
17:27 steeze joined
17:29 eacameron joined
17:29 MrWoohoo joined
17:30 govg joined
17:30 replay joined
17:31 codesoup joined
17:33 plutoniix joined
17:33 Berra joined
17:33 melop left
17:34 ner0x652 joined
17:34 nek0 joined
17:34 pfoetchen joined
17:35 plutoniix joined
17:35 amused joined
17:35 uglyfigurine joined
17:35 guampa joined
17:36 amused joined
17:37 eacameron joined
17:38 tax joined
17:40 kristjansson_ joined
17:40 plutoniix joined
17:41 ompaul joined
17:41 kristjansson_ joined
17:41 nagyf joined
17:42 <nagyf> Hello everyone, anyone used the SDL binding called sdl2?
17:42 dni joined
17:43 eacameron joined
17:43 <nagyf> I'm trying to run one of it's examples, but I get an error that it cannot find the Paths_sdl2 module
17:44 kristjansson joined
17:44 albel727 joined
17:45 tlaxkit joined
17:45 <byorgey> Cale: I think you mean AccValidation
17:46 chlong_ joined
17:46 <byorgey> Data.Validation defines both the Validation type (which is isomorphic to Either and has a Monad instance) and AccValidation (which is structurally isomorphic to Either, but the Applicative instance accumulates failures monoidally, and there is no Monad instance)
17:47 zalezd joined
17:47 <zalezd> hey everyone
17:48 <ski> hello zalezd
17:48 <zalezd> new to coding and im looking for a little help on a code for school
17:48 <c0dehero> zalezd: what's the problem?
17:48 <zalezd> I found this site on you tube and decidedxc to try it
17:48 <cocreature> zalezd: just ask your question directly :)
17:48 <c0dehero> also, starting with haskell?
17:49 <c0dehero> that's bold :D
17:49 <EvanR> good choice
17:49 <zalezd> ok thanks
17:49 codesoup joined
17:50 <zalezd> can i paste a code on here?
17:50 warlock joined
17:50 <Ferdirand> please no
17:50 <cocreature> zalezd: paste on http://lpaste.net/ and then paste the link here
17:51 eacameron joined
17:51 <zalezd> ok thanks
17:51 mstruebing joined
17:52 pera_ joined
17:53 <zalezd> error: A namespace does not directly contain members such as fields or methods
17:53 <zalezd> http://lpaste.net/354407
17:54 <zalezd> thanks everyone in advance
17:54 <cocreature> zalezd: I’m sorry but this channel is about the Haskell programming language
17:54 theelous3 joined
17:54 <cocreature> zalezd: that looks like c++
17:54 <zalezd> ok can you direct me to a channel for begginers c#
17:54 rokudoku joined
17:55 <zalezd> im using Visual Studio
17:55 <EvanR> /join ##csharp
17:55 <cocreature> https://stackoverflow.com/questions/3879140/channels-for-java-java-ee-c-asp-net-and-soa suggests ##csharp
17:56 <zalezd> ok thanks everyone!!
17:56 <Sornaensis> SOA?
17:56 HugoDaniel joined
17:57 <nagyf> There are some image files that is needed to run my haskell program. I'm using stack as build tool. Is it possible to configure stack to copy these images next to the executable after build?
17:57 <dfeuer> glguy: one challenge is figuring out where getting easy reduction is helpful and where it's just confusing.
17:58 <dfeuer> For example, incrementing a number always gives a number with at least one bit.
17:58 plutoniix joined
17:58 nilof joined
17:58 <dfeuer> So should Inc n reduce immediately to hd ': tl, or not?
17:59 path[l] joined
18:00 <zalezd> well no help in the other channel ##csharp
18:00 <EvanR> you have to be patient
18:00 <EvanR> on the other hand you could drop c# and do haskell instead!
18:01 Kundry_Wag joined
18:02 <zalezd> its for school not much choice
18:02 plutoniix joined
18:02 <ongy> and hey, C#8 will probably support pattern matching and record types
18:02 <EvanR> well then be patient in ##csharp
18:03 jbiesnecker joined
18:04 eacameron joined
18:04 <ski> ongy : not variant types, then ?
18:04 doomlord joined
18:04 des__ joined
18:05 <c0dehero> zalezd: ....
18:05 <c0dehero> i don't know what disappoints me more. that you ask this question in #haskell or that you can't understand the compiler message and google it..
18:05 significance joined
18:05 <c0dehero> like ..... come on http://stackoverflow.com/questions/21175781/a-namespace-cannot-directly-contain-members-such-as-fields-or-methods-in-net-r
18:05 JuanDaugherty joined
18:06 <glguy> c0dehero: No, that's neither necessary nor on topic
18:07 <c0dehero> oh wait, right
18:07 <c0dehero> i'm an idiot
18:07 <c0dehero> lol
18:07 <JuanDaugherty> c# and hs not same thing?
18:07 <JuanDaugherty> TIL
18:08 epsilonhalbe joined
18:09 <EvanR> well theres apparently a functional style for c#
18:09 <EvanR> haskell is that influential
18:09 <dfeuer> You can write pretty much anything functional-style, but it can be pretty hard.
18:09 eacameron joined
18:10 <JuanDaugherty> haskell is just the major player in something it hardly started and prolly won't finish
18:10 <c0dehero> sry zalezd
18:10 Einwq joined
18:10 <JuanDaugherty> just the most popular kid
18:11 <monochrom> No, I think it's Erik Meijer who is the influential one.
18:11 <dfeuer> Functional-style Postscript might not be that much harder than any other structured Postscript; those few Postscript programmers out there are already used to handling environments manually...
18:11 <dfeuer> monochrom: huh?
18:11 monochrom left
18:11 <JuanDaugherty> thing is when a lang or pkg get's that it never completely goes away until the adherents age out
18:11 monochrom joined
18:11 <JuanDaugherty> *gets
18:11 <monochrom> to explain why C# supports functional style.
18:12 <dfeuer> Ah.
18:14 eacamero_ joined
18:14 Kreest__ joined
18:16 SpaceGazebo joined
18:17 zcourts_ joined
18:17 sigmundv joined
18:18 eacameron joined
18:18 twanvl joined
18:18 <zalezd> almost got it!!
18:18 <zalezd> still working on it!
18:18 zcourts_ joined
18:19 cyborg-one joined
18:19 Ferdirand joined
18:19 nbro joined
18:19 <c0dehero> zalezd: nice. you know that you have mismatched braces, right?
18:21 <zalezd> yes
18:21 <zalezd> only one error left
18:21 <c0dehero> okay
18:21 buglebudabey joined
18:22 simukis_ joined
18:22 plutoniix joined
18:24 <tobiasBora> Hello,
18:24 <tobiasBora> Is there any way to install a stack project systemwise ?
18:24 <earldouglas> If I cabal install with --enable-coverage, then copy the binary onto another machine, no .tix file is generated when I run it. Is there something environmental I need to do on the second machine to enable coverage?
18:24 <tobiasBora> I could manually copy the exec file, but I was looking for a "proper" install
18:26 dagda1 joined
18:27 <earldouglas> Strike that; I am able to generate the .tix file after all.
18:27 tzh joined
18:29 tobhe joined
18:30 IanKelling joined
18:31 plutoniix joined
18:33 tobhe joined
18:34 <significance> It seems pretty easy to implement foldr for lists (i.e. with type (a -> a -> a) -> a -> [a] -> a) recursively -- how might I implement foldl similarly?
18:34 <glguy> You'd also implement it recursively
18:34 <significance> glguy: Would my basecase be the same?
18:34 iAmerikan joined
18:34 <significance> i.e. foldr _ [] s = s?
18:35 <glguy> yeah
18:35 <significance> how might I pattern match for the rightmost element of a list?
18:35 tobhe joined
18:35 <glguy> You wouldn't
18:35 <monochrom> Cannot. And do not.
18:35 <glguy> (and can't)
18:36 <glguy> foldl and foldr both process the list from beginning to end, left to right
18:36 ChaiTRex joined
18:36 <Cale> It is physically impossible to process a list in any other order.
18:36 <significance> ahh, got it -- thank you!
18:36 <EvanR> its a simple matter to process a list from right to left, first reverse it
18:36 <monochrom> foldl will require you to think a bit differently from foldr
18:37 <Cale> Of course, reversing it will process it from left to right :D
18:37 nepiktaz joined
18:37 <EvanR> but it doesnt make sense to process an infinite list starting from the end
18:37 <Cale> But that's not what foldl does
18:37 <Cale> (it doesn't need to reverse anything)
18:37 aarvar joined
18:37 <EvanR> so it really is an asymmetric situation
18:37 plutoniix joined
18:38 <Cale> The r and l refer to the manner in which the expressions are associated into a tree, rather than the order in which they occur from left to right
18:38 <Cale> foldr's tree leans to the right, while foldl's tree leans to the left
18:38 <Cale> but the leaves are in the same order that they occurred in the list
18:39 <monochrom> reverse is actually a special case of foldl. You may or may not be able to draw inspiration from this.
18:39 <Cale> reverse = foldl (flip (:)) []
18:39 <Cale> id = foldr (:) []
18:41 Itkovian joined
18:41 marsam joined
18:41 andyo joined
18:41 Marumarsu joined
18:42 simukis_ joined
18:42 <significance> thank you all!
18:43 ralu joined
18:45 tobhe joined
18:46 <hc> hi, looking at https://hackage.haskell.org/package/scotty, why are some of the version numbers displayed in green?
18:46 <hc> what's the semantics behind this? :)
18:47 <geekosaur> https://hackage.haskell.org/package/scotty/preferred
18:47 <JuanDaugherty> build state looks like
18:47 <geekosaur> although I'd arguye orange and green should be swapped there
18:47 <hc> another question, anyone here who maintains scotty? the example in the readme looks like it's got an xss problem
18:47 <MarcelineVQ> hc: click the info link at the end of the versions :>
18:47 <hc> geekosaur: thanks
18:49 albertus1 joined
18:49 albertus1 joined
18:50 ubsan_ joined
18:50 unK_ joined
18:50 albertus1 joined
18:50 tobhe joined
18:50 cchalmers joined
18:51 Ferdirand joined
18:52 <hc> another question about scotty (https://hackage.haskell.org/package/warp-3.2.9/docs/Network-Wai-Handler-Warp-Internal.html#t:Settings): is it possible to limit the maximum size of uploaded files per http request?
18:52 Mon_Ouie joined
18:52 <hc> (i don't see it in the list of settings)
18:53 takle joined
18:54 path[l] joined
18:55 iAmerikan joined
18:56 jbiesnecker joined
18:57 doomlord joined
18:57 zcourts joined
18:59 Flocks joined
18:59 cchalmers joined
19:00 chaosmasttter joined
19:00 zcourts_ joined
19:01 <nagyf> :R
19:02 <nagyf> oops
19:03 locallycompact joined
19:05 pheaver joined
19:06 <tobiasBora> Hello,
19:06 jbiesnecker joined
19:06 <geekosaur> world!
19:07 steeze joined
19:07 Itkovian joined
19:09 eacameron joined
19:10 cdg joined
19:13 Cassiopaya joined
19:13 freechips joined
19:13 b4ff3r joined
19:15 meghnath joined
19:16 Yuras joined
19:16 iAmerikan joined
19:16 cspollard joined
19:17 adirsms52 joined
19:17 sleffy joined
19:18 simukis_ joined
19:20 uuplusu_ joined
19:20 merijn joined
19:21 spoonm joined
19:21 epsilonhalbe left
19:22 Ferdirand joined
19:24 takle joined
19:24 spoonm joined
19:25 alx741 joined
19:25 Yuras joined
19:25 iAmerikan joined
19:27 JuanMiguel joined
19:28 Voldenet joined
19:28 Voldenet joined
19:29 WarmCookie joined
19:29 Wuzzy joined
19:30 <WarmCookie> Hi. Is it possible to have a MINIMAL definition for a type class that says `If A is implemented, then so must be B` ?
19:33 path[l] joined
19:33 <byorgey> WarmCookie: no, it's not. You only get logical conjunction and disjunction. There is no way to express implication.
19:34 <byorgey> Can you give an example of a situation where you would want it?
19:34 stevenxl joined
19:35 <byorgey> hmm, but can't you just add B as another conjunct in every disjunct where you would want A? So if you had A,D | A,C | C you would change it to A,B,D | A,B,C | C
19:36 freechips joined
19:36 redpoppies joined
19:37 <EvanR> isnt class A a => B a where implication (though backwards)
19:37 <byorgey> Hmm, yes, in fact, you can express any truth table using only AND + OR, so anything you could possibly want to express can be expressed already
19:37 <lyxia> it somehow works out because classes are finite
19:37 darktenaibre joined
19:38 <merijn> WarmCookie: You can use and/or for specifying minimal sets
19:38 <byorgey> it might not be as concise as if you had an implication operator but you can do it.
19:38 <cocreature> EvanR: that’s implication on the class level. MINIMAL is about the definitions in a single class
19:38 <EvanR> oh i dont know what MINIMAL is
19:39 <merijn> EvanR: A pragma to indicate the minimal complete definition of an instance
19:39 <dolio> byorgey: How do I write NOT using AND + OR?
19:39 <merijn> EvanR: So "== OR !=" for Eq
19:39 <merijn> EvanR: because of default definitions :)
19:39 <WarmCookie> byorgey: I'd like it be so that {-# MINIMAL storeCreate, storeRead, storeUpdate, storeDeleted, Optionally(storeInit, storeQuit) #-}
19:40 <EvanR> if its optional, wouldnt minimal be just not implementing it
19:40 <byorgey> dolio: oh, duh, I'm wrong, aren't I.
19:40 <dolio> :)
19:40 HugoDaniel joined
19:40 <cocreature> WarmCookie: what are the semantics of Optionally here?
19:41 perlnecrohacker joined
19:41 <WarmCookie> cocreature: Where this type class requires these 4 methods, and possibly two more methods if you chose to implement either storeInit or storeQuit.
19:41 <byorgey> maybe it means you can implement both or neither, but you can't just implement one of them?
19:41 <WarmCookie> byorgey: That's the goal, yes.
19:41 <glguy> WarmCookie: The purpose of the minimal pragmas is to avoid circular definitions because of default implementations
19:41 <byorgey> yeah, you can express that but it's going to be annoying: you have to write A,B,C,D,E,F | A,B,C,D
19:41 <cocreature> that seems weird
19:42 <byorgey> i.e. you have to duplicate the four required methods
19:42 chlong joined
19:42 <cocreature> byorgey: that still won’t stop you from implementing only one method
19:42 <WarmCookie> byorgey: I was hoping for something nicer but I'll roll with that.
19:42 Blazoen joined
19:42 <byorgey> cocreature: oh, you're right, it won't.
19:42 Mon_Ouie joined
19:42 <cocreature> the first part is completely redundant
19:42 ubsan_ joined
19:42 <byorgey> WarmCookie: ignore me, cocreature is right, that doesn't work
19:43 <byorgey> I agree this seems weird.
19:43 <cocreature> WarmCookie: you got me interested. how can you make default definitions that break if you implement only one of them?
19:45 Deide joined
19:45 <WarmCookie> cocreature: In my case, the methods have effects using IO and am worried it could leave the remote resource in an inconsistent state.
19:46 <WarmCookie> Granted this is something that has to be robust anyway, I was just wondering if I could "express my intention" to people implementing the type class.
19:46 <WarmCookie> *their instance
19:46 pranz joined
19:46 <glguy> WarmCookie: What you could do is to make one of your class methods a tuple of two things
19:46 <arpl> Hello. New to Haskell. (From C/Asm) I find the paradigm shift interestingly challenging ... which is always a good thing : )
19:46 <arpl> I will have questions about using the language too, but I would like to ask a question now about how people who write a substantial project start the process.
19:46 <arpl> When setting up a project, do Haskellers generally start with an 'algorithmic structure' or rather with 'data modelling'? I have a feeling the latter (but of course that is not what you see in learning materials about the language). If it is indeed the latter, how do you prevent being over-specific? And in what way do you get the most from the help the type system has to offer?
19:46 <glguy> storeInitQuit :: (StoreInitType,StoreQuitType)
19:47 <WarmCookie> glguy: That's a great idea.
19:47 <glguy> now you can write some helpers for: fst storeInitQuit and snd storeInitQuit
19:47 fotonzade joined
19:47 <cocreature> arpl: definitely the latter for me. I usually just define a few data types and then the type signatures of the main functions in my program and only then I start implementing them and thinking about the more fine grained control flow
19:48 <merijn> glguy, WarmCookie: Better yet, don't have separate init/quit but use a bracket pattern
19:48 amuck joined
19:48 _ashbreeze_ joined
19:48 obadz joined
19:48 stevenxl joined
19:48 <merijn> arpl: I'd say it depends on the problem
19:49 Itkovian joined
19:50 <WarmCookie> It's more intricate than that I fear. I will catch any problem during the operations; but I'd like each new data store implementation added to the project to consistently have the same interface, where if one data store decides to take the responsibility for initializing resources, it should also deinitialize them.
19:50 Xanather joined
19:50 <WarmCookie> glguy: No need, the library will be the only one calling these methods internally :)
19:51 <merijn> WarmCookie: Are you familiar with bracket?
19:51 <WarmCookie> merijn: Yes. There's resource acquisition, use, and release.
19:52 Blazoen left
19:52 Rainb joined
19:52 <WarmCookie> But it's a pattern that works for expressions; not to encode or enforce your intentions in regards to the interface of a type.
19:52 <merijn> WarmCookie: Right, so wouldn't that avoid the entire "implemented acquistion but skipped release" issue by putting them in one definition?
19:52 nepiktaz joined
19:53 <merijn> WarmCookie: I'm not sure I see why not? But it depends on the details of what you're doing, I suppose?
19:53 <WarmCookie> Probably. I think glguy's suggestion is as good as it gets.
19:53 Gurkenglas joined
19:53 <WarmCookie> byorgey: cocreature `a, b | a, b, c` doesn't work?
19:53 jgt1 joined
19:54 Itkovian joined
19:54 <cocreature> WarmCookie: that’s equivalent to a,b
19:54 jason85 joined
19:54 Lemmata joined
19:54 <WarmCookie> Ah it's reductible. I see.
19:54 <cocreature> it’s the minimal set of definitions. not all possible combinations.
19:55 raichoo joined
19:55 <WarmCookie> Do we have a {-# COMPLETE #-} :P ?
19:55 <cocreature> I don’t think so :)
19:55 <WarmCookie> Ignoring my use case, I think it could be useful.
19:56 <cocreature> I’m not convinced tbh but I haven’t thought about it long enough to make a convincing argument for why this is not needed :)
19:56 <WarmCookie> cocreature: merijn glguy byorgey Much appreciated. Thanks for the help and warm support.
19:57 ragepandemic joined
20:01 fizruk joined
20:01 <arpl> cocreature, merijn: Thanks. And that is of course the problem with a question like that ... it depends : ) Specifically I was thinking about modelling a disk. Which (with LBA access) is just a list of sectors numbered from 0 to some maximum (or even infinity). But not all sectors are the same with regard to their usage. (LBA0 carries the information for the whole disk, partition table ...) For learning I can just start s
20:01 boombanana joined
20:02 itachi joined
20:03 <merijn> arpl: Modelling for what purpose? But yeah, I agree with cocreature that I usually start by defining datatypes (not even their constructors/what they look like) and the types of functions I'd like to perform on them
20:03 <ski> (suspected cut off near end of ".. For learning I can just start so")
20:07 agjacome joined
20:07 <arpl> merijn: Disks is what I am familar with. I just want to get used to the type system and get the most out of it. So I have a familiar framework that I want to 'capture' in Haskell types. My initial question was something I was wondering about. I guess for this I better write something down and then get back here.
20:08 replay joined
20:08 yellowj joined
20:09 Xanather_ joined
20:10 jgt1 joined
20:10 <* ski> is suspecting arpl might want dependent types
20:11 nick_h joined
20:13 tput joined
20:13 <arpl> ski: I don't know about that (because I don't know enough about dependent types). I think that things can be expressed with the 'base' type system. Although I do think that certain things could be expressed better with 'type level programming' instead of relegating the validation to smart constructors (or similar).
20:14 tput joined
20:14 <EvanR> dependent types can express anything, given enough patience and ideally an artificially intelligent assistant
20:15 <arpl> [Will check out <https://wiki.haskell.org/Dependent_type>]
20:16 stef204 joined
20:16 <ski> arpl : perhaps <https://en.wikipedia.org/wiki/ATS_(programming_language)> will have some interest
20:17 <ski> with dependent types you could express in the types how many sectors you have, and express exactly how many blocks each sector is (which may vary depending on the sector number) .. and the compiler will check these sizes at compile-time
20:18 significance joined
20:19 <ski> (you could use arrays (having a specified size) in C to express that information, but you'd have to divide it up in "chunks" depending on the sector size .. with dependent types, you don't need that)
20:20 <arpl> ski: Will look at that too. For learning purposes I don't mind if things are initially a bit kludgy (because that also shows where the limits are). But being able to check those things at compile time is certainly a property I was looking for.
20:20 <ski> anyway, in Haskell (which doesn't have dependent types), you could e.g. use an array whose elements are arrays. the sizes would be checked at run-time
20:20 path[l] joined
20:20 Kuros joined
20:20 azahi joined
20:21 <ski> anyway .. i'd suggest trying to dive in to Haskell, and understand the basics of it "on its own merits", before thinking too much about how it compares to things you already know
20:22 <monochrom> Comparison is noble, but it also comes with the prerequisite of actually knowing.
20:23 pranz joined
20:23 <ski> being able to use the type system to your advantage is an acquired skill
20:25 the_2nd joined
20:25 <the_2nd> if I want to only pattern match a list with n parameters, is (x1:x2:x3:[]) fine?
20:25 <ski> as one of the initial steps, imho, you should aim towards being able to infer types of monomorphic and polymorphic operations in your head. the point being to *internalize* the type system (which is really quite reasonable, when you've familiarized yourself with it .. at least sans extensions)
20:26 <arpl> ski: That was the idea ... doing things the Haskell way. (I was merely using a familiar concept, not the techniques.) Like I said: a disk in LBA mode is nothing more than a l[Sector] of a certain size. And because there are different kinds of sector contents I would parameterize the Sector type. And acquiring skill is the goal : )
20:26 <ski> the_2nd : in case `n = 3', yes
20:26 <the_2nd> ski, thanks
20:27 <cocreature> the_2nd: you can also use [x1,x2,x3]
20:28 <the_2nd> cocreature, that's slightly better
20:28 <ski> arpl : of course, there's many other lessons. expressing iteration and looping as recursion. learning about pattern-matching (no, not regexen, nor something as simple as `switch'). handling immutability, learning when you really need/want mutability and when you don't. non-strict evaluation. &c.
20:30 <ski> arpl : pattern-matching is tied to so-called "disjoint union" types (aka "variant types", "sum types", "~ algebraic data types", &c.). this is "dual" to record types (`struct'). it's important to realize that there's commonly a trade-off between these two
20:30 mekeor joined
20:31 <merijn> the_2nd: Note that any other list will result in a crash, though :)
20:31 jgt1 joined
20:31 <ski> arpl : oh .. and of course treating functions as first-class values, passing them as arguments, returning them, storing them in data-structures, computing new functions at run-time (going beyond the use of function pointers in C)
20:31 <ski> in short, higher-order programming
20:32 <the_2nd> merijn, nope :) http://lpaste.net/2618949307662860288
20:33 jbiesnecker joined
20:33 moth joined
20:34 <ski> arpl : then, also some Haskell specialities, like side-effect-freeness, and how that affects the I/O system, and other stuff that's traditionally been expressed through side-effects (mutable state, (erratic and angelic) nondeterminism, exceptions, `setjmp'/`longjmp', &c.)
20:35 <monochrom> erratic? heh.
20:35 <merijn> the_2nd: I meant if you don't have any other cases. If you do, it's fine :)
20:35 <ski> arpl : probably all these things doesn't tell you that much atm .. i'm merely trying to point out that there's (potentially) interesting things to learn here
20:35 HugoDaniel joined
20:35 <monochrom> It should be demonic and angelic, but I guess sometimes the demon can't make up its mind.
20:36 <the_2nd> merijn, doens't hurt to let you verify
20:36 <ski> well, iiuc, demonic is when it's actively out to get you
20:36 <ski> erratic is when it doesn't care
20:36 <Gurkenglas> Is there some way that doesn't involve exceptions to get rid of "return" in each line? (The one with exceptions would be to use teaspoon to turn pattern match failure into Nothing)
20:36 <ski> so demonic reasoning would be used in worst-case scenarios
20:36 <merijn> Gurkenglas: It depends?
20:36 <ezyang> Gurkenglas: Does Either/Maybe monad count?
20:37 <geekosaur> Gurkenglas, you might show the code in question
20:37 cchalmers joined
20:37 <geekosaur> since it's hard to answer that otherwise
20:37 <Gurkenglas> I meant <the_2nd> merijn, nope :) http://lpaste.net/2618949307662860288
20:37 <ski> (depending, the difference may not be that large)
20:37 <Gurkenglas> ezyang, but then you still have to say return/Just, right?
20:38 <ski> arpl : .. does that help any ?
20:38 <ezyang> Gurkenglas: what are you really trying to do
20:38 <arpl> ski: Yes, that part (functions as first-class citizens) is part of the other thing I was contemplating to exercise with. (Which also has a clearer part to expansion.) A job is a pair of data and a list of functions that should act upon that data. What I want to explore with that is how I differentiate and order the functions that I am passed in. (In a specific case: Data is Text. Functions are encrypt and compress. Of course you will fi
20:38 <* geekosaur> thinks he's just seen the first thing that sends him seriously thinking about TH :)
20:38 <arpl> ski: Yes, that does help : )
20:38 <Gurkenglas> ezyang, I saw http://lpaste.net/2618949307662860288 and thought that it ought to be possible to get rid of those return lines
20:39 <monochrom> The "return" there means "Just". Look at the top type signature.
20:39 <merijn> Gurkenglas: You could replace the individual cases and do "return $ case vars of"
20:39 <geekosaur> doesn;t fly for Nothing/fail
20:39 <Gurkenglas> monochrom, yea but putting Just everywhere isnt better than putting return everywhere
20:40 <ezyang> I don't think there is a convenient way around this
20:40 <monochrom> I don't think the "return" can be fundamentally eliminated.
20:40 <ski> arpl : the side-effect-freeness is related to making it easier to reason about and refactor a program ("predictive power" as monochrom calls it, as opposed to "cavalier power", being the same as "expressive power") ..
20:41 <the_2nd> merijn, Gurkenglas "final" version, guess it's nice this way :) http://lpaste.net/8894904886655713280
20:41 <monochrom> Mainly because Haskell doesn't have "null". Every exception-like mechanism adds a Maybe or IO to your type.
20:41 <ski> arpl : .. people usually doesn't appreciate how important this is, until they've tasted it (and sometimes not even then, due to not clearly understanding what is making the difference)
20:42 <the_2nd> ski, coding c# at work, makes me cry
20:42 <the_2nd> null all the things
20:42 <ezyang> You can make it easier by defining a teeny helper function
20:43 <the_2nd> ezyang, also with mixed param count?
20:43 <monochrom> ski: No, I coined "cavalier" because precisely there is some kind of expressive power that increases predictive power and decreases cavalier power, for example to be able to write the type "forall a. a -> a".
20:43 <arpl> ski: Yes I understand. When I wrote "a clearer part to expansion" I was meant refactoring. That the specifications would change and the implementation needs to change. Goal: I want to refactor without fear! : )
20:43 <ski> arpl : yeah .. i'm not explicitly mentioning all the things that commonly is wrong in languages (like `NULL'), that Haskell gets right "automatically", so to speak. concentrating on the strengths (or at least interesting points), proper, not on weaknesses of other languages
20:43 <ezyang> the_2nd: yes you can do it
20:43 <the_2nd> ezyang, I'll also add "sum" xs etc later on
20:43 meoblast001 joined
20:44 <monochrom> In other words "expressive power" is simply a big mix bag that contains both and tells you nothing.
20:44 <ski> arpl : oh, actually, you said ".. (In a specific case: Data is Text. Functions are encrypt and compress. Of course you will fir", getting cut off and the end, a bit up
20:44 eh_eff joined
20:45 <Gurkenglas> Here's the aforementioned way to get rid of the returns using exceptions. http://lpaste.net/8894904886655713280#a354410
20:45 <arpl> ski: Better make the messages shorter then : ) Is there a limit? (Not only new to Haskell, new to IRC too. ; )
20:45 <ezyang> well, a simple way to do it is to just say f s [x] = helper s x
20:45 <ski> arpl : .. this is not to say that Haskell doesn't have flaws, though
20:45 <monochrom> Yikes, teaspoon.
20:46 <ski> arpl : iirc, around fivehundred characters or so (perhaps less ?), depending on the IRC server in question one's connected to. this is a weakness/bug in the IRC protocol, yes
20:46 Eduard_Munteanu joined
20:46 <ski> arpl : some IRC clients offer ways to automatically break your lines, by *guessing* the length (you can't really do better, iiuc)
20:47 <geekosaur> packet size 512 octets, minus protocol overhead
20:47 <glguy> and "protocol overhead" is dependent upon the length of your hostname :)
20:47 <geekosaur> and I think you can guess pretty accurately since the overhead is well characterized by the protocol. but it will depend on stuff not visible in a client like that
20:47 hurkan joined
20:48 <geekosaur> also on things like mIRC color/attribute codes which take no space on the display but several octets in the packet
20:48 <glguy> and the server wil tell you what it's using as your hostname
20:48 kiltzman joined
20:48 <glguy> clients do the computation accounting for formatting control codes
20:48 <arpl> ski: Of course. Nothing is perfect. I wanted to get my teeth into functional programming for some time. I like to be able to use the various paradigms (I even had fun programming in PostScript ... which is stackbased; as you may know, or similar to RPN.)
20:48 meck joined
20:48 bjz joined
20:49 <monochrom> Did you write ray-tracing in Postscript? :)
20:49 <ski> monochrom : ok, so you're there using "expressive power" in a wider sense that i was using it (namely referring to the possible behaviours of a program .. and how that can be changed by *local* changes ion the program) -- but i agree that it's not clear this makes fully sense, due to contravariance ..
20:49 <monochrom> It is just like "nondeterminism".
20:49 koneida joined
20:51 <glguy> https://github.com/glguy/irc-core/blob/ccbd68b744d5d375e08c7fe570ba2acbdd641471/lib/src/Irc/Message.hs#L288
20:52 <arpl> monochrom: No : D But I did use it as a 'general programming language', not just the page description part.
20:52 <arpl> ski: I have found a way to solve the length part quickly.
20:52 <arpl> ski: I just insert <CTRL-Enter> in the message and it gets posted as one blob, but not overflowing the max. length.
20:53 <koneida> hello haskell people. I have what I think is a simple parsec question. I'm trying to write a simple parser for lisp, and I want it to allow input like "( + 1 1 )" (with the extra spaces near the parens). I can get the open-parens to work, but not the close parens. I pasted the relevant code at https://pastebin.com/LN1sSnMd
20:53 <ski> arpl : "Goal: I want to refactor without fear!" -- Haskell does help with that, both by side-effect-freeness (enabling more powerful equational/equivalence reasoning), and by usually pointing you to the code that needs to change, when you're changing your data types (in GHC, flags `-fwarn-incomplete-patterns',`-fwarn-overlapping-patterns')
20:54 <EvanR> koneida: after each logical token consume extra whitespace
20:54 <EvanR> and do nothing with it
20:55 <EvanR> and begin the entire parse by consume any leading whitespace, then do nothing with it
20:55 <the_2nd> EvanR, seems like he does so already
20:55 <koneida> I think that's what I'm doing -- I wrapped the parse in two calls to spaces
20:55 <monochrom> koneida: Here is my example of what EvanR said: https://wiki.haskell.org/Parsing_expressions_and_statements
20:56 <EvanR> make sure "spaces" works properly
20:56 Sh4rPEYE joined
20:56 <EvanR> the second spaces shouldnt be necessary if everything is doing this strategy
20:56 <arpl> ski: (22:54:10) ski: Received CTCP 'VERSION' (to arpl) from ski
20:56 <arpl> (22:54:36) arpl: Deliberate message or accidental?
20:56 <arpl> (22:54:36) ski <AUTO-REPLY> : Security System Breached
20:56 <Gurkenglas> Maybe this way's acceptable? http://lpaste.net/8894904886655713280#a354411
20:57 <ski> deliberate, since i was wondering which version/client you were running
20:57 <ski> i used
20:57 <ski> /ctcp arpl version
20:57 <the_2nd> I'm out. As always, thanks everyone for the help
20:58 guampa joined
20:58 <monochrom> koneida: Notice that your current code does not eat spaces after ')', so you're inflicting on yourself a self-inconsistent convention and self-confusion.
20:58 Steven_ joined
20:58 Ferdirand joined
20:58 <arpl> ski: Ok. Am using Pidgin on a Debian VirtualBox machine.
20:59 <koneida> monochrom: I see that now. thanks.
20:59 e14 joined
20:59 freechips joined
20:59 <monochrom> Intead, we are saying that you should strictly follow the consistent convention of "each conceptual token is responsible for trailing spaces". For example parseList is responsible for its trailing spaces, parseDottedList is responsible for its trailing spaces, and therefore the closing paren is not going to worry about spaces before it, but it also has to eat spaces after.
21:00 zcourts joined
21:00 <joe9> I need a library to parse output from a socket. I can use cereal but am checking out attoparsec as it can handle partial/incremental input. Is attoparsec an alternative to cereal?
21:00 <koneida> monochrom: That makes sense. I'll give it a try and report back if I have no luck.
21:00 <glguy> joe9: all of binary, cereal, and attoparsec can process input in chunks
21:01 <EvanR> attoparsec is incremental but still hangs onto the entire input, so it wont work for an unlimited stream
21:01 <EvanR> unless you cancel out and start over from time to time
21:01 <merijn> EvanR: If you're getting a steam of small records that's easily solved
21:01 <joe9> EvanR: it is definitely not an unlimited stream.
21:01 <merijn> joe9: binary can do incremental input
21:01 <EvanR> is it easily solved?
21:02 <joe9> I am worried that the input might come in multiple chunks
21:02 <merijn> joe9: And it's more of an alternative to cereal than attoparsec
21:02 <merijn> joe9: Use something like pipes/conduit and the relevant parser wrappers to deal with that
21:02 <EvanR> it will certainly come in separate chunks
21:02 <EvanR> TCP has no knowledge of your content
21:03 <merijn> EvanR: Yeah, things like pipes-attoparsec can repeatedly apply a "chunk" parser to a stream of bytes, so you'll only need to keep one chunk of backtrack in attoparsec
21:03 <joe9> thanks folks.
21:03 <glguy> If you're parsing discrete messages using any of binary, attoparsec, or cereal, you can run the parser in incremental mode so that it completes after parsing a message message
21:03 <glguy> then you start a new parse initialized with the "remaining" input from the previous parse
21:03 <merijn> joe9: But anyway, I'd have a look at binary first
21:04 <merijn> As the name indicates, it's more aimed at binary formats than attoparsec
21:04 jbiesnecker joined
21:04 <glguy> "after parsing a complete message"*
21:04 <joe9> merijn: ok, Thanks.
21:04 <merijn> glguy: Right, but things like pipes can already take care of all that tediousness :)
21:05 <glguy> pipes is a big price to pay for what amounts to one line of calling the parser again
21:05 <koneida> monochrom: ok, got it working. thanks for your help!
21:06 <joe9> merijn: I have not ventured into pipes yet. It is a simple project and I do not want to use pipes for this.
21:06 <monochrom> koneida: And just now I found my s-expression parser: http://lpaste.net/114582
21:06 <merijn> glguy: big price? in what sense?
21:07 <glguy> Pipes brings in its own complexity that isn't needed for this simple situation
21:07 <merijn> glguy: Especially since it can help both handle cleanup of the socket and rechunking of input from said socket and consuming the stream of chunks
21:07 <glguy> If there was a significant amount of layering I'd agree that pipes could be beneficial
21:07 <glguy> perhaps chunks come in and then youre doing some kind of base 64 decoding and then some other layer, etc
21:08 <glguy> but not for just reading discrete binary messages off a socket
21:08 <EvanR> i would love a solution to this that doesnt involve pipes
21:08 <EvanR> this problem came up during a "do something useful with haskell" challenge
21:08 <joe9> I think Network.Connection.connectionGetChunk' and Cereal's Data.Serialize.runGetState seem to fill the need here.
21:09 zcourts joined
21:09 <merijn> EvanR: conduit? ;)
21:09 <EvanR> for someone without much haskell experience
21:09 <EvanR> pipes was a non starter
21:09 <EvanR> trifecta was a non starter
21:11 malakin joined
21:12 <monochrom> getContents was a non starter too.
21:12 <monochrom> Or rather, would be.
21:12 <glguy> Oh, don't forget not to start with machines
21:12 <EvanR> getContents was a non starter
21:12 <EvanR> machines too
21:12 <EvanR> im not sure if the problem would have been easier in C
21:13 <glguy> starting was probably a non-starter
21:13 <EvanR> would have its own share of non-robustness
21:13 <monochrom> C would give the illusion of being easier.
21:14 e14 joined
21:14 <EvanR> problem: incrementally process new data from a java log output file, recognize when the log entries are beginning and send the previous one to a web server
21:16 freechips left
21:17 spott joined
21:19 hamishmack joined
21:21 eacameron joined
21:22 cspollard joined
21:23 bencryption joined
21:24 iAmerikan joined
21:24 latro`a joined
21:25 <joe9> I have an integer value that is being sent on a socket as an ascii string. I plan to create a newtype ShowInt, instance Serialize ShowInt where put = pack . show . unShowInt
21:25 <joe9> not sure if that is overkill and if there might be a better way of going about it.
21:26 des_ joined
21:27 lbigg joined
21:28 eacameron joined
21:29 `^_^v joined
21:29 HugoDaniel joined
21:30 <Gurkenglas> EvanR, you mean "foo previous = do next <- fetch; if predicate next then send previous else foo next"?
21:30 soLucien joined
21:31 <EvanR> probably not
21:32 Micamo joined
21:32 eacamero_ joined
21:32 <EvanR> read a character when available until the buffer fills up with a complete log entry, you only know its complete when you see the beginning of a new log entry (which might conceivably be a false positive due to java log file contents)
21:32 nbro joined
21:32 <EvanR> at which point send the contents of the buffer up to the cloud
21:32 <EvanR> and start over
21:37 eacameron joined
21:37 vydd joined
21:37 vydd joined
21:40 spott joined
21:43 ChaiTRex joined
21:44 hybrid joined
21:44 iAmerikan joined
21:47 treehaqr joined
21:48 darjeeling_ joined
21:50 mr_sm1th joined
21:51 lbigg left
21:51 barryburd joined
21:51 klottie joined
21:52 hiratara joined
21:53 mizu_no_oto joined
21:55 ericdwhite joined
21:55 <klottie> I have a data type in a module. It does not derive Read, but I need to use read function for that type. If there were 'deriving Read' at the end of the type definition line, there would be no problem but I do not have access to the module. Is there a way to add that functionality in a separate file? I tried 'instance Read Foo' but it did not work as I described.
21:56 <EvanR> theres standalone deriving clauses
21:57 peterhil joined
21:57 spott joined
21:57 <barryburd> Beginner question: I’ve defined “data Length = Length Double Units” and “data Currency = Currency Double Locale”. I want to create a “class Convertible” with two functions, fromUS and toUS. So, for example, toUS converts meter lengths to foot lengths and toUS converts euro amounts to dollar amounts. It seems to me that, in the declaration of the Convertible class, I ought to be able to define fromUS in terms
21:57 <barryburd> toUS so that the minimal declaration for an instance is toUS. Is this possible? I understand that finding inverses is undecidable but this is such a simple inverse inverse function — only one value (the multiplier) to define for each instance.
21:57 <klottie> EvanR: Do you mean 'data Foo deriving Read' after the original definition as a separate line?
21:58 <EvanR> it doesnt look quite like that but yes
21:58 bennofs joined
21:58 <EvanR> currency as a Double o_O
21:58 <EvanR> use Centi from Data.Fixed
21:59 <EvanR> or Rational if you want the inverse to actually work
21:59 <barryburd> EvanR: Sorry about using Double. It’s not meant to be an industrial strength app.
21:59 <barryburd> Rational might work.
21:59 <glguy> EvanR: Maybe it's needed to find the sin or cos of the money, too?
21:59 <EvanR> o_O
21:59 <glguy> sqrt of the dollars?
21:59 <EvanR> reimann zeta function of dollars?
22:00 <barryburd> OK. I get it. Don’t use Double.
22:01 <glguy> barryburd: sure, you can write a default definition for fromUS in terms of toUS
22:02 <glguy> it might even be the case that only one of the two actually needs to be in the class
22:03 jbiesnecker joined
22:04 <barryburd> giguy, Whenever I define an instance, I have to define how I’m going to pull the numeric value out of the value, and then put it back into the new value??
22:05 iAmerikan joined
22:05 Kundry_Wag joined
22:08 coot joined
22:08 jdt joined
22:09 <monochrom> There was just a neat haskell-cafe thread on money.
22:10 dpren joined
22:10 <monochrom> (The trick is there are many ways to round, and you need to use the one your accountants or lawyers require. Or else.)
22:11 <monochrom> (And because of that, Double's semantics is unlikely to fit your semantics.)
22:12 futuristic joined
22:12 moth joined
22:12 spott joined
22:13 <monochrom> (And more counterintuitively (for programmers anyway), sometimes the rounding requirement is not so much on individual numbers, but on a whole list. Round elements in the list such that the sum is nicely 100%, for example.)
22:13 klottie left
22:14 jbiesnecker joined
22:14 <barryburd> I understand the dangers of using Double.
22:15 yrdz joined
22:19 <glguy> Not to worry, no one is lecturing you
22:20 <barryburd> I’ve got to go, but anyway, if you say defining fromUS in terms of toUS is possible, I’ll keep working on it.
22:21 safe joined
22:22 fizruk joined
22:24 HugoDaniel joined
22:25 barryburd left
22:26 <EvanR> is there a name for the type Left a | Right b | Both a b
22:26 <Cale> These
22:27 <Cale> https://hackage.haskell.org/package/these-0.7.3/docs/Data-These.html
22:27 <EvanR> nice
22:27 <Cale> wow, such instances
22:28 <monochrom> Everything from JSON to bicrosswalk.
22:28 <Cale> https://hackage.haskell.org/package/these-0.7.3/docs/Control-Monad-Chronicle-Class.html#t:MonadChronicle
22:28 <Cale> wat
22:28 <monochrom> This is the true cause of dependency hell.
22:29 <lyxia> wtf is MonadChronicle
22:29 <nbro> ahah
22:29 <nbro> that’s nice
22:30 <glguy> If you didn't want all these sweet sweet instances, like MonadChonicle, you'd just write the line "data These a b = ..." in your file
22:30 <monochrom> confess, absolve, condemn...
22:30 <monochrom> Is this an April 1st thing or what? :)
22:30 <EvanR> "in C you end up rewriting a lot of stuff from scratch anyway" or haskell ;)
22:31 <EvanR> not because code is not reusable, but because of the dependencies
22:31 hiratara joined
22:31 <Cale> We actually use These quite a bit in production code
22:31 <Cale> and Align
22:32 <Cale> But I'd never seen this Chronicle stuff
22:32 <Cale> https://hackage.haskell.org/package/these-0.7.3/docs/Data-Align.html -- quite useful
22:32 <EvanR> malign, nice
22:32 <Cale> haha, yeah, that's too fun a coincidence to pass up
22:33 <monochrom> This is a bad dream.
22:35 <Sornaensis> > malign
22:35 <Cale> Reflex's Event is an instance of Align
22:35 <lambdabot> error: Variable not in scope: malign
22:36 <Cale> @let import Data.Align
22:36 <lambdabot> .L.hs:66:1: error:
22:36 <lambdabot> Failed to load interface for ‘Data.Align’
22:36 <lambdabot> Perhaps you meant Data.Aeson (from aeson-1.1.1.0)
22:37 dan_f joined
22:37 <monochrom> Yeah I don't think lambdabot knows about the these library at all.
22:38 leat joined
22:38 <monochrom> If it did, we would have been using it to absolve each other since long ago. :)
22:38 <Cale> ahhhhh... newtype ChronicleT c m a = ChronicleT { runChronicleT :: m (These c a) }
22:39 sleffy joined
22:39 <Cale> The names are ridiculous, but this makes it much clearer what's going on at least.
22:41 <monochrom> @type arr
22:41 <lambdabot> Arrow a => (b -> c) -> a b c
22:41 <monochrom> Nice, it's still there.
22:41 jbiesnecker joined
22:41 <EvanR> integration makes sense for types that can be scaled and added together, so does this amount to vector space? polynomial ring? er not sure i ever figured this out
22:42 <EvanR> modules?
22:42 anuxivm joined
22:43 jdt joined
22:43 <monochrom> Pretty sure you want division for scalers too. The scalers are a field, therefore the whole thing is a vector space.
22:43 spott joined
22:43 <Cale> :t arr matey
22:43 <lambdabot> Arrow a => a Pirate's Greeting
22:43 <monochrom> YES!
22:44 kapott joined
22:45 yrdz joined
22:47 <Cale> EvanR: measure space
22:48 <monochrom> In the limit you will need it a normed vector space because you need <= on magnitudes so you can talk about convergence.
22:48 louispan joined
22:48 <monochrom> And so indeed you get yourself into L^p spaces and beyond the point of no return.
22:49 <Cale> ah, for the codomain
22:50 <Cale> Yeah, you probably want that to be a Banach space of some sort, I guess.
22:50 <EvanR> for the domain
22:50 <EvanR> how does measure space pertain to integration
22:50 <Cale> For the domain, you want a measure space
22:51 <Cale> Lebesgue's approach to integration works over an arbitrary measure space
22:51 <Cale> https://en.wikipedia.org/wiki/Lebesgue_integration#/media/File:RandLintegrals.png
22:51 <EvanR> the basic setup i am imagning is functions R -> R and getting another R -> R out which is the integral "over time" of that
22:52 <EvanR> so im having a hard time seeing how measures work into that
22:52 <EvanR> or how it could generalize using measures
22:53 <EvanR> measures sounds like area or volume, but i guess im thinking about solving DEs
22:53 <Cale> Yeah, or length
22:53 <Cale> So, if you can define what the lengths of sufficiently arbitrary sets are
22:53 <EvanR> initial value problems
22:54 <Cale> Then you can consider the length of the set of points where your function's value is greater than t, for various t.
22:55 <EvanR> if the functions value is a vector...
22:55 <Cale> Well, right, it doesn't work out as nicely in that direction, and even just to make things work for negative values, you need to split things up a little
22:56 <Cale> To some extent you can integrate componentwise
22:57 nemesit|znc joined
22:57 <Cale> for vectors in spaces equipped with bases
22:57 <EvanR> that doesnt seem necessary
22:57 snowalpaca joined
22:57 fizruk joined
22:57 <Cale> Though I haven't seen many integration algorithms which actually take the Lebesgue approach to anything.
23:01 uglyfigurine joined
23:02 <Cale> Well, I suppose Monte Carlo approaches to various things could be said to be directly inspired by it
23:05 snowalpaca joined
23:06 Kundry_Wag joined
23:08 yrdz joined
23:09 ericshortcut joined
23:09 ericshortcut joined
23:14 jbiesnecker joined
23:15 yrdz joined
23:16 pwnz0r joined
23:17 markus1199 joined
23:17 nakal joined
23:18 markus1209 joined
23:18 HugoDaniel joined
23:19 ludat joined
23:20 theDon_ joined
23:21 eacameron joined
23:24 <NemesisD> hey folks. say i have data Foo = A | B | C, i think i should be able to create Proxy :: Proxy '[A, B], and if i can, is it possible to reflect that back into a value-level [A, B]
23:24 uglyfigurine joined
23:24 <NemesisD> or would '[A, B] technically be a heterogeneous list and sink this idea
23:24 <glguy> NemesisD: It's possible to reflect it back, but it's not automatic. You'll have to define a class to do it
23:25 ericshortcut joined
23:25 <glguy> or use something like the 'singletons' package to do that
23:26 Wizek_ joined
23:26 <Cale> '[A,B] is homogeneous, it has kind [Foo]
23:26 <glguy> and it's actually '['A, 'B]
23:26 <Cale> yeah
23:28 <NemesisD> glguy: ah so like write a instance Reifies 'A Foo where reify _ = A and so on, then class (Reifies x xs) => Reflectamundo (x :' xs) where reflectList :: (Proxy :: Proxy xs) -> uhh
23:28 shayan_ joined
23:29 <glguy> NemesisD: An example: https://github.com/glguy/lift-nary-operator/blob/master/Derive.hs#L37-L49
23:29 lambda-11235 joined
23:33 electrostat joined
23:34 cschneid_ joined
23:36 <NemesisD> glguy: i'm having trouble figuring out the type signature of the custom typeclass i'll write for this though, class ReifyList (xs :: [*]) where reifyList :: proxy xs -> ???, i thought it may require another type param class ReifyList x (xs :: [*]) where reifyList :: proxy xs -> [x] but then i don't see how you'd write the instance for '[]
23:38 ystael joined
23:38 seagreen joined
23:40 fizbin joined
23:40 mr_sm1th joined
23:41 sanitypassing joined
23:41 sanitypassing joined
23:41 snowalpaca joined
23:41 snowalpaca joined
23:41 tax left
23:45 <monochrom> '['A, 'B] brings back memories of Lisp. :)
23:46 mda1 joined
23:46 Welkin joined
23:48 <NemesisD> woah i think i may have figured it out
23:49 bjz joined
23:50 <lpaste> glguy pasted “Demote for NemesisD” at http://lpaste.net/354413
23:51 <* glguy> fixes the extension list
23:52 <NemesisD> glguy: that's way more elegant than what i came up with. also i think what i came up with may actually be impossible to use :P
23:54 skeuomorf joined
23:54 Kundry_Wag joined
23:56 <lpaste> glguy annotated “Demote for NemesisD” with “single parameter type class, better type inference” at http://lpaste.net/354413#a354415
23:57 jle` joined
23:57 jle` joined
23:57 <NemesisD> TIL you need to put a space around the type level list opening bracket. Proxy '['A] is a parse error
23:58 <jle`> you don't necessarily need a space
23:58 <jle`> but quote-[-quote seems to be a parse error unfortunately, as some sort of Char
23:58 <jle`> ?
23:59 <jle`> you iften do '[A]
23:59 <NemesisD> it could be because the import was qualified, '['Mod.A]
23:59 <jle`> it's just '[' that causes problems
23:59 <NemesisD> oh ok
23:59 <NemesisD> haha! type level char that makes sense
23:59 <jle`> a bit unfortunate heh