<     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 _2_5 26 27  
28 29 30 31
00:02 systemfault joined
00:07 justinfokes joined
00:11 fotonzade joined
00:25 justinfokes joined
00:30 louispan joined
00:31 carlomagno joined
00:35 eacameron joined
00:38 Rodya_ joined
00:43 justinfokes joined
00:50 juanpaucar joined
00:51 Pupnik joined
00:53 Rodya_ joined
01:01 justinfokes joined
01:02 Zialus joined
01:19 justinfokes joined
01:31 conal joined
01:44 fred-fri joined
01:51 <fred-fri> how can i fix this syntax error? http://lpaste.net/355490
01:52 <thang1> It found a hole _ :: a
01:53 <thang1> look at lines 9-12 of your program
01:53 <geekosaur> usually if you get that and weren't specifically expecting it, you used a _ (which is normally for patterns) in a place that's not a pattern
01:53 Gurkenglas joined
01:53 <geekosaur> specifically lines 12-13
01:54 <geekosaur> what were you expecting to do with those?
01:54 juanpaucar joined
01:55 <geekosaur> more specifically: what did you think (_:x) and (_:y) would do on those lines?
01:56 <fred-fri> i get that _:x and _:y is what is generating the syntax error but im not sure why. i just want to match any list (empty or otherwise) and cons an element to it
01:56 justinfokes joined
01:56 <geekosaur> those are not places for matching
01:56 <geekosaur> you are invoking a function and passing it a value
01:57 <geekosaur> the (x:xs) and (y:ys) to the left of the = are patterns. to the right of a | or = will be an expression, not a pattern. there is nothing to match; you *provide* something, not match something provided elsewhere
01:57 <fred-fri> yes, im invoking the cons function and passing it whatever the wildcard list was and the elemtent i was to cons
01:57 <geekosaur> oh
01:58 <geekosaur> so, that makes two more issues. one is you want to use an as-pattern to match the entire list as well as the head and tail
01:58 <geekosaur> the other is not so easily solved: cons works only to prepend items
01:59 <geekosaur> :t (:)
01:59 <lambdabot> a -> [a] -> [a]
01:59 <thang1> > '1' : [1,2,3]
01:59 <lambdabot> error:
01:59 <lambdabot> • No instance for (Num Char) arising from the literal ‘1’
01:59 <lambdabot> • In the expression: 1
01:59 <thang1> whoops
01:59 <thang1> > 1 : [1,2,3]
01:59 justinfokes joined
01:59 <lambdabot> [1,1,2,3]
01:59 <thang1> > [1,2,3] : 1
01:59 <lambdabot> error:
01:59 <lambdabot> • Ambiguous type variable ‘t0’ arising from a use of ‘show_M589591749713...
01:59 <lambdabot> prevents the constraint ‘(Show t0)’ from being solved.
01:59 <geekosaur> fooo _ xss@(x:xs) yss@(y:ys) | x < y = fooo (xss ++ [x]) yss
01:59 <fred-fri> ah i see im not even using cons correctly
02:00 <geekosaur> the @s there let you name the whole thing as well as matching inside it
02:00 <thang1> > [1,2,3] ++ 1
02:00 <lambdabot> error:
02:00 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘show_M502831593822...
02:00 <lambdabot> prevents the constraint ‘(Show a0)’ from being solved.
02:00 <glguy> fred-fri: If you want to match *any list* empty or not, don't use a pattern like _:_ or [], just use a variable as your pattern
02:00 <geekosaur> also that, yes (although here you at least use x)
02:00 <geekosaur> I think the most optimal pattern is xs@(x:_)
02:00 <geekosaur> then x is the head and xs is the whole list
02:00 <geekosaur> (instead of its tail as with (x:xs)
02:01 <thang1> You could also do lx@(x:xs) if you really felt the need to. I think I had some semi reasonable reason to do that once
02:01 takle joined
02:01 <geekosaur> yes, I shows that above but called it xss instead of lx
02:01 <geekosaur> *showed
02:02 <glguy> I use xxs for that and i use xss if I have a list of lists
02:02 <thang1> oh whoops, I see that now. Wasn't paying attention
02:03 <thang1> I like lx because it reminds me of l_x which I would think of "the list x" but I haven't absorbed many idioms of haskell yet and I'm not particularly married to lx vs xxs or xss. xxs and xss seem more useful though
02:03 <geekosaur> this is a place where all possible names are kinda awkward, sadly
02:04 <geekosaur> sometimes I tell haskell conventions to take a hike and say xs@(xh:xt)
02:04 <geekosaur> (spot the ex-prologer)
02:05 <thang1> lol
02:06 <thang1> I forgot to do a super big problem on my last assignment and I feel dead inside now ;-;
02:07 aarvar joined
02:07 <fred-fri> http://lpaste.net/355492 this compiles but given foo [1,2,3] [1,2,3] doesn't output the expected [1,1,2,2,3,3] but just [3]
02:08 <glguy> fred-fri: You shouldn't be using an accumulating parameter for this
02:08 <glguy> and appending to the ends of lists repeatedly (e.g. xs ++ [x]) is going to be inefficient
02:08 <thang1> Just so you know, in lines 9-11, you can replace a with the _ and it won't change anything. I prefer to do that so the compiler knows I don't care about a right then
02:09 <fred-fri> some context, i was asked to whiteboard this during an interview the other day. i correctly implemented it using recursion in java and im now porting it to haskell just for fun
02:09 <glguy> fred-fri: OK, your Haskell version won't need two separate definitions and doesn't need an "accumulator"
02:12 takle joined
02:14 <glguy> fred-fri: Wait until you're got yours working, but save this version to compare after yours works: http://lpaste.net/265538174141333504
02:15 <thang1> You can also have an even more concise version
02:15 <fred-fri> glguy, it didn't work because i'm an idiot =) now it does http://lpaste.net/355493
02:15 <thang1> @let merge [] ys = ys
02:15 <lambdabot> .L.hs:175:1: warning: [-Woverlapping-patterns]
02:15 <lambdabot> Pattern match is redundant
02:15 <lambdabot> In an equation for ‘merge’: merge [] ys = ...
02:15 <thang1> @let merge (x:xs) ys = x : merge ys xs
02:15 <lambdabot> .L.hs:175:1: warning: [-Woverlapping-patterns]
02:15 <lambdabot> Pattern match is redundant
02:15 <lambdabot> In an equation for ‘merge’: merge (x : xs) ys = ...
02:15 <thang1> (I already played around with this in a query so it's giving overlapping pattern warning because this is already defined for me)
02:15 <thang1> > merge [1..10] [20..30]
02:15 <lambdabot> [1,20,2,21,3,22,4,23,5,24,6,25,7,26,8,27,9,28,10,29,30]
02:16 <thang1> http://stackoverflow.com/questions/3938438/merging-two-lists-in-haskell if you ever want to know pretty much every way possible to write this thing in Haskell
02:16 <glguy> thang1: That's something else
02:17 <geekosaur> note that in @let you need to define both of those at the same time
02:17 <thang1> geekosaur: really? whoops
02:17 <glguy> I think it might actually work with @let. I think @let might just append to a file
02:17 <geekosaur> well, it might work separately but it;s unsafe
02:17 <thang1> right. I'll keep that in mind :p
02:17 <geekosaur> you don;t get to use a transaction, so someone else could @let in between
02:18 <fred-fri> i realize the solution ive written isnt efficient or idiomatic haskell but its a 1:1 port of what i whiteboarded in java when asked this question during the interview
02:18 <geekosaur> (one might think this is low probability but I've seen it happen. lots of people use lambdabot in /query)
02:18 <fred-fri> i will take a look at your feedback and rewrite it to be more efficient and idiomatic
02:18 <thang1> fred-fri: no worries. Mine is just interleaving two lists together, not actually sorting them. I read your function wrong
02:19 <fred-fri> thang1, mine doesn't sort either, it assumes the input lists are sorted
02:19 <fred-fri> but mine does return a sorted list
02:19 <glguy> fred-fri: That's a standard assumption for a merge function
02:19 <thang1> Well yours does different things based on whether x is larger than y or not
02:19 <fred-fri> not just pick interleave
02:19 <thang1> Mine just blindly goes a b a b
02:19 <fred-fri> i see
02:20 <fred-fri> its interesting that during the interview i initially tried to implement it imperatively using nested loops
02:21 <thang1> I like the one I used because it's really easy to look at the recursion in it.
02:21 <glguy> fred-fri: Did you realize that that wasn't going to work, or did the interviewer say something?
02:21 <thang1> were they for loops or while loops?
02:21 <fred-fri> yeah i realized halfway through implementing imperatively that my naive nested loop implementation would fail if the lists were different sizes
02:21 <fred-fri> so i said this would be easier to implement using recursion
02:22 <fred-fri> wrote it in one go using recursion and they were very impressed lol
02:22 <thang1> nice
02:22 <fred-fri> i did caveat saying it would be less efficient and not idiomatic java
02:23 <thang1> Eh, idiomatic java 8 would probably treat both lists as streams
02:23 <fred-fri> yeah but that was not allowed
02:23 <fred-fri> they wanted the old school low level int[] stuff
02:23 <thang1> Of course, it's a java shop. Anything newer than 12 years isn't allowed /s
02:24 <fred-fri> i dont endorse these types of questions myself but i realize the industry has for some reason latched on to them so have practiced a lot on hackerrank and stuff
02:24 <fred-fri> most java interviewers wouldnt understand themselves if you implemented using streams lol because most java devs are frightened by the new functional features, at least in my experience haha
02:25 <glguy> Probably because they wanted to see you solve a specific, small problem, not because they're stodgy
02:26 <fred-fri> in any case the same solution looks so much better in haskell
02:26 <fred-fri> wish it was a haskell gig, alas im not good enough to get one yet and there arent many around
02:26 <thang1> Right, so you just solve that specific, small problem and show off by saying "well I could do it using Streams [insert drawbacks and benefits], or method X [insert drawbacks and benefits], ..., but for the purpose of the interview this simple method on primitive arrays should suffice"
02:27 <thang1> fred-fri: be the change you wanna see in the world. Introduce haskell for some small side projects if you can :p
02:27 <glguy> Yeah, that's a fine way to go
02:27 exferenceBot joined
02:28 <fred-fri> believe me im planning to :) big thanks for the feedback everyone
02:28 <thang1> no problem
02:28 <thang1> jk I didn't help at all
02:29 takle joined
02:32 hexagoxel joined
02:39 takle joined
02:53 takle joined
02:58 juanpaucar joined
03:02 pilne joined
03:03 Baraius joined
03:03 takle joined
03:24 takle joined
03:30 juanpaucar joined
03:34 justinfokes joined
03:41 takle joined
03:52 cschneid_ joined
03:54 takle joined
04:11 takle joined
04:19 takle joined
04:23 conal joined
04:28 cschneid_ joined
04:34 juanpaucar joined
04:35 Youmu joined
04:36 cschneid_ joined
04:39 takle joined
04:39 cschneid_ joined
04:41 justinfokes joined
04:46 takle joined
04:52 govg joined
04:56 justinfokes joined
05:05 takle joined
05:12 takle joined
05:22 takle joined
05:27 takle joined
05:28 meandi_2 joined
05:29 m3tti joined
05:30 systemfault joined
05:46 takle joined
05:54 conal joined
05:57 Cale joined
06:07 takle joined
06:21 takle joined
06:28 takle joined
06:34 wei2912 joined
06:35 juanpaucar joined
06:45 takle joined
06:53 takle joined
07:02 PandaLeaves joined
07:05 takle joined
07:13 takle joined
07:17 nickolay_ joined
07:21 takle joined
07:21 Baraius joined
07:29 Baraius joined
07:37 cschneid_ joined
07:39 takle joined
07:39 juanpaucar joined
08:00 wjmcdermott joined
08:01 takle joined
08:10 takle joined
08:20 MolluskEmpire joined
08:27 kritzcreek joined
08:29 takle joined
08:50 takle joined
08:54 MolluskEmpire joined
08:58 juanpaucar joined
09:05 takle joined
09:17 thc202 joined
09:20 nobodyzxc joined
09:24 takle joined
09:31 takle joined
09:39 takle joined
09:40 hvr joined
09:40 hvr joined
09:42 im0nde joined
09:46 takle joined
09:59 netheranthem joined
10:02 juanpaucar joined
10:02 takle joined
10:08 yellowj joined
10:10 sza joined
10:10 madjestic joined
10:13 smwangi joined
10:16 aarvar joined
10:17 fotonzade joined
10:22 Guanin left
10:22 dni- joined
10:33 takle joined
10:34 conal joined
10:41 takle joined
10:49 takle joined
10:55 Levex joined
10:58 obijankenobi joined
11:01 takle joined
11:08 takle joined
11:11 obijankenobi joined
11:16 takle joined
11:24 takle joined
11:27 permagreen joined
11:27 takle joined
11:32 simendsjo joined
11:32 bvad joined
11:38 cschneid_ joined
11:41 abhiroop joined
11:50 juanpaucar joined
11:56 abhiroop joined
12:00 abhiroop joined
12:01 simendsjo joined
12:06 im0nde joined
12:08 contiver joined
12:11 dni- joined
12:12 prophile joined
12:16 juanpaucar joined
12:24 NeverDie joined
12:27 shainer joined
12:43 wei2912 joined
13:10 Levex joined
13:11 simendsjo joined
13:12 NeverDie joined
13:12 takle joined
13:17 abhiroop joined
13:19 takle joined
13:21 juanpaucar joined
13:24 abhiroop joined
13:26 takle joined
13:27 Levex joined
13:28 vegai left
13:32 aarvar joined
13:35 Big_G joined
13:36 Prutheus joined
13:38 wildlander joined
13:48 abhiroop joined
13:56 fotonzade joined
14:00 dni- joined
14:03 <seanparsons> Is there a "best" way to generate Haskell bindings from C headers?
14:04 <simendsjo> Haven't tried it myself, but inline-c looks pretty awesome: https://hackage.haskell.org/package/inline-c
14:05 <simendsjo> Perhaps not exactly what you had in mind though
14:06 <seanparsons> simendsjo: Yeah, that to me makes me think of it as a way what I'm wanting could be implemented.
14:07 <seanparsons> I'm kinda surprised that swig doesn't support Haskell.
14:07 <simendsjo> I have never had any luck with Swig. Has always broken down for me - but I haven't tried it between popular languages, which might work.
14:11 zero_byte joined
14:14 nobodyzxc joined
14:17 pilne joined
14:25 juanpaucar joined
14:27 shainer left
14:37 kritzcreek joined
14:44 smwangi joined
14:45 smwangi joined
15:19 pbrant joined
15:23 nobodyzxc joined
15:26 obijankenobi joined
15:30 justinfokes joined
15:34 juanpaucar joined
15:40 obijankenobi joined
15:42 carlomagno joined
15:49 carlomagno1 joined
15:49 dni- joined
16:05 acarrico joined
16:08 jsoo joined
16:09 carlomagno joined
16:13 jsoo joined
16:26 justinfokes joined
16:30 NeverDie joined
16:38 juanpaucar joined
16:40 mheinzel joined
16:42 seagreen joined
16:44 bydo joined
16:49 simendsjo joined
16:51 justinfokes joined
17:05 justinfokes joined
17:06 kadoban joined
17:24 malaclyps joined
17:31 justinfokes joined
17:32 takle joined
17:37 crave joined
17:38 dni- joined
17:42 juanpaucar joined
17:47 grayjoc joined
17:52 im0nde_ joined
17:56 yellowj joined
17:59 Lokathor_ joined
18:00 abbe_ joined
18:01 carlomagno joined
18:02 grayjoc joined
18:02 codedmart_ joined
18:02 ebw joined
18:02 <ebw> Hi
18:02 mikedlr_ joined
18:02 <ebw> It seems I am wrong here
18:02 ebw left
18:03 mudphone_ joined
18:04 __red___ joined
18:06 m3tti joined
18:07 jtcs_ joined
18:08 rembo10_ joined
18:08 x1n4u- joined
18:08 Cthalupa joined
18:11 Oliphaunte joined
18:12 Akii joined
18:15 nille joined
18:16 greeny joined
18:16 yushyin joined
18:16 pilne joined
18:18 Oliphaunte joined
18:20 dyce[m] joined
18:24 albertus1 joined
18:28 takle joined
18:34 takle joined
18:34 mengu joined
18:34 mengu joined
18:35 justinfokes joined
18:43 ebw joined
18:43 sigmundv__ joined
18:44 <ebw> Hi there, finally from glirc2 ... what a journey
18:47 juanpaucar joined
18:54 argent0 joined
19:00 shayan_ joined
19:04 systemfault joined
19:09 grayjoc joined
19:13 Oliphaunte joined
19:15 yaewa joined
19:19 oakley91 joined
19:27 dni- joined
19:39 <glguy> ebw: Glad to hear you made it
19:42 yellowj joined
19:51 juanpaucar joined
19:52 mac10688 joined
20:10 mbrcknl joined
20:15 moei joined
20:26 chrissl joined
20:31 Prutheus joined
20:35 madjestic joined
20:39 Oliphaunte joined
20:50 malaclyps joined
20:51 juanpaucar joined
20:55 malaclyps joined
21:14 dni- joined
21:18 juanpaucar joined
21:35 zero_byte joined
21:39 jrm2 joined
21:41 juanpaucar joined
21:41 nocookie192 joined
21:41 baroncha1lus joined
21:42 a3f_ joined
21:42 henrytill_ joined
21:43 asante joined
21:43 oscarftoro joined
21:43 asante joined
21:43 mitchty joined
21:43 monochrom joined
21:44 <ebw> How can I make ghc use more than one cpu?
21:47 justinfokes joined
21:53 hiratara joined
21:54 malaclyps joined
21:56 mac10688 joined
22:27 romank joined
22:31 hiratara joined
22:45 juanpaucar joined
22:52 Big_G joined
22:52 justinfokes joined
22:55 dni- joined
22:58 justinfokes joined
23:06 eacameron joined
23:11 Levex joined
23:19 louispan joined
23:43 louispan joined
23:49 conal joined
23:51 eacameron joined
23:58 eacameron joined