<     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:00 atk joined
00:00 bydo joined
00:02 infinity0 joined
00:02 <JScully> How deep are 2^k-Bit carry select adders, if the adders Low, High0, High1 are implemented as 2^k-1 Bit adders
00:02 <JScully> whats the point here?
00:03 ericsagnes joined
00:03 <JScully> like i need more adders because the adders used are processing less bits
00:04 <JScully> is this a right assumption?
00:05 infinity0 joined
00:07 infinity0 joined
00:08 trism joined
00:09 northfurr joined
00:10 infinity0 joined
00:12 mekeor joined
00:13 tristanp joined
00:13 StoneToad joined
00:14 yobohohoz joined
00:14 JeanCarloMachado joined
00:15 cschneid_ joined
00:16 Guest45076 joined
00:16 castlelore joined
00:17 electrostat joined
00:19 exferenceBot joined
00:20 <JScully> hm no this is wrong
00:22 plutoniix joined
00:22 plutoniix joined
00:23 <JScully> if a 2^5 adder is realized using 2^4 adders, that means a 32 bit adder only needs two 16 bit full adders right
00:24 <JScully> that means it needs twice the depth
00:24 <hololeap> after installing bash-completion, it just does
00:25 filterfish joined
00:26 <hololeap> wrong channel
00:27 doomlord joined
00:30 i-amd3 joined
00:30 blym_ joined
00:30 tromp joined
00:30 JeanCarloMachado joined
00:31 shayan_ joined
00:33 erisco joined
00:33 chlong joined
00:34 shayan_ joined
00:35 <JScully> https://pastebin.com/WubVTVYs
00:35 <JScully> in line 11, is c1 even available at that time
00:35 <JScully> is line 10 executed before line 11 is accessd?
00:36 systadmin joined
00:37 <JScully> i am not sure how i can check that
00:38 mjora7 joined
00:39 JeanCarloMachado joined
00:40 <JScully> hm no its not !!
00:40 <JScully> c2 should be true but it is not true
00:41 justan0theruser joined
00:43 chao-tic joined
00:44 Efe joined
00:44 <Efe> Hello, can someone help me with a really basic error?
00:44 <mniip> ?
00:44 <Efe> I researched but I could not find any solution : ERROR - Unrecognised character `\1' in column 1
00:45 <JScully> ok my halfadder and my fulladder are working
00:45 <JScully> thats for sure
00:45 <JScully> Efe, post the code :D
00:45 <Efe> My function is higher l = [x|x <- l , x > 3]
00:45 <Efe> I'm trying to use filters, because I read at haskell oficial tips that recursion is pretty bad
00:46 <Efe> Even at university we are using recursion for list
00:46 <mniip> that's weird
00:46 <monochrom> You have an invisible control character in your file. Delete it and start again for scotched earth policy.
00:46 <mniip> everything in haskell is recursion
00:46 <Efe> explicit one I mean
00:47 <mniip> writing code that has already been written is bad
00:47 <mniip> not explicit recursion
00:47 <Efe> wow... thank you very much monochrom
00:47 filterfish joined
00:48 andyhuzhill joined
00:48 <monochrom> mniip: The actual advice from those teachers (some of them are here too like byorgey) is more subtle, but to student it does come across as "don't recurse" because students oversimplify.
00:48 <mniip> well yes
00:48 filterfish joined
00:48 <mniip> I was trying to say that it's a misinterpretation
00:48 <Efe> yeah, we are going thorught code logic , not for sugar code
00:48 <monochrom> Students always oversimplify. It's why they religiously believe "big-O = worst case" for example.
00:49 <mniip> monochrom, what do you mean by that
00:49 <monochrom> I don't know how to say it better, since I'm conveying a wrong belief anyway.
00:50 <erisco> a more relatable explanation may be to think why we use higher level languages
00:50 <erisco> i.e. why Haskell and not, say, assembly
00:50 <monochrom> "use big-O for worst case, big-Omega for best case" something like that.
00:50 <mniip> do you mean that big-O could be an unstrict bound?
00:50 <mniip> or is there something I don't know about big-O
00:50 <erisco> we can write programs that exhibit the same behaviour with either one
00:51 <erisco> but what we're missing in assembly is exactly why we call other languages "higher level" languages
00:51 <erisco> we're missing higher level concepts and definitions which make reasoning about problems simpler
00:51 <erisco> or certain problems, I should say. it is a pick a tool for the job kind of problem.
00:51 <erisco> by using explicit recursion we're limiting ourselves to the most basic facilities
00:52 <erisco> by using definitions like foldr we're using higher level facilities
00:52 <erisco> this makes our reasoning, intent, and code better and clearer
00:53 <erisco> the beginner defaults to using explicit recursion extensively because it can be used universally
00:54 <erisco> so just by knowing how to use that you can start to think of solutions using it
00:54 WhiskyRyan joined
00:54 <erisco> whereas other methods are more specialised and require further knowledge and study
00:56 blym_ joined
00:56 <davean> "haskell oficial tips" uh
00:57 hybrid joined
00:57 <JScully> [((True,False,False,True),(False,False,False,True))]
00:57 <JScully> does "map function [((True,False,False,True),(False,False,False,True))]" work
00:57 <JScully> or should i remove the [ ]
00:57 <erisco> Efe, that's for you in case you're not looking :)
00:58 <erisco> JScully, start up ghci or /dialog lambdabot and try it out
00:58 <erisco> I can catch one error for you or I can teach you how to catch errors yourself ;P
00:59 <Lokathor> I'd say that the primary reason to avoid explicit recursion is that you write the hidden-recursion form once and test that and then you can trust that later, so if there's a break you can focus on just what's new this time
00:59 <JScully> both does not work
00:59 <JScully> hn
00:59 <Lokathor> the same reason that you don't use explicit GOTO in C when you can use for or while, even though technically you could just use GOTO all the time
01:00 <erisco> JScully, okay, the next step is to explain what you are trying to do, what you tried, what the error is, and what you expected
01:00 <erisco> JScully, you can make use of lpaste to share longer code segments
01:00 <dmj`> fix is the new goto
01:01 <JScully> i think i got this, but my question from before is still unclear
01:01 <JScully> http://lpaste.net/355308
01:01 <JScully> is c1 in line 11 even available, it seems like its always false
01:01 <JScully> is the c1 in line 10 used in line 11?
01:02 <JScully> does haskell work that way?
01:02 <erisco> JScully, all definitions in a where block are available to each other
01:02 <erisco> that is, they are all in the same scope
01:02 <JScully> can i debug somehow single values in that function
01:03 <JScully> i would like to monitor all values
01:03 <Lokathor> JScully, that's a little less easy, but possible
01:03 <erisco> for this I would just evaluate the individual expressions in ghci
01:03 xcmw joined
01:03 <Lokathor> JScully, ^
01:03 robertkennedy joined
01:04 <Lokathor> but if you really want, something like traceShow from https://hackage.haskell.org/package/base-
01:04 JeanCarloMachado joined
01:05 <Lokathor> or just trace
01:05 <JScully> i saw that function
01:05 <Lokathor> it gets ugly fast, unfortunately
01:05 <JScully> but i cannot just put it inside my code
01:05 <Lokathor> (s2, c2) = fulladder a2 b2 c1 ----> (s2, c2) = trace ("s2,c2:" ++ show (fulladder a2 b2 c1)) (fulladder a2 b2 c1)
01:06 <erisco> fulladder True True False is easy to evaluate
01:06 mizu_no_oto_work joined
01:06 <JScully> the fulladder works
01:06 <erisco> that is the case where c1 should not be False, if I understand the content
01:06 <JScully> i dont know if the ripplecarryadder gets the right values
01:06 <JScully> not sure how i can debug this
01:06 lambdamu_ joined
01:06 <erisco> you mean you are not sure if the arguments to rippleCarryAdder1 are correct?
01:06 <JScully> yes
01:07 <JScully> because it seems like c1 is false
01:07 <JScully> where it should be true
01:07 <erisco> well then I'd go further up to the expression involving rippleCarryAdder1
01:07 <Lokathor> JScully, I'd evaluate all possible inputs to fulladder one at a time to see if they're all correct. If they are, then you might be threading the output values around wrong
01:08 <JScully> i did that already
01:08 <JScully> fulladder is working 100%
01:08 <Lokathor> then your arguments are being threaded around wrong
01:08 <JScully> i manually tried this https://pastebin.com/c3KtVx60
01:08 <JScully> which gives the correct result
01:09 <JScully> so c2 seems to hold a wrong value
01:09 <Efe> did you guys work programming in haskell?
01:09 <erisco> okay, well, first thing is to stop going back to the incorrect explanation
01:09 jer1 joined
01:09 <erisco> you've verified fulladder so c2 definitely does not have the incorrect value
01:10 <JScully> i verified fulladder manually with a truth table in ghci
01:10 <JScully> i have no idea what c2 is
01:10 <JScully> at the time it is computed
01:10 <Lokathor> if fulladder is correct, c2 can't be incorrect
01:11 <JScully> c2 is a parameter in rippleCarryAdder
01:11 <JScully> i did not verify the fulladder inside that
01:11 <Lokathor> c2 is calculated based on the result of the the "fulladder a2 b2 c1" expression, so it's value "when it's computed" can't affect the result, since it's not part of its own input
01:11 <JScully> yes i would like to debug that inside the ripple carry adder
01:11 <Efe> may l i = [x|x<-l,x>i] how its called the [] part, comprehension, filter?
01:12 halogenandtoast joined
01:12 JeanCarloMachado joined
01:12 <Lokathor> JScully, haskell doesn't actually have an execution order like in C, where you can debug line by line
01:12 Fairy joined
01:12 <kadoban> Efe: list comprehension
01:12 <erisco> a lot of the time you can solve the problem analytically
01:12 <Efe> Thank you kadoban
01:13 <halogenandtoast> Lokathor: it might be more accurate to say GHC doesn't allow you to debug line by line right?
01:13 <lin___> can i install XMonad using stack (from commercialhaskell)?
01:13 <halogenandtoast> I'm assuming a compiler author could provide that functionality.
01:13 <erisco> JScully, lets go through this step by step.
01:13 <monochrom> And then GHCi comes along allowing you some notion of stepping :)
01:13 <erisco> JScully, what are the values of a1, a2, a3, a4, b1, b2, b3, b4?
01:13 <Lokathor> halogenandtoast, you can use ghci to execute IO actions one step at a time, and a non-IO expression is printed as if you'd prefixed the expression with "print $"
01:13 <JScully> True, False, False, True), (False, False, False, True)
01:14 <erisco> okay, let me write that out
01:14 <halogenandtoast> Lokathor: I jumped in mid conversation so my comment might have been out of context with the rest of the conversation.
01:14 <JScully> rippleCarryAdder (True, False, False, True) (False, False, False, True)
01:14 <JScully> this is how i call it
01:14 <erisco> JScully, http://lpaste.net/355310 seem good?
01:15 <JScully> yes
01:15 <Lokathor> halogenandtoast, they want to "break on" a line of a pure expression, like you would in Java or C, but Haskell doesn't quite provide that because it doesn't quite execute like that
01:15 <erisco> now we want to know (s1, s2, s3, s4)
01:15 <JScully> T,F,F,F
01:15 <erisco> and by wanting to know that we have to look at the definitions in the where block, alright, lets do that
01:15 meba joined
01:15 <JScully> but it should be TFTF
01:16 rkazak joined
01:17 afarmer joined
01:17 <erisco> JScully, http://lpaste.net/355310
01:17 <erisco> I've started working on evaluating the first fulladder. So what is fulladder True False False?
01:17 <JScully> True,False
01:17 <JScully> c1 is false
01:17 <erisco> good, so now we have s1 = True and c1 = False
01:18 <JScully> s2, c2 = fulladder False False False
01:18 <JScully> well thats bad
01:18 rblaze joined
01:19 <erisco> JScully, now we start on the next one. What is fulladder False False False? http://lpaste.net/355310
01:19 <JScully> s2=False, c2=False
01:19 <JScully> we can stop here it hink
01:20 <JScully> because thats already wrong as it seems
01:20 <erisco> okay, what went wrong?
01:20 mkoenig joined
01:20 <JScully> well no nothing
01:20 <JScully> S2=False, C2=False
01:20 <erisco> so is something wrong or not wrong? should we continue?
01:20 Supersonic112_ joined
01:21 <JScully> (s3, c3) = fulladder False False False
01:21 <JScully> results into False again
01:21 <JScully> now we have T,F,F so far
01:21 <JScully> the result from the sheet provided is T,F,T
01:22 <erisco> okay, so the first observation is we were able to identify where the evaluation did not meet our expectations just by working the example by hand
01:22 <erisco> and I did it verbosely but you were able to skip many steps and figure it out more quickly
01:22 <erisco> this is generally how we're going to think about Haskell programs
01:23 <erisco> so we've progressed from thinking something is weird with c2's scope to realising our algorithm for computing the sum is just wrong
01:23 Snircle joined
01:24 <erisco> would you agree?
01:24 <JScully> Or the result provided is wrong
01:24 JeanCarloMachado joined
01:24 <erisco> well, here is something you may want to consider: endianness
01:25 Efe joined
01:26 <erisco> do you know what that is?
01:26 <JScully> i dont
01:26 <Lokathor> JScully, you said yourself that fulladder has been entirely verified. so the result provided can't suddenly just be wrong
01:26 <Efe> Guys, If I had to find the position of the element in a list, where the values correspond to minimum value in the list
01:26 <erisco> okay, here is something important about storing numbers on computers
01:26 <erisco> like on paper, we need to decide what order we put the digits in
01:27 <erisco> so with decimal notation we put the most significant digits first and the least significant at the end
01:27 <Lokathor> eg, 123 = "one hundred and twenty three"
01:27 LnL joined
01:27 mmachenry joined
01:27 <erisco> this normal way of writing numbers is called "big endian" in computer terms
01:27 takle joined
01:28 <erisco> so when we have a binary number such as 1101 we understand this is 1*2^3 + 1*2^2 + 0*2^1 + 1*2^0
01:28 peterhil joined
01:28 <erisco> rather than 1*2^3 + 0*2^2 + 1*2^1 + 1*2^0
01:28 systadmin joined
01:29 <erisco> or like Lokathor says, there is a difference in how we understand 123 and 321
01:29 <erisco> same thing on computers
01:29 <erisco> now, on some computers numbers are stored in little-endian
01:29 <JScully> right
01:29 <erisco> this is backwards to how we're used to writing numbers and so can be confusing
01:30 <erisco> the way you are computing the sum of the nibbles assumes an interpretation of little-endian numbers
01:30 <erisco> can you see why that is?
01:30 darlan joined
01:31 <JScully> you mean a1 should be in place of a4 and a4 should be in place of a1=
01:31 <JScully> ?
01:31 <erisco> well, that is part of it
01:32 <erisco> what I mean to show you is that if you consider the addition algorithm, which I presume you're familiar with, look at how you're doing the carries
01:32 <erisco> you are carrying from left to right
01:32 <erisco> if you were doing addition on paper you'd be carrying from right to left (because you'd write the numbers in big-endian)
01:32 sproingie joined
01:32 sproingie joined
01:33 <erisco> the addition algorithm carries from the smaller to the larger
01:33 <erisco> so, lets guess that you've mixed up the endianness
01:33 <erisco> there is an easy way to see if this might be the case without changing your function at all
01:34 <erisco> can you find it?
01:34 <JScully> without a chance in code?
01:34 <JScully> change*
01:34 <erisco> without changing the definition of rippleCarryAdder1 or fulladder
01:35 <JScully> well i can change the order of the bits in the nibble of the calling function
01:35 peterhil joined
01:35 Tene joined
01:35 Tene joined
01:35 <erisco> yes, that's it. you can just reverse both nibbles and see if you get the expected answer
01:35 <JScully> 0101
01:35 <JScully> its closer to 1010
01:36 <JScully> :D
01:36 <erisco> think a bit more
01:36 <JScully> do i have to revert them after calculation?
01:36 cschneid_ joined
01:36 <erisco> remember that your adder interprets as little-endian
01:36 <erisco> so what format is the answer going to be in?
01:36 jer1 joined
01:36 <erisco> yes, you have to reverse the answer as well to get back big-endian
01:37 <JScully> ah interesting
01:37 <JScully> :D
01:37 dfordivam joined
01:37 <erisco> so now you can either just write a function to reverse the nibbles as appropriate and keep rippleCarryAdder1 as-is
01:37 <JScully> that is probably going to be it, thank you first of all
01:37 <erisco> or you can change the direction you are carrying in
01:38 YongJoon joined
01:38 fosterite joined
01:39 <JScully> oh my god :D !
01:39 <JScully> you are the smartest person i have met today :D
01:39 Snircle joined
01:39 <JScully> thanks
01:40 <JScully> i need to read further on that endian thing
01:40 <mniip> that is about to change
01:40 <mniip> jk
01:41 cranej joined
01:41 <erisco> lol
01:42 <erisco> JScully, thanks and glad it worked out. I have to admit there are many people smarter than I here. after all, some of them taught me!
01:44 sword865 joined
01:46 blym_ joined
01:46 JeanCarloMachado joined
01:46 LHoT10820 joined
01:47 lambda-11235 joined
01:48 <JScully> overwhelming, thanks thanks thanks :D
01:49 <JScully> enough for today but i will come back for sure :)
01:53 <riaqn> hello, is there some index type such that, Ind n is integers in [0,n)?
01:53 <riaqn> I know dependent types in haskell sucks, but still wondering.
01:53 <erisco> riaqn, Fin
01:54 <erisco> data Fin :: Nat -> * where FZ :: Fin (S Z); FS :: Fin n -> Fin (S n)
01:55 <erisco> might be in singletons but I can't recall
01:55 conal joined
01:55 takle joined
01:55 <riaqn> erisco: thanks! https://hackage.haskell.org/package/data-fin-
01:55 <riaqn> this looks promising.
01:56 sgronblo joined
01:56 <mniip> riaqn, hold on!
01:56 <mniip> @hackage finite-typelits
01:56 <lambdabot> http://hackage.haskell.org/package/finite-typelits
01:56 filterfish joined
01:56 <erisco> I ran into problems with promotion
01:56 <riaqn> never understand dependent types in haskell, so twisted.
01:57 filterfish joined
01:57 <erisco> yes you can promote that type, but you don't have an unpromoted definition that is as strong as it could be
01:57 <erisco> particularly you're missing the SingI constraint on the natural
01:57 <erisco> and if you add in that constraint then you cannot promote it
01:58 <erisco> so for me it was a road that lead to disappointment, unfortunately
01:58 <erisco> detour ahead, use Idris
01:58 tromp joined
01:59 JeanCarloMachado joined
01:59 <riaqn> erisco: yeah idris. But I need some threaded programming..
01:59 <riaqn> might stick to haskell..
01:59 <erisco> riaqn, well they are not dependent types
02:00 <erisco> the name "singleton" is well chosen. it is that each type only has one value (ignoring bottom)
02:00 hucksy_ joined
02:00 <riaqn> I'm not in bad need for the type checking, simply want to express"it's in the range" to the code reader.
02:00 <erisco> so if you know the type you know the value, and that is the key
02:00 <mniip> riaqn, did you check out my package :o
02:01 <riaqn> erisco: some kind of hack? pretty haskell..
02:01 <erisco> it is not a hack
02:01 <riaqn> mniip: Yeah I checked. How is it compared to the last package?
02:01 CurryWurst_ joined
02:01 <erisco> it is as straight-forward as unit
02:01 <mniip> it uses typelits
02:01 <erisco> in principle, anyways
02:02 uuplusu joined
02:02 <erisco> in practice the implementation includes TH (if we're talking singletons package) which has pros and cons
02:02 <mniip> typelits have cleaner syntax but sometimes the compiler can't figure out your types
02:02 <erisco> pro is you can write straight (limited) Haskell code and have it lifted automatically
02:02 <erisco> con is that you have to sift through confusingly named definitions... particularly in error messages
02:03 <mniip> there's typelits-witnesses for doing advanced typelits arithmetic that does type-check
02:03 <riaqn> mniip: cool. I'll try that out. (don't know what you mean though).
02:03 <mniip> :k 1
02:03 <lambdabot> GHC.Types.Nat
02:03 <mniip> riaqn, this stuff ^
02:03 <mniip> :t undefined :: Proxy (3 + 4)
02:03 <lambdabot> error:
02:03 <lambdabot> Not in scope: type constructor or class ‘+’
02:04 jer1 joined
02:04 <mniip> :t undefined :: Proxy (3 GHC.TypeLits.+ 4)
02:04 <lambdabot> Proxy 7
02:04 robkennedy joined
02:05 <riaqn> mniip: erisco: thanks for explaining.
02:05 <riaqn> I wish all the packages ported to idris overnight.
02:06 <erisco> Idris is not painless either. Partly because it is in development.
02:06 <mniip> oh yeah
02:06 <erisco> the other part being that if you are new to dependent typing, like myself, then the changes can be really awkward
02:07 <mniip> once again, in what package can I find a good definition of natural transformations
02:08 <erisco> like how (->) is not a type constructor, and f x = m is not the same as f = \x -> m
02:08 <riaqn> mniip: I think there is some category theory in Coq. should be easy ported to idirs.
02:08 <erisco> and f X = m is not the same as f x = case x of X -> m
02:08 <erisco> and things like this
02:08 <mniip> I meant a haskell package
02:10 <erisco> on one hand it is wonderful to be able to express such complex properties in types
02:10 <erisco> on another I really like where we are now
02:10 jmcarthur joined
02:11 <erisco> or at least there are things I want to keep or improve rather than abandon
02:11 splanch joined
02:11 Costar joined
02:14 Gurkenglas joined
02:15 <riaqn> another question: fixed length bit vector with length info in type?
02:15 flatmap13 joined
02:16 <erisco> well there is Vec which you can fill with Bool
02:16 <riaqn> cool!
02:17 takle joined
02:18 e14 joined
02:18 <riaqn> erisco: ahh.. predefined Vec1 to Vec19?
02:19 <erisco> riaqn, no, and I think we're both looking at something I didn't expect
02:19 <erisco> there should be a Vec :: Nat -> * -> * somewhere... or maybe it is called something else
02:20 <erisco> if you're looking at Vec package, like I am, then that is something else actually
02:20 <erisco> that is effectively type lists
02:20 <erisco> and the Vec1 to Vec19 are not predefined... they're just convenient aliases
02:21 mizu_no_oto_work joined
02:22 <erisco> hm, I don't know what package it is in
02:22 <riaqn> erisco: maybe you mistake some idris def as haskell packages..haha
02:22 <erisco> probably
02:23 <riaqn> anyway..I'm writing some digital circuit simulator.. so lots of info in type.
02:23 <erisco> that package might work for you but it is not the definition I had in mind
02:23 <riaqn> maybe I should just use Integer in all place.
02:23 robertkennedy joined
02:24 <erisco> I was thinking data Vec :: Nat -> * -> * where VZ :: Vec Z a; VS :: a -> Vec n a -> Vec (S n) a
02:24 <erisco> exactly lists but augmented with length
02:25 <riaqn> erisco: that's exactly how you do it in idris...
02:25 <riaqn> I don't know if it's possible in haskell..
02:26 northfurr joined
02:26 <erisco> you can do this
02:26 <erisco> you need GADTs and DataKinds
02:27 halogenandtoast joined
02:27 tromp joined
02:28 <erisco> this is the classic example so it has to be defined somewhere
02:28 <riaqn> thanks.. I avoid ghc extensions as I can...except when I'm prompted to add a line or two..
02:28 <riaqn> nevermind, I will just use integer all where.
02:28 <erisco> avoid extensions? that's just like trying to hold your breath
02:29 louispan joined
02:29 Argue joined
02:30 aglorei joined
02:31 LordBrain joined
02:31 jer1 joined
02:31 Welkin joined
02:32 flatmap13 joined
02:33 <mniip> question
02:33 <mniip> I'm writing a function that accepts an arbitrary indexed type constructor, how can I let the user decide what argument of the constructor is the index?
02:34 <Welkin> mniip: alright dwight schrute
02:34 <LordBrain> mniip, use a view pattern
02:34 <turnage> I'm totally miss the Office reference here
02:34 <mniip> LordBrain, ?
02:34 <erisco> I don't use view patterns but I don't think they apply here
02:34 exferenceBot joined
02:35 <erisco> you can define a type family, mniip, that projects the index
02:35 <LordBrain> mniip, maybe i misunderstand you... but it sounds like you just want to do pattern matching without referring to the data constructor...
02:35 <erisco> alternatively you can expect them to reorder their arguments appropriately with newtypes
02:35 <mniip> I never said data constructor
02:35 <mniip> type constructors is where it's at
02:35 <mniip> erisco, I'm somewhat encouraged by zipWith
02:35 <LordBrain> okay, well how do you mean user tho
02:36 <erisco> :t zipWith
02:36 <lambdabot> (a -> b -> c) -> [a] -> [b] -> [c]
02:36 <mniip> thinking I can define a function to inductively lift my function
02:36 <mniip> erisco, I mean, have you seen the zipWithN paper?
02:36 <Welkin> mniip: link?
02:36 <erisco> no
02:36 systemfault joined
02:37 <LordBrain> mniip would passing a lens as a parameter or something do what you want? i am sorry if i dont get it.
02:37 <erisco> sounds like ZipList
02:37 <turnage> Welkin: oohhhh it's because they lead in with "question"
02:37 <turnage> gotcha
02:37 ptvirgo joined
02:37 <LordBrain> mniip, am i right in assuming you want to avoid a type class?
02:38 <mniip> Daniel Fridlender and Mia Indrika (2000)
02:38 <mniip> https://www.cambridge.org/core/services/aop-cambridge-core/content/view/S0956796800003658
02:38 <erisco> a type family is a possible solution to the problem stated
02:39 <mniip> erisco, could you expand?
02:39 hexagoxel joined
02:39 <glguy> mniip: Why does it need to be specific to being a type constructor? Perhaps you can have a type family that projects the "index" type from whatever type the user is choosing?
02:39 dfordivam joined
02:39 <erisco> glguy and I are saying the same thing
02:39 <mniip> uhhh
02:40 <mniip> not quire sure how that would work
02:40 <LordBrain> if you use a type family tho, they have to have instances declared of course
02:40 <erisco> mniip, what is the kind of your type constructors?
02:40 <glguy> mniip: Do you have an example of what you're trying to do without the flexibility you want in the indexes of your types?
02:40 <mniip> my function is 'forall (p :: Nat -> *)'
02:40 <Welkin> mniip: wtf? "Unfortunately you do not have access to this content, please use the Get access link below for information on how to access this content."
02:41 <Welkin> is there a non-paywalled version?
02:41 <erisco> I am not sure how that constitutes a function
02:41 <erisco> or you're saying that your type constructors have kind Nat -> * ?
02:41 <mniip> Welkin, https://scholar.google.com/scholar?hl=en&q=do+we+need+dependent+types
02:41 thallada joined
02:41 <mniip> does this help?
02:41 <mniip> erisco, glguy, induce :: KnownNat m => (forall n. KnownNat n => p n -> p (1 + n)) -> p 0 -> p m
02:42 <mniip> this, however, implies that the Nat is the last argument to the tycon
02:42 <glguy> (reminder: being a type constructor has nothing to do with kinds)
02:42 <mniip> which is not always the case
02:42 <LordBrain> mniip, they want $35
02:42 <LordBrain> including your second link
02:43 <erisco> mniip, is there a fixed arity for the constructors?
02:43 <MarcelineVQ> LordBrain: 2nd leads to https://pdfs.semanticscholar.org/7e66/7dd0515e4f674e42c0b0860644fee3dd5846.pdf
02:44 <mniip> sigh, Welkin LordBrain http://tcpst.net/pf6v.pdf
02:44 <LordBrain> alright that works
02:44 <glguy> mniip: OK, so you want something like: induce :: KnownNat m => (forall n. KnownNat n => SetIx p n -> SetIx p (1 + n)) -> SetIx p 0 -> SetIx p m -- where SetIx is a type family that takes a some 'p' and sets it's "index" to the given Nat?
02:44 <glguy> (a proxy argument would be needed there to disambiguate p and m and n
02:45 <mniip> yeah that sounds like a lot of problems
02:45 <glguy> Problems are the name of the game when you start getting this clever!
02:45 <mniip> because SetIx needs to be injective
02:45 <mniip> and it isn't
02:45 <mniip> it is type C injective which is unsupported
02:46 <glguy> Why would it need to be injective?
02:46 <mniip> to disambiguate m,n?
02:46 <glguy> You just add proxy arguments
02:46 <mniip> yeaa
02:46 <erisco> there is this, and there is the other thing I said
02:46 <erisco> which is to just use newtypes
02:46 <mniip> yes
02:47 <mniip> newtypes is the default solution
02:47 <mniip> if I don't find a better one
02:48 tromp joined
02:48 Xanather joined
02:49 uglyfigurine joined
02:51 xcmw joined
02:52 <mniip> I think I did it
02:53 <athan> Hey all, has anyone been getting 443's when running `stack upgrade --git`? This is in a fresh install
02:53 <athan> so no dependencies exist, and it's failing when fetching base-compat from fpcomplete's s3 clone
02:54 rkazak joined
02:54 <athan> here's a paste of the log http://lpaste.net/8814933119590203392
02:55 <erisco> mniip, why is my experience of that feeling usually followed by disappointment
02:56 <mniip> yeah no
02:56 <mniip> I did not do it
02:56 <LordBrain> lol
02:56 <mniip> only for the second parameter
02:56 <mniip> it did not magically expand for arbitrary n
02:57 mmachenry joined
02:58 jer1 joined
02:58 filterfish joined
02:59 eacameron joined
02:59 pavonia joined
03:01 AntiSpamMeta joined
03:02 rcschm joined
03:05 sleffy joined
03:05 ofdm joined
03:05 sproingie joined
03:08 ridho joined
03:09 andyhuzhill joined
03:13 SeMas joined
03:16 meba joined
03:17 takle joined
03:17 splanch joined
03:17 fosterite joined
03:23 matthewbauer joined
03:24 northfurr joined
03:25 jer1 joined
03:26 <Lokathor> any gl experts about? I'm trying to convert this program https://learnopengl.com/code_viewer.php?code=getting-started/hellotriangle and my work so far is here: https://github.com/Lokathor/learnopengl/blob/master/app/Lesson02.hs
03:26 louispan joined
03:26 <Lokathor> it shows the colored window, but not the triangle.
03:27 <mniip> hm
03:28 LuckyRawApe joined
03:28 <mniip> been a while since I've been writing out types (kinds) on paper haha
03:28 ^bschafer1 joined
03:30 LordBrain joined
03:30 peterhil joined
03:31 iqubic joined
03:33 <mniip> FlipT :: (m -> *) -> l -> (k -> l -> m) -> k -> *
03:33 <mniip> exciting
03:34 <erisco> I kind of want a class where I know the zero
03:34 <iqubic> How GHC be written in Haskell. How would you compile it the first time?
03:34 <erisco> I guess that can just be Eq1 m, MonadPlus m
03:34 <Lokathor> iqubic, you compile the next version with the previous version
03:34 <erisco> but equality here is kinda meh
03:35 <erisco> it is too strong, certainly
03:35 <matthewbauer> iqubic: https://en.wikipedia.org/wiki/Self-hosting
03:35 takle joined
03:36 <erisco> Maybe (a -> a) it is easy to determine the zero
03:37 <erisco> all I get is z <> x = x and x <> z = x but this isn't telling me enough
03:37 robotroll joined
03:37 <erisco> because I can't observe what it reduced to either
03:38 <iqubic> Lokathor: That's well and fine. Now, how was the very first version of GHC compiled?
03:38 <erisco> it'd be nice to have something more elegant than class HasZero m where isZero :: m -> Bool
03:38 <davean> iqubic: with Hugs I think
03:39 <iqubic> How was Hugs compiled.
03:39 <iqubic> ?
03:39 <Lokathor> iqubic, the earliest Haskell code wasn't executed by a program written in Haskell
03:39 <iqubic> How was it executed then?
03:39 <Lokathor> Hugs was written in C (or whatever language), and it could interpret Haskell code
03:40 <davean> iqubic: this isn't really a Haskell question though. This is pretty general to any compiler
03:40 <davean> iqubic: the first compilers were hand-done in machine code (well, first assemblers really)
03:40 <iqubic> erisco: why not just write a class HasZero m where zero :: m
03:40 <davean> if you go far enough back its someone setting toggle switches on a computer
03:41 <erisco> because I want to determine if an object is the zero
03:41 <erisco> otherwise I'd just use empty/mempty/mzero
03:41 whaletechho joined
03:41 <iqubic> Oh, yeah. I think you either need a clever law or a isZero :: m -> Bool
03:42 <iqubic> Why can't use just add a constraint to the class or function you're using so you know that a zero will exist
03:43 <erisco> such as?
03:43 <iqubic> Such as Moniod m.
03:44 <erisco> knowing a zero exists is different than knowing if a particular object is the zero
03:44 <iqubic> Oh, right.
03:45 <iqubic> So I think you need a method like HasZero m :: m -> Bool
03:47 <iqubic> :t isZero (Monoid m, Equal m) :: m -> Bool; isZero m = m == empty
03:47 <lambdabot> error: parse error on input ‘;’
03:47 halogenandtoast joined
03:47 <iqubic> Something like that I'd assume
03:47 <erisco> I think there has to be a better way to formulate it
03:47 <iqubic> :t isZero m = m == empty
03:47 <lambdabot> error:
03:47 <lambdabot> parse error on input ‘=’
03:47 <lambdabot> Perhaps you need a 'let' in a 'do' block?
03:47 <iqubic> :t m == empty
03:47 <lambdabot> error:
03:47 <lambdabot> • Couldn't match expected type ‘Expr’ with actual type ‘f0 a0’
03:47 <lambdabot> • In the second argument of ‘(==)’, namely ‘empty’
03:47 <erisco> let me try and condense the pattern
03:48 <iqubic> :t (\m -> m == empty)
03:48 <lambdabot> (Alternative f, Eq (f a)) => f a -> Bool
03:48 <iqubic> That's not what I wanted. Why does it give that answer?
03:49 <iqubic> Actually, that makes perfect sense.
03:49 <iqubic> :t (\m -> m == mempty)
03:49 <lambdabot> (Monoid a, Eq a) => a -> Bool
03:49 <mniip> hahahaha
03:49 <mniip> unlimited power
03:49 <iqubic> That's also a way to write it.
03:50 <mniip> check this out
03:50 <iqubic> mniip: What do you want to show me?
03:50 <mniip> @define data A = A; data B = B; data C = C; data D = D; data E = E
03:50 <lambdabot> Defined.
03:50 <mniip> @define data FlipC (b :: l) (f :: k -> l -> *) (a :: k) = FlipC (f a b)
03:50 <lambdabot> Defined.
03:50 <erisco> Eq is too strong
03:50 <mniip> @define data FlipT (c :: m -> l -> *) (b :: l) (f :: k -> m) (a :: k) = FlipT (c (f a) b)
03:50 <lambdabot> Defined.
03:50 <mniip> :t (A, B, C, D, E)
03:50 <lambdabot> (A, B, C, D, E)
03:50 <mniip> :t FlipC $ (A, B, C, D, E)
03:51 <lambdabot> FlipC E ((,,,,) A B C) D
03:51 <mniip> :t FlipT . FlipC $ (A, B, C, D, E)
03:51 <lambdabot> FlipT (FlipC E) D ((,,,,) A B) C
03:51 <mniip> :t FlipT . FlipT . FlipC $ (A, B, C, D, E)
03:51 <lambdabot> FlipT (FlipT (FlipC E) D) C ((,,,,) A) B
03:51 <mniip> :t FlipT . FlipT . FlipT . FlipC $ (A, B, C, D, E)
03:51 <lambdabot> FlipT (FlipT (FlipT (FlipC E) D) C) B (,,,,) A
03:51 <iqubic> mniip: What is the point of that?
03:51 <mniip> 1494210825 [05:33:45] <mniip> I'm writing a function that accepts an arbitrary indexed type constructor, how can I let the user decide what argument of the constructor is the index?
03:52 <iqubic> Oh. That's cool
03:52 <erisco> this is what I am working with, but it is wrong f x = g x >>= mplus y . f
03:52 <mniip> hm
03:52 jer1 joined
03:52 <mniip> FlipC = FlipT Identity
03:53 <erisco> actually no, it is this f x = (g x >>= f) `mplus` y
03:53 <mniip> it's a flippin' transformer!
03:53 louispan joined
03:53 <iqubic> erisco: Why do you need to know if something happens to be the zero?
03:54 <erisco> because this is what it begins expanding to f x = (g x >>= \x -> (g x >>= f) `mplus` y) `mplus` y
03:54 <iqubic> Also. x `mplus` empty = empty `mplus` x = x
03:54 <erisco> and this is not what I want
03:55 <iqubic> erisco: Why does it expand to that?
03:55 <erisco> that is just by substitution
03:55 <erisco> what I want is this f x = if isZero (g x) then y else g x >>= f
03:55 <iqubic> So why not use eq?
03:55 <erisco> so it is quite simple in intuition
03:55 <erisco> because Eq is too strong
03:56 <erisco> I've answered many of these things already
03:56 <iqubic> How is it too strong?
03:56 eklavya joined
03:56 <erisco> Maybe (a -> a)
03:56 <iqubic> Alright. And a can't be of type eq because...? Why not exactly?
03:56 <erisco> intuitively we are sequencing g, so g >=> g >=> g ... until we hit mzero
03:57 <erisco> after which we use y
03:57 <erisco> so it is tempting to use mplus here because we know mzero `mplus` y is y
03:57 <erisco> the problem is that if you write a definition like I did above then you get an `mplus` y at every item in the sequence, and that is wrong
03:57 <iqubic> I wish glguy or c_wraith were here to help.
03:57 <erisco> iqubic, you cannot define Eq on functions
03:58 <iqubic> erisco: That tells me why Eq is out of the picture.
03:59 felixsch__ joined
04:01 <erisco> so I need an op <+> where x <+> y = x if x /= zero and x <+> y = y if x == zero
04:01 <erisco> and it can be true on both sides, doesn't really matter
04:02 <erisco> that is as generic as I can think about it at the moment
04:03 <erisco> law 2 is given by monoid, but law 1 is not
04:03 <erisco> law 1 on both sides doesn't make sense actually
04:03 <erisco> that'd be a contradictory system :P
04:04 <erisco> so that's fine... I can define this extension to Monoid/Alternative/MonadPlus and go through all the instances and see what I can learn about it
04:05 <glguy> reminds me for logict's ifte
04:05 <glguy> http://hackage.haskell.org/package/logict-
04:06 <erisco> thanks glguy I will take a look
04:08 jer1 joined
04:09 xall joined
04:10 xienng joined
04:10 descender joined
04:11 louispan joined
04:11 sleffy joined
04:12 <lpaste> mniip pasted “FlipT” at http://lpaste.net/355313
04:12 <mniip> glguy, erisco ^ check out
04:12 brynedwardz joined
04:13 teto joined
04:13 infinity0 joined
04:14 <mniip> I don't think it's possible to generalize any further without either specializing the dependency 'induce' places on the indices or using dependent types
04:15 <mniip> this actually has good applicability
04:15 <mniip> consider e.g
04:16 <mniip> :t GHC.TypeLits.natVal
04:16 <lambdabot> GHC.TypeLits.KnownNat n => proxy n -> Integer
04:16 takle joined
04:18 <mniip> :t GHC.TypeLits.natVal . FlipT . Apply
04:18 <lambdabot> forall l (n :: GHC.Types.Nat) (f :: GHC.Types.Nat -> l -> *) (b :: l). GHC.TypeLits.KnownNat n => f n b -> Integer
04:18 <mniip> :t GHC.TypeLits.natVal . FlipT . FlipT . Apply
04:18 <lambdabot> forall l l1 (n :: GHC.Types.Nat) (f :: GHC.Types.Nat -> l -> l1 -> *) (b :: l) (b1 :: l1). GHC.TypeLits.KnownNat n => f n b b1 -> Integer
04:18 <mniip> :t GHC.TypeLits.natVal . FlipT . FlipT . FlipT . Apply
04:18 <lambdabot> forall l l1 l2 (n :: GHC.Types.Nat) (f :: GHC.Types.Nat -> l -> l1 -> l2 -> *) (b :: l) (b1 :: l1) (b2 :: l2). GHC.TypeLits.KnownNat n => f n b b1 b2 -> Integer
04:18 <mniip> etc
04:18 xall joined
04:18 dsfox1 joined
04:19 benl23 joined
04:19 <Lokathor> here's a fun little example for folks: http://lpaste.net/355314
04:19 <erisco> a pattern to bubble parameters
04:21 isenmann joined
04:22 <erisco> that does look fun mniip. I'll have to study FlipT some later
04:23 {emptyset} joined
04:26 doomlord joined
04:27 teto joined
04:27 thunderrd joined
04:31 ystael joined
04:32 codesoup joined
04:33 takle joined
04:35 teto joined
04:37 uglyfigurine joined
04:39 falafel joined
04:39 sproingie joined
04:40 indi_ joined
04:40 vlatkoB joined
04:41 xall_ joined
04:42 bshelden joined
04:42 mw joined
04:43 spacecadetbrown joined
04:44 toblorone_ joined
04:44 xall joined
04:46 <toblorone_> dumb question: I'm reading this article on automatic differentiation and I don't understand the (*) instance. They seem to be multiplying "a" with "Dif a" which shouldn't be possible... ?
04:46 <toblorone_> http://conal.net/blog/posts/beautiful-differentiation
04:46 <toblorone_> p@(D x x') * q@(D y y') = D (x * y) (x' * q + p * y')
04:46 <toblorone_> ooo
04:46 <toblorone_> nvm
04:46 <toblorone_> :^)
04:46 <geekosaur> rubber duck debugging, at your service >.>
04:47 cobreadmonster joined
04:47 <rotaerk> lol
04:48 splanch joined
04:49 featherlessbiped joined
04:50 teto joined
04:52 afarmer joined
04:53 <iqubic> Anyone here tried writting a Prolog parser in Haskell?
04:53 dcoutts joined
04:53 <toblorone_> i've wrote one years ago
04:53 louispan joined
04:54 _sras_ joined
04:55 <_sras_> How can I make a foldM call to execute operations using multiple threads?
04:55 <iqubic> Do you have the code?
04:55 <iqubic> toblorone_: Can I look at the prolog parser?
04:56 shangxiao joined
04:56 <sophiag> toblorone: i just saw your question about AD. i'm not sure if you're referring to how multiplication is overloaded for polynomials or that values need to be lifted up to the appropriate level of derivative
04:57 <toblorone_> I'm not sure I can dig up the code : ( sorry. Like i said, it was years ago :^). It should be pretty straight forward though. here's the bnf https://github.com/simonkrenger/ch.bfh.bti7064.w2013.PrologParser/blob/master/doc/prolog-bnf-grammar.txt
04:57 xtreak joined
04:57 <sophiag> if it's the latter, Barak Pearlmutter has written a great deal about it. he refers to it as "perturbation confusion." edward kmett's AD package solves that problem
04:57 treaki_ joined
04:58 <glguy> mniip: Now you need to find a way to generate the various induceN definitions given a Nat parameter
04:58 <toblorone_> sophiag: ha nothing that complicated. For some reason when i was reading the code I didn't notice that x' in x' * q was also a (Dif a) value. I immediately realized my mistake when i pasted it the channel.
04:59 <mniip> glguy, no thanks
04:59 <glguy> aw :)
04:59 <mniip> I'm not planning to include induce* functions
04:59 <iqubic> What is BNF??
04:59 <mniip> just that given wrap/unwrap the user will be able to fit 'induce' to their own constructors
04:59 <mniip> iqubic, google it
04:59 slack1256 joined
05:00 <iqubic> So for BNF grammer, I think I can just make a whole bunch of Data types.
05:00 <mniip> glguy, besides, not sure if that's possible
05:00 <mniip> there's a higher rank type involved
05:00 <mniip> practically slipping into dependent types there
05:00 <iqubic> What's a higher-ranked type?
05:00 <mniip> iqubic, google it
05:01 <toblorone_> iqubic: Yeah, you can basically make a bunch of data types directly corresponding to each line of the BNF file and use something like parsec which more or less directly translates to bnf
05:02 <iqubic> I need ot learn how to use parsec.
05:02 <toblorone_> ah
05:02 <toblorone_> ok
05:02 <iqubic> s/ot/to
05:02 <toblorone_> well its well worth learning
05:02 <iqubic> Anyone know of a good parsec tutorial?
05:03 xall joined
05:03 <toblorone_> this might work? https://www.schoolofhaskell.com/school/starting-with-haskell/libraries-and-frameworks/text-manipulation/attoparsec
05:03 <mniip> that's attoparsec
05:03 <mniip> a slightly different library
05:03 <toblorone_> yeah
05:03 <iqubic> Should I learn both. Or just one?
05:04 <glguy> The first step is to learn any parser combinators library at all, there's a theme to them all
05:04 <ReinH> They're similar enough that you can learn both at the same time
05:04 <toblorone_> i usually (always?) have used attoparsec...
05:04 <glguy> after that you can learn the differences
05:04 <mniip> that much is correct
05:04 <mniip> does attoparsec have explicit backtrack too?
05:05 <ReinH> attoparsec always backtracks
05:05 <ReinH> i.e.., try is immplied
05:05 <ReinH> implied
05:05 jer1 joined
05:06 <glguy> If the first operand of a <|> succeeds, it won't backtrack to the second branch, however, even if there's a failure in the future
05:06 <glguy> so it's not complete backtracking
05:06 <mniip> well then
05:06 <mniip> it's a significant difference
05:07 <ReinH> Just use try everywhere :p
05:07 <iqubic> What tutorial should I use?
05:07 <ReinH> glguy: I guess I expected "always" to be interpreted as "when useful" ;)
05:08 <glguy> Just distinguishing it from something like []
05:08 <ReinH> Any of these should be good https://www.google.com/search?q=haskell+parsec+tutorial
05:09 <ReinH> glguy: fair enough
05:09 <toblorone_> iqubic: if you have a good grasp on monads and applicative then it should be pretty quick to learn
05:09 <ReinH> I should have said that it automatically backtracks
05:10 <toblorone_> and if not its a good way to learn applicative style
05:11 <mniip> glguy, so it acts like Yoctoparsec Maybe then?
05:11 v0latil3 joined
05:13 dec0n joined
05:13 <glguy> Yeah, that appears to be the case
05:14 <iqubic> toblorone_: I know monads and applicatives quite well.
05:14 <toblorone_> great, so learning parsec should be a breeze then
05:15 <glguy> mniip: Is Yocto- the smallest modifier?
05:15 <mniip> yes I think
05:15 <mniip> do you think you can write something an order of magnitude smaller?
05:16 <glguy> That was nice of bos to leave room under Zepto
05:17 <glguy> smaller? Nothing comes to mind at the moment :)
05:17 louispan joined
05:17 <mniip> you'll have to fit in 0.5 lines
05:18 <glguy> so that's about 40 characters?
05:18 exferenceBot joined
05:18 <mniip> if we're counting characters then
05:19 <glguy> I'm wondering what we'd have to do to justify a kiloparsec
05:19 jer1 joined
05:19 <mniip> you have about 99
05:19 <mniip> err
05:19 <mniip> you have about 19
05:20 osa1 joined
05:20 osa1 joined
05:20 xall joined
05:20 <mniip> 'type P b t a=[t]->b a' is 21 chars
05:21 <mniip> and then the only combinators you get for "free" is composition
05:21 wilkie1 joined
05:21 <mniip> a hardly useful composition at that
05:25 xall_ joined
05:25 <ReinH> mniip: that's just about long enough to import Parsec ;)
05:27 <mniip> hahahhaha
05:31 uglyfigurine joined
05:31 louispan joined
05:33 jutaro joined
05:33 sz0 joined
05:35 teto joined
05:37 xall joined
05:37 tristanp joined
05:39 Gurkenglas joined
05:40 <ReinH> you import free monads, which basically write your whole library for you, so
05:40 <ReinH> I may not know what free monads are
05:40 torstein joined
05:41 <Lokathor> Free Monads are magic runes that you scribe on your broom to make it into a flying broom
05:41 <glguy> Don't miss out of free applicatives
05:44 takle joined
05:45 NilsHitze joined
05:46 jgertm joined
05:46 fre joined
05:48 splanch joined
05:49 xall joined
05:50 _sg joined
05:50 soniku joined
05:52 conal joined
05:56 dm3 joined
05:57 takle joined
05:57 kamyar joined
05:57 <kamyar> Hello all
05:57 <kamyar> I need some guide about Reader monad
05:58 <turnage> what's the q mate
05:58 juhp joined
05:59 ogrady joined
05:59 t joined
05:59 <kamyar> I have a service application that I want to read configuration from a YAML file
05:59 <Guest84872> what magic incantation does one use to get haddock to produce this sort of output: http://hackage.haskell.org/package/th-abstraction-
06:00 <kamyar> I want to read yaml file into a record just once and then use the variable to read config anywhere
06:00 systadmin joined
06:00 <kamyar> I dont want to send the variable to any of my functions
06:00 <kamyar> instead I want a way for my modules to access config variable
06:00 <kamyar> Is Reader monad appropriate for this ?
06:01 <osa1> kamyar: yes
06:01 <c_wraith> Guest84872: add --hyperlink-source to the haddock command
06:01 danvet joined
06:01 jer1 joined
06:01 <kamyar> So, Is the answer is yes, I am confused about reading YAML and integrating it with Reader monad
06:01 asjo joined
06:01 <Guest84872> c_wraith: I tried that. It doesn't get me that level of source annotation
06:02 <kamyar> I have read reader and YAML samples
06:02 <kamyar> But I cant mix them up
06:02 _sras_ joined
06:02 <c_wraith> Guest84872: huh. don't know then. I haven't worried about that much in my own stuff.
06:02 <cocreature> Guest84872: --hyperlinked-source is the fancy output iirc
06:02 <osa1> kamyar: once you read the YAML into the format you like you do something like `runReaderT <your reader action> <your data parsed from YAML>`
06:03 <_sras_> How can I make a foldM to run in multiple threads?
06:03 <cocreature> the names of those options are terrible
06:03 <Guest84872> Just --hyperlinked-source gets me this sort of output: http://hackage.haskell.org/package/di-0.1/docs/src/Di.html#Di
06:03 <Guest84872> c_wraith: but the one I linked first is one level further up
06:03 <cocreature> Guest84872: which version of haddock do you have?
06:03 chinaxing joined
06:03 ThomasLocke joined
06:03 <kamyar> osa1: 1) Where should I put this line? In which function with what signature?
06:03 <Guest84872> c_wraith: with the source itself hyperlinked (not just coloured)
06:04 <kamyar> osa1: 2) What is my reader action?
06:05 <cocreature> Guest84872: also --hyperlinked-source as a flag that needs to be passed to "haddock" itself not to "cabal haddock". you can pass --haddock-options=--hyperlinked-source to cabal
06:05 <Guest84872> cocreature: I ran it precisely like this: cabal haddock --haddock-option=--hyperlinked-source
06:06 <Guest84872> cocreature: still didn't get the fancy output!
06:06 <cocreature> Guest84872: which version of haddock are you using?
06:06 <cocreature> that’s a relatively new feature
06:06 <Lokathor> _sras_, http://chimera.labs.oreilly.com/books/1230000000929/ch02.html
06:06 <cocreature> also there might be a difference between --haddock-option and --haddock-options so try the latter one as well
06:06 <glguy> Guest84872: Neat, you found my package :)
06:07 <osa1> kamyar: http://lpaste.net/355320
06:07 <glguy> Guest84872: This is my documentation upload process: https://github.com/ekmett/lens/blob/master/scripts/hackage-docs.sh
06:08 <cocreature> _sras_: fold is inherently sequential so I’m not sure what you expect to parallelize here
06:08 <kamyar> osa1: Great thanx!
06:08 hurkan joined
06:09 quchen joined
06:11 <mniip> cocreature, o/
06:11 <_sras_> cocreature: Oh. yes.
06:11 ^bschafer1 joined
06:11 <Guest84872> glguy: excellent script. thanks!
06:11 <cocreature> mniip: \o
06:11 mjora7 joined
06:11 Gurkenglas joined
06:12 <_sras_> cocreature: What about mapM_?
06:12 <Lokathor> _sras_, you can make mapM run in parallel easily, that link i gave will explain it all from bottom to top
06:12 <cocreature> _sras_: https://hackage.haskell.org/package/async-
06:12 louispan joined
06:13 xall_ joined
06:13 conal joined
06:14 <kamyar> osa1: Is f what I should call from other modules to read config?
06:14 teto joined
06:14 <osa1> kamyar: no f is the function that can read config using `MonadReader` methods (`ask`)
06:14 <dmj`> cocreature++, and forConcurrently_
06:14 <osa1> kamyar: you can call other functions with the same `MonadReader` constraint from that function
06:15 <kamyar> osa1: Cant understand ! What should I do in it?
06:15 zeroed joined
06:16 <kamyar> osa1: You mean m?
06:16 <kamyar> You mean MOnadReader helps other functions e able to read data from config variable (YAMLDAta)
06:16 <kamyar> osa1: You mean MOnadReader helps other functions e able to read data from config variable (YAMLDAta)
06:17 Xanather joined
06:17 <kamyar> osa1: I dont want to change all functions signature!
06:17 <glguy> On the topic of configuration files I've been working on this package this weekend: http://hackage.haskell.org/package/config-schema
06:17 <Lokathor> kamyar, you've gotta have a MonadReader constraint on a function for it to benefit from Reader stuff
06:18 <Lokathor> kamyar, otherwise you have to pass in the argument manually
06:18 <kamyar> Lokathor: Oh ok! But anyway I have to change my whole code! Is there a better way?
06:18 jer1 joined
06:19 <Lokathor> kamyar, sorry, but not really. part of Functional Programming means that functions are only working with the arguments you pass them
06:19 filterfish_ joined
06:19 Uakh_ joined
06:19 <Lokathor> the MonadReader stuff just hides away some of what's going on, but it's passing around the "reader" value in the background
06:19 kwantam1 joined
06:19 tv1 joined
06:19 davean1 joined
06:19 cdornan_ joined
06:19 Profpats1 joined
06:19 commiefornia joined
06:19 Riviera__ joined
06:19 brynedwards joined
06:19 featherlessbiped joined
06:19 ofdm joined
06:19 halogenandtoast joined
06:19 redcedar joined
06:19 sw1nn joined
06:19 lsbn__ joined
06:19 redcedar joined
06:19 MP2E joined
06:19 Guest37310 joined
06:19 ego joined
06:19 vlatkoB joined
06:19 Costar joined
06:19 ridho joined
06:19 acarrico joined
06:19 ThomasLocke joined
06:19 ThomasLocke joined
06:19 CurryWurst_ joined
06:19 darjeeling_ joined
06:19 <kamyar> Lokathor: Yes u r right! Otherwise we are denying referential transparency
06:19 quchen joined
06:19 jo`ve joined
06:19 jo`ve joined
06:19 Cir0X joined
06:19 ^bschafer1 joined
06:19 jle` joined
06:19 zero_byte joined
06:19 jle` joined
06:19 nakal joined
06:19 descender joined
06:20 uuplusu joined
06:20 thallada joined
06:20 Nikotiini joined
06:20 sz0 joined
06:20 sivs joined
06:21 dmj` joined
06:21 infinity0 joined
06:21 ptvirgo joined
06:21 Argue joined
06:21 CARAM__ joined
06:22 <kamyar> osa1: So what should I write instead of undefined in f?
06:22 justan0theruser joined
06:22 <mniip> glguy, erisco I just realized there's more
06:22 splanch joined
06:23 atk joined
06:23 markus1189 joined
06:23 <mniip> :t natVal . FlipT . Apply
06:23 Mortomes|Work joined
06:23 <lambdabot> forall l (n :: Nat) (f :: Nat -> l -> GHC.Types.*) (b :: l). KnownNat n => f n b -> Integer
06:23 <mniip> :t natVal . Compose . FlipT . Apply
06:23 mmmrrr[m] joined
06:23 roadrunner168[m] joined
06:23 <lambdabot> forall k1 l (n :: Nat) (g :: Nat -> k1) (f :: k1 -> l -> GHC.Types.*) (b :: l). KnownNat n => f (g n) b -> Integer
06:23 colton[m] joined
06:23 crosleyt joined
06:24 <mniip> :t natVal . FlipT . Apply . Compose . FlipT . Apply
06:24 <lambdabot> error:
06:24 <lambdabot> • Couldn't match kind ‘l -> k1’ with ‘Nat’
06:24 <lambdabot> When matching the kind of ‘FlipT
06:24 <mniip> oop
06:24 zar[m] joined
06:24 Yves[m]1 joined
06:24 jacqueline[m] joined
06:24 hendrik[m] joined
06:24 <mniip> ah I guess you can't do that
06:24 Lex[m]1 joined
06:24 Adios joined
06:24 <mniip> ah you don't need Apply and it has the wrong kind
06:25 <mniip> :t natVal . FlipT . Compose . FlipT . Apply
06:25 <lambdabot> forall l k1 l1 (n :: Nat) (f :: Nat -> l -> k1) (b :: l) (f1 :: k1 -> l1 -> GHC.Types.*) (b1 :: l1). KnownNat n => f1 (f n b) b1 -> Integer
06:26 <glguy> No arguments are safe from your reach!
06:26 <kamyar> PLease help I am confused
06:26 <mniip> well some are safe
06:26 bvad joined
06:26 louispan joined
06:26 davidar joined
06:27 <mniip> I don't immediately see a way to feed 'Maybe Int' into a function accepting 'forall (p :: (* -> *) -> *). p m'
06:27 <mniip> i.e how to turn Maybe Int into '_ Maybe'
06:28 <Lokathor> kamyar, http://lpaste.net/355321 here's an example of how you might do it
06:28 <Lokathor> normally, MonadReader isn't too helpful
06:28 <Lokathor> you might use something like, doThing :: (MonadReader m, MonadIO m) => m ()
06:28 <Lokathor> then your doThing action can use the reader context, and also perform IO actions
06:29 codesoup joined
06:29 SeMas joined
06:29 louispan joined
06:29 <mniip> glguy, ha
06:29 <mniip> I take that back
06:29 <mniip> FlipT . Apply . Apply
06:29 peterhil joined
06:29 tromp joined
06:29 <mniip> a b -> FlipT Apply b Apply a
06:31 simukis joined
06:31 <kamyar> Lokathor: So again I am sending the config to needing function!
06:31 <kamyar> Lokathor: What is reader monad doing>
06:31 <kamyar> Lokathor: How it helps?
06:31 takuan joined
06:32 <glguy> The Reader type is just a function. There's no magic
06:32 peterhil joined
06:32 <Lokathor> If you stick a MonadReader constraint on your operations, you can forget about who needs the context specificly and who does not. it'll always be in the background when you do need it
06:32 conal joined
06:32 <Lokathor> it only really helps if you have deep layers of calls and returns, and not all the layers use the context
06:32 alfredo joined
06:33 <Lokathor> if you're not fully comfortable with it, i'd just pass whatever variable around explicitly
06:33 Sh4rPEYE joined
06:33 <kamyar> Lokathor: Thanks! Yes passing variable may be enough but I wanted to use this opportunity to understand Reader monad!
06:34 <Sh4rPEYE> Hello. How one implement this for "an arbitrary number of generations"?
06:34 <Sh4rPEYE> https://en.wikibooks.org/wiki/Haskell/Understanding_monads/List#Bunny_invasion
06:34 <Lokathor> sadly it's not too useful on its own
06:34 <Sh4rPEYE> It's a simple monad exercise, but I cannot deal with it
06:35 mmn80 joined
06:36 <Sh4rPEYE> They want me to use some of the Monad function, and that's the problem I have with it...
06:36 <cocreature> Sh4rPEYE: so you’re having trouble with implementing "themselvesTimes"?
06:36 tim_ joined
06:37 heurist joined
06:38 insitu joined
06:38 <Sh4rPEYE> cocreature: No, the bunny invasion. For an arbitrary number of generations. The link I posted is info about bunnies, the exercise itself is defined here:
06:38 <Sh4rPEYE> https://en.wikibooks.org/wiki/Haskell/Understanding_monads/IO#Monadic_control_structures
06:39 <cocreature> Sh4rPEYE: I think I don’t really understand the exercise. are you just supposed to take the number of generations as a parameter instead of leaving it at 3?
06:39 yoneda joined
06:41 <Sh4rPEYE> cocreature: I think the "reproduction rate" stays at 3. The number of generations is rather the number of bunnies after certain time... Say, gen 1 you have 1 Bunny, gen 2 you have three, gen 3 you have 9 (because each of those three had 3 kits), gen 4 you have 27 etc
06:41 <Sh4rPEYE> It'd look like this: bunnyGen' n = print $ concat $ replicate n $ ["bunny"] >>= generation
06:42 <cocreature> ah ok
06:42 <Sh4rPEYE> where generation = replicate 3
06:42 teto joined
06:42 fluffystub joined
06:42 <Sh4rPEYE> But I can't figure out what standard functions (forM/replicateM...) am I supposed to use here
06:43 yourname1 joined
06:43 mbuf joined
06:43 davidomanfredo joined
06:44 <yourname1> script load trackbar22
06:45 <cocreature> Sh4rPEYE: I think you’re just supposed to use recursion here tbh
06:45 jer1 joined
06:45 <Sh4rPEYE> as in go n and then call go (n - 1) etc? Maybe, yes
06:45 <cocreature> yep
06:46 <Sh4rPEYE> Doesn't make too much sense in IO chapter though
06:47 davidomanfredo left
06:49 mfukar joined
06:49 ertes-w joined
06:50 angerman joined
06:50 teto joined
06:51 <cocreature> Sh4rPEYE: try writing a function of type "iterateN :: Monad m => Int -> (a -> m a) -> m a -> m a". you should then be able to use that to solve your problem
06:51 louispan joined
06:52 soniku joined
06:52 <Lokathor> http://stackoverflow.com/a/43840223/455232 someone figured it out :3
06:53 eklavya joined
06:56 andyhuzhill1 joined
06:58 andyhuzhill joined
06:59 Swizec joined
06:59 nickolay joined
07:00 albel727 joined
07:00 ragepandemic joined
07:02 primal joined
07:03 <sophiag> i'm sure people ask this all the time, but there's no language pragma DeriveApplicative?
07:04 <mniip> that's quite hard to do and the result is not always unique
07:05 <mniip> there's an infinite amount of ways to write Applicative [] and I'm not sure whether it's countable
07:05 <sophiag> but not the case with regular functors i guess
07:05 <mniip> fmaps (assuming laws) are unique
07:06 <mniip> fmaps without laws were discussed here the other day - turns out you can only define an invalid fmap if you can factor out a '+1' somewhere in the algebraic type
07:06 <sophiag> most of the time i just end up writing pure = pure, <*> = ap
07:06 <mniip> (well, that was a conjecture)
07:06 <mniip> pure=return you mean?
07:06 <sophiag> ah right
07:07 <toblorone_> dumb question: is haskell able to cache values from infinite lists? For example, if i ran this program with the inputs "0 0" would it recalculate the vaiues twice? http://lpaste.net/355322
07:07 cdepillabout joined
07:07 <mniip> toblorone_, by2,by3,lists are all only computed once
07:07 <sophiag> i'm not sure what you mean by "factor out"
07:08 louispan joined
07:08 <toblorone_> cool
07:08 <mniip> sophiag, use distributive (and other) laws of the type algebra
07:08 <mniip> e.g, Maybe a = 1 + a -- counts
07:09 <mniip> Pair a = a + a = (1 + 1) * a -- counts
07:09 xall_ joined
07:09 <mniip> Const Int a = 1 + 1 + 1 ... + 1 -- counts
07:10 <mniip> (a, b) = a * b -- can't do anything
07:10 <sophiag> so you mean literally any sum type?
07:10 <mniip> Pair isn't a sum type
07:10 <sophiag> i know
07:10 <mniip> Either is a sum type but you can't factor a +1
07:10 <sophiag> the more interesting part is thinking of instances of product types where you could factor something out
07:10 primal joined
07:10 <sophiag> oh a + 1 i see
07:11 <mniip> I have a more categorical formulation
07:11 <sophiag> so Maybe counts because Nothing has an implicit unit?
07:11 <mniip> can you write a non-identity natural transformation?
07:11 thc202 joined
07:11 <sophiag> idk
07:11 <mniip> that's the criterion
07:12 <sophiag> oh i see
07:13 <sophiag> i'm not sure how to determine when that's the case, but it makes sense as the criterion for ambiguity in the instance
07:13 primal joined
07:13 <ertes-w> helo
07:14 <mniip> ehlo
07:14 <Hafydd> hole
07:14 primal joined
07:14 <mniip> sophiag, byorgey came up with the idea of the +1, and I think they're equivalent to the NT definition
07:14 PennyNeko joined
07:15 <mniip> and the NT definition comes directly from the free theorem of any fmap factoring into a natural transformation + real fmap
07:15 <glguy> mniip: how about a*a
07:15 vlatkoB_ joined
07:15 <glguy> did that get covered above?
07:15 BartAdv joined
07:15 refold joined
07:15 <mniip> glguy, like I said a^(1+1)
07:15 cur8or joined
07:15 <mniip> oh, I mistakedly said (1+1)*a
07:17 sproingie joined
07:17 sproingie joined
07:18 <sophiag> ah ok. i'm starting to get it
07:18 mattyw joined
07:20 andyhuzhill1 joined
07:20 uglyfigurine joined
07:20 ertes joined
07:21 uglyfigurine joined
07:22 jer1 joined
07:23 akfp joined
07:24 Levex joined
07:24 <akfp> if I have an arbitrary number of `Gen Text` (Gen from quickcheck) and I want to mappend them, how do I lift the (<>) operator?
07:25 gehmehgeh joined
07:26 <opqdonut> liftM2, Gen is a Monad
07:26 <cocreature> :t fmap mconcat . sequence -- akfp
07:26 <lambdabot> (Monad f, Monoid b) => [f b] -> f b
07:26 <opqdonut> if it's a [Gen Text], you want something like liftM mconcat . sequence
07:26 <opqdonut> yeah
07:27 juhp joined
07:27 <mniip> oh no :(
07:27 <mniip> writing show instance by hand
07:27 teto joined
07:27 <mrkgnao> "how many layers of law-breaking are you on?"
07:28 <mniip> one too many
07:28 <cocreature> mniip: TH your way to glory :)
07:28 <mniip> it's a polykinded gadt
07:28 <mniip> and unsafeCoerce is 10 lines away
07:28 <mniip> *and* it involved ghc typelits
07:28 mstruebing joined
07:29 <mniip> wait
07:29 <mniip> you *can* write Show for this
07:30 <mniip> can't you
07:30 <akfp> thanks!
07:31 seanparsons joined
07:31 oish joined
07:31 <mniip> rip
07:32 <mniip> it's not possible without impredicative
07:32 augur joined
07:33 <quchen> Booo liftM*
07:33 <quchen> Use fmap instead of liftM
07:33 <quchen> Use liftA2 instead of liftM2
07:34 CoderPuppy joined
07:36 razi1 joined
07:38 lavalike joined
07:38 ventonegro joined
07:39 <mniip> • Couldn't match type ‘(1 + k0) + (b * n0)’
07:39 <mniip> with ‘(1 + n2) + (b * n1)’
07:39 <mniip> hello there!
07:39 albertid joined
07:41 eklavya joined
07:43 louispan joined
07:45 connrs joined
07:45 Levex joined
07:46 ilyaigpetrov joined
07:47 iliastsi joined
07:50 soLucien joined
07:50 teto joined
07:52 coot joined
07:53 mjora7 joined
07:55 coot joined
07:58 acidjnk22 joined
07:59 jer1 joined
08:00 jeltsch joined
08:02 dm3 joined
08:05 michaelw joined
08:05 juhp joined
08:05 Nik05 joined
08:05 bennofs joined
08:08 tesan joined
08:08 Swizec joined
08:09 jutaro joined
08:09 Swizec joined
08:09 augur joined
08:10 Swizec joined
08:10 geekosaur joined
08:11 <tesan> Heya... I started with the simple hello world tutorial from the stackoverflow documentation... and I ran across something that seems curious...
08:11 Swizec joined
08:11 Swizec joined
08:11 geekosaur joined
08:11 <tesan> When compiling main :: IO () (and in another line) main = putStrLn "Hello World!" everything works fine... but in the GHCi, the first line will cause a "main not in scope".
08:12 <bennofs> tesan: GHCi does not really support multi-line input
08:12 yellowj joined
08:12 dec0n joined
08:12 <tesan> So the tutorial is totally legit and it's only repl related?
08:13 takle joined
08:13 <bennofs> tesan: yes
08:13 <bennofs> tesan: i recommend using a file and loading that in GHCi for anything that is not just `1 + 1` or calling a function
08:14 oisdk joined
08:14 xcmw joined
08:14 <tesan> bennofs: Thank you. (Also, do you recommend any haskell page to start learning other than stackoverflow: docs ?)
08:14 <bennofs> tesan: if you still want to define something in GHCi, you have to use let, like: let main :: IO (); main = putStrLn "hello world"
08:15 tomphp joined
08:15 <tesan> bennofs: Ohh I see, so logical ; separation works here too... thanks again.
08:15 xtreak joined
08:16 tromp joined
08:17 geekosaur joined
08:17 jer1 joined
08:18 xtreak joined
08:18 mbrcknl joined
08:18 meba joined
08:19 <ReinH> tesan: you can consider ghci to be like operating inside an IO monad do block
08:19 <ReinH> so bindings require a let
08:19 binaryplease joined
08:19 andyhuzhill1 joined
08:20 <ReinH> and you are already at the value level, so type signatures aren't allowed
08:20 <bennofs> tesan: I've seen some people recommend http://www.seas.upenn.edu/~cis194/spring13/lectures.html, but I haven't read that one myself. I used http://learnyouahaskell.com/chapters and thought it was great, but it doesn't really teach you how to write "real" programs (very little focus on IO)
08:20 insitu joined
08:21 <ReinH> combine that with the fact that each line is executed by itself and that's pretty much everything you need to know about ghci to get stuff done
08:21 <mniip> type signatures are allowed though,
08:21 <mniip> f :: Int; f = 3
08:21 <mniip> the problem is the single line thing
08:21 raichoo joined
08:21 Kristof_HT joined
08:22 <mniip> also there's :{ :} or some such
08:22 takle joined
08:22 <ReinH> mniip: well that's weird
08:22 <ReinH> and that also binds f without requiring a let
08:22 uglyfigurine joined
08:22 Itkovian joined
08:22 <mniip> new ghci doesn't require a let
08:22 <ReinH> I think I'd be happier if ghci didn't cheat as much
08:22 <ReinH> huh
08:22 <ReinH> welp
08:23 <mniip> modern ghci is actually trying not to be a pile of hacks
08:23 <mniip> every line gets compiled into its own module
08:23 <ReinH> I wonder if they rewrote the manual to indicate that ghci isn't really that much like an IO do block any more
08:23 sepp2k joined
08:23 splanch joined
08:24 <ReinH> it used to basically just say that and then decribe all the special cases that made it not like a do block
08:24 <ReinH> *describe
08:24 jgertm joined
08:24 alfredo joined
08:24 <mniip> well now I think being a do block *is* the special case
08:24 <tesan> bennofs: Thanks for the book recommendations. Ohh and btw... as I am a starter, the word "monad" shouldn't have much meaning to me... [I heard it, and that's all. I saw it in something that looked like an import statement to me]
08:25 <mniip> 'pat <- exp' is special syntax, and IO expressions are simply executed
08:25 <ReinH> Well, it still says "The syntax of a statement accepted at the GHCi prompt is exactly the same as the syntax of a statement in a Haskell do expression."
08:25 <mniip> oh man I remember the code related to 'pat <- exp'
08:25 <ReinH> so...
08:25 <mniip> it's not good
08:25 <Rembane> mniip: Is it still there?
08:26 <mniip> yes
08:26 <mniip> basically it rewrites the code to match that, and then return a list of bound variables
08:26 geekosaur joined
08:26 <Rembane> Nice hack! :D
08:26 <mniip> the code is then compiled and run, and the list is then rtti'd
08:26 <mniip> and manually exposed in the scope
08:27 <mniip> you can actually see it
08:28 <ReinH> I think maybe "exactly the same" is a bit misleading...
08:28 <ReinH> It is exactly the same, except for a number of ways in which it is not.
08:29 andyhuzhill1 joined
08:29 <mniip> :set -ddump-ds
08:29 <mniip> if you read core
08:30 splanch joined
08:30 hurkan left
08:31 lep-delete joined
08:31 <mniip> 'x:xs <- ...' -> case ds_d1c5 of (x_a1by:xs_a1bz) -> returnIO [unsafeCoerce# x_a1by :: (), unsafeCoerce# xs_a1bz :: ()]
08:31 MrWoohoo joined
08:31 Levex joined
08:32 <ReinH> that seems fine
08:32 <mniip> well yes
08:32 <mniip> ghci has no interaction with compiled code other than HValues
08:32 splanch_ joined
08:33 <quchen> mniip: Counterexample, GHCi allows »foo = 4« as a statement, while do-notation does not.
08:33 <mniip> () is a weird choice to coerce to though
08:33 <quchen> GHCi also allows let…in expressions, which do-notation does not.
08:33 <mniip> quchen, is that addressed at me
08:34 insitu joined
08:34 <quchen> At the »GHCi is an IO do block« discussion.
08:34 <quchen> So yes.
08:34 <mniip> I said the opposite
08:35 <quchen> Oh.
08:35 <mniip> btw quchen, have you seen the fancy flip transformer
08:35 <ReinH> quchen: I was operating on outdated info
08:36 <mniip> quchen, http://lpaste.net/355313
08:37 Itkovian joined
08:39 jer1 joined
08:39 gmcabrita joined
08:40 iulian joined
08:41 twanvl joined
08:41 louispan joined
08:42 pie_ joined
08:44 <quchen> mniip: uUuuuhgh
08:44 <mniip> :t natVal
08:44 <lambdabot> KnownNat n => proxy n -> Integer
08:44 <mniip> :t natVal . FlipT . Apply
08:44 <lambdabot> forall l (n :: Nat) (f :: Nat -> l -> GHC.Types.*) (b :: l). KnownNat n => f n b -> Integer
08:44 <mniip> :t natVal . FlipT . FlipT . Apply
08:44 <lambdabot> forall l l1 (n :: Nat) (f :: Nat -> l -> l1 -> GHC.Types.*) (b :: l) (b1 :: l1). KnownNat n => f n b b1 -> Integer
08:44 <mniip> stuff like this
08:46 sfcg joined
08:46 <quchen> Reminds me of how Java looks like when making an attempt at functional programming
08:47 <quchen> Is that the induction principle on Nath
08:47 <quchen> Nat*
08:47 <quchen> ?
08:47 <quchen> That one: ind-ℕ : ∀ {α} → (C : ℕ → Set α) → C 0 → ((n : ℕ) → C n → C (succ n)) → (x : ℕ) → C x
08:48 <mniip> yes
08:48 torstein joined
08:48 <mniip> I'm writing a package with induction schemes on typelit
08:48 Yuras joined
08:48 <mniip> s
08:48 <quchen> I see.
08:49 entuland joined
08:51 <mniip> check out this beauty
08:51 <mniip> (KnownNat b, KnownNat m) => r b -> (forall m. KnownNat m => q m) -> (forall k n. (KnownNat b, 1 + k <= b, KnownNat n) => q k -> p n -> p (1 + k + b * n)) -> p 0 -> p m
08:52 xall_ joined
08:52 andyhuzhill1 joined
08:52 leat joined
08:53 unK_ joined
08:55 <quchen> Uhh okay
08:55 sqrt2 joined
08:57 Yuras joined
08:59 jer1 joined
08:59 jutaro1 joined
08:59 cloudhead joined
09:00 toblorone_ joined
09:00 eacameron joined
09:01 insitu joined
09:04 romank joined
09:04 oish joined
09:04 geekosaur joined
09:06 tv joined
09:07 teto joined
09:07 bkboggy joined
09:08 geekosaur joined
09:08 jophish joined
09:09 Gloomy joined
09:10 juhp__ joined
09:10 aloiscochard joined
09:11 Wizek joined
09:12 marr joined
09:13 bennofs joined
09:14 DocWinter joined
09:15 Brando753-o_O_o joined
09:16 primal_ joined
09:18 taktoa joined
09:19 prophile joined
09:20 jer1 joined
09:22 xtreak joined
09:22 insitu joined
09:23 xtreak joined
09:24 sproingie joined
09:24 sproingie joined
09:24 jutaro joined
09:25 NyanPasu joined
09:25 gmcabrita joined
09:26 primal joined
09:30 tromp joined
09:30 benl23 joined
09:32 mjora7 joined
09:32 dschiptsov joined
09:32 sa1_ joined
09:34 amatecha joined
09:34 teto joined
09:35 benjamingr_ joined
09:35 implementation joined
09:35 implementation joined
09:35 biglama joined
09:36 primal_ joined
09:38 maarhart joined
09:39 lukexi joined
09:40 Wizek__ joined
09:40 jer1 joined
09:41 locallycompact joined
09:43 teto joined
09:45 locallycompact joined
09:46 primal joined
09:47 [[[[[ExTRa]]]]] joined
09:47 andreypopp joined
09:47 oisdk joined
09:49 merijn joined
09:49 Faucelme joined
09:52 jchia1 joined
09:53 soniku joined
09:54 yoneda joined
09:55 primal_ joined
09:56 sqrt2 joined
09:56 revtintin joined
09:58 incognito joined
09:58 jchia joined
10:00 teto joined
10:01 jchia joined
10:01 jer1 joined
10:01 _sg joined
10:02 montag451___ joined
10:02 xcmw joined
10:04 jchia joined
10:04 kuribas joined
10:05 crosleyt joined
10:06 netheranthem joined
10:06 oish_ joined
10:09 incognito left
10:09 splanch joined
10:09 ploop joined
10:10 teto joined
10:12 xtreak joined
10:12 RegEchse joined
10:14 primal joined
10:15 xtreak joined
10:15 geekosaur joined
10:18 xall_ joined
10:18 refold joined
10:18 kiltzman joined
10:19 splanch_ joined
10:19 dm3 joined
10:19 meba joined
10:21 orphean joined
10:22 jer1 joined
10:23 jgertm joined
10:23 primal_ joined
10:24 uuplusu joined
10:24 uglyfigurine joined
10:24 rossberg joined
10:27 michaelw joined
10:31 paolino joined
10:34 c4r50nz joined
10:34 primal joined
10:36 dhil joined
10:36 <mniip> man this looks bad
10:36 kaeluka joined
10:37 spicydonuts joined
10:38 <lpaste> mniip pasted “GHC typelits induction schemes” at http://lpaste.net/355323
10:39 tobiasBora joined
10:41 bigs joined
10:42 louispan joined
10:42 jer1 joined
10:44 primal_ joined
10:44 teto joined
10:44 doomlord joined
10:45 ljhms joined
10:45 <quchen> ಠ_ಠ tabs
10:47 litchblade joined
10:49 dogui joined
10:49 toblorone_ joined
10:49 alfredo_ joined
10:49 splanch joined
10:50 reem joined
10:53 foton joined
10:54 primal joined
10:55 soniku joined
10:58 BartAdv joined
11:00 Guest29369 joined
11:01 SenpaiSilver joined
11:01 jeltsch joined
11:01 teto joined
11:01 agis joined
11:02 Snircle joined
11:03 jer1 joined
11:06 zv joined
11:08 systadmin joined
11:08 soniku joined
11:08 __paul0 joined
11:08 teto joined
11:10 PennyNeko joined
11:10 louispan joined
11:11 <Guest29369> names
11:12 splanch_ joined
11:13 primal_ joined
11:16 panosk joined
11:17 panoskk joined
11:17 _rht joined
11:18 refold joined
11:19 avn_nb joined
11:20 andro__ joined
11:22 <quchen> Is there a TH package with a quasiquoter for multiline text?
11:22 <quchen> Using unwords and lots of qoutes or the \ \ syntax is annoying
11:23 jer1 joined
11:24 <lyxia> http://hackage.haskell.org/package/neat-interpolation- ?
11:26 sproingie joined
11:26 sproingie joined
11:26 louispan joined
11:26 alfredo joined
11:26 j03_k joined
11:26 ziocroc2 joined
11:27 Levex joined
11:27 <j03_k> Hi, how do I do this: 'Define a list of tuples of pairs of numbers. Use a fold function to calculate the sums of the first elements from every tuple'
11:27 obihann joined
11:28 <quchen> cocreature merijn RFC https://github.com/quchen/prettyprinter/#why-another-prettyprinter
11:28 bweston92 joined
11:28 <quchen> Thinking about a standalone release just to avoid the process of convincing lots of people ;-)
11:28 HoierM joined
11:29 ridho joined
11:29 <Guest19141> j03_k: For the first part, something like this would do; foo = [(1,42), (2,69)]
11:29 Kreest__ joined
11:29 <j03_k> Guest19141: I know how to do that part. I just don;t know about the fold
11:30 <Guest19141> j03_k: Have you seen foldl and foldr yet?
11:30 <j03_k> Guest19141: I don't understand them
11:30 <Guest19141> :t foldr
11:30 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
11:30 beerdrop joined
11:31 <j03_k> Guest19141: please can you tell me. I've got to do this quickly
11:31 <merijn> quchen: Who do I need to beat up? Err..."convince"? ;)
11:31 <Guest19141> j03_k: foldr takes 3 arguments; (1) a folding function (we'll get back to that later), (2) an accumulator, (3) a foldable
11:31 <quchen> merijn: Now that I added annotations I ran out of reasons to postpone the release
11:32 andro__ joined
11:32 tromp joined
11:32 <Guest19141> j03_k: In order, we start with the value of type `t a`, which is foldable `t` containing values of type `a`.
11:32 <Guest19141> j03_k: Then we have an accumulator of type `b`.
11:32 <Guest19141> j03_k: For each element, we pass `a` and `b` to the folding function `(a -> b -> b)`, resulting in a new accumulator of type `b` again.
11:32 bennofs joined
11:33 <Guest19141> j03_k: The process repeats until all elements have been "folded" into a single unique value (your accumulator) and that's going to be your result.
11:33 <Guest19141> > foldr (+) 0 [1,2,3,4,5]
11:33 <lambdabot> 15
11:33 soLucien joined
11:33 primal joined
11:33 <j03_k> Guest19141: sorry but im not here to learn. i need to get this done quickly
11:34 <Guest19141> j03_k: Then you're here for the wrong reason.
11:34 <j03_k> Guest19141: as a one off
11:34 <j03_k> Guest19141: please
11:34 <Guest19141> j03_k: I'll see you later :)
11:34 <j03_k> Guest19141: my life is on the line
11:34 <pacak> j03_k: Then you are going to die.
11:34 <Guest19141> With pattern matching we can get creative like:
11:34 <Guest19141> > foldr (\(x,y) -> ...) 0 [(1,42), (2,69)]
11:34 <lambdabot> <hint>:1:18: error: parse error on input ‘...’
11:35 <merijn> quchen: Who are the lots of people you'd have to convince? Isn't it mostly just the handful of people maintaining ansi-wl-pprint and then just everyone telling everyone else to switch/unify? :p
11:36 <pacak> > getSum $ foldMap (Sum . fst) ((,) <$> [1..4] <*> [4..1])
11:36 <lambdabot> 0
11:36 slomo joined
11:36 <pacak> O_O
11:36 mmhat joined
11:36 Guest19141 joined
11:36 thoradam joined
11:36 Denthir joined
11:36 <merijn> And hey, edwardk is maintainer and at least he is fairly easy to reach and reasonable :p
11:36 <quchen> merijn: Well, one problem is that half of Stackage is a revdep of ansi-wl-pprint, so *lots* of libs would break
11:37 <quchen> I tried switching Trifecta and it took maybe 5 minutes
11:37 <merijn> quchen: Only if they fucked up their upper bounds, no?
11:37 <quchen> but there are lots of 5-minute versions
11:37 <quchen> optparse-applicative for example
11:37 <nitrix> pacak: The problem is your ((,) <$> [1..4] <*> [4..1])
11:37 <merijn> quchen: If you release a major version update they shouldn't be using it anyway?
11:37 <pacak> > getSum $ foldMap (Sum . fst) ((,) <$> [1..4] <*> [4,3..1])
11:37 <quchen> Stackage makes everything run in sync though and it’s heavily used
11:37 <lambdabot> 40
11:37 <pacak> nitrix: Yea.
11:38 <merijn> quchen: But if ansi-wl-pprint is being used than they could just stick to the current version?
11:38 <quchen> Right.
11:38 <quchen> (I also don’t like wl-pprint, it’s a terrible package name)
11:39 JeanCarloMachado joined
11:39 <merijn> quchen: On the one hand I agree, on the other, "We have 15 competing packages. Let's build one that addresses all their issues!" -> "We have 16 competing packages..."
11:39 <quchen> Maybe I should talk to Edward about this, he has a fairly good overview over the package ecosystem, and what breakage means on a larger scale.
11:39 <quchen> Right, that’s what stops me :-)
11:40 <quchen> On the other hand, I believe the new one is strictly better than any of the others
11:40 <merijn> I suppose maybe a new library and convincing all the mainteiners of wl-pprint libraries to mark them as deprecated could work
11:40 <quchen> s/any/all/
11:40 uuplusu_ joined
11:40 <merijn> i.e., release it, change all the existing libraries to compat shims over it and mark them as deprecated
11:40 ixti joined
11:41 <merijn> But that still involves browbeating a bunch of maintainers :p
11:41 <quchen> One of them is famously unreachable :-þ
11:41 fsvehla joined
11:41 <quchen> Source: I tried since December
11:41 <merijn> quchen: Which one?
11:41 <quchen> Noam Lewis, AKA sinelaw
11:41 <quchen> Maintainer of wl-pprint
11:41 <merijn> quchen: All but two being deprecated is already an improvement :p
11:41 <merijn> (yours and wl-pprint)
11:42 <agis> Hey guys, quick interruption: Talking about a little piece of code I wrote, a Reddit user told me that he remembers reading something about the Writer monad being too slow to be used in production code, but was not sure and gave no reference. Does someone here know anything about this? I was not able to find anything on the Internet
11:42 leat joined
11:42 kritzcreek joined
11:42 <merijn> Speaking of unreachable maintainers, if someone isn't responding to github issues, what's the best solution: 1) email, 2) twitter, 3) passive-aggressive complaining online?
11:42 <quchen> Writer isn’t terribly performant, but »not fast enough for production« is false. Source: I use Writer in production.
11:42 <nitrix> agis: WriterT over IO is going to be problematic, that sounds right.
11:42 <merijn> Depends rather strongly on what you're using it for in production :p
11:43 <quchen> My prettyprinter uses Writer and it’s faster than the original. Not that the original is very fast ;-)
11:43 <pacak> Writter is kind of slow, but it's OK if you are not in a hurry or you are not working with huge amounts of stuff.
11:43 bkboggy joined
11:44 darlan joined
11:44 <merijn> Also, slow is relative
11:44 primal_ joined
11:44 <quchen> For high-performance logging, don’t use Writer.
11:44 <merijn> Some of my code deals with nanosecond operations, some of my code deals with "as long as it finishes within a few seconds" operations, you use different things for different cases :p
11:45 <nitrix> The lazyness can cause some neat space leaks when your base monad is IO.
11:45 <cocreature> there is writer-cps-transformers which should avoid the space leaks
11:46 <pacak> merijn: Nanoseconds? I'm curious. Any details?
11:46 Guest31866 joined
11:46 cobreadmonster joined
11:46 leat joined
11:47 cpennington joined
11:47 jer1 joined
11:48 <agis> Do you have any alternatives for high-performance logging?
11:49 Gloomy joined
11:49 <merijn> pacak: To be fair, that's not Haskell code, but C++ and GPU code. Trying to dynamically switch between implementations of BFS based on predictions to get better runtimes. The predictions are several tens of nanoseconds, the kernels anywhere from a few microseconds to a few seconds (depends on the size, when during the traversal, etc.)
11:49 <quchen> merijn: Are you going to any conferences this year? I remember never having met you each time summer comes up
11:50 <merijn> agis: Do you have a ballpark estimate for how high-performance? 10, 100, 1,000, 1,000,000 logs per second...
11:50 <merijn> quchen: Trying to get to ICFP this year (since it's nearby == cheap flight == easier to convince my advisor to pay for it), but I mostly end up in the non-PL conferences :p
11:50 xcmw joined
11:50 <pacak> merijn: That's exactly I was curious. Foreign imported primops?
11:51 <quchen> Aww I’ll miss ICFP I think :-/
11:51 <merijn> Stuff like HPDC, HiPEAC, EuroPar, trying to go to MASCOTS this year
11:51 <pacak> Or foreign imported functions?
11:52 <agis> merijn: Honestly, not really hahaha. I just have this kind of post about how to implement a Writer-like monad, and this user in Reddit suggested that maybe Writer is not the best alternative, so I would like to also recommend other alternatives that can be better than Writer if you need faster code
11:52 CurryWurst joined
11:52 <pacak> In my case it's primops and I'm doing numbers parsing/validation with vector instructions.
11:52 <merijn> pacak: Naah, this is all just straight C++ wrapper with no haskell :) I think Haskell would be fine for the boilerplate code, but I'd have to implement the bindings myself and I was a bit worried about how to eliminate/avoid potential overhead from GC pauses/etc. from things
11:52 <cocreature> the problem with using Writer for logging is also that in a lot of cases you want to immediately stream the logging results to whatever your log output is instead of accumulating them and then outputting them all at once
11:53 <merijn> agis: Honestly, if you literally don't know, I'd just go with whatever's easiest and fix it later if it becomes too slow
11:53 <cocreature> fast-logger is supposed to be reasonably fast I think :)
11:54 <agis> merijn: that seems about right, yup
11:54 <agis> Thank you for the insight, guys!
11:54 uglyfigu_ joined
11:54 soniku joined
11:55 Yuras joined
11:56 <merijn> I mean, I tend to go for "make everything way faster than necessary all the time", which is a good way to yak shave and slowly improve the world, but not one to get anything useful done :p
11:56 asmyers joined
11:57 chrisM_1 joined
11:57 Chrism13 joined
11:58 chrisM_1 joined
11:59 oisdk joined
11:59 xtreak joined
12:00 Itkovian_ joined
12:01 <agis> merijn: well, "making everything way faster than necessary all the time" seems like the kind of pet peeve I wouldn't mind on anyone haha
12:01 <Ulrar> So in JSONParseException from Network.HTTP.Simple, there seem to be a Request and a Response. How would I go about getting only the Response from it ? I'd like to display that, but avoid displaying the Request which contains auth headers
12:02 <merijn> Ulrar: Eh, which package is that?
12:02 <cocreature> Ulrar: just pattern match on it
12:02 <cocreature> merijn: http-conduit
12:02 <cocreature> https://hackage.haskell.org/package/http-conduit-
12:03 teto joined
12:03 primal joined
12:04 <Ulrar> cocreature: Yeah I'm trying to figure out how to do that :)
12:04 <Ulrar> (JSONParseException _ (resp ()) _) isn't working
12:04 <Ulrar> So I must be missing something in the doc I guess
12:04 <cocreature> just resp not resp ()
12:05 jutaro joined
12:05 <Ulrar> Ah, indeed
12:06 <Ulrar> Thanks
12:06 <Ulrar> Not sure why the doc says JSONParseException Request (Response ()) ParseError then ?
12:06 rcat joined
12:06 Itkovian joined
12:06 <cocreature> Ulrar: "Response ()" is the _type_ but you pattern match on _values_
12:07 jer1 joined
12:07 <cocreature> e.g. if it said Int you don’t pattern match on Int, you pattern match on 42
12:07 gawen joined
12:07 <Ulrar> I see
12:07 <merijn> cocreature: I don't, I pattern match on 69, because I'm 12 ;)
12:08 ljhms joined
12:08 <cocreature> merijn: then you’re doing it wrong :P
12:08 romank joined
12:09 insitu joined
12:12 <nitrix> I'm wearing my Stay Lifted Haskell t-shirt today; it can only be a good day.
12:12 <nitrix> (https://teespring.com/en-GB/haskell-stay-lifted)
12:13 armyriad joined
12:13 <nitrix> I think only one person in the metro caught onto the logo and smirked :P
12:13 Dookie12 joined
12:13 geekosaur joined
12:14 primal_ joined
12:14 sproingie joined
12:14 Argue joined
12:16 teto joined
12:16 fre joined
12:17 anRch joined
12:17 gaze__ joined
12:19 fendor joined
12:23 primal joined
12:24 <tfc[m]> does anyone have experience with the persistence library and :memory: dbs? my concrete problem is: i create a pool with :memory: and 1 connection. then i do multiple runSqlPersistMPool actions on that, and between them all data seems to get lost. with postgres and sqlite files it works great.
12:24 angerman joined
12:25 <tfc[m]> i had the impression that :memory: as a backend stays filled until the pool is lost, and not after a runSqlFoo statement has finished.
12:25 unyu joined
12:25 chlong joined
12:26 kamog joined
12:27 octarin joined
12:27 <liste> tfc[m]: I usually have a specific connection that keeps the database alive
12:27 <liste> and additional connections for doing actual stuff
12:28 jer1 joined
12:28 mmo joined
12:28 <merijn> tfc[m]: You can't use pool with :memory: according to the docs (when I checked a month or two ago)
12:28 <tfc[m]> liste: that's what i thought a pool would be good for.
12:29 <merijn> tfc[m]: The pool creates/deletes/reuses connections on demand, but doesn't guarantee "at least one connection" (so it could have 0) and :memory: gets wiped when all connections are closed
12:29 <tfc[m]> merijn: ok, so pool's bad for :mem:, and i should rewrite my functions in a way that they use explicit connections in case i use :mem: as backend... right?
12:30 <mmo> Could somebody tell me what the currently best testing framework for unit tests is, which also integrates with cabal? Thanks
12:30 <tfc[m]> oooh i see.
12:30 <cocreature> mmo: personally I prefer hspec
12:30 <tfc[m]> thank you merijn
12:30 mohsen_ joined
12:30 <merijn> tfc[m]: Well, that or simply test with a file (I'm assuming this is SQLite) instead
12:30 <merijn> Then the pool should work
12:31 <mmo> cocreature: Thank you. What about HUnit and QuickCheck? Do you know the differences to hspec?
12:31 mattyw joined
12:31 <tfc[m]> merijn: yes, that was also my observation. hoped i can avoid touching files, but that's also fine for me.
12:32 <merijn> tfc[m]: Honestly, using a file backend with SQLite is literally just writing a path instead of ":memory:" and that's it :)
12:32 locallycompact joined
12:32 <cocreature> mmo: they’re complementary. hspec wraps HUnit but provides a better interface (imho) and you can use existing hunit tests inside of hspec and it integrates with QuickCheck so you can use QuickCheck properties in hspec.
12:32 <merijn> tfc[m]: Plus, bonus, you can debug/inspect your database using the sqlite program :)
12:33 teto joined
12:33 <mmo> cocreature: Ok. That sounds nice. I'll give it a shot. Thanks
12:33 <tfc[m]> merijn: maybe /dev/null is the best choice then
12:33 <merijn> tfc[m]: Eh...that won't work in any sensible way >.>
12:33 cyborg-one joined
12:33 Denthir joined
12:33 primal_ joined
12:33 <tfc[m]> merijn: but i don't need no debuggers. haskell apps are always bug free because FP! :D :D
12:34 <cocreature> mmo: the other option is to use tasty which also integrates with HUnit and QuickCheck but doesn’t try to provide a better interface around HUnit
12:34 pellenation joined
12:36 <merijn> What's the right way to mark a benchmark/test in a cabal file as not buildable?
12:36 <cocreature> merijn: I think buildable: false works for any component, not just executables
12:37 balor joined
12:37 mbeidler joined
12:37 marr joined
12:38 jcjf joined
12:39 <merijn> cocreature: Can I override that locally?
12:39 <cocreature> merijn: what do you mean by that?
12:40 tromp joined
12:40 <merijn> cocreature: Something should be unbuildable for people grabbing it from, e.g., Hackage, but I want to actually build it locally (it's generally not buildable since I'm using patched dependencies that haven't been merged/released on hackage)
12:41 Xalphor joined
12:41 <cocreature> merijn: add a cabal flag that controls whether it’s buildable
12:42 mmo left
12:42 halogenandtoast joined
12:42 hucksy joined
12:43 northfurr joined
12:45 sdothum joined
12:47 bennofs joined
12:47 bennofs joined
12:48 jer1 joined
12:48 petermw joined
12:49 macivy joined
12:50 Itkovian joined
12:54 [[ExTRa]] joined
12:54 primal joined
12:54 starmix joined
12:55 mekeor joined
12:56 petermw joined
12:56 Boomerang joined
12:56 geekosaur joined
12:58 plutoniix joined
12:58 macrover joined
12:59 plutoniix joined
13:00 FreeBirdLjj joined
13:00 cfricke joined
13:00 jer1 joined
13:01 mmn80 joined
13:03 fosterite joined
13:04 primal_ joined
13:05 zariuq joined
13:06 unyu joined
13:06 eschnett joined
13:06 iAmerikan joined
13:07 macrover left
13:10 Gurkenglas joined
13:10 spacecadetbrown joined
13:10 macrover joined
13:11 Hexagenic joined
13:12 Arizona6882 joined
13:13 juhp_ joined
13:13 juhp_ joined
13:13 soniku joined
13:13 primal joined
13:14 Cogitabundus joined
13:14 soLucien joined
13:14 Cogitabundus joined
13:14 mivael_ joined
13:15 xcmw joined
13:20 dino_joel joined
13:20 Itkovian joined
13:21 c4r50nz joined
13:22 <merijn> So, suppose I get "indefinitely blocked in an MVar operation" any way to trace *which* MVar/where is blocked?
13:23 teto joined
13:23 tomphp joined
13:23 primal_ joined
13:24 insitu joined
13:25 SolitaryCypher joined
13:26 james42 joined
13:27 joelburget joined
13:28 jer1 joined
13:28 Grisha joined
13:28 cpup joined
13:28 insitu_ joined
13:28 eSVG joined
13:29 pgiarrusso joined
13:29 <liste> is using Data.Dynamic to store state for eg. different kinds of game objects a bad idea?
13:29 <merijn> liste: Yes, no, maybe
13:30 <merijn> Oh, I forgot "It Depends"
13:30 <liste> so each object would have an uniform interface but different internal state
13:30 <liste> and the state is wrapped in Data.Dynamic
13:30 <Grisha> Hi, another newbie trying to escape the IO monad here. My problem: my code recieves a piece of configuration by performing an IO action and then passes it around with the help of the ReaderT. Can I somehow keep it (the piece of conf) between different calls in the ghci repl?
13:31 Itkovian joined
13:31 <Grisha> everything works like a charm when I run the whole big code, but I would like to poke the single funcs without having to make extra IO calls
13:31 joelburget joined
13:31 jangsutsr joined
13:32 <byorgey> Grisha: first do config <- ioAction at the ghci prompt, then runReaderT someSingleFunc config ?
13:32 splanch joined
13:32 locallycompact joined
13:32 jimmyrcom_ joined
13:32 <Grisha> byorgey: thanks! wait a sec.
13:32 urodna joined
13:33 <mauke> it would probably be easier to just not use ReaderT
13:33 joelburget joined
13:33 <Grisha> wow
13:33 <Grisha> i didn’t know you could do this
13:33 <byorgey> liste: sounds to me like you should just be able to represent game objects as records of functions? Using Data.Dynamic to wrap the internal state sounds like asking for trouble.
13:33 <Grisha> now I have a pure instance of config
13:33 `^_^v joined
13:34 <Grisha> I’ve got config :: Config instead of config :: IO Config
13:34 <Grisha> byorgey: thanks a lot man
13:34 <byorgey> Grisha: yes, you can run IO actions at the GHCI prompt. It's as if the ghci prompt lives inside a do-block in the IO monad
13:34 <mauke> yes, because all of ghci is essentially impure :-)
13:34 primal joined
13:34 <byorgey> Grisha: glad to help!
13:34 joelburget joined
13:34 <Grisha> byorgey: you know how often I thought ``it would be nice to be able to do that''?
13:35 <Grisha> I hate you Haskell :~)
13:35 <byorgey> Grisha: also, as an aside, I do happen to be a man, but it's probably best not to assume that on IRC
13:35 meba joined
13:35 <byorgey> hehe
13:35 <mauke> your realname says "Brent". looks male to me :-)
13:35 <Grisha> byorgey: thank you, point taken
13:35 Guanin joined
13:35 Guanin left
13:36 leat joined
13:36 <monochrom> But does it look real? :)
13:36 <Grisha> mauke: why did you suggest to drop ReaderT?
13:37 <mauke> Grisha: it's syntactic sugar for function arguments
13:37 <merijn> byorgey: To be fair, I have known plenty of people who'd say "thanks man" to women too :p
13:37 <Grisha> mauke: that’s why I’m using it
13:37 <mauke> Grisha: so instead of 'runReaderT foo config' you could just write 'foo config' directly
13:37 raynold joined
13:37 <byorgey> merijn: so have I. That doesn't make it unproblematic.
13:38 <Grisha> mauke: being a total beginner, it was bothering me that I didn’t understand ReaderT, now I hope I do understand it a bit better
13:38 <merijn> Anyway, back to my earlier question: Any tips on finding which MVar is blocking indefinitely?
13:39 <liste> byorgey: thanks. I means something like "data GameObject = GameObject { ..., respondToAttack :: Int -> Action (), ... }" and have the game objects have health and have different responses based on that, but I guess I'll go with the more idiot-proof sum type
13:39 <rightfold> TIR ReaderT is flip Kleisli
13:39 <mauke> merijn: which version of ghc are you using?
13:39 <merijn> mauke: 8.0, so with the fancy callstack stuff
13:39 <mauke> ah
13:40 <byorgey> liste: data GameObject = GameObject { ..., respondToAttack ... } is what I mean too. And I'm saying I don't think you need Data.Dynamic for that.
13:40 Tesseraction_g joined
13:40 <james42> Hi everyone, I don't understand what this data declaration means : data Test f = Test (f Int). ghci tells me f is of kind * -> *, which is fine to me. When i see the (f Int) part, I understand (and this is probably the part that I get wrong) this as a partial application of the function type f to Int, so a bit like (->) Int. But when I try this : Test (const 'a'), I see that ghc expects type: b -> Int, which is the opposite of what I
13:40 <quchen> james42: No, it’s not partial application. It’s normal application.
13:40 <mauke> james42: your message got cut off at "opposite of what I"
13:41 <james42> "opposite of what I think"
13:41 <quchen> For example, »Test Maybe« has a field of type »Maybe Int«.
13:41 <Grisha> james42: it might be a type constructor application, if I’m not messing with the terminology
13:41 <byorgey> liste: oh, if you have it return an Action () then perhaps you do. Instead, you might consider having it return an Action GameObject --- i.e. it has some effect and returns an updated GameObject
13:41 <Grisha> james42: f could be Maybe
13:41 teto joined
13:42 ystael joined
13:43 <byorgey> liste, like this: monster :: Health -> GameObject; monster health = GameObject { ..., respondToAttack a | a > health = ... | otherwise = someAction >> return (monster (health - a)), ... }
13:43 locallycompact joined
13:43 <james42> okay, so f is a type constructor that takes an argument and returns a type ? and it's applied to Int ? But if so, how is (const 42) a type constructor ? (Test (const 42) works fine)
13:43 primal_ joined
13:43 jathan joined
13:43 <mauke> james42: there are two 'Test's here
13:43 <Grisha> james42: in other words, f is a type variable
13:44 <mauke> you're looking at the non-type one
13:44 <mauke> data Test f = MkTest (f Int) -- possibly clearer
13:44 <mauke> and then the expression you're asking about is 'MkTest (const 42)'
13:45 <james42> mauke: yes, I see the difference, but I don't get how you can apply a type variable to something
13:45 <james42> for me, a type variable is just a placeholder for a type
13:45 <mauke> const 42 :: a -> Integer
13:45 <byorgey> james42: do you see how you can apply the type 'Maybe' to something?
13:45 <byorgey> i.e. Maybe Int ?
13:45 <mauke> er
13:45 <liste> byorgey: thanks! that makes more sense :)
13:45 <mauke> const 42 :: a -> Int in this case
13:45 Guanin joined
13:45 Guanin left
13:45 fbergmann joined
13:45 <mauke> MkTest (const 42) :: Test (a ->)
13:45 Guanin joined
13:45 Guanin left
13:46 <mauke> which I think is a syntax error
13:46 jer1 joined
13:46 <byorgey> james42: yes, a type variable is just a placeholder for a type, but some types can take other types as arguments.
13:46 <byorgey> like Maybe, or [], or (Either Char)
13:46 <mauke> let's go with const 42 :: (->) a Int; then MkTest (const 42) :: Test ((->) a)
13:46 <mauke> here f = (->) a
13:47 <mauke> the field in Test has type 'f Int', i.e. '(->) a Int'
13:47 <mauke> i.e. 'a -> Int'
13:47 <byorgey> liste: great! =)
13:47 guampa joined
13:47 <* james42> is still alive, just reading carefully :p
13:48 <byorgey> @quote fire.hose
13:48 <lambdabot> byorgey says: sometimes asking #haskell for help can be like taking a drink from a fire hose
13:48 <Grisha> mauke: I’ve got a couple of funcs that a) do a http request, depending on some config and b) parse the json response (JSON parser returning Maybe a)
13:48 <merijn> mauke: I think I found out how to get a stack trace, using profiling and "+RTS -xc", of course even with that information it seems look perfectly fine, like all concurrency bugs always do
13:49 <mauke> merijn: oh, fun
13:49 <Grisha> mauke: do you think that `ReaderT Config (MaybeT IO) a` would be a good type for such funcs?
13:49 <merijn> mauke: The real fun is that I have two nearly identical implementations, only one of which works :)
13:50 <mauke> Grisha: depends on whether you need those monad instances. otherwise I'd just go with Config -> IO (Maybe a)
13:50 teto joined
13:50 <mauke> ... which are still monad instances anyway
13:50 <Grisha> mauke: I fancy that if I had a transformers stack, I could map/appy through it more easily
13:50 <jchia_1> In cabal, what's the difference between 'extensions:' and 'default-extensios:'? Can I specify package-wide extensions that apply to every library and executable in the package?
13:50 Denthir joined
13:51 <mauke> ((->) e) is an instance of MonadReader :-)
13:51 jutaro joined
13:51 <Grisha> mauke: if my a = [b], I would like to map over bs
13:51 <ezyang> jchia_1: default-extensions apply without you having to add LANGUAGE
13:51 alfredo_ joined
13:51 <merijn> jchia_1: default-extensions are package-wide, extensions just list all extensions you use
13:51 <ezyang> other-extensions indicates to Cabal that you're using an extension, which lets Cabal make better decisions in some cases
13:51 yellowj joined
13:51 <Grisha> mauke: it’s rather about joining the Maybe and the IO layers into one monad
13:51 <merijn> jchia_1: It's preferable *not* to use default-extensions
13:51 <ezyang> for example, if you declare TemplateHaskell, Cabal will correctly build dynamic libraries for GHC to build
13:52 <Grisha> mauke: I’d like to pPrint the results, for instance
13:53 <Grisha> with just a single `pPrint <$>`
13:53 <merijn> jchia_1: Besides letting cabal make better decisions, correctly listing all extensions in extensions lets tools more easily make decisions (e.g. UHC supports some, but not nearly all extensions GHC does, so you could automatically scrape "buildable package" of hackage)
13:53 jutaro1 joined
13:53 jgertm joined
13:53 <jchia_1> merijn: I think default-extensions is not recognized at the top-level. The fields allowed are name, version, cabal-version, build-type, etc. There's nothing about extensions in that list. I just want to enable a few relatively safe and useful extensions like GeneralizedNewtypeDeriving, BangPatterns, LambdaCase, MultiwayIf, PatternGuards, TupleSections.
13:53 primal joined
13:54 JeanCarloMachado joined
13:54 _sg joined
13:54 <merijn> jchia_1: It's not about safety, it's about keeping the source readable
13:54 <merijn> jchia_1: PatternGuards is no longer an extension, it's Haskell2010
13:54 <merijn> Which *everyone* always forgets :)
13:54 <jchia_1> merijn: OK, for me it's a project convention, so it's readable by people working on the project.
13:55 <merijn> jchia_1: If you explicitly list extensions at the top of the file it's easy to see what's enabled while browsing a file. Default-extensions are per library/executable, afaik
13:55 bigos_ joined
13:55 mizu_no_oto joined
13:56 <jchia_1> merijn: I don't want to spend time thinking about whether each source file needs some simple extension like MultiWayIf or LambdaCase.
13:56 jutaro joined
13:56 <jchia_1> the answer may flip between true and false as the code changes.
13:57 umib0zu joined
13:57 <merijn> Ok, so I have N threads that execute the task "readMVar start; do action" M times and one thread that does "putMVar start (); takeMVar start;" M times. Yet, mysteriously, the N threads mysteriously get "blocked indefinitely on MVar" *sigh*
13:59 <mauke> wouldn't that deadlock immediately?
13:59 dhil joined
13:59 romank joined
13:59 mada joined
13:59 teto joined
13:59 <merijn> mauke: Why?
13:59 primal_ joined
13:59 jutaro1 joined
13:59 <c_wraith> if the thread that does the putMVar does the takeMVar before some waiting thread does the readMVar, you'll get that error
13:59 <mauke> there's only one putMVar at the beginning
14:00 <mauke> oh, wait
14:00 <mauke> readMVar, not takeMVar
14:00 govg joined
14:00 <* mauke> reads source
14:00 <merijn> c_wraith: I force/deepseq the launching of threads before the main thread ever starts it's loop
14:00 <merijn> Although I did realise just now that there's a race
14:00 darlan joined
14:00 refold joined
14:01 <c_wraith> merijn: you're still counting on round-robin behavior from the MVar, which isn't guaranteed
14:01 danthemyth joined
14:01 <merijn> Between the last worker finishing it's task/doing readMVar and the main one
14:01 strawberry joined
14:01 <merijn> c_wraith: Nope, MVar guarantees all blocked reads complete before any take when a write happens
14:01 <merijn> The problem is a race I have at the end
14:01 <merijn> So at least I managed to rubber duck the issue :)
14:02 <merijn> At least, with recent GHC's this is true (base >= 4.7)
14:02 <merijn> "readMVar is guaranteed to receive the next putMVar"
14:03 <mauke> if 'action' is slow, the threads are going to miss all notifications past the first one. is this what you mean?
14:04 <merijn> mauke: The threads notify the main one when they're done, but of course there's a race between the last thread notifying the main one and running it's own readMVar and the main thread doing putMVar
14:04 mda1 joined
14:04 primal joined
14:07 <merijn> In other words, benchmarking concurrency primitives is fun >.>
14:08 MDA2 joined
14:08 <james42> mauke: thanks, I understand :)
14:09 crobbins joined
14:09 mmachenry joined
14:09 crobbins joined
14:09 <merijn> On that note: Besides the stuff in base, what are some good fast/low level synchronisation primitives?
14:10 <jchia_1> merijn: On the other hand, since I'd have to list the extensions per-library or per-executable in the cabal anyway, it's not much more trouble to just list in at the top if each .hs. There's not much benefit in putting it in the cabal if I can't make it a package-level setting.
14:10 rblaze joined
14:10 <merijn> I'm doing MVar, QSem(N), Chan, STM, IORef, etc. did anyone ever produce some low-level primops or something?
14:10 <bennofs> jchia_1: i believe you should at least list TemplateHaskell in your cabal if you use it, since cabal needs to know about it
14:10 <bennofs> merijn: LVar?
14:11 dsh joined
14:11 danthemyth joined
14:11 <bennofs> merijn: http://hackage.haskell.org/package/lvish idk if it applies
14:12 <jchia_1> bennofs: I didn't know that. I have a library that uses TH but the cabal doesn't mention it, and it builds fine.
14:13 <merijn> bennofs: I doubt that's going to be any faster, since those use IORef's internally
14:13 <bennofs> jchia_1: i think the failure case is like "sometimes rebuilds fail in weird ways" (perhaps it only happens if profiling or dynamic libraries are enabled)?
14:13 jutaro joined
14:14 chlong joined
14:14 infandum joined
14:14 cyborg-one joined
14:14 <bennofs> jchia_1: from https://www.haskell.org/cabal/users-guide/developing-packages.html: Additionally, certain language extensions such as Template Haskell require special handling from the build system and by listing the extension it provides the build system with enough information to do the right thing.
14:15 fsestini joined
14:15 <infandum> In lens, I'm trying to get values that are very deep in a json structure. I'm just getting an empty list, however, because of some mistake I'm doing. Is there some kind of error message lens can split out when it fails to access a value so it can help me figure out what's wrong?
14:15 sproingie joined
14:16 <byorgey> infandum: no, because it didn't fail to access a value, it succeeded in accessing zero values.
14:17 <jchia_1> bennofs: Maybe it depends on the compiler?
14:17 <infandum> byorgey: So there's no way to spit out a message at each step?
14:18 <infandum> like: I see these values, then I see these values, then I see these values, etc
14:18 michaelw joined
14:18 <merijn> infandum: Are they lenses you implemented?
14:18 <infandum> by each step I mean val ^.. first . second . third etc
14:18 jutaro joined
14:18 asmyers joined
14:18 <infandum> merijn: Yeah, using Data.Aeson.Lens
14:18 <bennofs> jchia_1: it may work fine in most cases, but there's a few rare cases where it fails with GHC
14:18 <merijn> infandum: Maybe you can hack something together use traceShow?
14:19 <merijn> @quote refreshing.desert
14:19 <lambdabot> chromatic says: My productivity increased when Autrijus told me about Haskell's trace function. He called it a refreshing desert in the oasis of referential transparency.
14:19 <infandum> merijn: I was trying but it's a little verbose
14:19 systadmin joined
14:20 <akfp> Anyone knows how I use quickcheck to generate an arbitrary constant?
14:20 <akfp> I mean an Arbitrary instance that always returns a constant.
14:20 <Grisha> I’m stuck again, having `ess :: Maybe [MyDataType]` (MyDataType is showable) and `pPrint :: (Show a, MonadIO m) => a -> m()`, I cannot `pPrint <$> ess`
14:21 <quchen> akfp: gen = pure <constant>
14:21 <quchen> eh, arbitrary = pure 5
14:21 DocWinter joined
14:21 <james42> mauke: so to check that I understand, if I have 'data Test f = MkTest (f Int Char)' and I have the expression y = MkTest (\x -> 'a')
14:21 <quchen> Or maybe phrased a bit bette: Arbitrary is Applicative.
14:21 <james42> we have: y :: Test (->)
14:21 <james42> because: (\x -> 'a') :: (->) a Char; then ghc "matches" '(->) a Char' with the expected type 'f Int Char'
14:21 <james42> it only matches if: f is (->), a is Int, Char is Char
14:21 <james42> therefore: y :: Test (->); which looks silly but is correct
14:21 <Grisha> or even `pPrint <$> Just 1`
14:21 <james42> and we could have Either instead of (->) for example, so this data definition is better than the definition: data Test = MkTest (Int -> Char)
14:22 <akfp> quchen: thanks!
14:23 pgiarrusso joined
14:24 Costar joined
14:24 Tallenz joined
14:24 <merijn> james42: That's about it, yes
14:24 <merijn> james42: And don't forget "Test (,)" in this example!
14:24 HarveyPwca joined
14:25 synProgrammer joined
14:25 mfukar joined
14:25 Usurp1 joined
14:26 teto joined
14:26 seequ joined
14:27 takle joined
14:28 <fsestini> hi! i’m trying to derive Eq and Ord instances for a GADT with phantom data kinds. here’s a minimal example: http://lpaste.net/7800056528211279872
14:29 <fsestini> is there a way to leverage ghc’s automatic deriving?
14:29 jgertm joined
14:29 <merijn> fsestini: StandaloneDeriving, I think I might have an example
14:29 robkennedy joined
14:29 jmelesky joined
14:30 burtons joined
14:30 <infandum> Okay, the real issue was that I was zipping multiple getters so when I was trying to debug the first one it always returned an empty list. But now I see the problem: how can I traverse an object to get the values over a list? I thought it was val ^.. key "a" but that didn't work as it returned an empty list, so I thought val ^.. traverse . key "a" might do it but that does not agree with the types
14:30 <cocreature> fsestini: enable StandaloneDeriving and put "deriving instance Show b => Show (Expr a b)" on a separate line
14:30 <cocreature> without any indentation
14:30 <merijn> ^^ that
14:31 pchiusano joined
14:31 cdg joined
14:31 carlomagno joined
14:32 <infandum> But it HAS to be traverse, that makes the most sense
14:32 <nitrix> How would one implement/represent ADTs in a completly visual language?
14:33 Gloomy joined
14:33 <merijn> nitrix: Personally I would either: 1) ditch the visual language or 2) start drinking heavily :)
14:33 <fsestini> cocreature: i still get unification errors if i try to “deriving instance Eq (Expr k a)”
14:33 <merijn> fsestini: Needs an Eq constraint on a
14:34 <nitrix> So far, the language looks like a graph; nodes are processes (ala erlang) and the edges are connections that represents the dependencies between each process that allows them to communicate via messages.
14:34 <merijn> "Eq a => Eq (Expr k a)"
14:34 <infandum> Nevermind, it is traverse, but because it's json it's values
14:34 <fsestini> merijn: yeah sorry, i meant with the Eq a
14:34 primal_ joined
14:34 <nitrix> But I want a strict type system and can't wrap my head how to represent ADTs.
14:34 <nitrix> merijn: Drinking it is ;-;
14:34 <merijn> fsestini: Can you lpaste the entire error
14:35 fluffystub joined
14:35 <merijn> nitrix: Single malt scotch is good at dulling the pain of crappy languages ;)
14:35 balor joined
14:35 <fsestini> merijn: yup: http://lpaste.net/8900165959600308224
14:35 <nitrix> merijn: It's not crappy. It cannot be crappy, it's still in the design phase. It has all the potential in the world to be a good language, I don't wanna give up :P
14:35 synProgrammer joined
14:36 <cocreature> fsestini: huh I tried your example and it worked just fine with what I wrote
14:36 <merijn> fsestini: Which GHC version?
14:36 cdidd joined
14:36 joelburget joined
14:36 <nitrix> merijn: Imagine, Flow Based Programming (erlang-like) + Haskell. I guess Viskell is the closest, but without any Haskell code behind it.
14:36 <merijn> fsestini: Also, any other extensions enabled?
14:36 <nitrix> Actually, how does viskell deal with ADTs...
14:37 bennofs joined
14:37 JScully joined
14:38 <JScully> hello :)
14:38 ixxie joined
14:38 joelburget joined
14:39 <fsestini> merijn: stack should be using 8.0.1. i also have gadt, kind signatures and datakinds
14:40 sjl_ joined
14:40 <merijn> cocreature: So, what's your GHC version? ;)
14:40 <fsestini> btw i tried with plain ghc 8.0.1 and its the same
14:41 coot joined
14:41 teto joined
14:41 <fsestini> full file here: http://lpaste.net/5461321942185279488
14:42 balor_ joined
14:43 afarmer joined
14:43 uglyfigurine joined
14:44 balor__ joined
14:44 simukis joined
14:44 <infandum> Okay, last thing: what is the equivalent of ^.. and toListOf, but for ^? and preview? Like, returning [Maybe a]?
14:44 hsiktas joined
14:44 locallycompact joined
14:45 jutaro joined
14:47 jangsutsr joined
14:48 bgyss joined
14:49 balor_ joined
14:49 <MitchellSalad_> infandum: [a] = all targets, Maybe a = first target, [Maybe a] = ???
14:49 acidjnk22 joined
14:50 <fryguybob> merijn: About concurrency primitives, Ryan Newton has several collected here: https://github.com/rrnewton/haskell-lockfree
14:50 <infandum> MitchellSalad_: "[null,2]" ^.. values . _Integer, for instance, returns [2] instead of [Nothing, Just 2]
14:50 locallycompact joined
14:50 alx741 joined
14:51 <merijn> fryguybob: Ah, the atomic-primops are interesting :)
14:52 mmachenry joined
14:52 Meow-J joined
14:52 <merijn> fryguybob: Will be interesting to compare an atomic spinloop vs MVar and co
14:54 eklavya joined
14:55 balor__ joined
14:55 <tsahyt> hello! I need a good implementation of okasaki's queue. which package should I use?
14:56 hackebeilchen joined
14:56 tomboy64 joined
14:57 oisdk joined
14:58 <tsahyt> or does Data.Sequence perform better?
14:59 <shapr> mmm, finger trees
14:59 <shapr> tsahyt: try Data.Sequence and see if it's fast enough?
14:59 <tsahyt> finger trees are very elegant, but at least for priority queues I've found them very slow
15:00 <tsahyt> but a simple dequeue might be different
15:00 ragepandemic joined
15:00 balor joined
15:02 jud joined
15:02 <shapr> tsahyt: worth trying ?
15:03 <tsahyt> shapr: I'll give it a shot
15:04 <lyxia> fsestini: the derived instance will not typecheck with existentials.
15:04 mizu_no_oto joined
15:04 oisdk joined
15:05 <lyxia> fsestini: you must write a heterogeneous equality by hand
15:05 ChristopherBurg joined
15:05 <fsestini> lyxia: exactly, i was wondering I there was a way to get around it without writing all by hand
15:05 al-damiri joined
15:05 <dolio> I think Data.Sequence will almost certainly be slower than an Okasaki queue. But the difference might not actually matter for you.
15:05 RayNbow`TU joined
15:06 <lyxia> fsestini: it can probably be automated with template haskell but I don't know any existing library offering this.
15:07 asmyers joined
15:08 bigos_ joined
15:08 rjungemann joined
15:08 <tsahyt> dolio: well since consing and unsnocing from the queue is almost everything I ever do, I think it matters quite a lot
15:08 <tsahyt> the rest is out of my control at this point
15:08 cobreadmonster joined
15:09 texasmynsted joined
15:09 <tsahyt> i.e. it's generalized breadth first search
15:09 northfurr joined
15:09 eacameron joined
15:09 quobo joined
15:09 FreeBirdLjj joined
15:10 <tsahyt> dolio: I also don't need the persistent version I think, so the simple implementation would do
15:10 teto joined
15:10 <tsahyt> I guess I could just implement it myself, it's not exactly a lot of code
15:11 <byorgey> tsahyt: https://www.well-typed.com/blog/2016/01/efficient-queues/
15:11 rightfold joined
15:11 cloudhead joined
15:11 <tsahyt> byorgey: thanks!
15:11 iphy joined
15:13 pylbrecht joined
15:13 soniku joined
15:14 zar joined
15:14 ixti joined
15:14 jameseb joined
15:16 posco joined
15:16 thunderrd joined
15:16 <Grisha> byorgey: have you come across failing ambiguity checks in type classes?
15:19 cschneid_ joined
15:19 rakete joined
15:19 ollieh[m] joined
15:19 hakan[m] joined
15:19 TheWizardTower joined
15:19 wr3n[m] joined
15:19 elwan7[m] joined
15:19 iulian_ joined
15:19 guardianJ joined
15:19 aer[m] joined
15:19 monomon[m] joined
15:20 roconnor_ joined
15:20 Magnap joined
15:20 M-berdario joined
15:20 reactormonk[m] joined
15:21 raichoo joined
15:21 herzmeister[m] joined
15:22 jer1 joined
15:23 flatmap13 joined
15:23 jzeus joined
15:24 <byorgey> Grisha: sure
15:24 <byorgey> I'm sure many others here have as well
15:25 <Grisha> i’m trying the simple `class T x where type Parameters x; fetch :: Parameters x -> String”
15:25 bbielsa joined
15:25 ixxie joined
15:25 <Grisha> byorgey: and it’s not happy about the fact that `Parameters x` occurs only on the argument side of fetch
15:26 <byorgey> Grisha: yeah, that's not going to work. The problem is that if you use the function fetch at some type, say, Char -> String, there is no way for it to infer what x should be
15:26 <Grisha> I’m currently reading about the type ambiguity and the non-injectiveness, but cannot grok it sofar
15:26 <byorgey> because there could be multiple types x for which Parameters x ~ Char
15:26 NemesisD joined
15:26 refold joined
15:26 <Grisha> hmmm, lemme think
15:27 Fairy joined
15:28 <Grisha> byorgey: I see - i can instantiate the fetch func for my types, but at the moment I want to call it, the compiler wouldn’t know to what x this instance belongs, right?
15:28 Swizec joined
15:29 <mauke> instance T () where { type Parameters () = Char; fetch c = [c] }; instance T Double where { type Parameters Double = Char; fetch _ = "hello" }
15:29 <mauke> fetch 'x' = ?
15:29 <Grisha> I see
15:29 <Grisha> thanks a lot folks
15:30 gehmehgeh joined
15:30 <ski> so you either need `Parameters' to be injective, or you need to have a method with `x' not (only) passed as argument to `Parameters'
15:31 <Grisha> ok, my actual problem is: I’m building the URL for a http request for diff data types. Some data types need one resource id, some need two, some zero
15:32 darjeeling_ joined
15:32 <Grisha> my initial solution would be to map the data type to the type of resource ids
15:32 <byorgey> Grisha: however, if you're using GHC 8, another solution is to turn on AllowAmbiguousTypes and TypeApplication, and call fetch with an explicit type argument, like fetch @Int or whatever.
15:32 <byorgey> I am not sure if this is a good solution.
15:32 <ski> can you use `data Parameters x' instead of using `type' ?
15:33 <Grisha> ski: what does that buy me?
15:33 <ski> then `Parameters' will be injective
15:33 <Grisha> hmmm
15:33 <Grisha> i’m really slow with that
15:33 jmelesky joined
15:33 <mauke> then every instance is forced to define a new type for Parameters
15:33 <Grisha> oh, I see
15:33 <byorgey> making Parameters an associated data type sounds like a good solution to me too
15:33 <Grisha> the `type` keyword just introduces a synonym
15:34 <Grisha> whereas `data` introduces truly distinct data types
15:34 trism joined
15:35 <Grisha> you’re all awesome
15:35 pgiarrusso joined
15:36 <Grisha> thank you all a lot
15:36 <ski> yw
15:36 Dookie12 joined
15:38 eacameron joined
15:39 cobreadmonster joined
15:39 pera_ joined
15:39 teto joined
15:40 cdornan_ joined
15:40 <Grisha> oh shoot, I’ve just written my first non-trivial polymorphic functions involving type deps and it compiled
15:41 BlueRavenGT joined
15:41 <akr[m]> Hello, I'm not sure how to use the connectionGetLine function from the connection package: https://hackage.haskell.org/package/connection-0.2.8/docs/Network-Connection.html#v:connectionGetLine
15:41 <akr[m]> I don't understand what it does if it doesn't read LF
15:42 <akr[m]> does it just throw away the data it's read and throws an exception?
15:42 fotonzade joined
15:42 <mniip> okay, I need help bikeshedding a library
15:42 <mniip> http://lpaste.net/355323
15:43 <mniip> I don't like the names of half of the constructors but I don't know of better ones
15:43 jer1 joined
15:44 akr[m] joined
15:44 <akr[m]> Context: I want to block until a whole line has been been delivered
15:44 posco joined
15:44 thunderrd joined
15:45 chlong joined
15:45 dibblego joined
15:45 dibblego joined
15:45 gawen joined
15:45 caw joined
15:46 <davean> akr[m]: well, what part leaves you in doubt? That documentation seems fairly clear to me
15:46 baamonde joined
15:46 Aidan[m] joined
15:47 <akr[m]> davean: I don't understand what happens it if doesn't read LF, apart from throwing an exception
15:47 <davean> It does various things if it doesn't read a LF in various circumstances
15:47 <davean> I mean, theres generally no "appart from"
15:47 <davean> throwing an exception *is what it does*
15:47 <davean> And if you look at the LineTooLong datatype, you see it contains no other data
15:47 <akr[m]> okay, so the data that was delivered isn't lost?
15:48 <davean> ...
15:48 <davean> No, its definately thrown away if you don't get a LF in the buffer limit + 1 chunk
15:49 <davean> not in the case you read the end of the file though
15:49 <davean> as it clearly states
15:49 <davean> "An end of file will be considered as a line terminator too, if line is not empty."
15:49 <davean> These are not resumable exceptions or something
15:49 <davean> it *throws an exception*
15:50 <davean> Perhaps you don't know what an exception is?
15:50 <mauke> why would it have to be resumable?
15:51 <mauke> we're talking about an operation with side effects on a mutable object
15:51 <davean> mauke: well, the exception doesn't store the data, so the only way you could get at the data after an exception was thrown would be if it was resumable?
15:51 <akr[m]> davean: well, I haven't really studied Haskell's IO exceptions in detail yet
15:51 <cocreature> merijn: fsestini: I’m using ghc 8.0.2 so you might want to try updating
15:51 <davean> akr[m]: this is a general exception concept really
15:51 <mauke> davean: or if it didn't throw it away and left it in the Connection
15:51 noahh joined
15:51 <cocreature> fsestini: ftr this is the exact file that I used http://lpaste.net/355326
15:52 <lyxia> cocreature: what about Eq
15:52 <cocreature> oh that fails for me as well
15:52 <cocreature> meh
15:52 noahh left
15:52 <davean> mauke: I suppose it could do that, but unless the semantics of some of the functions it uses are weird it doesn't.
15:52 isacloud joined
15:53 <davean> (it calls getChunk, which I assume actually getsa a chunk)
15:53 monomon[m] joined
15:53 closures999[m] joined
15:53 reactormonk[m] joined
15:53 bb010g joined
15:53 NickHu joined
15:53 <Grisha> ski: I’ve got another problem: when instantiating, I’m wringin “instance X Type1; data Parameters Type1 = String, fetch s = s`
15:53 davidar joined
15:53 Naughtmare[m] joined
15:53 riaqn joined
15:53 alaradia[m] joined
15:53 corintho[m] joined
15:53 nick2000 joined
15:53 angelbeats[m] joined
15:53 Lex[m] joined
15:53 iffsid[m] joined
15:53 jyp[m] joined
15:53 tfc[m] joined
15:53 travisr joined
15:53 M-BostonEnginerd joined
15:53 curry[m] joined
15:53 roadrunner168[m] joined
15:53 unlmtd[m] joined
15:53 unclechu joined
15:53 elwan7[m] joined
15:53 herzmeister[m] joined
15:53 karroffel joined
15:53 rdesfo[m] joined
15:53 m4lvin[m] joined
15:53 tester668[m] joined
15:53 seequ_ joined
15:53 jmnoz[m] joined
15:53 miviotros[m] joined
15:53 pellegrino joined
15:53 korayal[m] joined
15:53 sudoreboot[m] joined
15:53 Magnap joined
15:53 sirius[m] joined
15:53 aer[m] joined
15:53 M-berdario joined
15:53 davidar_ joined
15:53 hendrik[m] joined
15:53 M-Illandan joined
15:53 TheWizardTower joined
15:53 M-schmittlauch joined
15:53 srenatus[m] joined
15:53 MatrixTraveler[m joined
15:53 M-Quora joined
15:53 hiq[m] joined
15:53 TylerCecil[m] joined
15:53 hakan[m] joined
15:53 FederalRick[m] joined
15:53 bobjason[m] joined
15:53 goodboy[m] joined
15:53 Soif[m] joined
15:53 cbHXBY1D[m] joined
15:53 unknownln joined
15:53 wictory[m] joined
15:53 ptek[m] joined
15:53 jacqueline[m] joined
15:53 wr3n[m] joined
15:53 mmmrrr[m] joined
15:53 zaphar_ps[m] joined
15:53 <akr[m]> davean: ok, so presuming there is some data that was already delivered, the function returns as much as it can, stopping on newline?
15:53 jhinkle[m] joined
15:53 ollieh[m] joined
15:53 rfabbri[m] joined
15:53 moonarch joined
15:53 M-krsiehl joined
15:53 colton[m] joined
15:53 tomkerk[m] joined
15:53 TesX[m] joined
15:53 zar[m] joined
15:53 aspiwack[m] joined
15:53 Guest91110[m] joined
15:53 rakete joined
15:53 jascot[m] joined
15:53 M-kevinliao joined
15:53 ProofTechnique[m joined
15:53 noraesae joined
15:53 gentam[m] joined
15:53 NopeMarker[m] joined
15:53 drasich[m] joined
15:53 gkaplan[m] joined
15:53 M92854[m] joined
15:53 Yves[m] joined
15:53 JCGrant[m] joined
15:53 <mauke> the semantics it currently has are weird enough
15:53 <cocreature> 8.2rc1 also fails
15:53 <davean> mauke: yes, I agree the library seems very poorly designed
15:53 <Grisha> and it complains taht it cannon match String with `Parameters Type1`
15:53 <Grisha> *cannot
15:55 skeet70 joined
15:55 <davean> mauke: My argument is absed on the fact that the connectionGetLine function has an internal accumulator
15:55 <akr[m]> davean: I'm confused by "This throws an isEOFError exception on end of input" — what is end of input, exactly? Apparently not EOF, as EOF is considered a line terminator?
15:56 <davean> akr[m]: EOF
15:56 tazjin joined
15:56 <mauke> akr[m]: it depends on whether anything was read before hitting EOF
15:56 <davean> akr[m]: EOF is considered a line terminator if its buffer isn't empty
15:56 <mauke> if so, it is returned as a "line"; otherwise it throws
15:56 <davean> akr[m]: if its buffer isn't empty, it returns that, and the next call would be and EOF exception
15:56 <davean> This library looks TERRIBLE to me
15:57 <akr[m]> I see, thanks
15:57 LAZAR joined
15:57 <akr[m]> davean: heh, do you have any better recommendations?
15:57 <mauke> yeah, I wouldn't use it
15:57 <akr[m]> (I only want client-side connections)
15:58 teto joined
15:58 <Grisha> hm
15:58 <davean> akr[m]: I've not really considered the problem, esp your requirements
15:58 <davean> akr[m]: sorry
15:58 <davean> akr[m]: This library just raises a whole heap of red flags for me
15:58 macrover joined
15:59 <davean> akr[m]: I don't even REALLY know what you're trying to do
15:59 <akr[m]> well, it's getting quite a lot of downloads
15:59 <akr[m]> so if it's extremely bad, someone should tell all those people :)
15:59 niteria joined
16:00 <LAZAR> can I do pattern matching in lambda expressions? like (\Person name -> Student name)
16:00 <davean> There are a lot of people writing haskell without strong engenering skills lately
16:01 <lyxia> LAZAR: \(Person name) -> Student name
16:01 <geekosaur> LAZAR, you need parens there
16:01 <akr[m]> davean: also I'm not trying to do anything complicated, just communicate with a server in JSON-encoded messages
16:01 <davean> if we ever could use downloads as an indicator of quality, we can't now, and I really doubt we ever could
16:01 <LAZAR> ah thx
16:01 <akr[m]> I thought it would be nice if each JSON payload was on a separate line
16:01 osa1 joined
16:01 <davean> akr[m]: why don't you just parse JSON off the connection?
16:01 <davean> akr[m]: JSON isn't limited to single lines anyway
16:01 <davean> and its very parsable by its design
16:02 <davean> never mind its usually better form to length delimit connections
16:02 <akr[m]> I don't know how to parse JSON directly from the connection
16:02 <davean> https://hackage.haskell.org/package/aeson-
16:03 <davean> Its a lot less complicated to parse the JSON directly
16:03 <infandum> I'm scouring the internet and I really can't find out how to have a failure in ^.. as a Maybe
16:03 <davean> Its trivial to convert a stream of bytes to a stream of JSON values
16:03 jer1 joined
16:03 xcmw joined
16:03 <davean> Just keep applying that json parser
16:03 <akr[m]> davean: ah cool, didn't know you could do that so easily
16:04 <davean> akr[m]: its a LOT easier then what you were trying to do!
16:04 <akr[m]> indeed
16:04 mizu_no_oto joined
16:04 <akr[m]> thanks a lot, I'll do as you suggested :)
16:05 <davean> akr[m]: if you're using a streaming system like pipes, conduit, or machines its a small one-liner at that
16:05 <Grisha> mauke, ski, byorgey: thanks a lot, you helped me to solve a big problem, I’m heading home now
16:06 rogl joined
16:06 <cocreature> infandum: if you want to talk about failure and get a Maybe you probably want to use Prisms and use ^? instead of ^..
16:06 Sonolin joined
16:07 <davean> akr[m]: with conduit for example, you'd just push the stream into https://hackage.haskell.org/package/conduit-extra-1.1.15/docs/Data-Conduit-Attoparsec.html#v:conduitParser parameterized by 'json'
16:07 chlong joined
16:07 ludat joined
16:08 coot joined
16:08 lopex joined
16:08 <akr[m]> davean: this is quite nice, I need to read up on conduit though
16:09 <infandum> cocreature: Oh, so I can have ^? get values past the first one?
16:09 Gurkenglas joined
16:09 <cocreature> infandum: can you make some minimal example of what you are trying to do?
16:10 trampi joined
16:10 soLucien joined
16:10 <infandum> cocreature: [[1],[]] ^? traverse . ix 0 to return [Just 1, Nothing], for instance
16:10 descender joined
16:10 <infandum> oops, I mean [[1],[]] ^.. traverse . ix 0
16:11 <infandum> Instead, it treats failure as a filter instead, returning [1]
16:12 tromp joined
16:12 <davean> akr[m]: this sort of thing is a large part of the point of Haskell
16:13 <davean> akr[m]: it's rather uninteresting to have another language to write the same thing in, the point is to be able to write things better
16:13 <akr[m]> and safer, surely :)
16:13 meandi_2 joined
16:14 <davean> They go together
16:14 <cocreature> > [[1],[]] ^.. traverse . pre (ix 0) -- infandum
16:14 <lambdabot> [Just 1,Nothing]
16:14 rperry joined
16:14 <davean> Safe usually comes from structure and enforcing the structure
16:14 <infandum> cocreature: Welp, now I gotta study up on pre
16:16 <akr[m]> davean: well put… thought I think I prefer 'syntax' to 'structure', it's just more specific
16:16 sproingie joined
16:16 sproingie joined
16:16 <cocreature> infandum: the problem is that "ix" is a Traversal and traversals don’t have a notion of failure. pre converts a Traversal (or actually a Fold but every Traversal is a Fold) into something with a weird name that gives you a Maybe for the first element of the Traversal
16:17 dhil joined
16:18 Fairy joined
16:19 aarvar joined
16:20 <infandum> cocreature: Just the first element? Then how come it does the whole list?
16:20 eklavya joined
16:20 <cocreature> infandum: the first element that’s targeted by it’s argument. "ix 0" only targets 1 or 0 elements
16:21 <infandum> ah
16:21 <infandum> awesome, thank you!
16:21 xall_ joined
16:22 <infandum> cocreature: Yeah, the documentation for pre is a bit confusing for me
16:22 <infandum> without your help, that is
16:22 <cocreature> > [[1],[]] & traverse %~ preview (ix 0)
16:22 <lambdabot> [Just 1,Nothing]
16:22 <cocreature> that would be another solution
16:23 NeverDie joined
16:24 jer1 joined
16:24 SpinTensor joined
16:24 macrover left
16:25 fosterite joined
16:25 FreemanXiong joined
16:25 tsmish joined
16:26 jzeus joined
16:28 rkazak joined
16:28 negatratoron joined
16:29 MoALTz joined
16:29 <glguy> phadej: Is cabal-doctest on hackage known to be incompatible with ghc 8.2.1-rc1 builds?
16:30 Argue joined
16:30 <Argue> g d
16:31 <Argue> getting ending d now
16:31 <Argue> zoomed out to show the start menu we were like woahh
16:31 carlomagno joined
16:31 trig-ger joined
16:31 biglama joined
16:32 <Argue> oops
16:32 <Argue> sorry
16:32 <Argue> wrong chan
16:35 `^_^v joined
16:37 mjora7 joined
16:38 teto joined
16:39 jao joined
16:40 splanch joined
16:41 JeanCarloMachado joined
16:42 et09 joined
16:42 <et09> reading about applicative functors and see a reference to <*> <- what is that?
16:42 <cocreature> :t (<*>)
16:42 <lambdabot> Applicative f => f (a -> b) -> f a -> f b
16:42 <et09> ah - forgot the parens
16:43 <et09> ok thanks
16:43 primal joined
16:43 reino4477 joined
16:44 dooml0rd joined
16:44 jer1 joined
16:44 <reino4477> hi. How can I return json in Spock? I've tried this --> json "something" but it didn't compile
16:45 <reino4477> lexical error in string/character literal at character '\n'
16:45 <cocreature> that error is most likely unrelated to this. can you show us the complete file and all of the error message?
16:46 <reino4477> correction, there're many errors like this "Ambiguous type variable ‘a0’ arising from a use of ‘json’"
16:46 OliPicard joined
16:47 <cocreature> where have you gotten the json method from? I can’t find it in the Spock package
16:48 <cocreature> ah it’s in Spock-core
16:48 <reino4477> https://github.com/agrafix/Spock/blob/f1bd59b64a72da4181a3b2dd3a95beda25dabdbe/Spock-api-server/src/Web/Spock/Api/Server.hs#L42
16:48 <cocreature> do you have OverloadedStrings enabled?
16:48 <reino4477> yes
16:48 petrus joined
16:49 <cocreature> the problem is that the json function accepts anything that can be converted to json via the FromJSON instance. but since you have OverloadedStrings enabled GHC doesn’t know what "something" should be and different instances could potentially convert to different json values
16:49 <cocreature> so you’re going to have to provide explicit type annotations
16:49 <cocreature> e.g. json ("something" :: Text)
16:50 <reino4477> cocreature: thx, working
16:50 mikecaruso joined
16:51 reino4477 left
16:52 hybrid joined
16:53 sellout- joined
16:53 sellout- joined
16:54 mda1 joined
16:55 <petrus> hello, I am getting this error message when use "stack build"
16:55 <petrus> Compiler version mismatched, found ghc-8.0.1 (x86_64), but expected minor version match or newer with ghc-8.0.2 (x86_64-ncurses6)
16:56 fizruk joined
16:57 <petrus> I get this from a fresh skeleton project, but other older projects with the same resolver: lts-8.13 work fine.
16:58 Swizec joined
16:59 <petrus> I use the system ghc, and want to keep it this way. I can't see what went wrong, any suggestion?
16:59 <petrus> my stack version is 1.4.0
17:00 Folly joined
17:01 {emptyset} joined
17:01 jship joined
17:01 raichoo joined
17:02 flatmap13 joined
17:02 t7 joined
17:02 flatmap13 joined
17:02 tommd joined
17:03 sclv joined
17:05 jer1 joined
17:07 capicue joined
17:07 twanvl joined
17:07 michaelw joined
17:08 PotatoGim joined
17:08 <cocreature> petrus: are you sure that older projects still work or did they only work in the past? that error message seems correct to me
17:10 <cocreature> petrus: you’re probably going to have to mess with the compiler-check and/or compiler
17:10 <cocreature> options
17:10 balor joined
17:11 marcel joined
17:11 <petrus> cocreature, I am sure - I have just wiped out one's .stack-work, and rebuilt it, with no problem.
17:11 connrs joined
17:11 beanbagu1 joined
17:11 joelburget joined
17:12 <petrus> cocreature, my global .stack/config.yaml
17:12 <petrus> system-ghc: true
17:12 <petrus> compiler-check: newer-minor
17:12 <cocreature> 8.0.1 is not newer than 8.0.2 :)
17:13 <petrus> right, so why the other project works?
17:14 <cocreature> petrus: not sure. the only thing I can come up with that either there is a different GHC in $PATH or that stack is not using the system GHC for some reason
17:14 LHoT10820 joined
17:15 northfurr joined
17:15 <petrus> it is not clear to me what this newer-minor means, in the past I introduced because some lts demanded 8.0.2
17:15 <petrus> it helped!
17:15 <petrus> in the past I mean.
17:16 <cocreature> it shouldn’t. newer-minor works the other way around. if a stackage snapshot requires 8.0.1 and you have 8.0.2 then it should work.
17:16 soniku joined
17:16 <petrus> there is no different ghc, it would take a wee to compile on my machine. that's why I use system ghc
17:17 <cocreature> stack downloads GHC binaries so you don’t need to compile GHC even if you don’t use the system ghc
17:17 <petrus> cocreature, great, except is it signed?
17:18 <cocreature> no idea
17:18 <petrus> I don't think so, not really an option for me.
17:19 <davean> petrus: GHC is available over SSL which is a type of signature, just detached
17:19 physicalist joined
17:19 <petrus> davean, hmm ...
17:20 <kadoban> I believe that stack checks hashes on the things it downloads, like GHC. I'd have to look at the details though.
17:20 <davean> I mean, you'd likely get the public key over SSL also, which is why you'd trust it
17:20 <davean> so ...
17:20 DocWinter joined
17:21 <petrus> I have to think this ssl over ... still I would like to understand what is going on.
17:21 balor joined
17:22 <petrus> petrus, there must be some minor details I over look.
17:22 <petrus> (not to self :-)
17:23 sssilver joined
17:23 <petrus> I meant note
17:23 <davean> petrus: I'm not a stack user (Frankly I view it as counter productive) but one can easily pin the cert you're accepting uin most systems for extra security
17:25 joelburget joined
17:25 <petrus> davean, sure
17:26 jer1 joined
17:27 teto joined
17:28 kmels joined
17:28 insitu joined
17:28 balor joined
17:28 <petrus> davean, I am less and less a stack fan right now. Maybe I just return to good old cabal sandboxes.
17:29 <davean> petrus: new-build
17:30 hololeap joined
17:30 <lep-delete> build systems get more and more complex yet they still all dont work
17:30 oisdk joined
17:30 <petrus> davean, ???
17:30 primal_ joined
17:31 <davean> petrus: theres been a massive upgrade that replaces sandboxes
17:31 <davean> I mean sandboxs are still there but theres no reason to use them any more
17:31 gienah_ joined
17:31 Bassetts joined
17:31 <davean> lep-delete: I've yet to have a single major issue with cabal frankly
17:32 <cocreature> davean: except for the things that new-build doesn’t support :)
17:32 <davean> cocreature: yes
17:32 <cheater> hi
17:32 <lep-delete> cabal build links a new exe even when i havent touched a thing
17:32 <cheater> what is that website that has video talks side by side with the slides?
17:32 <lep-delete> which wastes time
17:33 <davean> lep-delete: but it correct
17:33 <davean> lep-delete: infact, it would often be incorrect not to?
17:33 <lep-delete> why relink when nothing has changed?
17:33 <davean> lep-delete: nothing tracked by *cabal* has changed
17:33 <davean> the system can change behind it
17:33 <cheater> lep-delete: why do cabal build if nothing has changed?
17:34 <davean> By calling build, you're claiming something has potentially changed
17:34 <davean> thus a relink is required
17:34 <davean> It would be incorrect to not relink
17:34 <lep-delete> meh, i only cabal for sandboxes anyway
17:34 <lep-delete> make still reigns supreme
17:34 mizu_no_oto joined
17:34 raichoo joined
17:35 <cheater> i dunno davean i don't think that logic stands up to scrutiny
17:35 <davean> cheater: Oh?
17:36 <cheater> it's just a layer of semantics that you've ascribed to explain a system that exists already..
17:36 <cheater> it's not necessarily intended
17:36 <davean> cheater: not really
17:36 <davean> cheater: this is a problem you run into with make a *lot*
17:36 <cheater> ok
17:36 joelburget joined
17:36 <cheater> i haven't been experiencing the problem but i trust your experience
17:37 <cheater> i'm looking for spj's talk on stm, with slides and video, does anyone have a link?
17:37 <davean> cheater: I suppose you've never maintained long running servers then - major distro upgrades cause it
17:37 <davean> with make you have to run everything from the top
17:38 <davean> (cabal cause cause that requirement too though)
17:38 <cheater> yeah you'd make clean
17:38 <cheater> and then make
17:38 <davean> cheater: and probably have to autoconfig too
17:39 <davean> external system tracking is a major failure point in build systems
17:40 yminsky joined
17:40 osa1 joined
17:40 Dookie12 joined
17:40 primal joined
17:42 mohsen_1 joined
17:43 sdemos joined
17:44 <petrus> davean, how is this new-build mixing with sandboxes?
17:45 <cocreature> petrus: it’s completely separate
17:45 <davean> Seperate
17:45 sssilver joined
17:45 simukis joined
17:45 <petrus> cocreature, except behaves differently when there is a sandbox -- as far as I understand.
17:46 Levex joined
17:46 <davean> petrus: to my knowlege new-build shouldn't behave differently - its not build
17:46 <cocreature> I would be very surprised if it behaves differently
17:46 jer1 joined
17:46 <cocreature> if that’s the case it’s probably a bug :)
17:47 rperry joined
17:47 uglyfigurine joined
17:47 dm3 joined
17:47 <nshepperd_> There are build systems that can track system changes, such as tup (it builds the program in a chroot over fuse)
17:47 <Tuplanolla> Oh, the other Tup.
17:48 <nshepperd_> Heh
17:49 <petrus> the cabal new-... help messages are full of "When using a sandbox, ..." and similar ones.
17:50 FreeBirdLjj joined
17:50 <petrus> OK, I need to read up on this new- thing. Using stack, I missed it.
17:50 epsilonhalbe joined
17:51 cloudhead joined
17:53 lancetw joined
17:53 grandy___ joined
17:53 <petrus> petrus, haskell tooling is just ...*@$#&(*^
17:54 <cocreature> petrus: if you compare it to haskell tooling 5 years ago, it’s pretty good :)
17:54 <davean> petrus: Haskell tooling is sufficient, but short of eligant
17:55 <petrus> cocreature, half full - half empty :-)
17:55 <davean> petrus: what in particular would you like improved?
17:55 <kadoban> Right about when stack started up things seem to have taken an upswing. But it's still far from perfect.
17:55 acertain joined
17:55 <davean> kadoban: I don't know, there was a long upswing before that, with sandboxes being added, etc
17:55 <davean> its been a constant evolution
17:55 <davean> Theres really no place it stopped making constant, notable improvements
17:56 <kadoban> I wasn't around before sandboxes. But even those never worked right for me, so I'm happy to see new-build being a thing. Haven't tried it though.
17:56 <phadej> @tell glguy yes, but it works with 8.2.1-rc2 (which is right around the corner)
17:56 <lambdabot> Consider it noted.
17:56 fosterite joined
17:56 <shapr> Long ago I would ghc from source and manually install packages. Haskell tooling is SO MUCH BETTER.
17:56 uglyfigurine joined
17:57 xcmw joined
17:57 <kadoban> Well, they kinda worked, they at least let me get things done. But I'd have to nuke the world bimonthly when something randomly broke, which was annoying, but was still something that worked enough.
17:57 <cocreature> it did improve before stack came around but stack definitely accelerated the development of haskell tooling (cabal itself included!) significantly
17:57 teto joined
17:57 Heero__ joined
17:57 sleffy joined
17:57 insitu joined
17:58 <shapr> Yeah, I'm a fan of stack.
17:58 <shapr> It's certainly not perfect, but things are better than they were before stack.
17:58 insitu joined
17:58 xxalien8dxx joined
17:58 <shapr> Sometimes I get frustrated when stack doesn't have a library I want
17:59 <cocreature> shapr: the funny thing is that stack is also probably the best thing that happened to cabal since it accelerated development so everybody can be happy :)
17:59 <shapr> but I figure if I really want a library that much, I can become a stack curator and fix the problem.
17:59 <MarcelineVQ> you can just ask it to grab the lib off hackage though :>
17:59 DataComputist joined
17:59 avn joined
17:59 <shapr> MarcelineVQ: yeah, but some libs still don't work that way
17:59 <MarcelineVQ> any in particular?
18:00 <kadoban> cocreature: That's also my feeling, heh. Most of my really big gripes with cabal-install disappeared fairly quickly after stack appeared. Though I've been reluctant to posit cause and effect.
18:00 <shapr> MarcelineVQ: off the top of my head, accelerate with CUDA/OpenCL had problems I just could not fix, though that was a few months back
18:00 <cocreature> kadoban: I just use both and complain about both equally :)
18:00 <shapr> Given time to go through my Haskell projects I'm sure I could come up with five or six
18:00 <cocreature> shapr: accelerate might be in stackage by now
18:01 <davean> MarcelineVQ: Uh, nothing I want would ever work that way
18:01 <shapr> Personally, I want hackage libraries ordered by most recent updated plus number of times downloaded
18:01 <kadoban> cocreature: I should try cabal-install new-build stuff sometime, I should try nix as well ... but I mostly just stick with stack 'cause I'm lazy :-/
18:01 rblaze1 joined
18:01 <davean> MarcelineVQ: stack is always ages in the past
18:01 <shapr> or maybe add in number of recently updated libs that depend on that library
18:01 <davean> MarcelineVQ: Stack feels like the stone age :(
18:01 <cocreature> shapr: at least I added llvm-hs to stackage partially because trevor asked for it so he could add accelerate
18:01 <shapr> I want a better way to skip the prototype libs that don't work well.
18:01 <MarcelineVQ> I see, since stack 1.4 custom cabal setrups are handled much better so don't be afraid to give it a shot again down the road
18:01 <cocreature> davean: your stack bashing is getting boring. if people are happy using it, just let them use it
18:02 <Tuplanolla> The past wasn't that bad, davean.
18:02 <davean> cocreature: They should feel free to, I was responding to shapr's issue and comiserating
18:02 flatmap13 joined
18:02 <davean> cocreature: I don't think I've even told anyone not to use stack, the closest was I said I couldn't help with an issue because I don't use stack
18:02 mikecaruso joined
18:03 <cocreature> “stack feels like the stone age” is not exactly helping anyone
18:03 <kadoban> I personally don't feel handicapped by old libraries/packages. Especially using the stackage nightlies, and knowing that I can pick a particular version of a library manually with extra-deps if I need it (or even pick one off of github if I really need)
18:03 <shapr> cocreature: I'll try accelerate again next week, I'd like to try CUDA/OpenCL dev in Haskell
18:03 <cocreature> and in the case of accelerate, you are probably even wrong. I’m pretty sure that the problem there is that the versions in stackage were too new
18:03 <MarcelineVQ> kadoban: pulling from github is one of stack's killer features, it's not far off from combing to cabal though
18:04 <kadoban> MarcelineVQ: Good, it'd be nice if they copied that, it's a nice feature.
18:04 <davean> I've always "pulled from github" with submodules
18:04 <davean> All my projects have a lib/ directory with submodules for extra dependencies
18:05 revprez_atlanta joined
18:05 binaryplease joined
18:05 <davean> I even have the current state of hackage as one of the submodules in some projects
18:05 {emptyset} joined
18:06 chaosmasttter joined
18:06 revtintin joined
18:06 <nitrix> Sounds like you're more or less emulating what stackage is trying to solve.
18:06 <shapr> At the rate I install libraries, I should be a stack curator.
18:06 codesoup joined
18:07 <shapr> I tend to jump into new fun projects and spend most of my time learning a few new libraries, and by that time the weekend is done and I'm on to the next project.
18:07 jer1 joined
18:07 <Tuplanolla> You're done, but the project is not, shapr?
18:07 <shapr> yup, exactly
18:07 <Tuplanolla> I have this problem.
18:07 <davean> nitrix: eh, sorta
18:07 <shapr> it's piles of fun, I guess that's all that matters.
18:08 <shapr> I've completed a bunch of code katas.
18:08 dansa joined
18:08 <shapr> I keep meaning to fix GHC for codewars.com, they need to update to ghc 8 from ghc 7
18:08 <dansa> Quicksort in functional programming. What is its time complexity? Is it different from the imperative programming? (Thank you. Good afternoon.)
18:09 <Tuplanolla> I have at least four physics engines sitting there, waiting to be finished.
18:09 stephe joined
18:09 alien8d joined
18:09 Itkovian joined
18:09 <shapr> Tuplanolla: somedays I consider pushing all my random code to github
18:09 <dansa> I understand it will consume more memory, but not in a relevant way. As far as I can see, the time complexity must be the same because the recursive function is called the same number of times. Does that proceed?
18:09 <shapr> but much of it is entirely incoherent
18:09 <kadoban> dansa: It depends how you write it. It's easy to get it to the same asymptotic complexity as written imperatively. But quicksort isn't used because of its asymptotic complexity.
18:09 <Tuplanolla> Indeed. I don't see anyone else enjoying n-dimensional floating-pointless physics either.
18:10 <shapr> that sounds interesting
18:10 <dansa> kadoban: consider the usual haskell two-liner. That's how I write it.
18:10 <shapr> I have part of the fitbit api
18:10 <kadoban> O(n^2) isn't much to write home about. Even expected O(n lg n) isn't too great.
18:10 <shapr> ah well, I could stand to chat less and code more
18:11 <kadoban> dansa: Depends how you do pivot selection what the asymptotic complexity is (which is the same story as written imperatively)
18:11 primal_ joined
18:11 <mniip> I have an nlogn qsort somewhere
18:11 <mniip> http://lpaste.net/354328
18:11 <kadoban> The median of medians one, or the usual randomized one?
18:11 <t7> what do i call new velocity after one step? like v'
18:11 <t7> ive heard people call it vee something
18:12 <shapr> v prime
18:12 <dansa> mniip: that's not the classic pure-version.
18:12 <mniip> dansa, it has nlogn worst case though
18:12 <mniip> for real
18:12 <t7> shapr: ta!
18:12 <dansa> I believe it. But it's not the beautiful qsort.
18:12 <mniip> duh
18:13 <dansa> I'm not not-appreciating your work. I appreciate it a lot.
18:13 <dansa> But I'm surprised to find out that the beautiful pure version isn't O(n^2) in the worst case.
18:13 <mniip> it is
18:13 <dansa> It is? That's what I'd like to understand.
18:13 <kadoban> dansa: It is. But the "beautiful" imperative version is too.
18:13 <mniip> if the list is backwards
18:13 <dansa> kadoban: Right.
18:14 <mniip> you're basically doing a quadratic reverse
18:15 <kadoban> dansa: You at least have to do pivot selection well to get something better than O(n^2) worst-case bounds.
18:16 <dansa> kadoban: I'm interested only in the worst case. So I'm asking myself: is the pure version worse than the imperative in-place version?
18:16 <kadoban> Considering only asymptotic complexity? No. But there's a reason that we don't *only* consider asymptotic complexity.
18:16 balor joined
18:16 <kadoban> I'd argue that quicksort's worst-case asymptotic complexity is *very* little of the reason it's used practically.
18:17 <dansa> Sure. I'm practice many constants matter. I insist the same. But at this moment, I'm really only concerned with assymptotic complexity in the worst case.
18:17 <dansa> /In/ practice [...].
18:17 sproingie joined
18:17 <kadoban> Then it'd be hard to argue that it's worse, by only that measure.
18:18 alien8 joined
18:18 <dansa> Okay. Do you see why? I'd like to build an argument that exposes this assymptotic equivalence.
18:18 <mniip> how about this beautiful pointless version
18:18 <Tuplanolla> Wow, lewd; assymptotic.
18:18 <dansa> I don't have any ideas at the moment. (By the way, I'm also only interested in the tmie-complexity, not space.)
18:18 jgertm joined
18:18 <mniip> @let qsort' = foldr ((uncurry (++) .) . uncurry (.) . (fmap . (:) &&& span . (>))) []
18:18 <lambdabot> Parse failed: Ambiguous infix expression
18:19 <mniip> what
18:19 <dansa> Tuplanolla: sorry about the misspelling. :)
18:19 <mniip> @let qsort' = foldr ((uncurry (++) .) . uncurry (.) . ((fmap . (:)) &&& (span . (>)))) []
18:19 <lambdabot> Defined.
18:19 Deide joined
18:19 <mniip> > qsort' [4,1,5,2,4,3]
18:19 <lambdabot> [1,2,3,4,4,5]
18:20 <dansa> That's beautiful!
18:20 <dansa> Very sophisticated.
18:20 <mniip> not quicksort though
18:20 xinming joined
18:20 <mniip> more like insertion, I don't know
18:20 <dansa> Not like the pure-version?
18:20 <dansa> Or like the pure-version?
18:20 <nitrix> Seems like an insertion-sort.
18:20 binaryplease joined
18:20 <dansa> I mean, the classic pure version.
18:20 <nitrix> Is it quadratic?
18:20 <mniip> yes
18:20 primal joined
18:20 WhiskyRyan joined
18:21 <nitrix> It's somewhat readable.
18:21 dm3 joined
18:21 <Tuplanolla> That's a missed opportunity to use `.:` though, mniip.
18:21 <mniip> I should've written 'f x . g x' as a join ;)
18:22 <mniip> ((f .) .) <*> g
18:22 <mniip> or something
18:22 <mniip> no
18:23 <kadoban> dansa: The argument would just be showing that they're both Θ(n^2) worst-case time I suppose, which shouldn't be too hard to show.
18:23 <mniip> (fmap . f) <*> g
18:24 <mniip> :t foldr ((uncurry (++) .) . ((fmap . (fmap . (:))) <*> (span . (>)))) []
18:24 mizu_no_oto joined
18:24 <lambdabot> (Ord a, Foldable t) => t a -> [a]
18:24 <mniip> much more conscise
18:24 govg joined
18:25 <Tuplanolla> :t foldr (uncurry (++) .: (fmap . fmap . (:) <*> span . (>))) []
18:25 <lambdabot> (Ord a, Foldable t) => t a -> [a]
18:25 <dansa> kadoban: I'm working on it. I'm convinced about it in the in-place C-like version. I'm not convinced about the haskell-classic-pure-two-liner.
18:25 <Tuplanolla> Let's not stop here, mniip.
18:26 <mniip> .: is in scope?
18:26 <Tuplanolla> :t (.:) -- Sure is.
18:26 <lambdabot> (Functor f1, Functor f) => (a -> b) -> f1 (f a) -> f1 (f b)
18:26 <mniip> where from
18:27 <mniip> I feel like 'foldr f []' could be rewritten
18:27 <Tuplanolla> I feel like the `fmap` pair could be merged.
18:28 jer1 joined
18:28 oish joined
18:28 <mniip> you think?
18:28 <Tuplanolla> Depends on the type applications.
18:28 <mniip> no
18:28 <mniip> there's two differnt functors
18:28 theelous3 joined
18:28 <mniip> one of them stands for (.)
18:28 buttbutter joined
18:29 <mniip> ah
18:29 <mniip> you mean using (.:)
18:29 <mniip> :t foldr (uncurry (++) .: ((.:) . (:) <*> span . (>))) []
18:29 <lambdabot> (Ord a, Foldable t) => t a -> [a]
18:29 iAmerikan joined
18:29 <Tuplanolla> Braille means good.
18:30 Uakh_ joined
18:30 mands_ joined
18:31 mikedlr joined
18:31 <mniip> :t foldr (uncurry (foldr (:)) .: ((.:) . (:) <*> span . (>))) []
18:31 <lambdabot> (Ord a, Foldable t) => t a -> [a]
18:31 fizruk joined
18:32 rblaze joined
18:33 baldrick joined
18:33 LKoen joined
18:33 customminer joined
18:34 cschnei__ joined
18:35 connrs joined
18:35 oisdk joined
18:36 <dansa> kadoban: I'm going to put the question in a more precise way --- with real code say in C. I realize there are (perhaps subtle) things to consider. For example, when in C, I can concatenate lists in constant time. So consider this following C program: http://lpaste.net/355329
18:37 <ij> I would like to have a Record that has an attribute that could be added only with an additional constructor with a different name. Is that possible? accessor (RecordAdditonal "bar" "foo") = Just "foo"; accessor (Record "bar") = Nothing
18:39 <lyxia> ij: uh, I didn't understand
18:39 ClaudiusMaximus joined
18:39 afarmer joined
18:40 takle joined
18:40 <ij> I would like to have a Record, whose one of values would be addable only via a different constructor.
18:40 osa1 joined
18:40 osa1 joined
18:41 <c_wraith> repeating the same words rarely improves communication.
18:41 <exio4> dansa: how is `append` or `concat` there constant time?
18:41 <ij> Hehe, sorry.
18:42 <ij> Can you redefine data/record constructors?
18:42 <exio4> dansa: List* append(List* l1, List *l2) does last(l1) which is O(|l1|)
18:43 <exio4> dansa: FWIW, that concat definition is sub-par, it would be "better" if it was append(ls1, append(ls2, ls3))
18:43 Destol joined
18:43 xinming joined
18:43 <lyxia> ij: what are you trying to do with that
18:43 <dansa> exio4: very well observed. What if I keep a pointer to my last element turning append into constant-time?
18:43 <exio4> dansa: as last(l1) has to traverse, first, ls1 completely (for append(ls1, ls2) and then that list again for the result of appending ls1 and ls2 together.
18:44 <lyxia> @where xy ij
18:44 <lambdabot> http://xyproblem.info/
18:44 <nitrix> Denotationally, it should be understood as append(list1, append(list2, list3), which can be done very easily in Haskell.
18:44 jo`ve joined
18:44 jo`ve joined
18:44 mystfox joined
18:44 rblaze joined
18:45 heurist` joined
18:45 <nitrix> Lists are just a degenerate case of trees.
18:46 <kadoban> dansa: I'm not sure why you don't just do the usual array implementation?
18:46 <exio4> dansa: well, that should work, but if we're modifying the structure, we might as well make it a double-linked list (which is quite painful to do in a non-mutable environment?)
18:46 <ij> lyxia, I know how to solve my problem in different ways, there's no xy problem.
18:46 <exio4> dansa: also, you're making some things harder (or adding another structure)
18:46 iAmerikan joined
18:46 rperry joined
18:47 <exio4> dansa: where are the Element and List definition? (as they feel to be the same?)
18:47 zeroed joined
18:47 zeroed joined
18:47 <lyxia> ij: explaining your problem would help make sense of the way you are currently looking for
18:47 rizary joined
18:47 <exio4> dansa: you're making removing an element a much more complicated operation by having a pointer to the end on every element, as then removing the final element out of a list would require to somehow change all "elements" whose end_ptr points to it
18:48 JoshS joined
18:48 <nitrix> dansa: Without mutable data structures, I think you can get something like O(log(min(n1,n2)))
18:48 <nitrix> for concatenation.
18:48 jer1 joined
18:48 <nitrix> O(1) if you don't care about the ordering.
18:48 <exio4> concatenation can be done in O(1)!
18:48 carlomagno joined
18:48 <exio4> just use difference lists! :P
18:48 JSharp joined
18:49 Bengi joined
18:49 rblaze joined
18:50 <nitrix> If that works like ShowS, it's only half the battle.
18:51 <exio4> dansa: FWIW, that's also leaking memory, badly :)
18:51 flatmap13 joined
18:53 <dansa> exio4: all memory is released as soon as the sort is done. :-)
18:53 uglyfigu_ joined
18:53 <dansa> exio4: I forgot to include my list.h in the paste.
18:54 dm3 joined
18:54 <Tuplanolla> Tangentially related, but you know you can say `e = malloc(sizeof *e)`, dansa?
18:56 <exio4> dansa: got it? I would like to run your code through valgrin :)
18:56 <exio4> valgrind*
18:57 caumeslasal joined
18:59 unyu joined
18:59 <dansa> Tuplanolla: I did not know. It makes actually sense. But when I wrote this, it didn't occur to me at all. Thanks for the *pointer*. :-)
19:00 crunchytype joined
19:00 dm3 joined
19:00 teto joined
19:00 <dansa> exio4: you're quite right: both List and Element are the same. I only created an alias to make the reading more natural.
19:01 rblaze joined
19:01 <dansa> exio4: paste with the declarations: http://lpaste.net/355331
19:02 <dansa> Sorry about that, by the way.
19:02 osa1 joined
19:02 osa1 joined
19:03 <dansa> (I've just edited to include EMPTY and IS_EMPTY.)
19:04 tzh joined
19:05 sproingie joined
19:05 SlashLife joined
19:05 <exio4> dansa: what about strerr?
19:05 <exio4> dansa: it's also missing one thing... the prototypes :P
19:05 teto joined
19:07 poga joined
19:08 bennofs joined
19:08 <dansa> exio4: you wanna run the program, right? I'll produce you a version that's complete. Hang on a second.
19:08 <dansa> Hang on a few minutes to be precise. :-)
19:09 jer1 joined
19:09 Elish joined
19:09 hooptw joined
19:11 <exio4> dansa: no problem, heh :p
19:11 <exio4> dansa: maybe you might wanna start a throwaway github repo?
19:12 xinming joined
19:12 balor joined
19:12 fotonzade joined
19:12 <ij> Are there any alternative non-manual Show derivation mechanisms? I've a single MVar, which, if ignored, would make the record useful to show.
19:12 meoblast001 joined
19:15 chaosmasttter joined
19:16 JeanCarloMachado joined
19:17 teto joined
19:17 <dansa> exio4: here's a complete version: https://hastebin.com/cativomode.cs (swtiched to hastebin as it seems to color it better.)
19:17 <dansa> exio4: thanks for the github suggestion. next time.
19:18 soniku joined
19:20 unK_ joined
19:22 kiltzman joined
19:22 darjeeling_ joined
19:23 yqt joined
19:23 kiltzman joined
19:23 zeroed joined
19:23 zeroed joined
19:24 <dansa> I can't just put a last item in struct Element. I'd have to make up a new struct, called say xList, with last and first pointers. I would not like to do that. I'm pretty much as minimalist as possible right now. I'd like to keep it that way. So I guess append() is not constant because I need to scan the entire list and there isn't anything I can do about it unless I change my data structure.
19:26 ploop joined
19:26 path[l] joined
19:28 takuan joined
19:29 insitu joined
19:29 <exio4> dansa: yeah, and having an xList also adds some extra boilerplate :P
19:29 jer1 joined
19:29 <exio4> dansa: "tail"/"rest" is no longer just returning something, but allocating memory
19:30 <dansa> yes, that's a pity, so I'd like to avoid that. wow, so true regarding rest. I'd like to allocate an xList structure every time. Bad news.
19:30 darjeeling_ joined
19:30 <dansa> I'd like ==> It'd have
19:31 cyborg-one joined
19:31 teto joined
19:31 <dansa> So, concat/append has a problem. It's not constant. How worse is that?
19:31 <dansa> It's not constant, but it must be O(n) due to last().
19:32 <dansa> Perhaps that makes this quicksort always O(n^2) and never O(n log n)?
19:32 <dansa> I don't know how see infer these things.
19:32 <dansa> to
19:33 <exio4> dansa: well, the first thing I notice is the memory leaks, the whole thing is never freeing the memory requested by cons
19:33 mmn80 joined
19:33 <dansa> Cons shouldn't free it.
19:34 <dansa> That's all I know at the moment.
19:34 <exio4> dansa: `requested by` :)
19:34 <dansa> Yes. :)
19:35 dddddd joined
19:35 Goplat joined
19:36 <exio4> dansa: one simple optimization, before I check anything, concat still has that issue I pointed before
19:36 zariuq joined
19:36 <exio4> dansa: append(append(L1, L2), L3) is worse than append(L1, append(L2, L3))
19:37 <dansa> return append(ls1, append(ls2, ls3)); (Next paste it'll be like that.)
19:37 herre[m] joined
19:37 <exio4> dansa: in the first case, the append(append(L1,L2), L3) has to first traverse L1, add L2 at the end, and then traverse that thing again, to add L3 at the end of L2
19:38 <exio4> while append(L1, append(L2, L3)) can avoid that, and traverse L1 and L2 once
19:38 <dansa> exio4: yes; that's very well observed. thank you!
19:38 northfurr joined
19:38 <dansa> that had not ocurred to me.
19:38 <exio4> so, the first would take |L1| + (|L1|+|L2|) steps, while the second is `only` |L1| + |L2|
19:39 <dansa> that's a relevant change --- in particular given the necessary work
19:39 <dansa> ... to make the change.
19:39 kamyar joined
19:39 <kamyar> Hello all
19:39 <dansa> hello
19:40 mjora7 joined
19:40 <kamyar> Please help me in using Reader monad
19:40 <kamyar> see this code: http://lpaste.net/355336
19:40 <dansa> Look, it's not clear to me any memory need to be freed. First, rest, concat, last, append, they all work with what they're given. They never throw anyway away and they shouldn't. I think maybe qsort must free some lists, but it's not clear to me how it should do that yet.
19:41 <dansa> s/anyway/anything/g
19:41 <exio4> dansa: work the step-by-step of a simple list cons(2, cons(1, cons(3, empty)))
19:41 earthy joined
19:41 <exio4> dansa: (err, btw, maybe we should move somewhere else, I think this is a bit too offtopic for #haskell?)
19:42 <dansa> exio4: sure. any suggestions?
19:42 earthy joined
19:42 <Tuplanolla> We have #haskell-offtopic.
19:42 <exio4> dansa: ^ :)
19:42 <kamyar> I need Reader monad for 1) using redis settings from config instead of defaultConnInfo 2) sending postgresql connection pool to all repository methods in another repository module
19:42 <dansa> #haskell-offtopic sounds good to me :)
19:44 nakal_ joined
19:44 dxdx joined
19:45 Yuras joined
19:45 flatmap13 joined
19:46 mands joined
19:46 vimalloc joined
19:47 <vimalloc> Total noob here. Can you do nested folds in haskell, something like this: https://gist.github.com/vimalloc/8f336250f5b807dd2316299b4db92172
19:48 gehmehgeh joined
19:48 fendor joined
19:49 <vimalloc> I'm probably just doing something stupid, but I can't figure out how to write this without getting type errors. If I only do one foldr for the inner lists, and do pattern matching ([] and (x:xs)) for the outer lists, it seems to work.
19:49 <Cale> vimalloc: why would you be prevented from doing so?
19:49 <Cale> oh, well, if it's a type error :)
19:49 <vimalloc> Sorry, should have started with that :P
19:49 <vimalloc> Just wanted to make sure it should work in theory before banging my head against it more
19:50 <Cale> This looks pretty similar to unlines . map (unwords . map show)
19:50 <vimalloc> I'll look into that. Thanks!
19:50 <Cale> what's with the tuple?
19:51 <Cale> your result appears to be more than just a String here
19:51 <Cale> You're returning a function and grid itself
19:51 <Cale> Did you mean to apply the function?
19:51 jmiven joined
19:52 <octarin> I think he did’nt mean to put a colon
19:52 <vimalloc> This is my working version: https://gist.github.com/vimalloc/1c2be7ac068e523915518dbd0cb424c6. Basically I'm just trying to convert that into using foldrs all the way down.
19:52 <Cale> octarin: a comma, you mean
19:52 <octarin> yes, a comma :)
19:52 <vimalloc> oh damnit!
19:52 <vimalloc> yep. Stupid commas. Thanks guys :)
19:52 <kamyar> Cale: Hello again! Please see my code and help again
19:53 jer1 joined
19:53 Tesseraction joined
19:54 _sg joined
19:54 mikecaruso joined
19:55 <hexagoxel> vimalloc: the existing foldr looks like `map show` plus `unwords`.
19:55 <hexagoxel> and the outer recursion is unlines, probably.
19:56 <vimalloc> I'll look at those two functions, cale mentioned them too. Thanks :)
19:56 <hexagoxel> unless that differs in newline after last item.
19:56 epsilonhalbe left
19:56 <* hexagoxel> should have read the last 10 lines of chat.
19:58 doomlord joined
20:00 <vimalloc> Totally overrated
20:02 macrover joined
20:04 <kamyar> No one helps me?
20:05 rperry joined
20:07 dxdx joined
20:08 <hexagoxel> kamyar: ah, now i am supposed to read 40 lines back? i hope this trend does not continue :D
20:08 <Tuplanolla> > foldr mniipQsortF [] [8, 1, 5, 3, 2, 1] -- We had this previously, dansa.
20:08 <lambdabot> [1,1,2,3,5,8]
20:08 <hexagoxel> i suppose you still are talking about http://lpaste.net/355336?
20:08 <Tuplanolla> > scanr mniipQsortF [] [8, 1, 5, 3, 2, 1] -- The intermediate results are useless.
20:08 <lambdabot> [[1,1,2,3,5,8],[1,1,2,3,5],[1,2,3,5],[1,2,3],[1,2],[1],[]]
20:08 teto joined
20:08 <LKoen> ? mniipQsortF
20:08 <kamyar> hexagoxel: No! I just want to use Reader monad for redis and rdbms settings
20:09 macrover joined
20:09 <kamyar> hexagoxel: I tried to get help hours ago but samples they send me was not applicable
20:11 cdg joined
20:11 path[l] joined
20:11 <* hexagoxel> does not understand the question.
20:12 jer1 joined
20:13 that_cannon_guy joined
20:14 Itkovian joined
20:15 <mniip> :t mniipQsortF
20:15 <lambdabot> Ord a => a -> [a] -> [a]
20:15 kamyar joined
20:15 phyrex1an joined
20:15 zeroed joined
20:15 zeroed joined
20:17 mrkgnao joined
20:19 unK_ joined
20:19 dm3 joined
20:20 synProgrammer joined
20:23 augur joined
20:24 dm3_ joined
20:24 zero_byte joined
20:25 <nitrix> It's for reasons like this that you're supposed to learn the language by developing a strong foundation than requesting help upon stumbling on practical problems rather than fumbling around, hitting practical problems and not understanding what part of the foundation you're missing that'd be applicable to your problem :/
20:26 northfurr joined
20:26 JeanCarloMachado joined
20:26 balor joined
20:29 vektorweg1 joined
20:29 insitu joined
20:31 <nitrix> *then
20:34 jer1 joined
20:34 <tdammers> the best way to learn is to stumble upon practical problems and then learning the relevant foundations so that the practical problems become solvable
20:34 balor joined
20:34 <tdammers> learning the foundations in a vacuum is just as silly as not learning them at all
20:34 halogenandtoast joined
20:35 <Tuplanolla> I tend to favor that, but never recover from the tangents, tdammers.
20:35 <nitrix> Agreed, but the "let's not learn anything until it's needed" leads to trial and error, which is very frustrating and a waste of time -- especially in a language that has big ideas like Haskell and strongly typed.
20:36 <nitrix> You'll constantly hit a wall and beg for help on IRC.
20:36 sellout- joined
20:36 zariuq joined
20:37 <nitrix> tdammers: I'll support your point up to "exercises are needed". I still think you should learn from bottom-up, starting with a foundation.
20:37 Xalphor joined
20:37 <nitrix> People have been really greedy and aggressive today to get help. I had one even say it was a "life of death" situation. I mean c'mon.
20:38 <tdammers> hmm yes
20:38 <tdammers> it does require a certain humbleness and an open mind
20:38 freusque joined
20:38 <tdammers> and I definitely didn't mean "stumble upon a practical problem and demand help while refusing to acknowledge the fact that what you're lacking is knowledge of the foundations"
20:39 <tdammers> au contraire
20:39 <davean> tdammers: I've found the "start with practical problems" version to leave me with skewed views it takes me many years to fix
20:39 sampuka joined
20:39 <nitrix> ^ this
20:39 <davean> tdammers: I've never managed to become as good a programmer in any system I've taken that approch in
20:39 <tdammers> my experience disagrees
20:39 <davean> tdammers: its always strongly limited my ability
20:39 v0latil3 joined
20:39 <nitrix> It was my experience as well with other languages. Thankfully I approached Haskell cautiously (by recommendation).
20:39 ChaiTRex joined
20:39 <tdammers> the whole problem-solution-order thing, y'know
20:40 <tdammers> the foundations won't make sense unless they address a problem you know
20:40 <nitrix> In the end, it's probably some loop that just dog-feed itself but anyway.
20:40 <tdammers> even if that problem is "I wonder what the underlying pattern here is"
20:40 <davean> The "learn theory and then find interesting ways to apply it" has usually lead me to much stronger patterns of thinking
20:40 danthemyth joined
20:40 <tdammers> I think it's a back-and-forth
20:40 <exio4> it's always a bit of both :)
20:41 yellowj joined
20:41 fizruk joined
20:41 <tdammers> you encounter a theory that's juuuust beyond your current horizon, study it, and realize that you can apply it to things you know
20:41 oisdk joined
20:41 <tdammers> but if the theory is too far from what you know, it just won't make sense
20:41 <davean> tdammers: what theory isn't just beyond your current horizon if you don't know it though?
20:42 <tdammers> and sometimes, it's actually something you already know and just didn't have a name for, or you just found a clearer formulation of it
20:42 <tdammers> davean: some are more than just a little bit beyond your current horizon
20:43 juliagoda joined
20:43 <Monoide> hello, I may have a silly question, I am trying to get the following code work point free, and below is my attempt
20:43 <hexagoxel> for me, a more important aspect is learning the relative (dis)advantages of new abstractions. what is frp good for, when exactly should i reach for it? that is much harder than understanding simple examples involving frp.
20:43 <Monoide> let five_up = 5 * (ceiling . (\x -> x / 5))
20:44 <Monoide> I do not really understand why this is not compiling
20:44 mizu_no_oto joined
20:44 <Tuplanolla> You're multiplying a function, Monoide.
20:44 <cocreature> Monoide: try (5 *) . ceiling . (/5)
20:44 <ski> did you mean `(5 *) . ceiling . (/ 5)' ?
20:44 <Monoide> (this simply round to the multiple of 5 up, like 50 -> 50, 52 -> 55)
20:44 <Monoide> oh, my bad
20:44 <Monoide> indeed, thank you <3
20:46 soLucien joined
20:46 <nitrix> Monoide: Equally, if not more readable: (\x -> 5 * ceiling (x / 5))
20:46 <Monoide> yes
20:46 <ski> > map ((* 5) . (`div` 5) . (+ (5 - 1))) [50 .. 56] -- Monoide, would something like this work ?
20:46 <lambdabot> [50,55,55,55,55,55,60]
20:47 <Monoide> I am more than happy, it is late here, I'm juste being silly
20:47 <ski> (in case you're working with integers, rather than fractionals)
20:47 <Monoide> couldn't see the homogeneity obvious error <_<
20:47 teto joined
20:47 <Monoide> this last version is way better, I agree
20:47 <nitrix> Monoide: Two insights here, function application always has the highest priority (if we ignore record update syntax) so the parens around `ceiling` aren't needed.
20:48 <nitrix> Monoide: Secondly, (\x -> x / 5) could be written as a section (/5)
20:48 d3lxa_ joined
20:49 <nitrix> (5*) . ceiling . (/5) -- Also fairly readable :)
20:49 x00r_ joined
20:49 <Monoide> right, thanks :)
20:52 RegEchse joined
20:52 <mniip> :t ((.) . (. ceiling) . (*)) <*> (flip (/))
20:52 oisdk joined
20:52 <lambdabot> (Integral c, RealFrac c) => c -> c -> c
20:52 twomix joined
20:52 <suppi> five_up x = 5 * ceiling (x / 5)
20:53 <suppi> just to be complete :)
20:53 kirillow joined
20:54 <nitrix> I just realised something. If <$> is more general than (.), and yet (.) is a categorical construct (Category) which is supposed to be an abstraction much higher... that seems to give a lot of power to morphisms suddently.
20:54 jer1 joined
20:54 refold joined
20:54 dhil joined
20:54 xcmw joined
20:54 <nitrix> That might just be me realizing there's a path to categories of categories.
20:54 <johnw> :)
20:54 vimalloc left
20:55 <johnw> a lot of concepts can be seen as objects or morphisms in some category
20:55 <johnw> "isomorphism" is just a morphism in a groupoid; "natural transformation" is just a morphism in a functor category; etc.
20:56 path[l] joined
20:56 <nitrix> johnw: Just like you can make monoids of endofunctors and obtain monads. That one blew my mind too.
20:57 <nitrix> I remember thinking people were just joking with mumbo jumbos and one day it clicked :P
20:57 <nitrix> Having small eureka moments here, slowly c:
20:57 <johnw> yes; the whole power here is seeing complex constructions as another example of a simpler, known sturcture
20:57 <johnw> nitrix: did you see my most recent blog post?
20:57 dejanr joined
20:59 <mniip> nitrix, (.) is more general than fmap imo
20:59 <mniip> because you're talking about the covariant Hom functor
20:59 Luke joined
20:59 zargoertzel joined
21:00 ystael joined
21:00 fosterite joined
21:01 <nitrix> I guess the question becomes "Would Haskell be able to type-check a definition akind to (.) = fmap" ?
21:01 <nitrix> With the proper type annotation.
21:01 <Tuplanolla> It's funny that you mention this, johnw. I had a moment today where a physicist colleague asked me what I was working with and I just said it's "the initial object in the category of algebras for this base functor".
21:01 <mniip> nitrix, I think that question is wrong
21:01 <mniip> you want to have fmap = (.)
21:02 <johnw> Tuplanolla: :)
21:02 <mniip> instance Category c => Functor (c a)
21:02 <Tuplanolla> Only then did I realize that my response was completely devoid of information.
21:02 <nitrix> mniip: Oh.
21:02 <mniip> as well as 'instance Category c => Functor c'
21:02 <mniip> but for that you need a more delicate functor class
21:02 <Tuplanolla> Is there even a question that can't be answered "x in the category of y"?
21:02 <Monoide> Tuplanolla: and so what is the real answer :) ?
21:02 <nitrix> Oh yeah otherwise you can't have categories of categories.
21:02 insitu joined
21:02 <nitrix> mniip: Which is where Haskell's Functors breaks, right?
21:03 <mniip> yes
21:03 <mniip> I should upload my Hask to github
21:03 <Monoide> Tuplanolla: in how many ways can you cut a polygones into triangles?
21:03 <nitrix> mniip: I'd love to see it.
21:04 <Tuplanolla> I'm sure there's one for that too, Monoide...
21:04 DisruptiveNL joined
21:04 flatmap13 joined
21:04 `^_^v joined
21:04 <Monoide> Tuplanolla: I'd be really curious if there is any interesting way to embbed Catalan numbers into nice categories
21:04 <nitrix> johnw: I had a fun exercise a few weeks ago, debating with people at work between what was the "best approach/most idiomatic/cleanest" between using some class inheritance of a language, vs doing some dependency injection to emulate composition. I ended up using CT to prove it formed a category :D
21:05 <nitrix> johnw: Composition always prevails >:3
21:05 dm3 joined
21:05 <mniip> nitrix, enjoy https://github.com/mniip/Hask/find/master
21:06 sproingie joined
21:06 <nitrix> Not that it made any difference mind you, I was just curious to see if they were equivalent and if so, which one was more general. Then CT came to mind and of course, composition. Composition is such a beautiful idea.
21:06 <nitrix> mniip: <3
21:07 <nitrix> class Functor (k :: kk -> kk -> *) (l :: ll -> ll -> *) (f :: kk -> ll) | f -> k l where fmap :: k a b -> l (f a) (f b)
21:07 dsfox1 joined
21:08 <mniip> nitrix, I think CT.Limit.Product is unfinished
21:08 <nitrix> mniip: Scary looking, heh. Is it why it's not in base :P ?
21:08 gaze__ joined
21:09 <mniip> there's an even scarier looking functor out therre
21:09 joelburget joined
21:09 <shapr> ok, what's your scariest functor?
21:10 uglyfigurine joined
21:10 <shapr> We should do a scary code evening near Halloween
21:10 bb4kk3r joined
21:11 <nitrix> instance Comonad Alien ...
21:11 bobakk3r joined
21:11 <mniip> class Functor k (f :: *) where type Dom :: * -> k -> k -> *; type Cod :: * -> k -> k -> *; fmap :: proxy f -> Dom f a b -> Cod f a b;
21:11 <mniip> something along those lines
21:11 fizruk joined
21:11 <mniip> with this you could have a true identity functor
21:11 <Tuplanolla> Could we lead newspapers to report on illegal assault functors?
21:12 <nitrix> Domain and codomains, seems clean though.
21:12 <nitrix> mniip: Curiously, would it ever be beneficial for Haskell to grow to use that?
21:12 <mniip> data Identity; instance Functor Identity where type Dom Identity a b = a -> b; type Cod Identity a b = a -> b; fmap = id
21:12 crave joined
21:12 <mniip> no wait
21:12 <mniip> fmap = const id
21:13 <mniip> nitrix, I think it doesn't fit
21:13 <mniip> see the proxy argument
21:13 <* nitrix> adds implict magic.
21:13 <nitrix> Yours worked though, I think.
21:13 <* nitrix> scrolls up.
21:14 <nitrix> Yeah yours is inbetween and still very reasonable.
21:15 <mniip> oh yeah
21:15 <mniip> I got stuck on product
21:15 jer1 joined
21:15 <mniip> and never got around to define monads
21:16 oisdk_ joined
21:18 coot joined
21:18 <nitrix> I'll have a look. This will probably make a lot more sense now. I should try implementing Hask too :P
21:20 oisdk joined
21:21 soniku joined
21:21 afarmer joined
21:22 <nitrix> mniip: http://mniip.com/powder/stock/
21:23 <nitrix> mniip: Interesting... you and I will need to chitchat some day :P
21:23 <mniip> that's uh
21:24 <nitrix> Tron 136% !
21:24 <mniip> let's say it's a very local meme
21:24 <nitrix> heh (:
21:25 dmiles joined
21:25 conal joined
21:26 bobakk3r joined
21:27 <mniip> 1494278846 [00:27:26] <+boxmein> mniip, say you're selling variations of cocaine 1494278847 [00:27:27] <+boxmein> powder stocks 1494278848 [00:27:28] <+boxmein> get it
21:28 dsantiag_ joined
21:28 <nitrix> I see. Anyway, heading home. Cheers~
21:29 Guest45076 joined
21:29 northfurr joined
21:30 teto joined
21:30 <kuribas> Why doesn't hackerrank include Data.MultiSet :(
21:30 <kuribas> there go my one-liners...
21:30 darjeeling_ joined
21:31 binaryplease joined
21:33 ikke joined
21:36 Denthir joined
21:36 joelburget joined
21:37 Levex joined
21:38 <kadoban> Heh, out of curiosity, what problem do you need them for?
21:39 jer1 joined
21:40 micmus joined
21:40 <oisdk> Is there any state-like transformer that lets you write instance Applicative m => Applicative (OddStateT s m)?
21:40 xcmw joined
21:41 <Tuplanolla> What would that be, oisdk? Nondeterministic state?
21:42 <mniip> oisdk, good question
21:42 <mniip> I stumbled across it myself too, as far as I can tell that's impossible with s -> m (a, s)
21:43 <oisdk> Had a look at the Update monad, but it seems like it won't work
21:43 <mniip> maybe, hmm, WriterT (Endo s)
21:44 danthemyth joined
21:44 teto joined
21:44 <oisdk> Tuplanolla I actually just want a random number generator that I can replay, but letting the underlying m be just applicative would make things fit more nicely
21:45 flatmap13 joined
21:45 dustmote joined
21:45 <mniip> m (s -> (s, a))
21:45 <mniip> would that work
21:45 dpren joined
21:46 <kuribas> kadoban: there are quite few
21:47 <kuribas> kadoban: ransom note from cracking the coding interview
21:47 <kadoban> Ah, I've actually read that one, but I didn't implement it.
21:48 Qommand0r joined
21:48 northfurr joined
21:49 rperry joined
21:49 <oisdk> mniip That looks good!
21:49 fizruk joined
21:49 splanch joined
21:51 leshow joined
21:51 <kuribas> kadoban: and contacts, which I solved with Data.Set, even though I'm supposed to use a trie :)
21:52 hiratara joined
21:52 <oisdk> I wonder why it's the other way around normally
21:53 <kadoban> Oh that one, I actually did that one. I wonder what I used
21:53 conal joined
21:53 <kadoban> Oh, that's one of the few I didn't use haskell, apparently a trie, heh.
21:53 Ciquattro joined
21:53 twanvl joined
21:54 <kuribas> kadoban: I just looked up the prefix (with splitMember), then counted the number of elements starting with it :)
21:54 <kadoban> Haha, that's pretty funny
21:55 <kadoban> I don't think I would have thought of that
21:55 <lyxia> oisdk: it's more useful and more efficient
21:55 <kuribas> probably wouldn't count in an interview...
21:55 <kadoban> I'd think it would, for a good interviewer.
21:57 SCHAPiE joined
21:57 burtons_ joined
21:57 <kuribas> kadoban: what other language?
21:57 <kadoban> I've done a bit of C++, though it's mostly reminded me why I stopped liking C++.
21:58 dan_f joined
21:58 jer1 joined
21:58 isenmann joined
21:58 <kadoban> Might try rust next, haven't been doing much hackerrank for a month or so though. Have google codejam coming up this weekend, probably after that.
21:58 afarmer joined
21:59 locallycompact joined
22:01 <kuribas> I'm trying C++ as well, to practice. It has more chance for a job thank haskell.
22:02 crobbins_ joined
22:02 e14 joined
22:02 <leshow> kadoban: I didn't like hackerrank much, having everything funnel through IO makes it odd. exercism.io I thought was fun though
22:02 <leshow> they have test cases you can run in cargo
22:02 <leshow> for each problem
22:03 <kadoban> I mostly factored out the IO parts, to the extent I could. Though it's not perfect, I don't have to spend much time thinking about input/output for the vast majority of problems.
22:03 joelburget joined
22:04 <leshow> fair enough, just saying if you want to try a site that actually spent some time thinking about each language they support
22:05 {AS} joined
22:05 <kadoban> Yeah, I like exercism.io, but what I do on hackerrank is just different. It's not really about learning the language, though I've learned a bunch of haskell because of it. It's about "competitive programming" and algorithms
22:05 sproingie joined
22:05 sproingie joined
22:05 locallycompact joined
22:05 <leshow> That can be fun, doing X algorithm isn't a great way to learn a language though
22:06 <leshow> the problems on leetcode are good too
22:06 <leshow> but they dont have the same protean language support hackerrank does
22:06 mdarse joined
22:06 <shapr> I enjoyed some of the Haskell puzzles on codewars
22:07 mmachenry joined
22:07 <kadoban> I didn't like what I've seen of leetcode, the problems and specifications didn't seem that well thought out :-/ I mostly do hackerrank and codeforces
22:07 <leshow> To each their own I guess
22:07 eschnett joined
22:07 <kadoban> Yeah. One of my friends spent a lot of time there and seemed to enjoy it and learn
22:07 <kadoban> (leetcode)
22:07 <leshow> Traditional algorithms in rust can be a bit odd because of ownership and borrowing rules
22:08 jml joined
22:08 <leshow> but then again, we're on #haskell lol
22:08 <kadoban> Yeah, I'm not sure how well that'll go, but I'm fairly excited to try.
22:08 <kadoban> Heh, ya.
22:08 Luke joined
22:09 <Tuplanolla> I noticed Rust doesn't have integer logarithms or any other extremely common number theory functions in its standard library, which is a big disappointment.
22:09 fosterite joined
22:09 <kadoban> Haskell doesn't either, does it?
22:10 <Tuplanolla> No, but it should.
22:10 milessabin joined
22:10 <leshow> Tuplanolla: what are you looking for? like log and log(basek)?
22:10 <hpc> :t \b -> floor . logBase b
22:10 <lambdabot> (Floating a, Integral c, RealFrac a) => a -> a -> c
22:10 <hpc> :t logBase
22:10 <lambdabot> Floating a => a -> a -> a
22:11 <Tuplanolla> That's slow and inaccurate, hpc.
22:11 <kadoban> Yeah, I've had to write my own before, it was unfortunate.
22:11 <Tuplanolla> In low-level languages it's very common to ask "how many bits does it require to represent this number" and the answer is an integer logarithm with rounding up.
22:12 <Tuplanolla> Another base comes up with "how long is this formatted number going to be".
22:13 <octarin> maybe in Data.Bits
22:13 <leshow> another thing that sucks about i32/i64/.. in rust std there's no generic Number trait
22:13 <leshow> with some effort you can put it together
22:14 <leshow> and there's crates to do it for you, but it's not in std
22:14 <kadoban> I though there's traits for like add and subtract and all the rest separately. Or is that not good enough?
22:14 <leshow> There is Add/Sub/Mul etc
22:16 <leshow> And you can definitely combine those to get something like Num
22:16 <kadoban> Is it just kind of tedious?
22:16 <leshow> yeah, it would be nice if it was included in std
22:16 <ChaiTRex> It's nice, because you can make types that don't include all the operations of Num.
22:17 <leshow> but sometimes i just want to say, take any type thats a number
22:18 e14 joined
22:18 antoine9298 joined
22:19 jer1 joined
22:20 JagaJaga joined
22:20 <antoine9298> hi. I’d like to know how ugly is this code, and see some more readable alternatives
22:20 <antoine9298> basically, I’m trying to have a set of conditions matched
22:21 <antoine9298> if any ($ args) [(1>).length, ("-u"==), ("-h"==)] then …
22:21 isenmann joined
22:22 <antoine9298> (also, I tried to use empty instead of `(>1).length`, but couldn’t find where it belong)
22:22 <ChaiTRex> I think you need null instead of empty.
22:23 <antoine9298> ^ thanks
22:23 <antoine9298> It works
22:23 <ChaiTRex> You're welcome.
22:24 <antoine9298> How bad it that code anyway?
22:25 pera joined
22:25 <ChaiTRex> It's not that bad. I'd personally do if any (\x -> null x || "-u" == x || "-h" == x) args, but it's just a personal preference.
22:26 <ChaiTRex> You might not need the null part if you're parsing command line options, since passing '' to a program is very rare.
22:26 kipd joined
22:26 <ChaiTRex> It doesn't mean that the argument list is empty.
22:27 <ChaiTRex> For that: null args || any ... args
22:27 <antoine9298> tried to golf it with any, but got caught with the “argh, the list is the 2nd argument”, that’s why
22:27 <antoine9298> (1st try with `any`)
22:27 <ChaiTRex> There also might be a nice option parsing library, but I haven't dealt with that myself.
22:28 <antoine9298> well, I though of it too, but it’s only for usage flag, so that’s not a big deal
22:29 <ChaiTRex> Ahh, OK.
22:29 <antoine9298> Nah, otherwise, it’s a bit like trying to parse JSON with regexp — madness.
22:30 juqrum joined
22:30 <antoine9298> (except that your broken inplementation is not as dangerous, but yet)
22:30 joelburget joined
22:33 <antoine9298> (but there are some that do even worse: they do it with html… https://ctrl.blog/entry/rdfa-socialmedia-metadata)
22:35 kritzcreek joined
22:35 northfurr joined
22:38 conal joined
22:39 teto joined
22:39 dfeuer joined
22:39 jer1 joined
22:41 mekeor joined
22:41 primal_ joined
22:42 fosterite joined
22:43 <antoine9298> hmm… I see what you meant with "passing '' as arg": I’ve given (← is that even english?) the arg list and the 1st arg test the same argument, can’t work.
22:43 AlainODea joined
22:44 <antoine9298> (the compiler could’nt type-check it ’cause the getArgs line was yet undefined, and a String is still a list)
22:44 <antoine9298> (or is it «I gave?»)
22:46 conal joined
22:46 shangxiao joined
22:48 joe9 joined
22:48 markasoftware joined
22:50 roar joined
22:50 <joe9> I am trying to read a binary data written to stdin, but, for some reason Data.ByteString.hGet does not seem to read anything. I piped the same output to xxd and it is being read fine. Any suggestions on what I might be missing, please?
22:51 <ChaiTRex> joe9: Try setting the reading mode. Let me see...
22:51 <joe9> oh, Thanks. will try that.
22:52 <ChaiTRex> hSetBuffering stdin NoBuffering
22:52 <ChaiTRex> Something like that.
22:53 <ChaiTRex> joe9: ^
22:53 <joe9> Thanks.
22:53 <ChaiTRex> You're welcome
22:54 <Cale> antoine9298: "I gave" (past tense) and "I've given" (perfect tense) are both valid English.
22:55 tromp joined
22:55 NeverDie joined
22:56 gugah joined
22:59 georgew joined
23:00 ludat joined
23:00 jer1 joined
23:00 uuplusu joined
23:01 cschneid_ joined
23:05 duog joined
23:06 sproingie joined
23:06 sproingie joined
23:06 <antoine9298> Cale, well, I guess it’s ok, then :-)
23:06 primal joined
23:06 alveric3 joined
23:09 JagaJaga joined
23:10 exferenceBot joined
23:10 fotonzade joined
23:11 joelburget joined
23:14 teto joined
23:14 soniku joined
23:17 ertes joined
23:21 jer1 joined
23:23 <mekeor> why is there no HOST environment variable in GHCI (ie. System.Environment.lookupEnv "HOST" == Nothing) although there is such a variable in my shell?
23:24 <hpc> are you sure there's such a variable in your shell?
23:24 <hpc> env | grep -i host
23:25 <mekeor> :O oh, indeed, there is no such variable
23:25 <mekeor> but `echo $HOST` returns my hostname...
23:25 avdi joined
23:25 <mekeor> it must be some shell-foo, huh?
23:25 <hpc> try echo $RANDOM sometime
23:25 <mekeor> i see
23:25 <hpc> yay for pseudo-variables
23:25 <geekosaur> mekeor, there are envars and shell vars
23:25 soniku joined
23:26 <mekeor> ah
23:26 <geekosaur> conventionally all-0uppercase is env, but bash cares not about convention
23:26 <geekosaur> so $HOST is a local shell var that is all uppercase
23:26 <geekosaur> "thanks, bash"
23:26 <mekeor> well, zsh does the same
23:27 DataComputist joined
23:27 <hpc> this is why i only use cmd.exe
23:27 <geekosaur> pretty sure zsh picked that up only because bash was already doing it and "all good linux programmers" therefore knew it is always available under that name as a 100% portable guarantee
23:28 <mekeor> thanks, bash
23:30 halogenandtoast joined
23:30 mda1 joined
23:32 cschneid_ joined
23:32 <hpc> when debugging, sometimes it helps to assume the code knows more than you
23:32 <hpc> the line where you draw that "sometimes" varies, but i find that most of hackage knows more than i do
23:32 <monochrom> Cunning plan: Fork bash to create a new shell, call it lash, to present environment variables as lowercase. :)
23:33 <hpc> that doesn't scale, you can only fix 25 bugs that way
23:33 <hpc> and some of them are already fixed!
23:34 <hpc> give it a guid, those are much easier to manage :P
23:35 northfurr joined
23:35 beerdrop joined
23:35 <monochrom> Good idea!
23:36 <hpc> #!/bin/71bbee79-42a6-4a86-a18e-eaf8a2adc298
23:36 <hpc> #!/bin/71bbee79-42a6-4a86-a18e-eaf8a2adc298 -x for debugging
23:37 <hpc> also TIL if you search duckduckgo for "guid" it generates one
23:37 <geekosaur> (zsh certainly has its own sins; it's a csh-oid, which means it conflates envars and shell vars *differently* weirdly, and has a bunch of lowercase vars with odd behaviors to emulate csh)
23:37 tromp joined
23:38 joelburget joined
23:39 ChaiTRex joined
23:39 tromp joined
23:39 robertkennedy joined
23:41 louispan joined
23:41 jer1 joined
23:41 et09 joined
23:42 <et09> i'm trying to read this: http://www.staff.city.ac.uk/~ross/papers/Applicative.pdf
23:42 <et09> and i'm having trouble understanding this line on page 2: sequence (c : cs) = return (:) ‘ap‘ c ‘ap‘ sequence cs
23:42 <monochrom> hpc! I just notices that the prefix 71bbe looks too similar to "tibbe". Is there is hidden message? :)
23:43 ChaiTRex joined
23:43 nakal joined
23:43 _M joined
23:43 flatmap13 joined
23:44 <monochrom> !. Do you know "ap"? 2. Do you know the infix syntax such as 10 `div` 3 ?
23:44 <mekeor> :t ap
23:44 <lambdabot> Monad m => m (a -> b) -> m a -> m b
23:44 <et09> i don't know "ap", but i see the definition right above it. and i get infix syntax, altho not positive on the operator precedence here - is it going from left to right?
23:45 <monochrom> It is infixl. (return (:) `ap` c) `ap` sequence cs
23:45 theDon__ joined
23:46 <et09> ok, so (return (:) `ap` c) is a monadic wrapped function?
23:46 <et09> is that right?
23:47 <monochrom> Since it uses ap twice, it is going to be a stress test on your understand of ap. You may need to work slowly, e.g., begin with "Just sin `ap` Just 0.1".
23:47 <monochrom> Let's ask lambdabot
23:47 markus1209 joined
23:47 <monochrom> @type return (:) `ap` (Just 5)
23:47 <lambdabot> Num a => Maybe ([a] -> [a])
23:47 Welkin joined
23:47 markus1219 joined
23:47 <monochrom> Generalize "Maybe" to arbitrary monad m.
23:48 dfeuer joined
23:48 <monochrom> The []'s are caused by (:). They stay.
23:51 <et09> ok so ap took two arguments, (return (:)) and (Just 5) - right? so those are the arguments m a and m b
23:51 <et09> and it merged it to m (a b)
23:51 <et09> and it merged it to m (a -> b)
23:51 raviko joined
23:52 <monochrom> m (a->b) and m b.
23:52 <et09> wait sorry.
23:52 <monochrom> Err heh
23:52 <monochrom> m (a->b) and m a.
23:52 <et09> it took m (a->b) and m a
23:52 <et09> yeah
23:52 <et09> so this should give a -> b
23:52 <et09> :t (:)
23:52 <lambdabot> a -> [a] -> [a]
23:53 <et09> ugh n/m lol i get it
23:53 jer1 joined
23:54 <et09> but i guess the idea is that the whole expression -- return (:) `ap` c - has the type m (a->b), thus it can be fed again as the first argument to ap. right?
23:54 <Welkin> why are you using `ap` and `return` (or monads) here?
23:54 <Welkin> why not use applicative?
23:54 northfurr joined
23:55 <monochrom> return (:) :: m (a -> ([a] -> [a]), so b = [a]->[a].
23:55 <et09> Welkin: i'm trying to understand an article explaining the invention of applicative, lol
23:55 <Welkin> lol
23:56 <monochrom> return(:) `ap` c :: m b = m ([a]->[a])
23:56 <monochrom> which is ripe for one more ap.
23:56 <et09> got it
23:57 infinity0_ joined
23:57 infinity0_ joined
23:57 teto joined
23:58 joelburget joined