<     May 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 31
00:02 infinity0 joined
00:05 infinity0 joined
00:07 darlan joined
00:07 dfeuer joined
00:08 infinity0 joined
00:10 tromp joined
00:11 infinity0 joined
00:11 ertes joined
00:13 infinity0 joined
00:14 e14 joined
00:16 infinity0 joined
00:20 jaziz joined
00:21 [L|I|T|0] joined
00:21 [L|I|T|0] left
00:23 castlelore joined
00:23 castlelore joined
00:25 peterbecich joined
00:25 halogenandtoast joined
00:25 roconnor joined
00:26 ziyourenxiang joined
00:26 Swizec joined
00:28 Swizec joined
00:28 peterbecich joined
00:29 Swizec joined
00:29 {emptyset} joined
00:30 peterbecich joined
00:32 Scip_ joined
00:32 andyhuzhill joined
00:33 wroathe joined
00:33 c4r50nz joined
00:38 bjz joined
00:43 acidjnk22 joined
00:48 ystael joined
00:49 primal joined
00:51 <athan> What's the best way to keep GHC from sending async exceptions to blocked STM transactions?
00:52 <lyxia> don't let them block
00:52 <athan> :(
00:52 <mauke> let them eat cake
00:53 exferenceBot joined
00:53 <lyxia> athan: what exceptions do you want to avoid
00:53 <athan> BlockedIndefinitelyOnSTM lyxia
00:53 tommd joined
00:54 <athan> but the issue is that the RTS will throw them to many different threads, main even
00:54 <ReinH> Yeah I recommend not blocking indefinitely.
00:54 <athan> I guess I better just use thunks
00:54 <lyxia> I thought these were thrown precisely when the runtime knows you're in a deadlock
00:55 <athan> lyxia: well, I did some reading, and it's only when it thinks there's only one thread blocking on a reference
00:55 flatmap13 joined
00:55 <lyxia> and it's the only one holding onto that reference, right?
00:55 <athan> yeah
00:56 <lyxia> then throwing an exception seems perfectly justified
00:56 mrkgnao joined
00:56 <lyxia> and the workaround is to find a way not to block or simply catch the exception and let the thread die.
00:57 bjz_ joined
01:01 {emptyset} joined
01:02 yuuuull joined
01:02 <yuuuull> Is there a way to pattern match for one specific pattern/constructor?
01:03 tromp joined
01:03 <yuuuull> something like (Constructor1 a b) -> e1; _ -> e2; ?
01:03 Supersonic112_ joined
01:04 <yuuuull> If I try using the _ pattern in case or function pattern match then it gets used every time even if its at the end
01:05 <lyxia> > case Just True of Just e -> e ; _ -> False
01:05 <lambdabot> True
01:05 nighty-- joined
01:05 <geekosaur> sounds to me like you are doing something wrong
01:06 <yuuuull> geekosaur: oh lol
01:06 <yuuuull> so that does work haha
01:07 Scip_ joined
01:08 louispan joined
01:08 whoman joined
01:09 <yuuuull> debugging haskell not the easiest thing in the world :)
01:10 <hpc> just don't bug it in the first place ;)
01:10 <lyxia> this is sound advice
01:10 <hpc> a good habit to get into is if you can't tell a piece of code is correct just by looking at it
01:10 <hpc> change it
01:11 <hpc> it's not universally applicable, but you get really good at distinguishing between coding style that is error-prone and style that is not
01:11 <whoman> +1
01:11 <yuuuull> ah, good advice hpc
01:12 <hpc> i haven't used a debugger ever without a professor telling me to
01:12 <yuuuull> well I'm not using a debugger, I'm debugging with trace lol
01:13 <hpc> ah, that's fine :P
01:13 <* hpc> does that all the time
01:14 <hpc> occasionally
01:14 Destol joined
01:17 drewbert joined
01:20 chrisdotcode joined
01:22 connrs joined
01:23 <Rotaerk> hmm if I have a Pipe String R m (), and a type data D = A String | B | C
01:23 darjeeli1 joined
01:24 <Rotaerk> is there some easy way to produce a Pipe D R m () from the Pipe String R m ()
01:24 <Rotaerk> i.e. where I only have to provide the additional information of how to convert B and C to R
01:25 <Rotaerk> and to pump only the As through the Pipe String R m ()
01:27 wroathe joined
01:29 {emptyset} joined
01:31 <lyxia> Rotaerk: await+yield+(>~) ?
01:32 eschnett joined
01:33 <Rotaerk> lyxia, eh?
01:34 <Rotaerk> hmm
01:35 drewbert joined
01:35 <Rotaerk> yea, no I don't see
01:35 ali_bush joined
01:35 ali_bush joined
01:37 <glguy> doing the chunks to lines?
01:37 <lyxia> Rotaerk: your Pipe String R m () should be the second argument of (>~), what type can you expect for the first argument?
01:38 <Rotaerk> glguy, my input type is TCP.Event, which includes Received ByteString | Closed | Disconnected
01:38 <Rotaerk> it'd be nice if I could somehow ... lift a Pipe ByteString R m () into a Pipe TCP.Event R m ()
01:38 tromp joined
01:39 halogenandtoast joined
01:39 <Rotaerk> it's possible to do it manually, which is what I did before, but it'd be nice if I could reuse Pipes on ByteStrings
01:40 hybrid joined
01:41 kaychaks joined
01:42 Gurkenglas joined
01:43 flatmap13 joined
01:44 jerbome_ joined
01:46 wroathe joined
01:48 lambda-11235 joined
01:50 ystael joined
01:51 lambdamu joined
01:54 flatmap13 joined
01:55 cpup joined
01:55 CoderPuppy joined
01:58 <* hackage> Villefort - Villefort is a task manager and time tracker written in haskell. https://hackage.haskell.org/package/Villefort- (ChrisReuter)
01:58 <* hackage> aws-ec2 0.3.7 - AWS EC2/VPC, ELB and CloudWatch client library for Haskell https://hackage.haskell.org/package/aws-ec2-0.3.7 (IanRoss)
01:58 <* hackage> HTTP 4000.3.7 - A library for client-side HTTP https://hackage.haskell.org/package/HTTP-4000.3.7 (GaneshSittampalam)
01:58 <* hackage> mustache 2.2.2, mustache 2.2.1, mustache 2.2 (justus): https://qbin.io/629ru2q
01:58 <* hackage> servant-auth-token - Servant based API and server for token based authorisation https://hackage.haskell.org/package/servant-auth-token- (NCrashed)
01:58 <* hackage> table-layout - Layout text as grid or table. https://hackage.haskell.org/package/table-layout- (muesli4)
01:59 <* hackage> sort - A Haskell sorting toolkit https://hackage.haskell.org/package/sort- (ChrisDornan)
01:59 <* hackage> dhall-nix 1.0.3, dhall-bash 1.0.1 (GabrielGonzalez): https://qbin.io/ueu1kpwt
01:59 <* hackage> statistics - A library of statistical types, data, and functions https://hackage.haskell.org/package/statistics- (AlexeyKhudyakov)
01:59 <glguy> mniip: ^
02:00 hucksy_ joined
02:00 kadoban joined
02:00 uwap joined
02:01 {emptyset} joined
02:02 <glguy> Rotaerk: Check out +++ http://hackage.haskell.org/package/pipes-extras-1.0.9/docs/Pipes-Extras.html#v:-43--43--43-
02:03 HoierM joined
02:03 <glguy> Rotaerk: You can either convert your type to an Either String BorC and use this
02:03 HoierM joined
02:04 <glguy> or you can peek at how these are implemented and do something similar
02:04 HoierM joined
02:08 acarrico joined
02:08 Xanather joined
02:09 saussure joined
02:12 hackage joined
02:13 <Rotaerk> hmm thanks glguy
02:14 Goplat joined
02:15 filterfish joined
02:15 mjora7 joined
02:15 meba joined
02:16 filterfish joined
02:19 fragamus joined
02:20 SkyPatrol joined
02:20 juanpaucar joined
02:21 exferenceBot joined
02:25 hexagoxel joined
02:28 wroathe joined
02:28 exarkun joined
02:32 {emptyset} joined
02:33 wonko7 joined
02:35 spacecadetbrown joined
02:35 barcabuona joined
02:37 <barcabuona> hey guys a quick question
02:37 <barcabuona> why cant i do print $ readFile "hi.txt" ?
02:37 <barcabuona> i need to do f <- readFile "hi.txt" first
02:38 <dmj`> barcabuona: what is the type of print, and what is the type of readFile
02:38 <dmj`> :t print
02:38 <lambdabot> Show a => a -> IO ()
02:38 <dmj`> :t readFile
02:38 <lambdabot> FilePath -> IO String
02:39 <dmj`> :t \file -> putStrLn =<< readFile file
02:39 <lambdabot> FilePath -> IO ()
02:39 <clever> :t :t hashFileStrict
02:39 <lambdabot> error: parse error on input ‘:’
02:39 <clever> :t hashFileStrict
02:39 <lambdabot> error: Variable not in scope: hashFileStrict
02:40 <barcabuona> dmj`: thanks!
02:41 SkyPatrol_ joined
02:44 MarioBranco joined
02:45 Spawndemonic joined
02:45 jerbome_ joined
02:49 systadmin joined
02:50 ystael joined
02:51 <c_wraith> Ok, I'm *really* liking GHC 8.2's colorized output. It's surprising me how much I like it.
02:51 blym joined
02:52 juanpaucar joined
02:53 <kadoban> 8.2 has colored output? That sounds fancy
02:53 systemfault joined
02:53 <kadoban> Is it in RC now? I lost track
02:53 <MarcelineVQ> it's fairly minimal but I like it
02:53 <c_wraith> kadoban: rc2 is out
02:53 <MarcelineVQ> iirc it just colors the error type by severity, unless that's been expanded on
02:54 <c_wraith> errors are red, warnings are purple, line numbers are blue in the code excerpt - I like that part, too.
02:55 <jchia_1> In a Set or Map, can do a lookup for the ith largest or smallest item?
02:55 <kadoban> c_wraith: neat
02:56 <c_wraith> jchia_1: definitely in Set, probably in Map.
02:56 <c_wraith> jchia_1: (only probably because I'm not 100% certain)
02:56 <jchia_1> c_wraith: Is there a function? I couldn't find one
02:56 <jchia_1> elemAt
02:56 <c_wraith> findMin
02:57 <c_wraith> and or findMax
02:57 LordBrain joined
02:57 <c_wraith> that appears to be the name for both
02:57 <jchia_1> I couldn't find it on the haddock by manual scanning. later I did a text search for 'Int ->' and found it.
02:58 <c_wraith> oh, I missed 'ith". heh. Well, you did find what you were looking for.
02:58 sproingie joined
02:58 sproingie joined
02:58 <kadoban> Huh, I never noticed showTree in Data.Map, that looks helpful.
02:58 <MarcelineVQ> you can also step some minView's
03:00 <c_wraith> MarcelineVQ: that's a lot more work... You can descend directly to a particular index with Map's representation
03:00 <MarcelineVQ> I forgot you can just ask the Set size ehe, so elemAt makes a lot more sense
03:03 {emptyset} joined
03:09 <LordBrain> whats out there for spotting clusters in data?
03:09 <c_wraith> just add more dimensions. If you add enough dimensions, all data is clustered.
03:10 wroathe joined
03:10 <c_wraith> (there's a theorem to that effect somewhere - the upshot is that you shouldn't be looking for clusters in very-high-dimensional spaces)
03:12 Welkin joined
03:12 davr0s joined
03:15 blym_ joined
03:18 anoLB joined
03:20 juanpaucar joined
03:23 blym_ joined
03:28 LoganC joined
03:29 brynedwardz joined
03:29 pavonia joined
03:29 saussure joined
03:31 wroathe joined
03:33 {emptyset} joined
03:33 <jchia_1> Question about vector-sized. What's an efficient way to write/modify one element? In the documentation I see only functions for bulk updates, not single updates. It seems that I have to use withVectorUnsafe?
03:34 <Welkin> just update that one element
03:34 <Welkin> what library are you talking about? Data.Vector?
03:35 <jchia_1> Welkin: vector-sized package, Data.Vector.Sized
03:37 <Welkin> it's not different than for vector
03:37 <Welkin> just use a list of one pair for the update
03:37 <c_wraith> if you're doing a lot of single-element updates, question whether it's the right data structure for you
03:38 <Welkin> there are also mutable vectors
03:38 <Welkin> you can `write` directly to the index
03:38 <jchia_1> Welkin: OK, I see Vector.Data also has no specialized single-element update function.
03:40 <jchia_1> Welkin: But Data.Vector has 'modify' that seems to provide some in-place efficiency. Data.Vector.Sized doesn't have 'modify'.
03:41 <Welkin> I'm not sure why you want to use vector-sized
03:41 <Welkin> what exactly does it do?
03:41 <jchia_1> Welkin: I know at compile-time that my vector size is fixed
03:41 <jchia_1> The content can change but the size is fixed
03:41 <Welkin> the size of your vector is always fixed
03:42 <Welkin> if you change the size, it's a new piece of memory
03:43 <jchia_1> Welkin: Fixed by the type
03:43 <Welkin> I don't understand the benefit
03:43 <Welkin> even so
03:43 sleffy joined
03:43 <jchia_1> Welkin: How do you ensure that at run-time the vector doesn't 'go crazy' by becoming the wrong size?
03:43 halogenandtoast joined
03:44 <Welkin> you could also just use Array
03:46 <Welkin> Vector will change the size automatically by copying the data
03:46 jerbome_ joined
03:46 <Welkin> array will not and requires explicit creation of a new array if you want to change the size
03:47 <jchia_1> Welkin: OK, but I think Array has no hope of in-place updates. At least it seems so from lack of something like Data.Vector.modify
03:47 felixsch__ joined
03:48 <Welkin> http://hackage.haskell.org/package/array-
03:48 <Welkin> mutable arrays
03:48 <Welkin> http://hackage.haskell.org/package/array-
03:49 prophile joined
03:50 <Welkin> There is also STArray, of course
03:50 <jchia_1> Welkin: Isn't it better to avoid the 'impurity' of Monads if I can?
03:50 xiinotulp joined
03:51 <Welkin> there is nothing impure
03:51 <Welkin> it is best to avoid mutation if possible, yes, even if the mutation is safe
03:51 <Welkin> it's more complicated to read and write
03:51 <EvanR> in place updates on purpose is imperative and critical to many algorithms
03:51 ystael joined
03:51 <EvanR> thats just how they are written
03:52 <jchia_1> I have to use it in some Monad. Since MArray requires a monad doesn't everything that uses it have to be defined in the context of a Monad? I can't just have simple functions anymore.
03:52 <EvanR> do youd want to use something like donotation
03:52 <EvanR> jchia_1: no
03:52 wroathe joined
03:53 <EvanR> you can use ST actions from "simple functions" and you can use simple functions from inside the ST action
03:53 <Welkin> jchia_1: a list is a "monad"
03:53 <Welkin> almost everything is a monad
03:53 <c_wraith> Int is not a monad. :P
03:53 <EvanR> no theres only like 19 different monads
03:54 <EvanR> in my survey from a few days ago
03:54 <jchia_1> EvanR: I think you mean that in my 'simple' function, I can 'run' an ST monad where I deal with the MArray, and outside the 'simple' function, nobody needs to know that inside I'm dealing with the monad that MArray requires. Is that right?
03:54 <EvanR> right
03:55 <Welkin> ST is very powerful
03:55 <jchia_1> OK, I'll try that. Thanks.
03:55 conal joined
03:55 <EvanR> you can use mutable arrays inside of the pure function and stay pure
03:55 <Welkin> read my favorite paper on it here: https://www.microsoft.com/en-us/research/wp-content/uploads/1994/06/lazy-functional-state-threads.pdf
03:55 <kadoban> ST is really nice. I do wish array access syntax was a tad more concise, but it's a small gripe.
03:56 <EvanR> needs more mixfix operators ;)
03:56 <EvanR> x [ i ]= 3
03:56 <kadoban> Heh, yeah.
03:57 <kadoban> I find myself wishing I could just write C-ish in those blocks sometimes. But then big parts of cool haskell stuff still abound. Probably would be hard to mix.
03:57 <Welkin> http://hackage.haskell.org/package/inline-c
03:57 mjora7 joined
03:59 <jchia_1> If I want to implement a IArray Int Char -> IArray Int Char, using runST inside on an MArray Int Char, I would need freeze and thaw at some point, correct? How do I avoid making a copy of the IArray in cases where the old array is no longer needed?
04:00 <EvanR> well if you stay inside of the ST action, you would use them like mutable arrays
04:00 <jchia_1> I.e. how do I do in-place modification under-the-hood in cases where I don't care about the old IArray after getting the new IArray.
04:00 <EvanR> you wouldnt use IArrays
04:01 <MarcelineVQ> kadoban, Welkin: https://github.com/ambiata/jetski :o
04:01 <EvanR> to save an array for later and end the ST action, youll need to do freeze and thaw
04:02 <jchia_1> EvanR: Is there a way to have the efficiency of in-place modification without explicitly dealing with ST? It seems that Data.Vector.modify allows this sort of in-place modification.
04:02 <EvanR> sure you can use IO
04:02 <EvanR> with Array or Vector
04:02 <jchia_1> EvanR: Nor IO. Not using any monadic context.
04:02 mrkgnao joined
04:02 <EvanR> well, how about an Applicative context ;)
04:02 bjz joined
04:03 {emptyset} joined
04:03 <EvanR> exactly what is the type of the operation you want /
04:03 <kadoban> MarcelineVQ: Heh, that's cute. Though what I was talking about is just writing ST code like C, not it actually *being* C hopefully
04:03 <jchia_1> EvanR: I'm trying to implement a circular buffer without having to express operations in terms of functions that run in a Monad.
04:03 <glguy> jchia_1: operations like accum allow for that
04:04 <glguy> None of these are going to tell you start and top the operations, however
04:05 <jchia_1> push :: a -> CircularBuffer a n -> (a, CircularBuffer a n)
04:05 <EvanR> ok
04:05 <jchia_1> Push a new item and the oldest item pops out.
04:05 <EvanR> and you promise not to use the old one
04:06 <jchia_1> EvanR: I could promise not to use the old circular buffer but it would be nicer if it's smart and do in-place update iff appropriate, like Vector.modify, though I don't actually know how smart it is.
04:06 <EvanR> you can use unsafeFreeze and unsafeThaw, but if this is library code you cant really expect the user code to "just be careful"
04:07 <glguy> That's a good way to create bugs for yourself, not a serious solution
04:07 <EvanR> yes i dont see a good way to make that safe
04:07 a3f joined
04:08 <EvanR> segfaults in haskell are even worse than in C
04:08 <EvanR> i say
04:08 ericsagnes joined
04:08 <EvanR> we dont have valgrind to identify where you did something bogus
04:09 a3f_ joined
04:09 blym joined
04:09 <EvanR> linear types can help you not use the old version, but then, that is a lot like what ST would do for you
04:10 tommd joined
04:10 <jle`> i keep on running into situations where linear types would have helped me debug code
04:10 <jle`> can't wait for ghc 8.4
04:10 <jchia_1> EvanR: I think under the hood, if I use a Vector to store the values, I can use Vector.modify and hope it does the right thing in terms of in-place update, but it doesn't enforce the vector size is fixed.
04:11 <EvanR> wait what will be in 8.4? o_O
04:11 ilyaigpetrov joined
04:11 <EvanR> jchia_1: i dont think thats going to do what you want
04:11 <EvanR> if you just want a hope, then hope and use a normal immutable data structure
04:12 <jchia_1> EvanR: Doesn't Vector.modify do in-place update when it's safe to do so?
04:12 <EvanR> i.e. if youre ok with bad performance of copying vectors, use a tree instead
04:12 <jchia_1> EvanR: Do you mean that in many normal cases, it can't figure out that it's safe?
04:12 <EvanR> i doubt it will actually reuse space
04:12 wroathe joined
04:13 <jchia_1> "Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise."
04:13 <jchia_1> Bogus documentation?
04:13 <glguy> modify will only be able to avoid the copy in the extreme cases
04:13 <EvanR> perhaps it should say "big IF"
04:13 <jchia_1> I've been using Vector.modify assuming that it can figure out the safety of in-place update with reasonable accuracy.
04:13 <EvanR> more likely it will run that ST action and the end result will be copied back to you
04:14 <glguy> Only count on modify avoiding a copy when you're modifying a vector that you just created in the same function body, basically
04:14 <glguy> like you wrote:: modify stuff (fromList alist)
04:15 a3f joined
04:15 <EvanR> in the code, it begins by doing clone
04:16 <EvanR> so you arent going to be dealing with the same space that has seen any action before
04:16 meba joined
04:17 <glguy> modify relies on fusing RULES to avoid copies, so it's only going to work if (after optimizations) the created vector is a direct argument of modify
04:18 <glguy> It doesn't do anything clever to check that there are no other references to an arbitrary vector and then modify it inplace
04:18 SpinTensor joined
04:19 <EvanR> a safe ring buffer that looks immutable and pure is going to take some more engineering and thought
04:19 <EvanR> im not sure how it would work
04:19 a3f_ joined
04:19 <jchia_1> It seems that the corollary of this is that generally if I want to improve performance by doing in-place updates, I can't depend on Vector.modify and need to do all the updates in ST on some other monads on a mutable data structure.
04:19 <EvanR> probably IO
04:19 <glguy> old-timey approach https://hackage.haskell.org/package/diffarray-0.1.1/docs/Data-Array-Diff.html
04:20 <EvanR> also are you seeing performance issues with immutable buffers?
04:21 <EvanR> if so, maybe try a functional queue
04:21 codygman joined
04:21 <jchia_1> EvanR: It depends on the performance requirement. Faster is always preferable.
04:21 <EvanR> i mean, have you measured it against realistic workload?
04:21 <EvanR> or premature optimization
04:21 <jchia_1> But on a large buffer, copying is surely going to be a problem.
04:22 <jchia_1> No, I haven't, but I'm trying to get the benefit of functional programming without losing the asymptotic performance I can get from imperative.
04:22 <EvanR> well if its asymptotic performance... check out the functional queue structure
04:22 <james9999> imperative programming gives asymptotic performance?
04:23 <EvanR> for real performance, youll need to really test it
04:23 <codygman> Would anyone like to help me figure out why I can't reproduce the techempower framework benchmarks Haskell performance? I have this issue open with some details: https://github.com/TechEmpower/FrameworkBenchmarks/issues/2800
04:23 <jchia_1> If I have a circular buffer of size m and a total of n items to push (and pop), imperative gives me O(n) but functional with copying of array/vector gives me O(mn)
04:24 <jchia_1> EvanR: Yeah, I agree, the actual performance is what matters in a real project.
04:24 juanpaucar joined
04:25 <EvanR> jchia_1: and functional queue is amortized O(1) for push or pop 1, assuming its a fixed total size
04:25 <EvanR> so same as imperative
04:26 <EvanR> the structure Queue a = Queue [a] [a]
04:26 <EvanR> which holds both ends of the queue in opposite directions
04:26 jedws joined
04:28 diegoksp joined
04:28 jgt3 joined
04:29 connrs joined
04:29 xtreak joined
04:30 FreeBirdLjj joined
04:32 {emptyset} joined
04:33 Leo_Verto joined
04:34 tripped joined
04:38 <c_wraith> though as Okasaki pointed out, it's only O(1) amortized in non-persistent use
04:38 <EvanR> non persistent?
04:39 DoubleLeft joined
04:40 <nshepperd> it can be O(1) persistent too, with lazily reversing the queue depending on length, or something like that
04:40 <jchia_1> What does it mean by 'persistent'?
04:40 <c_wraith> nshepperd: yes, but that's a different data structure :)
04:40 <EvanR> sometimes persistent means exploiting sharing
04:41 <c_wraith> in this case, it means being exploited by sharing. :)
04:41 <EvanR> ok
04:41 Welkin joined
04:41 <nshepperd> 'persistent use' meaning you can modify an old version of the datastructure and still expect the bounds to hold overall
04:42 <c_wraith> Whereas in the trivial version, if you reach the state where the next pop will move the back to the front, that's an O(n) cost, and you'll pay it every time you do the pop.
04:42 <EvanR> ah
04:43 <EvanR> so it should work ok for jchia_1 who is expecting to only use the latest version
04:43 <kadoban> Yeah, it works like a champ in that case.
04:43 <dfeuer> There are also different levels of persistence. Partial persistence (can read old copies but not modify them), full persistence (can read and write old copies), and confluent persistence (can read, write, and combine old copies).
04:44 <dfeuer> Basically everything written in plain Haskell is confluently persistent, but not always efficiently so.
04:46 abroz joined
04:46 connrs joined
04:47 blym_ joined
04:47 a3f joined
04:47 augur joined
04:49 sproingie joined
04:49 <dfeuer> I'm really not seeing how Pipes.Internal.unsafeHoist is even slightly unsafe. I understand that its MonadTrans instance is only valid under a certain equivalence, but I can't understand what the heck that has to do with hoisting.
04:52 ystael joined
04:53 dis11 joined
04:53 nomotif joined
04:54 wroathe joined
04:55 baldrick1 joined
04:55 butterthebuddha joined
04:56 <sproingie> says in the docs: "This is labeled as unsafe because you will break the monad transformer laws if you do not pass a monad morphism as the first argument"
04:58 sgfltx joined
04:58 a3f joined
04:59 <sproingie> so more "unsound" than unsafe, but convention is what it is
05:00 tromp joined
05:00 a3f joined
05:00 a3f joined
05:02 <nshepperd> the relevant equivalence is that M (pure r) ~= Pure r? that certainly doesn't seem interesting enough to call anything 'unsafe'
05:02 eacameron joined
05:02 rcschm joined
05:04 connrs joined
05:04 <nshepperd> err, M (pure (Pure r)) i guess
05:04 {emptyset} joined
05:04 pacak joined
05:05 juanpaucar joined
05:07 pranitbauva1997 joined
05:08 bjz joined
05:11 blym_ joined
05:12 sternmull joined
05:13 lucklove joined
05:14 tommd joined
05:14 sleffy joined
05:15 xtreak joined
05:15 wroathe joined
05:16 arch-nemesis joined
05:17 BartAdv joined
05:17 Guest32093 left
05:17 Guest32093 joined
05:18 zzz joined
05:19 lucklove joined
05:21 Guest32093 left
05:22 meandi_2 joined
05:23 lucklove joined
05:26 cpennington joined
05:26 blym_ joined
05:30 kritzcreek joined
05:33 <jle`> man how come haskell questions on stack overflow get answered so fast
05:34 {emptyset} joined
05:34 <MarcelineVQ> you can trade in answer points for bitcoin
05:35 xall joined
05:35 <lucklove> Good idea
05:35 <MarcelineVQ> suddenly a new platform was born..
05:35 Swizec joined
05:36 <mrkgnao> so I have this toplevel binding that is a Double, but if I write the type signature I get "no instance for" errors
05:36 wroathe joined
05:37 <jle`> sounds like a question that can only be answered by pasting the code and the error message
05:37 <mrkgnao> GHC can infer the type fine, but won't let me write it. (I did have to muck with -fsolver-constraint-iterations for this, so I might be in uncharted territory here.)
05:37 <glguy> mrkgnao: You can put the code and error on lpaste.net
05:38 <EvanR> jle`: haskell, winning the talked-about-on-programming-sites to being-actually-used ratio
05:39 <mrkgnao> http://lpaste.net/6432103543150215168
05:39 <glguy> mrkgnao: The definition of Ring is missing
05:39 <mrkgnao> but there's a lot of code behind the Ring Add Mul r constraint
05:40 blym_ joined
05:40 <mrkgnao> https://github.com/mrkgnao/noether/
05:40 <glguy> (RingS 'Add 'Mul Double) -- why didn't this reduce? Is RingS a type family?
05:40 gmhafiz joined
05:40 <jle`> can you reproduce the error in a minimal self-contained file
05:40 <mrkgnao> https://github.com/mrkgnao/noether/blob/master/library/Noether/Algebra/Linear/Modules.hs
05:41 <mrkgnao> Yes, but there is an instance defined for it elsewhere. If I remove the q :: Double type signature and load it into GHCi, :t q says Double.
05:41 <mrkgnao> glguy: https://github.com/mrkgnao/noether/blob/master/library/Noether/Algebra/Multiple/Strategies.hs#L39 defines the type instance
05:42 <mrkgnao> jle`: I'm not really sure I can, the code is spread out somewhat suboptimally.
05:42 <mrkgnao> :(
05:42 <jle`> :(
05:42 <glguy> mrkgnao: You should be careful to ' tick your lifted data kinds
05:43 <mrkgnao> and I was foolish enough to put -fno-warn-unticked-promoted-constructors into my package.yaml.
05:43 Kuros` joined
05:43 <glguy> and using package.yaml limits your audience
05:43 cyborg-one joined
05:43 butterthebuddha joined
05:44 <mrkgnao> does it cause trouble apart from '[], in general? none of my promoted datatypes share names with constructors. I guess as a matter of good practice, though, I should put in the effort.
05:45 <glguy> mrkgnao: What does: :kind! RingS Add Mul Double show in GHCi?
05:45 <mrkgnao> I've removed the cabal file from the gitignore
05:46 <mrkgnao> glguy: it's sort of long, essentially listing how the different parts of the ring structure fit together.
05:46 <mrkgnao> http://lpaste.net/6432103543150215168
05:47 <glguy> mrkgnao: well, it needs to reduce ot Double, not that, right?
05:47 <glguy> p :: Ring Add Mul r => r -> r -> r
05:47 <glguy> OH, I'm seeing RingK and Ring
05:47 <mrkgnao> no, Ring Add Mul r = RingK Add Mul r (RingS Add Mul r)
05:48 <mrkgnao> the last parameter to RingK defines the ring structure, essentially. r is Double.
05:48 <mrkgnao> yep
05:49 <mrkgnao> I think I have some kind of cycle in my constraint types somehow that GHC ignores while solving constraints without the annotation, but if the annotation is there, it somehow solves them in the wrong order and hits a dead end
05:50 <mrkgnao> the -fconstraint-solver-iterations thing is a bad sign, too
05:53 takuan joined
05:53 ystael joined
05:54 dfeuer joined
05:55 FreemanXiong joined
05:56 abroz joined
05:57 wroathe joined
05:59 primal_ joined
06:00 mohsen_ joined
06:00 baldrick1 joined
06:03 <cocreature> jle`: related https://ro-che.info/ccc/images/icfp.png
06:05 juanpaucar joined
06:06 Materiyolo joined
06:06 {emptyset} joined
06:08 hamishmack joined
06:08 mfukar joined
06:09 cpup joined
06:09 zero_byte joined
06:09 CoderPuppy joined
06:09 descender joined
06:09 primal joined
06:09 kaychaks joined
06:11 spacecadetbrown joined
06:11 andyhuzhill joined
06:12 <jle`> ha
06:13 caumeslasal joined
06:14 andyhuzhill joined
06:14 andro_ joined
06:15 Myrl joined
06:15 tromp joined
06:16 thimoteus joined
06:17 meba joined
06:19 inad922 joined
06:19 butterthebuddha joined
06:22 davr0s joined
06:22 hurkan joined
06:23 castlelore joined
06:24 ragepandemic joined
06:24 simukis joined
06:25 <Myrl> Is `a -> a` not a monoid?
06:26 <jle`> it is
06:26 aussie joined
06:26 <jle`> but not necessarily a Monoid
06:26 <cocreature> Myrl: https://hackage.haskell.org/package/base-
06:26 <Myrl> jle`: Not necessarily?
06:26 <Myrl> cocreature: Thanks.
06:26 <jle`> yeah, the instance you are thinking of is not the default instance
06:27 <Myrl> Oh.
06:27 <jle`> but (a -> a) is a Monoid when a is also a Monoid instance
06:27 <Myrl> jle`: Monoid a => (a -> a) ?
06:27 <jle`> yes
06:27 <mrkgnao> glguy: if I change the type signature from q :: Double to q :: Ring Add Mul Double => Double, then it works
06:27 <aussie> Dumb question (sorry) -- what is the syntax for creating a unboxed vector of unboxed vectors?
06:27 <Myrl> jle`: Yeah, thanks. Was reading the instances.
06:27 <jle`> that is the default instance (actually Monoid a => r -> a)
06:27 <Myrl> jle`: Makes sense though. That's probably more useful.
06:27 <Myrl> jle`: I was thinking of using that instance for Writer.
06:28 <jle`> yeah, Writer (Endo a) is a common trick
06:28 <jle`> popularzed by ocharles
06:28 <Myrl> :o
06:28 <cocreature> huh, I’ve never seen that
06:28 <mrkgnao> I think it's because there are multiple ways to "find" the Semigroup/Group/etc. instances for + and / by moving through the superclasses
06:28 <Myrl> jle`: How do they use it?
06:28 primal_ joined
06:28 <aussie> I thought I could do fromList [ fromList [1..5]] but there are errors with the inferred type
06:29 <jle`> i suppose i can't say "common trick" then
06:29 <jle`> aussie: it would help to post the error
06:30 <jle`> Myrl: https://ocharles.org.uk/blog/posts/2013-02-12-quick-dsls-with-endo-writers.html
06:30 <nshepperd> (the (r -> a) instance is a special case of the more general (Monoid a, Applicative f) => Monoid (f a) which isn't an actual instance because it would overlap with everything)
06:30 <jle`> it's mostly used to abuse do notation
06:31 <glguy> https://github.com/glguy/advent2016/blob/master/asmprog-final/Main.hs
06:31 <Myrl> jle`: lmao. That's *exactly* what I was thinking of.
06:31 <glguy> I had two example of Endo and writer in that code
06:31 <Myrl> jle`: It's a bit like a lesser State monad.
06:32 <jle`> yeah, Writer is basically a restricted State
06:32 <cocreature> Writer is one of the first Monad instances that I’ve learned about but for some reason I never use it
06:32 <aussie> I get "Non type-variable argument in the constraint: V.Unbox (V.Vector a) When checking the inferred type"
06:32 <aussie> when running V.fromList [V.fromList [1..5]]
06:33 <Myrl> cocreature: I guess it's because it's introduced as (String, a)?
06:33 Cogitabundus joined
06:33 <jle`> yeah, writer is pretty abused as well
06:33 <cocreature> Myrl: nah, I just have no use for it
06:33 <Myrl> cocreature: Which we more or less just do with `trace`
06:33 <Myrl> cocreature: Interesting.
06:34 <jle`> aussie: guess what the next line of the error message is
06:34 <jle`> :)
06:34 <cocreature> I don’t even use State very often
06:34 <Myrl> cocreature: That's true though. 2 years into Haskell, and only now do I feel like I need to use it.
06:34 <jle`> (it will probably be hints to fix resolve the error)
06:34 <jle`> although i don't blame you, people usually don't read past the first line of error messages
06:34 <Myrl> cocreature: And not because *I* need to use it, but because I want to play well with the library I'm using.
06:34 <jle`> i wonder if there could be better UX for this
06:34 FreemanX` joined
06:35 jerbome_ joined
06:35 <cocreature> Myrl: remember that the implementation in transformers is also prone to spaceleaks. you might want to use writer-cps-transformers instead
06:35 <glguy> I think most of the writer abuses come from thinking of it for logging
06:35 {emptyset} joined
06:36 FreeBirdLjj joined
06:36 <jle`> in my personal thing, Writer is abused because `Writer w ()` is just `w`
06:36 <jle`> and you can use mconcat instead of do notation
06:36 <Myrl> glguy: Mhm. THat's what I'm thinking too.
06:37 <jle`> if you really like do notation, better to just use `forall a. Const w a`
06:37 <mrkgnao> jle`: do you think Haskell will ever gain something like "extensible syntax" (i.e. do-as-a-library stuff)
06:37 <cocreature> for small strict monoids, i.e. Sum Int, the default Writer implementation is shitty and for larger monoids, e.g. loggin, you usually want to stream the results
06:37 <mrkgnao> ?
06:37 <nshepperd> the big three (Reader, Writer, State) are more often used as monad transformers ime
06:37 bjz joined
06:37 <nshepperd> but i've never seen WriterT used in the wild either so
06:37 <Myrl> nshepperd: RWST. :D
06:38 <EvanR> RWST IO
06:38 <jle`> Writer is the spiritual progenitor of a lot of kinda-monads in the wild though
06:38 <EvanR> all youll ever need
06:38 <jle`> people might not explicitly use Writer from transformers, but they implement the same monad/API
06:38 <Myrl> jle`: Kinda-monads?
06:38 <jle`> like blaze's HTML monad
06:38 primal joined
06:38 wroathe joined
06:39 <jle`> kinda-monads in that yes they are monads but they aren't really used as monads
06:39 <nshepperd> yeah, that's true
06:39 vlatkoB joined
06:39 <cocreature> jle`: ah yeah the various HTML libraries are a good example
06:39 <jle`> Writer itself is a bad implementation, but the abstract Writer API is nice
06:39 <cocreature> yep
06:39 baldrick1 joined
06:39 osa1 joined
06:39 rcschm joined
06:39 <nshepperd> and sometimes I write free monads with tell-like primitives
06:40 <glguy> blaze's type is pretty different in implementation from writer
06:40 descender joined
06:40 <jle`> but now that we have Applicative-do, we can just repliace `Writer w` with `Const w`
06:40 <jle`> let's do this
06:41 jedws joined
06:41 <jle`> um pun not intended
06:42 <jle`> now we just need ConstT
06:43 ph88 joined
06:44 <jle`> Writer is very rarely ever used properly, in a way that Const would do just as fine
06:44 <jle`> Writer w () is actually a big haskell pet peeve of mine
06:44 drewbert joined
06:45 <ph88> hey jle` i was trying your code https://bpaste.net/show/bf17ad8f2e9d can i still use <|> when i need to do IO ?
06:46 <nshepperd> data ConstT r m a = ConstT r -- hope you enjoyed your m, suckers
06:46 <cocreature> ph88: oh btw, foldl support is now back in conduit-extra and there is a new 1.1.16 release for it
06:46 <ph88> m & m
06:46 <ph88> cocreature, sweet ! is that by your doing? :P
06:46 <cocreature> ph88: yep :)
06:46 <ph88> eheh
06:46 <jle`> data ConstT w m a = ConstT (m w)
06:46 <ph88> show me what you did
06:46 <jle`> ph88: it depends on the type of your thing
06:47 <ph88> what thing ?
06:47 <jle`> the thing you are using <|> with
06:47 advn joined
06:47 FreeBirdLjj joined
06:47 <jle`> oh i see
06:48 <jle`> yeah, you can use traverse insead of fmap
06:48 <jle`> to get `IO (Maybe a)`
06:48 <ph88> i've a feeling sampleTime itself then also will be IO once i start trying to make that code work
06:48 <jle`> which has an Alternative instance if you wrap it in MaybeT
06:48 <cocreature> are packages in stackage nightly automatically included in the next major stackage lts?
06:48 <jle`> or you can just write <|> directly i suppose
06:48 slackman joined
06:48 <glguy> jle`: Writer e () isn't always bad, it's a very reasonable final type. in the course of building a value of that type one is likely to use other non () types
06:49 <jle`> yes
06:49 <ph88> jle`, isn't that right that sampleTime itself will be wrapped in IO ?
06:49 <jle`> if your entire program only ever uses Writer e (), that is the specific pet peeve i have
06:50 <mrkgnao> TIL: apparently your own infix alias for (,) :: Constraint -> Constraint -> Constraint won't work like the real one
06:50 <jle`> ph88: yeah, so you can use sampleTime <- runMaybeT $ (MaybeT (return st)) <|> (MaybeT (traverse getSampleTimeAverage tcol))
06:50 <mrkgnao> that was the source of all my trouble. :(
06:50 <jle`> ph88: or if you don't like wrapping and unwrapping MaybeT, you can just write your own (<|>) :: IO (Maybe a) -> IO (Maybe a) -> IO (Maybe a)
06:53 connrs joined
06:54 ystael joined
06:55 <ph88> jle`, i arrived at this now https://bpaste.net/show/80b2e5ba17e2
06:56 <jle`> yeah, that's fine, although in this specific case, i think maybe MaybeT might be overkill
06:57 blym_ joined
06:57 <jle`> you can just write sampleTimeIO :: IO (Maybe a) by hand using do notation
06:57 <jle`> probably the cleaner way to go
06:57 <ph88> ye ok but i still have an error there which i don't know why it is appearing
06:57 <jle`> is it a compile error or a runtime error
06:58 <ph88> oh it's sublime text auto complete to the wrong function name
06:58 <ph88> ye ok works now !
06:58 <jle`> :D
06:58 <ph88> but i will try to remove MaybeT
06:58 <jle`> yeah, MaybeT is more useful if you have a lot of things to MaybeT-together
06:58 <jle`> if it's just one or two things like in this situation it is admittedly a bit silly
06:59 tiny_test joined
06:59 nwf joined
07:00 <ph88> jle`, i changed line 7 to 10 .. this type checks too https://bpaste.net/show/6957cefe34d8
07:01 <jle`> yes that was what i was thinking :)
07:01 <ph88> :)
07:02 <ph88> this is the first time that i used traversed .. i looked into it before .. but not super familiar
07:02 <ph88> it's like fmap + return right ?
07:02 <jle`> in this context, traverse :: (a -> IO b) -> Maybe a -> IO (Maybe b)
07:02 <jle`> it's like an "effectful map"
07:02 <ph88> ok
07:02 <jle`> map :: (a -> b) -> Maybe a -> Maybe b)
07:02 <jle`> traverse :: (a -> IO b) -> Maybe a -> IO (Maybe b)
07:03 <jle`> so instead of fmapping an (a -> b), you're "fmapping" an a -> IO b
07:03 <ph88> okidoki
07:03 <ph88> are there opportunities here to clean up the code some more from line 7 to 17 ?
07:03 eacameron joined
07:03 markus1199 joined
07:07 blym joined
07:07 <ph88> flip . traverse == for ?
07:07 <jle`> for = flip traverse
07:08 jacereda joined
07:08 {emptyset} joined
07:09 juanpaucar joined
07:10 Netwolf joined
07:10 Netwolf joined
07:11 Netwolf left
07:13 <ph88> can i use pure . fromMaybe to replace line 15 to 17 ?
07:15 vlatkoB_ joined
07:16 bjz joined
07:18 Yuras joined
07:18 SkyPatrol joined
07:18 blym_ joined
07:19 merijn joined
07:20 wroathe joined
07:21 jacereda joined
07:23 Sgeo_ joined
07:23 soLucien joined
07:24 jchia1 joined
07:25 drcode joined
07:29 blym_ joined
07:29 `Guest00000 joined
07:30 fnurglewitz joined
07:32 robotroll joined
07:32 <merijn> hmm, is there a reason why there is a foldM, but not foldM'? Does foldM' not require strictness?
07:33 takle joined
07:34 drcode joined
07:35 augur joined
07:35 RouxTheDay joined
07:35 baldrick1 joined
07:36 juanpaucar joined
07:38 {emptyset} joined
07:40 Herbstkind joined
07:41 wroathe joined
07:44 ErinvanderVeen joined
07:45 netheranthem joined
07:47 JScully joined
07:48 alexbiehl joined
07:50 alexbiehl joined
07:52 MichaelBurge joined
07:53 systadmin joined
07:53 mohsen_ joined
07:53 ph88 joined
07:54 <ph88> does anyone know how i can disable reformatting help text with optparse-applicative? it's removing spaces and newlines where i want them
07:54 ystael joined
07:55 oish joined
07:56 <ph88> i have this in my source: "Combinations of options:\n" ++ "| timecolumn | sampletime | resample | \n" ++ "| ✘ | ✘ | - | \n" and it prints like this: Combinations of options: | timecolumn | sampletime | resample | | ✘ | ✘ | - |
07:56 ericdwhite joined
07:57 baldrick1 joined
07:57 hackage joined
08:01 gestone joined
08:01 <jle`> optparse-applicative uses the ansi-wl-pprint library to do its formatting
08:02 <jle`> i think you can pass in explicit Doc's
08:02 gillesmajor joined
08:02 <ph88> i thought maybe this function could help https://hackage.haskell.org/package/optparse-applicative-
08:02 <cocreature> while we’re on the topic of optparse-applicative, is there any way to get it to show me help for positional arguments?
08:02 <ph88> to replace paragraph here https://hackage.haskell.org/package/optparse-applicative-
08:03 <ph88> cocreature, what are positional arguments ?
08:03 ccomb joined
08:03 <jle`> ph88: yeah checkout progDescDoc
08:03 <jle`> instead of taking a String, it takes a Doc
08:03 <cocreature> ph88: arguments that don’t belong to some flag and are identified by their position in the argument list
08:04 harryblack joined
08:04 <cocreature> e.g. in "cat a b" a is the first positional argument and b is the second
08:04 <ph88> oh i didn't even know that was supported o_O
08:05 <cocreature> ph88: you can just use "strArgument" or the more general "argument" parser for this
08:05 <cocreature> but it seems to be ignoring what I specify via help
08:05 dfeuer joined
08:07 bkboggy joined
08:08 {emptyset} joined
08:09 primal_ joined
08:10 <cocreature> ah I just need to use hsubparser instead of subparser and then --help works
08:10 <cocreature> nice
08:10 wonko7 joined
08:10 <ph88> cocreature, can you show ?
08:10 <cocreature> ph88: what?
08:10 ixxie joined
08:10 augur joined
08:13 osa1 joined
08:14 gillesmajor left
08:15 tromp joined
08:16 baldrick1 joined
08:17 augur joined
08:19 blym_ joined
08:19 <ph88> cocreature, what you were able to achieve with hsubparser
08:20 <ph88> by the way, why is the help text of optparse-applicative showing Usage: <interactive> [..Myoptions here ..] what is that interactive part ?
08:20 bkboggy left
08:21 <jle`> it probably uses the name of the process/executable
08:21 <jle`> are you running it in ghci?
08:21 xtreak joined
08:21 <ph88> ye
08:22 <ph88> ah right :D
08:22 <jle`> if you compile it, it'll use the name of the executable
08:22 <ph88> :)
08:22 <jle`> it's kind of like $0 in bash
08:22 <ph88> ye
08:22 <ph88> is there an easy way to manage blobs (resources) i want to include in my program ?
08:22 <ph88> instead of having separate files it would be nice to include them in the binary
08:23 <jle`> you'd probably have to do something with TH there
08:23 osa1_ joined
08:24 <ph88> oh ok o_O
08:24 <jle`> but popping resources into your binary probably isn't the best way to do things
08:24 <cocreature> ph88: the output now looks like this http://sprunge.us/WdjO
08:25 refold joined
08:26 <cocreature> ph88: file-embed allows you to embed things in your executable via TH
08:26 primal joined
08:27 athan joined
08:30 louispan joined
08:30 <ph88> thx
08:30 <ph88> be back later guys
08:30 zariuq joined
08:30 <ph88> looks good those options cocreature
08:31 blym_ joined
08:31 primal_ joined
08:33 ziocroc joined
08:35 paolino joined
08:35 <mniip> why does ghci need to execute gcc?
08:37 <jle`> just tried it out and i'm slightly disappointed that :set -XCPP doesn't actually do anything
08:37 <jle`> well. it affects interpreted files i suppose
08:38 jchia joined
08:39 {emptyset} joined
08:39 wroathe joined
08:40 lep-delete joined
08:41 juanpaucar joined
08:43 osa1_ joined
08:44 thc202 joined
08:44 jerbome_ joined
08:44 marr joined
08:45 Kreest__ joined
08:46 primal joined
08:46 marvin2 joined
08:47 <mniip> apparently
08:47 <mniip> --print-file-name libgmp.so
08:47 <mniip> is all it needed
08:47 bjz joined
08:48 romank joined
08:49 fizruk joined
08:53 romank joined
08:54 filterfish joined
08:54 ErinvanderVeen joined
08:54 filterfish joined
08:55 ystael joined
08:56 primal_ joined
08:57 systadmin joined
08:58 drcode joined
08:58 <mniip> what determines the location of .dyn_hi files for installed libraries and why is it not --prefix
09:00 TheFuzzball joined
09:00 <EvanR> i am noticing weak pointers reporting death when i dont expect it
09:01 <EvanR> "references to ordinary non-primitive haskell types are particularly fragile" what kind of objects does it make sense to get a weak ptr to?
09:02 kody joined
09:03 lavalike joined
09:03 <Adeon> IORefs, MVars, they have their own functions to create weakrefs that behave more as you'd expect
09:04 filterfish joined
09:04 <EvanR> mkay i have some lying aroun, guess ill use refs to those
09:04 eacameron joined
09:04 balor joined
09:07 tsmish joined
09:08 romank joined
09:08 cyborg-one joined
09:08 Guest10 joined
09:09 {emptyset} joined
09:10 nickolay joined
09:11 <EvanR> yeehaw
09:11 <EvanR> ghc: Prelude.undefine
09:11 <EvanR> d
09:11 <EvanR> when evaluating the result of deRefWeak
09:11 <EvanR> to see if its Nothing or Just
09:13 juanpaucar joined
09:16 romank joined
09:19 mjora7 joined
09:20 <EvanR> so thats using the IORef weak ptr
09:20 gestone joined
09:20 <EvanR> happens in compiled too
09:20 TheFuzzball joined
09:21 raichoo joined
09:21 wroathe joined
09:21 <EvanR> programName: undefined
09:21 bendo joined
09:23 romank joined
09:28 teggi joined
09:28 bjz joined
09:28 zcourts joined
09:30 caumeslasal joined
09:32 romank joined
09:33 ian-mi joined
09:33 mfukar joined
09:35 ralu joined
09:35 romank joined
09:36 fotonzade joined
09:38 robotroll joined
09:38 romank joined
09:39 {emptyset} joined
09:40 merijn joined
09:42 beerdrop joined
09:42 Kuros` joined
09:44 gienah joined
09:44 coot____ joined
09:45 Trendrrr joined
09:45 jerbome_ joined
09:46 arquebus joined
09:46 primal joined
09:46 xtreak joined
09:46 arquebus joined
09:47 spacecadetbrown joined
09:47 t7 joined
09:47 Mon_Ouie joined
09:47 arquebus joined
09:48 romank joined
09:51 mjora7 joined
09:51 romank joined
09:54 jgt3 joined
09:56 ystael joined
09:56 romank joined
09:57 martinmch joined
09:59 fnurglewitz joined
10:00 mohsen_ joined
10:01 twanvl joined
10:01 romank joined
10:02 wroathe joined
10:04 romank joined
10:05 FreeBirdLjj joined
10:05 filterfish joined
10:06 raduom joined
10:07 romank joined
10:07 hackebeilchen joined
10:10 Boarders joined
10:10 baldrick1 joined
10:11 richi-235 joined
10:12 {emptyset} joined
10:13 primal_ joined
10:17 Trendrrr joined
10:18 <jchia_1> optparse-applicative reader question. There's no ReadM Double AFAICT. Is there a shorter route than something like 'Options.Applicative.Builder.maybeReader . ClassyPrelude.readMay'?
10:18 <jchia_1> I mean "optparse-applicative ReadM question."
10:19 Guest42604 joined
10:19 sgflt joined
10:20 <jle`> there is a ReadM Double
10:20 <jle`> it's `auto`
10:20 <jle`> http://hackage.haskell.org/package/optparse-applicative-
10:21 <jle`> fwiw it's just a wrapper over eitherReader
10:22 hackebeilchen joined
10:22 <jchia_1> jle`: Thanks
10:22 <jle`> np!
10:23 cschneid_ joined
10:23 primal joined
10:24 asthasr joined
10:28 grizwako joined
10:28 featherlessbiped joined
10:29 grizwako joined
10:30 grizwako joined
10:31 davr0s joined
10:33 primal_ joined
10:36 ErinvanderVeen joined
10:38 cloudhead joined
10:38 cretiq joined
10:39 skeuomorf joined
10:41 maerwald left
10:41 maerwald joined
10:44 {emptyset} joined
10:44 Gurkenglas joined
10:44 pookleblinky joined
10:48 cschneid_ joined
10:48 yellowj joined
10:49 hurkan left
10:51 nilof joined
10:51 romank joined
10:52 ErinvanderVeen joined
10:52 Trendrrr joined
10:56 romank joined
10:56 baldrick1 joined
10:57 ystael joined
10:59 TheFuzzball joined
10:59 romank joined
11:03 Snircle joined
11:04 mmn80 joined
11:05 eacameron joined
11:05 wroathe joined
11:08 augur joined
11:09 hazyPurple joined
11:09 _paul0 joined
11:10 fizruk joined
11:12 sampuka joined
11:13 albertus1 joined
11:13 {emptyset} joined
11:14 juanpaucar joined
11:17 dm3 joined
11:21 oish joined
11:21 xtreak joined
11:22 shangxiao joined
11:22 Gurkenglas joined
11:22 dddddd joined
11:24 romank joined
11:25 xtreak joined
11:26 rickygee joined
11:28 augur joined
11:29 romank joined
11:34 birdgg joined
11:35 xall joined
11:40 ziocroc joined
11:42 xtreak joined
11:44 romank joined
11:46 sigmundv joined
11:46 {emptyset} joined
11:46 tromp joined
11:46 TheFuzzb_ joined
11:47 raichoo joined
11:47 fizruk joined
11:47 jerbome_ joined
11:47 wroathe joined
11:48 xall_ joined
11:49 mivael_ joined
11:49 augur joined
11:49 takle joined
11:50 sdothum joined
11:52 <* hackage> libgraph 1.12 - Store and manipulate data in a graph. https://hackage.haskell.org/package/libgraph-1.12 (faddegon)
11:52 drewbert joined
11:56 ddere joined
11:56 charliekilo joined
11:56 felixsch_ joined
11:57 gestone joined
11:57 bendo joined
11:57 ystael joined
12:00 fred-fri joined
12:01 robotrolll joined
12:01 jgt3 joined
12:01 albertus1 joined
12:02 <fred-fri> i'm running spacemacs with the haskell layer... if i put the caret on an application of one of my own functions and go to definition, spacemacs opens it for me... but if i do it on eg putStrLn nothing happens. what am i missing?
12:04 romank joined
12:08 wroathe joined
12:10 augur joined
12:14 Cale joined
12:15 romank joined
12:16 {emptyset} joined
12:16 dequbed joined
12:16 kuribas joined
12:17 henriksod joined
12:18 darlan joined
12:22 thunderrd joined
12:23 oish joined
12:23 RouxTheDay joined
12:23 CurryWurst joined
12:23 <kuribas> How do you create a suffix tree efficiently in haskell?
12:23 sfcg joined
12:24 sfcg joined
12:25 sternmull joined
12:26 <mniip> kuribas, I would put strings into a map and do a monotonic filter probably
12:26 <mniip> repeatedly
12:26 <kuribas> does it have O(n) complexity?
12:26 <kuribas> or O(n log n) at most?
12:30 harryblack joined
12:30 augur joined
12:31 fizruk joined
12:32 meba joined
12:32 romank joined
12:36 kuwaity joined
12:36 juanpaucar joined
12:38 bennofs joined
12:38 <kuwaity> 1
12:38 <kuwaity> 1
12:38 <kuwaity> 1
12:38 <kuwaity> 1
12:38 eyck joined
12:39 buttbutter joined
12:43 tromp joined
12:44 maybefbi joined
12:45 jgt3 joined
12:45 <maybefbi> should i avoid lists altogether, and use something else always?
12:45 quobo joined
12:45 <kuribas> maybefbi: why?
12:45 <kuribas> maybefbi: use what is appropriate.
12:46 <liste> maybefbi: no, lists have many useful use cases
12:46 <liste> maybefbi: the most important one is iteration
12:46 <maybefbi> relevant nick :)
12:46 <maybefbi> ok
12:46 {emptyset} joined
12:46 <maybefbi> i guess i will use it then, because im iterating over it
12:46 <liste> I use lists in many cases I would use for loops in other languages
12:46 <kuribas> maybefbi: for example a Map, Set, Vector, Sequence, etc...
12:47 aarvar joined
12:47 <maybefbi> what about String? should i avoid String always, and use ByteString or Text?
12:47 <liste> maybefbi: yes
12:48 <maybefbi> i wonder why people dont say use vector instead of list always, vectors have head and tail too and helps with iteration no?
12:48 <cocreature> maybefbi: they don’t have an O(1) cons operation
12:49 <maybefbi> but what if my list is consed just once during initialization using hardcoded constant data?
12:50 <cocreature> then vector is fine and potentially faster
12:50 <maybefbi> noted
12:50 <cocreature> but as always benchmark to figure out if it’s actually faster :)
12:50 <Tuplanolla> You can reserve space ahead of time when constructing a `Vector`, maybefbi.
12:50 <liste> btw, what is the status of stream fusion?
12:50 <kuribas> maybefbi: use a vector when you need O(1) indexing.
12:51 <maybefbi> Tuplanolla, cool
12:51 <maybefbi> kuribas, ok
12:51 augur joined
12:51 <kuribas> maybefbi: but beware than functional update is O(n).
12:51 <cocreature> that’s not the only reason to use a vector. even if you traverse it sequentially, the fact that you get better cache locality can make vector significantly faster
12:52 <maybefbi> kuribas, my vector is a constant list of domains
12:52 <kuribas> If you don't need indexing I'd say use a list.
12:52 <sternmull> maybefbi: In imperative languages vectors may be more often the better choice. In haskell lists often are nicer because they fit the functional programming problems (creating values) while vectors are often less useful because they are immutable.
12:52 <kuribas> even if it is a tiny bit slower.
12:53 <maybefbi> ok
12:53 <kuribas> You can have O(1) append for a vector, but it is a mutable operation.
12:53 <maybefbi> i guess i will use [ByteString] for my constant list of domains i iterate over
12:53 ragepanda joined
12:53 Punisher joined
12:53 takle joined
12:54 <cocreature> you can have _amortized_ O(1) append for a vector
12:55 <kuribas> The expert question on the current hackerrank competition is rather trivial with a suffix tree, but building one doesn't see trivial...
12:55 <kuribas> I wish copy pasting was allowed...
12:56 <kuribas> I wonder how people can solve these in under an hour...
12:56 anuxivm joined
12:56 <Tuplanolla> The trick is to stop caring about quality.
12:57 <Maxdamantus> also note that when you do something like `map f . map g . map h $ a`, it's not constructing lots of big intermediate structures.
12:57 <kuribas> Tuplanolla: even then, they will not work with brute force.
12:57 joncol joined
12:57 leah2 joined
12:58 <kuribas> Perhaps they have a library of solutions to reuse...
12:58 <joncol> What's the current state of the book "The Joy of Haskell"? Tried visiting the web page for the book, but couldn't find much information.
12:58 ystael joined
13:00 takle joined
13:00 Boomerang joined
13:02 baldrick1 joined
13:02 <sternmull> when looking for online books i found https://en.wikibooks.org/wiki/Haskell to be the most useful.
13:03 <cocreature> joncol: I don’t think either of the authors come here so probably want to send them an email if you want more info
13:03 rcat joined
13:05 wroathe joined
13:05 freakofmimsy joined
13:05 cpup joined
13:06 eacameron joined
13:07 Itkovian joined
13:08 takle joined
13:09 takle_ joined
13:11 nshepperd joined
13:12 augur joined
13:12 <balor> I've derived a Functor for a record type. Is there a way to get `ghci` to show me the functor that it has derived? Just out of interest.
13:13 epsilonhalbe joined
13:14 <lyxia> balor: you can do :set -ddump-deriv before deriving
13:14 epsilonhalbe left
13:14 <balor> lyxia, thanks
13:15 eyck joined
13:15 ilyaigpetrov joined
13:15 romank joined
13:16 louispan joined
13:16 {emptyset} joined
13:16 rcschm joined
13:17 selthas joined
13:19 fragamus joined
13:19 <joncol> cocreature: OK, gotcha.
13:22 felixsch__ joined
13:24 primal joined
13:25 romank joined
13:26 davr0s joined
13:26 baldrick1 joined
13:28 zariuq joined
13:28 eSVG joined
13:29 sepp2k joined
13:30 bjz_ joined
13:31 sdothum joined
13:32 eyck joined
13:32 augur joined
13:33 tromp joined
13:33 eacameron joined
13:34 darlan joined
13:35 jerbome_ joined
13:35 padre_angolano joined
13:41 ralu joined
13:41 Gloomy joined
13:42 butterthebuddha joined
13:43 primal_ joined
13:44 vgrocha joined
13:45 ErinvanderVeen joined
13:45 juanpaucar joined
13:45 romank joined
13:46 fnordmeister joined
13:47 Guest10 joined
13:47 wroathe joined
13:47 butterthebuddha joined
13:47 {emptyset} joined
13:50 romank joined
13:52 sdothum joined
13:52 kirillow joined
13:53 augur joined
13:53 romank joined
13:54 Itkovian joined
13:55 sdothum joined
13:58 meba joined
13:59 ystael joined
13:59 <kuribas> How do you turn a mutable structure in a pure one?
14:00 Big_G joined
14:00 <kuribas> for example (s IORef) -> (s Identity)
14:01 <c_wraith> I mean, you could do that.
14:01 <hpc> start with addind MonadIO s to that type
14:01 <hpc> or something like that
14:01 <c_wraith> But there's no automatic answer.
14:01 kaychaks joined
14:01 <c_wraith> You just write the appropriate traversal for your type
14:01 sdothum joined
14:01 <hpc> MonadIO s => s (IORef a) -> s (Identity a)
14:01 <jchia_1> Lens question. I have 'data NeedsLens = HasLens1 HasLens1 | HasLens2 HasLens2 | HasLens3 HasLens3' where HasLens[1-3] all have an instance of 'class HasPart a where part :: Functor f => (Int -> f Int) -> a a -> f a'. In other words, HasLens[1-3] all have lens that let them focus to an Int, as witnessed by HasPart. How do I easily define an instance of HasPart for NeedsLens easily making use of the HasPart instances of HasPart[1-3]?
14:01 eyck joined
14:01 <kuribas> c_wraith: I suppose so...
14:02 <c_wraith> hpc: that feels like an extra s
14:03 <jchia_1> Correction: 'Functor f => (Int -> f Int) -> a -> f a'
14:03 theelous3 joined
14:03 romank joined
14:03 ixxie joined
14:03 Elish joined
14:03 <hpc> c_wraith: i don't want to give up the whole game by reducing the type to something like IORef a -> IO a
14:03 <hpc> :P
14:04 <jchia_1> Basically, NeedsLens is a sum type and I want to make a lens for it in terms of the lens for the parts of the sum.
14:04 primal joined
14:04 coltfred joined
14:04 <Tuplanolla> Don't you need a prism, jchia_1?
14:05 <c_wraith> Tuplanolla: well, no. Every branch has the same lens
14:05 wei2912 joined
14:05 systadmin joined
14:05 <c_wraith> jchia_1: have you ever written a lens by hand?
14:06 <jchia_1> Tuplanolla: I don't know much about prism, only heard of them. I just need to have something to focus into the parts.
14:06 <AlainODea> jchia_1: instances are on types. HasLens[1-3] aren't types, they are inhabitants of the NeedLens type. There would be an instance of Functor for NeedLens that would handle each of HasLen[1-3] by pattern matching
14:06 Guest42604 joined
14:07 <jchia_1> c_wraith: Only simple for accessing part of a simpel product type.
14:07 kfish joined
14:07 <c_wraith> jchia_1: this is a little more interesting, but.. not much.
14:08 wroathe joined
14:08 <jchia_1> AlainODea: data HasLens1 = HasLens1 ...; data HasLens2 = HasLens2 ..; data NeedsLens = HasLens1 HasLens1 | HasLens2 HasLens2 | HasLens3 HasLens3;
14:09 c137 joined
14:09 caumeslasal joined
14:10 cpennington joined
14:10 <AlainODea> That won't compile. HasLens[1-3] are inhabitants or data constructors. They can't also be types.
14:11 <c_wraith> AlainODea: sure they can
14:11 <c_wraith> AlainODea: they're different namespaces
14:11 mstruebing joined
14:11 <Tuplanolla> It won't compile for other reasons.
14:12 <AlainODea> c_wraith: oh, right. It won't work as expected though ;)
14:12 <* hackage> JuicyPixels-extra 0.2.1 - Efficiently scale, crop, flip images with JuicyPixels https://hackage.haskell.org/package/JuicyPixels-extra-0.2.1 (mrkkrp)
14:13 acidjnk22 joined
14:14 augur joined
14:14 <jchia_1> AlainODea: OK, more accurately, I mean 'type HasLens1 = ( "a" := Int, "b" := Char); type HasLens2 = ( "a" := Int, "b" := [Int])'
14:14 <wilornel> I think it's interesting that Haskell needs many definitions for functions on 2-tuples, 3-tuples, 4-tuples, and others
14:15 <AlainODea> jchia_1: I'm out of my depth here. I'll leave you in more capable hands ;)
14:15 <wilornel> is there no way to define a function such that it can take different sized tuples?
14:15 <Tuplanolla> Lenses are accompanied with type classes for that, wilornel.
14:16 <Tuplanolla> @hoogle Field1
14:16 <lambdabot> Control.Lens.Tuple class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s
14:16 <lambdabot> Lens.Micro.Internal class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s
14:16 <lambdabot> Agda.Utils.Lens.Examples field1 :: Record a b -> a
14:16 Itkovian joined
14:16 <wilornel> ah, I don't know much about lenses yet, and these definitions are confusing D:
14:16 <wilornel> I've never seen this | syntax before
14:17 ragepanda joined
14:17 <Tuplanolla> You can almost ignore it if you just want to use the classes.
14:17 {emptyset} joined
14:17 takle joined
14:17 <wilornel> hmm alright
14:17 <wilornel> is that | an overloading of syntax?
14:17 <wilornel> :(
14:17 <Tuplanolla> It's a functional dependency.
14:18 madsa joined
14:19 <jchia_1> Tuplanolla: Actually, Prism allows me to do 'preview' and 'review'. I don't need those. I still just need the lens functionality of 'view' and 'set'. The part I'm focusing on exists in all the 'branches' of the prism and there's no 'Maybe' involved.
14:19 <wilornel> thanks Tuplanolla
14:19 oish joined
14:20 primal_ joined
14:22 takle joined
14:22 buttbutter joined
14:23 SkyPatrol_ joined
14:23 yqt joined
14:25 primal joined
14:26 teggi joined
14:26 romank joined
14:27 <c_wraith> jchia_1: http://lpaste.net/355704
14:27 GamboPango joined
14:28 <c_wraith> jchia_1: note that my entire dev procedure for that was using typed holes. Throw a hole in, look at what types I need and what types are in scope..
14:29 eschnett joined
14:29 <jchia_1> c_wraith: Thanks. Let me try that approach with my code.
14:30 jmcarthur joined
14:33 <wilornel> I don't get  undefined :: (Plus (S Z) (S Z) r) => r :: S (S Z)
14:33 <wilornel> in https://byorgey.wordpress.com/2010/06/29/typed-type-level-programming-in-haskell-part-i-functional-dependencies/
14:33 codesoup joined
14:33 primal_ joined
14:34 <* hackage> ombra - Render engine. https://hackage.haskell.org/package/ombra- (ZioCrocifisso)
14:34 <c_wraith> wilornel: All it's really doing is demonstrating that the type is well-kinded
14:35 <wilornel> I'm trying to find how does it figures out what r is. Because that's what we show, right? We ask for r by doing `:t undefined :: (Plus (S Z) (S Z) r) => r`
14:35 <c_wraith> wilornel: well, and that GHC doesn't reduce the type
14:35 <c_wraith> wilornel: it's not figuring anything out. That's why the output says the type is identical to what was provided
14:35 <wilornel> Hmmm
14:36 <wilornel> The type is identical?
14:36 <c_wraith> yeah
14:36 <wilornel> (S Z) (S Z) r does not look identical to S (S Z)
14:36 <wilornel> that's what's confusing me
14:36 <c_wraith> Oh, you're further down the page than I was checking. My mistake
14:36 <wilornel> ah yes
14:37 <wilornel> two boxes down
14:37 e14 joined
14:38 kritzcreek joined
14:38 <c_wraith> So, the two instances in the previous box are how it works
14:39 <c_wraith> They almost read like a recursive function definition, except that the body comes before the head in the second instance
14:39 <wilornel> Hmmm so because we have Plus (S Z) (S Z) r, it's using the second instance definition
14:39 <wilornel> is that right?
14:39 <c_wraith> yes
14:40 <wilornel> oh, byorgey is here!
14:40 mfukar joined
14:40 <wilornel> but how does that translate to r being S (S Z)
14:40 <wilornel> recursive function definition?
14:40 <wilornel> yeah it's weird if we say that r = (S r), right?
14:41 <c_wraith> well, the fundep says that m n -> r
14:41 <wilornel> so S( Z) (S Z) -> r
14:41 soLucien joined
14:41 <wilornel> or (S m) n -> (S r)
14:41 <c_wraith> yes, that
14:41 <wilornel> aaah it's strange when we have two differnent r's
14:41 <c_wraith> yeah
14:41 <wilornel> Is it (S m) n -> (S r) or (S m) n -> r?
14:42 <wilornel> first one right right
14:42 <c_wraith> yes
14:42 Kreest_ joined
14:42 <wilornel> but then that still does not fully explain S (S Z)
14:42 <wilornel> I see where Z comes from
14:42 <wilornel> (S m ) == (S Z), so m == Z
14:42 <c_wraith> No. Then it goes recursively into the instance
14:43 SkyPatrol joined
14:43 <c_wraith> and matches against Z (S Z) r
14:43 primal joined
14:43 <wilornel> you lost me with recursivity
14:43 <c_wraith> the second instance has a constraint
14:43 <wilornel> yes
14:43 <c_wraith> That constraint gets applied when the head matches
14:43 cfricke joined
14:43 <wilornel> the head being Plus?
14:43 <wilornel> or m?
14:43 <c_wraith> The head being (S m) n (S r)
14:44 <wilornel> yes
14:44 <wilornel> but how is that recursive
14:44 <wilornel> oh wait
14:44 <wilornel> wait wait
14:44 <c_wraith> The constraint gets applied to those values of m, n, and r
14:44 redpoppies joined
14:44 <c_wraith> And the constraint is to the same class, so it's recursive
14:45 <wilornel> alright, yes
14:45 <wilornel> It's like saying Num a => Num a for simpler typeclasses
14:45 <c_wraith> Well, Num a => Num (Foo a)
14:45 <c_wraith> But yeah
14:45 <wilornel> Alright, and then the matching happens on the right side
14:46 albertus1 joined
14:46 ragepanda joined
14:46 ddere joined
14:46 <wilornel> So if I have Num (Foo 1), then 1 is Num
14:47 <c_wraith> By the way, this isn't just you. Type-level programming with functional dependencies is basically doing a half-hearted prolog in the type system. It's very different from writing functions as Haskell terms
14:47 {emptyset} joined
14:47 <wilornel> It seems almost perpendicular to doing function definitions in terms of diffulty of understanding
14:48 <wilornel> I wonder how often do you end up havking to think about these things deeply for each feature in Haskell
14:48 <wilornel> or does it get easier?
14:49 fizruk joined
14:49 <c_wraith> Most features in this area are trying to make type-level programming more like Haskell term programming, so there's less to learn. :)
14:49 <wilornel> oooooooh wait
14:49 <c_wraith> And you're right. It's just a totally different way of doing things.
14:49 <wilornel> I think I get it!
14:49 yellowj joined
14:50 wroathe joined
14:50 <wilornel> so you said it's recursive so I had to realize there's a base case. I kept thinking that since it's recursive it should go on forever. The base case in this situation is the first instance definition: `instace Plus Z n n`, is taht right?
14:50 romank joined
14:50 <c_wraith> yes
14:51 <wilornel> so first we match the second definition, and then we match the first one. On matching the second def, we get that m = Z, n = (S Z) and (S r) = r. Then, on matching the second def, we should get n = n, so (S Z) = (S r), which is = r
14:52 <wilornel> I still don't see where the first S in _S_ (S Z) comes from
14:53 tromp joined
14:53 <c_wraith> It comes from the S r in the second definition
14:53 <c_wraith> The thing is, when you're working with a fundep, you can see the things on the right side as output.
14:53 <wilornel> ok then (S Z) comes from the first definition
14:53 <wilornel> hmmmmm
14:54 juanpaucar joined
14:54 <wilornel> it's a strange way of doing this
14:54 <wilornel> and thanks for clarifying that the right hand side is like the output
14:54 <c_wraith> yes, it is. Unless you have a lot of experience with prolog, which I don't. :)
14:54 Noldorin joined
14:55 MarioBranco joined
14:55 romank joined
14:55 <wilornel> it's interesting that Haskell can achieve this part of another language with an extensin
14:55 fkurkowski joined
14:55 <c_wraith> It was sort of accidental :)
14:56 <* hackage> threepenny-editors - Composable algebraic editors https://hackage.haskell.org/package/threepenny-editors- (PepeIborra)
14:56 Itkovian joined
14:56 <wilornel> cool! :) I wonder what else will end up being accidental easy addition and if extending the language will ever stop
14:57 <c_wraith> Well, fundeps were added to solve an entirely different problem.
14:58 davr0s joined
14:58 <c_wraith> Then people noticed that they allow you to specify calculating types as the result of other types.
14:58 <liste> wilornel: if you're interested in type-level programming, check out Idris (or Agda)
14:58 <wilornel> is that what you would use for formal proofs?
14:59 <c_wraith> Agda is a proof language. Idris is more intended as a programming language first
14:59 <wilornel> one of the things you'd use for formal proofs*
15:00 tommd joined
15:00 <wilornel> so Agda is built with Haskell, that's nice
15:00 baldrick1 joined
15:00 ystael joined
15:00 <c_wraith> So is Idris, iirc
15:00 <liste> so is Idris
15:00 <ggVGc> one day GHC will be written in Idris and we'll be complete
15:00 <c_wraith> Well that would be complicated. :)
15:01 LKoen joined
15:01 <wilornel> What's the reason for making Idris when Haskell is there? if Idris is a programming language when Haskell already is
15:01 <wilornel> You can't write GHC in Haskell?
15:01 <c_wraith> Idris is a full dependently-typed language
15:01 <ggVGc> depdendant types afaik
15:01 <ggVGc> mainly
15:01 <wilornel> fundeps are dependent types, right?
15:02 <c_wraith> No
15:02 <ggVGc> not really
15:02 <wilornel> fundeps are for* dependent typeS*
15:02 <liste> wilornel: it's hard to make Haskell fully dependently typed, starting from "scratch" is much cleaner
15:02 <c_wraith> Dependent types allow you to specify types that depend on values
15:02 mohsen_ joined
15:02 <c_wraith> fundeps let you specify types that depend on types
15:02 <ggVGc> wilornel: it's one of the pieces of haskell that brings haskell towards being dependently typed
15:02 <ggVGc> but I believe haskell will never really have full dependent types
15:02 <wilornel> hmmm I see
15:02 <c_wraith> ggVGc: They should be in 8.6 or 8.8
15:02 <ggVGc> oh
15:02 <ggVGc> interesting
15:03 <c_wraith> Look for Rich Eisenberg's Dependent Haskell papers.
15:03 <wilornel> wow! So Haskell would be complete and no need for Idris?
15:03 <liste> I wonder what'll happen with Idris ten?
15:03 <liste> then*
15:03 <liste> wilornel: well, hardly "complete", I think it would still evolve after that
15:03 <c_wraith> But that version of dependent types won't allow lifting functions to the type level. There's still a long way to go.
15:03 <Tuplanolla> Complete the way C++ is complete, wilornel?
15:04 <c_wraith> Also, Idris is a strict language. It's just plain different. :)
15:04 <liste> Idris tries to learn from Haskell's mistakes
15:04 Simulacrum joined
15:05 <c_wraith> Strictness is the mistake. :P
15:05 <wilornel> I was being overly irrationally innocently optimstic
15:05 <ggVGc> what are you guys talking about. haskell is already perfect and complete
15:05 <wilornel> so we'll throw away Haskell and go with Idris!
15:05 <c_wraith> I mean, strictness sesms required for a termination checker.
15:05 <c_wraith> *seems
15:05 marinelli joined
15:05 <wilornel> checking if something terminates??
15:05 <jchia_1> halting problem?
15:06 <c_wraith> Yeah. Idris and Agda have termination checkers.
15:06 <liste> wilornel: yeah, dependently-typed languages can be total
15:06 <wilornel> I guess it would be possible if your yprogram has a specific shape
15:06 <c_wraith> It's part of avoiding some type-level inconsistenties
15:06 <c_wraith> Like, Haskell's type system corresponds to an inconsistent logic.
15:06 epsilonhalbe joined
15:06 <Tuplanolla> You can give up Turing completeness for some other nice properties, wilornel.
15:06 <wilornel> so for some fucntions, you'd get `terminates (my_function) == undetermined` ?
15:07 <wilornel> Hmmmm interesting!
15:07 <c_wraith> Here's the thing - Turing completeness is not a language feature.
15:07 <wilornel> it's a bug?
15:07 <c_wraith> Yes
15:07 <wilornel> WHAT
15:07 <wilornel> side-effect?
15:07 <c_wraith> The only thing Turing completeness adds is the ability to write infinite loops.
15:07 Wuzzy joined
15:07 <c_wraith> non-productive ones, that is
15:08 <c_wraith> Any algorithm you want to write doesn't require Turing completeness, because it wants to be productive.
15:08 <wilornel> That's interesting. Any good readings on this? I feel like this would be some nice mind bending
15:08 <wilornel> what do you mean?
15:08 Itkovian joined
15:08 <wilornel> It want to be somewhat optimized in runtime/space complexity / structure?
15:08 <wilornel> It wants to be self-contained, and not required a variable amountof memory?
15:09 epsilonhalbe left
15:09 <c_wraith> None of the above.
15:09 <wilornel> :(
15:09 <c_wraith> I just mean that if you're running a program, you want it to do something.
15:09 <wilornel> Tuplanolla: any good readings?
15:09 <wilornel> c_wraith: yes, and that's what the turing machine does as well
15:09 <Tuplanolla> Do you accept tangentially related, wilornel?
15:09 <wilornel> You mean you want it to do a specific thing?
15:09 <wilornel> Tuplanolla: yes!
15:09 <Tuplanolla> @google software foundations book
15:09 <lambdabot> https://www.cis.upenn.edu/~bcpierce/sf/
15:10 <wilornel> Thank you!
15:10 <liste> Tuplanolla++
15:10 <wilornel> c_wraith++
15:10 <wilornel> Tuplanolla++
15:10 <wilornel> Anything keeps count?
15:10 <Tuplanolla> @bot
15:10 <lambdabot> :)
15:10 koserge joined
15:10 wroathe joined
15:11 <liste> Tuplanolla: mind if I PM you on a thing related to Haskell but specific to you?
15:11 <wilornel> And c_wrait, so does that mean that you can structure programs to not have a variable memory size, which is what the turing machine has?
15:11 <c_wraith> wilornel: I mean that you want from a program is for it to produce results.
15:12 Itkovian joined
15:12 <wilornel> Hmmm and the turing machine is not specifically designed for this. It's designed to compute and at some point stop?
15:12 <Tuplanolla> Ask me via email if you can email me first, liste.
15:12 <c_wraith> wilornel: the whole point of the turing machine was that you can write programs that you can't tell if they terminate or not.
15:12 <wilornel> That was good IRC etiquette I thought
15:12 <liste> Tuplanolla: OK
15:12 <c_wraith> wilornel: but all programs you *want* to write do terminate.
15:13 <int-e> especially servers
15:13 <c_wraith> wilornel: (or equivalently, eventually perform IO, even if the process keeps running)
15:13 <wilornel> right, so you want to give up turing completeness in order to always know that it will terminate at some point
15:14 <c_wraith> Yes. The problem, of course, is that termination proofs can be *hard*.
15:14 <int-e> Also, termination is quite overrated... the fact that a program does terminate still doesn't tell you when that will happen.
15:15 <c_wraith> That's also true.
15:15 <Tuplanolla> This banishment of Turing completeness tends to lead to useful results when applied in other computational contexts too, wilornel.
15:16 <c_wraith> In other words, requiring termination proofs often doesn't prove anything actually useful about the code, and adds a bunch of effort to writing it
15:16 <c_wraith> So.. This is why most languages accept Turing completeness.
15:16 Itkovian joined
15:16 <Tuplanolla> @google langsec babel
15:16 <c_wraith> It might be a bug, but it's easier to work with the bug than to fix it. :)
15:16 <lambdabot> http://www.cs.dartmouth.edu/~sergey/langsec/occupy/
15:16 <lambdabot> Title: Occupy Babel!
15:16 quchen joined
15:16 <wilornel> I see! Awesome
15:17 ChaiTRex joined
15:18 oish joined
15:19 <wilornel> This page reminds me of something I had in mind before. Since Haskell is lazily evaluated, I think that in the representation that Haskell keeps, it probably has a sort of tree representation of all the functions calling eachother. Are there any visualizers for your variables in your code?
15:19 {emptyset} joined
15:19 SkyPatrol_ joined
15:19 drcode joined
15:19 <wilornel> say `let x = (* 2); y = x 3`, then you would visualize y and it would show you that y is in fact (* 2) applied onto 3
15:20 <c_wraith> there is a package that introspects the runtime representation and produces DOT graphs
15:20 <wilornel> or at least print it out somehow
15:20 bennofs joined
15:20 <ertes> termination does prove one useful thing: your program will always produce in one way or another
15:20 <wilornel> cool!
15:20 <ertes> that eliminates some bugs
15:20 lambdageek joined
15:20 <c_wraith> I can never remember the package's name, though
15:21 <ertes> but it comes at a price: you will not be filtering an infinite list
15:21 zariuq joined
15:21 maarhart joined
15:21 <wilornel> but you can filter a list of variable size, still, right?
15:21 <c_wraith> ertes: unless you can write a proof that an infinite subset of elements in the list satisfy the predicate. :P
15:22 argent0 joined
15:25 <monochrom> Is that Hat? Is it Hood?
15:26 <c_wraith> No, it's a package kind of like vacuum
15:26 <ClaudiusMaximus> !hackage vacuum-graphviz -- c_wraith this?
15:26 <c_wraith> Except it can introspect thunks, too
15:26 <c_wraith> @hackage ghc-vis
15:26 <lambdabot> http://hackage.haskell.org/package/ghc-vis
15:26 <ClaudiusMaximus> http://hackage.haskell.org/package/ghc-heap-view perhaps
15:26 <c_wraith> I think it's that one
15:26 Itkovian joined
15:27 <c_wraith> which doesn't appear to have been updated for ghc 8
15:27 <c_wraith> and ghc-vis depends on ghc-heap-view, so yeah
15:27 RayNbow`TU joined
15:27 takle joined
15:28 athan joined
15:28 Guest42604 joined
15:28 jsgrant_ joined
15:30 ErinvanderVeen joined
15:30 Simulacrum left
15:31 romank joined
15:31 wroathe joined
15:33 <wilornel> awesome! that might make visualizing algorithm much easier now that I think about it
15:33 ystael joined
15:33 <wilornel> although you need to understand the graphs
15:33 lambdageek joined
15:33 drcode joined
15:34 <c_wraith> Yeah, it's not a magic bullet - but it's still really nice information
15:34 <wilornel> there's no magic bullet eh?
15:34 <wilornel> Would haskell be one? I do feel like it could be much more productive than procedural programming
15:34 <c_wraith> Only one, and it was used to assassinate Kennedy.
15:34 Itkovian joined
15:34 <wilornel> D:
15:34 eminhi joined
15:35 SkyPatrol joined
15:35 <wilornel> ah we said magic bullet, I thought we were talking about silver bullet. Recently read about it in Mythical Man-Month
15:35 <c_wraith> Well, they have the same use in metaphor.
15:35 <c_wraith> They both do the impossible.
15:35 fizruk joined
15:36 <* hackage> th-abstraction - Nicer interface for reified information about data types https://hackage.haskell.org/package/th-abstraction- (EricMertens)
15:36 <wilornel> ah yes, although software silver bullets don't assassinate any Kennedies
15:36 oish joined
15:37 acidjnk22 joined
15:37 bjz joined
15:38 urodna joined
15:38 Welkin joined
15:38 <c_wraith> jchia_1: did that approach work out?
15:39 cyborg-one joined
15:39 Itkovian joined
15:41 maarhart joined
15:42 gugah joined
15:43 <* hackage> vty 5.15.1 - A simple terminal UI library https://hackage.haskell.org/package/vty-5.15.1 (JonathanDaugherty)
15:43 drcode joined
15:44 geekg_000 joined
15:45 ErinvanderVeen joined
15:46 <ertes> c_wraith: have fun doing that =)
15:46 zzz joined
15:47 <ertes> "this filter is actually productive" is among the most horribly inconvenient proofs to write in a CH setting
15:47 TheFuzzball joined
15:48 kirillow joined
15:48 pie_ joined
15:49 <c_wraith> ertes: I did say proofs of productivity could be really hard. :)
15:49 {emptyset} joined
15:50 <ertes> ah, i didn't read the whole backlog =)
15:50 cpup joined
15:51 <Rotaerk> hmm how should something that's allowed by the type system but is logically impossible be reported?
15:51 HoierM joined
15:51 romank joined
15:51 <EvanR> an exception?
15:52 <Rotaerk> I could, I suppose, was also considering assertion
15:52 <EvanR> if anything not like this
15:52 <Rotaerk> e.g. processing a result type that's A | B | C, but it *can't* be A
15:52 <EvanR> ghc: undefined
15:52 wroathe joined
15:52 <ertes> Rotaerk: "segmentation fault"
15:53 <EvanR> Rotaerk: well, this is pretty fragile.... consider using a different result type
15:53 <ertes> that's how C does it, and everybody seems to be fine with that
15:53 <Rotaerk> EvanR, it's a parser
15:53 <Rotaerk> it can either fail, succeed, or partially parse
15:53 <Rotaerk> but in this case, there's no way the parser can fail, it will either succeed or partial
15:53 <LKoen> *** Exception: nameOfTheFunction: impossible value A
15:54 <ertes> "heartbleed a security issue? nah, that's just our version of throwing an exception"
15:54 <EvanR> Rotaerk: so whats the argument for this?
15:54 drcode joined
15:54 <EvanR> seems like parsers can definitely fail no matter what
15:55 <Rotaerk> in this case, I'm doing: ABS.takeTill (`BS.elem` "\CR\LF") <* (pCR <* optional pLF <|> pLF)
15:55 <EvanR> ok, so anything at all satisfies the parser?
15:56 <Rotaerk> it will parse everything until it encounters \CR or \LF; if it never encounters them before the end of input, then it will return a Partial
15:56 <Rotaerk> so either Succeed or Partial
15:56 asm_ joined
15:56 <Rotaerk> s/Succeed/Done/
15:57 <Rotaerk> I could just ... not handle the Fail case
15:57 <EvanR> what would be interesting is to somehow attach a sentry to the parser code that says you verified its cant failness. you are allowed to ignore the failure case as long as you dont change the parser code
15:58 grumble joined
15:58 <EvanR> you can wrap the parser action and the result type in another set of types specifically for parsers than cant fail
15:58 <EvanR> but the question is how to make sure you only use it with cant fail parsers
15:59 <EvanR> its sort of the same thing as, only use div with non zero numbers
15:59 <Rotaerk> yea
15:59 Itkovian joined
16:00 <Rotaerk> I think I'm not going to try to solve THAT problem here, i.e. of adjusting the type system to match the logically possible results
16:00 <Rotaerk> since that's kind of a larger problem...
16:00 <EvanR> do handle the case so the warning goes away, and throw an exception
16:00 <Rotaerk> k
16:00 <EvanR> and make an extensive comment about it in the code, and hope it does become wrong ;)
16:00 <EvanR> doesnt
16:01 <Rotaerk> heh
16:01 <EvanR> ah you know what
16:01 <Rotaerk> hmm I guess assert throws an AssertionFailed exception when its input is false
16:02 <Rotaerk> and that's what this really is...
16:02 <Rotaerk> an assertion that this should never happen
16:02 <EvanR> you could make an entirely new parser lib based on cant fail parsers, but it would limit the kinds of cant fail parsers you could write
16:02 <EvanR> where is AssertionFailed?
16:03 <Rotaerk> Control.Exception
16:03 <EvanR> ah
16:03 ompaul joined
16:03 <Rotaerk> the main downside to that is that assertions can be disabled
16:03 <Rotaerk> and I'm not sure I'd want this check to be disabled
16:03 <EvanR> just directly throw the assertion failed exception
16:03 <Rotaerk> true
16:03 <EvanR> or whatever exception you want. i have an exception type for this called Bug
16:04 Costar joined
16:04 wildlander joined
16:04 <EvanR> bug "File.hs" 3423 "You dolt! (explanation of why this shouldnt happen)"
16:05 <Rotaerk> :P
16:06 <EvanR> if the only conceivable way your thing can crash is with messages about bugs you already thought of... thats pretty good
16:07 torgdor joined
16:07 <EvanR> ignoring out-of-memory
16:07 monochrom joined
16:07 tusj joined
16:08 bigos joined
16:09 jerbome_ joined
16:09 <wilornel> hmmm... I am trying to fix an example that was labelled as bad practice in the haskell book I am reading
16:10 ragepanda joined
16:10 <wilornel> They say not to have a defaultValue function for your types. I am trying to make a defaultValue :: (Numberish a) -> a for my types that are instances of Numberish
16:10 <wilornel> How could I have that function defaultValue return different values depending on the type it is casted to?
16:10 <wilornel> defaultNumber :: Age = Age 65?
16:11 <wilornel> of course that does not work
16:11 <srhb> wilornel: First off, there is no casting. Secondly, it sounds like you want Numberish a => a
16:11 balor joined
16:11 <srhb> wilornel: Thirdly, that's like the Default typeclass.
16:11 <wilornel> ah, sorry yes
16:12 <wilornel> defaultValue :: (Numberish a) => a is what I have
16:12 <EvanR> the bad practice i think here is the Default-like typeclass
16:12 <wilornel> and this is just for the sake of trying things out, not necessarily looking to use this in the proper manner
16:12 <EvanR> or the Default-like behavior
16:12 e14 joined
16:12 <wilornel> yes the deafult-like typeclass is bad practice as they said
16:12 <wilornel> oh no wait
16:13 <wilornel> "Don't use typeclasses to define default values." "-- Seriously. Haskell Ninjas will find you""-- and replace your toothpaste with muddy chalk."
16:13 mada joined
16:13 <EvanR> agreed
16:13 wroathe joined
16:13 wei2912 joined
16:13 <wilornel> and so I could try to define defaultValue outside of the typeclass
16:14 <wilornel> not that that's good but just wondering how that would work out
16:14 <srhb> wilornel: It does not, really.
16:14 <wilornel> Ah, alright
16:14 <monochrom> I thought toothpaste was muddy chalk
16:14 <srhb> wilornel: At least not the way you are imagining it. The way to overload a name like that with multiple values is exactly through type classes, which is the no-no.
16:14 <EvanR> especially default numbers? weird
16:15 <EvanR> there are special zero and one like values for numbers with special properties, but they arent really defaults
16:15 <wilornel> alright, then I shall look at the previous thing that was bad. They didn't say why it was bad
16:15 <glguy> You know, for those times when any number will do
16:15 Kuros` joined
16:16 <monochrom> Default value without type class would be to always pass default values as parameters.
16:17 <EvanR> formatTime defaultTimeLocale "%Y-%M-%d" today
16:17 <EvanR> (... defaultTimeLocale... what is it...)
16:17 <wilornel> alright, I'm not quite sure why they say that the code was silly
16:17 <glguy> It's the default TimeLocale
16:17 safe joined
16:17 <EvanR> "the" ?
16:17 <glguy> yeah
16:17 <wilornel> HAskell programming from First Principles section 6.11
16:17 <EvanR> its per system right
16:18 <wilornel> the first block of code
16:18 <glguy> EvanR: No, I don't think so
16:18 <EvanR> o_O
16:18 <EvanR> default time locale is US english everywhere?
16:18 <glguy> yeah
16:18 <EvanR> mind blown
16:19 <glguy> If you want actual localized time , you have to generate a TimeLocale using whatever criteria you might want
16:19 {emptyset} joined
16:19 <glguy> that would go into another package to extract it from various places on various operating systems, etc
16:19 <monochrom> Like the random number is 4 everywhere
16:19 <wilornel> alright, good day/night/evening/morning/lunch/dinner/breakfast #haskell!
16:20 <EvanR> default time of day
16:20 <rntz> glguy: so System.Locale provides "the ability to adapt to local conventions" - except that it doesn't actually do the thing that tells you want local conventions are? :P
16:20 <rntz> s/you want/you what/
16:20 <\u> Anyone use Arch Linux community/ghc-8.0.1 Can you share your output of `ar tv /usr/lib/ghc-8.0.1/base- | grep Weak`
16:21 <\u> I wonder why there are so many Weak*.o called Weak__1.o Weak__2.o Weak__3.o ... However, what I obtained by building GHC HEAD only contains two Weak.o (duplicated name)
16:21 <monochrom> -fsplit-objs ?
16:22 Puggy joined
16:22 <glguy> rntz: That's a different package
16:23 TheFuzzball joined
16:23 <* hackage> prettyprinter 0.1, prettyprinter-ansi-terminal 0.1, prettyprinter-compat-annotated-wl-pprint 0.1, prettyprinter-compat-wl-pprint 1, prettyprinter-compat-ansi-wl-pprint 0.1 (quchen): https://qbin.io/zlrr5sy
16:23 <glguy> rntz: Data.Time.Format.TimeLocale is being discussed
16:23 RouxTheDay joined
16:23 primal_ joined
16:24 <quchen> ?tell merijn Uploaded a pre-release, search for »prettyprinter«. Your nagging was successful. Pity Hackage displays the dependencies wrong (or has an old build system).
16:24 <lambdabot> Consider it noted.
16:24 <quchen> cocreature: ^
16:24 <cocreature> quchen: nice!
16:24 <quchen> At least you can now put it into your .cabal files.
16:24 <quchen> And have some sense of stability :-)
16:25 <quchen> I’ll put it on Stackage when I’m even more certain about everything.
16:25 <\u> monochrom: Yes! thx
16:25 <cocreature> quchen: btw, what kind of trouble am I getting myself into by using the internal Text constructor to trick prettyprinter into thinking that a text has a different width than it actually has?
16:26 <quchen> cocreature: I don’t think that might cause issues.
16:26 <cocreature> quchen: great so I can actually continue being evil and do that :)
16:26 <quchen> cocreature: The length field is just a cache of (Text.length t).
16:26 <quchen> The layouters use that to determine whether to insert line breaks etc.
16:27 <quchen> Lengthening the value is kind of like adding trailing whitespace to the Text, I guess.
16:27 <cocreature> I was wondering if the cache is ever recalculated and thereby me overwriting it could lead to inconsistencies
16:27 <cocreature> I was shortening it
16:27 sleffy joined
16:27 <quchen> Nope, it‘s only ever filled by »unsafeText«.
16:27 <quchen> At least it should! :-)
16:27 <cocreature> so far everything seems to work just like I expect it to :)
16:28 <quchen> I’d be surprised if this broke things, or did something unexpected.
16:28 <cocreature> quchen: it would be nice if you could upload docs to hackage
16:28 <quchen> Arrr. We still have to do this manually eh
16:28 <cocreature> I mean you can probably wait for the builder and if you’re lucky at some point it will generate them
16:29 <cocreature> but just uploading them with your package is more convenient for users
16:29 <EvanR> we dont even have markovs principle for hackage docs
16:31 cpennington joined
16:31 <* hackage> saltine - Cryptography that's easy to digest (NaCl/libsodium bindings). https://hackage.haskell.org/package/saltine- (amx)
16:31 <cocreature> huh, I thought saltine was dead
16:33 <amx> what gave you that impression?
16:33 wroathe joined
16:33 rickygee joined
16:33 <cocreature> amx: oh didn’t know you where here. the last time I looked, the readme mentioned that it’s an early release and it hadn’t received an update in quite some time so I thought you abandoned it. happy to see that this is not the case!
16:34 maarhart joined
16:34 primal joined
16:36 ystael joined
16:37 Gloomy joined
16:37 <quchen> cocreature: There you go. http://hackage.haskell.org/package/prettyprinter-0.1
16:37 <amx> I took over from tel end of last year and just now had some time to get a bit of work done on it. Since I'm using it in production it will stick with me for a while.
16:37 <quchen> Also: DAMN THIS IS ANNOYING
16:37 <quchen> 4 packages to go
16:38 <cocreature> quchen: the fact that you need to use cabal sandboxes and not stack or cabal new-build makes it even more annoying
16:39 <cocreature> oh have you tried to use stack? the links are broken :)
16:40 ragepandemic joined
16:40 <quchen> I’d rather gauge my eyes out than use Cabal to build this.
16:40 <cocreature> fair enough
16:40 <quchen> cabal configure -- error, package not found
16:41 moth joined
16:42 ragepanda joined
16:42 <quchen> cocreature: I’ll use the »it’s just a pre-release for you and merijn« joker ;-)
16:42 <cocreature> quchen: heh, I accept that. thank for all the work you put into this, I really find it a lot more pleasant than the other libs
16:42 <quchen> Anyway, I’m off for now. Good luck with your text hack ;-)
16:43 <quchen> And: if you give me a compelling use case for your short-text I might add it
16:43 <quchen> Unlike the other maintainers, I’m observably alive ;-)
16:43 hybrid joined
16:44 cfricke joined
16:45 Gurkenglas joined
16:46 <Rotaerk> glguy, https://ptpb.pw/jlfb/hs
16:46 <Rotaerk> particularly pointing out the stuff starting at line 105
16:47 <Rotaerk> (I'll move that partial-pipe stuff out of the TCP module eventually... probably reusable)
16:48 <glguy> ah, cool
16:49 <glguy> Rotaerk: watch out with Network.Simple.TCP, it doesn't handle connecting to things with multiple results from DNS correctly
16:50 <glguy> Rotaerk: this can cause problems connecting on systems with ipv4/ipv6
16:50 {emptyset} joined
16:50 e14 joined
16:50 <Rotaerk> hmm what do you suggest I use instead?
16:50 mtg joined
16:51 drcode joined
16:51 <Rotaerk> pipes generally exist to await input values and yield output values, all in one pipe... partialPipe allows you to do this in multiple steps, each step converting *part* of the input into output
16:52 truelean joined
16:52 <Rotaerk> and by the time each of your steps is complete, all the input should've been consumed and only output values remain
16:52 <Rotaerk> so it ends up being kind of a case-expression for pipes
16:52 <glguy> Rotaerk: My hookup package handles this and TLS and SOCKS, or you can use network package directly, I don't recommend it, but the connection package is another choice
16:52 <Rotaerk> k, thanks
16:53 <cocreature> glguy: what’s your problem with the connection package? the API seemed rather nice the last time I looked at it iirc
16:54 <glguy> cocreature: It uses the tls package
16:54 osa1_ joined
16:54 <cocreature> glguy: so?
16:54 <glguy> and has had bugs in its recv function, I don't know if they're all fixed
16:55 <cocreature> fair enough
16:55 <glguy> cocreature: I don't trust the tls package to implement TLS, there are known isues with how it validates certificates
16:55 <glguy> it pulls in a dependency on the foundation package
16:55 zzz joined
16:55 <cocreature> huh I didn’t know it had problems with certificate validation
16:56 davr0s joined
16:56 <cocreature> I guess I should look into this when I use it the next time
16:56 <Clint> still i'd take it over openssl any day
16:56 <glguy> I certainly wouldn't
16:56 <Clint> that seems evident
16:58 gestone joined
16:59 kau joined
16:59 drcode joined
17:01 xall joined
17:01 drcode joined
17:02 dewzer joined
17:02 zcourts joined
17:02 <glguy> it didn't handle timeouts as well as openssl, the underlying crypto library has a history of segfaults due to unsafePerformIO usage for passing around random number sources
17:03 lambdageek joined
17:03 <c_wraith> The problem is that tls is so complex that it should basically never be implemented.
17:04 <c_wraith> Sadly, that's not the world we live in.
17:04 <ongy> I wonder if 1.3 will make that better or worse
17:04 acarrico joined
17:07 ErinvanderVeen_ joined
17:07 osa1 joined
17:08 balor joined
17:11 wroathe joined
17:13 juanpaucar joined
17:14 primal_ joined
17:15 mizu_no_oto joined
17:15 drewbert joined
17:18 takle joined
17:19 MarioBranco joined
17:21 <cocreature> ongy: given that you can’t get away with only supporting 1.3 anytime soon, it can only get worse
17:21 descender joined
17:21 dewzer joined
17:22 <* hackage> etc - Declarative configuration spec for Haskell projects https://hackage.haskell.org/package/etc- (RomanGonzalez)
17:22 gestone joined
17:23 mizu_no_oto_work joined
17:23 primal joined
17:24 mkoenig joined
17:24 <glguy> Yeah, in the short term 1.3 adds new code paths that didn't exist before
17:25 soLucien joined
17:25 <glguy> We just need a year or 20 so we can drop 1.2 and below :)
17:26 <c_wraith> By then we'll need to support 1.8 though
17:26 <glguy> \o/
17:26 <\u> Mac OS X users, does `libtool -static -o a.a -L$dir_of_libHSbase -lHSbase-` retain all .o files of the same name (e.g. Weak__4.o Weak.o)?
17:27 eklavya joined
17:28 jerbome_ joined
17:28 Mon_Ouie joined
17:29 takle joined
17:29 leah2_ joined
17:30 <glguy> \u: here's some output for libtool -static -o a.a -L/Users/emertens/Tools/ghc-8.0.2/lib/ghc-8.0.2/base- -lHSbase- > libtool-output.txt 2>&1 and nm a.a > nm-output.txt
17:30 <glguy> https://glguy.net/libtool-output/
17:31 fnurglewitz joined
17:31 neoo joined
17:32 Wizek_ joined
17:32 meba joined
17:32 <\u> Thx! libtool does retain all object files. I am trying to implement -staticlib for non iOS/Darwin/Mac OS X...
17:33 primal_ joined
17:34 tommd joined
17:34 baldrick1 joined
17:35 <\u> Weak__4.o occurs in libHSbase- multiple times , but I cannot find an option for GNU ar to extract all of them
17:36 ystael joined
17:37 tzh joined
17:37 hybrid joined
17:38 lyxia joined
17:40 sleffy joined
17:40 lambdageek joined
17:41 armyriad joined
17:43 primal joined
17:45 cpennington joined
17:45 e14 joined
17:46 yamad joined
17:47 torgdor joined
17:51 geekg_000 joined
17:51 ragepandemic joined
17:55 bigos joined
17:58 kirelagin joined
17:58 gawen joined
18:01 wroathe joined
18:02 bennofs joined
18:03 kadoban joined
18:03 Sornaensis joined
18:04 mrkgnao joined
18:04 jaziz joined
18:06 Boarders joined
18:07 wroathe joined
18:07 teurastaja joined
18:08 cpup joined
18:10 cloudhead joined
18:12 zachk joined
18:12 zachk joined
18:13 <Boarders> If I do something like data Nat = zero | succ Nat then (roughly) there is a functor F: Type ->Type where X-> * \coprod X and the natural numbers is the largest fixed point of this functor
18:13 <Boarders> (so really is the natural numbers with infinity but whatever)
18:13 <Boarders> what if I do data Fun = val (Fun -> Fun)
18:13 <Boarders> what is the corresponding functor
18:14 <Boarders> since X--> X^X is not a functor as far as I can tell
18:14 <EvanR> data Nat = Z | S Nat has all the natural numbers, an infinite natural number, and many bottomy elements that do not correspond to any number
18:14 <* hackage> universum 0.4.2 - Custom prelude used in Serokell https://hackage.haskell.org/package/universum-0.4.2 (gromak)
18:14 davr0s joined
18:14 <zachk> EvanR, how do the nat's have many bottoms?
18:15 nullfxn joined
18:15 <EvanR> Z, S ⟂, S (S ⟂), S (S (S ⟂ ))
18:15 <Boarders> I am ignoring bottom
18:15 <Boarders> or bottom(s)
18:15 <zachk> EvanR, my unicode is broken, are you taking succ of bottom?
18:15 maerwald joined
18:15 <EvanR> yes
18:16 <EvanR> S Z, S ⟂
18:16 <EvanR> fix S
18:17 <EvanR> Boarders: Fun = Fun (Fun -> Fun) isnt the right kind
18:17 <Boarders> you are really doing list on a unit type for Nat so it makes sense you have succ _|_
18:18 <Boarders> hmm ghc doesn't complain when I write it
18:18 <EvanR> i mean for a Functor instance
18:19 <Boarders> so if I write that do I just think of it as giving me a type Fun where F \iso (Fun -> Fun)
18:19 <Boarders> err Fun \iso (Fun -> Fun)
18:19 <EvanR> it looks like the type of lambda calculus programs
18:19 <monochrom> Boarders: X ≌ X^X is a model of untyped lambda calculus.
18:19 <Boarders> yeah that is what I was trying t write
18:20 <Boarders> this is abstraction and you can add application
18:20 cretiq joined
18:20 <EvanR> you already have it
18:20 Wizek_ joined
18:20 <Boarders> have what?
18:20 <EvanR> newtype Fun = MkFun { apply :: Fun -> Fun }
18:20 MarioBranco joined
18:20 <EvanR> f `apply` g
18:21 <monochrom> It is also true that X -> X^X is not quite a functor because you have an X in the contravariant position.
18:21 teggi joined
18:21 <Boarders> I think I was just caught up on a story about data being short hand for finding terminal F-coalgebras by taking fixed points
18:22 <Boarders> and so thought it always accompanied a functor of some sort
18:22 <Boarders> but that is probably putting the cart before the horse
18:23 primal_ joined
18:24 <monochrom> That story cannot be complete. It cannot possibly cover data QuantitativeEasing = Q (QuantitativeEasing -> Money)
18:24 <Boarders> I thought that stuff was attached to a contravariant functor Type^op ->Type
18:25 MarioBranco joined
18:25 cpennington joined
18:25 <Boarders> though what the hell an F-algebra means makes it clear enough that I am being stupid
18:26 <Boarders> but yeah that all makes sense, thanks
18:26 <heath> i'm wanting more answers from the haskell community, so far i've mostly received answers from the erlang/elixir crowd
18:26 <EvanR> i know what it means i heard it enough as a university intro math assistant
18:26 <heath> if you have time and are open to responding, here are the questions: https://gist.github.com/heath/858a321b5fc96d3011d9b6ea4fca3cb9
18:27 <heath> if you think this is a pseudoscience or a wasted effort, i would love an explanation
18:27 SkyPatrol_ joined
18:27 <EvanR> heath: the difference between the erlang way and haskell is so vast...
18:28 <EvanR> its really hard to even compare
18:28 <zachk> heath have you tried cloud haskell yet?
18:28 <EvanR> i.e. "individual self contained units of logic" exists in both, and dont even remotely refer to the same thing
18:28 shangxiao joined
18:29 <EvanR> an abstract data type, properly implemented and proven, is a possibly small self contained unit of logic
18:29 <EvanR> and you dont need to keep pushing it
18:30 <EvanR> the wheels do not come off the Text type or the Queue type and require a hotcode reload
18:31 <* hackage> VKHS 1.7.3 - Provides access to Vkontakte social network via public API https://hackage.haskell.org/package/VKHS-1.7.3 (SergeyMironov)
18:31 takle joined
18:31 <heath> zachk: indeed i have. one could start comparing runtimes once you start comparing CH and erlang, but i'm not wanting to go there right now. neither system is perfect in reality
18:32 <heath> the point of this is that i don't hear many haskell folk talking about this sort of thing, and i was hoping to gather a few responses
18:32 <EvanR> CH is not really a thing whereas erlang installations have been for a while
18:32 tromp joined
18:32 <EvanR> its a big experiment
18:32 <zachk> I tried elixir the other year, it was decent, debugging my code turned into me peppering it with print statements, and it was basically a "type" error in one of the messages being passed
18:33 <heath> i refer to the comparison as "a proven runtime vs provable types" :)
18:33 TheFuzzball joined
18:33 <heath> i've been reminded this isn't entirely accurate since haskell is used in production as well
18:33 <EvanR> heath: in my current project im making a lot of use of the tree of processes and retrying, using async.
18:33 <EvanR> im a lot more comfortable doing that with types than without
18:34 BlueRavenGT joined
18:34 Wizek joined
18:35 <monochrom> There is going to be a self-selection phenomenon. Erlang people will tell you "I don't need types" and Haskell people will tell you "I need types". Consider why someone became an Erlang people or a Haskell people in the first place.
18:35 rkazak joined
18:35 venkat24 joined
18:35 <EvanR> heath: check it out... high score saving may seem to fail, but while the game continues normally, tries to recover functionality goo.gl/AWux0wcontent_copyCopy short URL
18:36 <EvanR> goo.gl/AWux0wcontent_copyCopy short URL
18:36 <EvanR> wtf
18:36 <EvanR> https://goo.gl/AWux0w
18:36 <monochrom> I am certainly one of those who looked at Prolog and then looked at Haskell and settled with Haskell on the slight pretext of "but I want types".
18:37 <EvanR> heath: the code each component of this thing is in a separate module
18:37 ystael joined
18:38 marvin2 joined
18:38 torgdor joined
18:38 <EvanR> since youve been asking the same question for days, i feel like youre not going to get anywhere unless you try haskell
18:39 <zachk> EvanR, are you using CH?
18:39 <EvanR> you can always bring the sort of reasoning that makes your haskell code work back to erlang and elixir, where you need it even more since lack of type checking
18:39 <EvanR> zachk: no
18:42 <heath> EvanR: i am using haskell :)
18:43 <EvanR> sweet preaching to the choir
18:44 <monochrom> It is still fair to ask other people "what do you do for reliability".
18:44 <int-e> what's that CH thing?
18:44 <monochrom> The problem is do they all agree on what it means?
18:44 <EvanR> cloud haskell, sorry for abbrieviating it gratuitously
18:45 <heath> that's true, nancy goes into the definitions in https://mitpress.mit.edu/books/engineering-safer-world and why, even, she looked back to methods from ww2
18:45 <int-e> (I *think* earlier CH stood for Curry-Howard... google would probably suggest Switzerland. Hence the question.)
18:45 <EvanR> continous hypothesis
18:45 <EvanR> er... continuum hypothesis
18:46 yellowj joined
18:46 irco joined
18:49 torgdor joined
18:49 <heath> thanks for responding. i won't continue asking for feedback (i'm always open to discussing it though)
18:52 ErinvanderVeen_ joined
18:52 MarioBranco joined
18:52 zero_byte joined
18:54 wroathe joined
18:54 CoderPuppy joined
18:55 codygman_ joined
18:55 Jesin joined
18:59 <heath> EvanR: what are some reasons saving high scores fail in that particular project?
19:00 sellout- joined
19:00 <heath> (ignore grammatical blunder please)
19:01 <* hackage> mywatch 0.3.0 - Web application to view and kill MySQL queries https://hackage.haskell.org/package/mywatch-0.3.0 (ip1981)
19:02 davr0s joined
19:03 <zachk> heath: it looks like it doesn't have permission yet to write to the file, probably the file is still opened from something else
19:03 primal joined
19:04 <* hackage> shade - A control structure used to combine heterogenous types with delayed effects. https://hackage.haskell.org/package/shade- (fredefox)
19:05 <heath> int-e: CH == cloud haskell
19:06 test joined
19:06 <test>
19:06 <test> http://breachforums.com/
19:06 <Guest5481> hi
19:06 <Guest5481> http://breachforums.com/
19:07 ErinvanderVeen_ joined
19:08 connrs joined
19:09 <nshepperd> instance Applicative (State Endo s) where { mempty = Strict.unsafeHex }
19:09 sepp2k joined
19:09 <nshepperd> ^^ haskell written by a neural network :)
19:09 <jle`> looks like something i just wrote
19:09 <jle`> which makes sense, since i myself am a neural net
19:10 <heath> nshepperd: nice
19:11 buglebudabey joined
19:11 pie_ joined
19:12 <nshepperd> i think my library needs a function called unsafeHex
19:13 <dmj`> /msg jle` you see that ghcjs comment
19:13 primal_ joined
19:13 <jle`> i did :o
19:14 <jle`> it seems like it's compiling now, i just needed to stack clean
19:14 <jle`> ;_;
19:14 <dmj`> woops :o
19:14 <jle`> not sure what happened
19:14 <dmj`> pm fail
19:14 <dmj`> ah, nice
19:14 bendo joined
19:16 Welkin joined
19:16 meba joined
19:19 Uncripted joined
19:20 <Uncripted> Hello
19:22 <zachk> Uncripted, hello
19:22 <lambdabot> Hello.
19:22 <hpc> bwuh?
19:22 cpup joined
19:23 CoderPuppy joined
19:24 <Uncripted> New to IRC. Just trying out some channels.
19:25 <lyxia> lambdabot... speaks?
19:25 dewzer joined
19:26 ystael joined
19:28 takle joined
19:28 nomotif joined
19:29 jerbome_ joined
19:29 Uncripted joined
19:30 <buglebudabey> if i want to store a pretty large adjacency table / tables, what structure would be appropriate to store it in?
19:31 <cocreature> kuribas: sparse or dense?
19:31 <Athas> buglebudabey: if sparse, then a set.
19:31 <buglebudabey> Athas how does that work with it being multidimensional and all
19:32 <Athas> buglebudabey: the set element type can be an arbitrary type that is an instance of Ord.
19:32 <buglebudabey> So would I have a list of sets representing a particular node's set of neighbors, or a set of sets?
19:32 <buglebudabey> Athas ^
19:32 <jle`> you can store a set of tuples
19:33 <jle`> or a map of lists
19:33 <buglebudabey> set of tuples seems like a good option
19:33 <jle`> it does really depend on the things you want to do with it too of course
19:33 jimmyrcom_ joined
19:34 ult joined
19:34 <buglebudabey> jle` it's to compile a local set of wikipedia articles and the pages they refer to within a few degrees of separation
19:35 <buglebudabey> like the first 2 level of all pages 'Haskell' links to
19:35 <jle`> i might do a map of lists then maybe
19:35 <buglebudabey> what's the reason behind that?
19:35 <jle`> since given an origin article, you can look up all of the ones it links to at the same time
19:36 <jle`> for a set of tuples, you'd have to filter the set
19:36 <jle`> and traverse the set's structure
19:36 <kuribas> cocreature: ?
19:36 <cocreature> kuribas: eh sorry wrong nick
19:36 <kuribas> np :)
19:36 <buglebudabey> jle` is that still good for if I wanted to do a page-rank sort of algorithm where i find articles based on how many link to it?
19:37 SkyPatrol joined
19:37 <jle`> hm, not sure exactly. is page-rank an eigenvalue problem?
19:38 <jle`> i know it'd be much easier to "square" the map-of-lists adjacency matrix
19:38 <buglebudabey> jle` i haven't looked into yet to be honest although i do know it uses some linear algebra
19:38 <jle`> it'd probably be much faster to square :: Map k [k] -> Map k [k], than Set (k,k) -> Set (k,k)
19:39 <buglebudabey> noted
19:39 tromp joined
19:39 <buglebudabey> and k can be an Id :: Int with no problem right, and I can look up the article based on the id
19:39 <buglebudabey> would that lookup also be good as a map or as a set
19:40 <buglebudabey> jle` ^
19:40 <jle`> yeah, if you have k ~ Int, you can also use IntMap for some optimized implementations
19:40 takle joined
19:40 <buglebudabey> sweet, thank you
19:41 TheFuzzball joined
19:41 <jle`> np
19:41 <buglebudabey> jle` does intmap only work for Map Int Int or could I use it for the Map Int [Int] as well?
19:42 <nshepperd_> Page rank is an eigenvalue thing, yeah. It's a fixed point of everyone's​ reputation being proportional to the total reputation of things that link to them. Something like that
19:42 codesoup joined
19:42 <jle`> buglebudabey: you can use IntMap [Int]
19:42 <buglebudabey> sweet
19:42 <buglebudabey> yeah gotta look more into page rank
19:43 dan_f joined
19:43 <Tuplanolla> Why not `IntMap IntSet`?
19:43 eacameron joined
19:43 <buglebudabey> it could be too complicated for something like this
19:43 <jle`> hm yeah, a map of sets makes more sense
19:43 <jle`> buglebudabey: it'd actually be much simpler
19:44 primal joined
19:44 <jle`> since squaring a Map k [k] you'd have to be careful to preserve uniqueness
19:44 <jle`> but not for Map k (Set k)
19:44 robotroll joined
19:44 egis joined
19:44 <buglebudabey> very cool, i would have taken a while to figure that out on my own
19:44 <buglebudabey> thanks guys
19:45 <jle`> np
19:45 <jle`> if you want to do pagerank, you also have to assign a weight to each edge, though
19:45 <jle`> so you might end up doing `IntMap (IntMap Double)`, heh
19:46 juanpaucar joined
19:46 <buglebudabey> jle` is the double for squaring or something?
19:46 Discovery joined
19:46 <jle`> not sure how ideal that is for performance though for the operations pagerank requires
19:47 <jle`> the double is for the weight of each edge
19:47 <buglebudabey> ah ok
19:50 monadicDuck joined
19:51 <zachk> buglebudabey, I am currently starting to work/think on a similar project, and I am going to go with a graph database like neo4j most likely
19:51 <zachk> though orientDB is 10x faster in some benchmarks
19:51 Scip_ joined
19:51 darjeeli1 joined
19:52 <buglebudabey> zachk interesting, if I wanted to look for libraries like that myself, would graph database be the way to search for it? also i'm guessing those are haskell packages right
19:52 <monadicDuck> has anyone built an RNN in haskell that wouldn't mind sharing their repo link :)
19:53 <zachk> no they are databases like mysql or oracle, but optimized for storing graph's natively, they have their own modified sql like query languages usually
19:53 <AWizzArd> How quickly would an experienced Haskeller know what (fmap . fmap) sum Just [10, 20, 30] returns, without using a computer?
19:54 <zachk> though supposedly you can put apache tinkerpop over most of them and talk to them with something called gremlin
19:54 primal_ joined
19:54 <zachk> haskell has neo4j and gremlin api bindings in hackage
19:54 <Tuplanolla> It's a bit tricky due to the `(a ->)` instance, AWizzArd.
19:54 <zachk> neo4j's query language is something called cypher, and it seems pretty interesting so far
19:54 <jle`> monadicDuck: there's grenade
19:54 <jle`> and i've made a few
19:54 <jle`> AWizzArd: well, it probably wouldn't take too long
19:55 <jle`> AWizzArd: but they would still get angry if they saw it used in a codebase
19:55 <jle`> since it's basically obfuscated code
19:55 <buglebudabey> zachk ah ok, what's the support like for orientDB?
19:55 <jle`> de-obfuscating code can be a mechanical process if you're familiar with the mechanics
19:55 <zachk> no idea, I have mostly been focusing on neo4j
19:55 <buglebudabey> zachk and would performing operations on the graph for page rank be easy with something like neo4j
19:56 <AWizzArd> jle`: how would you parse this, without the help of a repl?
19:56 <jle`> AWizzArd: the same way you parse anything else in haskell
19:56 <jle`> by expanding the definitions
19:56 <AWizzArd> I can’t look at it and say „Ah of course, it’s clear whats going on here”.
19:56 <zachk> I was just looking that up and it looks like you need to use something outside of most graph databases to do that
19:56 <jle`> AWizzArd: it isn't immediately clear to anyone
19:56 <jle`> even most experienced haskellers would have to think about it
19:56 <AWizzArd> k
19:57 <jle`> that doesn't mean it's not interpretable at a mechanical level
19:57 <AWizzArd> Sure.
19:57 <jle`> you have the definition for (.)
19:57 <buglebudabey> zachk like source from the database and read into the data types we discussed above, perform the ops, then push the results back in?
19:57 <jle`> @src (.)
19:57 <lambdabot> (f . g) x = f (g x)
19:57 <zachk> I just looked at pagerank and I dont totally comprehend it for the time being, or how you would specialize it to certain words or phrases
19:57 <lyxia> AWizzArd: (fmap . fmap) sum Just [] = fmap (fmap sum) Just [] = (fmap sum . Just) [] = fmap sum (Just []) = Just (sum [])
19:58 <buglebudabey> zachk alright, fair enough
19:58 <zachk> buglebudabey, with neo4j I think you can get backlinks really easy and just calculate from those results in your language
19:58 <jle`> AWizzArd: it's pretty much like reading obfuscated code in any other language. it's designed to be unintelligble at an immediate level
19:58 <AWizzArd> lyxia: why is this true? fmap (fmap sum) Just [] = (fmap sum . Just) []
19:58 wroathe joined
19:58 <buglebudabey> zachk ok i'll look more into it and see what makes sense
19:58 <lyxia> AWizzArd: because we're using the instance Functor ((->) a)
19:58 <buglebudabey> zachk thanks
19:58 <jle`> AWizzArd: fmap f g = f . g
19:59 <jle`> if g is a function type
19:59 <jle`> which Just is
19:59 <zachk> neo4j has a local web interface and tutorials built into its web interface
19:59 <jle`> so fmap blahblah Just = blahblah . Just
19:59 <AWizzArd> Yes okay, Just is also an ordinary function.
20:00 <zachk> buglebudabey, what I am thinking of doing is downloading the relevant pages for ranking searcching to a local cache first, then parsing them and then putting the relative data into a graph database
20:00 <jle`> depends on what you define as 'ordinary', but sure
20:00 <jle`> what else would it be? :)
20:00 <AWizzArd> I too easily forget about data constructors being functions like you and me.
20:00 fragamus joined
20:00 <AWizzArd> Yes yes, you are right. Thx jle` and lyxia.
20:00 <lyxia> "functions like you and me"?
20:00 <buglebudabey> zachk that does sound pretty similiar, so you wanna keep the page data locally?
20:01 <AWizzArd> lyxia: ;-)
20:01 <* geekosaur> took that homiletically
20:01 <EvanR> but not the other way around...
20:01 <EvanR> functions are not made of constructors
20:01 <glguy> data constructors aren't necessarily functions, only the ones that are functions are
20:01 <AWizzArd> Yes.
20:01 <EvanR> :t False
20:01 <lambdabot> Bool
20:02 cpennington joined
20:03 <jle`> the lesson is that the only prerequisite for something being a function is that it has to be a function
20:04 <jle`> its type is made with an application of (->) :)
20:04 <zachk> buglebudabey, well google keeps a cache of most of the world wide web and parses and analyzes offline, so I think local caching of pages for processing seems like a meritable idea
20:04 <buglebudabey> i'm more of an altavista man myself
20:06 plakband joined
20:08 jgt joined
20:08 yamad joined
20:11 eacameron joined
20:12 gestone joined
20:12 zariuq joined
20:13 takle joined
20:18 simon` joined
20:19 wroathe joined
20:19 <simon`> When I just need a simple String to String map, should I rather use Data.Map.Strict or Data.Map.Lazy?
20:19 <hpc> use Data.Map until you care one way or the other
20:20 <simon`> ok!
20:20 RouxTheDay joined
20:22 <EvanR> people seem to prefer HashMap for string to foo mapping
20:22 eacameron joined
20:22 <EvanR> a strict map of any kind wont do much on String
20:22 <EvanR> since its a list of characters and that will just evaluate the first letter
20:23 <EvanR> talking about the values in the map
20:24 <simon`> EvanR: Sure, I know. That's why I asked what is "best practice" in that case
20:24 teurastaja joined
20:24 Chai-T-Rex joined
20:25 cretiq joined
20:25 <EvanR> to get an approximation of a java script object of strings, use Data.HashMap.Strict and not String as the value
20:26 <EvanR> probably Text
20:26 <Welkin> I have a suspicion that the tendency for people to prematurely optimize their code comes from the terrible way in which programming is taught in schools
20:26 <simon`> It was not meant be an "optimization question"
20:26 <EvanR> alternative best practice, do not care at all and use Map + String
20:27 <Welkin> I've used String with parsec and never had an issue :P
20:27 henriksod1 joined
20:27 <Welkin> to parse huge files
20:27 <EvanR> i have had issue with String and "huge" (1M) files "parsing" manually with splits etc
20:28 <EvanR> stack overflows
20:28 <simon`> Good to know, as I am currently writing a megaparsec parser for potentially > 50 MB files
20:28 <Welkin> the files were 12-20 mb
20:29 <Welkin> this was with parsec though, not my own handrolled parsing
20:29 <Welkin> no issues at all
20:29 <Lokathor> EvanR, good thing that IRC is usually 512 bytes or less per message frame! lets you do all the manual parsing you want :P
20:29 <EvanR> yeah!
20:30 asm_ joined
20:30 <EvanR> as long as you consume String data incrementally it works
20:30 <monochrom> [Char] is huge. Expect 24 bytes per character.
20:30 jerbome_ joined
20:31 ChaiTeaRex joined
20:31 <EvanR> is haskelll the only game in town with list strings...
20:31 tristanp joined
20:31 <monochrom> This is why some people choose 32-bit GHC on 512MB rented virtual machines, even if the virtual machine can do 64. Because it is then just 12 bytes per character.
20:31 <hpc> maybe a lisp or two?
20:32 <monochrom> Lisps probably have native string types.
20:32 <[exa]> yup
20:32 <monochrom> I mean rather than "oh just re-use cons lists"
20:32 <hpc> haskell might be the only game in town to get even a slight benefit from list strings
20:32 wroathe joined
20:32 <hpc> yeah, it'd be a toy lisp if anything
20:34 primal joined
20:34 <EvanR> yay haskell: toy technology
20:35 <lyxia> all so we can do fix show
20:35 <* EvanR> goes back in time and renames Text to String and String to [Char] not in that order
20:36 <monochrom> To be fair, Haskell compilers honed implementation of lazy evaluation really well, not toy at all.
20:36 <monochrom> Also on the frontier of GC.
20:37 <EvanR> i kind of cant get over the 24B thing
20:37 ErinvanderVeen_ joined
20:37 <EvanR> a unicode char is less than 3 bytes
20:37 coot____ joined
20:38 <jle`> good thing people don't use [Char] for storing text
20:39 <simon`> Is there a way to show the memory "footprint" of a certain list in ghci?
20:39 <simon`> *any other data structure for that matter
20:39 <EvanR> theres GHC.Vacuum
20:40 <EvanR> and EKG
20:40 <mniip> hmmm
20:40 <mniip> there are monads in End(Hask) :o
20:41 <EvanR> vacuumLazy :: a -> IntMap HNode
20:41 <EvanR> doesn't force anything
20:41 acertain joined
20:42 <mniip> IdentityT and ReaderT
20:42 <EvanR> dont see an easy "size" function
20:42 <mniip> hmm
20:42 <simon`> Hm, might take a look at your proposels if I have time
20:43 <simon`> I am not really familiar with anything that happens behind the scenes with Haskell and that does bother me a little
20:43 <EvanR> hehe
20:43 <mniip> data MonadT m f a = MonadT (m (f a))
20:43 <mniip> instacnce Monad m => Monad (MonadT m)
20:44 primal_ joined
20:44 <simon`> It's a beautiful language but I do miss C in this respect occasionally
20:44 <EvanR> haskell code runs on a highly optimized and bug free platform of denotational semantics that is all that matters. and you have infinite memory
20:45 rcschm joined
20:45 <EvanR> you can use inline-c ! ;)
20:45 <simon`> Well I would doubt the infinite memory part
20:45 <simon`> ^^
20:45 <mniip> use infinite memory in C with this one simple trick!
20:46 Big_G joined
20:46 <jle`> mniip: . o O ( type MonadT = Compose )
20:46 yamad_ joined
20:46 <mniip> jle`, good point
20:47 ErinvanderVeen joined
20:48 mizu_no_oto joined
20:48 hexfive joined
20:48 Herbstkind joined
20:49 buttbutter joined
20:51 ondrejs joined
20:52 <ondrejs> hi, I want to tell if a filepath leads to a file (or a dir.), the https://www.stackage.org/package/system-fileio package has `isFile` function but the package is deprecated. Is there some replacement for this or what's the standard way to solve this? Thanks
20:53 <ondrejs> system.directory has doesFileExist but that checks more than I want...
20:54 primal joined
20:54 cpup joined
20:54 CoderPuppy joined
20:55 juanpaucar joined
20:57 wroathe joined
20:59 <ondrejs> ok I will settle for doesFileExist
21:00 <verement> ondrejs: Any check you do could be invalid by the time you act on it. Couldn't you assume the filepath is indeed a file, and handle any resulting error if it isn't?
21:01 <EvanR> if you just want to poll and get a Bool back, doesFileExist
21:01 <ondrejs> verement: good point, but I don't think that will happen in my use case so I'll stick with what I have
21:02 moet joined
21:02 <EvanR> anything more and you want a brackety thing that tries to use the file for something, but catches the does not exist (or similar) exceptions
21:02 <EvanR> the latter can implement the former
21:05 primal_ joined
21:07 e14 joined
21:07 <ondrejs> EvanR: understood, thank you.
21:07 zariuq joined
21:07 jordan335 joined
21:07 <jordan335> https://ideone.com/0NYbZI
21:07 <jordan335> can anyone explain me why this doesnt work in line 15
21:08 <lyxia> NKnoten is applied to three arguments, it accepts only two.
21:09 <jordan335> this is suppossed to be a tree
21:09 cpennington joined
21:09 <jordan335> "sonne" is at the top and points to two things: "merkur" and "venus"
21:09 <int-e> please, use spaces... but [...] [...] is two lists, not a single list with two elements
21:10 <jordan335> oh its all in a list
21:10 <jordan335> NKnoten "Sonne"[NBlatt "Merkur", NBlatt "Venus"]
21:10 <jordan335> this should work then?
21:10 <int-e> Node "sun" [Leaf "mercury", Leaf "venus"]
21:10 <int-e> so, yes.
21:10 <jordan335> awesome
21:11 <jordan335> thanks a lot
21:11 <jordan335> do u recognize the language btw?
21:11 <lyxia> German?
21:11 <jordan335> dont answer haskell please
21:11 <jordan335> yes haha ^
21:12 fragamus joined
21:12 <hpc> i guess it could technically be a number of ML-family languages
21:14 tristanp joined
21:17 meba joined
21:22 tromp joined
21:24 jud joined
21:28 mkoenig joined
21:28 prophile joined
21:29 yamad_ joined
21:30 robotroll joined
21:30 quobo joined
21:30 yobohohoz joined
21:31 cpup joined
21:31 CoderPuppy joined
21:31 <simon`> Is there a Hashmap that preserves order?
21:31 Princess17b29a joined
21:31 tristanp joined
21:32 <kuribas> no
21:32 <EvanR> order of what?
21:33 <* hackage> debug-me 1.20170510 - secure remote debugging https://hackage.haskell.org/package/debug-me-1.20170510 (JoeyHess)
21:33 <kuribas> simon`: if you need order use a normal Map.
21:33 mtg joined
21:33 <EvanR> Map will keep order of keys, in terms of the ordering on keys
21:33 <EvanR> theres a package here, insert-ordered-containers which keeps order based on which order you inserted things in
21:34 acyed joined
21:34 <EvanR> which is more like how PHP works
21:34 <kuribas> EvanR: so a stack or deque?
21:34 <EvanR> well, with fast lookup
21:35 anuxivm joined
21:36 <kuribas> why would you need that?
21:36 <simon`> Yes, I need to preserve the order things got inserted into the Map
21:36 <simon`> *that
21:37 <geekosaur> there's also psqueues and such
21:37 <EvanR> its certainly a non typical requiremnt
21:38 <EvanR> and a source of bugs when people assume thats how it works
21:38 <simon`> I want to parse chess PGN files and I am looking for a suitable data structure for the tag pair section
21:38 <jordan335> https://ideone.com/yb39Vn
21:38 <jordan335> i want to make a function that convert one data type into the other
21:38 <jordan335> converts*
21:38 <jordan335> is pattern matching the way to go?
21:39 <simon`> Maybe a list of tuples would also suffice actually
21:39 tristanp joined
21:40 <kuribas> simon`: you could create a vector of pgn files, then a map (Map ke Index), mapping from key into an index into the vector.
21:41 <kuribas> if the order of the chess games is important.
21:41 <EvanR> you can prepend an ordering number to the key itself
21:42 <kuribas> simon`: or simply have a Int field in the Pgn datatype describing the order.
21:42 <EvanR> (i, k) is the new key, but could get tedious
21:42 bennofs joined
21:42 <kuribas> yes, having the position in the datatype is cleaner.
21:43 moth joined
21:43 <kuribas> jordan335: sure
21:43 <jordan335> how would i start doing that?
21:43 <EvanR> having a separate index of what the order is, is something a new data structure should take care of for you
21:43 <jordan335> i dont have much experience with pattern matching
21:44 <kuribas> btreentree (BBlatt val) = ...; btreentree tree1 bm1 tree2 = ...;
21:45 <kuribas> to quick...
21:45 <kuribas> btreentree (BBlatt val) = ...; btreentree (BKnoten tree1 bm1 tree2) = ...;
21:46 <kuribas> jordan335: then reconstruct the second tree.
21:46 <simon`> Maybe I am just sticking with a list of tuples since the tag pair section of a game will hardy ever consist of more than 10 elements
21:46 saussure joined
21:46 <EvanR> oh jeez... then yes use a list
21:46 <buglebudabey> what's a good library for making api calls?
21:46 <simon`> Is there a predefined lookup function for tuple lists?
21:46 <EvanR> :t lookup
21:46 <lambdabot> Eq a => a -> [(a, b)] -> Maybe b
21:47 cyborg-one joined
21:47 <simon`> Oh, perfect!
21:47 <kuribas> simon`: why not create a proper haskell datatype?
21:48 <kuribas> http://hackage.haskell.org/package/chesshs-0.2.1/docs/Chess-PGN.html
21:48 <simon`> kuribas: the library does not follow the spec
21:49 <kuribas> update it?
21:49 <simon`> for various reasons
21:49 <jordan335> kuribas im not sure what to do with that
21:50 <kuribas> jordan335: you need to fill in ...
21:50 Goplat joined
21:50 <simon`> kuribas: How would "updating" work with haskell packages
21:51 <simon`> Just send a new proposel to the maintainer?
21:51 <kuribas> yes
21:51 <* hackage> jenkinsPlugins2nix - Generate nix for Jenkins plugins. https://hackage.haskell.org/package/jenkinsPlugins2nix- (MateuszKowalczyk)
21:51 <kuribas> simon`: download the source, make improvements, contact the author.
21:52 fotonzade joined
21:52 <kuribas> simon`: if you think it's worth improving, rather than beginning from scratch.
21:52 <simon`> I think I rather write my own library
21:52 bjz joined
21:52 <simon`> there is not much to the existing one
21:52 hiratara joined
21:53 <simon`> plus I wrote most of the parser with megaparsec instead of attoparsec already
21:53 pranitbauva1997 joined
21:53 charliekilo joined
21:54 <jordan335> https://ideone.com/OPaAA9
21:54 <jordan335> kuribas
21:54 <jordan335> somehow this doesnt work
21:55 <jordan335> Not in scope: data constructor ‘BBaum’
21:55 <kuribas> jordan335: BBaum is a type, not a contructor.
21:56 <kuribas> you can only match against BBlatt or BKnoten
21:56 <monochrom> Or just use a variable because you are not checking anyway.
21:57 <monochrom> Also [Int] and [5] mean very different things.
21:57 <geekosaur> they're extracting the thing under the constructor --- which won't work (what if the BBaum c is a BBlatt c?
21:57 <monochrom> Namely, [Int] does not say "length is 1", but [5] does.
21:58 <jordan335> hm
21:58 Trendrrr joined
21:59 <jordan335> line 9 is correct though?
21:59 juanpaucar joined
21:59 louispan joined
22:00 ixian joined
22:01 primal joined
22:01 Velociraptor1 joined
22:01 <kuribas> simon`: great, that sounds very useful.
22:02 tromp joined
22:02 <kuribas> simon`: if you use Map instead of hashmap you can do interesting things like looking up all games less than a key, or between two keys, etc...
22:03 calloc joined
22:03 <kuribas> simon`: if they have a proper Ord instance of course.
22:06 Trendrrr joined
22:06 <* hackage> xml-conduit 1.5.1 - Pure-Haskell utilities for dealing with XML with the conduit package. https://hackage.haskell.org/package/xml-conduit-1.5.1 (koral)
22:06 Uncripted joined
22:11 Trendrrr joined
22:11 hackebeilchen joined
22:12 FreeBirdLjj joined
22:12 quchen joined
22:12 dm3 joined
22:13 gestone joined
22:14 primal_ joined
22:15 begriffs joined
22:15 louispan joined
22:16 <simon`> kuribas: I think I will not use haskell for a large collection of games
22:16 <kuribas> why not?
22:16 <simon`> I want all games to potentially fit into memory
22:16 <simon`> which might potentially be ~8 Mio
22:17 <simon`> So I am thinking of writing my own database format in C
22:17 <simon`> and to have some sort of tree structure with information packed into the least possible amount of bytes for each game
22:17 <ab9rf> i don't see why you'd prefer C to Haskell in that context
22:18 <simon`> Hm, I am not enough of an expert in Haskell as to know how to have precise control over every bit I am using for a datastructure
22:18 TheFuzzball joined
22:18 <ab9rf> why do you need precise control over every bit?
22:19 <ab9rf> are you prematurely optimizing?
22:19 <simon`> If you want to fit >10 Mio Chess games into memory I wouldn't call opimizatino prematurely
22:20 <simon`> My server has 4GB Ram
22:20 <kuribas> use a proper database?
22:20 <kuribas> sqlite or mysql for example?
22:20 <ab9rf> or come up with a means to characterize them that uses less memory
22:21 <simon`> I don't think they will be very useful for chess games
22:21 <ab9rf> i don't see why notr
22:21 <simon`> I want the database to allow for efficient prefix checking of move sequences as a major requirement
22:21 <ab9rf> what's a mio chess game?
22:21 <ab9rf> isn't that just a matter of storing the move sequence?
22:21 <jordan335> https://ideone.com/v79sDL
22:21 <kuribas> ab9rf: I think he means million
22:21 <jordan335> kuribas this doesnt work either : /
22:22 <ab9rf> any sensible database eingine can
22:22 <ab9rf> do prefix matching
22:22 <monochrom> I think you phrased your concern on the wrong foot. Your wording was "control", but what you meant is careful accounting and informed decision.
22:22 <ab9rf> i can represent nearly any chess game in under a kilobyte
22:22 <simon`> million
22:22 <ab9rf> given that, 8 million chess games is well less than 8 gigabytes
22:22 <kuribas> jordan335: BKnoten isn't a constructor for NBaum
22:23 <ab9rf> don't really see the issue
22:23 <ab9rf> that's a tiny amoutn of data for any reasonable database engine
22:24 <kuribas> simon`: what's the goal, looking up moves?
22:24 <zachk> if you are storing the chess games as [Char] in haskell in memory (from earlier) each Chat is from 12 to 24 bytes
22:24 <zachk> so that might increase your size a bit
22:24 <kuribas> you can use bytestring as binary data
22:24 <ab9rf> the base representation i'd likely use is osmething like [ChessMove]
22:25 <ab9rf> where chessmove was an ADT that described every possible move
22:25 <ab9rf> there aren't that many possible moves
22:25 <simon`> The major goal is to efficiently insert a new game which might potentially be in the database in a slightly different form
22:25 <simon`> e.g. have one move less but otherwise the same
22:26 <kuribas> simon`: I am not sure what you goal is?
22:26 <ab9rf> that's trivial
22:26 <ab9rf> just serialize the moves and do a prefix match
22:26 <jordan335> i fixed it and it still doesnt work
22:26 <kuribas> simon`: do you want to match positions?
22:26 <simon`> The database engine would need to be able to quickly present me with a list of possible duplicates
22:26 <ab9rf> if you use a SQL database and index the "move" field, that's a constrained index seek
22:26 TheFuzzball joined
22:27 <kuribas> simon`: duplicate games?
22:27 <simon`> I also want to be able to search for games with a specific position
22:27 <ab9rf> simon`: you can characterize psotions into a single (largish) integer
22:27 <ab9rf> or a character string of 64 characters
22:27 <simon`> and with a certain set of positions (e.g. all 5 pawn endgames or similar)
22:28 <kuribas> simon`: in the worst case you can always "pack" into a Bytestring.
22:28 <kuribas> simon`: you don't need C for that.
22:29 takuan joined
22:29 <ab9rf> dpm
22:29 <kuribas> for example: https://hackage.haskell.org/package/binary
22:29 <ab9rf> don't obsess on representation
22:29 <simon`> If I am mostly dealing with bytestrings I might aswell make the database a standalone C-application I thought
22:29 <ab9rf> get the data structure first, figure out its in-memory and persisted representations later
22:31 <simon`> And use Haskell for Parsing and an abstraction layer to the database
22:31 hiratara joined
22:31 wroathe joined
22:31 orion joined
22:31 orion joined
22:32 jerbome_ joined
22:32 <ab9rf> i've found haskell especially effective for doing ETL
22:33 <kuribas> simon`: an on-file database will also work when the database doesn't fit into memory.
22:34 eacameron joined
22:34 <simon`> Sure, but a major requirement for me is speed
22:34 <kuribas> Aren't modern databases pretty quick?
22:34 <simon`> I already hate my chess program for being so slow with databases at times
22:34 <simon`> I want to be better in this respect :)
22:34 <kuribas> it's probably implemented inefficiently.
22:34 <kuribas> maybe doing linear search.
22:35 <simon`> Hm, not all chess databases it seems
22:35 <simon`> The most common chess database format is closed source unfortunately
22:35 takle joined
22:35 juanpaucar joined
22:36 <simon`> And I thought it would be a good exercise to see if I can make a better one
22:36 <kuribas> Of course loading a large png library from file into memory and indexing is going to take a long time.
22:36 <simon`> Yeah, that'd be stupid
22:36 <simon`> You need a smart representation
22:36 <monochrom> No wait, that's a great idea! To "parse" a chess board from picture... :)
22:37 <ab9rf> simon`: if you're having speed issues, it's not because of the datbase engine itself, but how you're using it
22:37 <simon`> ^^
22:37 Trendrrr joined
22:37 <simon`> How do you know?
22:37 <ab9rf> because i've been a database administrator since 1986
22:37 <simon`> A chess database admin?
22:38 <jordan335> kuribas i dont make progress
22:38 <monochrom> Supposedly one can pull a "but the status quo is wrong" on this :)
22:38 <ab9rf> i've never actually dealt with a chess database, but that barely matters
22:38 <ab9rf> monochrom: oh, possibly. a lot of apps are stupidly written.
22:38 <ab9rf> datas are datas
22:39 coot____ joined
22:39 <ab9rf> most likely your slowness is due to not creating column indices, or using queries that cannot benefit from indices.
22:39 <kuribas> simon`: I used scid, and it was pretty fast (that's 15 years ago or so).
22:39 <kuribas> simon`: http://scid.sourceforge.net/
22:39 <simon`> I am studying physics, so I might be missing on some database theory. But I thought the database design should be optimized for the specific ways I want to retreive data from it.
22:40 <simon`> Yeah, using scid too
22:40 <simon`> If you use a standard scid database as an opening tree, it's pretty slow for example
22:41 <ab9rf> also, scid doesn't appear to be closed source to me
22:41 <simon`> scid is open
22:41 <simon`> But chessbase cbv is by far the most popular
22:41 <simon`> which is closed source
22:42 kadoban joined
22:42 <simon`> afaik
22:42 <ab9rf> i don' tknow what's computationally necessary to "use a standard scid database as an opening tree" and so i can't advise on how to optimize the database
22:44 <simon`> I will have to figure that out
22:44 iomonad joined
22:44 <simon`> Just thought C might be the better tool for it
22:44 systadmin joined
22:44 <ab9rf> not particularly
22:45 <kuribas> simon`: it will give you a few linear improvements, but those are usually insignificant.
22:45 <ab9rf> you need precomputed indices that allow you to narrow your search set when you do searches so you don't have to spool your entire database
22:45 <kuribas> simon`: and linear improvement in memory or speed, not programming time, program complexity, safety, etc...
22:46 <ab9rf> so this comes down to coming up with ways to characterize games or positions with summary characterizations that can then be organized in a search tree that can be traversed much faster than the primary data set
22:46 hanna joined
22:46 <simon`> It's hard to judge for me, as I am not experienced enough in Haskell to know how big the overhead will be
22:46 <ab9rf> i don't know what sorts of searches you want to be able to do Especially Quickly, and so i can't advise on how to do those characterizations
22:46 <ab9rf> this has Almost Nothing to do with haskell
22:47 <jordan335> i did it finally
22:47 <ab9rf> it has to do with avoiding linear scans
22:47 <simon`> ab9rf: do you have a book recommendation on general database design?
22:47 <ab9rf> simon`: nope
22:47 <kuribas> simon`: heh, I did a few hackerrank problems in haskell, and it was maybe in 2x the speed of a C implementation. But an unoptimized C implementation would be 1000x slower or so.
22:47 <ab9rf> simon`: i've been doing this for 31 years
22:47 TheFuzzball joined
22:47 <ab9rf> how much of that do you think i learned from a book?
22:48 <simon`> :)
22:48 <simon`> Well you'd have to start somewhere I guess?
22:48 <ab9rf> i started working with databases six years before SQL existed.
22:48 <ab9rf> well, sure, mostly product manuals and specific product technical documentation
22:49 Trendrrr joined
22:49 <ab9rf> because to be a good DBA you need to know what's going on "under the hood"
22:49 Eduard_Munteanu joined
22:49 <simon`> kuribas: 2x the speed would be a huge improvement if searching takes more than 1/10 second or so+
22:49 <ab9rf> i can go on for hours about how Microsoft SQL Server structures a database on disk, but that would not likely illuminate your problem :)
22:50 <kuribas> simon`: it wasn't particularly optimized haskell.
22:50 <kuribas> simon`: it just had the right algorithmic complexity.
22:50 <simon`> Just looked at the git design which is written in C
22:51 <simon`> So I thought I might aswell use C too :)
22:51 <ab9rf> getting the right algorithmic complexity is far more important than squeezing some efficiency out of the runtime implementation
22:51 <simon`> Sure, that's always a given
22:51 <ab9rf> but you're talking about language when you have no idea what your approach even is
22:52 <ab9rf> a slow algorithm is slow in every language
22:52 <Tuplanolla> Do you develop or just administer databases, ab9rf?
22:52 <ab9rf> Tuplanolla: i've done both.
22:52 primal joined
22:52 <kuribas> simon`: heh, you can always port that 0.1% part of your program to C, once you find where the bottleneck is.
22:53 <Tuplanolla> I kind of expected that.
22:53 <monochrom> Time to say: Haskell makes a fast algorithm fast, and an infinite-time algorithm finite-time. :)
22:53 <ab9rf> Tuplanolla: it's usually the DBA who figures out how to optimize the database anyway, the devlopers rarely understand enough of the way the query engine works to be able tyo decide what indices should be added :)
22:55 <simon`> Maybe I am writing a Haskell prototype first
22:55 <ab9rf> i probably don't have as much database theory as i could, i'm aware that there's a relational algebra for databases but couldn't recite the laws off the top of my head
22:56 <Tuplanolla> How about database engines?
22:56 <ab9rf> at the same time, i do know the difference between a selection, a projection, and a join
22:57 <simon`> I basically know nothing about specific database engines
22:57 primal_ joined
22:57 <ab9rf> simon`: do you know what a "column index" is? do you know the difference between a table scan, an index scan, and an index seek?
22:59 Beetny joined
22:59 <ab9rf> iirc an index fetch from a B+ tree is normally O(lg n) in the number of records in the index
22:59 mizu_no_oto joined
22:59 <ab9rf> most database engines use B+ trees or something very similar for indexes
23:00 P1RATEZ joined
23:01 zv joined
23:01 Engen joined
23:01 <ab9rf> yeah, the base of the logarithm will depend on the implementation, but it's going to be logarithmic in the number of records stored
23:01 alveric4 joined
23:03 <Lokathor> so
23:03 <Lokathor> I want readFile, but not lazy
23:03 <ab9rf> Lokathor: you want to be assured that the entire file has been read?
23:03 <Lokathor> yes
23:04 <Eduard_Munteanu> Lokathor, you can use the strict bytestring's readFile
23:04 <Eduard_Munteanu> Or strict Text.
23:04 <ab9rf> System.IO.Strict?
23:04 <Eduard_Munteanu> Data.ByteString.IO
23:04 <Lokathor> yeah i figure you can do this with ByteString or Text, but I wasn't sure if there was an easy way with just stuff from base
23:04 <simon`> Hm, "table scan" = iterate over all rows in the db, "index scan" = iterate over all index items, "index seek" = iterate over all qualifying rows?
23:04 takle joined
23:05 <ab9rf> simon`: basically, yes. the key to making a datbase fast is to have as many of your selects use index seeks instead of index scans or table scans.
23:05 <ab9rf> index scans are faster than table scans.
23:05 <ab9rf> (usually)
23:05 <Lokathor> Strict.hGetContents h = IO.hGetContents h >>= \s -> length s `seq` return s
23:05 <ab9rf> index seeks are O(lg n), while index scans and table scans are O(n) (and table scans typically have a larger constant factor because a larger amoutn of data has to be skuffled about)
23:06 <Lokathor> simple now that I think about it
23:06 <ab9rf> Lokathor: heh, nice way to force it
23:06 <MarcelineVQ> I wonder about !foo <- readFile "nyar.txt"
23:06 <Lokathor> i just looked here https://hackage.haskell.org/package/strict-0.3.2/docs/src/System-IO-Strict.html#hGetContents
23:06 <Eduard_Munteanu> That just reads the first character.
23:07 <ab9rf> MarcelineVQ: only guarantees the first character, aeverything after that could still be a thunk
23:07 <MarcelineVQ> interesting
23:07 <Eduard_Munteanu> You could foldl/foldr with seq, though.
23:08 saussure joined
23:09 <Eduard_Munteanu> > foldr (\x xs -> x `seq` (x:xs)) [] [1,2,3,4]
23:09 <lambdabot> [1,2,3,4]
23:09 <simon`> ab9rf: Ok, thank you!
23:09 <Eduard_Munteanu> > foldr (\x xs -> x `seq` (x:xs)) [] [1,2,undefined,4]
23:09 <lambdabot> [1,2*Exception: Prelude.undefined
23:10 <simon`> What datastructure are databases usually stored in?
23:10 <simon`> *s
23:11 <Eduard_Munteanu> simon`, there's an on-disk format, not some generic data structure
23:11 <simon`> I mean some sort of tree I suppose?
23:12 <Eduard_Munteanu> Indexes are trees usually.
23:12 <simon`> And the leaves point to data on the disk?
23:12 <Eduard_Munteanu> The data may be stored inline in the tree or as pointers/offsets within the database.
23:13 <MarcelineVQ> Eduard_Munteanu, ab9rf: actually I feel like a fool now, of course it only forces the first element, that's what : is all about :>
23:13 <ab9rf> simon`: virtually all modern databases uses some variant on a B+ tree
23:14 <Eduard_Munteanu> Well, all modern classic RDBMSes :)
23:14 <ab9rf> yeah, key-value databases may use other structures
23:14 <Eduard_Munteanu> You can probably do with a binary tree for SSD-optimized stuff.
23:15 <ab9rf> simon`: in most of the db engines i've used, a table is just an index with data in the leaves, while an index has pointers to table roes in the leave instead
23:15 <simon`> ab9rf: Ok, I see. I have to prepare a btrfs talk for work, so I need to learn about B-trees anyway
23:16 <ab9rf> the table is alsoa B+ tree indexed by either the "primary key" or by an internally-genreated unique row identifier
23:16 takle joined
23:16 <ab9rf> also, in some cases some row data may be stored "elsewhere"
23:16 <ab9rf> (e.g. large binary object fields)
23:17 <simon`> Ok, that makes sense!
23:18 <simon`> ab9rf: What is the difference between a B- and a B+-tree actually?
23:18 <ab9rf> simon`: B-trees contain values at all nodes, not just leaves
23:19 <ab9rf> it's much harder to sequentially traverse a B-tree starting at some arbitrary point
23:20 lminy_ joined
23:20 <simon`> Ok, I understand!
23:20 <ab9rf> tpyically also B+ trees have much higher "fan-out"
23:22 t0m0 joined
23:22 <simon`> Is the balancing done automatically or after "manually" after each insert/transaction?
23:22 MarioBranco joined
23:22 <simon`> -after
23:22 ckubrak joined
23:23 <ab9rf> the database engine does the balancing, although it's an implementation details as to when balancing happens.
23:23 <ab9rf> normally transactionsa re not written to main store until committed
23:24 <ab9rf> until committed, they'll be in transient store (and the transaction log) only
23:24 cpennington joined
23:25 <simon`> Ok, makes sense!
23:25 <ab9rf> it gets even more fun if you're dealing with a multiphase commit architecture
23:26 <simon`> I will work through Knuth's chapter on B trees sometime next week to fully understand what's going on
23:26 <ckubrak> Hi guys, I'm currently learning haskell and I have a doubt. In the the books I'm reading (Real World Haskell and LYAH) they do this kind of stuff:
23:26 <ab9rf> can't argue with knuth
23:26 <ckubrak> https://gist.github.com/ckubrak/ebc5966ffc99aee2ba2c65287f8749a3
23:27 <ckubrak> Why do they use a where clause? Why don't they define step outside?
23:27 saussure joined
23:27 SkyPatrol_ joined
23:27 <EvanR> its only useful to that function being defined
23:27 <EvanR> a locally defined function
23:27 <ab9rf> simon`: on mssql, the dba can specify on a table-by-table (or index-by-index) the "desired" free space in the index
23:27 <EvanR> like you would use local variables instead of global variables for the same purpose
23:28 <ab9rf> simon`: if you know, as the dba, that additional records will only be added to the "end" of the table (as defined by its primary key) then you may want to set the fill factor to 100%, which forces the engine to only do splits when nodes are completely full
23:28 Trendrrr joined
23:28 <ckubrak> EvanR: ok thanks
23:29 <EvanR> ckubrak: also, you see it uses the variable p... if you just moved it out, that would be "variable not in scope"
23:29 <ab9rf> simon`: but if you anticipate that additional records will be added across the entire range of the index alues, you would specify a smaller fill factor to leave room so that most inserts don't require a block split. most DBAs run periodic table reorganizations to reshape the indices back to the desired fill factor.
23:31 Trendrrr joined
23:31 theDon_ joined
23:32 <ab9rf> ckubrak: otherwise you clutter up your module namespace to the point that it gets difficult to avoid collisions
23:32 jerbome_ joined
23:32 eacameron joined
23:33 <simon`> ab9rf: That's intersting! I think I will teach myself a thing or two about databases
23:33 systemfault joined
23:33 <simon`> Do you know a good B-tree module for Haskell?
23:33 louispan joined
23:33 markus1209 joined
23:34 markus1219 joined
23:35 <Eduard_Munteanu> I've seen a couple on Hackage, although somewhat limited.
23:36 <Eduard_Munteanu> Note btrees are usually used as on-disk structures, not as much as in-memory structures.
23:36 <simon`> why not actually?
23:37 <Eduard_Munteanu> The fanout of btrees is useful for slow rotating media, but it's unnecessary for random access memory.
23:38 rcschm joined
23:38 <ab9rf> Eduard_Munteanu: yeah, in-memory is a whole different chicken
23:38 <Engen> hey everyone, currently trying do an exercise to do with propositional logic in haskell and I'm having some trouble understanding the given data data instanciation to try and figure out if some given formula is satisfiable http://wklej.org/hash/cf20176d9a1/
23:38 <ab9rf> Eduard_Munteanu: although you still can get some benefit if you use a B-tree with a block size that matches your CPU cache line
23:39 <Engen> I understand that Exists takes in a list of some type a, but then the second argument which is a function is where I get confused on what's happening
23:40 <simon`> what is fanout?
23:40 <ab9rf> simon`: this is getting a bit far afield for #haskell
23:40 <simon`> you started though ;-)
23:41 nakal_ joined
23:41 <Engen> the type definition is as follows: Show a => [a] -> (Term a -> Formula as) -> Formula (a, as). What is the function (second argument) saying?
23:41 <ab9rf> simon`: and you're not paying me enough for a tutorial lesson :)
23:41 <ab9rf> and Engen's question is actually about haskell and i want to focus on that :)
23:41 castlelore joined
23:42 <Engen> I know that satisfiable has to try every combination of inputs and if any happens to be true, then output true, otherwise false
23:42 <simon`> ab9rf: I am paying you gratitude (and potentially awe) :)
23:42 <Eduard_Munteanu> simon`, it's the number of branches that go out of a node, e.g. 2 for binary trees
23:42 <Tuplanolla> I'm paying attention. Is that not enough?
23:43 teurastaja joined
23:43 <simon`> Eduard_Munteanu: ok, I see. Weird terminology :)
23:43 <zachk> great now I can get webpages over https using http-conduit :D
23:43 <zachk> now I can get to parsing them
23:44 <Gurkenglas> Engen, the second argument is something that becomes a formula given a term, such as a formula with blank spaces in it that are going to be filled with the given term. If you call the blank space by a name such as x, you've got yourself a formula with a free variable, which that functions is probably meant to represent
23:44 <Gurkenglas> *that function is
23:48 <Gurkenglas> Engen, "satisfiable xs func" is not something that will compile because satisfiable takes one argument. You may want to replace "satisfiable xs func" with some expression of form "map (satisfiable . _) xs" for some _, in order to turn each element of [a] into some Formula and then check it for satisfiability.
23:48 <ab9rf> yeah, i finally figured that out too
23:48 <Gurkenglas> Of course, 'foldl (||) False (map f x)' is 'any f x'
23:49 <ab9rf> you''re going to have to dive into func
23:49 <begriffs> What's a slick way to "filter" a Maybe? For instance turning (Just "") into Nothing, but preserving Just of any other string value?
23:49 <Gurkenglas> Engen, that last _ will probably need some way to turn a into Term a
23:49 <Gurkenglas> :t mfilter :: begriffs
23:49 <lambdabot> error:
23:49 <lambdabot> • Couldn't match expected type ‘begriffs1’
23:49 <lambdabot> with actual type ‘(a0 -> Bool) -> m0 a0 -> m0 a0’
23:50 <Gurkenglas> :t mfilter -- begriffs (gotta go sleep i guess?)
23:50 <lambdabot> MonadPlus m => (a -> Bool) -> m a -> m a
23:50 <ab9rf> heh
23:50 <begriffs> Oh nice, my hoogle search was too specific I guess. :)
23:50 <Engen> Gurkenglas: yeah I was thinking of using map also but couldn't see how I'd map into the function/data compared to over it like you would with a list
23:51 mjora7 joined
23:52 darlan joined
23:52 <Gurkenglas> The _ will have type "a -> Formula a". The as yet unused argument has type "Term a -> Formula a". Want a hint? :P
23:53 ckubrak joined
23:53 <Engen> Gurkenglas: oh, would that just then be a -> Term a ?
23:54 <Gurkenglas> You should need to use such a function within the _, yes.
23:55 Bhootrk_ joined
23:55 bjz_ joined
23:56 <ab9rf> heh
23:56 anodium joined
23:57 gestone joined
23:57 <Engen> Gurkenglas: I've defined the following though: data Term t where Con :: t -> Term t
23:57 Trendrrr joined
23:58 <Engen> Gurkenglas: slight diversion, but what is the period inside (satisfiable . _) doing?
23:58 infinity0 joined
23:58 <Gurkenglas> :t (.)
23:58 <lambdabot> (b -> c) -> (a -> b) -> a -> c
23:59 rcschm joined