00:00:00 --- log: started haskell/02.01.22 01:09:47 --- quit: dennisb (carter.openprojects.net irc.openprojects.net) 01:10:13 --- join: dennisb (~dennis@as2-4-3.an.g.bonet.se) joined #haskell 01:16:56 re dennisb 01:17:00 morning 01:17:36 g'mornin Heffalump 01:17:39 what's up? 01:18:37 not much 01:18:40 I should go to work 01:18:54 yah, probably so 01:19:04 I've been at work since 9am 01:19:06 I should start 01:27:25 --- join: jewel (~jleuner@57.66.12.99) joined #haskell 03:56:23 --- quit: dblack_ ("[x]chat") 04:16:11 hm, Michael Feathers asking about SMTP and POP3 libs for Haskell 04:16:17 I gotta get movin 04:26:02 movin where? 04:26:19 well, start cranking out libraries 04:27:01 xbill passed me a minimalistic Imap.hs he wrote, it includes a bit of SMTP support as well 04:28:35 plus it's pretty likely that if I release crappy newbie versions of Haskell libs 04:28:46 then more experience people will complain and fix them =) 04:35:45 or at least give me advice on how to fix them 04:39:04 --- quit: shapr ("reboot emacs") 05:01:06 --- join: shapr (~user@p-c2fbabb9.easy.inet.fi) joined #haskell 05:05:36 --- part: shapr left #haskell 05:05:38 --- join: shapr (~user@p-c2fbabb9.easy.inet.fi) joined #haskell 05:05:44 yay! I got ASN.1 Haskell code! 05:14:07 wow cool 05:14:16 it's an LDAP module written in Haskell 05:14:20 it's pretty, too 05:14:59 cool. 05:15:13 very elegant 05:41:07 hrm 05:41:15 data ASN = forall a . (CF a, Encodable a, Show a) => 05:41:15 Primitive' Tag a | 05:41:15 Constructed' Tag [ASN] 05:41:23 any idea why that won't compile? 05:41:32 ASN.hs:12: not a constructor: `forall' 05:41:35 that's from ghc 05:42:07 that looks like a type statement on a type alias.. 05:44:19 --- quit: dblack (Remote closed the connection) 05:45:46 --- join: dblack (~dblack@shunat236-80.shu.edu) joined #haskell 05:46:31 try it with ghc -98 05:46:47 an explicit forall isn't valid Haskell 98, but it's a fairly standard extension 05:47:33 hrm, ok 05:48:19 I was using "ghc --make -package data Test.hs" 05:48:28 it doesn't recognize -98 05:49:38 hrm 05:52:23 oh 05:52:29 hugs -98 Test.hs *does* work 05:52:39 oh, the flag to ghc might be different, sorry 05:53:01 possibly -fglasgow-exts ? 05:53:07 * shapr tries that 05:53:35 yay!! 05:54:04 thanks! 06:51:11 --- join: graydon (~graydon@H145.C193.tor.velocet.net) joined #haskell 07:15:14 --- quit: dmiles (Read error: 104 (Connection reset by peer)) 07:16:06 --- quit: jewel (carter.openprojects.net irc.openprojects.net) 07:16:06 --- quit: dennisb (carter.openprojects.net irc.openprojects.net) 07:17:09 re graydon 07:17:10 ltns 07:17:37 --- quit: LoganH (carter.openprojects.net irc.openprojects.net) 07:17:37 --- quit: Heffalump (carter.openprojects.net irc.openprojects.net) 07:20:11 --- quit: shapr (carter.openprojects.net irc.openprojects.net) 07:20:26 --- quit: smkl (carter.openprojects.net irc.openprojects.net) 07:20:26 --- quit: jsw (carter.openprojects.net irc.openprojects.net) 07:20:26 --- quit: jemfinch (carter.openprojects.net irc.openprojects.net) 07:20:26 --- quit: jlb (carter.openprojects.net irc.openprojects.net) 07:20:26 --- quit: xbill (carter.openprojects.net irc.openprojects.net) 07:21:01 --- join: LoganH (~logan@up112.blacksburg.ntc-com.net) joined #haskell 07:21:01 --- join: Heffalump (ganesh@munchkin.comlab.ox.ac.uk) joined #haskell 07:21:42 --- join: smkl (~sami@glubimox.yok.utu.fi) joined #haskell 07:21:42 --- join: jsw (scott@12-234-202-177.client.attbi.com) joined #haskell 07:21:42 --- join: jemfinch (~jemfinch@rpat-100-139.resnet.ohio-state.edu) joined #haskell 07:21:42 --- join: xbill (wli@DOMINIA.MIT.EDU) joined #haskell 07:21:42 --- join: jlb (~ktk@jeremeydsl-3.mylinuxisp.com) joined #haskell 07:22:25 --- join: jewel (~jleuner@57.66.12.99) joined #haskell 07:22:25 --- join: dennisb (~dennis@as2-4-3.an.g.bonet.se) joined #haskell 07:24:28 --- join: shapr (~user@p-c2fbabb9.easy.inet.fi) joined #haskell 07:28:20 "Sometimes people don't even realize they have bought illegal software, or don't realize that sharing software with friends is illegal," Piquette said. 07:28:38 BSA? 07:28:59 http://www.wired.com/news/business/0,1367,49856,00.html 07:29:04 melkrasoft 07:29:18 I like how they always lump all software sharing as illegal. 07:29:36 Because I guess it doesn't sound as nice if you say that just your software is illegal to share. :P 07:30:20 Heh, I'm not sure I'd pay $3 for Windows XP. :P 07:30:24 but that is exactly what they should be saying 07:30:27 hehe 07:31:17 Look, criminals are involved in anything that will make them a profit," Angonasta said. "And anything that will make a profit can also be used to fund terrorism activities, so it's probably happening somewhere. 07:31:21 Wow, that is the worst argument ever. 07:31:33 It's like straight out of Monty Python or something. 07:31:59 This is a really good story to make fun of on my site. *grin* 07:32:40 There are so many fallacious arguments here. 07:35:54 erm. you're quoting out of context. 07:36:10 "... It's an interesting concept, but to my knowledge there's only one possible case where they think one guy, who seemingly operates on his own out of South America, may have been kicking back part of his profits to a terrorist group. I just don't see this as a fascinating new trend" 07:36:26 the rest of what the guys says clearly indicates he _doesn't_ think it has anything to do with terrorism. 07:36:53 * LoganH nods. 07:37:03 He's poking fun at the people that do claim that. 07:37:18 Gotta go to class, later. 07:39:30 --- quit: shapr ("short break...") 08:02:16 --- join: shapr (~user@p-c2fbabb9.easy.inet.fi) joined #haskell 08:29:38 --- quit: shapr (Read error: 104 (Connection reset by peer)) 08:42:25 --- join: shapr (~user@p-c2fbabb9.easy.inet.fi) joined #haskell 10:14:41 --- quit: xbill ("Leaving") 10:21:30 --- join: xbill (wli@DOMINIA.MIT.EDU) joined #haskell 11:05:56 --- join: zorb (a@ppp-208-188-42-60.dialup.eulstx.swbell.net) joined #haskell 11:06:05 hi zorb 11:06:12 hello 11:06:26 accomplished Haskeller? or just learning? 11:06:28 wow, this place is popular compared to efnet haskell. 11:06:36 how many on efnet? 11:06:40 still learning. 11:06:46 um... a few. 11:07:08 well, invite 'em over ;) 11:07:20 I've taken a sacred vow never to return to efnet 11:07:24 so I can't 11:07:25 * shapr grins 11:07:26 they probably already know about this place :) 11:08:05 if you're still learning Haskell, you may want to check out the Language of the Year project 11:08:21 http://pragmaticprogrammer.com/loty/ 11:08:43 efnet, what's that? 11:08:47 * jewel grins 11:08:52 hehe 11:09:03 * shapr grins 11:09:09 and leaves for jujitsu, later 11:09:23 bye jewel! 11:09:34 later jewel 11:11:11 so zorb... have any questions? 11:11:24 well... 11:11:26 wanna donate code to the Haskell Libraries Project? :) 11:11:36 oh sure. 11:11:47 just tell me what to write :) 11:12:13 I'm working on an Imap.hs 11:12:25 hmm, Imap? 11:12:35 on comp.lang.functional, Michael Feathers just requested an SMTP and POP3 module 11:12:52 I think libs of that flavor would be useful to the general public 11:12:57 oh right. 11:13:07 hmmm. 11:13:12 what do you think? 11:13:29 um, of doing something like that? 11:14:00 yah 11:14:02 im ambivalent 11:14:08 hi, I'm Shae ;) 11:14:16 heh 11:14:18 How do I convert a list of elements to a list of single-element lists? 11:14:44 map (\x -> [x]) 11:14:49 on the one hand, i can see much usefullness for something like that as a haskell module 11:15:15 if you have better suggestions for Haskell modules, I'd love to hear 'em 11:15:22 Igloo: Thanks. 11:15:27 I need to learn this anonymous lambda thing. 11:15:48 hrm, I want a cvs server for the Haskell Tutorial 11:15:50 Do you want me to explain how it works? 11:15:58 maybe I should use sourceforge 11:16:20 on the other hand I'm lazy enough to want to use a ffi to some other imap library :) 11:16:39 if there is one. 11:17:45 (i guess the reality is for me that im not too interested in learning the ftp http,imap, etc protocols) 11:18:24 hmmm. 11:18:29 Igloo: Sure. 11:18:52 I guess \x -> expr makes expr a function that acts on x? 11:19:22 (\x -> x + 3) 5 => 5+3 11:20:18 the x in that expression gets bound to 5. 11:20:42 * LoganH nods. 11:20:44 It makes sense. 11:20:53 When I first read about it, I wasn't thinking this way. 11:21:09 (\ p1 p2 p3 ... pn -> f) is a function that takes n arguments matching the patterns p1 through pn, binding the values as normal functions do, and evaluates f with them having these values 11:21:29 Cool. 11:22:17 So you can also have tuples or lists on the left, so you can do (\(x, y) [a,b,c] -> x + y + a + b + c) (4, 5) [3,4,5] 11:24:12 yeah, of coures you'd better not try that against something that has more than 3 elements in that list.. 11:24:29 Yeah :-) 11:25:53 I can't make this function correct no matter what I try. 11:25:58 What function? 11:26:21 I have a FiniteMap that associates Strings to Strings. 11:26:35 Or, really, Chars to Strings. 11:27:00 And I want to replace each character in a word with the string it's mapped to in the FiniteMap. 11:27:22 I think I know what I may have done wrong, now that I've formalized it like that. *grin* 11:27:32 :-) 11:27:48 yah, the "cardboard wookie" syndrom 11:27:56 Cardboard wookie? 11:27:58 hmm? 11:28:05 er, it's a story I read... 11:28:15 I've never heard of it posed like that. 11:28:32 I didn't define the types of my function properly. 11:28:39 the lead developer on a project had all his time taken up by his team members coming to him to explain their problem 11:28:42 Because the translation as I describe is String -> [String], which I didn't realize. :P 11:29:00 about 75% of the time they figured it out halfway through the discussion 11:29:03 * LoganH nods. 11:29:05 I do that all the time. 11:29:14 I'm more used to channels where people rarely answer me. :P 11:29:17 so the lead put a cardboard wookie in the small room in front of his office 11:29:43 and then clients on tour would say "why is your developer talking to a cardboard wookie?" 11:30:01 ah! 11:30:24 damn, that's not such a bad idea :) 11:30:48 yah, I have a small purple stuffed pterodactyl hanging from an ethernet cable over my monitor =) 11:31:19 * graydon contemplates adapting eliza to the task 11:31:28 yah, that would be a good idea 11:31:58 "I have a function of type [String] -> [String]" 11:32:05 "Why do you have a function of type [String] -> [String]?" 11:32:10 "Oh, yeah, thanks" 11:32:12 * shapr laughs 11:34:25 Hahaha. 11:39:45 * Igloo growls at people who don't know how to use tabs properly 11:40:05 * shapr hides his unsightly stack of spaces 11:40:05 What is proper tab usage? 11:40:19 tabs on cereal boxes? 11:40:24 that does irritate me. 11:41:10 Proper tab usage is fairly complicated, but using 4 "space" indentation but collapsing every 8 spaces into a tab is the worst and most common error 11:42:08 * LoganH nods. 11:42:18 I wish vim didn't do that by default when autoindenting. 11:42:25 Igloo: is proper usage documented somewhere? 11:42:25 That's why I'm really strict about only indenting to tab stops. 11:43:03 I can imagine mixed tab usage could really screw up Haskell parsing. 11:43:17 I've never been a big fan of layout governing syntax. 11:43:22 shapr: I haven't seen anything that does so 11:43:22 emacs does by default too 11:43:25 I just use spaces 11:43:41 A lot of people have very strong and very opposing views regarding tab usage. 11:43:45 Haskell defines tabs to be 8 spaces for the purposes of the layout rule 11:44:18 When vim autoindents, it uses as many tabs as it can, then uses spaces to make up the remaining difference. 11:44:27 So it's pretty safe that way. 11:45:14 I'm used to Python, correct usage there is: one indent is four spaces, two indents together take up 8 spaces. continue adding four spaces every indent 11:45:29 and *never* use tab characters in your source code. 11:45:44 Igloo: you should be receiving email from me about now ;) 11:45:45 Tabs in Haskell are harder than normal because of the way people tend to write it 11:45:45 (if you ignore the fact they are defined to be 8 spaces) 11:45:53 I use a tabwidth of 4. 11:45:55 And just use tabs. 11:46:02 That way you can have the tab character actually mean indention. 11:46:23 The problem occurs when other people modify your code with editors that aren't smart with tabs. 11:46:33 shapr: Who are you? 11:46:40 Hi Igloo, I'm Shae Erisson. 11:46:47 nice to meet you. 11:47:01 Hi, but whois already told me that :-) 11:47:06 * shapr grins 11:47:16 Will the mail be from Shae Erisson too? 11:47:20 yup. 11:47:32 shapr: Let's see some ID. 11:47:37 uh oh 11:47:37 Ah, OK, not one of the ones I just got then 11:47:57 LoganH: That doesn't work in Haskell 11:47:59 part of the Haskell Tutorial Series, brought to you by a realllly long CC: list 11:48:08 foo = do bar 11:48:13 baz 11:48:22 Is not the same as 11:48:25 foo = do bar 11:48:34 baz 11:49:06 I do foo = dobarbaz 11:49:39 I think "cuddling" expressions with keywords makes it too difficult to line things up. 11:49:43 OK, that style will work 11:50:02 Hmm? How is it any harder? 11:50:04 with emacs, I can hit C-c = and stuff lines up happily. 11:50:20 Igloo: First, it pushes your amount of indenting way out to the right. 11:50:48 Second, you either have to follow the keyword you're cuddling with a tab (so you can still use just tabs to indent), or you'll have to use mixed tab/space usage to line things up. 11:50:51 shapr: Is this mail going to be about CVS, before I send one about it? :-) 11:51:02 And either case is bad, because you might change your tab width. 11:51:09 In which case the number of tabs required to line things up will change. 11:51:17 Which means someone else won't necessarily see your stuff lined up. 11:51:43 If you constrain tabs solely to the beginning of lines, your code will look the same regardless of editor settings (though it may get wider or narrower :P). 11:52:09 I'm not convinced I like 11:52:16 somethingverylong = do 11:52:27 stuff inside the do block starts way back here 11:52:29 Igloo: yah, it is 11:52:34 OK 11:52:53 Igloo: I volunteered for chapter 2 (since that's all I'm really qualified for) and I asked about CVS, and requested a mailing list. 11:52:59 Igloo: Well, I hate how somethingverylong = do has a body that is indented at a different level than short = do. 11:53:27 You could do somethingverylong =dobody 11:53:37 I'm kind of undecided between the two styles. 11:53:41 And I'm not sure what you meant about tabstop changing making the code not line up properly - it will if you are using tabs correctly 11:53:41 I tend to use the latter style in bash scripts. 11:53:46 e.g. 11:53:47 foo = do bar 11:53:47 baz 11:54:01 Yeah, but most editors don't autoindent that way. 11:54:04 Or replace the rightmost space on each line with a tab if you prefer 11:54:11 And I've found typing that way is a pain. 11:54:11 No, but that's the fault of the editor 11:54:20 I used to line up the conditional expressions in if statements in C, for example. 11:54:23 And ran into the same problems. 11:54:27 And is basically the reason why I use spaces 11:55:05 I think my style makes the semantic meaning of every whitespace character perfectly clear to me. :P 11:55:06 Editors will lign subsequent lines up correctly, if you are just using spaces, when you hit enter 11:55:11 So if I'm ever processing my code itself, I know what to do. 11:55:34 Yeah, I don't think there is anything wrong with your style, it's just not my preferred style 11:55:34 imho, if it works in ghc, I can always reindent it later. 11:55:48 It's code that breaks when your tabstop isn't the same as the author's tabstop that annoys me 11:55:48 This just goes to show that there can never be any consensus on the matter, hence there is no "proper usage documented" anywhere. :P 11:56:07 I think my way is consistent enough to be safe. I'm not an expert on Haskell syntax yet, though. :P 11:56:30 You can define "Proper usage of tabs", but you will be defining a set of possibilities rather than the One True Way 11:56:41 I think if the only whitespace that can occur before any non-whitespace at the beginning of the string is tabs, then it's safe. 11:56:51 Maybe A True Way. :P 11:57:08 :-) 11:57:15 soo... 11:57:34 anyone wanna contribute code to the Haskell User-Submitted Libraries project? 11:57:35 So I need to fix this code. :P 11:57:37 shapr: Sure. 11:57:43 anyone wanna join as a developer? 11:57:48 What is that, shapr? 11:57:57 I just started learning Haskell 36 hours ago, though. 11:57:59 it's a sourceforge project I just created 11:58:00 :-) 11:58:08 Ah, has it actually been created already? 11:58:12 because honestly, the standard libs are missing lots of stuff 11:58:15 well, submitted 11:58:17 not approved 11:58:18 * Igloo has not been impressed with my SF experiences 11:58:27 Is it just packages, or cookbook style code snippets? 11:58:27 hey, it's better than what I have 11:58:31 shapr where is it? 11:58:50 zorb: it'll be sf.net/projects/haskell-libs/ if they approve it (which I assume they will) 11:58:56 * Igloo really should have replied half an hour ago instead of collapsing on here :-) 11:59:05 I'm putting together a cookbook (in C) for the programming teams I coach. :P 11:59:06 What did you put for the license OOI? 11:59:22 LoganH: oh cool, you coach programming teams! 11:59:29 Well, assistant coach. 11:59:41 But I thought it'd be cool to have this cookbook. 11:59:52 We've always had code lying around, but never organized and thus never much reused. 12:00:03 And you can only have paper sources in an ACM contest. :P 12:00:59 diff -ub rocks 12:01:22 Igloo: I chose a BSD license 12:01:27 diff --side-by-side :P 12:01:33 mostly because I read the GHC license today 12:02:08 and it says "we can't use lGPL because binaries would require something, and this, and that, and so.. we use something that's almost BSD" 12:02:51 honestly, I don't care about the license as long as no one tries to sue me. 12:03:28 Overkill - it was a 3 line change hidden as the guy doing it had changed all the tabs to spaces - hence the -b :-) 12:03:55 aha 12:04:27 Tom Moertel wants to get the latest version of tHT also 12:04:28 Hmmm, that's not in the Debian copyright file 12:05:06 MS do their best not to touch anything GPLed to avoid possible problems if they write similar things unrelatedly, though 12:05:15 "viral" licenses 12:06:45 what does Sourceforge actually provide? 12:07:09 cvs tree, website, bug tracking, etc 12:07:18 and I just got the approval mail :) 12:07:20 yay! 12:08:12 anyone else wanna join? 12:08:22 if so, tell me your unix username for sf.net 12:08:25 What is the definition of Ordering? 12:08:37 shapr: I'm loganhanks. 12:08:42 awright 12:09:16 Oh, I think I found it, LT | GT | EQ ? 12:10:08 i think I have a name as nrut uder sourceforge. I may need to create a new account though. (yes I want in) 12:10:32 ok, check to see if you can login to sf.net 12:10:36 if you can, I'll add you 12:15:02 I'm in. 12:15:27 and your username is? 12:15:48 nrut 12:15:51 awright 12:16:06 loganh: yep 12:16:37 ok, you're added 12:17:35 Can patterns be nested (like: [(a, b):rest])? 12:17:51 Yes 12:18:04 Thought (hoped) so. :P 12:18:09 though that pattern is probably wrong 12:18:25 unless you really want a singleton list whose element is a list of tuples 12:18:30 s/a/to match a/ 12:18:38 doh, s/a /to match a / 12:19:02 incidently [a,b,c] is rather a ahort version of (a:(b:(c:[]))) 12:19:03 alrighty 12:19:34 so you were implicitly using a nested pattern. 12:19:37 I'll try to have Imap.hs (donated by xbill) cleaned up and in CVS tonite 12:23:51 anyone else have some libs or code they want to donate? 12:24:58 I meant ((a, b):rest) :P 12:26:23 I'm starting to get to the point where I have bugs more often than type errors. :P 12:26:33 :-) 12:26:41 I posted something onto the haskell-cafe mailing list about a week ago, but frankly its 1. too ugly and unruly 2.my goal was to ambitious for my level of knowledge of Haskell. 12:27:36 so franky, I dont have anything :( 12:27:54 huh? 12:28:24 um.. 12:28:34 Oh, I see, code to contribute 12:28:40 right. 12:28:54 What did you post OOI? 12:29:06 OOI? 12:29:10 out of interest 12:29:18 ooh. 12:29:24 Differentiate.lhs 12:29:38 (more of a web page to it). 12:29:39 Ah, right 12:29:47 How do I convert a list of lists to a flat list? 12:29:51 Seems like it should be obvious to me. 12:29:52 Yeah, I remember the link being mentioned now 12:29:57 concat 12:30:35 --- quit: jlb ("Client Exiting") 12:30:47 Thanks 12:30:54 * shapr goes off to watch Dark Angel 12:31:12 mmm. Jessica Alba 12:31:46 Now to come up with something analagous to strstr in C. :P 12:32:14 I really need a good Haskell function reference. :P 12:32:28 The report is fairly good as a reference 12:32:49 www.haskell.org, definition and follow the link to the revised edition 12:33:03 well..., if you want fast there's something like Knuth, Morris, Pratt, which I have no idea how'd that be translated to haskell :) 12:33:20 The report seems to just be type signatures and implementations. :P 12:33:28 or the best way anyway. 12:33:37 Knuth-Morris-Pratt is not quite as good as Boyer-Moore. 12:34:01 * Heffalump thinks the report is only good as a reference if you like that sort of thing, which most people don't 12:34:11 Or implementation and specification are fairly close in Haskell, and type signatures, specification and name (often gives a hint as to what it does) make a good reference IMO 12:34:25 s/Or // 12:34:39 KMP and BM would both be overkill for the substring searching I'm doing. :P 12:34:47 hehe 12:34:58 Since my max word size here is 80. 12:35:33 Is there a trivial way just to get the length n prefix of a string? 12:35:40 (or the first n elements of any list?) 12:35:55 take n 12:35:56 take 12:35:59 Ohhh yeah. 12:36:01 Heh. 12:36:11 and if you're looking for prefixes, isPrefixOf is a good function.. 12:40:27 hmmm. strstr searchstr str@(_:xs) = (searchstr 'isPrefixOf' str) || strstr searchstr str;strstr _ [] = False .... (or something :-) 12:40:34 oops. 12:41:09 s/strstr searchstr str/strstr searchstr xs/ 12:41:14 :-) 12:41:25 strstr [] [] should be true 12:42:14 I think I understand your thinking 12:42:21 Is tails not in the prelude?! 12:42:38 Hmm, it's in List 12:43:18 but rather str [] _ should probably be true. (null is a substring of anything including null) 12:45:15 igloo: would tails make the code particularly better? 12:45:44 My strstr is 82 chars long 12:46:18 I didn't say shorter, I said better 12:46:36 I think it's nicer 12:47:03 Here's my strstr: 12:47:04 substring :: String -> String -> Bool 12:47:04 substring _ (_, []) = True 12:47:04 substring [] _ = False 12:47:04 substring a b 12:47:04 tails makes the recursion implicit 12:47:05 igloo: yes, but you're an experienced Haskell programmer 12:47:06 | (take (length b) a) == b = True 12:47:09 | otherwise = substring rest b 12:47:11 where 12:47:14 (_:rest) = a 12:47:18 Oops, that's not quite it. 12:47:21 Change (_, []) to [] 12:47:31 strstr needle haystack = elemIndex True $ map (isPrefixOf needle) $ tails haystack 12:47:33 shapr: I'm eleganesh on sourceforge, btw (having taken a little while to find this out...) 12:47:36 (the substring I'm actually using takes a (String, String) as second argument, due to what my program is doing) 12:47:48 Heh, I'll have to try that. 12:47:50 What's the $ operator? 12:47:58 loosely bound application 12:48:02 Function application, but low precedence 12:48:24 Is a $ b shorthand for a (b) then? 12:48:29 No 12:48:33 Oh. 12:48:34 a b c = (a b) c 12:48:40 a $ b c = a (b c) 12:48:53 That's what I meant. :P 12:49:09 Oh, yeah, ISWYM now :-) 12:49:28 it's shorthand for (a) $ (b), in a sense 12:49:32 I was using b to mean any string of characters, wasn't very clear of me. 12:49:38 Only that assume that $ (and various other things) aren't in a 12:49:46 Yeah, I can see how that saves it from being too much like lisp syntax. :P 12:49:58 igloo: errm, it associates to the left, so $ wouldn't matter 12:50:12 * Heffalump tries to think of something that would 12:50:31 Ooops, yes 12:50:37 Well user defined operators could 12:50:53 how does associativity work on things of equal precedence? 12:51:10 left and right work in the obvious way 12:51:12 1 is lowest, isn't it? 12:51:15 non gives an error 12:51:17 0 is 12:51:24 and ($) is 1? 12:51:32 If you say so 12:52:28 nope, 0 12:52:33 so is there anything? 12:53:17 Oh, maybe there isn't anything that's valid Haskell 12:53:19 I like the word "fixity." 12:53:54 That's quite a cute result 12:54:05 um, somehow operators are determined to be right or left associative. 12:54:26 that comes from infixl or infixr in the definition 12:54:37 or infix for non-associative 12:54:40 s/definition/fixity declaration/ 12:54:43 ah. 12:55:02 igloo: wdym by "non-associative" 12:55:03 hmm 12:55:06 Ooops, I think I got distracted from what was distracting me from work 12:55:26 a & b & c is an error if & is non-associative 12:56:20 * Heffalump wonders if anyone has ghc 4.08 or 5.something on a platform that isn't i386-linux, sun4-solaris or i386-cygwin 12:58:22 * zorb scratches head as to whether his 5.something is cygwin. does cygwin mean "windows platform" or "running under cygwin under windows" 12:58:43 you want to test some code? 12:59:29 cygwin means windows platform really 12:59:38 the Makefile won't work without cygwin, that's all 12:59:56 and yeah 13:01:03 Heh, finally have a working implementation for this problem. 13:01:06 Now to try a harder one. 13:01:48 What problem? 13:02:11 ah.. ok, sorry 13:02:15 I'm learning Haskell by implementing solutions to past problems from ACM programming contests. 13:02:26 Ah, right 13:02:38 I just did Problem C from the '97 ICPC. :P 13:04:08 For the next one I'll have to learn how to use actual data structures in Haskell. :P 13:06:42 How do I do records in Haskell? 13:06:52 I presume I use a tuple, but how do I easily access particular elements of the tuple? 13:07:17 Write a function for each member? :P 13:07:20 you can use tuples, or you can declare your own datatype with accessors. 13:07:23 You use a data statement 13:07:24 there's proper records 13:07:35 I just need a good example. 13:08:54 A search for "haskell accessors" didn't turn up much on Google. :P 13:09:23 Works better if I search for the singular, I guess. 13:09:50 well, i dont know the proper name for them. 13:10:36 try Haskell records 13:10:51 yeah. 13:11:08 Heffalump: That's the first thing I tried, I didn't feel like sifting through a bunch of government stuff for towns or counties named Haskell. *grin* 13:11:22 I should be able to constrain the search. 13:11:46 Have you looked at the section in the report on records? 13:11:51 ok, since I went to the trouble to look at some of my other code.... 13:12:09 --- quit: dblack (Read error: 110 (Connection timed out)) 13:12:41 --- join: jlb (~ktk@jeremeydsl-3.mylinuxisp.com) joined #haskell 13:12:45 I'm looking. 13:12:48 something like data X a = Z {list::[a],int::Integer,fefifofum::a->b} etc. 13:13:02 oops 13:13:10 X a b = Z {list::[a],int::Integer,fefifofum::a->b} etc. 13:14:25 I found something in the gentle introduction that does a binary tree. 13:15:26 ok, I guess I shouldn't have used type variables in my example. 13:16:42 or uh.. 13:16:46 ok. 13:18:07 * zorb just wondered if his example needed any more explaining. 13:18:31 It was completely incomprehensible to me. :P 13:18:46 sorry about that. 13:18:51 how about this. 13:18:58 All I want is a simple directed acyclic graph. :P 13:19:22 Or, rather, I want a record type that contains a value of arbitrary type and two lists of that record type. 13:19:45 alright 13:20:09 I was trying to understand how the example in the "gentle" introduction worked. 13:20:33 I need to find my copy of "gentle". 13:20:52 http://haskell.org/tutorial/goodies.html is where I'm looking now. 13:21:59 But it's not really what I want. 13:22:06 I just want a familiar notion of a record. :P 13:22:33 What did the X and Z stand for in your example? 13:22:49 That page doesn't look like it talks about record? 13:23:05 No, but it does build a binary tree. :P 13:23:08 I'm not quite sure what to call Z (other than a constructor) 13:23:20 data Tree a = Tree { leaf :: a, left, right :: Tree a } is what you want I think 13:23:22 actually, i guess it is a constructor 13:23:23 Oh. 13:23:59 Igloo: Hmm, and so if I have an instance of Tree in variable x, left x would return the left subtree of x? 13:24:03 data Tree a = Fork { leaf :: a, left, right :: Tree a } | Leaf actually 13:24:08 Yup 13:24:31 What is the significance of the constructor identifier? Does the constructor have to be defined somewhere? 13:24:38 * Igloo should mention I don'e use records 13:25:01 you define it by using "data" 13:25:06 Fork 5 lefttree righttree is an expression of type Tree Integer 13:25:33 Oh, so you're just providing an identifier that'll represent a function you can use to construct instances of that type? 13:25:39 yep. 13:25:42 That answers my other question, then. 13:25:56 (at least I think you can use that syntax with records) 13:26:02 but it's also special in that you can use it to pattern-match too 13:26:14 you can't normally use functions in pattern-matching 13:28:07 Heffalump: want me to add you to the project then? 13:28:13 * shapr finishes watching Dark Angel 13:28:17 mm, good episode 13:28:35 shapr: may as well 13:28:45 alright 13:33:25 * Heffalump and Igloo get distracted by major sysadmin problems 13:33:26 ok, you're added 13:42:29 --- quit: jsw (Read error: 110 (Connection timed out)) 13:46:53 later people 13:46:57 --- part: zorb left #haskell 13:49:58 If I have a function of type a -> b -> c, and I give it its first parameter, what is its type signature? 13:50:01 b -> c? 13:50:18 I guess that makes sense. 13:51:06 I actually have a use for a "section" now. 13:51:24 That's a really nice feature. 13:58:50 LoganH: yah that's right 13:59:31 I wrote a fractal module, one method is "iterUntil" 13:59:45 so I have a function called "bail" 13:59:55 that bails out after so many iterations 14:00:29 I do partial resolution on it: bail 200, or bail 400 14:00:43 then I use the returned function in the rest of the module 14:01:03 it's a lot simpler to try stuff in the interactive mode of ghc or hugs: 14:01:12 map (+1) [1..6] 14:01:32 do you have an interactive session open? 14:02:45 * LoganH nods. 14:03:14 ok, so try these lines of code: 14:03:16 [1..6] 14:03:24 [1,3,12] 14:03:27 er, oops 14:03:32 [1,3..12] 14:03:34 :t (+1) :P 14:03:34 that's right 14:04:00 I think I'm going about this code all wrong. 14:04:09 map (+1) [1..6] 14:04:11 I just can't think in a functional manner regarding this problem. :P 14:04:23 filter (>3) [1..6] 14:04:42 filter (>3) . map (+1) $ [1..6] 14:04:59 hm, I'm not sure if I got that last one right 14:07:20 --- join: lodewijk (~lodewijk@voge.xs4all.nl) joined #haskell 14:07:33 hoi lodewijk 14:07:38 re 14:07:47 what's up? 14:07:49 how do I create a Show instance for a polymorphic type? 14:07:59 shapr: still learning haskell :) 14:08:05 same here 14:08:11 keep the code flowing 14:08:20 I'm not sure what a polymorphic type looks like 14:08:33 data BinTree a = Nil | Node a (BinTree a) (BinTree a) 14:08:46 hm, good question 14:08:48 so BinTree Int would be a binary tree for integers 14:09:14 so I turn to page 222 of thompson and whip up: 14:09:15 instance Show (BinTree a) where 14:09:15 show Nil = "Nil" 14:09:15 show (Node e _ _) = show e 14:09:33 --- join: dblack (~dblack@ool-18be3b59.dyn.optonline.net) joined #haskell 14:09:40 and hugs starts to complain about "Cannot justify constraints in instance member binding" 14:09:56 wow 14:10:04 I've never heard of that error message 14:10:15 cool huh ;) 14:10:15 yah, I'm impressed 14:11:01 oh, wait, ghc gives a more helpful message. 14:11:07 what does it say? 14:11:33 hmmm 14:11:35 Could not deduce (Show a) from the context (Show (BinTree a)) 14:11:35 Probable fix: 14:11:35 Add (Show a) to the instance declaration context 14:12:00 instance Show BinTree where 14:12:14 show (BinTree a) = 14:12:14 ? 14:12:22 here's what Heffalump helped me write recently: 14:12:27 newtype MandelData = MandelData (Integer, Complex Double, Complex Double) 14:12:32 instance Show MandelData where 14:12:32 show (MandelData (iters, z, c)) = "MandelData with values: Iteration Count: " ++ show iters ++ ", value of Z:" ++ show z ++ ", value of C:" ++ show c 14:13:08 "Illegal type in class constraint" 14:13:11 hmm... 14:13:22 I had some problems putting together 'instance' and a type constructor 14:15:20 that's my only suggestion, btw 14:15:45 ah.. show (Node _ left right) = "foo" gives to type errors 14:16:04 no errors? 14:16:29 show (Node e left right) = "foo" doesn't either, so it's the "show e" part. 14:17:51 hm 14:18:48 apparently I have to show that a is a Show instance. 14:19:34 uh 14:19:44 oh 14:20:00 do you have to make Node a show instance or something? 14:20:00 I'm having a hard time thinking how to do graph transformations in a functional manner. 14:20:02 * shapr is guessing 14:20:19 I'm stuck in the imperative mindset all of a sudden. 14:20:27 LoganH: er, how do you do them procedurally 14:20:58 Usually with traversals of some sort. 14:21:27 Where upon visiting a node you might change its value or its edges. 14:21:48 Hmm, I guess if I think of it carefully like that, I can do this. 14:22:47 I might need a better way of representing a graph here too. 14:22:55 I don't know anything about graphs 14:23:01 at least, not the ones your talking about. 14:25:07 oh 14:25:08 hey 14:25:17 are these like state automata? 14:28:12 A finite state machine can be represented as a graph, and its execution is a particular sort of graph traversal. :P 14:28:17 A binary tree is a graph. 14:28:20 oh 14:28:24 that sounds simple enough 14:28:44 A collection of vertices and a collection of ordered pairs of these vertices defines a (directed) graph. 14:29:23 why a pair of vertices? 14:29:36 (from, to) 14:29:47 * shapr thinks about that 14:30:47 so... 14:30:51 what's the point of a directed graph? 14:30:56 maybe I should just hit google 14:32:06 shapr: it is something a lot of problems can be modeled into and something where there's a lot of existing algorithms for. 14:32:15 oh 14:32:15 ok 14:33:34 map problem to DAG, run algorithm, map solution to problem domain, voila. 14:34:39 got it.. from the source of the Functional Graph Library, so maybe LoganH can be helped by it too. got it from www.haskell.org. 14:34:49 instance Show a => Show (BinTree a) where 14:34:50 etc 14:35:45 oh 14:35:46 nifty 14:36:35 Main> Node 4 Nil Nil 14:36:36 (4 Nil Nil) 14:36:43 cool! 14:37:01 Main> Node 4 (Node 2 Nil Nil) (Node 6 Nil Nil) 14:37:02 (4 (2 Nil Nil) (6 Nil Nil)) 14:37:07 A lot of things can be represented as graphs (directed or undirected)... 14:37:17 * shapr thinks about that 14:37:24 And quite a few th ings can be represented as directed acyclic graphs, or DAGs for short. 14:37:41 I'll have to read up on those 14:37:44 For instance, a packaging system, where packages have sets of dependencies, is a DAG. 14:37:49 Or represented by a DAG, rather. 14:38:03 So is a set of courses and their prerequisites. 14:38:12 that's interesting 14:38:28 LoganH: http://www.cs.orst.edu/~erwig/fgl/haskell 14:38:33 For example, there is an algorithm known as a "topological sort" that applies to figuring out what order you have to take classes in, in order to meet all prerequisites. 14:38:44 I'd enjoy making a directed graph of debian packages 14:39:01 that's fascinating 14:39:13 shapr: how do you think dpkg works? :) 14:39:29 shapr: Heh, go to that page lodewijk just pasted, it actually shows topological sort as an example. 14:39:58 Yeah, when you tell apt-get to install a set of packages, apt does a topological sort to determine what packages have to already be installed before it can install those packages. 14:40:10 And it uses topological sort to determine what order to install them in. 14:41:39 fascinating 14:42:02 I'm off. good luck hacking :) 14:42:03 --- quit: lodewijk ("byte") 14:42:20 You can also represent a road system as a graph. 14:42:26 If you have one-way roads, it's a directed graph. 14:42:45 And you can associate weights with each edge, representing the cost of traversing that edge, for instance. 14:42:58 So the weights in a graph representing a system of roads could represent how long it takes on average to drive that stretch of road. 14:43:15 And then you can run any one of tons of shortest path algorithms to compute the most efficient path between any two points. 14:43:22 That's how stuff like mapquest work. 14:43:29 cool 14:43:31 routing tech ;) 14:45:33 Yes, that too. 14:45:36 Computer networks are graphs. 14:47:36 There are certain routing protocols, like "OSPF", which stands for "Open Shortest Path First", that rely on graphing algorithms to pick optimal paths, I presume. :P 14:51:02 interesting stuff 14:55:23 I'm finding in this graduate digital picture processing class I'm taking this semester, some of the stuff we're doing right now can really just be reduced to graph theory. :P 14:55:33 nifty 15:00:45 Is there a library for doing a lot of unix system type stuff (like exec, for example)? 15:01:06 yah 15:01:33 Or, better yet, pipes. 15:01:40 Like popen in C. 15:01:41 that would be Posix 15:01:45 lemme show you some code... 15:02:02 http://kungens.kemi.fi/~shae/Hsh.hs 15:02:14 Cool, I think I found the documentation. 15:02:58 Heh, I should've noted ghci outputting: Loading package posix ... linking ... done. 15:03:04 Aren't I observant? :P 15:04:06 heh :) 15:04:14 Hmm, is there something analagous to popen in Posix? 15:04:25 somewhat 15:04:46 er 15:04:51 wait, no I don't know that :) 15:05:12 I guess I can just use a named pipe. 15:06:46 Which negates the need for Posix entirely for now. 15:07:36 ok 15:07:38 http://haskell.org/onlinelibrary/io.html 15:08:03 I think the handles they mention in here are popen kinda things 15:09:11 If I use hGetContents to get the characters of a file, how do I split them into lines easily? 15:10:42 List.lines maybe? 15:11:15 * shapr is guessing again 15:11:53 I really wish I had this standard libraries documentation in html rather than PDF. 15:12:01 http://haskell.org/onlinelibrary/ 15:12:55 Oh, I missed that one. :P 15:13:06 we're here to help :) 15:20:44 What's the optimal way to remove the first n elements of a list? 15:21:08 drop ? 15:21:09 Oh, drop? 15:21:10 drop. 15:21:10 drop 5 15:21:11 Heheh. 15:21:28 I veentually remembered where I asked a similar question to that, where take was the answer. :P 15:22:06 takeWhile, dropWhile 15:22:09 are also fun and useful 15:27:25 does hugs have Socket?? 15:28:08 I can't find it 15:38:18 I don't know. Does ghc? 15:39:31 yup 15:39:45 in ghc I have to do :set -package net 15:45:35 * shapr falls over asleep 15:59:11 What's the difference between Int and Integer? 16:02:10 Integer is unbounded 16:02:14 Int is 32 bit (I think) 16:03:32 Hmm, does which one you use affect efficiency? 16:04:38 yes 16:06:39 I'll have to keep that in mind, then. :P 16:06:49 Writing my first useful program in haskell. 16:06:51 Or just wrote it, rather. 16:07:35 Examines output of the ping command and picks out where there are lost or out-of-order packets. 16:07:46 Heffalump: Do you know if there is something analagous to popen available for haskell? 16:15:35 I like how ghc builds an executable that requires libgmp.so.3. 16:21:26 dunno, sorry 16:46:04 Heh, functional programming lets me do a lot of things I've often strived to do for years in other languages. 16:58:12 --- quit: pHa (Read error: 104 (Connection reset by peer)) 17:29:12 --- log: started haskell/02.01.22 17:29:12 --- join: clog (nef@bespin.org) joined #haskell 17:29:12 --- topic: 'Functional Programming, that's the opposite of Dysfunctional Programming (like VB) | we be loggin' http://tunes.org/~nef/logs/haskell/ | welcome to the Haskell Dojo | julien is up to white belt! jewel and shapr are up to yellow belt!' 17:29:12 --- topic: set by shapr on [Mon Jan 21 04:46:00 2002] 17:29:12 --- names: list (clog LoganH Heffalump) 17:29:14 What do I use for integer division? 17:29:40 Oh, div. 17:37:45 --- join: graydon (~graydon@H145.C193.tor.velocet.net) joined #haskell 17:40:06 --- join: smkl (~sami@glubimox.yok.utu.fi) joined #haskell 17:49:15 --- join: dblack (~dblack@ool-18be3b59.dyn.optonline.net) joined #haskell 17:49:18 --- join: Igloo (~ian@pc3-oxfo3-0-cust1.oxf.cable.ntl.com) joined #haskell 17:56:17 --- join: dmiles (~alife@sense-sea-MegaSub-2-56.oz.net) joined #haskell 17:59:57 --- join: juhp (~petersen@firebox-ext.jp.redhat.com) joined #haskell 18:07:39 --- join: jlb (~ktk@jeremeydsl-3.mylinuxisp.com) joined #haskell 18:39:56 --- join: xbill (wli@DOMINIA.MIT.EDU) joined #haskell 18:46:05 --- quit: smkl (carter.openprojects.net irc.openprojects.net) 18:47:11 --- join: smkl (~sami@glubimox.yok.utu.fi) joined #haskell 18:52:50 --- join: PragDave (~dave@pragdave210.august.net) joined #haskell 19:09:10 I need some sort of swap function. 19:27:03 If I have two lists of the same length, how do I build a list of tuples, the nth tuple being the nth element of the first list and the nth element of the other list? 19:27:27 Is that what zip does? 19:28:32 LoganH: yes 19:28:33 i think 19:28:41 Main> zip "abc" [1,2,3] 19:28:41 [('a',1),('b',2),('c',3)] 19:29:01 yeah 19:37:45 --- join: pHa (sjh@Sprint252.tbaytel.net) joined #haskell 19:42:01 How do I efficiently append an element to a list? 20:32:23 --- quit: graydon () 20:54:13 --- join: La_mala (~ismael@223-MADR-XL4.libre.retevision.es) joined #haskell 20:55:24 Ruby rules! 20:58:14 it does? 20:58:41 Maybe, maybe not! 20:59:02 it's popular here in Japan 20:59:13 do you like it? 20:59:45 I don't know much about it, bat it seems clean. 21:01:23 the little i know about it, it seems to have taken a bit too much from perl for my taste 21:02:51 It has taken a bit from python too but even more object oriented. I can't say you much more about it. 21:04:02 How is the health of linux in Japan? It's only for geeks? It's conquering the desktop? 21:09:07 --- nick: La_mala -> ismael 21:31:09 Someone has seen the Monad Lisa? 21:33:50 ismael: fine. though maybe the adoption by businesses is slower than in the US. 21:34:02 ismael: how about in Spain? 21:36:20 juhp: Slow too. Spanish government goes on supporting Microsoft. 21:36:43 same here really :( 21:37:17 Last month gave a lot of money to Microsoft to get more Licenses of Windows for Universities. 21:37:31 ouch! 21:37:56 hard to tell whether it is conservatism or some conspiracy really 21:38:37 I like to think there's lack of knowledge. 21:39:13 "Madrid writes fat cheque to M$" -- hmm nice headline! 21:39:17 But the idea of conspiracy is always floating. 21:42:04 or "How do you want to pay today?" ;) 21:42:09 They gave money to install Explorer and Office. Wow, they are carrying university to the future! 21:42:46 ;) 21:44:24 or "How much can you pay today?...and tomorrow?" 21:46:38 ;) 21:46:52 ismael: using haskell? 21:49:11 Not now, but last year I use it in the university. It was love at first sight. 21:49:24 Login message 21:50:24 Choose payment method (choose cancel to pay automatically by tax) 21:51:14 [Credit card] [Cash] [.money] [Cancel] 21:51:17 ;-) 21:52:13 [Credit card] [Cash] [.money] [All] 21:52:35 Of course we don't want your money, just your grandchildren's last dime.... 21:53:03 ok, sorry -- guess i'm getting carried about and very off topic 21:53:52 we should thank MS Research for indirectly supporting the GHC developers at least 21:54:04 that is something positive 21:54:12 We don't want your money, we want your soul for the rest of the eternity. 21:54:42 but MSR and M$ are different i like to think 21:54:52 They call it 'Colaterar damage', or something like that. 21:55:17 'Colateral damage', sorry. 21:55:53 they can call it what they like -- i'm not giving them a penny if i can help it 21:55:58 ;) 21:56:55 Do you think they use it GHC to make Windoz? It's imposible! 21:57:33 windoz 2010? 21:58:18 my understanding is that the GHC developers are not being paid by MSR to work on GHC 21:58:55 Not even Haskell can help them to make a half-good product! 22:00:45 Sorry juhp but I go to sleep now (7:00 AM). (Shit!, I must change my vampiric habits!) 22:01:09 ismael: night! 22:01:43 night! (or morning!) 22:01:54 --- part: ismael left #haskell 22:14:01 dropWhile isn't doing what I think it should be doing. 22:48:16 --- join: jemfinch` (~jemfinch@rpat-100-139.resnet.ohio-state.edu) joined #haskell 23:59:59 --- log: ended haskell/02.01.22