<    March 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:09 Rizy joined
00:14 mengu joined
00:19 louispan joined
00:30 Apocalisp joined
00:30 hphuoc25 joined
00:33 justicefries left
00:41 conal joined
00:46 dpren joined
00:49 Rizy joined
00:50 dni- joined
00:57 takle joined
00:58 peterbecich joined
00:59 fhoffmeyer1 joined
01:08 eacameron joined
01:08 takle joined
01:10 NeverDie joined
01:15 Rodya_ joined
01:16 takle joined
01:18 peterbecich joined
01:20 Apocalisp joined
01:30 merijn joined
01:31 takle joined
01:33 peterbecich joined
01:34 peterbecich joined
01:35 peterbecich joined
01:35 chin-tastic joined
01:36 peterbecich joined
01:36 Youmu joined
01:36 \Mike joined
01:37 peterbecich joined
01:40 Lazersmoke joined
01:46 takle joined
02:00 fhoffmeyer1 joined
02:02 louispan joined
02:08 takle joined
02:13 Rodya_ joined
02:15 <Vzox01> Hey, guys, did you know that "monada" means cute in Spanish? Kinda found it curious and funny.
02:18 louispan joined
02:24 takle joined
02:27 Rodya_ joined
02:31 hphuoc25 joined
02:33 Apocalisp joined
02:35 takle joined
02:36 justicefries joined
02:37 <justicefries> nt
02:38 Rodya_ joined
02:40 dni- joined
02:40 <benzrf> Vzox01: cute
02:43 peterbecich joined
02:44 takle joined
02:45 shayan_ joined
02:45 louispan joined
02:46 aarvar joined
02:55 conal joined
02:55 tom7942 joined
02:55 takle joined
02:57 emmanuel_erc joined
02:57 tokik joined
02:58 leothrix joined
03:01 takle joined
03:02 fhoffmeyer1 joined
03:03 takle_ joined
03:03 peterbec` joined
03:10 takle joined
03:19 tch024 joined
03:25 louispan joined
03:27 takle joined
03:29 hphuoc25 joined
03:34 <tch024> in the definition of Functor, there's this line: instance Functor ((->) r)
03:34 <tch024> what does this 'r' on the most right refer to
03:34 takle joined
03:36 <geekosaur> ((->) r) means a function that takes some parameter. r is the parameter
03:37 <geekosaur> (you can't use the function arrow in section syntax, so this has to be written in prefix form. as a section, were it valid syntax, this would be (r ->) as partial application of (r -> a))
03:38 <geekosaur> remembering that this is at type level, not value level...
03:38 nomotif joined
03:39 <tch024> thanks for your answer, actually i was confused on how to read this in the context of applicative
03:39 <tch024> specifically f (a->b) where function is the applicative
03:42 exferenceBot joined
03:42 kagcc joined
03:44 takle joined
03:47 hexagoxel joined
03:48 conal joined
03:49 tom7942 joined
03:49 louispan joined
03:50 <louispan> tch024: (->) r is another way of writing (r ->)
03:50 <louispan> which is the Reader r monad
03:50 <louispan> Umm...
03:51 Rodya_ joined
03:51 <louispan> It is saying that all functions that take an 'r', can be fmap'ed to another function that take an 'r'
03:52 <louispan> so if you know how to (a -> b), then you can convert (r -> a) to a (r -> b)
03:53 <tch024> thanks!
04:03 takle joined
04:03 fhoffmeyer1 joined
04:05 suls joined
04:22 takle joined
04:28 dni- joined
04:30 hphuoc25 joined
04:31 takle joined
04:44 systemfault joined
04:46 tom7942 joined
04:46 fhoffmeyer1 joined
04:50 bungoman_ joined
04:58 kagcc joined
04:59 uglyfigurine joined
05:03 takle joined
05:04 peterbec` joined
05:05 qu1j0t3 joined
05:09 takle joined
05:17 takle joined
05:23 koodailar joined
05:25 takle joined
05:42 hexagoxel joined
05:43 peterbecich joined
05:44 aarvar joined
06:08 chadrs joined
06:17 dni- joined
06:21 uglyfigurine joined
06:23 takle joined
06:29 takle joined
06:30 hphuoc25 joined
06:37 takle joined
06:46 takle joined
06:48 meandi_2 joined
06:50 ThomasLocke joined
06:50 ThomasLocke joined
06:56 Rizy joined
06:56 pie_ joined
07:00 liangzan joined
07:03 <liangzan> hello, i’ve hit a wall with mysql-simple
07:03 <liangzan> http://lpaste.net/353765
07:03 takle joined
07:03 <liangzan> can anybody give me a hint?
07:03 Pupnik joined
07:05 peterbec` joined
07:06 ali_bush joined
07:09 zaquest joined
07:11 nomotif joined
07:19 hdeshev joined
07:27 kritzcreek_ joined
07:35 louispan joined
07:36 <glguy> liangzan: add a type signature to the result you are inspecting with case
07:36 hphuoc25 joined
07:36 <glguy> it's ambiguous what sort of empty list you're checking for
07:37 <liangzan> yup, i got that working now
07:37 <liangzan> thanks to the guys at #haskell
07:38 buoto joined
07:43 dni- joined
07:53 louispan joined
07:59 thc202 joined
08:04 takle joined
08:09 yellowj joined
08:09 uglyfigurine joined
08:12 mengu joined
08:20 Durz0 joined
08:24 louispan joined
08:27 gmg85 joined
08:32 mattyw joined
08:34 hvr joined
08:36 peterbec` joined
08:40 hvr joined
08:51 kagcc joined
08:52 grdryn joined
09:00 buoto joined
09:01 louispan joined
09:02 pie_ joined
09:24 gregman_ joined
09:27 galderz joined
09:27 Rizy joined
09:27 vito_swiss joined
09:41 takle joined
09:42 dnaeon joined
09:47 hexagoxel joined
09:51 takle joined
09:57 zero_byte joined
10:15 mmo joined
10:31 Rizy joined
10:36 peterbec` joined
10:40 merijn joined
10:51 netheranthem joined
10:53 Rizy joined
10:58 hphuoc25 joined
11:00 pie_ joined
11:03 buoto joined
11:17 ederign joined
11:29 madjestic joined
11:30 AndreasK joined
11:30 buoto joined
11:31 uglyfigurine joined
11:34 merijn joined
11:38 snowcrshd joined
11:38 peterbec` joined
11:50 Baikonur joined
11:50 <Baikonur> hi
11:51 <Baikonur> so why does haskell-platform include sthings from x11 etc
11:51 <Baikonur> it's over a GB without docs
11:55 freechips joined
11:57 adjesticm joined
12:02 suls joined
12:07 <Baikonur> just installing haskell is intimidating
12:08 suls joined
12:10 <yushyin> depends! I just had to install stack via the package manager of the linux distribution I use and I was ready to go.
12:13 suls joined
12:18 <hvr> Baikonur: it's the "batteries included" distribution
12:19 <hvr> Baikonur: otoh, an unpacked GHC 8.0.2 is also already 1 GiB of installed space
12:20 <hvr> the major contribution from the HP you see comes from GHC proper
12:20 <hvr> (and Stack can't evade this)
12:20 skapazzo joined
12:23 pie_ joined
12:27 <Baikonur> my result from installing just ghc with apt would be 667 MB
12:31 <Baikonur> maybe I'll just install the haskell platform and go from there
12:31 <Baikonur> without docs or prof or anything else
12:32 <Baikonur> I just don't get why it installs x11 things
12:32 <Cale> Is 1GB even a significant amount?
12:33 <Baikonur> my only *nix platform is a raspi, so there's a limited amount of space
12:33 <Cale> ah
12:34 <Baikonur> well, there's also a netbook but I don't like coding on that
12:34 <Baikonur> I mean, I could just keep it on and ssh into it like I do with the raspi but...
12:48 jud^ joined
13:01 howdoi joined
13:14 pbrant joined
13:17 jomg joined
13:18 bydo joined
13:21 mmo left
13:23 stef204 joined
13:32 DataComputist joined
13:33 nepiktaz joined
13:34 merijn joined
13:35 DataComputist joined
13:36 DataComputist joined
13:36 DataComputist joined
13:37 ^jud joined
13:37 DataComputist joined
13:37 DataComputist joined
13:38 DataComputist joined
13:40 peterbec` joined
13:40 Big_G joined
13:44 nepiktaz joined
13:52 carlomagno joined
13:56 yellowj joined
14:00 hoffmeyer joined
14:06 <ThomasLocke> I'm fairly confident that I have lost my way. I've written something that looks as "bad", but I can't figure out how to make it right.
14:06 <ThomasLocke> ints <- forM (map qLen qs) ($ 0)
14:07 <ThomasLocke> I feel I should be able to use . to get rid of running over the qs list twice, but I can't for the life of me make my brain come up with a solution.
14:07 harfangk joined
14:08 <ThomasLocke> qLen :: QCtrl Job -> Int -> IO Int
14:08 <ThomasLocke> qs :: [QCtrl Job]
14:09 <Akii> :t forM
14:09 <lambdabot> (Monad m, Traversable t) => t a -> (a -> m b) -> m (t b)
14:10 <Akii> :t ($ 0)
14:10 <lambdabot> Num a => (a -> b) -> b
14:10 <Akii> wat
14:10 <Akii> well `forM qs (($ 0) . qLen)
14:10 <Akii> `
14:10 <ThomasLocke> Akii, As stated: I've lost my way completely.
14:10 <Akii> oh wait
14:10 <Akii> hm
14:11 <Akii> no idea xD
14:11 <ThomasLocke> at least I'm not alone then! :D
14:12 <Akii> well try what I wrote, could work
14:12 <Akii> `forM qs (($ 0) . qLen)`
14:12 <ThomasLocke> ints' <- forM_ qs (`qLen` 0)
14:12 <ThomasLocke> seems to also do the trick.
14:12 <ThomasLocke> forM
14:13 <ThomasLocke> not forM_ ... typo!
14:13 <merijn> forM is really for when you want to have a nice way to write a do block as argument, why not just mapM here?
14:13 <ThomasLocke> Thanks for the gentle push Akii - was driving me mad. :D
14:13 <ThomasLocke> merijn, Good question.
14:13 <ThomasLocke> I have no good answer. I just used forM.
14:13 <Akii> follow merijns advice :D he knows way more stuff
14:14 <ThomasLocke> Will do!
14:14 <* ThomasLocke> wanders of to do experiments
14:14 <merijn> "mapM (($0) . qLen) qs" althought that could simplify to "mapM (\q -> qLen q 0) qs"?
14:14 <merijn> ThomasLocke: Also, did you write qLen yourself?
14:14 <ThomasLocke> Dude.. So awesome. Thanks!
14:15 <merijn> (and what does qLen do?)
14:16 e14 joined
14:16 <ThomasLocke> merijn, Yea.. It grabs the length of a STM TQueue, and emits a warning if it's higher than some value.
14:17 <merijn> ThomasLocke: Where I'm going with this is: if this is a common usecase, wouldn't it be nicer to flip the argument of qLen so that it's "Int -> QCtrl Job -> IO Int"?
14:17 <merijn> Becasue then you could simply write "mapM (qLen 0) qs"
14:17 <ThomasLocke> Good point.
14:17 <merijn> (Whether this makes sense depends on how you "normally" want to use qLen)
14:18 <ThomasLocke> There's really no "normally" here - it's just a toy program for learning purposes.
14:18 chlong joined
14:18 <merijn> ThomasLocke: Right, then I think that's even cleaner. Generally I decide argument order based on "how likely am I to want to partially apply this"
14:19 <ThomasLocke> merijn, That makes very good sense. I'm new to this whole "partially apply" thing, so it's still pretty hard to remember to think about those things.
14:21 <merijn> ThomasLocke: Lots of practice ;)
14:22 <ThomasLocke> Hehe, indeed.
14:22 <merijn> ThomasLocke: Also, if it's any consolation, the "first pass" of like 50% of the haskell code I write is way more horrific than that. The nice thing is that once you've written it it's usually not too hard to refactor and simplify until you have something elegant like "mapM (qLen 0) qs" :)
14:23 <ThomasLocke> Yea. Also I gotta say: Already I'm enjoying not doing OO. My God this is soooo much more clean.
14:24 <ThomasLocke> The only thing I'm not enjoying about Haskell, is that I'm still pretty bad at detecting space leaks.
14:24 <ThomasLocke> That's no fault of the language though.
14:38 uglyfigurine joined
14:39 Rizy_ joined
14:41 ysgard joined
14:42 Apocalisp joined
14:42 tom7942 joined
14:46 takle joined
14:53 sbrg joined
14:57 plakband joined
15:12 Cale joined
15:14 <ThomasLocke> Maybe is Foldable, right?
15:14 <ThomasLocke> yes it is.. nice
15:14 uglyfigurine joined
15:15 pie_ joined
15:23 blissdev joined
15:26 mounty joined
15:41 peterbec` joined
15:59 jathan joined
16:04 <nitrix> You develop that instinct over time. Try not building up unevaluated thunks unecessarily and reason about what references are held for longer than needed.
16:05 <nitrix> Granted, a big portion of these "space leaks" would be present in procedural code too, because people have a tendency to generate some data, then process it, then discard it, proceduraly, instead of doing the traversal once and applying all the transformations at once.
16:06 <nitrix> Only in lazy languages we worried this much about space leaks, because we have means to avoid them and gain better performance.
16:07 <nitrix> The remaining small amount of them are the though ones to figure out but it's so rare.
16:08 conal joined
16:16 kattak joined
16:17 kattak left
16:18 meandi_2 joined
16:28 merijn joined
16:29 e14 joined
16:36 buoto joined
16:40 buoto joined
16:42 Apocalisp joined
16:43 kattak joined
16:44 buoto joined
16:52 AndreasK joined
16:58 ysgard_ joined
17:07 e14 joined
17:11 ysgard joined
17:11 uglyfigurine joined
17:11 uglyfigurine joined
17:16 aarvar joined
17:18 ysgard joined
17:37 aarvar joined
17:42 nil_ joined
17:43 peterbec` joined
17:45 ederign_ joined
17:45 wildlander joined
17:46 mizu_no_oto_work joined
17:47 vmeson joined
17:50 kadoban joined
17:51 aarvar joined
17:52 e14 joined
17:53 FullyFunctional1 joined
17:57 taksuyu joined
17:58 jomg joined
17:59 ederign joined
18:05 uglyfigurine joined
18:11 uglyfigurine joined
18:12 e14 joined
18:18 e14 joined
18:24 Gurkenglas joined
18:25 chrissl joined
18:32 peterbec` joined
18:33 animated joined
18:37 nadirs joined
18:43 animated joined
18:43 takle joined
18:43 eacameron joined
18:45 Deide joined
18:46 expo873 joined
18:55 freechips joined
18:57 ederign joined
19:13 chlong joined
19:13 e14 joined
19:17 nomotif joined
19:19 takle joined
19:20 takle joined
19:27 malaclyps joined
19:29 dni- joined
19:31 gfixler joined
19:50 mengu joined
19:56 animated joined
20:12 chrissl joined
20:15 takle joined
20:16 zaquest joined
20:28 chrissl joined
20:28 malaclyps joined
20:34 shayan_ joined
20:37 grayjoc joined
20:38 mizu_no_oto_work joined
20:46 conal joined
20:47 jakb joined
20:48 <jakb> hello people, I have function type signature question, is there anybody that could help me with an exaple problem I'm looking into at the moment?
20:48 chlong joined
20:49 <kadoban> jakb: Probably several, sure.
20:49 <splanch> I will help if I can. What's the question?
20:50 <jakb> I'm going through the haskell programming book and currently I'm supposed to understand function type signatures, the example is:
20:50 <jakb> g :: a -> b -> c -> b
20:50 <jakb> `g 0 'c' "woot"` the type of `g` is `Char`
20:50 <jakb> that I understand
20:50 <jakb> h :: (Num a,Num b) => a -> b -> b
20:50 <jakb> `h 1.0 2` is a type of `Num b` I kind of get that too - similar principle as above
20:51 <jakb> but
20:51 <jakb> kessel (Ord a, Num b) => a -> b -> a
20:51 <jakb> `kessel 1 (2 :: Integer)` is type of `(Ord a, Num a) => a` and that I do not understand at a
20:51 <jakb> * at all
20:51 <jakb> why isn't it just a type of Ord a?
20:52 <monochrom> No, the type of g is not Char. The type of 'c' is Char.
20:53 <splanch> The numeric literal has constrained a to be an instance of Num.
20:53 <jakb> oh yes, you're right it's the actual argument that has a type
20:54 <jakb> and in the second example the type of b is Num because it's a polymorphic type, right?
20:54 <monochrom> g has a type too. It's a -> b -> c -> b.
20:55 <monochrom> In the second example, b is already the type. Of the 2nd parameter.
20:56 lithie joined
20:56 <jakb> and the second paramenter is Num b hence the answer - makes sense
20:57 conal joined
20:59 <jakb> but the last example still seams myserious to me, where does (Ord a, Num a) => a come from?
21:01 <monochrom> There are two separate concerns.
21:02 <monochrom> The easier one is suppose we talk about the empty list, written []. What is its type? Answer: [a], in which "a" is a type variable.
21:02 malaclyps joined
21:03 peterbec` joined
21:03 malaclyps joined
21:03 <jakb> yup that makes sense
21:03 <monochrom> This type variable indicates parametric polymorphism. It means you may use [] as though its type is [Int], or [Bool], or [Char], etc etc.
21:03 <jakb> ok
21:03 <monochrom> The harder one is when you also have "(Num a) =>" before.
21:04 <monochrom> This is a constraint that says "whatever actual type you choose for a, it'd better be an instance of Num"
21:06 <jakb> so (Ord a, Num a) would mean a list of Nums
21:06 <monochrom> No.
21:06 <monochrom> In "[a]" it's the square brackets that indicate listness.
21:11 <jakb> but it's still not clear for my why kessel :: (Ord a, Num b) => a -> b -> a would return (Ord a, Num a) => a
21:11 <jakb> for some reason (Ord a, Num b) becomes (Ord a, Num a)
21:15 <monochrom> This example is particularly tricky because the final "Num a" did not come from the type of kessel.
21:15 exferenceBot joined
21:15 <monochrom> Here is a second example to show the phenomenon better. monochrom :: (Ord a, Eq b) => a -> b -> a
21:16 <monochrom> Then monochrom 1 (2 :: Integer) :: (Ord a, Num a) => a
21:16 <monochrom> and it is not because "Eq transfigured into Num".
21:16 <monochrom> Instead, it is because of using 1.
21:18 dni- joined
21:21 <jakb> I see, now it's a bit more clear
21:21 <jakb> one more question what's the benefit of setting the type to be Ord a
21:21 <monochrom> The function body could use comparisons such as <
21:22 takle joined
21:24 <FullyFunctional1> Hmmmmmm, UltraBeginner here. But why wasn't the word "constraint" used in the explanation to jakb's question?
21:24 djfo joined
21:24 <monochrom> I did say "constraint".
21:24 <monochrom> But to be fair I was too lazy to correct jakb's wording.
21:25 <jakb> haha, sorry I'm still getting lost between types, contraints and type signatures, thanks for pointing that out
21:27 <FullyFunctional1> I am in no postion to answer. Really just begun even reading. But I easily understood that concept and when jakb kept referring to it as a type, I figured that was the source of the confusion. And now coming back after getting coffee I see that that was the case : )
21:28 <monochrom> No, it still didn't explain where did "Num a" come from.
21:29 Sose_ joined
21:33 <jakb> ok so (Ord a, Num a) are constraints, which means that a needs to be Ord and Num at the same time? is that even possible?
21:35 <monochrom> Yes, Integer is an example. You can compare, you can add.
21:35 <monochrom> "x + y > x" is also when you require both Num and Ord.
21:35 <monochrom> So it is both possible and necessary.
21:38 <jakb> monochrom: thanks for clarification, time and patience answering my questions, that is much appreciated!
21:38 <monochrom> You're welcome.
21:51 carlomagno joined
21:52 hiratara joined
22:03 uglyfigurine joined
22:07 stef204 joined
22:09 uglyfigurine joined
22:12 dni- joined
22:18 gabluc joined
22:21 louispan joined
22:22 <gabluc> So I have a question regarding cis194's tenth homework in which I have to make a Functor instance of Parser type. Is fmap supposed to perform a function composition? It basically has to map a function over a function
22:23 <gabluc> newtype Parser a = Parser { runParser :: String -> Maybe (a, String) } here's the Parser
22:24 <kadoban> gabluc: So, what would the type of fmap be, specialized to that type?
22:24 <kadoban> :t fmap
22:24 <lambdabot> Functor f => (a -> b) -> f a -> f b
22:24 <kadoban> For example for the Maybe Functor, it'd be :: (a -> b) -> Maybe a -> Maybe b
22:24 <gabluc> (a -> b) -> Parser a -> Parser b
22:25 <kadoban> Good. What does that mean in words? What does it do?
22:27 <gabluc> It takes a function and applies it to the context of Parser a (applies it to a) and returns a new Parser
22:28 uglyfigurine joined
22:29 <kadoban> Right, but what's it's meaning. A "Parser a" can parse a String, yielding either Nothing or a value of type "a", and the rest of the String. So what fmap does, is takes a function, (a -> b), and a `Parser a` and gives you a Parser that yields the result of running the original parser and then applying the given function to the resulting "a" value
22:29 <qu1j0t3> .b 20
22:31 hiratara joined
22:32 zero_byte joined
22:33 <gabluc> So the concept of Parser being a Functor is to easily chain simple functions into a more complex Parser by mapping them over a existing Parser?
22:38 louispan joined
22:39 <kadoban> I think it's less a chain, for Functor and more just ... you have a parser that does one thing, as a result, and you want the result to be slightly different.
22:39 <kadoban> Say like you have a parser that yields an Int, and you need it to have the same result, with 5 added to it or something.
22:39 <kadoban> A "chain" sounds more like Applicative or Monad
22:45 <gabluc> Basically it's function composition. I stumbled upon a confusion since I only made Functor instances for something simpler.
22:45 skapazzo joined
22:45 <gabluc> Thanks for clearing things up for me. :)
22:47 gabluc2 joined
22:48 Gurkenglas_ joined
22:49 gabluc joined
22:58 malaclyps joined
23:11 aarvar joined
23:12 madjestic joined
23:19 Rizy joined
23:20 gabluc joined
23:20 uglyfigurine joined
23:21 bungoman joined
23:34 nomotif joined
23:54 malaclyps joined
23:56 FullyFunctional1 left
23:58 suls joined
23:58 dougger joined