<    April 2017    >
Su Mo Tu We Th Fr Sa  
 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  
00:08 louispan joined
00:15 Pupnik joined
00:17 zero_byte joined
00:39 ljc joined
00:53 rstefanic joined
00:55 takle joined
01:08 dni- joined
01:11 expo873 joined
01:16 ebsen joined
01:28 freechips joined
01:45 \Mike joined
01:45 louispan joined
01:53 ebsen joined
01:54 merijn joined
02:11 exferenceBot joined
02:15 hexagoxel joined
02:29 mizu_no_oto_work joined
02:40 malaclyps joined
02:41 malaclyps joined
02:48 wei2912 joined
02:52 louispan joined
02:54 vaibhavsagar joined
02:54 meandi joined
02:55 MotherFlojo joined
02:57 dni- joined
03:03 permagreen joined
03:11 takle joined
03:23 HEGX64 joined
03:25 harfangk joined
03:31 louispan joined
03:37 louispan joined
03:38 perlnecrohacker joined
03:40 perlnecrohacker joined
03:41 perlnecrohacker joined
03:43 perlnecrohacker joined
03:45 perlnecrohacker joined
03:46 perlnecrohacker joined
03:47 perlnecrohacker joined
04:01 nepiktaz joined
04:11 WarmCookie joined
04:17 rstefanic joined
04:23 texasmynsted joined
04:45 jgertm joined
04:46 dni- joined
05:00 MotherFlojo joined
05:01 abh joined
05:26 ljc joined
05:58 rstefanic joined
06:00 Ferdirand joined
06:12 Gurkenglas joined
06:22 Gurkenglas_ joined
06:32 MotherFlojo joined
06:35 dni- joined
06:35 malaclyps joined
06:41 sherub2 joined
06:42 malaclyps joined
06:54 mac10688 joined
07:03 yellowj joined
07:16 harfangk joined
07:16 sumeet__ joined
07:26 sherub2 joined
07:26 azahi joined
07:28 takle joined
07:55 madjestic joined
07:58 AndreasK joined
08:01 merijn joined
08:07 cschneid_ joined
08:14 yellowj joined
08:24 dni- joined
08:25 thc202 joined
08:27 albertus1 joined
08:46 cschneid_ joined
08:51 mariusz89016 joined
08:52 <mariusz89016> hi there!
08:53 <mariusz89016> I have one question about point-free notation
08:54 <mariusz89016> task is to replicate elements of a list a given number of times
08:54 <mariusz89016> solution: 'flip $ concatMap . replicate'
08:54 <mariusz89016> question: how is it possible to infer that replicate will take one arg?
08:54 <mariusz89016> is it because of concatMap?
08:55 RonnieHolm joined
08:55 MotherFlojo joined
08:58 nepiktaz joined
08:59 uglyfigurine joined
09:05 manWithNoName joined
09:05 louispan joined
09:05 <manWithNoName> greetings to all programs
09:09 ljc joined
09:15 dni- joined
09:18 vaibhavsagar joined
09:20 wei2912 joined
09:22 nil_ joined
09:23 Denthir joined
09:26 Denthir left
09:26 Denthir joined
09:48 Gloomy joined
09:48 takle joined
09:55 <srhb> manWithNoName: Hi.
09:56 obh15 joined
10:16 azahi joined
10:18 shayan_ joined
10:22 chrissl joined
10:35 sbrg joined
10:41 merijn joined
10:41 takle joined
10:47 Ferdirand joined
10:48 <mariusz89016> I think I know why this 'flip $ concatMap . replicate' works
10:48 <mariusz89016> because (.) works only for one argument functions, right?
10:49 gspia joined
10:52 <sbrg> mariusz89016: well, it's not some special treatment or anything. It basically works because if you take the types of (.), concatMap, replicate and flip and replace the general types with the concrete ones, it all adds up :)
10:53 <sbrg> doing that when in doubt is actually a pretty good exercise, and I end up doing it sometimes still, just to make sure I understand how things are being applied
10:53 slomo joined
10:53 slomo joined
10:53 <sbrg> It isn't always very obvious how things work.
10:53 pbrant joined
10:53 <srhb> (.) does not "not" work with multi-argument functions, but it's a bit unclear what you meant by that.
10:54 <srhb> > ((+) . (+1)) 1 2
10:54 <lambdabot> 4
10:54 <mariusz89016> thanks for the response!
10:54 wildlander joined
10:55 <mariusz89016> I was wondering why these 2 arguments wasn't applied to 'replicate'
10:55 <srhb> mariusz89016: Maybe replace the $ with ()
10:56 <srhb> Then start reducing your way out.
10:58 Firestart__ joined
11:00 Gurkenglas joined
11:06 louispan joined
11:06 <srhb> mariusz89016: Does that help? Basically just inline the definition of (.) :)
11:13 <mariusz89016> srhb: but does it still be in pointfree notation? (if I inline (.))
11:15 mehs joined
11:21 wei2912 joined
11:36 t0by joined
11:36 t0by joined
11:39 merijn joined
11:49 louispan joined
11:56 MotherFlojo joined
11:59 <srhb> mariusz89016: Nah, insert the points. Or I would.
11:59 <srhb> Just for clarity :)
12:12 Denthir joined
12:16 kritzcreek_ joined
12:16 nick_h joined
12:32 abhiroop joined
12:40 merijn joined
12:40 <abhiroop> I want to parse the characters 'L' and C' in the string LsomejunkhereC
12:40 <abhiroop> using ReadP
12:41 <abhiroop> I tried (many (char 'L' <|> char 'C'))
12:41 <sbrg> abhiroop: so given 'LfooC', you want to just return L and C?
12:41 <abhiroop> but this doesn't parse till C
12:42 <abhiroop> yes
12:42 <abhiroop> sbrg: yes
12:42 <sbrg> many (char 'L' <|> char 'C') will parse a string of 0 or more Ls and Cs.
12:43 <sbrg> you want something like: char 'L' >> consumeRest >> char 'C'
12:43 <sbrg> @hoogle manyTill
12:43 <lambdabot> Text.ParserCombinators.ReadP manyTill :: ReadP a -> ReadP end -> ReadP [a]
12:43 <lambdabot> Text.Parsec manyTill :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
12:43 <lambdabot> Text.Parsec.Combinator manyTill :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
12:43 <abhiroop> exactly
12:43 <sbrg> @hoogle anyChar
12:43 <lambdabot> Text.Parsec.Char anyChar :: (Stream s m Char) => ParsecT s u m Char
12:43 <lambdabot> Text.ParserCombinators.Parsec.Char anyChar :: (Stream s m Char) => ParsecT s u m Char
12:43 <lambdabot> Data.Attoparsec.ByteString.Char8 anyChar :: Parser Char
12:43 <sbrg> manyTill anyChar (char 'C') ?
12:44 <abhiroop> I want to do it only using ReadP
12:44 <abhiroop> anyChar is parsec's right?
12:44 <sbrg> oops, yeah
12:46 <sbrg> > readP_toS (char 'L' >> munch (/= 'C') >> char 'C') "LfooC"
12:46 <lambdabot> error:
12:46 <lambdabot> Variable not in scope: readP_toS :: m0 b0 -> [Char] -> terror:
12:47 <lambdabot> • Couldn't match expected type ‘m0 a1’ with actual type ‘Doc’
12:47 <sbrg> > readP_toS (char 'L' >> munch (/= 'C') >> char 'C') "LfooC" :: [(String, String)]
12:47 <lambdabot> error:
12:47 <lambdabot> Variable not in scope:
12:47 <lambdabot> readP_toS :: m0 b0 -> [Char] -> [(String, String)]error:
12:47 <sbrg> > readP_to_S (char 'L' >> munch (/= 'C') >> char 'C') "LfooC" :: [(String, String)]
12:47 <lambdabot> error:
12:47 <lambdabot> Variable not in scope:
12:47 <lambdabot> readP_to_S :: m0 b0 -> [Char] -> [(String, String)]error:
12:47 <sbrg> eh
12:47 <sbrg> something like that, anyway
12:47 pietilson joined
12:49 <abhiroop> manyTill
12:49 <abhiroop> looks interesting
12:49 <abhiroop> > :t manyTill
12:50 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
12:50 <abhiroop> @hoogle manyTill
12:50 <lambdabot> Text.ParserCombinators.ReadP manyTill :: ReadP a -> ReadP end -> ReadP [a]
12:50 <lambdabot> Text.Parsec manyTill :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
12:50 <lambdabot> Text.Parsec.Combinator manyTill :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
12:50 <sbrg> abhiroop: there's also `between`
12:50 <sbrg> which is probably what you want
12:51 <sbrg> @import Text.ParserCombinators.ReadP
12:51 <lambdabot> Unknown command, try @list
12:51 <sbrg> > import Text.ParserCombinators.ReadP
12:51 <lambdabot> <hint>:1:1: error: parse error on input ‘import’
12:51 <sbrg> *table throw*
12:51 <sbrg> between (char 'L') (char 'C') parseMiddle
12:51 <sbrg> though that will return the middle
12:54 <abhiroop> Actually I am parsing the string 'LBAC'
12:54 <abhiroop> and I want L B and C
12:54 <abhiroop> Itried this
12:54 <abhiroop> > readP_to_S (between (char 'L') (char 'C') (char 'L' <|> char 'C' <|> char 'B')) "LBAC"
12:54 <lambdabot> error:
12:54 <lambdabot> Variable not in scope: readP_to_S :: t0 -> [Char] -> terror:
12:54 <lambdabot> Variable not in scope: between :: Doc -> Doc -> f0 a0 -> t0error:
12:54 Ferdirand joined
12:55 <abhiroop> I am getting []
12:56 <sbrg> yes, because 'A' is not a character that you allowed in the middle
12:56 <sbrg> you allowed L, C and B
12:57 <abhiroop> Thats what i want to know
12:57 <abhiroop> when the parsing fails
12:57 <abhiroop> how can i let the parser go ahead
12:57 <abhiroop> Generally I would use >> when I know the length
12:58 <abhiroop> But here it can be 'LfooBbarC'
12:58 <abhiroop> or simply 'LBAC' or 'LBC'
12:59 <sbrg> the parser can't know automagically what it should do.
12:59 <sbrg> it can only parse the things you have defined. if you want it to be able to backtrack, ReadP has operators for that as well.
13:00 <sbrg> also, it would probably be a good idea if you explained what exactly you want to be able to parse. it's clear that "between L and C" doesn't do it justice since you just introduced a third capital character in the middle in your example
13:00 <sbrg> (actually, ReadP automatically backtracks)
13:02 <sbrg> if you want to parse a string which as the format "<Upper><lower>*<Upper>.." etc, then you probably want sepBy
13:02 <abhiroop> well I am actually parsing the string which begins with L ends with C and has some interesting chracters in between
13:02 manWithNoName joined
13:02 <abhiroop> right now I am trying to work with only 1 character and see if I can get it to work
13:02 <abhiroop> so L B and C
13:02 <sbrg> you just want to return whatever is in the middle of L and C?
13:03 <abhiroop> yes I want to return the character B if it occurs in between
13:04 <abhiroop> it should look like (between (char 'L') (char 'C') (char 'B'... some way to move ahead if it fails parsing here))
13:05 <sbrg> the parser `between (char 'L') (char 'C') (many (satisfy (`notElem` "LC")))` works for me
13:06 <sbrg> what do you mean by "move ahead if it fails"?
13:09 dgonzo joined
13:10 shainer joined
13:14 <abhiroop> yeah well it returns all the character in between
13:14 alasi joined
13:14 <abhiroop> so in the string LBAC it returns BA
13:14 <abhiroop> I wanted just B
13:14 <abhiroop> So i wrote (between (char 'L') (char 'C') (many (satisfy (\c -> c == 'B'))))
13:15 <abhiroop> but that doesnt work either
13:16 <sbrg> no, because it fails when it reaches the A. it would be easier to write one that simply parses everything in between and then only returns the Bs in that string
13:17 <sbrg> think of the parser as a way to declaratively specify the "format" of the data you are parsing. the parsing succeeds if the data meets the specification. if a parse succeeds, you can take the result and change it, only keeping the parts you want
13:18 <sbrg> in your case, you basically want a specification that says "anything that starts with an L and then ends with a C is valid"
13:18 <sbrg> what you are saying now is "anything that starts with an L, followed by 0 or more Bs, and then finally by a 'C' is valid"
13:19 <sbrg> so naturally, the string LBAC is not valid, because it contains an A in the middle.
13:32 abhiroop_ joined
13:36 dgonzo joined
13:37 c137 joined
13:39 <c137> Hello there! I'm a newbie and reading Learn You A Haskell now. Can someone please enlighten me why "Abrakadabra" < "Zebra" returns True?
13:40 <c137> Or a link I can read about it?
13:41 ubsan joined
13:42 jespada joined
13:48 takle joined
13:50 WarmCookie joined
13:50 lithie joined
13:56 MotherFlojo joined
14:10 Denthir joined
14:12 sujeet joined
14:29 sherub2 joined
14:31 freechips joined
14:54 abhiroop joined
14:56 pietilson left
14:59 stef204 joined
15:03 hoffmeyer joined
15:23 mac10688 joined
15:24 abhiroop joined
15:30 sherub2 joined
15:34 Ferdirand joined
15:35 zero_byte joined
15:37 kotangent joined
15:40 eacameron joined
15:41 yellowj joined
15:54 li4ick_ joined
15:56 permagreen joined
15:57 MotherFlojo joined
16:03 takle joined
16:03 <saylu> c137: If you're still here -- I believe it's because Char has an instance for Ord, so you are allowed to compare and see if a given char is "greater" than another.
16:03 <saylu> From Data.Char:
16:03 <saylu> https://hackage.haskell.org/package/base-
16:04 <saylu> "The character type Char is an enumeration whose values represent Unicode characters"
16:04 abhiroop joined
16:04 <saylu> in that enumeration 'A' comes before 'Z', so you could say that 'A' is less than 'Z'
16:04 <saylu> or you could read the < as 'earlier in the enumeration than...'
16:05 <glguy> saylu: c137 isn't here
16:05 takle joined
16:05 <saylu> i should learn how to check statuses
16:12 mariusz89016 joined
16:14 takle joined
16:17 permagreen joined
16:21 hoffmeyer joined
16:25 <glguy> saylu: the easy way is to try and tab complete the user's nickname when responding
16:27 contiver joined
16:30 sherub2 joined
16:43 abhiroop joined
16:47 eacameron joined
16:56 abhiroop joined
16:57 peterbecich joined
17:01 Lokathor_ joined
17:02 albertus1 joined
17:04 eacameron joined
17:04 martingale joined
17:10 eacameron joined
17:17 eacameron joined
17:24 eacameron joined
17:29 abhiroop joined
17:30 eacameron joined
17:31 abhiroop joined
17:31 sherub2 joined
17:41 abhiroop joined
17:45 <qmm> > ((Sum 2), (+1)) <*> ((Sum 0), 0)
17:45 <lambdabot> (Sum {getSum = 2},1)
17:45 <qmm> what is this getSum from the result?
17:46 abhiroop joined
17:47 <qmm> > let x = ((Sum 2), (+1)) <*> ((Sum 0), 0) in getSum (fst x)
17:47 <lambdabot> 2
17:48 <glguy> qmm: The Sum constructor is defined using record syntax and getSum is the name of it's field
17:48 <geekosaur> @src Sum
17:48 <lambdabot> newtype Sum a = Sum { getSum :: a }
17:48 <qmm> thank you both
17:48 <glguy> -'
17:49 monochrom joined
17:56 vios joined
17:58 MotherFlojo joined
17:58 <saylu> Thanks glguy
17:59 NoCreativity joined
17:59 <saylu> By the way, if I want to study functional algorithms, is Okasaki's 1997 book still the de facto standard for that?
17:59 <saylu> Or are there other good resources?
18:09 mariusz89016 joined
18:13 Ferdirand joined
18:15 freechips joined
18:20 <srhb> saylu: That is the bible, definitely.
18:32 zero_byte joined
18:32 sherub2 joined
18:41 peterbecich joined
18:43 sigmundv joined
18:51 contiver_ joined
18:56 MotherFlojo joined
18:58 abhiroop joined
19:11 malaclyps joined
19:14 abhiroop joined
19:14 mojjo joined
19:15 aarvar joined
19:18 abhiroop joined
19:24 merijn joined
19:25 abhiroop joined
19:28 systemfault joined
19:30 acarrico joined
19:39 abhiroop joined
19:46 <qmm> i am trying to install lambdabot, and it fails to build dependent-sum. i was instructed to build dependent-sum myself, but i don't atually know how i would make this build known to cabal when it attempts to install lambdabot
19:47 <qmm> i figure build errors are maybe more appropriate in -beginners
19:47 kritzcreek_ joined
19:51 <monochrom> qmm, it is not true that build failure questions are uninteresting. Instead, it is true that they are so much harder to resolve, requiring so much more context, in the limit someone might need remote access to your full computer.
19:52 Majiir joined
19:56 <monochrom> And for example I have never had "can't find DLL/so" so I don't even know how to cause it, much less how to solve it.
19:57 <monochrom> And furthermore I don't have MacOS so if the cause is specific to MacOS I won't know what to do.
19:57 <monochrom> Build failures that make it to IRC are very tailored personalized failures.
20:01 <geekosaur> that one was fixed (ghc 8.0.2 needed on Sierra) but that then led to a build problem with dependent-sum, because 8.0.2 tightened up type resolution in certain cases, so it needs to be built from git
20:02 <geekosaur> (hasn;t been a release for some reason)
20:03 <geekosaur> but, the lambdabot build is a bear in general, there's a bunch of components to be built together
20:09 carousel joined
20:11 <__rgn> can a -> a be anything else than identity?
20:14 \Mike joined
20:18 <geekosaur> bottom :)
20:19 <geekosaur> otherwise, no, if you don't know anything about the type but "a" then you can't do anything but produce the value you were given
20:20 ralu joined
20:33 eacameron joined
20:36 louispan joined
20:39 Majiir joined
20:47 abhiroop joined
20:55 malaclyps joined
21:00 mengu joined
21:02 acarrico joined
21:05 Deide joined
21:11 eacameron joined
21:12 abhiroop joined
21:17 t0by joined
21:17 t0by joined
21:27 RonnieHolm joined
21:43 Sose_ joined
21:49 eacameron joined
21:52 hiratara joined
21:56 eacameron joined
22:00 acarrico joined
22:01 zero_byte joined
22:03 eacameron joined
22:05 <madjestic> hmm, at some point (prior to ghc8.0.2) I was able to run ghci and get 'arr (1 +) <<< arr (1 +)' evaluated with a result printed out
22:06 <madjestic> but now I am getting a scary 'Ambiguous type variables' error
22:06 <madjestic> I am playing with yampa in ghci, I wonder if anybody ran accross the same issue
22:10 abhiroop joined
22:11 eacameron joined
22:13 <srhb> madjestic: Hmm, I can't think of a specific change to Arrow that would affect that. What are your imports?
22:16 <srhb> madjestic: Either way, you know you can just constrain the types manually?
22:17 <srhb> (Assuming you pick something showable, eg. not the function instance.
22:18 <srhb> > (arr (+1) <<< arr (+1)) 1
22:18 <lambdabot> 3
22:18 <srhb> Ah, it should default nicely there.
22:18 eacameron joined
22:31 hiratara joined
22:35 eacameron joined
22:38 <glguy> madjestic: It's unlikely that the expression you wrote there ever defaulted to something that prints nicely
22:41 malaclyps joined
22:53 <madjestic> srhb, glguy: I am not exactly sure, but I am looking at my previous session dump and it looks ~like that: http://lpaste.net/354436
22:54 <glguy> What program is that?
22:54 <madjestic> I don't remember the error that I got this time printed out. But you are right, feeding it an argument kind of solves that.
22:54 <madjestic> glguy: emacs
22:54 <monochrom> I have only seen emacs haskell-mode do that.
22:57 mariusz89016 joined
22:57 vios joined
23:00 eacameron joined
23:03 louispan joined
23:05 eacameron joined
23:08 takle joined
23:10 ali_bush joined
23:10 ali_bush joined
23:11 Pupnik joined
23:11 permagreen joined
23:16 NoCreativity joined
23:20 manWithNoName joined
23:22 takle joined
23:35 abhiroop joined
23:45 sigmundv joined
23:49 oconnorct1 joined
23:50 dni- joined
23:52 <abhiroop> I asked this question earlier but I will try to clarify and ask again
23:52 <abhiroop> I am trying to parse a string using ReadP
23:53 <abhiroop> Say the string is "ABCDFGABIJABGHA"
23:53 <abhiroop> I want to parse all instances of "AB"
23:54 <abhiroop> I tried something like (many $ string "AB")
23:54 <abhiroop> So when I try
23:54 <abhiroop> > readP_to_S (many $ string "AB") "ABCDFGABIJABGHA"
23:54 <lambdabot> error:
23:54 <lambdabot> Variable not in scope: readP_to_S :: f0 [a0] -> [Char] -> terror:
23:54 <lambdabot> • Variable not in scope: string :: [Char] -> f0 a0
23:54 <abhiroop> It actually works and outputs [([],"ABCDFGABIJABGHA"),(["AB"],"CDFGABIJABGHA")]
23:55 <abhiroop> Now is it possible to continue parsing the rest of the string
23:55 <abhiroop> How do I refactor my parser (many $ string "AB")
23:55 <abhiroop> to accomodate that