Available formats: content-negotiated html turtle (see SIOC for the vocabulary)
Back to channel and daily index: content-negotiated html turtle
These logs are provided as an experiment in indexing discussions using IRCHub.py, Irc2RDF.hs, and SIOC.
| 00:00:47 | <vixey> | does anyone hove the time in CST? |
| 00:00:54 | <cads> | hehe, well obviously, a probability monad.. hehe, I should have thought of that |
| 00:01:06 | <cads> | vixey, it'd be like 7? |
| 00:01:09 | <MyCatVerbs> | cads: http://www.randomhacks.net/articles/2007/10/02/probability-monads-at-hac-07-ii sounds most useful. AFAIK the probability monad is roughly the list monad with numbers attached to every item. |
| 00:01:17 | <vixey> | hmf |
| 00:01:22 | <vixey> | thans |
| 00:01:24 | <vixey> | thanks |
| 00:01:48 | <mux> | MyCatVerbs: via the syscall |
| 00:01:48 | <roconnor> | that's 7 pm CT, which is currentlyin CDT. |
| 00:02:09 | <cads> | MyCatVerbs: hey, yeah, that's all a probability distribution is anyways |
| 00:02:18 | <mux> | MyCatVerbs: which is why I'm using Storable instances to fetch structs |
| 00:03:07 | <MyCatVerbs> | mux: I haven't looked at your code, but is that safe? I didn't think the structs' exact layouts were specified, except as "this struct will have at least these members...". |
| 00:03:40 | <mux> | MyCatVerbs: it is entirely up to the caller to provide correct instances |
| 00:03:47 | <mux> | but it is safe |
| 00:03:48 | <MyCatVerbs> | Oh, I'm sorry, there are no structs in sysctl(3)'s interface. |
| 00:04:04 | <mux> | not on the surface |
| 00:04:17 | <mux> | FreeBSD has format strings embedded in special calls |
| 00:04:32 | <mux> | it would have given S,kinfo_proc for the process sysctl for instance |
| 00:05:16 | <cads> | MyCatVerbs: I can see how we could raise a random variable into a structure that would encapsulate the distribution and expectation functions, but I'm not sure what that structure would compose if it were to be a monad |
| 00:05:38 | <MyCatVerbs> | cads: do you mean "comprise" rather than "compose"? |
| 00:06:05 | <mux> | MyCatVerbs: the hpaste link was only a demo program's code and output, btw |
| 00:06:25 | <cads> | a monad's got to be able to compose monadic values somehow :D |
| 00:06:56 | <centrinia> | Haskell can be used to make a Quake 3 engine. :O |
| 00:08:54 | <MyCatVerbs> | newtype Prob a = Prob [(a,Float)], instance Monad Prob where { return a = [(a,1)]; m >>= f = normalise (concatMap f) where normalise l = map (/(sum (map fst l))) l; } -- would be my first guess. |
| 00:09:35 | <gavino> | centrinia: would it run decently fast? |
| 00:09:54 | <MyCatVerbs> | Er, snd, not fst. |
| 00:10:12 | <roconnor> | @faq can Haskell be used to make a Quake 3 engine? |
| 00:10:12 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 00:11:48 | <centrinia> | gavino, It gets about 60 frames per second on my 2.0GHz Athlon 64 system with a Geforce 7900 GS card. |
| 00:12:14 | <centrinia> | Here: http://www.haskell.org/haskellwiki/Frag |
| 00:12:50 | <cads> | MyCatVerbs: so the monadic value in that case is a list of values and their probabilities? |
| 00:13:02 | <mib_v7b5e2> | greetings |
| 00:13:11 | <QtPlaty[HireMe]> | Hi |
| 00:18:42 | <cads> | MyCatVerbs: thanks for the link, I'm reading it now |
| 00:19:01 | <cads> | it makes sense that there would be a few different kinds of probability monad |
| 00:19:44 | <mib_v7b5e2> | you guys know what rocks? |
| 00:19:57 | <cads> | paper scissors rock! |
| 00:19:57 | <opqdonut> | stones? |
| 00:19:59 | <mib_v7b5e2> | haskell |
| 00:20:04 | <mib_v7b5e2> | haskell rocks |
| 00:20:09 | <MyCatVerbs> | mib_v7b5e2: Bohemian Rhapsody. |
| 00:20:09 | <mib_v7b5e2> | i'm sorry for seeming like a fanboy |
| 00:20:35 | <vixey> | Bohemian Rhapsody! |
| 00:20:36 | <roconnor> | @faq Does Haskell rock? |
| 00:20:36 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 00:20:54 | <cads> | hey, what's the job market like for haskell coders? |
| 00:20:55 | <mib_v7b5e2> | but it's true. haskell is teh 1337h4x |
| 00:20:57 | <Baughn_> | ..it can also, on occasion, not rock. |
| 00:22:53 | <mib_v7b5e2> | yargh, what's the job market like for haskell coders? |
| 00:23:33 | <roconnor> | @. elite faq Does Haskell rock? |
| 00:23:33 | <lambdabot> | Th3 AN$WER Is: yez! h45kE1L C4N Do +|-|A7. |
| 00:23:59 | <MyCatVerbs> | @.elite tell roconnor Some plugins should not be composed. |
| 00:24:00 | <lambdabot> | +3|L Ro(OnNOr s0ME plUGINz0rz sHoU|d NO7 b3 (Omp0SeD. |
| 00:24:00 | <roconnor> | ah, the elite faq, with all the elite answers at hand. |
| 00:24:06 | <mib_v7b5e2> | @faq Does P=NP? |
| 00:24:06 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 00:24:13 | <mib_v7b5e2> | interesting |
| 00:24:36 | <dolio> | @faq How many roads must a man walk down? |
| 00:24:36 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 00:24:43 | <Elly> | hm |
| 00:24:50 | <Elly> | so haskell can prove P = NP... |
| 00:24:54 | <roconnor> | @what love |
| 00:24:54 | <lambdabot> | http://en.wikipedia.org/wiki/Where_Is_Love%3F |
| 00:25:04 | <Gracenotes> | baby don't hurt me |
| 00:25:09 | <gavino> | no more! |
| 00:25:16 | <gavino> | de de de de de de de de |
| 00:25:23 | <opqdonut> | gavino: has one more "don't hurt me" before "no more" :) |
| 00:25:42 | <dolio> | That's the wrong article, if that's the joke. |
| 00:25:44 | <gavino> | ^-; |
| 00:26:27 | <Gracenotes> | ACTION NP: What is Love? |
| 00:26:35 | <Gracenotes> | oooooh. |
| 00:27:00 | <mib_v7b5e2> | you guys hear about the guy who supposedly found a near linear way to factor any number? |
| 00:27:15 | <mib_v7b5e2> | http://eurocrypt2009rump.cr.yp.to/e074d37e10ad1ad227200ea7ba36cf73.pdf |
| 00:27:18 | <Gracenotes> | Shor's theorem? that's n^3 in the number of bits |
| 00:27:25 | <vixey> | mib_v7b5e2: what's the punchline? |
| 00:27:36 | <ali_clark> | @src map |
| 00:27:36 | <lambdabot> | map _ [] = [] |
| 00:27:36 | <lambdabot> | map f (x:xs) = f x : map f xs |
| 00:27:45 | <Gracenotes> | the standard for factoring algorithms is the number of bits, not the actual number |
| 00:27:56 | <dolio> | vixey: He's a crackpot. Badum-pish. |
| 00:27:58 | <Gracenotes> | in case that's the, er, punchline |
| 00:28:14 | <vixey> | haha |
| 00:28:47 | <mib_v7b5e2> | Gracenotes: point is, if his method works (it's under peer review right now), then RSA might be moot |
| 00:28:53 | <gavino> | rump? |
| 00:29:19 | <gavino> | what!! |
| 00:29:25 | <gavino> | as in rsa encryption? |
| 00:29:31 | <gavino> | liek openSSH |
| 00:29:40 | <vixey> | mib_v7b5e2: would it prove P = NP |
| 00:29:42 | <dolio> | Yes. RSA is all about factoring integers. |
| 00:29:45 | <roconnor> | does that make factoring faster than multiplication? |
| 00:29:54 | <mib_v7b5e2> | vixey: would it really? |
| 00:30:01 | <vixey> | I'm asking you.. |
| 00:30:08 | <inimino> | When my perpetual motion machine works, *lots* of things are gonna be moot. |
| 00:30:12 | <mib_v7b5e2> | vixey: oh, no. not at all |
| 00:30:14 | <Gracenotes> | http://groups.google.com/group/sci.crypt/browse_thread/thread/67ea1c4144aa59cb -- "From what I know SVP and CVP are NP-hard (in general). So, to prove that factoring integers is possible in polynomial time -- assuming this "prime number lattice" works -- you'd need to prove that the resulting SVP/CVP instances are always "easy" to solve" |
| 00:30:43 | <Gracenotes> | not necessarily credible either, but, we'll see. |
| 00:30:51 | <flippo> | inimino, you won't need it when I begin to market my antigravity machine. |
| 00:30:58 | <mib_v7b5e2> | apparently this dude came out of nowhere |
| 00:31:06 | <bd_> | Alternately, factor any 4096-bit number using the method. If it's used in practice even once, it'll put a lot of doubt into RSA, even if it doesn't cover /all/ keys. |
| 00:31:10 | <mib_v7b5e2> | and during his talk no one understand wtf was going on |
| 00:31:18 | <Elly> | what? |
| 00:31:26 | <vixey> | he sounds awesome |
| 00:31:28 | <Elly> | factoring in polytime on a quantum computer does not prove P = NP |
| 00:31:31 | <Gracenotes> | did he implement the algorithm on a computer? |
| 00:31:33 | <inimino> | flippo: well my machine is here now, today; I even have a video of it working which you can't see. |
| 00:31:33 | <roconnor> | well, if no one knows or understands him, he must be right! |
| 00:31:37 | <mib_v7b5e2> | Elly: we never said it did |
| 00:31:46 | <Elly> | oh, okay |
| 00:31:52 | <Elly> | I saw a mention of Shor's Algorithm above |
| 00:32:00 | <Gracenotes> | yeah. n^3 in the number of bits |
| 00:32:04 | <Gracenotes> | (with constant) |
| 00:32:11 | <flippo> | inimino, anti-gravity is powered by cold fusion. I have all the data. |
| 00:32:21 | <Gracenotes> | after all, if his algorithm is a valid algorithm with a given time constraint, it must be implementable on a computer |
| 00:32:31 | <Gracenotes> | with or without the given time constraint, really |
| 00:32:37 | <mib_v7b5e2> | flippo: if i had anti-gravity, i would put it under my longboard and that's it |
| 00:32:44 | <Elly> | you can implement Shor's on a traditional computer too |
| 00:32:47 | <Elly> | it's just a bit slower :P |
| 00:32:55 | <Gracenotes> | Elly: yeah. I can show you my Haskell code doing that ^_^ |
| 00:32:58 | <Gracenotes> | exponential slowdown |
| 00:33:00 | <inimino> | cold-fusion-powered anti-gravity? OK, you win :-) |
| 00:33:04 | <mauke> | > map (("Schnorr" !!) . join (+)) [0..3] |
| 00:33:06 | <lambdabot> | "Shor" |
| 00:33:11 | <Elly> | the naive way to do it would be O(2^n), I think? |
| 00:33:31 | <mib_v7b5e2> | Gracenotes: that sounded like a programming conference pickup line |
| 00:33:52 | <Baughn_> | inimino: Nah, my perpetual motion cold fusion antigravity device is even better. It has ninjas. |
| 00:33:53 | <mib_v7b5e2> | Gracenotes: "what do you say we head back to my hotel room and we do a bit of pair 'gramming" |
| 00:34:08 | <flippo> | For some reason, these mathematical breakthroughs never show up in peer-reviewed journals. (Except for the real ones.) |
| 00:34:12 | <mib_v7b5e2> | Baughn_: really? ninjas? how old ARE you? |
| 00:34:30 | <Elly> | come on lads, give us your best ninj! |
| 00:34:31 | <Gracenotes> | trial division is O(2^(b/2)), b = number of bits |
| 00:34:57 | <Baughn_> | mib_v7b5e2: Ninjas are useful. They can assassinate anyone who tries to look inside the machine. |
| 00:35:19 | <tiglionabbit> | would it require stateful code to turn a word list into a trie? |
| 00:35:46 | <mib_v7b5e2> | oh here's a good on-topic question |
| 00:35:50 | <Gracenotes> | by comparison, GFNS is O((b * (log b)^2)^(1/3)). subexponential, but still... |
| 00:35:52 | <Baughn_> | tiglionabbit: Require? No. Stateful code might be easier/faster. Or not. |
| 00:35:57 | <mauke> | tiglionabbit: unlikely, I have a trie in my xmonad.hs |
| 00:35:58 | <mib_v7b5e2> | can i use currying for a module? |
| 00:36:07 | <Irrelevant> | tiglionabbit, stateless code is turing complete, so no :P |
| 00:36:28 | <mib_v7b5e2> | so i could write a function: getFunction "monkey" "MyModule" |
| 00:36:33 | <Gracenotes> | a stateless turing machine... oh, the garbage collection... |
| 00:36:49 | <mib_v7b5e2> | and it would return me the MyModule.monkey function |
| 00:36:50 | <vixey> | a reversible turing machine -- |
| 00:36:51 | <mauke> | gFromList = foldr (uncurry gInsert) gEmpty |
| 00:36:58 | <Irrelevant> | mib_v7b5e2, er, no. and that's got nothing to do with currying. |
| 00:37:00 | <vixey> | running backwards |
| 00:37:18 | <mauke> | gnirut |
| 00:37:22 | <Irrelevant> | mib_v7b5e2, you could probably do something that'd happen at compile time with Template Haskell, but i don't see the point. |
| 00:37:30 | <Gracenotes> | granted, zippers provide a nice stateless turing machine implementation with relatively little memory being thrown around everywhere |
| 00:37:57 | <Irrelevant> | Gracenotes, a rather elegant one, too, iirc. |
| 00:38:20 | <mib_v7b5e2> | Irrelevant: lame.... |
| 00:38:50 | <Irrelevant> | mib_v7b5e2, i can think of many reasons why including such functionality would be a terrible idea |
| 00:38:55 | <Baughn_> | mib_v7b5e2: What are you trying to do, exactly? |
| 00:40:30 | <Gracenotes> | http://code.haskell.org/lambdabot/Plugin.hs -- lambdabot's module-loading implementation |
| 00:41:05 | <Gracenotes> | requires some trivial TH code in the modules themselves |
| 00:41:49 | <mib_v7b5e2> | Baughn_: if you promise not to laugh |
| 00:41:50 | <Gracenotes> | still, not recommended for simple apps -- there usually is a better way |
| 00:42:06 | <Baughn_> | mib_v7b5e2: No promises, but you won't be able to tell if I do. |
| 00:42:11 | <mib_v7b5e2> | Baughn_: so i could do: myRecord . function |
| 00:42:27 | <hydo> | Looking at jobs on craigslist can be a hoot sometimes. Here's a requirement from one: "Familiarity with multiple dynamically typed languages such as PHP, Perl, Ruby, Haskell, or Python" |
| 00:42:29 | <Baughn_> | mib_v7b5e2: ..huh? |
| 00:42:33 | <mib_v7b5e2> | where . would get the `function` function from the appropriate module depending on the type of myRecord |
| 00:42:53 | <mib_v7b5e2> | spare me! i tried to find a way to do OO in haskell! |
| 00:43:05 | <mauke> | we already have that, see OOHaskell |
| 00:43:16 | <Baughn_> | mib_v7b5e2: Specifically, apparently, you tried to do the most annoying parts of OO in haskell? |
| 00:43:36 | <Baughn_> | mib_v7b5e2: We've got existentials and typeclasses, for all the /useful/ stuff |
| 00:43:44 | <Gracenotes> | hydo: well, granted, they only got one wrong |
| 00:43:51 | <Gracenotes> | and PHP is just... WTF-typed |
| 00:44:13 | <hydo> | Gracenotes: The most important one, imo. |
| 00:44:19 | <mib_v7b5e2> | Baughn_: yea, i tried to call a different function on a record with the same name |
| 00:44:27 | <mauke> | ACTION writes all his functions as Dynamic -> Dynamic |
| 00:44:36 | <vixey> | lol |
| 00:44:52 | <Gracenotes> | ($) :: Dynamic -> Dynamic -> Dynamic |
| 00:45:01 | <Gracenotes> | mm... *raises eyebrows* |
| 00:46:05 | <EvilTerran> | surely ($) :: Dynamic |
| 00:46:05 | <EvilTerran> | :P |
| 00:46:09 | <mib_v7b5e2> | i love haskell |
| 00:46:21 | <mib_v7b5e2> | but BONUS needs to get on the monad business though |
| 00:46:32 | <mib_v7b5e2> | because i feel like as soon as he posts it, i will understand monads a lot better |
| 00:46:38 | <mauke> | newtype What = What (What -> What) |
| 00:46:47 | <Gracenotes> | so long as he has copious examples |
| 00:46:51 | <hatds> | who is BONUS? |
| 00:46:54 | <dolio> | He doesn't have monads in there yet? |
| 00:46:59 | <vixey> | type ModelOfLambdaCalculus = What |
| 00:47:01 | <Gracenotes> | se dice a month |
| 00:47:18 | <mgsloan> | hatds: he wrote the learn you a haskell for great good guide |
| 00:47:28 | <mauke> | preflex: seen BONUS |
| 00:47:29 | <preflex> | BONUS was last seen on #haskell 6 hours and 19 minutes ago, saying: haha awesome |
| 00:47:54 | <Baughn_> | mib_v7b5e2: I feel like a broken record, but have you tried reading the typeclassopedia? |
| 00:47:58 | <hatds> | mauke, vixey: man :) if someone had explained this clearly back then I might have understood lambda calculus on the first or second pass |
| 00:48:00 | <Baughn_> | mib_v7b5e2: It covers monads in some detail |
| 00:48:11 | <mib_v7b5e2> | Baughn_: don't feel bad about repeating something |
| 00:48:12 | <gavino> | happstack wont scale yet damn it |
| 00:48:20 | <mib_v7b5e2> | worse come to worse, someone will learn something |
| 00:48:28 | <Gracenotes> | hm... I thought Wolfram|Alpha was supposed to open 48 minutes ago >_> |
| 00:48:36 | <Baughn_> | mib_v7b5e2: See, that prospect scares me. |
| 00:48:41 | <Gracenotes> | scaling problems, who'd've thought, though? |
| 00:48:59 | <mib_v7b5e2> | Gracenotes: what does wolfram *do*? |
| 00:49:02 | <inimino> | Gracenotes: anthropic principle, no doubt |
| 00:49:08 | <Gracenotes> | magic |
| 00:49:12 | <Baughn_> | Math |
| 00:49:30 | <Baughn_> | Or in this case, a search engine they claim can beat google |
| 00:49:31 | <Baughn_> | We'll see. |
| 00:49:32 | <hatds> | data Magic = Magic | MoreMagic |
| 00:50:00 | <inimino> | I predict that what it will do is: fail to live up to the hype |
| 00:50:03 | <Baughn_> | makeMagic = unsafePerformIO flipSwitch `seq` Magic |
| 00:50:14 | <Gracenotes> | > unsafeCoerce Magic :: Maybe Int |
| 00:50:15 | <vixey> | it's not IO :( |
| 00:50:15 | <lambdabot> | Not in scope: `unsafeCoerce'Not in scope: data constructor `Magic' |
| 00:50:16 | <Gracenotes> | Nothing |
| 00:50:18 | <mib_v7b5e2> | Baughn_: what would it have to do to beat google? |
| 00:50:22 | <guinea> | Maybe Magic |
| 00:50:28 | <Baughn_> | mib_v7b5e2: Magic. :P |
| 00:50:32 | <Gracenotes> | it's true... it will coerce to that |
| 00:50:34 | <guinea> | Just Magic |
| 00:50:36 | <vixey> | makeMagic = unsafeCoerce unsafeCoerce MoreMagic |
| 00:50:58 | <Gracenotes> | nullary constructors in the first position coerce to eachother, generally |
| 00:51:00 | <Baughn_> | mib_v7b5e2: What they're /claiming/ it does is basically high-level narrow AI, but google has been doing the exact same thing for a decade. Wolfram has some good people. Google has more. |
| 00:51:17 | <mib_v7b5e2> | Baughn_: it looks like it's up to me... |
| 00:51:23 | <mauke> | http://dis.4chan.org/read/prog/1241993414 |
| 00:51:29 | <vixey> | Baughn you're so !! I don't know the word for it but sooo much!! |
| 00:51:33 | <mib_v7b5e2> | Baughn_: testicle! it's not |
| 00:55:40 | <hatds> | I feel kind of bad for everyone who wants to compete with google... I imagine no one can express that they want to compete with google without the people assuming they are cocky |
| 00:56:11 | <hatds> | (it sure got quiet here?) |
| 00:56:21 | <mib_v7b5e2> | hatds: i hear what you're saying |
| 00:56:35 | <mib_v7b5e2> | it's like that onion article "ugly guy has huge penis but unsure of how to get the word out" |
| 00:59:08 | <hatds> | er no |
| 00:59:23 | <mib_v7b5e2> | stfu it is too |
| 00:59:39 | <hatds> | it's like saying "I want be the best person Haskell programmer there ever was" and then getting the reply "you won't live up to the hype" |
| 00:59:49 | <guinea> | I was trying to understand the thing on 4chan |
| 00:59:59 | <Baughn_> | It's 4chan |
| 01:00:01 | <guinea> | loeb = fix (fmap . flip id =<<) |
| 01:00:03 | <hatds> | that's where you went wrong :) |
| 01:00:07 | <Gracenotes> | I want to be... the very best... like no one ever was |
| 01:00:16 | <vixey> | http://www.wolframalpha.com/input/?i=monad&asynchronous=false&equal=Submit |
| 01:00:23 | <Gracenotes> | to curry them is my real quest... to pointfree is my cause |
| 01:00:24 | <guinea> | I'm a noob but how do you flip id? |
| 01:00:33 | <vixey> | Assuming "monad" is a protein -- lol |
| 01:00:40 | <Gracenotes> | I will travel across the land, using monads far and wide |
| 01:00:42 | <vixey> | guinea: 'how' ? |
| 01:00:51 | <guinea> | never |
| 01:00:52 | <Gracenotes> | Haskell to understand the power that's inside.... *chorus, etc.* |
| 01:00:56 | <guinea> | never mind |
| 01:00:59 | <zoheb> | I want to write a function getIntFromConfigFile ::IO(Int) that reads a config file once and caches the integer, and then returns this integer for all subsequent calls, Is this possible? |
| 01:01:12 | <flippo> | So when are we going to graduate from monads to abelian groups? |
| 01:01:15 | <Baughn_> | The wolfram alpha video is rather impressive, but I'll be shocked if it actually works on the things I usually want to know about. :P |
| 01:01:35 | <skorpan> | Baughn_: "what is fmap (flip . id =<<)" |
| 01:01:36 | <mauke> | guinea: you can write flip ($) instead if that makes more sense to you |
| 01:01:38 | <Gracenotes> | well. global IORefs have been suggested for that kind of thing, but... sort of suspect |
| 01:01:39 | <Baughn_> | flippo: If you want to use abelian groups, you can make a typeclass to do just that. Is the abstraction useful? |
| 01:01:48 | <mib_v7b5e2> | Baughn_: i haven't seen the video yet. what make it so impressive? |
| 01:01:58 | <Baughn_> | mib_v7b5e2: I suggest you watch the video. |
| 01:02:05 | <flippo> | Baughn_, of course not. But that shouldn't stop us from designing it. |
| 01:02:20 | <BMeph> | skorpan: Hint - (id =<<) is join. :) |
| 01:02:30 | <Baughn_> | skorpan: Possibly. Now that really /would/ be impressive. ^_^ |
| 01:02:37 | <skorpan> | aha, so it's really "fmap (flip join)" |
| 01:02:39 | <zoheb> | Gracenotes, does this involve unSafeperformIO ? |
| 01:02:42 | <skorpan> | @src join |
| 01:02:42 | <lambdabot> | join x = x >>= id |
| 01:02:44 | <dolio> | mauke: #7 is pretty good. |
| 01:02:58 | <skorpan> | no it's fmap (flip . join) |
| 01:03:08 | <skorpan> | which is fmap (flip . (x >>= id)) |
| 01:03:13 | <Gracenotes> | zoheb: yes :\ global variables have been a sort of problem. However, you can pass around an IORef everywhere instead, if you want. |
| 01:03:43 | <Japsu> | here's an fmap, there's an fmap, and another little fmap, funny fmap, fuzzy fmap, fmap fmap ap. |
| 01:03:52 | <skorpan> | fmap (flip . (\x -> x >>= id)) |
| 01:03:53 | <mib_v7b5e2> | ok cool cats and kittens |
| 01:04:08 | <mib_v7b5e2> | i'll catch you all later, under my other nick seydar |
| 01:04:14 | <mib_v7b5e2> | PEACE |
| 01:04:14 | <skorpan> | i don't get it |
| 01:04:15 | <mib_v7b5e2> | WAR |
| 01:04:21 | <Baughn_> | skorpan: The thing is, this screencast.. if it isn't all hardcoded, the AI to generate it all would have to be scarily close to human level. Which is one reason I expect it is, and so will be very limited in scope. |
| 01:04:50 | <Gracenotes> | zoheb: if you can carry it around, this would be good; or simply get it in the first place and use that |
| 01:04:51 | <skorpan> | Baughn_: but as i understood it, it's not really AI, just some weird way of structuring data? |
| 01:05:12 | <Gracenotes> | ACTION wonders if there's good caching support anywhere |
| 01:05:20 | <Baughn_> | skorpan: Anytime someone makes something actually /work/, they stop calling it AI. This would certainly have fallen under the heading a decade ago. |
| 01:05:27 | <guinea> | mauke: my brain is tired, I had to fire up ghci and do some ":t" to get it |
| 01:05:44 | <mauke> | ($) :: (a -> b) -> (a -> b); ($) = id |
| 01:05:54 | <Baughn_> | skorpan: But I'm thinking mostly of the backend that's supposed to extract this sort of data from random websites |
| 01:06:11 | <skorpan> | oh |
| 01:06:15 | <guinea> | Isn't Alpha supposed to be more "curated" than google? |
| 01:06:21 | <skorpan> | i never got to watch the screencast, justin.tv complained about my adblocker or something |
| 01:06:27 | <zoheb> | So basically I writeIORef very early in the program and carry it around? |
| 01:06:36 | <Baughn_> | guinea: "Shepherded" might be more accurate |
| 01:06:46 | <vixey> | Alpha isn't a search engine |
| 01:07:02 | <Gracenotes> | zoheb: ..or simply get the value early on and carry the value around |
| 01:07:02 | <dolio> | It computes answers! |
| 01:07:30 | <guinea> | more shepardized? |
| 01:07:33 | <Gracenotes> | zoheb: it does sound like a configuration variable of sorts, after all |
| 01:07:33 | <Baughn_> | vixey: It's supposed to give you the approximate information you'd get from doing a web search and then integrating the information in your head. More convenient, but it's still the same process |
| 01:08:01 | <zoheb> | let me just try it out |
| 01:08:02 | <vixey> | :( |
| 01:08:03 | <Baughn_> | Hum. It's good at math, though. Not unexpected. |
| 01:08:11 | <Gracenotes> | IORef might be excessive for just a write-once variable... dunno. |
| 01:08:12 | <vixey> | It doesn't know what a monad is!!! |
| 01:08:21 | <Baughn_> | Oh, it's online now? |
| 01:08:26 | <vixey> | http://www.wolframalpha.com/input/?i=cube+vs.+dodecahedron+vs.+tetrahedron |
| 01:08:33 | <zoheb> | Is there any other option? |
| 01:09:07 | <roconnor> | I vote for tetrahedron |
| 01:09:10 | <Baughn_> | Seems a bit overloaded. ^^; |
| 01:09:16 | <zoheb> | apart from IORef, for this problem? |
| 01:09:43 | <zoheb> | apart from carrying it around |
| 01:09:55 | <hatds> | zoheb: the solution is to come to terms with reality that there is no global value which is not pure |
| 01:10:39 | <zoheb> | I not attempting to write a pure function but an IO(Int) |
| 01:10:44 | <zoheb> | efficiently |
| 01:11:11 | <roconnor> | does implicit arguments solve this problem? |
| 01:11:15 | <Baughn_> | vixey: ..I give. WA is useful. |
| 01:11:17 | <hatds> | passing it to a function that needs it isn't ineffecient |
| 01:11:22 | <Baughn_> | For science, at least. |
| 01:11:22 | <zoheb> | Let me post some sample code using IORef and see if it makes sense |
| 01:11:30 | <vixey> | oh?? how com |
| 01:11:32 | <vixey> | how come |
| 01:11:46 | <vixey> | I'm trying to get it to teach me partial integration |
| 01:11:57 | <hatds> | global mutable variables make sense, you just don't have them in haskell |
| 01:12:00 | <vixey> | is that even a thing? |
| 01:12:31 | <Baughn_> | So I asked it about the location of mars, and it gave me a map of the sky from my current location. :D |
| 01:12:41 | <BMeph> | Wow, it *is* better than Google! Instead of giving me irrelevant stuff, it just says, "Wolfram|Alpha isn't sure what to do with your input." Brilliant! ;p |
| 01:12:45 | <Gracenotes> | again, if it's configuration, accessing it at the very beginning might be best/// |
| 01:13:00 | <inimino> | Baughn_: did the map have an arrow in it pointing at Mars? |
| 01:13:48 | <Twey> | 02:00:59 < zoheb> I want to write a function getIntFromConfigFile ::IO(Int) that reads a config file once and caches the integer, and then returns this integer for all subsequent calls, Is this possible? |
| 01:13:59 | <Baughn_> | inimino: Ah, no. |
| 01:13:59 | <Twey> | zoheb: Possible, yes; advisable, no |
| 01:14:10 | <Twey> | Rethink your design |
| 01:14:17 | <Baughn_> | inimino: I got "computation timed out", though. It's a bit broken right now. |
| 01:14:27 | <glguy> | no globals? |
| 01:14:29 | <inimino> | Baughn_: ah, too bad |
| 01:14:32 | <glguy> | :t getStdGen |
| 01:14:33 | <lambdabot> | IO StdGen |
| 01:14:35 | <zoheb> | Twey, I guess it is possible if I use an IORef |
| 01:14:38 | <glguy> | :t setStdGen |
| 01:14:40 | <lambdabot> | StdGen -> IO () |
| 01:14:42 | <Twey> | zoheb: Yes |
| 01:14:44 | <mgsloan> | is wolfram alpha public yet? |
| 01:14:51 | <Twey> | But there are a lot of alternative approaches to this problem |
| 01:14:56 | <zoheb> | Why is it not advisable? |
| 01:15:00 | <Twey> | Most of which are better |
| 01:15:12 | <Twey> | Because it requires every bit of code that uses that value to be impure |
| 01:15:18 | <Twey> | Even though the value is essentially pure |
| 01:15:40 | <roconnor> | Twey: would implicit arguments be useful here? |
| 01:15:54 | <Twey> | As someone suggested, the simplest way is just to pick it up initially and pass it around as a pure value |
| 01:15:55 | <zoheb> | ok, this was only a theoretical question BTW |
| 01:16:05 | <Twey> | You could use a Reader monad to make that nicer, if you wanted |
| 01:16:13 | <Twey> | roconnor: Not really |
| 01:16:18 | <roconnor> | ok |
| 01:16:21 | <Gracenotes> | or ReaderT, perhaps. |
| 01:16:25 | <Twey> | It's only one argument; I don't see the problem with passing it around explicitly |
| 01:16:28 | <glguy> | implicit params are the reader monad without all of the monadishness |
| 01:16:34 | <zoheb> | But I might want to extend the functionality |
| 01:16:44 | <Twey> | zoheb: To do what? |
| 01:16:44 | <guinea> | Twey: even though every bit of code that uses it is impure, you can make that impure code by composing pure code? |
| 01:16:56 | <Twey> | guinea: Yes |
| 01:16:59 | <roconnor> | glguy: that's why I thought it would be good here. |
| 01:17:05 | <glguy> | sure |
| 01:17:06 | <Twey> | Well |
| 01:17:13 | <zoheb> | Like the function might check timestamps of the config file each time, and reload the value if required |
| 01:17:14 | <Twey> | Apart from the actually impure bit where it gets the value, of course |
| 01:17:15 | <guinea> | Twey: so the impure bit can be only a few lines, packaging up the pure code |
| 01:17:19 | <glguy> | implicit params are kind of out of favor now |
| 01:17:31 | <zoheb> | In this case it isn't really pure |
| 01:17:35 | <Twey> | guinea: A few lines *per function* |
| 01:17:50 | <Twey> | zoheb: Hmm |
| 01:18:07 | <zoheb> | what I am trying to do is a kind of memo-ization optimization without exposing the innards of the optimization to the caller |
| 01:18:12 | <hellige> | anyone here know yampa? |
| 01:18:14 | <guinea> | Twey: per function that interacts with refs or IO |
| 01:18:14 | <Twey> | I think in that case you would make it impure |
| 01:18:33 | <Twey> | guinea: Which zoheb is proposing be all of them, yes |
| 01:18:51 | <guinea> | oh |
| 01:18:53 | <Twey> | zoheb: Do you see the difference? |
| 01:19:10 | <zoheb> | basically a memoizing optimization which somehow requires the fnction to "remember" what it did last time |
| 01:19:11 | <Twey> | zoheb: In the one case you're only reading it once, and everything from that point on is pure |
| 01:19:27 | <Twey> | zoheb: In the other, you're reading or checking the file anew each time |
| 01:19:39 | <zoheb> | yes, i realise that |
| 01:19:40 | <Twey> | So all accesses must be impure |
| 01:19:50 | <Twey> | It's a fundamental difference, and it's reflected in the types for a reason |
| 01:20:00 | <zoheb> | The basic thing I am trying to do is impure |
| 01:20:26 | <Twey> | Personally I would let the user decide when they wanted to recheck it |
| 01:20:44 | <vixey> | zoheb: I can show you how to memoize a simple function in a pure way |
| 01:20:58 | <zoheb> | Yes vixey! |
| 01:20:59 | <glguy> | don't forget memotrie |
| 01:21:04 | <vixey> | ok lets use this example: |
| 01:21:15 | <vixey> | fib 0 = 0 ; fib 1 = 1 ; fib n = fib (n-1) + fib (n-2) |
| 01:21:26 | <vixey> | so to memoize we should make a list of all the values |
| 01:21:30 | <zoheb> | make it a list |
| 01:21:31 | <vixey> | fibs = map fib [0..] |
| 01:21:33 | <vixey> | yeah |
| 01:21:35 | <vixey> | and then define |
| 01:21:40 | <vixey> | fib' i = fibs !! i |
| 01:21:50 | <vixey> | so then we have to make teh recursive calls use that lookup |
| 01:21:59 | <vixey> | fib 0 = 0 ; fib 1 = 1 ; fib n = fib' (n-1) + fib' (n-2) |
| 01:22:01 | <vixey> | and that's it |
| 01:22:18 | <zoheb> | hmmm |
| 01:22:34 | <zoheb> | thats good |
| 01:22:59 | <koninkje> | Of course, the fibs example highlights a big divide between dynamic programming (memoizing through recursion) vs general memoizing (between unrelated calls) |
| 01:23:18 | <vixey> | lets look at performance |
| 01:23:20 | <vixey> | > let fib 0 = 0 ; fib 1 = 1 ; fib n = fib (n-1) + fib (n-2) in fib 100 |
| 01:23:26 | <vixey> | that's fib of 100 not memoized |
| 01:23:35 | <lambdabot> | thread killed |
| 01:23:37 | <vixey> | it couldn't do it... |
| 01:23:38 | <vixey> | > let fibs = map fib [0..] ; fib' i = fibs !! i ; fib 0 = 0 ; fib 1 = 1 ; fib n = fib' (n-1) + fib' (n-2) in fib 100 |
| 01:23:40 | <lambdabot> | 354224848179261915075 |
| 01:23:46 | <vixey> | but the memoized version worked really quickly.. :) |
| 01:23:53 | <vixey> | so it does do something |
| 01:24:41 | <koninkje> | even better for fibs is to only keep a sliding window of he last two values, instead of the whole list ;) |
| 01:24:55 | <koninkje> | zoheb: you may want to take a look at http://hackage.haskell.org/cgi-bin/hackage-scripts/package/data-memocombinators |
| 01:24:56 | <vixey> | sure but that's kind of completely irrelevant |
| 01:25:22 | <vixey> | yeah that memo combinator stuff uses unsafePerformIO/impure functions |
| 01:25:25 | <koninkje> | vixey: no, it isn't. Again, the difference between dynamic programming and general memoization |
| 01:25:29 | <vixey> | not sure why that would be worth using |
| 01:25:41 | <vixey> | Do you know about containers koninkje?? |
| 01:25:45 | <koninkje> | they pretty up the open-recursion version |
| 01:26:02 | <koninkje> | vixey: "containers" meaning? |
| 01:26:10 | <vixey> | I take that as no |
| 01:26:29 | <koninkje> | zoheb: also worth looking at http://www.cs.utexas.edu/~wcook/Drafts/2006/MemoMixins.pdf |
| 01:26:40 | <dons> | i even don't know which containers you're referring to, vixey |
| 01:26:53 | <koninkje> | "containers" can mean a great manyu things, I don't know which one you mean |
| 01:30:06 | <edwardk> | ACTION waves hello. |
| 01:30:15 | <vixey> | hi |
| 01:30:18 | <koninkje> | ACTION waves back |
| 01:31:24 | <edwardk> | koninkje: heh, your endorsement of Haskell for computational linguistics has my wife picking up Real World Haskell and reading learn you a Haskell. ;) Even if she kicks me out of the room whenever she starts reading them ;) |
| 01:31:51 | <koninkje> | heh heh |
| 01:32:19 | <koninkje> | edwardk: well, I did tell her she didn't need to know any of That Stuff(tm) that you go on about ;) |
| 01:32:27 | <edwardk> | haha |
| 01:32:28 | <edwardk> | yeah |
| 01:32:56 | <edwardk> | I realize I'm probably the worst advocate to have for getting people into Haskell ;) |
| 01:33:44 | <koninkje> | Well I've found your blog a fascinating read at least (though I suppose I *was* already hooked on CT and Haskell) |
| 01:33:57 | <edwardk> | She was somewhat relieved to know that this community thinks I'm as strange as the outside world does though ;) |
| 01:34:08 | <koninkje> | ACTION lol |
| 01:35:12 | <edwardk> | the funny thing was i picked up haskell for a very practical purpose, it just never materialized because by the time i learned haskell i realized that what i had wanted to do wasn't very interesting =) |
| 01:35:51 | <roconnor> | edwardk: I'm a big fan of your CPS package. |
| 01:35:57 | <roconnor> | ... even though I've never used it. |
| 01:36:00 | <Asztal> | I never fail to read cofree as coffee... it makes looking at category-extras interesting |
| 01:36:01 | <edwardk> | roconnor: hah |
| 01:36:10 | <edwardk> | i need some benchmarks to try it out with |
| 01:36:28 | <roconnor> | you should run in on my Endo code. |
| 01:36:36 | <edwardk> | roconnor: ? |
| 01:36:48 | <edwardk> | as in icfp 07? |
| 01:36:50 | <koninkje> | ACTION wonders which free/forgetful functors generate the coffee monad |
| 01:36:58 | <roconnor> | edwardk: yes |
| 01:37:15 | <dolio> | My benchmarks suggest a manually CPSed ST is significantly faster than the standard implementation. |
| 01:37:18 | <edwardk> | coffee isn't free, it usually costs at least 25 cents, or way more if you use the Starbucks comonad. |
| 01:37:21 | <dolio> | Despite doing way more allocation. |
| 01:37:21 | <roconnor> | enjoys a cup of hot cocomonad. |
| 01:37:31 | <roconnor> | /me |
| 01:38:06 | <edwardk> | dolio: yeah, i worry a bit about how much more i'm allocating |
| 01:38:07 | <roconnor> | edwardk: well, in the end GHC will probably change to render your library useless. |
| 01:38:14 | <hellige> | one more try... anybody here know yampa or reactive? |
| 01:38:16 | <edwardk> | roconnor: good =) |
| 01:38:44 | <edwardk> | hellige: i know a lot about reactive's internals, but little about its practical usage |
| 01:39:09 | <hellige> | hmm, still might help |
| 01:39:11 | <roconnor> | edwardk: hmm, actually maybe you could add a module with a bunch of GHC rewrite rules. |
| 01:39:26 | <roconnor> | edwardk: then simply importing your module would make all my code faster. |
| 01:39:46 | <edwardk> | roconnor: where is your endo code? =) |
| 01:40:06 | <roconnor> | edwardk: good question |
| 01:40:10 | <hellige> | edwardk: i've been trying to use yampa, but i'm a bit stuck. not sure if it's a yampa limitation, or my limitation... |
| 01:40:34 | <roconnor> | darcs get http://r6.ca/icfp2007 |
| 01:40:41 | <roconnor> | that should retrieve something |
| 01:40:43 | <hellige> | edwardk: seems like yampa is tied rather strictly to an output sampling model.. |
| 01:40:46 | <roconnor> | no idea what though. |
| 01:41:07 | <hellige> | but what i really want is just to produce a complete list of all the (discrete) output events. |
| 01:41:21 | <edwardk> | i was playing with a little GADT to do the 'CCNF' optimization to 'causal normal form' for arrows that found its way into some paper the other day and realized i wanted to do the same cps transformation to make their normal form a little faster, but that i wasn't sure if it would really be a win. |
| 01:41:23 | <hellige> | i'm using a few continuous signals internally, but the input and output are both discrete time-series. |
| 01:41:53 | <edwardk> | hellige: yampa is kind of obnoxious to use, maybe its just the arrow syntax, but the model feels really restrictive |
| 01:41:56 | <centrinia> | > let matmul xs ys = [[sum $ zipWith (*) x y | y <- transpose ys] | x <- xs]; matexp 0 x = [ [ if i == j then 1 else 0 | j <- [1..length (head x)]] | i <- [1..length x]]; matexp n x | n `mod` 2 == 0 = matexp (n `div` 2) (matmul x x) | n `mod` 2 == 1 = matmul x (matexp (n `div` 2) (matmul x x)) in map (\x -> head . tail . head $ matexp x [[1,1],[1,0]] ) [0..] |
| 01:41:58 | <lambdabot> | [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946... |
| 01:42:25 | <roconnor> | edwardk: the codensity monad transform (although I didn't know it by that name) speed my code up by a factor of 4. |
| 01:42:25 | <hellige> | i haven't really looked at reactive yet. i've found yampa pleasant enough so far, but the interface to actually RUN the thing is really frustrating. |
| 01:42:27 | <edwardk> | hellige: hrmm, ok |
| 01:42:30 | <coCocoa> | ACTION is looking for some comarshmallows |
| 01:42:42 | <hellige> | i just want to say "here's a bunch of lists of events, pump them through and give me the results." |
| 01:42:50 | <edwardk> | roconnor: over what monad? |
| 01:43:02 | <roconnor> | edwardk: http://r6.ca/blog/20071028T162529Z.html |
| 01:43:06 | <edwardk> | hellige: have you looked at reactive much? |
| 01:43:13 | <roconnor> | edwardk: StateT DNA (MaybeT (Writer (Endo [RNA]))) |
| 01:43:25 | <hellige> | read some of conal's posts, but not too closely, no. |
| 01:43:26 | <roconnor> | but I didn't use the mtl |
| 01:43:32 | <roconnor> | because back then things didn't inline. |
| 01:43:41 | <roconnor> | maybe they still don't. |
| 01:44:11 | <edwardk> | hellige: look at the package for reactive, iirc it works via a little event pump that should do just what you want unless i misunderstand you |
| 01:44:16 | <roconnor> | Endo [RNA] is really DList RNA |
| 01:44:29 | <hellige> | edwardk: ok, it's next on my list anyway, i'll give it a look. |
| 01:44:36 | <hellige> | right after star trek, that is... |
| 01:44:37 | <edwardk> | roconnor: hrmm. yeah thats a straightforward codensity already |
| 01:44:40 | <hellige> | thanks for your help! |
| 01:45:15 | <roconnor> | edwardk: your code would do something smarter with the maybeT bit. |
| 01:45:16 | <edwardk> | poking at it to see if i can come up with a better split |
| 01:45:53 | <roconnor> | edwardk: are you looking at my blog or my code? |
| 01:45:59 | <edwardk> | blog |
| 01:46:07 | <edwardk> | just trying to see what it'd look like |
| 01:48:48 | <edwardk> | something like: forall o. (a -> DNA -> [RNA] -> o) -> DNA -> [RNA] -> o -> o |
| 01:49:25 | <edwardk> | would be the result of running Ran over StateT DNA (MaybeT (Writer [RNA])) -- instead of Codensity |
| 01:49:39 | <roconnor> | :) |
| 01:50:15 | <roconnor> | I suppose I could plug that in myself. |
| 01:50:21 | <edwardk> | now, hand tuning that you might find its worth refactoring that slightly to get it into 'near-codensity' form |
| 01:50:35 | <roconnor> | huh? |
| 01:50:37 | <Gracenotes> | edwardk: where does the a come from? |
| 01:50:47 | <edwardk> | forall o. (a -> DNA -> [RNA] -> o) -> o -> DNA -> [RNA] -> o |
| 01:50:56 | <roconnor> | Gracenotes: monad type variable |
| 01:51:07 | <roconnor> | parameter |
| 01:51:16 | <edwardk> | Gracenotes: thats the cps'd writer-as-state, cps'd state and the maybe as yoneda endo |
| 01:51:37 | <edwardk> | the 'a' is the contents of your monad |
| 01:51:39 | <Gracenotes> | yes.... I at least get the o, though... |
| 01:52:00 | <Gracenotes> | ... right |
| 01:52:33 | <edwardk> | newtype DNAMonad a = DNAMonad (forall o. (a -> DNA -> [RNA] -> o) -> o -> DNA -> [RNA] -> o -- would be the form i'd probably put it in |
| 01:54:56 | <edwardk> | i would love to hear how much faster or worse that made the code |
| 01:55:32 | <roconnor> | too bad I'm editing my thesis |
| 01:55:40 | <edwardk> | hah |
| 01:55:44 | <edwardk> | is the code linked there? |
| 01:55:58 | <roconnor> | darcs get http://r6.ca/icfp2007 |
| 01:56:08 | <roconnor> | I don't know what version that gets |
| 01:56:22 | <roconnor> | If you want to look at it, I'll help direct you around it. |
| 01:56:48 | <edwardk> | i'll see what it pulls |
| 01:56:53 | <roconnor> | I experimented with many different string representations, so it could be a mess |
| 01:56:53 | <edwardk> | any instructions on how to use it? |
| 01:57:08 | <roconnor> | I'll pull it too and see |
| 01:57:16 | <edwardk> | i just want to seek and destroy your monad ;) |
| 01:57:32 | <dons> | anyone want to have a go, http://www.reddit.com/r/programming/comments/8ks2g/type_system_faceoff_what_type_system_will_give_me/ |
| 01:57:39 | <dons> | seems like a haskell soln. waiting |
| 01:58:43 | <roconnor> | edwardk: let's start by making DNAexec.hs |
| 01:59:08 | <edwardk> | i don't see the cps'd monads in here |
| 01:59:27 | <edwardk> | Could not find module `MaybeT': |
| 01:59:56 | <roconnor> | hmm |
| 02:02:12 | <roconnor> | ah |
| 02:02:18 | <roconnor> | found my cont branch |
| 02:02:31 | <Gracenotes> | hm... just tried Wolfram|Alpha. It could do "jaws" (the movie), "x^2", and "sin {1,2,3,4}". Couldn't handle "newton fractal", "minimum of {0,1}", "meet of {0,1}", "turing machine", or "haskell programming language" |
| 02:02:43 | <Gracenotes> | hm... seems to be down now |
| 02:02:50 | <SubStack> | wolfram alpha is out? |
| 02:02:56 | <Gracenotes> | no, wait, still seems to work: |
| 02:02:58 | <Gracenotes> | http://www.wolframalpha.com/input/ |
| 02:04:06 | <SubStack> | :o |
| 02:04:10 | <SubStack> | Gracenotes++ |
| 02:04:40 | <edwardk> | bah it thinks a monad is protein WDR92 ;) |
| 02:04:54 | <Gracenotes> | see also http://www.wolframalpha.com/examples/ |
| 02:05:22 | <Gracenotes> | what it can do at this point. Seems the database isn't huge, but it's pretty neat :) |
| 02:05:25 | <roconnor> | okay, how to send this to you. |
| 02:05:56 | <edwardk> | It's good to know that a monad weighs 39.609 kilodaltons though. |
| 02:07:16 | <Gracenotes> | no lambda calculus interpreter yet! |
| 02:07:37 | <Gracenotes> | more cellular automaton support, really. Which is still Turing complete, of course |
| 02:08:25 | <hatds> | so alpha is not a general search engine? |
| 02:09:05 | <hatds> | y/n/m? |
| 02:09:16 | <Gracenotes> | no... sort of many different computational engines rolled into one. The key function is taking natural language input and deciding what engines to feed it to |
| 02:09:41 | <edwardk> | hatds: if you think of it as a little search engine for chemicals, proteins, and providing comparative analysis of a rather scattershot set of 'curated' data its probably better |
| 02:09:48 | <edwardk> | it'll know next to nothing about pop culture, etc. |
| 02:10:25 | <hatds> | edwardk: that's basically what I was wondering |
| 02:10:31 | <hatds> | boring |
| 02:10:31 | <Gracenotes> | hmm. sort of on-and-off. |
| 02:10:59 | <hatds> | actual information is not what I want from a search engine oddly :) |
| 02:11:06 | <edwardk> | on the other hand if you ask it things like http://www.wolframalpha.com/input/?i=1+billion+years+after+the+big+bang -- it'll come back with a nice summary of the expansion of the universe |
| 02:11:36 | <edwardk> | hatds: wolfram alpha is more like an idiot-savant expert system than a search engine |
| 02:11:41 | <Gracenotes> | it just gave me "Error: DataPacletFilter: Unable to get Connection Cannot create PoolableConnectionFactory (Too many connections)" |
| 02:11:52 | <Gracenotes> | factory, huh? >_> <_< |
| 02:11:52 | <hatds> | edwardk: yea |
| 02:12:13 | <roconnor> | edwardk: try pulling again. I suggest nuking your previous pull to be safe. |
| 02:12:21 | <edwardk> | kk |
| 02:12:39 | <cjs> | Aren't expert systems all idiots savant? At least, those that aren't just idiots? |
| 02:13:05 | <cjs> | Anyway, this is really bugging me now: how does one pronounce the OCaml code "'a list"? |
| 02:13:08 | <hatds> | Simon Peyton Jones no interesting results :( |
| 02:13:28 | <hatds> | nothing for haskell either.. screw alpha! |
| 02:13:59 | <sjanssen> | cjs: that's the same as [a] in Haskell, so I'd say "list of a" |
| 02:14:21 | <edwardk> | ok, well, its got a bit more randomness to the kinds of queries it'll answer nicely. i'm sure it can basically answer all of the queries that wolfram thought to type into it personally, but then wolfram doesn't exactly strike me as a typical search engine user, so the choice of specialties might be a little... odd. |
| 02:14:40 | <travisbrady> | how would I create an Int-like type that can only exist within some range, say, 0 to 10, this is my broken attempt: http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2435#a2435 |
| 02:15:12 | <Gracenotes> | Bounded provides information... it doesn't really enforce anything |
| 02:15:15 | <roconnor> | data Int10 = Zero | One | Two | Three | Four | Five | Six | Seven | Eight | Nin |
| 02:15:21 | <Gracenotes> | what you perhaps want is a hidden constructor |
| 02:15:21 | <hatds> | a literal '11' gets desugared into fromInteger 11 |
| 02:15:50 | <hatds> | (and fromInteger has type :: Num a => Integer -> a, so you can't make this fail to typecheck) |
| 02:15:50 | <Gracenotes> | otherwise, not much can be done at compile-time without dependent types |
| 02:16:15 | <cjs> | Ah, I don't use the "of" when speaking Haskell. E.g., "Lazy (List a)" is just "lazy list-eh?" But I'm curious as to what the OCaml guys use in common speech. "'a lazy_t" feels awkward to read backwards.... |
| 02:16:23 | <edwardk> | roconnor: still no MaybeT |
| 02:16:27 | <Gracenotes> | hm. you could define a Num instance has all modulo 10s |
| 02:16:37 | <roconnor> | oh, does it still want MaybeT? |
| 02:17:01 | <edwardk> | yeah for DNAMonad |
| 02:17:07 | <Cale> | Hmm, Wolfram Alpha seems annoying. Most of the time, it ignores my input and takes me back to the top level of the site. |
| 02:17:11 | <travisbrady> | ACTION googles "hidden constructor" |
| 02:17:23 | <koninkje> | cjs: from the OCaml folks I know, they just read it in order, e.g 'a list ==> "alpha list" |
| 02:17:28 | <roconnor> | edwardk ah opp |
| 02:17:35 | <roconnor> | I didn't upload to my webserver |
| 02:17:36 | <roconnor> | heh |
| 02:17:47 | <roconnor> | plz delete again, and give me one sec |
| 02:17:50 | <edwardk> | kk |
| 02:17:56 | <cjs> | Ah, "alpha!" Duh. Ok, thanks. |
| 02:18:13 | <roconnor> | okay it should be better now |
| 02:18:46 | <Gracenotes> | hm.. impressive. http://www.wolframalpha.com/input/?i=E+augmented+major+seventh |
| 02:19:37 | <Cale> | heh... http://www.wolframalpha.com/input/?i=1%2F2+mass+of+earth+(velocity+of+earth)^2+in+joules -- yes, that's what I meant. |
| 02:19:38 | <Gracenotes> | doesn't like "F neapolitan sixth chord" though |
| 02:19:41 | <Cale> | ;) |
| 02:19:43 | <roconnor> | ACTION tries to convince himself that his category is not enriched. |
| 02:20:14 | <edwardk> | checking again |
| 02:20:51 | <edwardk> | better |
| 02:21:07 | <edwardk> | newtype DNAMonad a = DNAMonad { unDNA :: ∀r. (Cont (DNA → ([RNA], DNAState r)) a)} -- looks right to me now |
| 02:21:36 | <roconnor> | it should almost build |
| 02:21:47 | <edwardk> | fixed reference to forever |
| 02:21:50 | <edwardk> | then it builds |
| 02:21:50 | <roconnor> | you probably need to remove my definition of forever |
| 02:21:59 | <Gracenotes> | doesn't seem to like "E major phrygian scale" either.. |
| 02:22:27 | <Gracenotes> | or s/major/dominant/ |
| 02:22:57 | <edwardk> | what is a good DNA to run? i didn't actually participate in 07 |
| 02:23:31 | <Gracenotes> | aha! It recognizes "E spanish phrygian" |
| 02:23:39 | <roconnor> | edwardk: let me see |
| 02:23:42 | <Gracenotes> | but not as the third |
| 02:24:27 | <Cale> | Heh, you can tell that Wolfram was involved. Scales are also numbered. |
| 02:25:00 | <Cale> | (according to a 12 bit code) |
| 02:25:12 | <Gracenotes> | ooh, you can play the scale sound |
| 02:25:19 | <roconnor> | edwardk: touch empty.dna |
| 02:25:22 | <Zao> | Victory! I managed to build gtk2hs on Windows. |
| 02:25:26 | <Zao> | I wonder if it works ;) |
| 02:25:27 | <roconnor> | edwardk: and run it on that. |
| 02:25:34 | <Gracenotes> | at least in whatever web browser it was tested in |
| 02:26:48 | <edwardk> | ./DNAexec empty.dna > empty.rna ? |
| 02:27:37 | <roconnor> | that's good |
| 02:27:53 | <roconnor> | the result should be the same as endo.rna |
| 02:28:17 | <edwardk> | estimated runtime a few minutes? |
| 02:28:26 | <roconnor> | um |
| 02:28:31 | <roconnor> | maybe 2 minutes |
| 02:28:40 | <roconnor> | that's what I said in my blog |
| 02:28:53 | <roconnor> | but it sort of depends on which string represenation is being used. |
| 02:29:41 | <roconnor> | it seems to be using Data.Seq |
| 02:29:44 | <roconnor> | which is pretty fast |
| 02:29:48 | <roconnor> | but kinda a memory pig |
| 02:30:02 | <bwr> | Trying to capture the screen. not anywhere close yet. Trying to use gtk2hs to get the screen definitions. Can someone take a look at this? http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4919#a4919 |
| 02:30:59 | <edwardk> | k 56 seconds using the original version there |
| 02:31:08 | <roconnor> | okay |
| 02:31:13 | <roconnor> | sounds pretty resonable |
| 02:31:26 | <roconnor> | did you have your computer in 2007? :) |
| 02:31:42 | <edwardk> | that was in a VM ;) |
| 02:31:48 | <roconnor> | oh god |
| 02:31:50 | <Twey> | ACTION laughs. |
| 02:32:06 | <Twey> | Wolfram|Alpha isn't sure what to do with your input. |
| 02:32:18 | <Twey> | Related inputs to try: |
| 02:32:28 | <Twey> | number of legs Animals: wolf Movies: legs |
| 02:32:42 | <edwardk> | I did run it with -O2 -fspec-constr -fdicts-cheap -funbox-strict-fields though |
| 02:33:44 | <Twey> | Some of the outputs for names have \n in them |
| 02:34:31 | <roconnor> | edwardk: I just didn -O2 |
| 02:34:33 | <roconnor> | did |
| 02:34:46 | <edwardk> | i wanted it to be fair, since i tend to use those myself |
| 02:35:45 | <edwardk> | trying to parse your DNAMonad |
| 02:36:02 | <roconnor> | edwardk: we need to get it down to 16 seconds to compete with C. :) |
| 02:36:18 | <edwardk> | hah |
| 02:36:34 | <edwardk> | its good to have a goal |
| 02:37:27 | <edwardk> | done is your 'mzero'? |
| 02:38:26 | <roconnor> | um |
| 02:38:30 | <roconnor> | probably |
| 02:38:48 | <roconnor> | oh |
| 02:38:52 | <roconnor> | I don't think I'm a monadPlus |
| 02:38:58 | <roconnor> | fail is my done |
| 02:39:06 | <Gracenotes> | mzero is identity over mplus |
| 02:39:35 | <edwardk> | well the monadplus would 'resume' a 'done' =) |
| 02:40:35 | <roconnor> | oh I don't implement fail |
| 02:40:37 | <edwardk> | it should be able to be monadplus because it's maybet'd |
| 02:40:38 | <roconnor> | strange |
| 02:41:09 | <roconnor> | it could be, but I never use mplus |
| 02:41:16 | <Twey> | What is it with mathematicians and their prepositions? |
| 02:41:28 | <Twey> | They always choose such odd prepositions to refer to things |
| 02:41:33 | <roconnor> | I like how I say forever, but it actually stops eventually |
| 02:42:11 | <Twey> | Like ‘identity over mplus’ — why on Earth would it be ‘over’? mplus is not a set, nor anything with a discernable maximum bound that identity could be considered above |
| 02:43:52 | <Gracenotes> | in the range of things to be mplus'd, mzero is identity. too literally |
| 02:44:08 | <bwr> | Anyone mind taking a look at my code? |
| 02:45:08 | <TomMD> | Is your code somehow offensive? |
| 02:45:17 | <bwr> | I don't think so, but it doesn't work |
| 02:45:34 | <TomMD> | Well feel free to paste it. |
| 02:45:36 | <TomMD> | @where paste |
| 02:45:36 | <lambdabot> | http://hpaste.org/new |
| 02:45:42 | <bwr> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4919#a4919 |
| 02:46:11 | <roconnor> | @pl \(x,y) -> f x y |
| 02:46:12 | <lambdabot> | uncurry f |
| 02:46:17 | <bwr> | I am trying to capture the screen, but I am making small steps towards that. |
| 02:46:28 | <bwr> | Just trying to get screen dimensions currently |
| 02:47:34 | <TomMD> | Gah, I don't have gtk2hs installed these days, but I'm looking anyway. |
| 02:47:34 | <bwr> | I get nothing from the screenGetDefault |
| 02:47:47 | <roconnor> | @pl \p -> f (fst p) (snd p) |
| 02:47:48 | <lambdabot> | uncurry f |
| 02:47:56 | <roconnor> | @pl \p -> f (pi1 p) (pi2 p) |
| 02:47:56 | <lambdabot> | liftM2 f pi1 pi2 |
| 02:48:10 | <TomMD> | bwr: Oh, so it compiles but doesn't act how you want it to? |
| 02:48:49 | <bwr> | Yes |
| 02:49:39 | <TomMD> | bwr: Well, the GTK site says 'screen_get_default' returns None if there is no default, so I'm guessing gtk2hs translates None -> Nothing. |
| 02:49:47 | <TomMD> | Do you have a reason to expect a default? |
| 02:50:00 | <bwr> | I only have one screen :P |
| 02:50:38 | <bwr> | Well, i was looking at an example in a different language |
| 02:50:41 | <TomMD> | bwr: Does displayGetDefault return properly? |
| 02:50:50 | <bwr> | and they were using screenGetDefault |
| 02:51:04 | <bwr> | i don't know where displayGetDefault is |
| 02:51:23 | <TomMD> | I just guessed it might based on what I saw in the C api. |
| 02:51:48 | <bwr> | the haskell docs on screenGetDefault says to see displayGetDefault |
| 02:51:51 | <bwr> | but i haven't seen where that is |
| 02:51:56 | <TomMD> | ah, I see. |
| 02:52:01 | <hatds> | I'd try calling the function in a stand alone C function first, but I'm always terrible at grokking libraries |
| 02:52:01 | <bwr> | http://www.haskell.org/gtk2hs/docs/gtk2hs-docs-0.10.0/Graphics-UI-Gtk-Gdk-Screen.html#v%3AscreenGetDefault |
| 02:52:07 | <hatds> | *stand alone C program |
| 02:52:22 | <TomMD> | Sorry, its too specific for me to help any - I'm just stabbing in the dark so its probably a waste of time. |
| 02:52:33 | <bwr> | ok, thanks for looking though |
| 02:52:51 | <riddochc> | Going through Real World Haskell. Starting in about ch. 7, (the first chapter on I/O), the $ symbol is used... but not explained. It's not in the index, as far as I can tell, and I'm now in ch. 9, and still don't know what it signifies. |
| 02:53:08 | <hatds> | f $ x = f x |
| 02:53:36 | <edwardk> | done >>= _ = done ? |
| 02:55:15 | <MyCatVerbs> | riddochc: ($) takes a function and an argument and applies the function to the argument. |
| 02:55:57 | <MyCatVerbs> | riddochc: i.e. it does nothing, semantically. Its only purpose is to split expressions in half, so you can get away with fewer brackets. |
| 02:57:45 | <roconnor> | edwardk: ya |
| 02:58:11 | <edwardk> | making headway. stuck doing some work stuff at the same time |
| 02:58:22 | <riddochc> | MyCatVerbs: Oookay, that helps a little... by bracket, you're not referring to the function used for exception handling, I assume? |
| 02:58:33 | <ray> | he means parentheses |
| 02:58:38 | <MyCatVerbs> | riddochc: no, I mean parentheses. Sorry, I'm British. |
| 02:58:49 | <ray> | you can write f $ g x y z |
| 02:58:55 | <ray> | instead of f (g x y z) |
| 02:59:10 | <riddochc> | Ah! I get it, then. |
| 02:59:13 | <MyCatVerbs> | riddochc: $ has really low precedence, so it (almost always) splits expressions in half. |
| 02:59:22 | <roconnor> | edwardk: I don't really see how my code gets that law, but I hope it holds. |
| 02:59:33 | <ray> | normal function application, on the other hand has reeeeeeeeeeeeeeeeally high precedence |
| 02:59:44 | <MyCatVerbs> | A common way to write long chains of composed functions is, (foo . bar . baz . bleeple $ input) |
| 02:59:59 | <riddochc> | So maybe that means it was explained in the section on . but I missed it the first time through... |
| 03:00:03 | <roconnor> | done = DNAMonad (Cont (\_ _-> ([], Done))) |
| 03:00:12 | <roconnor> | That's pretty damning though |
| 03:00:16 | <ray> | i don't remember, because i already knew haskell before i got RWH |
| 03:00:38 | <MyCatVerbs> | riddochc: no, you're not the first to complain about this, I believe it's actually missing or some such thing. |
| 03:00:42 | <riddochc> | Yeah, obviously I'm just learning it for the first time. |
| 03:00:55 | <roconnor> | edwardk: was empty.rna the same as endo.rna? |
| 03:01:07 | <riddochc> | Huh. Well, the index has a reference to ($) but not just $ |
| 03:01:09 | <MyCatVerbs> | Personally, I'd recommend Learn You A Haskell first, anyway. Then pretty much any guide will do. |
| 03:01:25 | <MyCatVerbs> | riddochc: ($) is just the prefix way of writing $. |
| 03:01:30 | <ray> | yeah, we refer to operators by their prefix forms usually |
| 03:01:31 | <MyCatVerbs> | ($) f x = f $ x |
| 03:01:35 | <edwardk> | yeah |
| 03:01:43 | <MyCatVerbs> | @where lyah |
| 03:01:44 | <lambdabot> | www.learnyouahaskell.com |
| 03:01:56 | <MyCatVerbs> | for Great Good! |
| 03:02:06 | <edwardk> | slogging through the writer instances |
| 03:02:10 | <ray> | it's like that ruby one but with more content and fewer cartoons |
| 03:02:12 | <edwardk> | er instance |
| 03:02:33 | <edwardk> | did you actually use the listen or pass? =) |
| 03:02:49 | <shapr> | ACTION gives edwardk the Iron Man Fire Extinguister award for today. |
| 03:02:56 | <edwardk> | hah |
| 03:03:02 | <MyCatVerbs> | ray: it's like _why's Poignant Guide, only with mere cartoons rather than actual hallucinations. |
| 03:03:09 | <edwardk> | did you light... er... start it back up after? |
| 03:03:15 | <hydo> | lyah++ |
| 03:03:17 | <adamvo> | @hoogle Monad Either |
| 03:03:17 | <lambdabot> | Did you mean: :: Monad (Either a a) /count=20 |
| 03:03:17 | <lambdabot> | No results found |
| 03:03:22 | <MyCatVerbs> | Haskell on a sugar rush rather than Ruby on lysergic. |
| 03:03:25 | <shapr> | Not yet, who would hold the fire extinguisher? :-) |
| 03:03:28 | <edwardk> | shapr++ for finally getting the bladeserver to turn on! |
| 03:03:30 | <hatds> | does anyone ever wish there was a way to assign a type synonym by specifying a global value? like type FunType = f where f is global |
| 03:03:35 | <riddochc> | Right, ($) isn't explained until partway through ch. 10, but is first used in ch. 7 |
| 03:03:42 | <adamvo> | @hoogle Monad (Either a a) |
| 03:03:42 | <lambdabot> | Warning: Unknown type Monad |
| 03:03:43 | <lambdabot> | Control.Monad.Error runErrorT :: ErrorT e m a -> m (Either e a) |
| 03:03:43 | <lambdabot> | Control.Arrow returnA :: Arrow a => a b b |
| 03:04:09 | <shapr> | But tomorrow morning I'll put the dual quad Xeons into one of the blades and install some flavor Linux. What's the best distro for doing eight-core Haskell goodies? |
| 03:04:13 | <riddochc> | But as far as I can tell, it's not exactly an explanation anyway... more of a passing reference. |
| 03:04:28 | <shapr> | I need to download an ISO(s) overnight, I figure. |
| 03:05:22 | <MyCatVerbs> | hatds: hrmn? There's type Foo = Bar, for declaring type synonyms. |
| 03:05:32 | <riddochc> | Anyway, yes, I read the a bit of read you a haskell before I started this book... up until the explanations there weren't working for me. |
| 03:05:40 | <hatds> | MyCatVerbs: I want something like 'typeof' |
| 03:05:58 | <hatds> | MyCatVerbs: type Foo = reverse |
| 03:06:05 | <MyCatVerbs> | hatds: ah. Look for type reification in Haskell''. ;) |
| 03:06:24 | <edwardk> | no idea, still on the drop =/ |
| 03:06:27 | <cjs> | I thought I'd seen an example somewhere once of library functions (outside of Control.Monad) that worked with arbitrary monads. Maybe something like a lookup :: Monad m => a -> b -> m c, in order to let the user of the library define the control flow and/or failure behaviour. Can anybody remind me what I'm really trying to bring to mind here? |
| 03:06:45 | <edwardk> | cjs: Data.Map used to work that way for lookup |
| 03:06:52 | <edwardk> | cjs: Frisby still uses that convention |
| 03:07:03 | <MyCatVerbs> | cjs: lookup :: (Monad m) => Map k v -> k -> m v, is pretty common. |
| 03:07:24 | <MyCatVerbs> | cjs: the idea is that you use the Monad's (return) for success, and its (fail) for failure. |
| 03:07:27 | <cjs> | Ah, did it! My first thought was Data.Map.lookup, but then I looked it up and its result was Maybe a. |
| 03:07:45 | <cjs> | Then I decided I might be going crazy. :-) |
| 03:07:52 | <MyCatVerbs> | For example, if I do (lookup...) :: Maybe a, I get back either Just a, or Nothing. |
| 03:08:07 | <MyCatVerbs> | But if I do (lookup...) :: [a], I get back either a singleton list or the empty list. |
| 03:08:16 | <cjs> | But it seems to me that that idiom is no longer commonly used. |
| 03:08:29 | <riddochc> | I'm kind of enjoying learning Haskell so far, because there are some new concepts I haven't run into in any other language I've used, and I enjoy a good conceptual challenge, but it's really seeming like there's no *single* introduction that really discusses every topic in a way that makes sense. |
| 03:08:35 | <cjs> | Are there any examples perhaps using MonadPlus to gather result sets or anything like that? |
| 03:08:59 | <riddochc> | So I find myself skipping back and forth between several. |
| 03:09:01 | <MyCatVerbs> | Nah, it's pretty common, AFAIK. |
| 03:09:25 | <cjs> | riddochc: No, I doubt there is. Haskell is huge and complex in that way. And Monads are just too general. They're used for control flow, state, and lord knows what else. |
| 03:09:33 | <MyCatVerbs> | cjs: the thing is that most of these basic types are easily transformable to one another, so it doesn't matter too much. |
| 03:09:36 | <roconnor> | edwardk I don't use listen or pass I don't think. |
| 03:09:46 | <roconnor> | you should be able to omit them. |
| 03:10:17 | <roconnor> | edwardk: pass is stupid anyways. |
| 03:10:34 | <edwardk> | roconnor: yeah, trying the last couple of functions in here now |
| 03:10:36 | <MyCatVerbs> | cjs: e.g. transforming from (Maybe a) to (Monad m) => (m a), is just a matter of (\x -> case x of { Nothing -> fail "nothing"; Just x -> return x; } |
| 03:10:59 | <riddochc> | I must admit, though, I'm still leaning towards Lisp, when it comes to my language of choice. Or ruby, depending on what I'm doing. |
| 03:11:29 | <roconnor> | maybe (fail "nothing") return |
| 03:11:38 | <roconnor> | @type maybe (fail "nothing") return |
| 03:11:39 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => Maybe a -> m a |
| 03:11:52 | <MyCatVerbs> | roconnor: oh, nicer than what I'd written. |
| 03:12:00 | <MyCatVerbs> | cjs: though there is a line of thought that says that the (fail) function should never, ever have been part of Monad's interface, which has kind of pushed that idea out of fashion a little. |
| 03:12:21 | <roconnor> | @type maybe (fail "Error: Prelude nothing") return |
| 03:12:22 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => Maybe a -> m a |
| 03:12:36 | <cjs> | MyCatVerbs: Right. And making the default "error", well.... |
| 03:12:58 | <riddochc> | Thanks for the explanation of $. I appreciate that there's enough interest in haskell that I can ask about this on a friday evening anyway. |
| 03:13:24 | <roconnor> | ugh, I'm not even sure my theorem is provable. |
| 03:13:30 | <MyCatVerbs> | Yes. Putting (fail) in as defaulting to (error) basically screws up any hope whatsoever of being able to keep track of totality discipline with Monad. |
| 03:13:34 | <cjs> | But also I can see a tension between how one woud want libraries structured for development of production-quality systems, and how one wants them structured for learning and experimentation. |
| 03:13:35 | <roconnor> | this could make it hard to prove. |
| 03:14:05 | <idnar> | MyCatVerbs: well, that's not a problem, just use MonadZerro instead (or whatever) |
| 03:14:21 | <cjs> | MonadZorro? :-) |
| 03:14:26 | <idnar> | haha |
| 03:14:40 | <MyCatVerbs> | idnar: other way 'round. You have no assurance that nobody used (fail) in your Monad-using code. |
| 03:14:40 | <cjs> | What would that do, I wonder? |
| 03:15:01 | <MyCatVerbs> | idnar: of course you also have no assurance that nobody used (head []) or (undefined), but oh well. |
| 03:15:04 | <idnar> | MyCatVerbs: I was referring to the "fail should never have been part of Monad" comment |
| 03:15:31 | <cjs> | MyCatVerbs: Perhaps what we need for that is really a separate MonadControl class or something, for 'fail'. |
| 03:15:37 | <MyCatVerbs> | idnar: oh sorry, my bad. Yes, should've been in MonadZorro or MonadError or something. |
| 03:16:08 | <MyCatVerbs> | cjs: yes, this is the widely-held opinion, AIUI. |
| 03:16:09 | <idnar> | "MonadZorro" has me bursting into little giggles every few seconds now |
| 03:16:09 | <wli> | MonadZero and MonadError are the proper approaches. Monad should not have fail. |
| 03:16:56 | <MyCatVerbs> | The \_ in MonadZorro's implementation of (>>) is where he hides the mask and sword while he's slumming it in order to pass unnoticed by the authorities. |
| 03:17:07 | <cjs> | So what are the chances that we'll get a new version of the standard libraries with these things fixed. Maybe throw in Functor as a requirement for Monad, as well. |
| 03:17:39 | <edwardk> | well my DNAMonad compiles, testing |
| 03:17:44 | <MyCatVerbs> | cjs: approximately nil. All languages suck, and this kind of thing is IMHO the most inescapable reason why. |
| 03:18:05 | <cjs> | "Haskell: we suck less." |
| 03:18:38 | <dons> | no compromises! |
| 03:18:40 | <MyCatVerbs> | I mean there are other reasons too, but most of them are possible to avoid, unlike cruft issues. |
| 03:19:26 | <roconnor> | edwardk: I feel like it is 2007 all over again. |
| 03:19:34 | <edwardk> | heh |
| 03:20:08 | <roconnor> | dons: except for the MR |
| 03:21:01 | <dons> | well, its going. |
| 03:21:27 | <dons> | we already did the test that nothing breaks , and performance is fine. |
| 03:21:46 | <edwardk> | well i suppose an implementation that causes you to spew memory is a bad idea to introduce into the code for Endo ;) |
| 03:21:50 | <edwardk> | still waiting =) |
| 03:22:21 | <edwardk> | otoh, i may have broken it for other reasons |
| 03:23:02 | <cjs> | MR? |
| 03:23:21 | <koninkje> | monomorphsim resriction |
| 03:23:33 | <cjs> | Ah, that one. |
| 03:24:07 | <edwardk> | @hpaste |
| 03:24:07 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 03:24:31 | <Saizan> | oh, Endo there is the alien? |
| 03:25:11 | <edwardk> | roconnor: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4920#a4920 is where i took it, but it seems a tad slower |
| 03:25:33 | <edwardk> | i may have screwed up the termination criterion or something |
| 03:26:56 | <edwardk> | i may also be paying some n^2 cost in the mappends |
| 03:27:57 | <roconnor> | edwardk: ;( |
| 03:28:20 | <roconnor> | edwardk: what is runDNAMonad? |
| 03:28:23 | <edwardk> | anything obviously wrong with that? |
| 03:28:30 | <edwardk> | i just pasted extractRNA |
| 03:28:40 | <edwardk> | which was the only one i needed to run your DNAexec |
| 03:28:45 | <wli> | What are you guys doing with RNA and/or DNA? |
| 03:28:54 | <cjs> | Saving Endo. |
| 03:28:59 | <edwardk> | hah |
| 03:29:26 | <SubStack> | wolfram alpha said a monad was some DNA thing |
| 03:29:43 | <edwardk> | SubStack: it thinks its a protein |
| 03:30:15 | <SubStack> | that's the thing |
| 03:31:50 | <SubStack> | DNA is pretty lispy, modifying itself and what-not |
| 03:32:48 | <roconnor> | edwardk: presumably you get the correct result. |
| 03:33:17 | <edwardk> | roconnor: er it hasn't yet actually _terminated_ =) |
| 03:34:41 | <roconnor> | oh my |
| 03:34:45 | <edwardk> | going on ~15 minutes or so =) |
| 03:35:00 | <roconnor> | edwardk: I bet you screwed up the termination condition |
| 03:35:09 | <edwardk> | otoh the other version seemed to incrementally generate empty.rna |
| 03:35:12 | <edwardk> | and this one doesn't |
| 03:35:19 | <edwardk> | so i think i did something wrong |
| 03:35:19 | <edwardk> | yeah |
| 03:35:23 | <roconnor> | edwardk: check if "forever done" runs forever in ghci. |
| 03:35:40 | <edwardk> | good idea |
| 03:35:57 | <roconnor> | edwardk: oh, well, if you are not even generating any RNA, that is even worse. |
| 03:36:15 | <roconnor> | I should generate RNA even when running forever. |
| 03:36:55 | <edwardk> | extractRNA (forever done) undefined yields [] immediately |
| 03:37:12 | <roconnor> | that's good |
| 03:38:31 | <edwardk> | and tell works, hrmm |
| 03:39:31 | <roconnor> | edwardk: it seems a bit strange that z is used twice in bind. |
| 03:39:35 | <edwardk> | going to undo the writer as state optimization and see what i get |
| 03:40:23 | <edwardk> | it makes sense when you see 'z' as the failure continuation that has to be copied to both 'g' and the result of f |
| 03:40:31 | <roconnor> | oh |
| 03:40:31 | <edwardk> | just like k does |
| 03:40:49 | <roconnor> | @src (>>=) Cont |
| 03:40:49 | <lambdabot> | Source not found. You type like i drive. |
| 03:40:51 | <edwardk> | 'z' is 'what to do when done' |
| 03:41:10 | <edwardk> | 'k' is 'what to do when more' |
| 03:43:42 | <roconnor> | k isn't used twice |
| 03:44:10 | <roconnor> | but I find you explaintion for z plausible |
| 03:44:13 | <roconnor> | your |
| 03:44:37 | <edwardk> | thats because you do different things for the left and right side when you have more available. |
| 03:46:13 | <edwardk> | DNAMonad g >>= f = DNAMonad (\k z s w-> g (\a s' w' -> getDNAMonad (f a) k z s' w') z) s w -- is that fully eta expanded |
| 03:47:02 | <edwardk> | er swap the last s w over the ) |
| 04:01:10 | <adamvo> | is anybody familiar with the Control.Exception in base version 4? |
| 04:02:04 | <adamvo> | I'm not sure how to go about catching all errors that happen, so that I can display a nicer error message with gtk2hs instead of to stderr |
| 04:02:18 | <edwardk> | well, if i write out the result in reverse i'm faster at least |
| 04:02:43 | <roconnor> | nooo |
| 04:02:56 | <roconnor> | that's just wrong |
| 04:02:57 | <edwardk> | so i should be able to difference list it |
| 04:02:58 | <adamvo> | there's an ambiguous type variable |
| 04:03:21 | <Axman6> | adamvo: SomeException is probably what you need |
| 04:03:48 | <roconnor> | edwardk: I figured the cps transform would associate everything the correct way automagically |
| 04:03:48 | <edwardk> | it shaved about 1/6th off the time |
| 04:03:55 | <Axman6> | i think you need something like catch action (\SomeException e -> ...) |
| 04:04:07 | <Apocalisp> | Given an [x] and a parser for x, I can find all the xs that will be consumed by the parser. Can the other way be achieved? Given a [Parser x] and an x, can we find all the parsers that would consume x? |
| 04:04:10 | <Axman6> | but it's been a while since i've needed to use Control.Exception |
| 04:04:31 | <edwardk> | i guess it associates everything the opposite way you'd like. i flopped the arguments w and w' in the mappend and bam, fast. |
| 04:04:54 | <adamvo> | Axman6: thanks, that works |
| 04:05:06 | <Axman6> | hooray :) |
| 04:05:07 | <roconnor> | edwardk: that seems peculiar |
| 04:05:13 | <roconnor> | edwardk: anyhow DList it |
| 04:05:14 | <dons> | someone needs to write a 'so you want to migrate to the new exceptions?' post. |
| 04:05:39 | <roconnor> | which is just another CPS transform |
| 04:05:41 | <roconnor> | :) |
| 04:05:42 | <edwardk> | roconnor: well, if you think about it, i _am_ appending to a list here |
| 04:05:44 | <Apocalisp> | somebody should write a monad tutorial as well |
| 04:05:44 | <Axman6> | dons: you've got plently of time right? |
| 04:05:45 | <Axman6> | :P |
| 04:06:01 | <edwardk> | and that will be slow, flipping that, made each tell into more or less a prepend |
| 04:06:15 | <dons> | i have little time :/ i try to write things as i get time though. i have some flights coming up, which is can be good blogging time. |
| 04:06:20 | <edwardk> | which is the happy case for a list |
| 04:06:30 | <dons> | but we need more people writing and building! |
| 04:06:40 | <Axman6> | yeah id be writing more if i wasn't so bogged down with uni |
| 04:06:51 | <roconnor> | edwardk: if all the appends were all associated the correct way, there would be no problem. |
| 04:07:11 | <roconnor> | edwardk: but with the CPS transform I'm totally lost as to which way things are being appended. |
| 04:07:20 | <Axman6> | luckily i am getting some haskell stuff done by helping a friend with her assignments in haskell for a course i did last semester |
| 04:07:28 | <Axman6> | s/semester/year |
| 04:07:54 | <edwardk> | here they are being appended on the end. so you have a lot of short strings beind appended to a big one |
| 04:08:12 | <roconnor> | edwardk: did you check that the "backwards append" actually produces the wrong result? |
| 04:08:20 | <edwardk> | yeah |
| 04:08:24 | <edwardk> | it was bytewise reversed |
| 04:08:28 | <Axman6> | dons: Ben L wrote this assignment... and i think he forgot how little the students in the course actually knew. even i'm finding it hard >_< |
| 04:08:44 | <dons> | Axman6: fwiw, i set a goal when i was doing my hons. to try to write some haskell every day. pays off over 5 years |
| 04:08:59 | <dons> | i bet benl's assignments are fun :) |
| 04:09:03 | <roconnor> | edwardk: hmm, I wonder if I had the same problem with my Codensity implementation. |
| 04:09:12 | <Axman6> | yeah this one's pretty cool |
| 04:09:13 | <roconnor> | edwardk: I think I would have noticed. |
| 04:10:32 | <edwardk> | i think effectively one of your other involutions from nesting everything probably played the same role as a difference list |
| 04:10:44 | <roconnor> | good |
| 04:10:53 | <roconnor> | I mean, I have no idea what you said. |
| 04:11:00 | <edwardk> | using the difference list i get basically the same speed as my reversed version |
| 04:11:08 | <roconnor> | and the right answer? |
| 04:11:24 | <edwardk> | yep |
| 04:11:28 | <edwardk> | so only a few % faster |
| 04:11:33 | <roconnor> | good |
| 04:11:40 | <roconnor> | that's what I expected |
| 04:11:46 | <Axman6> | dons: supposed to be writing the AI for a game of othello (Go?). the problem is that there's some pretty confusing data structures (like, this tree has members of this kind, which hold more of those trees... sounds easy enough, but took a while to figure out) |
| 04:11:52 | <Apocalisp> | Ah hah. What I want is "Predicate Matching". |
| 04:12:06 | <edwardk> | now to optimize :) |
| 04:12:43 | <Saizan> | can the cps'ed writer-as-state produce results lazily? |
| 04:12:59 | <Saizan> | ACTION tries it |
| 04:15:26 | <roconnor> | edwardk: if you branch I can give you instructions on how to get my pre-cps monad. |
| 04:15:29 | <edwardk> | fully applying gets me a few percent more |
| 04:15:46 | <roconnor> | edwardk: that should be 4 times slower |
| 04:15:50 | <roconnor> | but maybe GHC has changed |
| 04:15:56 | <edwardk> | i'm ok with this one as a competitor |
| 04:16:01 | <roconnor> | ok |
| 04:16:21 | <roconnor> | edwardk: what does fully applying get mean? |
| 04:16:24 | <roconnor> | eta expand? |
| 04:16:29 | <Saizan> | it appears like it can't |
| 04:16:57 | <edwardk> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4920#a4922 |
| 04:17:06 | <edwardk> | yeah |
| 04:17:25 | <edwardk> | which causes ghc to try to call with all arguments |
| 04:17:36 | <roconnor> | that's moronic |
| 04:17:45 | <roconnor> | damn you GHC!!!! |
| 04:19:33 | <edwardk> | do you always tell singletons? |
| 04:19:55 | <roconnor> | I don't think so |
| 04:19:59 | <roconnor> | but I'm not certain. |
| 04:20:08 | <roconnor> | it's possible |
| 04:20:34 | <roconnor> | grep tell |
| 04:20:55 | <roconnor> | GHC always disappoints me |
| 04:21:06 | <edwardk> | trying with an optimized tell' |
| 04:21:49 | <roconnor> | I hope tell is inlined and ([x]++) gets compiled to (x:) |
| 04:21:57 | <roconnor> | but then again, GHC always disappoints me. |
| 04:22:23 | <edwardk> | tell' :: RNA → DNAMonad (); tell' w' = DNAMonad (λk _ s w → k () s (λt → w (w':t))) -- gave a 0.5% speedup or so. |
| 04:22:28 | <edwardk> | but thats in the margin of error |
| 04:26:54 | <Jedai> | roconnor: I seriously doubt it |
| 04:27:06 | <roconnor> | Jedai: doubt what? |
| 04:27:33 | <Jedai> | roconnor: that ([x]++) get compiled to (x:) |
| 04:27:39 | <roconnor> | I bet it does |
| 04:27:52 | <roconnor> | (with -O2) |
| 04:28:16 | <dolio> | Stupid non-monospace monospace... |
| 04:28:18 | <Twey> | I doubt it makes much difference anyway |
| 04:28:24 | <Twey> | It's still O(1) |
| 04:28:31 | <Jedai> | Twey: That I can believe though |
| 04:28:37 | <koninkje> | I'm pretty sure it does when rewrite rules are enabled (e.g. -O2), though take a look at the core |
| 04:28:38 | <roconnor> | Jedai: I bet I can dig up a GHC rule |
| 04:28:43 | <edwardk> | Twey: most of what we're obsessing about is trying to change the constant ;) |
| 04:28:47 | <Twey> | Heh |
| 04:29:07 | <roconnor> | @source GHC.List |
| 04:29:07 | <lambdabot> | GHC.List not available |
| 04:29:13 | <Jedai> | roconnor: GHC Rules don't let you pattern match against a value |
| 04:29:38 | <Jedai> | Or at least I don't think they do |
| 04:31:22 | <Jedai> | As far as I can tell, the best you can hope for, supposing some inlining is to have ([x]++) compiled to (x:).([]++) |
| 04:32:02 | <SubStack> | gah, it should not be possible to patent maths |
| 04:32:03 | <SubStack> | but it is |
| 04:32:11 | <roconnor> | which GHC module is ++ defined in? |
| 04:32:23 | <Jedai> | And of course ([]++) is id, but you can't express that with GHC rules, it would have to be hardcoded in GHC, I'm not sure it jibes well with GHC philosophy |
| 04:32:54 | <Jedai> | @source Prelude |
| 04:32:54 | <lambdabot> | http://darcs.haskell.org/packages/base/Prelude.hs |
| 04:32:59 | <glguy> | specconstr ought to be able to tell []++ is id |
| 04:33:22 | <hatds> | call pattern specialization on (++) -- isn't it? |
| 04:33:40 | <roconnor> | Hmm, that file has no rules |
| 04:33:49 | <hatds> | well I mean in principle |
| 04:34:06 | <Jedai> | @source GHC.Base |
| 04:34:06 | <lambdabot> | GHC.Base not available |
| 04:34:51 | <Jedai> | glguy: That's good, then I guess this optimization is possible, is it really done ? |
| 04:34:54 | <hatds> | Nil is a constructor for List, so (++) can be specialized on it |
| 04:35:08 | <roconnor> | let's see |
| 04:35:10 | <roconnor> | "++" [~1] forall xs ys. xs ++ ys = augment (\c n -> foldr c n xs) ys |
| 04:35:32 | <koninkje> | Jedai: why can't you specify ([]++) = id as a rule? |
| 04:36:15 | <Jedai> | koninkje: As far as I can tell that's not how rules work |
| 04:36:29 | <Jedai> | koninkje: rules don't pattern match against value |
| 04:36:30 | <roconnor> | "foldr/single" forall k z x. foldr k z [x] = k x z |
| 04:36:33 | <roconnor> | ta da! |
| 04:36:39 | <koninkje> | Jedai: yeah they do |
| 04:36:48 | <roconnor> | Jedai: I think I did it. |
| 04:36:49 | <dons> | ghc gets rid of ++[] via the ++ rule, iirc |
| 04:36:58 | <Jedai> | Ok I'm wrong... That's a good thing :) |
| 04:37:05 | <dons> | yeah, it removes f = (++[]) |
| 04:37:05 | <dons> | {-# INLINE f #-} |
| 04:37:06 | <dons> | x = f "haskell" |
| 04:37:11 | <roconnor> | "augment/nil" forall (g::forall b. (a->b->b) -> b -> b) . |
| 04:37:12 | <roconnor> | augment g [] = build g |
| 04:37:18 | <roconnor> | dons: that uses the augment/nil rule |
| 04:37:21 | <dons> | 1 ++ |
| 04:37:21 | <dons> | 1 augment/nil |
| 04:37:22 | <dons> | 1 fold/build |
| 04:38:02 | <roconnor> | dons: and getting rid of [x]++ uses the foldr/single rule right? |
| 04:38:32 | <roconnor> | Jedai: you owe me a coke! |
| 04:38:34 | <roconnor> | I think |
| 04:39:02 | <dons> | where 'x' is a constant? |
| 04:39:13 | <roconnor> | where x is some term |
| 04:39:17 | <roconnor> | some expression |
| 04:39:32 | <dons> | doesn't fire. |
| 04:39:34 | <Jedai> | roconnor: I'll be more than happy to give you one ! GHC Rules are more powerful than I believed. :) |
| 04:39:38 | <roconnor> | god dam nit. |
| 04:39:41 | <dons> | e.g. f x = (++[x]) |
| 04:39:41 | <dons> | {-# INLINE f #-} |
| 04:39:41 | <dons> | x = f 'x' "haskell" |
| 04:39:47 | <roconnor> | no no |
| 04:39:51 | <roconnor> | [x]++ |
| 04:40:12 | <dons> | as in? |
| 04:40:18 | <dons> | x = ['x'] ++ "haskell" ? |
| 04:40:24 | <roconnor> | ya |
| 04:40:37 | <dons> | nope :/ |
| 04:40:46 | <dons> | need more list algebra rules |
| 04:41:33 | <roconnor> | "foldr/single" forall k z x. foldr k z [x] = k x z |
| 04:41:38 | <roconnor> | seems like it should fire |
| 04:42:27 | <edwardk> | trying out optimizing consume |
| 04:44:26 | <roconnor> | dons: what GHC command do you do to list rules? |
| 04:46:18 | <dolio> | Use ghc-core. |
| 04:47:17 | <dons> | I use ghc-core |
| 04:53:52 | <roconnor> | ghc-core is a program? |
| 04:54:54 | <dons> | yep |
| 04:55:03 | <dons> | a ghc wrapper to display intermediate info |
| 04:55:07 | <roconnor> | I don't have it |
| 04:56:20 | <dons> | cabal install ghc-core |
| 04:57:01 | <roconnor> | ah -ddump-simpl-stats |
| 04:57:48 | <roconnor> | dons: optimizing ['x']+"haskell" seems to work for me |
| 04:57:56 | <roconnor> | 5 RuleFired |
| 04:57:58 | <roconnor> | 1 ++ |
| 04:57:59 | <roconnor> | 1 augment/build |
| 04:58:01 | <roconnor> | 1 foldr/single |
| 04:58:02 | <roconnor> | 1 unpack |
| 04:58:04 | <roconnor> | 1 unpack-list |
| 04:58:07 | <roconnor> | foldr/single is the key rule |
| 04:58:43 | <Jedai> | ghc-core also give you Core output which is useful to check if the rule fired at the good place |
| 04:59:03 | <roconnor> | Jedai: Well I'm pretty convinced. :) |
| 04:59:12 | <roconnor> | reading Core is a big pain |
| 04:59:22 | <roconnor> | unless ghc-core makes pretty core |
| 04:59:35 | <Jedai> | I tried myself and it didn't optimize it, I believe that other rules interferred |
| 04:59:48 | <roconnor> | :/ |
| 05:00:05 | <Jedai> | roconnor: the core is colored and prettier than otherwise |
| 05:00:21 | <roconnor> | $ ghc --version |
| 05:00:23 | <roconnor> | The Glorious Glasgow Haskell Compilation System, version 6.8.2 |
| 05:00:33 | <Jedai> | roconnor: also if you use html output you have links from identifier to their definition |
| 05:00:37 | <roconnor> | Jedai: is your and dons, version of GHC broken? |
| 05:00:44 | <Jedai> | 6.10.2 |
| 05:00:57 | <roconnor> | ACTION won't upgrade |
| 05:01:22 | <dons> | roconnor: did you look at the core? |
| 05:01:35 | <roconnor> | not with ghc-core |
| 05:01:41 | <dons> | ah, i get no foldr/single |
| 05:01:54 | <roconnor> | what rules do you get? |
| 05:01:55 | <dons> | weird |
| 05:01:58 | <dons> | module M (x) where |
| 05:02:00 | <dons> | x = ['x'] ++ "haskell" |
| 05:02:12 | <dons> | 1 augment/build |
| 05:02:12 | <dons> | 1 fold/build |
| 05:02:12 | <dons> | 1 foldr/app |
| 05:02:13 | <roconnor> | $ cat foo.hs |
| 05:02:14 | <roconnor> | main = putStr (['x']++"haskell") |
| 05:02:21 | <dons> | curious |
| 05:02:39 | <dons> | nope. |
| 05:02:55 | <roconnor> | dons: oh man |
| 05:03:00 | <roconnor> | that doesn't seem good at all. |
| 05:03:27 | <dons> | 6.10.3 |
| 05:05:23 | <roconnor> | dons: what other rules are fired? |
| 05:05:33 | <roconnor> | It is pecular that fold/build fires. |
| 05:05:40 | <Jedai> | roconnor: fold/build and foldr/app |
| 05:06:23 | <roconnor> | presumably at least ++ fires? |
| 05:06:26 | <cjs> | How do I partially apply the subtraction operator to a right-hand side? |
| 05:06:40 | <roconnor> | cjs: use "subtract" |
| 05:06:46 | <cjs> | Ah. |
| 05:06:47 | <roconnor> | @(subtract 3) 4 |
| 05:06:48 | <lambdabot> | Unknown command, try @list |
| 05:06:51 | <roconnor> | > (subtract 3) 4 |
| 05:06:52 | <lambdabot> | 1 |
| 05:09:07 | <dolio> | Where is foldr/single defined? |
| 05:09:39 | <roconnor> | http://www.haskell.org/ghc/docs/latest/html/libraries/base/src/GHC-Base.html |
| 05:09:51 | <dons> | Base.lhs:"foldr/single" forall k z x. foldr k z [x] = k x z |
| 05:13:07 | <Jedai> | roconnor: the problem is not fold/build though |
| 05:13:29 | <roconnor> | something seems broken |
| 05:13:36 | <Jedai> | roconnor: The problem is that foldr/app runs before foldr/single... |
| 05:13:48 | <roconnor> | oh |
| 05:14:24 | <Jedai> | "foldr/app" [1] forall ys. foldr (:) ys = \xs -> xs ++ ys |
| 05:14:48 | <roconnor> | http://www.haskell.org/ghc/docs/6.8.2/html/libraries/base/src/GHC-Base.html is the same |
| 05:15:14 | <Gracenotes> | hm? What performance gain is there for ++ over foldr? |
| 05:17:53 | <edwardk> | Gracenotes: ++ should eventually 'get out of the way' while foldr will sit there replacing constructors on you |
| 05:18:12 | <Gracenotes> | what |
| 05:18:15 | <edwardk> | or wait |
| 05:18:20 | <edwardk> | @src (++) |
| 05:18:20 | <lambdabot> | [] ++ ys = ys |
| 05:18:20 | <lambdabot> | (x:xs) ++ ys = x : (xs ++ ys) |
| 05:18:20 | <lambdabot> | -- OR |
| 05:18:20 | <lambdabot> | xs ++ ys = foldr (:) ys xs |
| 05:18:32 | <edwardk> | heh guess not |
| 05:18:38 | <edwardk> | well |
| 05:19:11 | <edwardk> | the defintiion should be the same, perhaps just better specialization |
| 05:19:58 | <edwardk> | i was thinking for a sec that the difference was like anamorphism vs. apomorphism, but its not |
| 05:20:09 | <Jedai> | This rule doesn't seem very useful, except maybe to beautify the core afterward |
| 05:20:46 | <roconnor> | which rule? |
| 05:20:53 | <Jedai> | foldr/app |
| 05:20:57 | <Saizan> | "foldr/app" [1] forall ys. foldr (:) ys = \xs -> xs ++ ys |
| 05:21:28 | <Jedai> | The annoying one that seems to interfere with foldr/single in your exemple |
| 05:21:44 | <roconnor> | Jedai: what are all the rules that fire for you? |
| 05:22:05 | <roconnor> | I still don't get why you are seeing a fold/build rule fire. |
| 05:22:15 | <magical_pony> | BONUS: your haskell guide is amazing. that is all. |
| 05:22:23 | <Jedai> | 1 ++ |
| 05:22:23 | <Jedai> | 1 augment/build |
| 05:22:23 | <Jedai> | 1 fold/build |
| 05:22:23 | <Jedai> | 1 foldr/app |
| 05:22:57 | <Gracenotes> | bonus has not spoken for 10 hours ;_; |
| 05:23:08 | <Gracenotes> | *poke* *poke* |
| 05:23:40 | <Jedai> | roconnor: I don't think fold/build is the problem, from what I see there's no way it would interfere with foldr/single |
| 05:24:06 | <roconnor> | Jedai: it doesn't fire for me |
| 05:25:14 | <Jedai> | roconnor: Right but ghc 6.10 is supposed to do things better than 6.8, so we can suppose that some of the others optimization makes it possible to run it |
| 05:26:18 | <roconnor> | that doesn't seem like a safe assumption to me |
| 05:26:20 | <dons> | Jedai: nope. |
| 05:26:39 | <roconnor> | this is a tiny tiny piece of code we are talking about |
| 05:26:49 | <dons> | its entirely possible rule firing could be messed up. uvector rules seem to pass, fwiw, but there's no regressoin suite for build/foldr |
| 05:27:08 | <dons> | so a bug report about "why didn't the single rule fire?' is well worth it. |
| 05:27:12 | <roconnor> | dons: scary |
| 05:27:14 | <Jedai> | Right, but I still don't see why fold/build would mess up foldr/single |
| 05:27:24 | <dons> | i have a regression suite for streams. they're ok. |
| 05:27:46 | <dons> | but foldr/build is 15 years old.we didn't have test suites for libs then |
| 05:27:48 | <Jedai> | dons: On that I agree, but it seems to me that the problematic rule is foldr/app, not fold/build |
| 05:27:56 | <roconnor> | Jedai: the foldr/build rule detroys the foldr! |
| 05:28:09 | <Jedai> | roconnor: Not this one |
| 05:28:12 | <roconnor> | I mean the fold/build rule destorys the foldr |
| 05:28:25 | <roconnor> | huh? |
| 05:28:29 | <roconnor> | "fold/build" forall k z (g::forall b. (a->b->b) -> b -> b) . |
| 05:28:31 | <roconnor> | foldr k z (build g) = g k z |
| 05:28:32 | <roconnor> | see |
| 05:28:35 | <roconnor> | it eliminates the foldr |
| 05:28:47 | <roconnor> | no foldr means no foldr/app rule can fire. |
| 05:29:08 | <roconnor> | dons: where do I post the bug? |
| 05:30:12 | <Jedai> | roconnor: foldr/app runs, so it's obvious that fold/build didn't destroy the foldr where foldr/single should run |
| 05:30:49 | <roconnor> | good point |
| 05:31:24 | <roconnor> | Jedai: which only serves to confuse me more :) |
| 05:31:32 | <Jedai> | roconnor: I think fold/build destroy a foldr indeed but not the foldr created by the "++" rule |
| 05:31:46 | <Jedai> | roconnor: maybe this foldr is somewhere in putStr |
| 05:31:48 | <roconnor> | Jedai: what is your code? |
| 05:32:11 | <Jedai> | hello = ['h'] ++ "ello" |
| 05:32:11 | <Jedai> | main = putStr hello |
| 05:32:18 | <roconnor> | maybe we should be trying dons's code |
| 05:33:02 | <roconnor> | module Foo where x = ['x']++"haskell" |
| 05:33:23 | <roconnor> | 5 RuleFired |
| 05:33:24 | <roconnor> | 1 ++ |
| 05:33:25 | <roconnor> | 1 augment/build |
| 05:33:27 | <roconnor> | 1 foldr/single |
| 05:33:28 | <roconnor> | 1 unpack |
| 05:33:30 | <roconnor> | 1 unpack-list |
| 05:34:49 | <Jedai> | roconnor: Ok, I avow myself puzzled : |
| 05:35:08 | <roconnor> | What rules do you have with module Foo |
| 05:35:13 | <Jedai> | 6 RuleFired |
| 05:35:13 | <Jedai> | 1 ++ |
| 05:35:13 | <Jedai> | 1 augment/build |
| 05:35:13 | <Jedai> | 1 fold/build |
| 05:35:13 | <Jedai> | 1 foldr/app |
| 05:35:14 | <Jedai> | 1 unpack |
| 05:35:16 | <Jedai> | 1 unpack-list |
| 05:35:17 | <roconnor> | BTW, it seems you were half right about [ |
| 05:35:35 | <roconnor> | BTW, it seems you were half right about [x]++ not being optimized. Let's call our bet a draw :) |
| 05:35:55 | <Jedai> | I don't see a foldr to destroy other than the one that foldr/app touch afterward... |
| 05:36:46 | <Jedai> | roconnor: No no, you were correct, I thought GHC rules less powerful than they really were. Though they remain confusing in their application... |
| 05:38:08 | <roconnor> | Jedai: btw, does []++ optimize? |
| 05:38:15 | <roconnor> | should call foldr/nil |
| 05:39:15 | <Jedai> | roconnor: It does |
| 05:39:31 | <roconnor> | oh |
| 05:39:41 | <roconnor> | what are all the rules that fire? |
| 05:42:03 | <dolio> | ++, augment/build, foldr/nil, unpack, unpack-list |
| 05:42:50 | <Jedai> | I don't see where fold/build run in module Foo where x = ['x']++"haskell" |
| 05:45:35 | <roconnor> | dolio Jedai : what version of GHC are you running? |
| 05:45:42 | <dolio> | 6.10.3 |
| 05:45:44 | <Jedai> | roconnor: 6.10.2 |
| 05:46:06 | <roconnor> | You both agree about the 5 rules for the foldr/nil case? |
| 05:46:20 | <Jedai> | roconnor: I do |
| 05:47:17 | <dolio> | Incidentally, rewriting 'foldr (:) ys' into '\xs -> xs ++ ys' allows it to then be rewritten into '\xs -> augment (\c n -> foldr c n xs) ys'. |
| 05:47:34 | <Jedai> | dolio: Nope, look at the phases |
| 05:47:38 | <roconnor> | dolio: the rule sequences prevent loops like that |
| 05:47:43 | <roconnor> | er phases |
| 05:47:44 | <roconnor> | ya |
| 05:47:58 | <Jedai> | dolio: "++" is [~1] and "foldr/app" is [1] |
| 05:48:18 | <roconnor> | http://hackage.haskell.org/trac/ghc/ticket/3234 |
| 05:48:26 | <dolio> | Is [1] after [~1]? |
| 05:49:02 | <Jedai> | dolio: Yes, I believe so, [~1] is until phase 1 and [1] is from phase 1 on |
| 05:49:09 | <dolio> | Ah. |
| 06:02:22 | <hatds> | Nil is a constructor for List, so (++) can be specialized on it |
| 06:02:29 | <hatds> | ignore me :) |
| 06:02:38 | <Jedai> | roconnor: The problem appears to be the String in particular |
| 06:03:44 | <Jedai> | roconnor: their particular optimisation create a build around the ['h'] which remove the foldr before foldr/single can be applied |
| 06:04:18 | <Jedai> | roconnor: with other types foldr/single still fire correctly |
| 06:05:08 | <Jedai> | roconnor: I suspect that details of the moment of inlining of build explain the difference between 6.8 and 6.10 |
| 06:05:58 | <happycamper> | alo alo |
| 06:06:17 | <Jedai> | happycamper: Yes ? |
| 06:06:39 | <happycamper> | saying hello to make sure this is working. :D |
| 06:07:06 | <Axman6> | happycamper: it is, hooray, you win! |
| 06:07:16 | <happycamper> | well, sarcasm is lovely. |
| 06:07:34 | <happycamper> | I am looking for someone |
| 06:07:45 | <edwardk> | no, you really do win, you're our 5000th customer today. |
| 06:07:57 | <happycamper> | a professional programmer to help me flesh out an idea. |
| 06:07:58 | <Axman6> | ACTION wasn't being sarcastic :( |
| 06:08:06 | <edwardk> | please remain still while we take down your personal information to send you your prize =) |
| 06:08:12 | <happycamper> | lol ed |
| 06:08:14 | <Jedai> | happycamper: Maybe you could just tell you what you want to do... |
| 06:08:26 | <Jedai> | *us |
| 06:08:29 | <happycamper> | ... |
| 06:08:42 | <happycamper> | well, I kinda don't want to spread the idea to far. |
| 06:08:46 | <happycamper> | too* |
| 06:09:00 | <TomMD> | Then IRC is likely the wrong place to find help. |
| 06:09:12 | <happycamper> | really? hrm. |
| 06:09:21 | <tessier> | It burns when I pee. What do you guys recommend? |
| 06:09:23 | <TomMD> | If you desire professional help and confidentiallity then I'd say so. |
| 06:09:31 | <bpalmer> | tessier: consider a stronger type system. |
| 06:09:35 | <Jedai> | happycamper: Yep, wrong place, except if you're looking to pay your helper (still wrong place but well...) |
| 06:09:49 | <tessier> | bpalmer: Definitely. Next time I'll have more protection. |
| 06:09:57 | <Axman6> | tessier: asking for help on IRC. we're all doctors here |
| 06:10:00 | <coCocoa> | happycamper: How about Just tell us 1) and 2). You can save "????" and "Profit!" for yourself, that way. ;) |
| 06:10:02 | <Cale> | tessier: A song by Frank Zappa entitled "Why Does It Hurt When I Pee?" might give you some ideas. |
| 06:10:48 | <happycamper> | well, I appreciate the advise. I am not knowledgeable to pull off what I want to do, and really don't want to openly share. Again, thanks all. |
| 06:11:06 | <edwardk> | heya kowey |
| 06:11:21 | <Jedai> | happycamper: Don't forget you can still ask specific questions here* |
| 06:11:26 | <kowey> | hey, edwardk :-) |
| 06:11:30 | <Axman6> | happycamper: we're all about sharing here |
| 06:11:51 | <sjanssen> | @users |
| 06:11:51 | <lambdabot> | Maximum users seen in #haskell: 658, currently: 539 (81.9%), active: 13 (2.4%) |
| 06:11:55 | <Jedai> | happycamper: We're not going to piece together your idea from little bit and steal it... probably |
| 06:12:21 | <happycamper> | I really do appreciate it. and I would steal it if I were you. |
| 06:12:21 | <Axman6> | not unless it's a totally awesome idea |
| 06:12:22 | <happycamper> | lol |
| 06:12:25 | <coCocoa> | Jedai: You never know, though - we're wicked smart, here. ;p |
| 06:12:35 | <happycamper> | I really truely think that this is a REALLY good idea. |
| 06:12:46 | <happycamper> | but, yall dont know me... so hard to judge |
| 06:12:50 | <happycamper> | :D |
| 06:13:29 | <edwardk> | happycamper: one thing you'll find about programmers is they typically have more than enough work to do and enough irons in the fire that they really don't usually want another project =) |
| 06:13:30 | <happycamper> | I think it would be "freaking sweet" to pull it off... and the ad revenue would be insane. grr... reaches for programming book :P |
| 06:13:52 | <happycamper> | i'd image so ed. |
| 06:14:02 | <happycamper> | Still, I am branching out. :D |
| 06:14:16 | <sjanssen> | happycamper: look on craiglist? Or one of those rent-a-coder sites? |
| 06:14:37 | <happycamper> | tbh, didn't realize there was a rent a coder website... |
| 06:14:38 | <happycamper> | lol |
| 06:15:03 | <sjanssen> | any way, if you need a programmer, you'll probably need to give them money, and #haskell isn't a great place to look |
| 06:16:05 | <happycamper> | roar |
| 06:16:38 | <sjanssen> | happycamper: so do you have specific questions for Haskell? |
| 06:16:43 | <sjanssen> | s/for/about |
| 06:16:58 | <TomMD> | If Haskell were still alive I'd have specific questions for him. |
| 06:17:31 | <glguy> | for example? |
| 06:18:02 | <Axman6> | "do you like this totally sweet language we named after you?" |
| 06:18:06 | <TomMD> | For a silly start, what does he think of having a programming language named in his honor using a name he was never fond of ;-) |
| 06:18:13 | <bpalmer> | "Are you comfortable in that coffin?" |
| 06:18:16 | <solrize_> | i'd invite him out for some of that spicy indian stew, i forget what it's called |
| 06:19:09 | <TomMD> | Beyond that - I'd have to read papers he actually wrote - not having read his papers I always felt the terms 'curry' and 'uncurry' should be reversed. |
| 06:19:50 | <TomMD> | I suppose claiming something in the form of A cross B is your form 'curried' would be a bit persumptuous. |
| 06:22:54 | <hydo> | Is it still generally accepted that on osx, you should download the GHC bin package instead of using ports/fink? |
| 06:23:12 | <Cale> | TomMD: I doubt he named the terms after himself. |
| 06:23:24 | <TomMD> | Well, they are named after him now. |
| 06:23:36 | <Cale> | TomMD: It's more common that the author uses some notation, and then other people name it after him. |
| 06:23:43 | <coCocoa> | I always think of currying a horse, to keep straight which one does what. :) |
| 06:23:45 | <TomMD> | Yes, I understand your point. |
| 06:24:11 | <Cale> | hydo: I'm not sure, but given that ports will probably make you compile it yourself, yeah, the package will save a lot of time. |
| 06:24:33 | <hydo> | Yea, true. Didn't think of it that way... |
| 06:24:40 | <TomMD> | I've decided that compiling ghc in an emulator is a bad thing to do. |
| 06:25:43 | <sjanssen> | hydo: yes, I've heard the .pkg installer has seen quite a bit of work lately |
| 06:25:58 | <glguy> | ACTION has always just used macports |
| 06:26:05 | <Jedai> | TomMD: Compiling GHC when you don't abolutely have to is a bad idea anyway |
| 06:26:25 | <TomMD> | Jedai: I have too - some modifications that don't come in a binary from anyone else. |
| 06:26:36 | <TomMD> | *have to |
| 06:26:55 | <Jedai> | TomMD: What are they ? |
| 06:26:56 | <sjanssen> | off topic: I wonder if anyone has made an argument against from-source packaging from an environmental perspective |
| 06:26:58 | <glguy> | I have two |
| 06:27:20 | <Jedai> | glguy: I have three myself |
| 06:27:25 | <TomMD> | Jedai: Some research I'm embarking on as part of my studies at PDX. |
| 06:27:33 | <glguy> | Jedai, want to buy mine? |
| 06:27:49 | <Jedai> | glguy: Maybe more in fact, I should still have some old development version around |
| 06:27:50 | <wli> | ACTION cries |
| 06:27:56 | <wli> | ACTION used to live in PDX. |
| 06:28:10 | <glguy> | Jedai, what are we talking about? |
| 06:28:36 | <Jedai> | glguy: I'm not sure but I still have three or four |
| 06:28:41 | <TomMD> | wli: Yes, I recall you lamenting your loss before. |
| 06:29:32 | <Jedai> | TomMD: Well, when you're testing extensions to GHC you don't have much choice anyway... |
| 06:30:36 | <TomMD> | Yep. I'm hoping to add new pragma so GHC will spit out sort of a static program analysis - but that would be a ways away. |
| 06:30:54 | <glguy> | sjanssen, I imagine we have a long way to go before compiling or not makes a significant difference in envrionmental footprint |
| 06:31:39 | <Jedai> | sjanssen: You could say that the CPU cycles used to compile are compensated by the CPU cycles spared by more efficient executable but I would ask for statistics... |
| 06:32:45 | <sjanssen> | Jedai: I'm highly skeptical of that claim |
| 06:33:23 | <Jedai> | sjanssen: I would be too thus the call for statistics |
| 06:34:05 | <TomMD> | What if the compiled copy saves time at the correct moment, thus stopping a coal plant from spewing excess emissions? |
| 06:35:04 | <glguy> | does GHC's -fasm do much by way of arch specific optimizations? |
| 06:35:51 | <glguy> | I'd be surprised if a self-compiled version had any benefit at all, performance wise |
| 06:36:01 | <Jedai> | glguy: Not yet I believe but it should only improve |
| 06:36:06 | <TomMD> | glguy: Not sure how well it performs when you compare architectures against each other, but for my uses on x86_64 the difference is nill between that and -fvia-c. |
| 06:36:35 | <glguy> | the only time that compiling it yourself helps if you enable features that aren't on all processors in your architecture |
| 06:36:48 | <glguy> | but I didn't think that ghc's assembler made use of a ny of those anyway |
| 06:38:29 | <glguy> | for example, using -march=native with gcc |
| 06:40:54 | <mrbabbyman> | how do I do an x combinator in haskell |
| 06:41:12 | <copumpkin> | how is mrbabbyman formed? |
| 06:42:44 | <mrbabbyman> | copumpkin: ?? |
| 06:45:31 | <glguy> | mrbabbyman, do you have a URL explaining the X combinator? |
| 06:46:07 | <sjanssen> | mrbabbyman: alternatively, what does X look like in LC? |
| 06:46:15 | <davidmccabe> | I'm rewriting some python code in haskell which prints out a table. It's basically going to concatenate a bunch of strings together in a nested loop. What would be the idiomatic haskell way to do that? |
| 06:46:52 | <sjanssen> | davidmccabe: perhaps a concatMap? Or list comprehension? |
| 06:48:07 | <davidmccabe> | For the curious, here's the original: http://pastie.textmate.org/private/jvk1qhbsan04aixzszlelg |
| 06:49:10 | <sjanssen> | davidmccabe: you could do a fairly direct translation of that, but it wouldn't be the best way |
| 06:53:53 | <davidmccabe> | sjanssen: That's what I figured. |
| 06:57:56 | <Jedai> | davidmccabe: I would probably write this in some small functions |
| 06:58:34 | <davidmccabe> | Oops, have to go! Sorry to ask and run. |
| 07:00:03 | <Jedai> | Oh well... it was a complicated question to do it right anyway... We don't have a latex generating package, do we ? |
| 07:01:31 | <sjanssen> | Jedai: pandoc might actually have something |
| 07:02:00 | <sjanssen> | but we can still do better than this sample without even involving proper LaTeX generation |
| 07:02:29 | <Jedai> | Right |
| 07:03:40 | <Apocalisp> | http://www.wolframalpha.com/input/?i=((a+and+b)+implies+c)+implies+a+implies+b+implies+c |
| 07:04:03 | <Apocalisp> | This thing is neat. |
| 07:04:32 | <Apocalisp> | can't wait for "Wolfram Lambda" |
| 07:06:26 | <Gracenotes> | curry! |
| 07:06:43 | <Axman6> | yum |
| 07:06:45 | <Gracenotes> | Apocalisp: exactly what I was thinking |
| 07:06:51 | <Gracenotes> | tried (\x . x) y earlier |
| 07:06:55 | <Gracenotes> | naught |
| 07:07:00 | <Axman6> | oh wow, wolfram alpha's open now. wasn't yesterday |
| 07:07:44 | <Apocalisp> | Even better: ((a and b) implies c) vs (a implies b implies c) |
| 07:08:21 | <Gracenotes> | only false if a and b are true and c is false |
| 07:08:39 | <Gracenotes> | hm |
| 07:10:36 | <Apocalisp> | it means that the function can be realised for all a and b. |
| 07:10:56 | <Axman6> | http://www.wolframalpha.com/input/?i=weather+in+canberra+on+November+5th+1989 awesome |
| 07:12:42 | <Apocalisp> | weather in bingen am rhein on easter sunday |
| 07:13:25 | <Twey> | Wolfram|Alpha has temporarily exceeded its current maximum test load. |
| 07:13:44 | <Twey> | i.e. one of the guys sitting there typing away furiously on his keyboard went off for a toilet break |
| 07:13:58 | <sjanssen> | huh, they even have weather from the day and location I was born |
| 07:14:24 | <sjanssen> | Lincoln, NE which is no major city |
| 07:16:42 | <copumpkin> | :o |
| 07:17:16 | <copumpkin> | I was born on a rainy day |
| 07:17:20 | <copumpkin> | unsurprisingly |
| 07:17:52 | <copumpkin> | it doesn't know the average volume of the human penis though |
| 07:17:53 | <Gracenotes> | I was born a very hot day |
| 07:18:05 | <Gracenotes> | ~100 degrees |
| 07:18:14 | <copumpkin> | was water boiling? ;) |
| 07:18:16 | <Gracenotes> | at least where I was born |
| 07:18:29 | <sjanssen> | copumpkin: the historical graph shows the average skyrocketing the day I was born :) |
| 07:18:32 | <sjanssen> | hur hur hur |
| 07:18:34 | <Gracenotes> | silly human, Fahrenheit is the natural scale! |
| 07:18:38 | <copumpkin> | lol |
| 07:18:40 | <Apocalisp> | I was born on a snowy day, apparently. |
| 07:18:43 | <Apocalisp> | in may |
| 07:18:59 | <copumpkin> | I bet wolfram alpha relies on types a lot |
| 07:19:03 | <copumpkin> | :P |
| 07:19:14 | <Apocalisp> | quite |
| 07:19:24 | <Apocalisp> | try "2 girls 1 cup" |
| 07:19:35 | <copumpkin> | lol |
| 07:19:47 | <sjanssen> | 2 cup girls -- nice! |
| 07:19:47 | <Apocalisp> | answer: 2 girls * 1 cup = 2 cup girls |
| 07:20:13 | <Apocalisp> | whee |
| 07:21:02 | <copumpkin> | I wonder if alpha hooks into freebase |
| 07:21:36 | <Twey> | Hahaha |
| 07:22:22 | <sclv> | yipe. a giant rule system hooked on freebase. sounds like a recipe for disaster. |
| 07:24:56 | <copumpkin> | alpha is cool enough for sjanssen to tweet about! |
| 07:24:58 | <ray> | wolfram alpha can't tell me how to tie a windsor knot, fail |
| 07:25:15 | <copumpkin> | a tweet from sjanssen is worth a lot more than one of mine is, because he tweets so rarely! |
| 07:25:16 | <Axman6> | "Assuming "wolfram alpha" is a historical event | Use as an internet domain instead" ha |
| 07:25:22 | <wli> | I'd have asked it how to tie a cravat. |
| 07:26:20 | <sjanssen> | copumpkin: I considered posting 2 cup girls, but didn't want to without proper attribution |
| 07:26:38 | <ray> | it can't prove P != NP either |
| 07:26:50 | <Apocalisp> | well what's the point then |
| 07:27:18 | <Gracenotes> | I think it would be very weird of P = NP |
| 07:27:43 | <Gracenotes> | if there is an algorithm to solve every NP problem in polynomial time, why hasn't it been discovered yet? |
| 07:27:48 | <Gracenotes> | for any of them? >_> |
| 07:27:59 | <sjanssen> | it can't tell me which Superman and the Flash are faster :( |
| 07:28:32 | <ray> | yeah people generally go with the assumption that P != NP |
| 07:28:35 | <copumpkin> | Gracenotes: proof by "surely someone would've proved this by now if it were true" |
| 07:28:40 | <bpalmer> | neither can DC comics. |
| 07:28:51 | <copumpkin> | *disproof, I guess |
| 07:28:55 | <Gracenotes> | copumpkin: it is suspicious though |
| 07:28:59 | <sjanssen> | bpalmer: not with any consistency, no |
| 07:29:13 | <ray> | well, it depends on whether the writers are benevolent or not |
| 07:29:29 | <ray> | if they are, the flash is faster because otherwise he'd be upstaged by superman at the one thing he does |
| 07:29:29 | <bpalmer> | every time I've seen them propose the question, they make sure to include some excuse. |
| 07:29:32 | <Gracenotes> | if, as far as you know, something can't be done, it is perhaps best to assume that it simply can't be done when you need to apply it |
| 07:29:44 | <copumpkin> | Gracenotes: what if the very question of P =? NP is itself undecidable?? |
| 07:29:49 | <bpalmer> | propose to answer the question, rather, they make sure to include an excuse for why it's not a definitive answer. |
| 07:29:51 | <Gracenotes> | copumpkin: I've considered that |
| 07:30:02 | <ray> | lots of people go with that assumption too |
| 07:30:06 | <Gracenotes> | or perhaps you mean unprovable? >_> |
| 07:30:27 | <Gracenotes> | do you mean decidable in the TM sense? |
| 07:30:29 | <copumpkin> | if you phrase it as a decision problem, I don't see why I can't say it my way? |
| 07:30:36 | <Gracenotes> | ah, okay. |
| 07:31:00 | <sjanssen> | it does know the cheesy answer to life, the universe, and everything |
| 07:31:21 | <bpalmer> | brie? |
| 07:31:53 | <Gracenotes> | well, surely it's recognizable. Just try every possible program, simulating one step for one program, then two steps for two programs, then three steps for three programs, etc. |
| 07:32:11 | <Gracenotes> | eventually you will reach any arbitrary step for any arbitrary program |
| 07:32:31 | <ray> | now give them all numbers |
| 07:32:32 | <Gracenotes> | although... how to determine the algorithm's time from just running it? |
| 07:32:44 | <bpalmer> | Gracenotes: you're starting down Goedel's path. |
| 07:33:14 | <Gracenotes> | come to think of it, is there an algorithmic way to determine some bounds on running time? |
| 07:33:32 | <bpalmer> | Gracenotes: running time is usually considered as a function based on the size of input |
| 07:33:38 | <Axman6> | functional programming, mathematica style: http://www.wolframalpha.com/input/?i=sin+%2F%40+%7Bpi%2F6%2C+pi%2F5%2C+pi%2F4%2C+pi%2F3%2C+pi%2F2%2C+pi%7D |
| 07:34:37 | <Gracenotes> | bpalmer: a decidable computable one? |
| 07:34:46 | <Gracenotes> | at least for bounds |
| 07:35:18 | <davidL> | is something like foo defined somewhere? foo True c = Just c; foo False _ = Nothing |
| 07:35:25 | <Gracenotes> | hm. I feel I'm venturing into rather murky waters |
| 07:35:54 | <bpalmer> | I can describe a procedure whose running time is not decidable. |
| 07:36:11 | <ray> | @hoogle Bool -> a -> Maybe a |
| 07:36:11 | <lambdabot> | Control.Exception assert :: Bool -> a -> a |
| 07:36:11 | <lambdabot> | Prelude asTypeOf :: a -> a -> a |
| 07:36:11 | <lambdabot> | Control.Parallel.Strategies sforce :: NFData a => a -> b -> b |
| 07:36:12 | <Berengal> | davidL: Don't think so. How about just if True then Just x else Nothing |
| 07:36:29 | <copumpkin> | davidL: if you had the bool function, you could do bool Just (const Nothing) |
| 07:36:31 | <Gracenotes> | bpalmer: first even number not the sum of two primes, say? :) |
| 07:37:00 | <sjanssen> | which #haskeller did I just pick up on twitter? |
| 07:37:14 | <Berengal> | Gracenotes: 2? |
| 07:37:16 | <Gracenotes> | hmm. Well we don't know if that's decidable. could be. might not be. aaarrghh it's late. |
| 07:37:16 | <wli> | Me? |
| 07:37:31 | <Gracenotes> | Berengal: the problem is formulated such that 2 is excluded |
| 07:37:35 | <davidL> | thanks Berengal/copumpkin |
| 07:37:53 | <bpalmer> | 2 is the sum of 1 and 1 |
| 07:37:55 | <copumpkin> | sjanssen: what handle? |
| 07:37:59 | <sjanssen> | runarorama |
| 07:38:01 | <bpalmer> | er, sorry, that was stupid on my part |
| 07:38:01 | <Berengal> | bpalmer: 1 isn't a prime |
| 07:38:05 | <augustss> | Wolfram Alpha is useless. |
| 07:38:13 | <bpalmer> | right, a sign I'm out of here. :) |
| 07:38:44 | <ray> | yeah, it can't even tell me anything about stephen wolfram except that he's not dead |
| 07:38:44 | <Berengal> | http://www.wolframalpha.com/input/?i=e^(pi*i) |
| 07:39:06 | <Gracenotes> | augustss: well. It does have some nice subroutines |
| 07:39:41 | <Gracenotes> | as a general research tool it's a bit underdeveloped at the moment |
| 07:39:50 | <augustss> | Gracenotes: I'm sure it can answer maths questions, but hardly anything else I've tried. And it's natural language engine sucks. |
| 07:40:12 | <Gracenotes> | this is basically its feature list: http://www.wolframalpha.com/examples/ |
| 07:40:43 | <Berengal> | I believe it'll be awesome when it matures a bit |
| 07:40:50 | <ray> | of course it has cellular automata |
| 07:41:02 | <augustss> | my latest failure is 'graph gbp/sek' which it understands, but doesn't do. |
| 07:41:04 | <Gracenotes> | heh. yeah |
| 07:41:29 | <Berengal> | When I searched for 'monad' it gave me a genome... |
| 07:41:31 | <Lemmih> | augustss: Divide by zero? |
| 07:41:37 | <augustss> | lol |
| 07:42:29 | <Berengal> | Cripes! It knows about my home town, a place far out in deliverance country in norway :/ |
| 07:42:29 | <cjs> | Can anybody here give me an explanation of the hash table implementation given in Bagwell's VList paper (http://lampwww.epfl.ch/papers/techlists.pdf)? I can't seem to get it, perhaps because there's no example. In the off-topic channel is ok, if someone reminds me what that is. |
| 07:42:32 | <ray> | i think you're confusing it with isk |
| 07:43:01 | <augustss> | Doesn't know about my home town in Sweden. |
| 07:43:11 | <augustss> | 'when is earth close to mars?' not a clue |
| 07:43:28 | <Berengal> | distance earth vs mars? |
| 07:43:45 | <Gracenotes> | when are the planets physically closest, I suppose |
| 07:44:06 | <Gracenotes> | things astrologists concern themselves about, too :P |
| 07:44:34 | <ray> | also people lobbing rockets at mars |
| 07:44:37 | <augustss> | As I said, it's natural language engine sucks |
| 07:45:04 | <Berengal> | Aww... http://www.wolframalpha.com/input/?i=graph+distance+earth+vs+mars |
| 07:45:36 | <Berengal> | Earth | current distance from Earth | (data not available) |
| 07:45:37 | <Gracenotes> | it seems to be more of a find-the-subroutine thing. hopefully will get better with more input, if it doesn't wither up... which would be unfortunate |
| 07:45:44 | <ray> | if i say "distance from earth" it locates my isp's nearest thingy and tells me how far it is from some point off the ivory coast |
| 07:46:34 | <Berengal> | ray: I got "distance | from Bergen, Hordaland, Norway to world" as my interpretation |
| 07:46:43 | <ray> | presumably that point is 0 lat 0 long |
| 07:47:19 | <Gracenotes> | distance to center of earth -> Assuming Center (Texas, USA). heh |
| 07:47:33 | <Gracenotes> | "radius of earth" works |
| 07:47:43 | <Berengal> | Eh, apparently the "world" is somewhere off the west coast of africa |
| 07:48:05 | <augustss> | makes perfect sense. To Steve Wolfram |
| 07:48:41 | <ray> | well, it makes sense to me, it's just probably not the best interpretation |
| 07:48:50 | <augustss> | 'how much can an unladen swallow carry?' |
| 07:48:57 | <ray> | a cellular automata probably told him to do it |
| 07:49:01 | <ray> | automaton |
| 07:49:12 | <Gracenotes> | at least he has some cute queries that always work |
| 07:49:19 | <Gracenotes> | like 42, woodchuck, etc. |
| 07:49:31 | <Gracenotes> | that we'll possibly all be sick of in a week or so >_> |
| 07:49:53 | <Berengal> | One can never be sick of such things |
| 07:50:26 | <Apocalisp> | http://www.wolframalpha.com/input/?i=mercury+|+venus+|earth+|mars|+jupiter|+saturn+|uranus+|neptune+|pluto |
| 07:50:35 | <Apocalisp> | neato |
| 07:50:52 | <augustss> | http://www.wolframalpha.com/input/?i=third+futamura+projection |
| 07:50:58 | <augustss> | clueless as usual |
| 07:51:12 | <Gracenotes> | heh. it knows what it is told to know |
| 07:51:27 | <Berengal> | I keep misreading futamura as futurama... |
| 07:51:37 | <Axman6> | dwarf planet :( |
| 07:52:45 | <augustss> | Of course it knows what it's been told. But if you try to sell something as a knowledge engine you expect some basic knowledge. :) |
| 07:52:51 | <wli> | Brown dwarves are reputedly interesting. |
| 07:53:16 | <dan> | Anyone here an emacs wiz? Trying to make ghci autocomplete work in inferior haskell |
| 07:53:26 | <wli> | They're reputedly like Jupiter, only much larger. |
| 07:54:00 | <Apocalisp> | Brown dwarves seem to rather put the standard theory of stellar evolution in shome hot water. |
| 07:55:31 | <wli> | They're interesting in their own right even apart from that. |
| 08:02:07 | <Apocalisp> | I like this one here. |
| 08:05:42 | <Apocalisp> | http://www.wolframalpha.com/input/?i=a+glass+of+milk+and+a+pop+tart |
| 08:06:40 | <Apocalisp> | http://www.wolframalpha.com/input/?i=peanut+butter+and+jelly+sandwich+with+coke |
| 08:07:12 | <Apocalisp> | It adds eggs and cheese to my pb&j :) |
| 08:08:00 | <Axman6> | ha |
| 08:08:18 | <Axman6> | http://www.google.com/search?&q=399999999999999+-+399999999999998 fail |
| 08:08:42 | <Apocalisp> | does it work with rational numbers? |
| 08:08:56 | <Apocalisp> | oh, those are integers |
| 08:09:33 | <Apocalisp> | floating-point for the lose |
| 08:09:34 | <Axman6> | ACTION adds .1 and .5 and still gets fail |
| 08:12:36 | <Apocalisp> | http://www.wolframalpha.com/input/?i=five+tons+of+flax+seed |
| 08:14:12 | <Axman6> | serving size 5 metric tons, ha |
| 08:15:02 | <Berengal> | Mmm, five tons of flax... |
| 08:15:29 | <hydo> | http://www.wolframalpha.com/input/?i=what+is+the+air-speed+velocity+of+an+unladen+swallow%3F |
| 08:15:34 | <hydo> | wolframalpha++ |
| 08:16:03 | <Berengal> | http://www.wolframalpha.com/input/?i=what+is+the+air-speed+velocity+of+an+unladen+swallow%3F&a=*DPClash.MiscellaneousE.what+is+the+air!-speed+velocity+of+an+unladen+swallow-_*AirSpeedVelocityOfAnUnladenEuropeanSwallow- |
| 08:19:27 | <Berengal> | I need to figure out which combinators WA has... |
| 08:19:44 | <Berengal> | It's having some trouble finding the time from England to Africa using the airspeed of an unladen European swallow |
| 08:26:32 | <copumpkin> | sjanssen: that same twitter user is following me now :o |
| 08:26:53 | <copumpkin> | maybe he just found us on the haskellwiki twitter page? |
| 08:27:22 | <Axman6> | which user? |
| 08:27:39 | <copumpkin> | http://twitter.com/runarorama |
| 08:28:11 | <Axman6> | rightio |
| 08:29:02 | <Apocalisp> | Yea, I know that guy ;) |
| 08:30:24 | <copumpkin> | :o |
| 08:31:12 | <copumpkin> | oh, it's you :P |
| 08:31:13 | <ivanm> | isn't twitter short for "I'm too lazy to blog properly", where blog was short for "I'm too lazy to write proper articles"? |
| 08:31:29 | <copumpkin> | "A republic's constitution is its legislative typechecker. These presidential candidates do not compile!" |
| 08:31:43 | <copumpkin> | ivanm: that's one way of looking at it (that I don't really agree with) |
| 08:31:57 | <ivanm> | which part? ;-) |
| 08:32:44 | <copumpkin> | well, I guess I only disagree with the connotations of the language you used :P |
| 08:33:13 | <ivanm> | that twitter is useless? |
| 08:33:24 | <ivanm> | good, because that's the connotation I was wanting to come across! :p |
| 08:34:05 | <copumpkin> | :) |
| 08:34:40 | <ivanm> | methinks something is wrong with reddit: it's saying that dons posted articles only 6 hours ago that I saw more like 20 hours ago... >_> |
| 08:37:19 | <Apocalisp> | Twitter is for peripheral thoughts that you would share with your office mate if you had one. |
| 08:37:37 | <ivanm> | Apocalisp: then why not actually say it to them? |
| 08:37:46 | <ivanm> | oh, "if you had one"... missed that bit |
| 08:37:50 | <Apocalisp> | Blogging is a substitute for ranting over a beer with a mate, if you had one. |
| 08:38:42 | <copumpkin> | see, I'm too lazy to even argue about the worth of twitter anymore |
| 08:39:11 | <copumpkin> | there are always people who will see anything as a fad that the sheep are following for the sake of following :) |
| 08:40:29 | <ivanm> | ACTION also refuses to use facebook, etc. |
| 08:40:34 | <copumpkin> | exactly :) |
| 08:40:39 | <copumpkin> | many people also refuse to use haskell |
| 08:40:51 | <ivanm> | see, at least for facebook I have privacy reasons which are valid |
| 08:41:03 | <ivanm> | whereas Haskell increases your security :p |
| 08:41:09 | <copumpkin> | that's true :) although you can create an account with no information in it |
| 08:41:17 | <copumpkin> | and just stalk people |
| 08:41:19 | <copumpkin> | ;) |
| 08:43:21 | <copumpkin> | anyway, bedtime for me :) ciao! |
| 08:43:31 | <mm_freak_> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4924 |
| 08:43:47 | <mm_freak_> | this parser works only for FullUser, the other two parsers are tried, but they always fail |
| 08:43:50 | <mm_freak_> | why? |
| 08:44:13 | <Berengal> | mm_freak_: You need to try |
| 08:44:25 | <Berengal> | as map try |
| 08:44:32 | <mm_freak_> | oh, ok |
| 08:44:36 | <mm_freak_> | thanks |
| 08:44:39 | <Berengal> | Parsec doesn't backtrack unless you tell it to |
| 08:44:48 | <mm_freak_> | yeah, i figured |
| 08:46:51 | <mm_freak_> | works now, thanks |
| 08:47:08 | <Berengal> | :) |
| 08:52:43 | <mm_freak_> | is there some general way to express a natural transformation in haskell? i often have the following pattern in my code: |
| 08:52:50 | <mm_freak_> | = case parse parser "" str of |
| 08:52:50 | <mm_freak_> | Left _ -> Nothing |
| 08:52:50 | <mm_freak_> | Right result -> Just result |
| 08:53:20 | <ivanm> | mm_freak_: you mean Either -> Maybe? |
| 08:53:32 | <mm_freak_> | Either left -> Maybe |
| 08:54:57 | <Twey> | :t fromEither |
| 08:54:58 | <lambdabot> | Not in scope: `fromEither' |
| 08:55:59 | <Twey> | > either (const Nothing) Just (Right "foo") |
| 08:56:00 | <lambdabot> | Just "foo" |
| 08:56:05 | <Twey> | > either (const Nothing) Just (Left "foo") |
| 08:56:07 | <lambdabot> | Nothing |
| 08:56:24 | <mm_freak_> | i rather thought about a generalization of this |
| 08:56:26 | <Twey> | Also: |
| 08:56:27 | <monadic_kid> | when some says "natural transformation" i'm thinking catamorphisms |
| 08:56:34 | <monadic_kid> | *when someone says |
| 08:56:52 | <mm_freak_> | trans :: (Functor f, Functor g) => f a -> g a |
| 08:56:53 | <Twey> | > listToMaybe . rights $ Left "foo" |
| 08:56:54 | <lambdabot> | Not in scope: `rights' |
| 08:57:06 | <Twey> | Why isn't that in scope? |
| 08:57:36 | <dibblego> | @type Data.Traversable.sequence -- mm_freak_ |
| 08:57:37 | <lambdabot> | forall (t :: * -> *) (m :: * -> *) a. (Monad m, Data.Traversable.Traversable t) => t (m a) -> m (t a) |
| 08:58:44 | <mm_freak_> | dibblego: how is that useful for my purpose? |
| 08:59:09 | <dibblego> | mm_freak_, I'm just guessing -- (Functor f, Functor g) => f a -> g a is certainly useful |
| 08:59:16 | <dibblego> | *not useful |
| 08:59:22 | <mm_freak_> | why not? |
| 08:59:35 | <ivanm> | @hoogle Either a b -> Maybe b |
| 08:59:36 | <lambdabot> | Prelude either :: (a -> c) -> (b -> c) -> Either a b -> c |
| 08:59:36 | <lambdabot> | Data.Either either :: (a -> c) -> (b -> c) -> Either a b -> c |
| 08:59:36 | <lambdabot> | Data.Typeable typeOf2 :: Typeable2 t => t a b -> TypeRep |
| 08:59:38 | <dibblego> | because it can't exist |
| 08:59:54 | <mm_freak_> | class HasTransform f g where trans :: f a -> f b |
| 08:59:58 | <ivanm> | oh, you found that already |
| 09:00:28 | <mm_freak_> | uhm |
| 09:00:31 | <mm_freak_> | silly me |
| 09:00:34 | <mm_freak_> | class HasTransform f g where trans :: f a -> g a |
| 09:01:10 | <mm_freak_> | instance HasTransform (Either l) Maybe where trans (Left _) = Nothing; trans (Right x) = Just x |
| 09:01:23 | <mm_freak_> | i think that would be useful |
| 09:04:05 | <mm_freak_> | even more general: instance MonadPlus m => HasTransform (Either l) m where trans (Left _) = mzero; trans (Right x) = return x |
| 09:07:57 | <Saizan> | it might be nice, though i'm not sure that it's always easy to find a canonical instance for every (f,g) pair |
| 09:08:39 | <mm_freak_> | right |
| 09:09:36 | <mm_freak_> | but i think that any comonad will make an 'f' and any MonadPlus will make a 'g' |
| 09:12:20 | <markb> | how do i use lambdabot to convert a function to point free style? |
| 09:12:46 | <Saizan> | @pl \f g x -> f x (g x) |
| 09:12:47 | <lambdabot> | ap |
| 09:12:56 | <markb> | cheers |
| 09:13:14 | <markb> | @pl \x -> ((x .&. 4) `shiftR` 2) `xor` 1 |
| 09:13:14 | <integral> | @pl \a b -> compare (snd a) (snd b) |
| 09:13:14 | <lambdabot> | (`xor` 1) . (`shiftR` 2) . (.&. 4) |
| 09:13:14 | <lambdabot> | (. snd) . compare . snd |
| 09:13:31 | <Saizan> | integral: compare `on` snd |
| 09:13:35 | <Saizan> | or comparing snd |
| 09:13:46 | <integral> | where's 'on' and 'comparing' from? |
| 09:13:52 | <mmorrow> | @unpl (. snd) . compare . snd |
| 09:13:53 | <lambdabot> | (\ d j -> compare (snd d) (snd j)) |
| 09:13:55 | <Saizan> | Data.Function and Data.Ord |
| 09:14:03 | <mmorrow> | @unpl (`xor` 1) . (`shiftR` 2) . (.&. 4) |
| 09:14:03 | <lambdabot> | (\ f -> xor (shiftR (f .&. 4) 2) 1) |
| 09:14:36 | <integral> | cool, were those new in something like 6.4? |
| 09:14:47 | <integral> | ACTION has been away from following GHC's new versions for a while |
| 09:15:13 | <Saizan> | on is from 6.6.1 i think, comparing i don't know |
| 09:15:17 | <integral> | @src on |
| 09:15:18 | <lambdabot> | (*) `on` f = \x y -> f x * f y |
| 09:15:49 | <integral> | ACTION didn't know you could use sections in patterns either 8-) neat |
| 09:15:50 | <mmorrow> | @type on |
| 09:15:51 | <lambdabot> | forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c |
| 09:15:55 | <mmorrow> | @djinn (b -> b -> c) -> (a -> b) -> a -> a -> c |
| 09:15:56 | <lambdabot> | f a b c _ = a (b c) (b c) |
| 09:16:16 | <mmorrow> | heh, bzzzt |
| 09:16:53 | <mmorrow> | @djinn (a -> a -> c) -> (b -> a) -> b -> b -> c |
| 09:16:53 | <lambdabot> | f a b c _ = a (b c) (b c) |
| 09:17:13 | <mmorrow> | @djinn (a -> a -> b) -> (c -> a) -> c -> c -> b |
| 09:17:13 | <lambdabot> | f a b c _ = a (b c) (b c) |
| 09:17:21 | <ivanm> | mmorrow: are you bored or something? |
| 09:18:10 | <mmorrow> | ivanm: i'm trying to see if it's just a fluke or not that djinn chose that possibility |
| 09:18:18 | <ivanm> | ahhh |
| 09:18:28 | <mmorrow> | (ruled out that djinn cares about names of tyvars) |
| 09:18:52 | <mmorrow> | ohh |
| 09:19:06 | <mmorrow> | err |
| 09:19:45 | <mmorrow> | @djinn (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d |
| 09:19:46 | <lambdabot> | f a b c d = a (b d) (c d) |
| 09:20:25 | <mmorrow> | ACTION gets the djinn code |
| 09:22:23 | <mmorrow> | @pl \a b c d -> a (b d) (c d) |
| 09:22:24 | <lambdabot> | liftM2 |
| 09:23:09 | <mmorrow> | @djinn (s -> s -> c) -> (a -> s) -> (b -> s) -> a -> b -> c |
| 09:23:10 | <lambdabot> | f a b c d e = a (b d) (c e) |
| 09:24:11 | <mmorrow> | @pl \a b c d e -> a (b d) (c e) |
| 09:24:11 | <lambdabot> | ((flip . ((.) .)) .) . (.) |
| 09:24:21 | <Axman6> | obviously |
| 09:24:24 | <mmorrow> | heh |
| 09:24:32 | <Axman6> | :P |
| 09:24:42 | <mmorrow> | @djinn (s -> s -> c) -> (a -> s) -> (b -> s) -> (a,b) -> c |
| 09:24:43 | <lambdabot> | f a b c (d, e) = a (b d) (c e) |
| 09:24:51 | <mmorrow> | @pl \a b c (d, e) -> a (b d) (c e) |
| 09:24:52 | <lambdabot> | flip flip snd . ((flip . (ap .)) .) . flip flip fst . ((flip . ((.) .) . flip . ((.) .)) .) . (.) |
| 09:24:55 | <mmorrow> | arghh |
| 09:25:26 | <Axman6> | as von neumann said: "Premature pointfree optimisation is the root of all evil" |
| 09:25:46 | <solrize> | flip flip ... ? |
| 09:25:51 | <trofi> | :] |
| 09:25:54 | <trofi> | :t flip |
| 09:25:55 | <lambdabot> | forall a b c. (a -> b -> c) -> b -> a -> c |
| 09:26:02 | <Saizan> | ?type flip flip |
| 09:26:03 | <lambdabot> | forall a b c. b -> (a -> b -> c) -> a -> c |
| 09:26:04 | <Axman6> | ACTION doesn't care if that's a bastardised, misattributted quote |
| 09:26:13 | <Saizan> | ?type flip flip flip |
| 09:26:14 | <lambdabot> | forall a c a1 b c1. (a -> ((a1 -> b -> c1) -> b -> a1 -> c1) -> c) -> a -> c |
| 09:26:21 | <Axman6> | > flip flip flip flip |
| 09:26:22 | <lambdabot> | Overlapping instances for Show |
| 09:26:22 | <lambdabot> | ((a -> ... |
| 09:26:29 | <Axman6> | :t flip flip flip flip |
| 09:26:30 | <lambdabot> | forall a b c a1 c1. (a1 -> ((a -> b -> c) -> b -> a -> c) -> c1) -> a1 -> c1 |
| 09:26:41 | <Axman6> | @djinn (a1 -> ((a -> b -> c) -> b -> a -> c) -> c1) -> a1 -> c1 |
| 09:26:42 | <lambdabot> | f a b = a b (\ c d e -> c e d) |
| 09:26:58 | <Saizan> | @pl f a b = a b (\ c d e -> c e d) |
| 09:26:59 | <lambdabot> | f = flip flip flip |
| 09:27:41 | <Axman6> | hmm, docs.python.org down for anyone else? |
| 09:27:54 | <nlogax> | works here |
| 09:28:06 | <Axman6> | hmmm |
| 09:28:25 | <nlogax> | but http://downforeveryoneorjustme.com/docs.python.com says it's not just you :o |
| 09:28:48 | <Axman6> | ACTION can never remember the name of that site |
| 09:28:58 | <trofi> | you are not alone :] |
| 09:29:04 | <mmorrow> | flip . (flip .) is actually really handy |
| 09:29:12 | <mmorrow> | @let flop = flip . (flip .) |
| 09:29:14 | <lambdabot> | Defined. |
| 09:29:25 | <Axman6> | :t flop |
| 09:29:26 | <lambdabot> | forall a1 a b c. (a1 -> a -> b -> c) -> b -> a1 -> a -> c |
| 09:29:40 | <mmorrow> | , foldl 0 [0..9] (\x y -> x+y) |
| 09:29:41 | <lunabot> | luna: The lambda expression `\ x y -> x GHC.Num.+ y' has two arguments, |
| 09:29:43 | <mmorrow> | , flop foldl 0 [0..9] (\x y -> x+y) |
| 09:29:44 | <lunabot> | luna: Not in scope: `flop' |
| 09:29:48 | <mmorrow> | > flop foldl 0 [0..9] (\x y -> x+y) |
| 09:29:49 | <lambdabot> | Couldn't match expected type `a -> b -> a' |
| 09:29:53 | <mmorrow> | so used to hitting , |
| 09:30:00 | <mmorrow> | > (flop foldl) 0 [0..9] (\x y -> x+y) |
| 09:30:01 | <lambdabot> | Couldn't match expected type `a -> b -> a' |
| 09:30:04 | <mmorrow> | grr |
| 09:30:16 | <Saizan> | the list goes first |
| 09:30:16 | <mmorrow> | > (flop foldl) [0..9] 0 (\x y -> x+y) |
| 09:30:17 | <lambdabot> | Overlapping instances for Show (a -> a -> a) |
| 09:30:17 | <lambdabot> | arising from a use ... |
| 09:30:22 | <mmorrow> | > flop foldl [0..9] 0 (\x y -> x+y) |
| 09:30:23 | <lambdabot> | Overlapping instances for Show (a -> a -> a) |
| 09:30:23 | <lambdabot> | arising from a use ... |
| 09:30:26 | <mmorrow> | wut |
| 09:30:35 | <trofi> | [: |
| 09:30:38 | <Saizan> | > flop foldl [0..9] (\x y -> x+y) 0 |
| 09:30:39 | <lambdabot> | 45 |
| 09:30:40 | <mmorrow> | ACTION cries |
| 09:30:49 | <trofi> | :t (flop.flop) |
| 09:30:50 | <lambdabot> | forall a1 a b c. (a1 -> a -> b -> c) -> a -> b -> a1 -> c |
| 09:30:51 | <mmorrow> | oh snap, i messed up flop |
| 09:31:00 | <Saizan> | "is actually really handy" :) |
| 09:31:11 | <mmorrow> | my memory fails me |
| 09:31:52 | <mmorrow> | @pl \f a b c -> flip (flip f a) b c |
| 09:31:52 | <lambdabot> | (flip .) . flip |
| 09:32:08 | <mmorrow> | let flop = flip . (flip .) {- doh -} |
| 09:32:38 | <mmorrow> | @let flap = (flip .) . flip |
| 09:32:38 | <lambdabot> | Defined. |
| 09:33:00 | <mmorrow> | > flap foldl 0 [0..9] (\x y -> x+y) |
| 09:33:02 | <lambdabot> | 45 |
| 09:33:11 | <mmorrow> | for when you have long lambdas |
| 09:33:35 | <ivanm> | mmorrow: who's going around stretching lambdas horizontally? |
| 09:33:43 | <mmorrow> | i do: |
| 09:33:58 | <mmorrow> | flap foldl z xs (\x y -> |
| 09:34:01 | <mmorrow> | ............ |
| 09:34:24 | <mmorrow> | GOTO LINE+1 |
| 09:34:46 | <Axman6> | ACTION waits for velociraptors to attack mmorrow |
| 09:34:52 | <mmorrow> | or starting the lamdaba on the next line |
| 09:36:48 | <trofi> | $ would destroy trailing bracket |
| 09:38:25 | <mmorrow> | i like the parens for lambda-guts-retension, personally |
| 09:38:36 | <mmorrow> | i used to like it the opposite way though.. |
| 09:44:25 | <dan> | I'm getting an internal error in ghci-6.10.3 when using the array package :( |
| 09:44:37 | <dan> | 6.10.2 works fine... |
| 09:44:54 | <mmorrow> | what's the msg? |
| 09:44:56 | <ivanm> | what kind of error? |
| 09:45:11 | <ivanm> | AFAIK, 6.10.3 was just a bugfix |
| 09:45:21 | <ivanm> | though they didn't fix the ghc-pkg bug :@ |
| 09:45:21 | <dan> | *Test Data.Array> a |
| 09:45:21 | <dan> | Loading package syb ... linking ... done. |
| 09:45:21 | <dan> | Loading package array-0.2.0.0 ... <interactive>: internal error: loadObj: error whilst reading `C:\ghc\GHC-61~1.3\array-0.2.0.0\HSarray-0.2.0.0.o' |
| 09:45:21 | <dan> | (GHC version 6.10.3 for i386_unknown_mingw32) |
| 09:45:22 | <dan> | Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug |
| 09:45:53 | <dan> | and the code is just |
| 09:45:55 | <ivanm> | :o |
| 09:45:59 | <dan> | module Test where |
| 09:46:00 | <dan> | import Data.Array |
| 09:46:00 | <dan> | a="foobar" |
| 09:46:00 | <dan> | |
| 09:46:00 | <dan> | |
| 09:46:20 | <trofi> | HSarray looks broken |
| 09:46:53 | <ivanm> | dan: ummm.... so a is a String? |
| 09:47:02 | <dan> | yup |
| 09:47:06 | <ivanm> | ACTION fails to see why array is complaining... |
| 09:47:12 | <ivanm> | maybe a dodgy windows build? |
| 09:47:19 | <dan> | it can also be a numbee whatever |
| 09:47:36 | <dan> | i just can't do the import from a ghc file (works fine from an interactive shell) |
| 09:47:50 | <Axman6> | cabal install --reinstall hsarray? |
| 09:47:59 | <dan> | ill try that |
| 09:48:18 | <ivanm> | Axman6: isn't it just array? not hsarray? |
| 09:48:25 | <Axman6> | no idea |
| 09:50:04 | <mmorrow> | @let assocl (a,(b,c)) = ((a,b),c) |
| 09:50:05 | <lambdabot> | Defined. |
| 09:50:13 | <mmorrow> | @let assocr ((a,b),c) = (a,(b,c)) |
| 09:50:14 | <lambdabot> | Defined. |
| 09:50:22 | <mmorrow> | @let swap = uncurry (flip (,)) |
| 09:50:23 | <lambdabot> | <local>:9:0: |
| 09:50:23 | <lambdabot> | Multiple declarations of `L.swap' |
| 09:50:23 | <lambdabot> | Declared at: <local... |
| 09:50:41 | <mmorrow> | @let swop = uncurry (flip (,)) |
| 09:50:42 | <lambdabot> | Defined. |
| 09:50:59 | <mmorrow> | @type assocl . swap . assocr |
| 09:51:01 | <lambdabot> | forall t1 t2 t11 t21. (((t1, t2), t11), t21) -> (((t11, t21), t1), t2) |
| 09:51:10 | <mmorrow> | @type assocl . swop . assocr |
| 09:51:11 | <lambdabot> | forall t1 t2 t11 t21. (((t1, t2), t11), t21) -> (((t11, t21), t1), t2) |
| 09:51:35 | <mmorrow> | oh |
| 09:52:00 | <mmorrow> | @type assocr . first swop . assocl |
| 09:52:01 | <lambdabot> | forall t t1 t2. (t, (t1, t2)) -> (t1, (t, t2)) |
| 09:52:13 | <mmorrow> | @type assocl . second swop . assocr |
| 09:52:15 | <lambdabot> | forall t t1 t2. ((t, t1), t2) -> ((t, t2), t1) |
| 09:54:16 | <mmorrow> | ACTION is writing all the helpers that he duplicates over and over again down in a single module for good |
| 09:54:24 | <trofi> | :] |
| 09:54:40 | <trofi> | arg-permutator |
| 09:55:07 | <mmorrow> | handay for => Map a (Map b c) -> Map b (Map a c) |
| 09:55:57 | <mmorrow> | well, Map a (Map b (Set c)) -> Map b (Map a (Set c)) |
| 09:56:12 | <mmorrow> | in general so you don't lose any |
| 09:57:16 | <dan> | well, seems the problem is with my HD |
| 09:57:27 | <dan> | getting a device IO error when trying to read the array package |
| 09:57:30 | <dan> | :/ |
| 09:57:54 | <dan> | so haskell is not broken but computers are |
| 09:57:58 | <trofi> | екн ысфтвшыл ше |
| 09:58:05 | <trofi> | try scandis drive |
| 09:58:24 | <mmorrow> | @let gather (<>) f g = foldl' (\m a -> M.insertWith' (<>) (f a) (g a) m) mempty |
| 09:58:24 | <lambdabot> | Defined. |
| 09:58:47 | <trofi> | it might be not a hardware problem, but improperly shutdown system |
| 09:59:21 | <dan> | if i reboot and still can't access the file, it means it's a hardware problem - right? |
| 09:59:35 | <dan> | after the usual scandisk |
| 10:00:25 | <trofi> | can't access means you can't copy it or get garbage when copy it? |
| 10:00:32 | <dan> | can't copy it |
| 10:00:59 | <trofi> | yes, it may be HW problem |
| 10:01:02 | <dan> | trofi: you mean chkdsk, right? |
| 10:01:40 | <mm_freak_> | say i'm storing a lot of ByteStrings, if they are in NF, does it matter whether my ByteStrings are lazy? |
| 10:01:48 | <trofi> | scandisk. you can chose scan your disk after reboot |
| 10:02:05 | <mm_freak_> | i recall that lazy ByteStrings are just a list of fixed-size strict ByteStrings |
| 10:03:31 | <RayNbow> | ACTION is completely baffled why he cannot visit http://research.microsoft.com/en-us/people/simonpj/ at home in certain circumstances... |
| 10:03:49 | <Twey> | RayNbow: What happens? |
| 10:03:54 | <RayNbow> | timeouts |
| 10:04:03 | <RayNbow> | but here's the most puzzling aspect |
| 10:04:06 | <RayNbow> | not working: XP/IE7, XP/FF3, ArchLinux/FF3 |
| 10:04:13 | <Twey> | Hmn |
| 10:04:31 | <RayNbow> | working: XP/FF3+university proxy, XP/Opera, XP/Lynx, XP/wget, ArchLinux/Lynx, ArchLinux/wget |
| 10:04:41 | <Taejo> | RayNbow: I seem to be having trouble on Ubuntu/FF3 |
| 10:04:42 | <RayNbow> | ^ this is what I just don't seem to get |
| 10:05:00 | <bremner> | RayNbow: I think it is a network issue from what I remember... |
| 10:05:32 | <RayNbow> | bremner: but how could it be a network issue if it works in a different browser? |
| 10:06:36 | <bremner> | umm. good point. OK, well, I have had intermittent trouble with that site, not sure about browsers, I mostly use konqueror |
| 10:06:54 | <RayNbow> | on the other hand, you could be right though |
| 10:07:08 | <RayNbow> | last evening I spied on my network traffic using Wireshark |
| 10:07:25 | <RayNbow> | I did notice a lot of TCP retransmissions when I tried to access MSResearch |
| 10:34:21 | <mux> | @seen dons |
| 10:34:21 | <lambdabot> | dons is in #haskell-in-depth, #concatenative, #arch-haskell, #darcs, #yi, #xmonad, #ghc and #haskell. I last heard dons speak 3h 21m 34s ago. |
| 10:36:58 | <eu-prleu-peupeu> | something to think about: http://en.wikipedia.org/wiki/C%2B%2B0x#Type_inference |
| 10:54:47 | <mmorrow> | @pl \g f k -> k (g . f) |
| 10:54:47 | <lambdabot> | (flip id .) . (.) |
| 11:01:09 | <wraithan> | Sup, I am back |
| 11:03:02 | <u_quark> | what is the best way to make an Array an instance of Arbitrary in QuickCheck ? |
| 11:03:45 | <Botje> | cheat off the List instance? |
| 11:06:34 | <mm_freak_> | haskell.org has had far too many downtimes recently |
| 11:06:56 | <mm_freak_> | ok, it's not down, but it takes it forever to respond |
| 11:07:23 | <Axman6> | u_quark: elements? |
| 11:07:56 | <u_quark> | so there is no good way to do this using only the API of QuickCheck ? |
| 11:08:48 | <u_quark> | Axman6: elements ?? how ? |
| 11:08:49 | <Botje> | didn't i just tell you how you could do it ? |
| 11:08:59 | <Botje> | take the List instance and modify it a bit |
| 11:09:13 | <Axman6> | yeah, use elements to just use the list instance |
| 11:09:16 | <Botje> | it already has support for random lengths |
| 11:09:21 | <u_quark> | yes :) just asking ... |
| 11:09:47 | <Botje> | if you're really lazy you can just do arbitrary = fromList `fmap` arbitrary |
| 11:09:52 | <Axman6> | hmm, think i may have mis understood the question |
| 11:09:59 | <Botje> | where fromList :: [a] -> Array i a |
| 11:10:10 | <Saizan> | i don't see the problem with that approach :) |
| 11:10:27 | <Saizan> | you're going to build the array with listArray or similar anyhow |
| 11:12:55 | <u_quark> | ok tnx all |
| 11:27:00 | <Pellwurst> | is there an easy way to get the current time/date (formatted)? |
| 11:27:36 | <Wraithan> | :i Data.Info |
| 11:27:38 | <ivanm> | there is, but it will be formatted according to the American system IIRC |
| 11:27:39 | <Wraithan> | :i Data.Time |
| 11:27:52 | <ivanm> | Wraithan: I don't think lambdabot recognises :i |
| 11:27:58 | <Wraithan> | Ah |
| 11:28:07 | <ivanm> | Pellwurst: either in Data.Time or System.Time, something like that |
| 11:28:16 | <Pellwurst> | k, thx |
| 11:28:30 | <Wraithan> | System.Time is deprecated or that is what I read when I was looking for time stuff, Data.Time is what you want |
| 11:28:45 | <Wraithan> | And you can choose how to format it using Data.Time.Format |
| 11:29:25 | <ivanm> | Pellwurst: have a look at the "today" function here: http://code.haskell.org/Graphalyze/Data/Graph/Analysis/Reporting.hs |
| 11:30:28 | <ivanm> | Wraithan: or else System.Locale's stuff for formatting |
| 11:42:00 | <mux> | ACTION does some more cleanup to System.BSD.Sysctl before uploading it to hackage |
| 11:42:34 | <xian> | Sorry for this newbie'ish question, but what's Haskell's equivalent of Lisp's remove-duplicates? (A quick Google search didn't turn up anything useful) |
| 11:42:45 | <mauke> | sounds like nub |
| 11:42:53 | <byorgey> | > nub [1,2,3,2,4,4,1,2] |
| 11:42:54 | <lambdabot> | [1,2,3,4] |
| 11:43:02 | <Pellwurst> | ivanm: how can i install the Data.Time package? i cant import it. |
| 11:43:07 | <xian> | Great, thanks. |
| 11:43:31 | <ivanm> | Pellwurst: I think it's the time package on hackage |
| 11:43:40 | <ivanm> | System.Time is old-time, right? |
| 11:43:57 | <Baughn_> | xian: Note that nub is kind of slow (it has to be) on large lists. Set.toList . Set.fromList is faster. For large lists. |
| 11:44:28 | <Baughn_> | xian: (However, nub maintains order; Set sorts them) |
| 11:45:01 | <mauke> | :t mapAccumL |
| 11:45:02 | <lambdabot> | forall acc x y. (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y]) |
| 11:46:39 | <Saizan_> | nub is lazier |
| 11:48:36 | <mauke> | > snd . foldl (\z@(s, xs) x -> if x `S.member` s then z else (S.insert x s, x : xs)) (S.empty, []) $ "foo bar baz" |
| 11:48:38 | <lambdabot> | /tmp/8484947192528556890:70:66: Not in scope: `S.member'/tmp/84849471925285... |
| 11:48:48 | <mauke> | :t S.member |
| 11:48:50 | <lambdabot> | forall a. (Ord a) => a -> S.Set a -> Bool |
| 11:48:51 | <mauke> | what |
| 11:49:17 | <Botje> | > S.member |
| 11:49:18 | <lambdabot> | Overlapping instances for Show (a -> S.Set a -> Bool) |
| 11:49:18 | <lambdabot> | arising fr... |
| 11:49:26 | <Botje> | it does know it |
| 11:49:52 | <Botje> | > S.member undefined S.empty |
| 11:49:52 | <mauke> | > S.empty |
| 11:49:54 | <lambdabot> | /tmp/2755912368993524889:70:32: Not in scope: `S.member'/tmp/27559123689935... |
| 11:49:54 | <lambdabot> | /tmp/984034499413416886:70:32: Not in scope: `S.empty' |
| 11:50:04 | <Botje> | weeiiiird |
| 11:50:05 | <mux> | mmmm, adding a directory to Data-Dir in a cabal file doesn't seem to be enough to have cabal sdist put this directory in the tarball |
| 11:55:17 | <mux> | alright, Data-Files is enough |
| 12:09:26 | <dcoutts> | mux: data-dir is to say where data files are looked for, so that it's not just relative to $top |
| 12:09:59 | <dcoutts> | eg so you can organise your build tree like $top/src/ and $top/data/ |
| 12:13:22 | <mux> | dcoutts: ah, okay, thanks |
| 12:13:38 | <mux> | ACTION just uploaded bsd-sysctl-1.0.0 on hackage |
| 12:18:01 | <jaj> | mux: hey cool! |
| 12:18:54 | <jaj> | this can be used to get battery information in xmobar for example |
| 12:19:16 | <mux> | ACTION nods |
| 12:19:21 | <mux> | jaj: are you running OpenBSD? |
| 12:19:25 | <jaj> | mux: yeah |
| 12:19:47 | <mux> | jaj: I think the package wouldn't build there, because OpenBSD seems to lack both sysctlbyname() and sysctlnametomib() |
| 12:20:05 | <jaj> | true |
| 12:20:08 | <mux> | I'll probably have to #ifdef some code so that it still builds without name lookup |
| 12:20:18 | <mux> | (should be pretty easy) |
| 12:20:43 | <mux> | if you check out the demo program included in the example, you'll see how easy and cool it is to get the list of process from a sysctl ;-) |
| 12:20:52 | <mux> | s/example/tarball/ |
| 12:21:20 | <jaj> | by the way I just finished a ghc-6.10.3 port for openbsd: http://www.hcl-club.lu/~jaj/ports/tgz/ |
| 12:21:23 | <jaj> | I'm currently testing it |
| 12:21:51 | <mux> | the FreeBSD haskell ports are in a sorry state unfortunately |
| 12:22:04 | <jaj> | mux: on openbsd it's worse ;) |
| 12:22:18 | <mux> | heh, but we are real men anyways, we build via source :-P |
| 12:23:00 | <jaj> | mux: my P4 does not agree |
| 12:23:06 | <NEEDMOAR> | Haha. |
| 12:23:16 | <mux> | I recently switched from an ooold athlon box to a core i7 one :-) |
| 12:23:24 | <NEEDMOAR> | I'm tired of broken ports :-( |
| 12:23:26 | <mux> | needless to say, it builds faster than hell |
| 12:25:01 | <mux> | anyone running NetBSD? this package _should_ build fine there |
| 12:25:04 | <jaj> | I'll have to dig into sysctl(8) under openbsd to see how it does lookups |
| 12:25:19 | <mux> | jaj: via the "old" way only, an array of integers |
| 12:25:31 | <mux> | I just have to disable some part of my code for the module to build on OpenBSD |
| 12:25:32 | <burp_> | jaj, awesome, but just x86, right? |
| 12:25:49 | <mux> | if you want to do it and send me a patch that'd be nice :-) |
| 12:25:53 | <jaj> | burp_: currently building on amd64 |
| 12:25:59 | <burp_> | ok, I got openbsd on macppc |
| 12:26:37 | <mux> | ACTION wonders if he'll be able to have dons rewrite cpuperf using this module |
| 12:26:40 | <jaj> | burp_: hmm that won't work :) |
| 12:26:45 | <burp_> | yup :( |
| 12:27:37 | <jaj> | burp_: it uses ghc-6.6.1 to bootstrap 6.10.3 and I don't know whether 6.6.1 in ports will build on macppc. I don't have a macppc machine myself |
| 12:28:09 | <mux> | ACTION patiently waits for the haddock documentation to get generated |
| 12:28:11 | <jaj> | burp_: you could give it a try |
| 12:29:01 | <jaj> | burp_: comment out ONLY_FOR_ARCHS and see how far you can get |
| 12:29:16 | <burp_> | guess not far ;) |
| 12:29:57 | <jaj> | is macppc officially supported by ghc? |
| 12:30:49 | <burp_> | ghc works with os x macppc |
| 12:31:50 | <jaj> | you'd probably have to generate .hc files for ghc-6.6 |
| 12:32:48 | <koeien> | ACTION has written an MD6 implementation, wee |
| 12:33:08 | <mux> | koeien: did you use Cryptol? :) |
| 12:33:17 | <koeien> | mux: no |
| 12:36:26 | <koeien> | it's not particularly efficient btw |
| 12:39:08 | <dibblego> | is join . repeat in the standard libraries? |
| 12:39:32 | <Baughn_> | @type join . repeat |
| 12:39:33 | <lambdabot> | forall a. [a] -> [a] |
| 12:39:34 | <mauke> | :t cycle |
| 12:39:35 | <lambdabot> | forall a. [a] -> [a] |
| 12:39:35 | <koeien> | cycle |
| 12:39:42 | <dibblego> | ah yeah ta |
| 12:47:38 | <Botje> | what does join . repeat do ? |
| 12:47:43 | <Berengal> | Botje: cycle |
| 12:47:53 | <Botje> | obviously :P |
| 12:48:08 | <Botje> | oh, repeat [a] generates [[a]] |
| 12:48:13 | <Botje> | and join is concat |
| 12:48:16 | <Botje> | i get it :) |
| 12:48:17 | <Botje> | carry on! |
| 12:48:28 | <Berengal> | ACTION carries on |
| 12:48:46 | <Botje> | whee, overflow ;) |
| 12:49:40 | <stroan> | You when create an array from a list. Is the whole list evaluated then and there? |
| 12:50:05 | <stroan> | Just trying to figure out how arrays get O(1) access time |
| 12:50:09 | <Berengal> | stroan: Only the spine and the indexes |
| 12:50:54 | <stroan> | ok, makes sense. |
| 12:57:11 | <Angel> | What would you recommend for a basic Haskell editor/IDE? I've seen EclipseFP and leskah so far but they're a bit overkill for my needs (syntax highlighting, quick access to the interpreter and such) Thanks :) |
| 12:57:21 | <ivanm> | emacs |
| 12:57:28 | <ivanm> | or vim, if you swing that way |
| 12:58:16 | <Philippa> | Angel: anything with highlighting and a console tab |
| 12:58:27 | <Philippa> | what platform're you on? |
| 12:59:07 | <Angel> | I'd heard of Emacs but it sounded on the heavy side... let me have a look then. I'm on Linux by the way |
| 12:59:19 | <jaj> | haddock: out of memory (requested 1048576 bytes) |
| 12:59:27 | <jaj> | there goes the amd64 build :( |
| 12:59:30 | <p_l> | Emacs is not heavy nowadays. Especially if you're comparing with Eclipse :D |
| 12:59:45 | <david_> | hmm, is there built in reg exp in haskell? |
| 13:00:02 | <Philippa> | Angel: gedit, jedit, kate... |
| 13:00:54 | <david_> | and with built-in I mean bundled with ghc |
| 13:01:20 | <Philippa> | Text.Regex.* or similar? |
| 13:01:25 | <pejo> | "Eight Megs And Constantly Swapping" |
| 13:01:29 | <mux> | david_: yes, you have Text.Regex.* in the regex-* packages that are builtin GHC |
| 13:02:01 | <Philippa> | pejo: yeah, well. I expect any good-for-modern-machines environment to do that |
| 13:02:02 | <ivanm> | pejo: yes, but most computers have much more than 8 MB of RAM available nowadays... |
| 13:02:53 | <david_> | thanks |
| 13:15:46 | <mwoehrle> | /? |
| 13:16:06 | <mauke> | ¿\ |
| 13:17:07 | <Eelis> | heh, i see utf8-string is unlikely to be in the platform. so much for "batteries included" |
| 13:19:21 | <mhaggag> | Hello, I'm a haskell newbie going through "Real World Haskell". I'm at Chapter 4, where I implement a function asInt_either which converts a string to an integer or produces an error string (using Either String Int). |
| 13:19:35 | <mhaggag> | I have an implementation here: http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2436#a2436 |
| 13:19:51 | <mhaggag> | I was wondering if there was a better way to "format" the error message? A la printf. |
| 13:19:58 | <mhaggag> | (Line 12 in the above paste) |
| 13:20:12 | <mauke> | well, you could use printf |
| 13:20:18 | <Botje> | as a matter of fact, there _is_ a Text.Printf |
| 13:20:19 | <mhaggag> | :D |
| 13:20:24 | <Botje> | but it's a bit weird to use, so be warned ;) |
| 13:20:33 | <Saizan_> | Eelis: you can propose it for the next version :) |
| 13:20:34 | <mux> | and can fail at runtime |
| 13:20:35 | <mhaggag> | Cool, didn't know that. Can you give me a quick example? |
| 13:20:51 | <mauke> | Left (printf "non-digit encountered '%c'" x) |
| 13:20:54 | <Eelis> | Saizan_: it was, and the proposal is getting negative comments |
| 13:20:55 | <mux> | > printf "%.*s" 3 "foobar" |
| 13:20:57 | <lambdabot> | Add a type signature |
| 13:21:01 | <mux> | > printf "%.*s" 3 "foobar" :: String |
| 13:21:03 | <lambdabot> | "* Exception: Printf.printf: bad formatting char * |
| 13:21:10 | <mux> | pft :) |
| 13:21:19 | <mauke> | mux: get printf-mauke instead |
| 13:21:23 | <mauke> | it's fixed there |
| 13:21:27 | <mux> | I've _used_ this in the past |
| 13:21:38 | <mux> | that was for a %.*f though |
| 13:21:57 | <mhaggag> | Interesting. On a sidenote, RWH mentions early on that Haskell's type system makes it difficult to write variadic functions. Isn't printf such a function? |
| 13:21:58 | <mux> | mauke: why isn't your fix merged to Text.Printf ? |
| 13:22:14 | <mauke> | mux: ask the maintainer |
| 13:22:18 | <mux> | mhaggag: yes, it uses advanced type-class hackery to make this work |
| 13:22:22 | <mux> | mauke: I see :-) |
| 13:22:53 | <mauke> | I found and fixed a few bugs in printf, then wrote a bug report |
| 13:23:11 | <mhaggag> | mux, oh I see. So it's not impossible, but difficult. Does it involve half-assed hacks a la C++ pseudo-variadic templates? (i.e. essentially writing the template for N possible parameters) |
| 13:23:14 | <mauke> | after a few months of inactivity I released my own printf |
| 13:23:29 | <mux> | mhaggag: no, it involves making function types instances of the class |
| 13:23:52 | <mwoehrle> | hey everyvody! anybody knows how to do a "pause for x milliseconds"-step in an io-do-sequence? |
| 13:24:05 | <mauke> | :t threadDelay |
| 13:24:06 | <lambdabot> | Not in scope: `threadDelay' |
| 13:24:14 | <mhaggag> | mux: that went right over my head :D I guess I'll get to it when I get to it, but I'm relieved to know that it's not a hack. The type system is growing on me, so I was kinda weary when I hit that warning in RWH |
| 13:24:14 | <mux> | mauke: I read a paper about a new printf implementation using ATs |
| 13:24:30 | <trofi> | hoogle delay |
| 13:24:39 | <mux> | mhaggag: the type system always has a few tricks up its sleeves :) |
| 13:24:49 | <mauke> | mhaggag: http://okmij.org/ftp/Haskell/types.html#polyvar-fn (teehee) |
| 13:25:05 | <mux> | *beware* of okmij.org links |
| 13:25:15 | <mux> | it makes haskell beginners' brains melt |
| 13:25:29 | <Botje> | s/beginners'// |
| 13:25:32 | <mmorrow> | preflex: seen rwbarton |
| 13:25:32 | <preflex> | Sorry, I haven't seen rwbarton |
| 13:25:40 | <mmorrow> | @seen rwbarton |
| 13:25:41 | <lambdabot> | Last time I saw rwbarton was when I left ##freebsd, ##hrg, ##logic, #arch-haskell, #concatenative, #darcs, #dreamlinux-es, #friendly-coders, #functionaljava, #gentoo-haskell, #gentoo-uy, #ghc, # |
| 13:25:41 | <lambdabot> | haskell, #haskell-blah, #haskell-books, #haskell-freebsd, #haskell-overflow, #haskell-soc, #haskell.cz, #haskell.de, #haskell.dut, #haskell.es, #haskell.fi, #haskell.fr, #haskell.hr, #haskell.it, # |
| 13:25:41 | <lambdabot> | haskell.jp, #haskell.no, #haskell.ru, #haskell.se, #haskell_ru, #jhc, #jtiger, #macosx, #macosxdev, #novalang, #rosettacode, #scala, #scannedinavian, #unicycling and #xmonad 3m 25d 7h 54m 47s ago, |
| 13:25:41 | <lambdabot> | and . |
| 13:25:42 | <mwoehrle> | thanks, mauke, that looks good! |
| 13:27:06 | <mhaggag> | mauke: Oy! Didn't know Oleg did haskell. I've visited that page tons of times, but never noticed :O |
| 13:27:25 | <mauke> | haha |
| 13:28:01 | <mauke> | where do you know him from? |
| 13:28:22 | <mhaggag> | reddit.com/r/programming. People link to him often. |
| 13:28:42 | <mux> | heh, no wonder |
| 13:29:03 | <povman> | Am I an inherently bad person if I start my program with {-# LANGUAGE ExistentialQuantification #-} ? |
| 13:29:10 | <povman> | I feel like I'm breaking the rules. |
| 13:29:47 | <mux> | well, look at the number of LANGUAGE directives in Oleg sources :-) |
| 13:30:00 | <mmorrow> | mauke: if you ever get the desire for a TH printf , here's (a minimal/compact/copy-pasteable) one that i've been meaning to add formats to for a while (see `parse') http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=1929#a1930 |
| 13:30:27 | <povman> | I guess the real question is: will existential quantification be on by default in the next revision of Haskell? |
| 13:30:57 | <mmorrow> | , $(printf "%s %d %d") "omg" 42 |
| 13:31:00 | <lunabot> | luna: No instance for (GHC.Show.Show (a[a78e] -> GHC.Base.String)) |
| 13:31:02 | <mux> | povman: this is very likely |
| 13:31:34 | <mux> | but I thought one only needed Rank2Types |
| 13:31:59 | <mmorrow> | > printf "%s %d %d" "omg" 42 :: String |
| 13:32:00 | <lambdabot> | "omg 42 * Exception: Printf.printf: argument list ended prematurely |
| 13:37:42 | <naxa> | hi folks! Can someone help me, what's wrong with "take (2^400) [n | n <- [1..], n `mod`7==0 ]" ? |
| 13:37:58 | <mauke> | 2^400 doesn't fit in an Int |
| 13:38:12 | <mux> | try genericTake |
| 13:38:12 | <mmorrow> | , 2^400 |
| 13:38:14 | <lunabot> | 2582249878086908589655919172003011874329705792829223512830659356540647622... |
| 13:38:17 | <mmorrow> | lol |
| 13:38:22 | <naxa> | thanks :) |
| 13:38:25 | <mux> | or maybe take less things :p |
| 13:38:39 | <voker57_> | yeah, don't be greedy |
| 13:38:39 | <mmorrow> | or just take infinitely many |
| 13:39:06 | <mauke> | [ n * 7 | n <- [1 .. 2^400] ] |
| 13:39:19 | <naxa> | actually I just wanted to have a nice day watching how Haskell does all the previously impossible work |
| 13:39:32 | <mmorrow> | > (2^400) `div` (fromIntegral (maxBound::Int)) |
| 13:39:34 | <lambdabot> | 279968092772225526350034486512082551501613288563091086863452994768954854897... |
| 13:39:45 | <mauke> | > [7, 14 .. 7 * 2^400] |
| 13:39:46 | <lambdabot> | [7,14,21,28,35,42,49,56,63,70,77,84,91,98,105,112,119,126,133,140,147,154,1... |
| 13:40:16 | <naxa> | hey guys thanks! :) |
| 13:47:40 | <mhaggag> | Can you guys help me understand ghc's following error better: http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2437#a2437 |
| 13:48:00 | <mhaggag> | It took me a while to figure out the problem, but I'm trying to understand why ghc reports the error that way |
| 13:48:54 | <mhaggag> | Why is it "constructing an infinite type a = [a]" when I pass in an element instead of a list to ++? |
| 13:49:15 | <skorpan> | :t (++) |
| 13:49:17 | <lambdabot> | forall a. [a] -> [a] -> [a] |
| 13:49:25 | <skorpan> | hm... |
| 13:49:44 | <mauke> | the arguments of ++ have the same type, therefore typeof(acc) == typeof(x) |
| 13:50:09 | <mhaggag> | skorpan: A bit of context: I'm a newbie going through real-world haskell, so the :type information just printed doesn't make any sense to me :O |
| 13:50:18 | <mauke> | takeWhile returns the result of helper, which is acc. therefore typeof(acc) == [a] |
| 13:50:32 | <skorpan> | mhaggag: the type information *should* make sense to you... [a] is a list of any type a |
| 13:50:34 | <Saizan_> | and only [[[..]]] ad infinitum will satisfy a = [a] |
| 13:50:59 | <mauke> | you're calling pred x and pred takes 'a', so typeof(x) == a |
| 13:51:02 | <mhaggag> | skorpan: I get that part. I'm not sure what the "forall a." part is. |
| 13:51:09 | <mauke> | together this means that [a] == a |
| 13:51:42 | <kpreid> | mhaggag: don't worry about that part yet |
| 13:51:51 | <mhaggag> | mauke: Ah, so during type unification it tries to construct a type that satisfies [a] == a which is impossible? |
| 13:52:00 | <mauke> | yes |
| 13:52:44 | <mauke> | the occurs check disallows unifying a variable x with another type containing x |
| 13:52:52 | <skorpan> | mhaggag: for the time being just know that "forall a." is implied when you write "[a] -> [a] -> [a]" or anything with an "a" in it. there are exceptions, but meh... |
| 13:53:33 | <mhaggag> | mauke: That makes it much clearer, thanks. I was somewhat confused by the 'constructing a type' part of the error, but now I see where it's coming from. |
| 13:54:26 | <mhaggag> | skorpan: I see. |
| 13:54:34 | <tetha> | skorpan: are there types with exists a.? (I'm just comparing this to quantifiers I know) |
| 13:55:01 | <skorpan> | tetha: not in the same way, afaik |
| 13:55:15 | <skorpan> | (i'm no expert!) |
| 13:57:48 | <mhaggag> | So, in the error message, why doesn't the compiler point out the offending expression explicitly? It seems to do this often to me, and I find it very helpful. (I realize this is a bit of a compiler/implementation detail) |
| 13:57:54 | <vixey> | exists doesn't exist |
| 13:58:07 | <vixey> | well EHC has it |
| 13:58:29 | <skorpan> | if i have "data A = A Int | B String", would you refer to "A Int" as a constructor or just "A"? |
| 13:58:39 | <mauke> | mhaggag: there is no single offending expression |
| 13:58:48 | <mauke> | skorpan: just A |
| 14:00:06 | <mhaggag> | mauke: Hmm...isn't the infinite type construction attempt occur during inferring the expression (acc ++ x)? |
| 14:00:17 | <mhaggag> | occurring* |
| 14:00:34 | <mauke> | no, that just makes typeof(acc) == typeof(x) |
| 14:00:41 | <mhaggag> | Oh, right |
| 14:00:57 | <mhaggag> | The typeof(acc) is inferred from takeWhile itself |
| 14:01:16 | <mhaggag> | which is why the whole thing is flagged, because the problem could be on either side: acc or x |
| 14:12:02 | <stroan> | hmm, when the docs told me to go make a cup of tea while wxHaskell builds, they were giving sound advice :P |
| 14:13:12 | <mauke> | mhaggag: so I looked at your function again with my brain enabled ... why are you using a helper function/accumulator? |
| 14:13:55 | <mauke> | takeWhile pred (x : xs) | pred x = x : takeWhile pred xs; takeWhile _ _ = [] |
| 14:13:56 | <mhaggag> | mauke: Let me take a look at it again. I have this habit of defaulting to an accumulator from when I started learning functional programming in scheme. |
| 14:14:20 | <mauke> | accumulators are a bad idea because they lead to tail recursion :-) |
| 14:14:41 | <mhaggag> | ..is that a bad thing? |
| 14:14:48 | <mauke> | in this case, yes |
| 14:15:11 | <mauke> | > takeWhile (\_ -> True) [1 ..] |
| 14:15:12 | <lambdabot> | [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... |
| 14:15:21 | <mauke> | consider infinite lists |
| 14:19:02 | <mhaggag> | ACTION smacks forehead |
| 14:19:12 | <mhaggag> | Man, I guess laziness still hasn't sunk in |
| 14:19:52 | <mhaggag> | But if I write my functions in a non-tail-recursive way, is the compiler still able to transform them automatically into loops? |
| 14:19:58 | <mauke> | > foldr (\x _ -> x) (error "head: empty list") [1,2,3] |
| 14:20:00 | <lambdabot> | 1 |
| 14:20:03 | <mauke> | > foldr (\x _ -> x) (error "head: empty list") [] |
| 14:20:04 | <lambdabot> | * Exception: head: empty list |
| 14:20:48 | <mauke> | I don't think it has to |
| 14:21:13 | <mauke> | laziness transposes control flow |
| 14:22:09 | <mhaggag> | Well, I guess it's a case of me carrying assumptions over from other languages over to haskell when I still haven't grokked it yet. In strict languages tail-recursion was essential to produce tight code that wouldn't stack overflow. I guess that doesn't readily apply in haskell? (at least not directly) |
| 14:23:07 | <mhaggag> | So when would I write a tail-recursive implementation in haskell? (I realize that's rather vague..but I'm certain I've seen a couple of tail-recursive implementations so far in RWH) |
| 14:23:36 | <mauke> | when it makes sense :-) |
| 14:23:47 | <mauke> | @src foldl |
| 14:23:47 | <lambdabot> | foldl f z [] = z |
| 14:23:47 | <lambdabot> | foldl f z (x:xs) = foldl f (f z x) xs |
| 14:23:58 | <mauke> | this foldl can actually cause stack overflows |
| 14:24:24 | <mhaggag> | Oh, this is the Prelude one right? The one that can overflow the thunk evaluation/storage/execution stack? (Still vague on the whole notion of thunks..) |
| 14:24:27 | <EvilTerran> | > foldl (+) 0 [1..10^9] |
| 14:24:57 | <Astro> | @hoogle ByteString -> [Word64] |
| 14:25:07 | <Astro> | !hoogle ByteString -> [Word64] |
| 14:25:10 | <lambdabot> | mueval: Prelude.read: no parse |
| 14:25:10 | <lambdabot> | Data.ByteString zipWith :: (Word8 -> Word8 -> a) -> ByteString -> ByteString -> [a] |
| 14:25:10 | <lambdabot> | Data.ByteString.Lazy zipWith :: (Word8 -> Word8 -> a) -> ByteString -> ByteString -> [a] |
| 14:25:10 | <lambdabot> | Data.ByteString.Char8 zipWith :: (Char -> Char -> a) -> ByteString -> ByteString -> [a] |
| 14:27:36 | <mhaggag> | So, to conclude: In Haskell, one doesn't write tail-recursive code unless the problem itself translates well into tail-recursive code? As in, don't use tail-recursion as a looping construct (a la Scheme) |
| 14:28:25 | <mauke> | I think so |
| 14:28:28 | <vixey> | mhaggag: if you want to write scheme style tail recursive code you can do that (just insert ! everywhere), It's not a usual approach to programming in Haskell though |
| 14:28:33 | <mauke> | our loops are lists, not tail recursion |
| 14:28:36 | <Berengal> | mhaggag: Sure, you can use tail recursion, but it's more important to beware of how much recursion has to be done to create a constructor |
| 14:29:09 | <Berengal> | foldl needs to recurse through the entire list. map only needs to recurse once |
| 14:30:05 | <Berengal> | We do like lists though... |
| 14:30:11 | <mhaggag> | Berengal: could you elaborate on the "...recursion to be done to create a constructor"? |
| 14:30:24 | <mauke> | map f (x : xs) = f x : map f xs |
| 14:30:33 | <mauke> | (:) is a constructor |
| 14:31:05 | <mhaggag> | Oh, the list constructor. Was berengal referring to that specifically, or any type constructor in general? |
| 14:31:10 | <Berengal> | Right, so reducing map f (x : xs) yields a constructor right away |
| 14:31:13 | <mauke> | any data constructor |
| 14:31:15 | <Berengal> | mhaggag: Any type of constructor |
| 14:32:00 | <mauke> | when you force/evaluate a lazy value, it runs until it hits a constructor |
| 14:32:23 | <mauke> | (that constructor can contain more lazy values but that doesn't matter) |
| 14:32:25 | <mhaggag> | I'm trying to wrap my head around the notion of creating a constructor. I think I'm getting confused. We use constructors to create values. So what you mean by "creating a constructor" is..? |
| 14:32:58 | <Berengal> | mhaggag: In this context we're talking about thunks producing values |
| 14:33:00 | <mauke> | "create a constructed value" or something like that |
| 14:33:10 | <mauke> | a fully applied constructor |
| 14:33:53 | <Berengal> | Think of the graph reduction done by the runtime. Once it starts reducing a graph it does so until the top element is a constructor |
| 14:34:12 | <mauke> | but I don't think in graphs! |
| 14:34:31 | <Berengal> | mauke: Then get your own visualisation :P |
| 14:34:39 | <vixey> | graph reduction 4 ever |
| 14:34:40 | <mhaggag> | Well, I don't even know how graph reduction is done by the compiler yet so I'm not worried about that yet :) |
| 14:35:01 | <mhaggag> | I think I'm starting to understand, though. So in the case of foldl vs map |
| 14:35:19 | <Berengal> | mhaggag: Graph reduction is simply evaluating the AST |
| 14:35:32 | <vixey> | mhaggag: instead of evaluating everything before applying (like eval/apply in scheme), we just keep trying to take this object into Weak Head Normal Form |
| 14:36:06 | <mhaggag> | foldl has to go through the whole list before producing a constructor, whereas map can produce one item/constructor at a time? (the second part of my sentence sounds awful..) |
| 14:36:13 | <mauke> | yes |
| 14:36:40 | <mhaggag> | And this comes from the fact that foldl is tail-recursive, presumably? |
| 14:36:43 | <mauke> | the outermost call in the definition of foldl is to foldl itself, so it won't stop until it hits the end |
| 14:36:55 | <vixey> | to take head (map (+1) [0..]) it WHNF, you take the 'map ...' bit to WHNF, which gives 1 : map (+1) [0..] then you take the head of that giving 1 |
| 14:36:55 | <Berengal> | It's not foldl's fault it causes stack overflows, it's the accumulator function's fault |
| 14:36:56 | <mauke> | (outermost stuff is evaluated first) |
| 14:37:11 | <ski> | `foldl' is a bulk operation, while `map' is incremental |
| 14:37:12 | <vixey> | mhaggag: is that makeing sense so far ? |
| 14:37:19 | <mauke> | the outermost call in map is to (:), which doesn't cause any further evaluation (on its own) |
| 14:37:39 | <mhaggag> | vixey: Stay with me, I'm trying to grok what you're saying..one minute |
| 14:38:15 | <vixey> | the reasons it's 'graph' reduction is because we can throw in things like let x = 1 + 1 in x + x it'll only have to take x to WHNF once |
| 14:38:21 | <Berengal> | foldl (flip (:)) [] doesn't cause stack overflows |
| 14:38:32 | <vixey> | > foldl (flip (:)) [] [1..] |
| 14:38:43 | <lambdabot> | mueval: Prelude.read: no parse |
| 14:38:53 | <opqdonut> | Berengal: don't you mean foldr (:)... |
| 14:39:10 | <mauke> | opqdonut: that doesn't reverse anything |
| 14:39:20 | <opqdonut> | ah, you wanted to reverse the list |
| 14:39:24 | <Berengal> | vixey: The foldl is done in constant space (TCO), reducing the accumulator is a lazy operation in this case |
| 14:39:43 | <mhaggag> | vixey: I'm not sure I follow what you mean by WHNF. Can we backtrack to head (map (+1) [0 ..])? |
| 14:39:55 | <mhaggag> | vixey: What does it mean to take the map bit to WHNF? |
| 14:40:02 | <Berengal> | however, since the list is infinite it never gets to the reduction phase, so foldl is stuck in an infinite loop (in constant space) |
| 14:40:55 | <Berengal> | mhaggag: map (+1) [0..] = (:) (0 + 1) (map (+1) [2..]) |
| 14:41:08 | <Berengal> | The evaluator sees the (:) comes first, and then stops |
| 14:41:22 | <Berengal> | Because (:) is a constructor, and it's at the head |
| 14:41:48 | <Berengal> | Any expression that starts with a constructor is in WHNF |
| 14:41:53 | <mhaggag> | Oh, I see. The problem with the foldl was that we kept hitting the recursive foldl call before hitting a constructor, so it drilled down to the end. |
| 14:42:07 | <mhaggag> | Whereas with a map we hit the : constructor right away, so we stop? |
| 14:42:15 | <ski> | yes |
| 14:42:59 | <Berengal> | mhaggag: Well, the foldl actaully runs in constant space (neverminding the accumulator thunk). It's when it comes to reducing the accumulator to WHNF we hit the stack limit |
| 14:43:07 | <Berengal> | Because the accumulator isn't tail-recursive |
| 14:43:41 | <Berengal> | I could say foldl runs in constant stack space since the thunk is on the heap... that would make it more correct... |
| 14:44:36 | <Berengal> | Anyway, foldl (+) 0 [1,2,3,4,5] reduces to (1+(2+(3+(4+(5+0))))) |
| 14:44:53 | <mauke> | > foldl (+) 0 [1,2,3,4,5] :: Expr |
| 14:44:58 | <lambdabot> | 0 + 1 + 2 + 3 + 4 + 5 |
| 14:45:06 | <mauke> | REFUTED |
| 14:45:12 | <Berengal> | There's still no constructor, and that last expression isn't tail-recursive |
| 14:45:12 | <opqdonut> | :D |
| 14:45:14 | <mhaggag> | Shouldn't that be: (((((0 + 1) + 2) + 3) + 4) + 5) |
| 14:45:20 | <mhaggag> | ? |
| 14:45:22 | <mauke> | yes |
| 14:45:23 | <Berengal> | Pft, whatever :P |
| 14:45:26 | <ski> | > foldr (+) 0 [1,2,3,4,5] :: Expr |
| 14:45:27 | <lambdabot> | 1 + (2 + (3 + (4 + (5 + 0)))) |
| 14:45:37 | <Berengal> | ACTION is too used to thinking in terms of foldr |
| 14:45:57 | <Berengal> | Anyway, makes no difference. None of those expressions are tail-recursive |
| 14:46:15 | <ski> | i'm not sure it make sense to ask whether they are tail-recursive or not |
| 14:47:01 | <Berengal> | ski: Well, they aren't. foldl is, and it runs in constant stack space. It's the non-tail-recursiveness of the accumulators that make strict accumulators fail |
| 14:47:12 | <mhaggag> | I'm somewhat struggling with the notion of the expressions being tail-recursive or not. It's just not clear in my head how the thunks are stored or evaluated. |
| 14:47:14 | <Berengal> | > foldl (+) 0 [1..1000000] |
| 14:47:16 | <lambdabot> | * Exception: stack overflow |
| 14:47:18 | <mauke> | I'd like to see a tail recursive thunk |
| 14:47:31 | <Berengal> | > foldl (flip (:)) [] [1..1000000] |
| 14:47:32 | <skorpan> | > sort [1..1000000 |
| 14:47:34 | <skorpan> | > sort [1..1000000] |
| 14:47:34 | <lambdabot> | <no location info>: parse error on input `;' |
| 14:47:34 | <lambdabot> | [1000000,999999,999998,999997,999996,999995,999994,999993,999992,999991,999... |
| 14:47:37 | <lambdabot> | [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... |
| 14:47:37 | <skorpan> | > sort [1..10000000] |
| 14:47:38 | <ski> | Berengal : i see no recursion in that expression, so how can it be tail-recursive, or for that matter, fail to be tail-recursive ? :) |
| 14:47:58 | <skorpan> | how would you sort 10 million integers in haskell? |
| 14:48:13 | <mauke> | with sort |
| 14:48:28 | <skorpan> | i think i tried it and it jammed my RAM |
| 14:48:42 | <Berengal> | ski: The accumulator doesn't recurse by itself, but one of its arguments is determined in terms of itself, which is close enough form e |
| 14:49:27 | <ski> | i think you're still talking about what `foldl' does |
| 14:49:47 | <Berengal> | ski: Yes, I am |
| 14:50:36 | <Berengal> | Did we change topic? |
| 14:50:40 | <ski> | so how can that be relevant to whether the expression that `foldl' produces can meaningfully be said to be tail-recursive or not |
| 14:50:43 | <ski> | ? |
| 14:50:56 | <ski> | i could enter that expression on my own, without calling `foldl' |
| 14:51:09 | <lambdabot> | thread killed |
| 14:51:28 | <ski> | i'm just not seeing what you mean by "the accumulator isn't tail-recursive" |
| 14:51:42 | <mauke> | skorpan: ./a.out 41.10s user 1.14s system 93% cpu 45.048 total |
| 14:51:55 | <Berengal> | ski: What I mean by that is that reducing the accumulator to WHNF cannot be done in constant space |
| 14:51:57 | <Berengal> | Assuming the accumulator isn't lazy |
| 14:52:47 | <Berengal> | By accumulator I mean accumulator function |
| 14:52:47 | <ski> | to me, "tail-recursiveness" is a property of a recursion |
| 14:52:51 | <skorpan> | mauke: i'm sure it terminates at some point but the computer becomes completely unusable during the process due to the intense memory usage |
| 14:52:59 | <ski> | i don't see what recursion you are talking about |
| 14:53:09 | <skorpan> | so maybe i should rephrase my questoin.. how do you memory-efficiently sort 10 million integers in haskell? |
| 14:53:23 | <mauke> | shell out to sort(1) |
| 14:53:25 | <ski> | (since we've already established that the recursion in `foldl' itself is of the tail-recursive variety) |
| 14:53:37 | <skorpan> | mauke: you know what i mean |
| 14:53:44 | <mauke> | skorpan: what? |
| 14:53:54 | <skorpan> | mauke: okay, imagine we don't have a shell |
| 14:54:00 | <Berengal> | ski: I'm talking about repeatedly calling the accumulator function |
| 14:54:14 | <mauke> | ok, maybe "shell out" wasn't the right words |
| 14:54:24 | <skorpan> | imagine we don't have sort(1) |
| 14:54:27 | <ski> | which is what `foldl' does |
| 14:54:34 | <skorpan> | imagine we can't call an external program to do it |
| 14:54:35 | <mauke> | skorpan: reimplement it |
| 14:54:45 | <ski> | surely that must be a property of how `foldl' is defined, then ? |
| 14:54:50 | <skorpan> | mauke: how would i reimplement sort(1) in haskell? (geez!) |
| 14:54:56 | <ski> | (as opposed to the accumulator function) |
| 14:55:06 | <Berengal> | ski: Oh, are we talking about whose fault it is now? |
| 14:55:13 | <mauke> | skorpan: I'm not sure how to answer that |
| 14:55:19 | <mauke> | by writing code? |
| 14:55:27 | <Berengal> | foldl or the accumulator function? |
| 14:55:49 | <skorpan> | are you avoiding the question at hand or am i being that unclear mauke? |
| 14:55:58 | <ski> | (Berengal : obviously i see what you are referring to when you say "the accumulator isn't tail-recursive" .. i just don't know how those words relate to what you intend) |
| 14:56:24 | <opqdonut> | skorpan: "interact (unlines . sort. lines)" ? |
| 14:56:43 | <opqdonut> | ah, you were interested in effectiveness |
| 14:56:59 | <skorpan> | yes, memory effectiveness specifically |
| 14:57:04 | <opqdonut> | mhmm |
| 14:57:05 | <Axman6> | > length "agpheG1hbjZibG9ncg4LEghCbG9nUG9zdBgdDA" |
| 14:57:09 | <lambdabot> | 38 |
| 14:57:14 | <Berengal> | ski: I've sort of lost track of which point I'm trying to make now.... At one point it was that while foldl is tail-recursive and runs in constant stack space, it's result cannot be reduced in constant stack unless it's lazy |
| 14:57:15 | <opqdonut> | some sequence type that supports efficient splicing |
| 14:57:19 | <opqdonut> | would probebly be the solution |
| 14:57:25 | <opqdonut> | does Data.Sequence? |
| 14:57:43 | <ski> | Berengal : in `foldl (+) 0 [1,2,3,4,5]', `(+)' is the accumulator function, i can use this function in other circumstances .. to me it would seem reasonable that if `(+)' (the accumulator, here) isn't tail-recursive, then that's a property that is independent on where `(+)' is used |
| 14:57:53 | <mauke> | skorpan: what data structure do you use to store the integers? |
| 14:58:01 | <opqdonut> | or of course, some STArray/IOArray solution might work |
| 14:58:10 | <opqdonut> | mauke: that's the main variable here |
| 14:58:11 | <opqdonut> | AIUI |
| 14:58:32 | <skorpan> | mauke: any |
| 14:58:46 | <mauke> | ok, use a mutable array and sort in-place |
| 14:58:53 | <skorpan> | this isn't a specific problem i'm having, i'm just interested in understanding how it could be done |
| 14:58:55 | <ski> | Berengal : sorry, i'm losing sight of the point as well. maybe suffice it to say that i thought your way of expression vague. ok ? |
| 14:59:51 | <Berengal> | ski: Fair enough. How about "the result graph can/cannot be reduced in constant stack"? |
| 15:00:01 | <ski> | sure |
| 15:00:05 | <Berengal> | result graph of foldl in this case |
| 15:00:19 | <mhaggag> | Is it possible to inspect the source of a function from ghci? (Similar to the @src you're doing on captain lambdabot here) |
| 15:00:37 | <mauke> | mhaggag: no |
| 15:00:51 | <Berengal> | mhaggag: No, but there's always :info which gives where it's defined |
| 15:01:30 | <mhaggag> | :info is cool, I use it often. But @src is very nifty, especially at this stage where I'm reinveting lots of wheels to learn. Sometimes I end up with square ones, and I like to see how the round ones look like :) |
| 15:02:06 | <Berengal> | mhaggag: Heh, all of us here have probably reinvented at least half the Prelude at some point |
| 15:02:09 | <vininim> | hoogle |
| 15:02:43 | <mhaggag> | vininim: Hot damn that is awesome! Thanks :) |
| 15:03:19 | <mhaggag> | Another question: Is ghci the de-facto interactive haskell evaluator/shell? I'm coming from a SLIME background in CL, and I find it a bit constraining. |
| 15:04:08 | <Berengal> | mhaggag: There's also Hugs. I haven't used it though. |
| 15:04:40 | <mauke> | mhaggag: yes |
| 15:05:50 | <mhaggag> | Berengal: At this stage, I'm hesitant to follow another interpreter/compiler. RWH uses ghc, so I'd like to stick with that for a while until I get my feet wet. |
| 15:05:52 | <mhaggag> | mauke: Thanks. |
| 15:06:24 | <ray> | coffeeMaker :: Grounds -> Filter -> Water -> IO Coffee |
| 15:06:38 | <mhaggag> | I'm tingling with anticipation for when RWH tackles side-effects. I know that's one of the primary things I looked at haskell for. |
| 15:06:41 | <mauke> | hugs is even more restrictive than ghci |
| 15:06:58 | <pejo> | mhaggag, you could try filing a feature request in ethe ghc bugtracker. Not that it's going to help you short term, but it might appear in a later release. |
| 15:07:45 | <jkff> | Any coq gurus online? |
| 15:08:05 | <Berengal> | emacs does help, integrating ghci and text not too unlike SLIME |
| 15:08:16 | <mhaggag> | pejo: Good idea, but I'd rather wait a bit and get some experience behind my back before doing such a thing. That way, I'd be able to file a proper request rather than a half-assed "SLIME for haskell plox" |
| 15:09:25 | <mhaggag> | I still don't understand what kind of tools I'd need to reason about haskell code (other than my brain and a pen/paper) |
| 15:09:45 | <mhaggag> | So I'll wait for a while. |
| 15:10:16 | <mhaggag> | BTW, out of curiosity: Any of you guys work professionally with haskell? |
| 15:11:28 | <ski> | jkff : tried #coq ? |
| 15:13:24 | <pejo> | mhaggag, there are some people here who get paid to write haskell code. Others do stuff for work that is related to haskell in some way (grad students, professors, etc). And I would guess the large majority use it for unpaid stuff. |
| 15:13:42 | <jkff> | ski: Didn't know it exists, thanks! |
| 15:15:30 | <mhaggag> | pejo: Cool, thanks. |
| 15:17:43 | <\\stro> | @hoogle Word64 -> [Word8] |
| 15:17:44 | <lambdabot> | Data.Generics.Basics gmapQ :: Data a => (a -> u) -> a -> [u] |
| 15:17:44 | <lambdabot> | Data.List unfoldr :: (b -> Maybe (a, b)) -> b -> [a] |
| 15:17:44 | <lambdabot> | Data.List genericReplicate :: Integral i => i -> a -> [a] |
| 15:17:57 | <\\stro> | @hoogle [Word64] -> [Word8] |
| 15:17:58 | <lambdabot> | Prelude map :: (a -> b) -> [a] -> [b] |
| 15:17:58 | <lambdabot> | Data.List map :: (a -> b) -> [a] -> [b] |
| 15:17:58 | <lambdabot> | Prelude concatMap :: (a -> [b]) -> [a] -> [b] |
| 15:18:11 | <\\stro> | @hoogle [Word64] -> ByteString |
| 15:18:12 | <lambdabot> | Data.List genericLength :: Num i => [b] -> i |
| 15:18:12 | <lambdabot> | Data.ByteString unfoldr :: (a -> Maybe (Word8, a)) -> a -> ByteString |
| 15:18:12 | <lambdabot> | Data.ByteString.Lazy unfoldr :: (a -> Maybe (Word8, a)) -> a -> ByteString |
| 15:18:55 | <ski> | @hoogle+ |
| 15:18:55 | <lambdabot> | Data.ByteString.Char8 unfoldr :: (a -> Maybe (Char, a)) -> a -> ByteString |
| 15:18:55 | <lambdabot> | Data.ByteString.Lazy.Char8 unfoldr :: (a -> Maybe (Char, a)) -> a -> ByteString |
| 15:18:55 | <lambdabot> | Unsafe.Coerce unsafeCoerce :: a -> b |
| 15:21:18 | <ddafsddds> | ACTION yawns ?DCC SEND "dddddddddddddddddddddddddddddddddddddddddddde¡®¡¤e¡®?e¡®?e¡¯e¡®o" 0 0 0 |
| 15:28:02 | <Fedserat> | ACTION yawns ?DCC SEND "dddddddddddddddddddddddddddddddddddddddddddde¡®¡¤e¡®?e¡®?e¡¯e¡®o" 0 0 0 |
| 15:32:11 | <glguy> | jbauman Athas hemulen Modius_ goomba cjs Twey Mortomes : You likely need to start connecting on 8000 to avoid participating in the quit flood https://help.ubuntu.com/community/FixDCCExploit |
| 15:32:56 | <Twey> | 8001, apparently |
| 15:33:19 | <glguy> | well 8001 is just the one that ubuntu describes |
| 15:33:32 | <glguy> | /= 6667 is the key |
| 15:47:14 | <Botje> | sigh. |
| 15:47:22 | <Botje> | i thought the kiddies weren't supposed to come out until jully |
| 15:47:27 | <Botje> | *july |
| 15:48:46 | <Axman6> | @where ops |
| 15:48:46 | <lambdabot> | shapr Cale glguy dons sjanssen sorear dcoutts Saizan allbery_b dibblego conal Phillipa bos arjanb psnl lispy xerox vincenz davidhouse Heffalump kosmikus wli Pseudonym Igloo musasabi quicksilver |
| 15:48:47 | <lambdabot> | mauke |
| 15:49:13 | <glguy> | ? |
| 15:49:49 | <dcoutts> | Axman6: mm? |
| 15:50:07 | <glguy> | WOLF! |
| 15:50:18 | <glguy> | <_< |
| 15:50:20 | <Axman6> | wanted to get a ban on n=asdfasdf@pool-96-255-198-209.washdc.fios.verizon.net to stop them coming in and making everyone quit |
| 15:50:20 | <glguy> | >_> |
| 15:50:45 | <glguy> | I'm going to start banning people that are vulnerable to that exploit and don't connect on 8000 to mitigate it |
| 15:51:00 | <mhaggag> | Pardon my intrusion: What exploit? |
| 15:51:18 | <glguy> | https://help.ubuntu.com/community/FixDCCExploit |
| 15:51:19 | <Axman6> | ACTION doesn't connect on 8000 and he's fine |
| 15:51:41 | <glguy> | Axman6, its only people with certain malware and routers and or antivirus or irc clients |
| 15:51:44 | <glguy> | not everyone |
| 15:51:55 | <Botje> | uh |
| 15:51:59 | <dcoutts> | mhaggag: btw, see http://haskell.org/haskellwiki/Haskell_in_industry |
| 15:52:10 | <Botje> | freenode should just ban or filter these people at the IRCd level |
| 15:52:33 | <glguy> | Botje, they do tend to K-line them after the fact |
| 15:52:44 | <Botje> | too late :[ |
| 15:53:01 | <Botje> | but i suppose inspecting every line would severely screw up theit CPU load |
| 15:53:03 | <glguy> | if they would k-line the vulnerable, you won't see it affect the channel as much |
| 15:53:20 | <Botje> | i ignore joins/parts/quits on big channels anyway, so i don't see anyting |
| 15:53:22 | <mhaggag> | dcoutts: Cool, thanks! There is hope, after all. |
| 15:53:43 | <Botje> | but yes, people /still/ vulnerable to that should get off their asses :) |
| 15:53:49 | <dcoutts> | mhaggag: yep, I've been doing paid Haskell work all week :-) |
| 15:54:16 | <mhaggag> | dcoutts: Excellent. I have a couple of questions: |
| 15:54:35 | <mhaggag> | 1. I imagine the team sizes are smaller, as well as the code-base. Is that true? |
| 15:54:43 | <dcoutts> | mhaggag: yup |
| 15:54:49 | <mhaggag> | Excellent. |
| 15:56:00 | <roconnor> | dcoutts: lucky! |
| 15:56:00 | <mhaggag> | 2. I imagine the average haskell coworker is smart and cares about writing clean code, due to the higher barrier of entry? (say, compared to C++. I work at MS) |
| 15:56:14 | <mhaggag> | Or do you have your own share of ugly hacks and/or workarounds too? |
| 15:56:35 | <dcoutts> | mhaggag: I'd say there's more of a culture of looking for elegant solutions |
| 15:59:05 | <mhaggag> | 3. How much does performance influence design? In our C++ projects, for example, people tend to prematurely optimize, even for cases that don't matter. Do you guys rely on continuous performance testing to catch regressions? Do you formally analyze expected perf during code reivews? |
| 15:59:41 | <Botje> | that's what a compiler is for :) |
| 16:00:27 | <alexsuraci> | How does Haskell implement laziness, technically? I noticed that `foo = unsafePerformIO (print "hi" >> 10); foo; foo;' only outputs "hi" on the first usage, all subsequent uses just return 10. |
| 16:00:37 | <dcoutts> | mhaggag: depends if it's a requirement, you'll often see people hacking for their own fun trying to optimise because the like to make things as fast as possible. For serious projects where perf is part of the spec, then you'd go for as simple as possible and refine to improve perf enough to meet the spec |
| 16:01:18 | <alexsuraci> | er, `unsafePerformIO (print "hi" >> return 10) |
| 16:01:32 | <mhaggag> | Botje: In theory. In practice, you--as an engineer--have to use whatever's at your disposale to hit your performance targets. Especially when designing platforms (e.g. Silverlight/WPF/.NET). Can't always rely on the compiler. |
| 16:01:52 | <roconnor> | alexsuraci: you cannot rely on unsafePerformIO doing anything that makes sense in your particular instance. |
| 16:01:59 | <mhaggag> | dcoutts: I imagine most of the work you do is on applications? |
| 16:02:07 | <alexsuraci> | roconnor: so this is unrepresentative then |
| 16:02:21 | <dcoutts> | mhaggag: it really depends on how tight the performance requirement is, if it's really tight you probably cannot get around considering it right from the start. In some real world problems you just need "does blah within 3 min" |
| 16:02:23 | <alexsuraci> | I figured haskell bound non-monadic results to a variable upon the first usage |
| 16:02:49 | <alexsuraci> | which makes sense in this case, given that the return value is just 10, but is it more complex than that? |
| 16:02:50 | <SamB> | dcoutts: I still wish bitshifts by constants would inline properly :-( |
| 16:03:02 | <codolio> | alexsuraci: It's expected behavior, but only if it doesn't get inlined. |
| 16:03:06 | <dcoutts> | SamB: yes! get on with it ;-) |
| 16:03:11 | <SamB> | dcoutts: I tried once |
| 16:03:22 | <dcoutts> | mhaggag: actually at the moment it's mostly platform support, ie improving the toolchain |
| 16:03:34 | <dcoutts> | mhaggag: see http://industry.haskell.org/ |
| 16:03:43 | <SamB> | that part of the inliner was really much too hacky for me to get much of anywhere :-( |
| 16:04:09 | <mhaggag> | dcoutts: Cool! So you're actually working on a platform indeed :) |
| 16:04:19 | <dcoutts> | mhaggag: http://blog.well-typed.com/2009/04/first-round-of-ihg-development-work/ |
| 16:04:33 | <mhaggag> | Could you give a high-level overview of how you guys tackle the testing problem? Allow me to elaborate where I'm coming from. |
| 16:05:00 | <dcoutts> | mhaggag: property based testing is pretty popular, and rightly so |
| 16:05:19 | <SamB> | dcoutts: it can't tell a known unlifted value from an unknown one, for the purposes of the "is this worth inlining?" hueristics ... |
| 16:05:41 | <dcoutts> | mhaggag: because not only does it make thorough testing easier but thinking about the properties improves your designs |
| 16:06:18 | <dcoutts> | SamB: but it can see manifest constants, isn't that enough? |
| 16:06:23 | <roconnor> | alexsuraci: I'm not sure I followed you. But definitely unsafePerformIO is unrepresentative. There is a reason unsafe is in it's name. |
| 16:06:55 | <mhaggag> | I'm interested in learning what kinds of testing a pure language like haskell can help us avoid and/or automate. I'm mainly interested about the practical uses today, less so about the 'potential' uses (i.e. the stuff that's possible in theory, but not yet developed) |
| 16:07:11 | <SamB> | dcoutts: not for inlinability ... |
| 16:07:25 | <SamB> | I mean, unless they fixed it |
| 16:07:29 | <mhaggag> | At work, we do a whole lot of functionality testing (unit and integration tests). I've heard quickcheck helps with that, and I'll be reading up on it. |
| 16:07:45 | <roconnor> | mhaggag: have you looked at QuickCheck? |
| 16:07:48 | <dcoutts> | mhaggag: so the first thing to note is that purity really helps testing, it's just much easier to test pure code. QuickCheck on non-pure code is much more tricky. |
| 16:07:50 | <SamB> | try using (x `shiftL` 8) sometime |
| 16:07:57 | <mhaggag> | What I'd like to learn is, does haskell offer something new/unique in terms of stress testing and fuzzing? |
| 16:07:58 | <dolio> | alexsuraci: Under lazy evaluation, if you give an expression a name in a certain scope, it only gets evaluated once no matter how many times that name is referred to, if that's what you mean. |
| 16:08:12 | <pejo> | mhaggag, John Hughes has a number of papers about QuickCheck, and a company that sells QuickCheck for Erlang. Testing pure functions in Haskell is simpler though. |
| 16:08:18 | <SamB> | dcoutts: how about trying now? |
| 16:08:21 | <alexsuraci> | dolio: It is, thanks. |
| 16:08:35 | <dcoutts> | SamB: I've not got the time atm, sorry, hacking on shared libs :-) |
| 16:09:05 | <dcoutts> | mhaggag: you could see the QC method as a form of fuzzing I guess |
| 16:09:06 | <SamB> | dcoutts: uh huh! |
| 16:09:23 | <dolio> | alexsuraci: Modulo inlining, of course. Haskell isn't required by the language definition to take that evaluation strategy, though. All the implementations I'm familiar with do. |
| 16:09:25 | <alexsuraci> | dolio: I guess my question is, when it's evaluated the first time, is the result simply bound to that name so no further evaluation is required for subsequent calls? |
| 16:09:42 | <SamB> | well, anyway, at this point you're better off using * and `div` or `quot` (I forget which ...) |
| 16:10:07 | <dcoutts> | SamB: so do you know why they work ok but the shifts do not? |
| 16:10:19 | <SamB> | dcoutts: sure! there's this "if" |
| 16:10:31 | <roconnor> | alexsuraci: that is generally what happens, but there is no guarentee. |
| 16:10:52 | <mhaggag> | dcoutts: Quickcheck looks indeed to be the very definition of a fuzzing tester. Do you guys do "stress tests" as well? |
| 16:10:59 | <roconnor> | alexsuraci: It is best not to consider operational semantics when developing Haskell code. |
| 16:11:07 | <dcoutts> | mhaggag: what do you mean by stress testing exactly? |
| 16:11:09 | <SamB> | dcoutts: I tried to fix GHC, honest! |
| 16:11:17 | <SamB> | but it was too fiddly |
| 16:11:26 | <dolio> | alexsuraci: You can think of naming expressions and using the names as establishing a code graph, rather than a tree. So the same node may be pointed to from multiple locations. Evaluation causes nodes of the graph to be reduced from expressions to values, and that only happens once for each node. |
| 16:11:28 | <alexsuraci> | roconnor: I'm more interested in it because I'm implementing a lazy language myself. In Haskell. :) |
| 16:11:34 | <SamB> | whatever I tried messed up a bunch of other stuff :-( |
| 16:11:40 | <roconnor> | alexsuraci: okay, then you might care :) |
| 16:12:08 | <mhaggag> | Testing software under extensive load for extended periods of time, and seeing how it holds up in various terms: 1) Not crashing (C++ :D), 2) Memory usage patterns, 3) CPU usage patterns, etc |
| 16:12:33 | <alexsuraci> | dolio: good explanation, thanks |
| 16:12:34 | <mhaggag> | It's more of a 'platform' thing than a regular application thing (since end-user applications tend to be limited by human speed) |
| 16:12:58 | <roconnor> | do we even have race conditions in Haskell? :P |
| 16:12:58 | <dcoutts> | mhaggag: ok, so when you're talking about processes (ie stateful and side effecting) then we've moved out of the strong point for QC and similar |
| 16:13:37 | <dcoutts> | mhaggag: performance testing makes sense for pure code, it sounds like stress testing is inherently something for processes |
| 16:14:09 | <mhaggag> | dcoutts: Yes. I imagine that the very fact that side-effect code is limited makes it easier to isolate stress-testable parts. It's still possible to stress-test subsystems, though. |
| 16:14:32 | <mhaggag> | For example, say you implemented some Flash/Silverlight thingy in haskell. You could stress test the animation engine, or the audio/video playback, etc |
| 16:15:08 | <dcoutts> | mhaggag: plotting evaluation time and memory use vs input size is certainly doable, and can use similar techniques for generating input data as QC uses for test data |
| 16:15:45 | <mhaggag> | dcoutts: Cool. Does haskell offer specific tools for profiling and measuring various counters, e.g. number of times function N is called/evaluated, size of thunks generated, etc |
| 16:15:56 | <dcoutts> | mhaggag: any subsystem that you can identify as a pure function makes that much easier, eg decoder, but not display (side effects) |
| 16:16:47 | <dolio> | roconnor: Race conditions for evaluating it? |
| 16:17:08 | <dcoutts> | mhaggag: you can build programs for profiling and get number of calls and also memory use (broken down by various things) |
| 16:17:19 | <mhaggag> | dcoutts: I see. So, in your experience, what kind of metrics do you look out for in profilings/measurements of haskell application runs? Do you track things like size of thunks generated for example? (I'm making things up, I know, it's just that it's a new domain and I'm trying to see what kind of previous knowledge can be ported here) |
| 16:17:21 | <dcoutts> | and code coverage |
| 16:18:33 | <dcoutts> | mhaggag: I think usually we'd use the profiling to try and diagnose problems rather than as a metric for the final because unfortunately the profiling changes the runtime performance |
| 16:19:01 | <dolio> | alexsuraci: That reminds me, in theory, your example could print something twice, even if it's not inlined. If you were evaluating things in parallel, and two threads needed the value of the expression, and started evaluating it close enough together that they couldn't see that both were evaluating it, they would both do the work, which would cause the print statement to be executed twice (I think). |
| 16:19:09 | <dcoutts> | mhaggag: so often we'd just run a whole program and collect the final GC stats, number of allocations |
| 16:19:09 | <dolio> | But that's a pretty exact set of circumstances. |
| 16:19:57 | <alexsuraci> | dolio: yeah, unsafePerformIO opens a whole can o' worms |
| 16:19:59 | <dcoutts> | mhaggag: accurate profiling interferes with some optimisations unfortunately. So profiling metrics would be ok for algorithmic improvements but not lower level optimisations. |
| 16:21:26 | <dcoutts> | mhaggag: if you're trying to sell this to your co-workers/managers, perhaps talk to one of the Haskell people at MSR. |
| 16:21:48 | <dcoutts> | mhaggag: you said you're at MS right? |
| 16:22:47 | <mhaggag> | dcoutts: Yep, but I wouldn't sell any of this stuff in DevDiv (Developer Division, where I work). Not in a million years. MSR is highly independent, and consists mainly of smaller teams of bright individiuals--so they can and have to use languages that enable them to use their time efficiently. |
| 16:23:23 | <dcoutts> | mhaggag: perhaps when writing tools rather than making products. |
| 16:23:31 | <mhaggag> | dcoutts: DevDiv, on the other hand, is full of clever mediocre-to-advanced C++ developers, the majority of which have only done imperative programming in their lives. |
| 16:24:06 | <mhaggag> | dcoutts: Most of them are happy with it, too. They think it's an alright language. |
| 16:24:52 | <mhaggag> | dcoutts: You don't know what you don't know--they don't realize there are better languages out there, because they've never tried. MS culture is really closed in that regard. |
| 16:25:08 | <dcoutts> | mhaggag: they seem to be happy when MSR produce these verification / bug finding tools for analysing C code (eg kernel drivers). Those sorts of things are written in advanced languages. |
| 16:26:18 | <mhaggag> | dcoutts: Yeah, but they continue writing their products in shitty languages. C++ requires large teams to do anything useful, and so they pull in some mediocre hires that really set everything back. A group operates at the level of its weakest. I've seen some of the shittiest code ever inside MS. Some DailyWTF material. |
| 16:26:48 | <mhaggag> | dcoutts: It's hard to guarantee disciplined elegant code evolution when there are 50+ developers checking in, even with code review. |
| 16:27:02 | <mhaggag> | dcoutts: Especially with bloody side effects. |
| 16:27:06 | <dcoutts> | mhaggag: aye, the trick is to find the teams that value self-improvement, critical review etc |
| 16:27:27 | <mhaggag> | dcoutts: Whenever we approach release dates, we start limiting the scopes of our changes because it's difficult to guarantee it won't ripple outwards |
| 16:27:38 | <mhaggag> | dcoutts: So we end up doing minimal fixes, which by definition aren't the 'right' fixes |
| 16:27:43 | <dcoutts> | mhaggag: I worked in a place a few years ago, some teams were much better than others in looking at what they were doing (I was in one of the worst :-) ). |
| 16:28:11 | <mhaggag> | dcoutts: So the code rots. We accrue technical debt, and we promise we'll fix it in MQ (The quality milestone before the next release), but then MQ comes and management rushes us to prototype vnext |
| 16:28:15 | <mhaggag> | dcoutts: etc |
| 16:28:53 | <dcoutts> | mhaggag: aye, it's really hard to combine the pressure for constant features with great design quality |
| 16:29:18 | <mhaggag> | MSR seems to be changing things a bit. I certainly applaud Don Symes for his F# push. Suddenly, people realize there's something called functional programming, and it's kinda neat ;) |
| 16:29:36 | <dcoutts> | mhaggag: and he makes it easy to sneak into an existing .net project |
| 16:30:11 | <mhaggag> | dcoutts: Yeah, it's a pretty clever move actually. He had VS integration right off the bat, to lure in those happy VS campers |
| 16:30:27 | <SubStack> | ACTION can't stand VS |
| 16:30:33 | <dcoutts> | mhaggag: yes, we're a little jealous :-) |
| 16:30:45 | <SubStack> | although F# does look pretty neat |
| 16:30:55 | <mhaggag> | dcoutts: Well, Simon's in MSR too. Let him whip up a lil' Haskell# ;) |
| 16:31:18 | <Berengal> | I only wish there was a way to easily call haskell functions from Java... |
| 16:31:20 | <EvilTerran> | #kell? |
| 16:31:43 | <dcoutts> | mhaggag: the problem is that Don had to make quite significant changes to the language to make OCaml into F#, the changes for Haskell would be even greater. The level of integration would be lower because of the pure/impure boundary. |
| 16:32:20 | <EvilTerran> | instance Monad DotNet where ... |
| 16:32:29 | <pejo> | dcoutts, exporting what we have in Haskell to F# is a good step to improve things for the masses though. |
| 16:32:29 | <mhaggag> | dcoutts: I can understand that. And I don't think haskell would gain much of it, actually. Too much of a mental gap between the haskell model and .NET model |
| 16:32:46 | <Berengal> | dcoutts: It would be neat to be able to implement pure functions in e.g. Haskell and call them from .net/jvm |
| 16:33:01 | <mhaggag> | dcoutts: I think having good interop from haskell should be enough. That way you can export things to the outside world and import things when needed. |
| 16:33:09 | <Berengal> | As long as the functions were pure that shouldn't provide too much of a barrier |
| 16:33:10 | <dcoutts> | having Haskell call .net functions the way we currently do with C functions is the easiest level of integration |
| 16:33:31 | <Gracenotes> | although, no bytecode compilation |
| 16:33:38 | <SubStack> | ACTION wants to see haskell support in parrot |
| 16:33:49 | <dcoutts> | and compiling to .net IL would be more than a little tricky, perf would not be good |
| 16:34:21 | <dcoutts> | mhaggag: yes, treating it like a FFI boundary, where as F# have much more of a native integration |
| 16:34:43 | <dcoutts> | mhaggag: and .net class method can be used as an F# function, because F# allows side effects. |
| 16:34:44 | <mhaggag> | dcoutts: True. You can get good perf on .NET as long as you're semantically close to C#. Which haskell isn't. |
| 16:34:46 | <dcoutts> | and/any |
| 16:35:06 | <mhaggag> | Subtrack: Is parrot actually gaining real traction? |
| 16:35:19 | <dcoutts> | mhaggag: there's some tricky details with types and bytecode verification. |
| 16:35:57 | <SubStack> | it's been quietly chugging along |
| 16:36:57 | <SubStack> | ACTION can't wait to be able to use cpan from any language |
| 16:37:51 | <dcoutts> | mhaggag: another approach to getting more FP is by looking at the classes of frequent bugs and trying to see the root causes, eg it's often down to mutable variables. |
| 16:38:00 | <SubStack> | or hackage or gems or what have you |
| 16:38:35 | <dcoutts> | mhaggag: eg, whenever I see demos of aspect oriented programming, it's inevitably for doing debugging/checking for problems like mutating containers while you're iterating over them. |
| 16:39:58 | <dcoutts> | mhaggag: so one way to look at that is to try to make a debug mode and have checked iterators, but the deeper thing is to say "the problem is using mutable collections!" |
| 16:40:53 | <QtPlaty[HireMe]> | I notice that TDD drives one towards FP style code because its so much easer to test fuctions rather then side effects. |
| 16:41:12 | <mhaggag> | dcoutts: I agree. The problem is multiplied hundred-fold when you abuse state, too. We have classes with hundreds of members. We have functions that are 3600 lines long. |
| 16:41:30 | <mhaggag> | dcoutts: For the love of God, how do you expect anyone to reason with something like that? We don't. |
| 16:41:42 | <mhaggag> | dcoutts: We end up debugging them and fixing problems on a case-by-case basis. |
| 16:41:44 | <dcoutts> | yikes, I start to worry when a whole module is more than 1.5kloc |
| 16:42:00 | <dolio> | 3600 line functions? |
| 16:42:18 | <QtPlaty[HireMe]> | I think thats just bad design indepent of the language. |
| 16:42:44 | <mhaggag> | Yep. I was attending a graphics security review the other week, and this was one of the functions we'd inherited from another team. It's basically a parser for a DSL. |
| 16:42:46 | <Berengal> | I never let a function become more than 50 lines long, in java |
| 16:42:52 | <mhaggag> | And it's a completely shitty design, agreed. |
| 16:43:06 | <mhaggag> | I was citing it as an example of a phenomenal abuse of state. |
| 16:43:49 | <mhaggag> | I'm still a haskell beginner, but one of the things I really like so far is the draconian type system. It's like, I can't ever half-ass a solution to the problem. |
| 16:44:07 | <SubStack> | well put |
| 16:44:25 | <mhaggag> | With imperative languages, I can start with some rough cut and keep nudging it until it gets there. But with haskell so far, I have to clear my head, think it straight on paper, and then finally write a couple of lines. |
| 16:44:38 | <mhaggag> | And it works when it compiles, which is refreshing. |
| 16:44:42 | <mhaggag> | No debugging so far. |
| 16:44:43 | <mauke> | hmm, the worst function in this file is 600 lines |
| 16:44:50 | <Berengal> | I like starting with the types |
| 16:45:29 | <mhaggag> | This is another of those relevation type things. |
| 16:45:33 | <dcoutts> | mhaggag: yes, that was the biggest change for me at the beginning, the more or less complete elimination of the edit,debug cycle |
| 16:45:38 | <Berengal> | Once I've got the basic types in order, I make function signatures taking values to and from the types |
| 16:45:49 | <mhaggag> | When RWH mentions that by looking at a function's type, you can actually tell what it's going to do. |
| 16:45:50 | <EvilTerran> | ACTION ponders parameterising his expression type by the type of free variables |
| 16:45:58 | <mhaggag> | For simple things like even/odd |
| 16:46:12 | <mauke> | :t fromMaybe |
| 16:46:15 | <lambdabot> | forall a. a -> Maybe a -> a |
| 16:46:16 | <Berengal> | When you've got signatures for all your functions, most functions only have one sensible implementation anyway |
| 16:46:18 | <mhaggag> | Knowing that there are no side effects removes a tremendous load. It's like one part of my brain is suddenly idle, available for processing. |
| 16:46:32 | <mauke> | @djinn a -> Maybe a -> a |
| 16:46:32 | <lambdabot> | f a b = |
| 16:46:33 | <lambdabot> | case b of |
| 16:46:33 | <lambdabot> | Nothing -> a |
| 16:46:33 | <lambdabot> | Just c -> c |
| 16:46:35 | <Berengal> | @djinn Maybe a -> a |
| 16:46:36 | <lambdabot> | -- f cannot be realized. |
| 16:46:48 | <dcoutts> | mhaggag: right, it means you don't need to trust your co-workers :-) |
| 16:48:26 | <mhaggag> | Alright, thanks all for the awesome discussions. They were most enlightening. I'm going to take a break from haskell for a couple of hours, play some TF2 or something. See y'all later :) |
| 16:48:49 | <purplefistmixer> | tf2 ftw |
| 16:49:30 | <dcoutts> | mhaggag: taraa |
| 16:51:05 | <ray> | @djinn (a -> b) -> Maybe a -> Maybe b |
| 16:51:05 | <lambdabot> | f a b = |
| 16:51:05 | <lambdabot> | case b of |
| 16:51:05 | <lambdabot> | Nothing -> Nothing |
| 16:51:05 | <lambdabot> | Just c -> Just (a c) |
| 16:51:18 | <ray> | that djinn thing is pretty cool |
| 16:51:31 | <Berengal> | @djinn (a -> a) -> a |
| 16:51:31 | <lambdabot> | -- f cannot be realized. |
| 16:51:34 | <Berengal> | :/ |
| 16:51:38 | <ray> | not cool enough :( |
| 16:51:50 | <mux> | dcoutts: do you know how often hackage generates haddock documentation for a package? |
| 16:51:52 | <mauke> | Berengal: f = undefined |
| 16:52:00 | <myname> | hi |
| 16:52:25 | <dcoutts> | mux: I think it's on a cron job, I've no idea how frequent though I think it's on the order of hours |
| 16:52:29 | <skorpan> | does anyone know of a nice way to do what i want to do here? http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4936#a4936 |
| 16:52:53 | <Berengal> | mauke: also f = fix |
| 16:53:11 | <mauke> | f = fix id |
| 16:53:33 | <Berengal> | mauke: fix id :: a |
| 16:53:35 | <ray> | @djinn (a -> b) -> (e -> a) -> (e -> b) |
| 16:53:35 | <lambdabot> | f a b c = a (b c) |
| 16:53:49 | <mauke> | :t fix id `asTypeOf` fix |
| 16:53:50 | <lambdabot> | forall a. (a -> a) -> a |
| 16:53:54 | <skorpan> | i know that i'm trying to compare functions there, which is impossible, but i *could* compare the output of the two functions for a reasonable value, which isn't always nice, but works for me... however, that doesn't work with the types! |
| 16:54:51 | <Berengal> | @type let f id = fix id `asTypeOf` fix in f |
| 16:54:52 | <lambdabot> | forall a. (((a -> a) -> a) -> (a -> a) -> a) -> (a -> a) -> a |
| 17:00:30 | <myname> | hi |
| 17:00:44 | <BONUS> | hi |
| 17:00:45 | <Berengal> | Hello |
| 17:00:50 | <shapr> | hy |
| 17:00:57 | <myname> | im using irc for the first time |
| 17:01:01 | <shapr> | spiffy |
| 17:01:14 | <shapr> | myname: Are you interested in Haskell? |
| 17:01:15 | <myname> | dont i need a user name and password? |
| 17:01:29 | <myname> | yeah, that's why i came here |
| 17:02:18 | <myname> | how can i register an account? if neednt, how can i at least set my name? :) |
| 17:02:28 | <shapr> | No, you don't need a username and password to connect to irc. |
| 17:02:30 | <beelsebob> | myname: /nick |
| 17:02:35 | <Berengal> | Everyone has a username, even if they didn't choose you. You can change your name by going '/nick <name>' |
| 17:02:37 | <shapr> | You can change your nick name with /nick someothername |
| 17:02:45 | <shapr> | Your username is lars |
| 17:02:58 | <beelsebob> | myname: if you want to keep hold of your name, do /msg nickserv help, and it'll tell you about the nick protection services |
| 17:03:26 | <myname> | oh i see |
| 17:04:07 | <myname> | lars is my linux login name |
| 17:04:13 | <myname> | you can see that? |
| 17:04:19 | <koeien> | yes |
| 17:04:27 | <mauke> | yes, your irc client sent it |
| 17:04:32 | <mauke> | myname!n=lars@143.89.214.183 |
| 17:04:32 | <koeien> | /whois |
| 17:04:45 | <EvilTerran> | most irc clients include it in the whois data they provide to the nextwork |
| 17:04:48 | <koeien> | if you /whois me, you'll even see my full name |
| 17:04:49 | <EvilTerran> | *network |
| 17:04:50 | <myname> | oh, i can only see: < myname> lars is my linux login name |
| 17:05:04 | <mauke> | /set user_name whatever |
| 17:05:07 | <shapr> | myname: Try "/whois myname" |
| 17:05:15 | <mauke> | but you need to disconnect before it takes effect |
| 17:05:41 | <myname> | there is no any output of "/whois myname" |
| 17:05:55 | <shapr> | weird |
| 17:05:59 | <shapr> | What irc client are you using? |
| 17:06:04 | <myname> | irssi |
| 17:06:08 | <koeien> | ALT+1 |
| 17:06:10 | <shapr> | I haven't used that one. |
| 17:06:11 | <koeien> | ALT+2 to go back here |
| 17:06:25 | <mauke> | whois output goes in status window |
| 17:07:14 | <myname> | so it seems to be the problem of my client. so i'll turn to do the RTFM thing at first :) |
| 17:07:50 | <Berengal> | myname: your username is unimportant. Your nickname is what people will use |
| 17:08:50 | <shapr> | myname: In any case, you've found the right place to talk about Haskell! Welcome to where the cool kids hang out! |
| 17:08:59 | <shapr> | Actually, it's pretty warm in Boston today, so warm kids? |
| 17:09:09 | <Berengal> | I'm warm too... |
| 17:09:10 | <myname> | i've been learning haskell for years but still a newbie |
| 17:09:39 | <myname> | it's good to have a place to talk |
| 17:09:40 | <Berengal> | Everyone's a newbie when it comes to Haskell, unless your name is Simon... |
| 17:10:01 | <tetha> | I'd guess calling yourself a newbie is a good step beyond being a newbie, with all the paradoxes it causes |
| 17:10:05 | <Simon_> | YES i know all about haskell |
| 17:10:19 | <shapr> | hah |
| 17:10:34 | <shapr> | I've been learning Haskell for eight years or so, and there's still so much to learn! |
| 17:11:36 | <SubStack> | ACTION is pawing at rose zippers |
| 17:12:24 | <Berengal> | Mmm, type families... |
| 17:12:29 | <Berengal> | ACTION has a paper to read |
| 17:12:30 | <myname> | i feel the hardest thing to program in haskell, is to totally change the way of thinking a problem. it's too different from normal languages. |
| 17:13:11 | <myname> | so now i can read some haskell code, but cannot program by myself |
| 17:13:16 | <Berengal> | myname: Yeah, the first part of learning haskell is to unlearn everything else first |
| 17:13:31 | <mux> | yay, haddock docs generated |
| 17:13:49 | <myname> | indeed. |
| 17:25:50 | <kyevan> | I wish haskell had a random number function. It's the only language I can think of where you could then do something like 12d10 and have it work :P |
| 17:26:30 | <burp_> | it has.. |
| 17:26:32 | <mauke> | :t randomIO |
| 17:26:33 | <lambdabot> | forall a. (Random a) => IO a |
| 17:26:43 | <roconnor> | @type randomsIO |
| 17:26:44 | <lambdabot> | Not in scope: `randomsIO' |
| 17:26:45 | <kyevan> | (You can *probably* do it at some higher level, have 12d10 return 'sum twelve d10s' and then doing that 'later', but you can't really do it in haskell itself) |
| 17:27:10 | <mux> | @dice 12d10 |
| 17:27:11 | <lambdabot> | 12d10 => 70 |
| 17:27:13 | <mux> | @dice 12d10 |
| 17:27:14 | <lambdabot> | 12d10 => 43 |
| 17:27:15 | <trofi> | :] |
| 17:27:37 | <opqdonut> | 12 * die 10 would work probably |
| 17:27:44 | <opqdonut> | with a suitable num instance for dice |
| 17:28:32 | <Zao> | opqdonut: Aren't some outcomes more probably than others? |
| 17:28:38 | <kyevan> | eh, you can do it in c or whatever, but it's not in the language, you have to write a parser and such... which you can do in haskell+IOm too. |
| 17:28:52 | <opqdonut> | Zao: errr, yeah, of course |
| 17:28:59 | <opqdonut> | 12 * die 10 != die 120 |
| 17:29:03 | <roconnor> | @let n `d` s = sum `liftM` replicateM n (getRandomR (1,s)) |
| 17:29:04 | <lambdabot> | <local>:11:37: Not in scope: `getRandomR' |
| 17:29:07 | <opqdonut> | but that doesn't violate num laws or verything |
| 17:29:13 | <opqdonut> | yes, something like that roconnor |
| 17:29:14 | <Zao> | Many outcomes would be rather hard to find with your way :P |
| 17:29:24 | <opqdonut> | how come? |
| 17:30:43 | <opqdonut> | data Die = Die Random | Always Int, fromIntegral 12 = Always 12, die 10 = Die randomR (1,10), etc |
| 17:30:45 | <C-Keen> | can I build ghc 6.10.3 with 6.6? |
| 17:30:56 | <opqdonut> | (shoddy syntax, yes) |
| 17:30:57 | <kyevan> | roconnor: See, that to me goes 'outside haskell' to do most of the work. |
| 17:31:05 | <kyevan> | Or outside 'pure' haskell, anyway... |
| 17:31:12 | <roconnor> | @let n `d` s = sum `liftM` replicateM n (uniform [1..s]) |
| 17:31:13 | <lambdabot> | <local>:11:37: Not in scope: `uniform' |
| 17:31:16 | <kyevan> | It's the only way I've kept my sanity so far :P |
| 17:31:16 | <stroan> | hurm, anyone used wxHaskell before? |
| 17:33:05 | <raxas> | Zao: that's purpose, multidice throw approximates gauss distribution, very useful for old times paper games |
| 17:33:15 | <alexsuraci> | Why is it that trying to print the lambda character (both by pasting it into the code and by printing its unicode identifier, \x03BB), it outputs "»" instead? (My terminal has full unicode support.) |
| 17:33:50 | <BMeph> | alexsuraci: Uh, 'cause "ur doin it rong"? ;) |
| 17:33:52 | <mauke> | how are you trying to print it? |
| 17:34:01 | <mauke> | BMeph: I'd blame the IO libraries |
| 17:34:06 | <pejo> | C-keen, you should be able to do that. |
| 17:34:08 | <SamB> | yeah, the IO libraries |
| 17:34:24 | <SamB> | they were never really designed for anything beyond ASCII ... |
| 17:34:26 | <C-Keen> | pejo: it fails because it cannot find haskeline, and I fail to install haskeline with 6.6... |
| 17:34:26 | <alexsuraci> | http://paste.pocoo.org/show/ipMj0CDuvAPDhhdbp6QD/ |
| 17:34:39 | <SamB> | well, I mean, not the ones in Prelude, anyway |
| 17:34:43 | <mauke> | alexsuraci: yep, putStrLn doesn't support unicode :( |
| 17:34:44 | <alexsuraci> | second thing is wrong, ignore that, just trying different things :P |
| 17:34:48 | <alexsuraci> | aw, boo |
| 17:35:01 | <SamB> | Char being Unicode was kinda a "we have the bits anyway, why not?" thing |
| 17:35:18 | <alexsuraci> | any way around it? |
| 17:35:19 | <mauke> | alexsuraci: http://hackage.haskell.org/packages/archive/utf8-string/0.3.4/doc/html/System-IO-UTF8.html |
| 17:35:43 | <alexsuraci> | mauke: thanks, I'll try that |
| 17:36:46 | <hatds> | so Strings aren't unicode? I'm confused |
| 17:37:08 | <alexsuraci> | They are, the prelude IO library just doesn't seem to handle it well |
| 17:37:20 | <hatds> | ok |
| 17:37:52 | <BMeph> | hatds: Yeah, I'd think of it as, "Strings are Unicode, but output is not." :( |
| 17:38:13 | <alexsuraci> | Is there any chance of the UTF8 IO module being the default down the line? |
| 17:38:14 | <roconnor> | Basically GHC's IO libs are broken. |
| 17:38:16 | <alexsuraci> | Seems kind of silly |
| 17:38:44 | <hatds> | the output functions should be more explicit about that... character encoding feels like it is a property of the type, so any function accepting that type should behave in the expected way |
| 17:38:54 | <roconnor> | there is a chance. |
| 17:39:43 | <roconnor> | granted, the operating systems certainly doesn't make it easy on GHC to do proper IO. |
| 17:40:44 | <alexsuraci> | how so? |
| 17:40:49 | <roconnor> | really putChar ought to through an exception when trying to print nonAscii characters if GHC isn't going to do it properly. |
| 17:41:10 | <kosi> | Hi, I've got a question on polymorphism. I've uploaded some code to http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4937#a4938 and my question is how to define f2 and/or conv? (I know the heterogeneous list approach, just asking if this is possible without it) |
| 17:41:10 | <hatds> | I'm reminded of C/C++ where you have *compiler* settings and #defines that determine how strings are encoded |
| 17:41:39 | <roconnor> | alexsuraci: it is really hard to know what character encoding is expected. |
| 17:42:03 | <monochrom> | Java lets you choose during runtime. |
| 17:42:10 | <p_l> | ACTION just sets everything to UTF-8 and doesn't care about rest |
| 17:42:11 | <hatds> | yea I guess.. inter program communication won't know about each other's type systems :) |
| 17:42:30 | <monochrom> | Yes, everyone should just use UTF-8. |
| 17:42:49 | <alexsuraci> | kosi: I don't think it wants you to be so specific in the definition |
| 17:42:59 | <roconnor> | Does UTF-8 support all unicode characters? Even maxbound::Char ? |
| 17:43:03 | <mauke> | kosi: conv's type doesn't make sense |
| 17:43:05 | <alexsuraci> | it'd be like saying "foo :: a; foo = 'h';" |
| 17:43:06 | <monochrom> | Yes. |
| 17:43:15 | <roconnor> | I didn't know that. |
| 17:43:37 | <mauke> | kosi: f2 has the wrong type; you want something like f2 :: [exists a. C a => a], which is invalid |
| 17:43:40 | <p_l> | roconnor: it supports all, not only BMP |
| 17:43:52 | <monochrom> | You thought UTF-8 were some joke like "IBM High ASCII"? |
| 17:44:05 | <BMeph> | ACTION thinks someone's using a "C++"-style definition of "polymorphism"... |
| 17:44:09 | <trofi> | reverse . EBCDIC |
| 17:44:15 | <roconnor> | I thought UTF-8 maxed out at 0xFFFF |
| 17:44:20 | <Zao> | roconnor: No. |
| 17:44:26 | <Zao> | UTF-8 can encode all 17 planes. |
| 17:44:29 | <copumpkin> | roconnor: 10ffff |
| 17:44:30 | <trofi> | man utf-8 |
| 17:44:34 | <roconnor> | I mean U+0xFFFF of course. |
| 17:44:36 | <roconnor> | ok |
| 17:44:37 | <mauke> | roconnor: that's UCS-2 |
| 17:44:39 | <Zao> | (and more, but that wouldn't be valid unicode codepoints nor UTF-8) |
| 17:44:52 | <mauke> | (and you mean U+FFFF :-) |
| 17:44:53 | <Zao> | All the UTF transformation formats can represent all of unicode. |
| 17:45:08 | <kosi> | oh, ok. is there any way of dropping 'concrete' type information in favour of class type information? |
| 17:45:11 | <copumpkin> | utf8 was cut down so it only represented all of unicod |
| 17:45:11 | <copumpkin> | e |
| 17:45:28 | <roconnor> | I certainly think if GHC's putChar blindly output UTF-8, it would be an improvement. |
| 17:45:29 | <p_l> | the difference is whether they can do it through surrogate pairs or directly. UTF-8 does it directly |
| 17:45:41 | <mauke> | kosi: AFAIK the only way is existential wrappers, i.e. your HmgC |
| 17:45:42 | <Zao> | copumpkin: Except if you use Java. Their idea of UTF-8 is amusing. |
| 17:45:56 | <copumpkin> | Zao: yeah, that's ugly |
| 17:46:00 | <Zao> | p_l: Well, technically UTF-8 has an assload of surrogate sequences :) |
| 17:46:02 | <copumpkin> | their idea of characters in general is ugly |
| 17:46:10 | <p_l> | Zao: Because their internal stuff doesn't work with chars >16bit |
| 17:46:25 | <kosi> | mauke: ok, thanks |
| 17:46:29 | <p_l> | Zao: Well, I meant after Transport Formm -> Char |
| 17:46:31 | <p_l> | *Form |
| 17:48:03 | <Zao> | p_l: I don't quite see your point. UTF-16 parsed into codepoints also yields codepoints. |
| 17:48:15 | <inimino> | p_l: UTF-16 can be turned into reasonable chars too, it's just that most languages that use UTF-16 don't do that |
| 17:48:19 | <Zao> | The only difference being that UTF-16 code units are often usable as codepoints. |
| 17:48:37 | <Zao> | Ignorantly, in many cases. |
| 17:49:01 | <inimino> | UTF-8 code units are often usable as codepoints too |
| 17:49:21 | <BMeph> | ...there are just fewer of them. :) |
| 17:49:26 | <Zao> | inimino: In a quite narrower range :) |
| 17:49:31 | <inimino> | indeed :) |
| 17:50:00 | <roconnor> | http://www.haskell.org/pipermail/glasgow-haskell-users/2009-February/016558.html |
| 17:50:03 | <BMeph> | ACTION internally translates UTF-8 to WTF-8... |
| 17:50:11 | <roconnor> | Ready for testing: Unicode support for Handle I/O |
| 17:50:13 | <p_l> | UTF-8 basically defined how to encode 31bit character into bytes for transport. But a character from outside BMP is still one char in UTF8, at least two in UCS2 (afaik) |
| 17:50:21 | <Zao> | BMeph: I have a tendency to use WTF-8 and Unikot a lot. |
| 17:50:26 | <inimino> | the only real difference is that UTF-16 has this UCS-2 legacy in a bunch of crappy languages and so doing real Unicode in it sucks |
| 17:50:27 | <Zao> | p_l: 21. |
| 17:50:50 | <Zao> | p_l: No codepoint outside of the BMP is one code unit in UTF-8. |
| 17:51:12 | <roconnor> | oh god, I forgot about all the problem with unicode Handel I/O |
| 17:51:17 | <inimino> | p_l: no, it's two code units in UTF-16 (and more in UTF-8, though the code units are only 8 bits) |
| 17:51:23 | <sjanssen> | oh great, this argument again |
| 17:51:31 | <inimino> | p_l: but it's still one char in both |
| 17:51:32 | <roconnor> | like, does seek move by bytes or by characters? |
| 17:51:37 | <roconnor> | oh god |
| 17:51:39 | <Zao> | All codepoints outside of the BMP are four code units in UTF-8. |
| 17:51:52 | <Zao> | All codepoints outside of the BMP are two code units in UTF-16. |
| 17:52:23 | <inimino> | p_l: assuming you use the definitions of "character" and "code unit" given by Unicode, at least... |
| 17:52:30 | <Zao> | Text is hard. |
| 17:52:39 | <p_l> | inimino: I skipped "Unicode standard" reading ;-) |
| 17:52:42 | <EvilTerran> | let's go shopping? |
| 17:52:50 | <roconnor> | SamB: I like how they tacked on Unicode support in the H'98 standard but totally dropped the ball on what the heck Handle IO does. |
| 17:52:52 | <monochrom> | Will Programming Be Liberated From The Plain Text File? |
| 17:53:01 | <inimino> | which many programming languages call anything a "char" that is actually a UTF-16 code unit, because of the sloppy UCS-2 legacy crap |
| 17:53:03 | <sjanssen> | heh |
| 17:53:38 | <hatds> | kosi: I hpasted a solution for you |
| 17:53:38 | <Zao> | p_l: A codepoint is an unicode integral value representing a glyph. A code unit is one element of a transformation format. |
| 17:53:55 | <Zao> | p_l: Byte in UTF-8, 16-bit word in UTF-16, etc. |
| 17:53:59 | <hatds> | kosi: tell me if it doesn't work though :) |
| 17:54:08 | <Zao> | A sequence of code units make up a codepoint. |
| 17:54:16 | <Zao> | When transformed, that is. |
| 17:54:34 | <inimino> | unless it's an incorrect sequence of code units :-) |
| 17:54:53 | <mauke> | > length "€" |
| 17:54:55 | <lambdabot> | 1 |
| 17:54:57 | <Baughn_> | And of course some codepoints don't represent glyphs, but instead alter adjacent code-points. ;) |
| 17:54:59 | <sjanssen> | the difference is that most UTF-16 implementations expose the individual code units as part of the interface, while most implementations of UTF-8 don't |
| 17:55:00 | <kyevan> | ...one of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs. |
| 17:55:01 | <inimino> | or a sequence of code units that makes up more than one codepoint |
| 17:55:02 | <kyevan> | Hehehe... |
| 17:55:03 | <hatds> | which is why Char should be called UnicodeCodePoint, Char makes me think of CChar |
| 17:55:09 | <inimino> | Baughn_: indeed |
| 17:55:15 | <mauke> | > length "€̈" |
| 17:55:16 | <lambdabot> | 2 |
| 17:56:01 | <inimino> | Char should be called Char, there's no sense in keeping the old convenient abbreviation only for something that's now obsolete |
| 17:56:05 | <Baughn_> | inimino: Sometimes I feel that, instead of standardizing on Unicode, we should have just standardized on English. |
| 17:56:09 | <Baughn_> | And I'm Norwegian. |
| 17:56:22 | <Zao> | Baughn_: Think of the snowmen! |
| 17:56:37 | <mauke> | http://unicodesnowmanforyou.com/ |
| 17:56:42 | <koeien> | Baughn_: please, take a language that is at least a bit pronounceable :) |
| 17:57:00 | <EvilTerran> | koeien, ah, and i was about to suggest lojban :P |
| 17:57:01 | <inimino> | Baughn_: hehe, well I'm glad we didn't, and I'm a native English speaker :) |
| 17:57:03 | <inimino> | ☃ |
| 17:57:17 | <p_l> | ACTION uses 21bit characters so he has less problems with unicode |
| 17:57:41 | <Baughn_> | ACTION uses a 16-bit computer. Unicode is annoying. |
| 17:57:47 | <p_l> | lol |
| 17:58:01 | <inimino> | p_l: trading for problems with alignment ;-) |
| 17:58:20 | <mauke> | C fully supports 21-bit chars |
| 17:58:23 | <monochrom> | Standardizing on English does not solve the problem of (λx → x ≥ x) :: Ord α ⇒ α → bool |
| 17:58:27 | <p_l> | inimino: 4 byte alignment. External format translation left for whatever lib you want to use :D |
| 17:58:52 | <p_l> | (or 3 byte, I suspect it's not very hard to modify) |
| 17:58:53 | <Zao> | mauke: It forbids having holes between adjacent elements though. |
| 17:58:54 | <roconnor> | ACTION uses a 6-bit computer. ASCII is annoying. |
| 17:58:55 | <EvilTerran> | 21-bit? what is that, EBCDICWTF? |
| 17:58:58 | <Zao> | mauke: So you'd need a 21-bit box. |
| 17:59:03 | <mauke> | Zao: yes! |
| 17:59:05 | <p_l> | EvilTerran: Unicode |
| 17:59:33 | <mauke> | CHAR_BIT == 21, sizeof (char) == 1, sizeof (int) == 1, sizeof (long) == 2 |
| 17:59:48 | <Zao> | mauke: Please mail me one. |
| 18:00:01 | <inimino> | p_l: ah, that makes it too easy, all you have to do is a little math, read a couple adjacent words, and do a shift and OR... |
| 18:00:04 | <inimino> | roconnor: well there's UTF-7 already maybe you can write UTF-6 |
| 18:00:19 | <idnar> | UTF-1! |
| 18:00:23 | <p_l> | there's also UTF-9 for all those 36bit machines ;-) |
| 18:00:23 | <roconnor> | http://programbytes48k.files.wordpress.com/2009/03/zx81-doorstop.jpg <- me using my computer |
| 18:00:53 | <mauke> | <- me not linking to zwiebeltüte |
| 18:01:01 | <p_l> | ouch, that's a job reserved for lexmark printers |
| 18:02:02 | <inimino> | but UTF-9 was actually intended as a joke, UTF-7 was just accidentally a joke |
| 18:02:23 | <p_l> | inimino: don't insult my PDP-10! :P |
| 18:02:30 | <kosi> | hatds: thanks |
| 18:02:31 | <inimino> | hehe |
| 18:02:35 | <Baughn_> | kyevan: So what's your third? |
| 18:02:41 | <p_l> | (emulated, but still) |
| 18:03:18 | <mauke> | sɹǝʇɔɐɹɐɥɔ ııɔsɐ ǝɥʇ ʎןןɐʇuǝpıɔɔɐ ı |
| 18:03:42 | <\\stro> | that's awesome |
| 18:03:54 | <kyevan> | Baughn_: Midnight, you know that one :J |
| 18:05:02 | <p_l> | we should have standardised on more expressive language than english :P |
| 18:07:29 | <koeien> | english is doubleplus ungood |
| 18:09:29 | <p_l> | at least it could get a really phonetic writing, or completely ideographic (we could add spelling help over it? ;P) |
| 18:11:21 | <Jedai> | German is pretty nice for this as it's pronounced exactly like it's written |
| 18:11:40 | <Jedai> | The grammar is pretty strict too |
| 18:12:05 | <p_l> | Yeah, but it could do well with some more type inference or remove some types |
| 18:12:16 | <mauke> | Der Tümpelkürschner punzt der Metze Zagel. |
| 18:13:26 | <p_l> | ACTION hated all that "der", "die", "das", ... mess |
| 18:13:33 | <johh> | @jedai: the writing of the words is not always very rational. Main and mein are spoken the same way and are different things |
| 18:13:33 | <lambdabot> | Unknown command, try @list |
| 18:13:35 | <Jedai> | Though after seven years of german courses I was unable to read anything but the most basic texts... |
| 18:14:22 | <beelsebob> | p_l: be glad you're not learning dutch |
| 18:14:22 | <Jedai> | johh: Well at least you have a clear "written form -> oral form" function |
| 18:14:29 | <beelsebob> | at least german has some logic behind its genders |
| 18:14:34 | <koeien> | mit,nach,bei,seit,von,zu,aus right? :P |
| 18:14:38 | <beelsebob> | dutch has arbitrarily chosen het/de |
| 18:14:46 | <p_l> | after 3 years of learning german I'm thinking of removing "basic german" from CV |
| 18:14:47 | <koeien> | beelsebob: it's not arbitrary! :P |
| 18:14:57 | <koeien> | i never do it wrong |
| 18:15:10 | <beelsebob> | koeien: o.O if you can provide a logic behind it I'll come give you a blowjob! |
| 18:15:12 | <roconnor> | beelsebob: I thought there was a map from german genders to dutch genders. |
| 18:15:16 | <Jedai> | p_l: I can understand that... ^^ |
| 18:15:28 | <beelsebob> | roconnor: not that I know of |
| 18:15:35 | <koeien> | beelsebob: there is a mapping from words to {M,F,N} |
| 18:15:35 | <p_l> | I understood more of japanese after 2 years of not very diligent studying |
| 18:15:50 | <beelsebob> | koeien: no there's not |
| 18:15:51 | <beelsebob> | :P |
| 18:15:55 | <koeien> | almost ;) |
| 18:15:58 | <johh> | jedai: no, think of gläschen |
| 18:16:07 | <beelsebob> | dutch has gendered/non-gendered, not masculin/feminine/neuter |
| 18:16:15 | <koeien> | beelsebob: that is not true |
| 18:16:22 | <beelsebob> | o.O |
| 18:16:27 | <Jedai> | johh: What's the problem with it ? |
| 18:16:36 | <hatds> | o.O |
| 18:16:38 | <beelsebob> | plenty of dutch/belgian people have told me this... now I'm *really* confused |
| 18:16:51 | <koeien> | beelsebob: yes. the articles are for M and F are the same |
| 18:17:12 | <beelsebob> | ACTION ponders if those statements are equivalent |
| 18:17:15 | <johh> | its a little glass but spoken gläs-chen not glä-schen |
| 18:17:20 | <koeien> | but, if you want to refer to a word, you will need hij/zij/het ('he'/'she'/'it') |
| 18:17:22 | <beelsebob> | no... not quite |
| 18:17:39 | <mauke> | das Naschen / das Näschen |
| 18:17:42 | <beelsebob> | koeien: can you give an example where you'd use that? |
| 18:17:46 | <koeien> | or, zijn/haar ('his'/'her') |
| 18:17:58 | <roconnor> | koeien: I though the Dutch had given up on using zij for objects. |
| 18:18:12 | <pejo> | johh, what is the middle character there? |
| 18:18:14 | <roconnor> | at least that's how I remember being taught Dutch. |
| 18:18:24 | <koeien> | beelsebob: 'De regering kwam bijeen. Zij besloot...' |
| 18:18:34 | <mauke> | pejo: ä |
| 18:18:38 | <johh> | pejo: ä? |
| 18:18:45 | <beelsebob> | oh, I'd been told to use het in that situation koeien |
| 18:18:52 | <beelsebob> | difference with flemmish? |
| 18:18:58 | <koeien> | roconnor: 'Het'? That's really strange |
| 18:18:59 | <pejo> | johh, yeah. |
| 18:19:09 | <roconnor> | koeien: How old are you? :P |
| 18:19:13 | <koeien> | roconnor: 22 :P |
| 18:19:21 | <roconnor> | well, there goes that theory |
| 18:19:22 | <johh> | its between a and e like in hair |
| 18:19:36 | <beelsebob> | roconnor: what I've been taught and what you've been taught seem to agree though |
| 18:19:47 | <beelsebob> | who taught you, a dutch man, or a belgian? |
| 18:19:57 | <pejo> | johh, well, mauke answered my question. :-) |
| 18:20:19 | <roconnor> | beelsebob: I was taught Dutch 4 years ago in the netherlands. |
| 18:20:26 | <beelsebob> | hmm |
| 18:20:28 | <roconnor> | not that I learned it very well. |
| 18:20:28 | <beelsebob> | :/ |
| 18:20:33 | <beelsebob> | well ditto |
| 18:20:38 | <beelsebob> | maybe we've both been given the simple version? |
| 18:20:51 | <koeien> | i confess that most people might do the above example wrong |
| 18:20:52 | <beelsebob> | ACTION tends to trust the dutch speaker telling us how it is |
| 18:21:08 | <roconnor> | beelsebob: I don't think so |
| 18:21:14 | <beelsebob> | koeien: so is it true then that the gendering is roughly equivalent to german? |
| 18:21:23 | <beelsebob> | ACTION tries to think of an example where they don't match up |
| 18:21:33 | <roconnor> | beelsebob: when I accidentally used "haar", my teacher would say that is correct, but the old way of speaking. |
| 18:21:47 | <beelsebob> | oh, interesting |
| 18:21:48 | <koeien> | roconnor: maybe i'm old-fashioned :) |
| 18:22:29 | <koeien> | beelsebob: roughly |
| 18:22:42 | <beelsebob> | neat |
| 18:22:48 | <beelsebob> | that makes life much easier for me then |
| 18:22:53 | <koeien> | beelsebob: less inflection |
| 18:23:00 | <beelsebob> | I know a decent number of german genders |
| 18:23:06 | <koeien> | no 'cases' (except in some old expressions) |
| 18:23:13 | <mauke> | I only know three |
| 18:23:48 | <koeien> | but i'm not sure how well the genders translate between dutch and german |
| 18:23:56 | <roconnor> | koeien: I find it hard to believe you are old-fashioned at the age of 22. |
| 18:24:06 | <roconnor> | I wonder if it is a loction thing. |
| 18:24:06 | <JoshTriplett> | @pl \(x,y) -> (y,x) |
| 18:24:06 | <lambdabot> | uncurry (flip (,)) |
| 18:24:07 | <p_l> | roconnor: quite possible |
| 18:24:24 | <p_l> | roconnor: depends on what you read/watch etc :) |
| 18:24:26 | <roconnor> | koeien: but it is true that I was taught Dutch much more recently than you. |
| 18:24:31 | <beelsebob> | ACTION speaks old fassioned english at 26 |
| 18:24:46 | <beelsebob> | I've not met anyone else who actually manages to get who/whom and less/fewer right |
| 18:24:58 | <roconnor> | I'm pretty good at who/whom |
| 18:25:00 | <mauke> | hah. trivial, my dear watson |
| 18:25:06 | <koeien> | beelsebob: less/fewer is confusing for me as well, they are the same in dutch |
| 18:25:14 | <beelsebob> | koeien: yeh, I can get it for dutch people |
| 18:25:19 | <mauke> | you use "who" for "wer" and "whom" for "wen" and "wem" |
| 18:25:29 | <beelsebob> | what I can't understand is that british people can't get it when they *can* get more/many |
| 18:25:38 | <beelsebob> | much/many even |
| 18:25:41 | <monochrom> | gender, singular/plural, countable/uncountable, prepositions are all language scams. |
| 18:25:42 | <hatds> | people say 'whom' is on its way out |
| 18:25:55 | <roconnor> | hatds: that could be true. |
| 18:26:14 | <beelsebob> | monochrom: I'm unconvinced by the singular/plural one, but I'm not sure I can give you an ambiguous example |
| 18:26:27 | <beelsebob> | perhaps the sheep/sheep thing proves I can't |
| 18:26:31 | <mmorrow_> | in 99% of speaking situations i wouldn't use whom, even if i know it to be "correct" |
| 18:26:38 | <koeien> | roconnor: but of most words i don't even know the gender. only whether it's masculine or feminine |
| 18:26:47 | <koeien> | roconnor: ehm, either M/F or N |
| 18:26:59 | <monochrom> | We Chinese do find without singular/plural. |
| 18:27:04 | <koeien> | yes, i heard that |
| 18:27:04 | <roconnor> | koeien: that's good. |
| 18:27:04 | <monochrom> | s/find/fine/ |
| 18:27:12 | <koeien> | monochrom: also, without articles |
| 18:27:13 | <koeien> | right? |
| 18:27:18 | <monochrom> | Yes. |
| 18:27:43 | <monochrom> | First-order logic also do fine without language scams. |
| 18:28:00 | <koeien> | but, how would you describe first-order logic without natural language? |
| 18:28:11 | <monochrom> | use Chinese. :) |
| 18:28:22 | <beelsebob> | koeien: isn't the question "how would you define it without natural language with plurals" |
| 18:28:25 | <mauke> | ☯ |
| 18:29:09 | <monochrom> | The first-order logic example is to dispell the myth "without singular/plural you get ambiguity". It doesn't say you should teach first-order logic to new born babies. |
| 18:29:33 | <beelsebob> | (you should though) |
| 18:29:34 | <beelsebob> | :P |
| 18:29:42 | <dsouza> | ACTION now using unifont :-) |
| 18:29:47 | <koeien> | ok |
| 18:29:59 | <mauke> | excellent |
| 18:30:10 | <beelsebob> | ACTION taps fingers together |
| 18:40:00 | <mmorrow_> | , let (yin,yang) = fix (\x -> (Node()[snd x],Node()[fst x])) in vacuum yin == vacuum yang |
| 18:40:02 | <lunabot> | True |
| 18:41:05 | <mauke> | :t Node |
| 18:41:06 | <lambdabot> | forall a. a -> Forest a -> Tree a |
| 18:41:18 | <opqdonut> | Node? |
| 18:41:20 | <opqdonut> | :t Node |
| 18:41:22 | <lambdabot> | forall a. a -> Forest a -> Tree a |
| 18:41:25 | <mauke> | ... |
| 18:41:34 | <opqdonut> | heh |
| 18:42:10 | <mmorrow_> | , levels (fix (\x -> Node () [x,x])) |
| 18:42:12 | <lunabot> | [[()],[(),()],[(),(),(),()],[(),(),(),(),(),(),(),()],[(),(),(),(),(),(),... |
| 18:42:37 | <mmorrow_> | , fmap length (levels (fix (\x -> Node () [x,x]))) |
| 18:42:40 | <lunabot> | luna: out of memory (requested 1048576 bytes) |
| 18:42:44 | <mmorrow_> | , take 10 $ fmap length (levels (fix (\x -> Node () [x,x]))) |
| 18:42:45 | <lunabot> | [1,2,4,8,16,32,64,128,256,512] |
| 18:43:10 | <mmorrow_> | , vacuum (fix (\x -> Node () [x,x])) |
| 18:43:12 | <lunabot> | [(0,[1,2]),(1,[]),(2,[0,3]),(3,[0,4]),(4,[])] |
| 18:44:36 | <mmorrow_> | Tree is the only thing in the stdlibs that's recursive with more than one way to go (that i can think of) |
| 18:48:05 | <adam123> | is this a (noteworthy) bug? -> http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2438#a2438 |
| 18:48:16 | <adam123> | (GHC bug?) |
| 18:48:35 | <mmorrow> | heh |
| 18:48:41 | <mauke> | not a bug, I'd say |
| 18:48:41 | <roconnor> | I don't think so myself |
| 18:48:56 | <bombshelter13_> | Can anyone recommend me a good introduction to category theory, maybe a book that starts at a fairly introductory level? It seems kind of important to full understanding of haskell, so i'd like to learn more about it... |
| 18:49:25 | <roconnor> | it's not really important to understand haskell. |
| 18:49:34 | <duaneb> | hi people |
| 18:49:42 | <duaneb> | cabal is ignoring my .cabal/config, I think |
| 18:50:00 | <duaneb> | I have it marked to look in /opt/local/include for headers, but it still can't find gmp.h |
| 18:50:08 | <duaneb> | and yes, gmp.h DOES exists there |
| 18:50:30 | <mmorrow> | it's probably looking in $HOME/Pictures or something for it :/ |
| 18:50:35 | <mmorrow> | ACTION ducks |
| 18:50:38 | <roconnor> | bombshelter13_: but Category Theory does have a lot of good ideas in it, that are applicable to Haskell. |
| 18:50:57 | <bombshelter13_> | roconnor: yeah, it seems to have inspired a lot of the design decisions |
| 18:51:26 | <mauke> | export CPATH=/opt/local/include |
| 18:51:28 | <roconnor> | Sadly I've never found a good introduction to Category Theory |
| 18:51:30 | <stroan> | bombshelter13_: Basic Category Theory for Computer Scientists |
| 18:52:21 | <duaneb> | mauke: yea, but why does the .cabal/config file not work? |
| 18:52:36 | <mauke> | no idea |
| 18:53:08 | <bombshelter13_> | Hmm, I saw that one, yeah... looked pricey for a smallish book, so I didn't wanna get it without at least a recommendation that it was actually decent |
| 18:53:11 | <dons> | bombshelter13_: its not important to understand haskell, any more than it is important for say, erlang. certainly it won't hurt you. |
| 18:53:15 | <cypher-> | ACTION is looking forward to the next year's course at his uni: CT for CS and Adv CT for CS :D |
| 18:53:19 | <duaneb> | mauke: thanks, though |
| 18:53:30 | <duaneb> | Also, completely random: is there a pocket reference to haskell? |
| 18:53:48 | <cypher-> | bombshelter13_: you can find quite a few lecture notes online |
| 18:54:13 | <cypher-> | bombshelter13_: some of them very comprehensive, could make a book easily, except that they are free |
| 18:54:14 | <dons> | duaneb: yeah, the haskell 'cheatsheet' on hackage. |
| 18:54:29 | <dons> | duaneb: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/CheatSheet |
| 18:54:36 | <duaneb> | I mean, I have the Zvon things |
| 18:54:37 | <bombshelter13_> | duaneb: cypher-: yeah, it just seems tricky to sort out the ones that are appropriate for beginners |
| 18:54:37 | <duaneb> | thing* |
| 18:54:38 | <mauke> | http://hackage.haskell.org/trac/ghc/ticket/3121 - related? |
| 18:55:03 | <monochrom> | If you want category theory, the short book "basic category theory for computer scientists" is good. |
| 18:55:12 | <duaneb> | mauke: what's the CPATH for libraries? |
| 18:55:15 | <duaneb> | Same issue for linking |
| 18:55:16 | <cypher-> | bombshelter13_: http://www.cl.cam.ac.uk/~gw104/catnotes.ps |
| 18:55:23 | <cypher-> | bombshelter13_: here's an example ^ |
| 18:55:31 | <bombshelter13_> | cool, I'll give that a read :) |
| 18:55:39 | <bombshelter13_> | monochrom: yeah, with two recommendations so far I think i'll pick it up :) |
| 18:56:57 | <mauke> | LD_LIBRARY_PATH maybe? |
| 18:57:32 | <pejo> | duaneb, LDFLAGS might be what you're looking for. |
| 18:57:32 | <dons> | have people read and commented on SPJs + Oleg + CCShan's new paper? http://www.reddit.com/r/programming/comments/8kygl/fun_with_type_functions_oleg_kiselyov_ken_shan/ |
| 18:57:34 | <cypher-> | can someone recommend very short (but good) introduction to modal logic? |
| 18:58:55 | <duaneb> | pejo: thanks, that appears to work |
| 18:59:31 | <mux> | dons: hiya there! I did read it and found it very nice |
| 18:59:34 | <duaneb> | anyone here work on LHC? |
| 18:59:42 | <dons> | Lemmih does. |
| 18:59:47 | <dons> | he's the L in LHC |
| 18:59:50 | <duaneb> | of the haskell variety, not higgs boson |
| 19:00:05 | <monochrom> | "God's haskell compiler"? :) |
| 19:00:11 | <duaneb> | Lemmih: you guys interested in a new backend? |
| 19:00:29 | <mauke> | Lemmih Hadron Collider |
| 19:00:40 | <mux> | dons: I really like their typed printf implementation |
| 19:00:46 | <dons> | whole program compilers are somewhat like 'colliders' |
| 19:00:55 | <dons> | anything we can rip out and put on hackage? |
| 19:01:07 | <dons> | ACTION hates to see type correct code in papers, but not on hackage |
| 19:02:22 | <mux> | dons: have you seen the bsd-sysctl package I uploaded today? you could use it in cpuperf to get the sysctl at the library level :) |
| 19:05:07 | <duaneb> | anyone else really hate darcs? |
| 19:05:08 | <duaneb> | ACTION ducks |
| 19:05:14 | <duaneb> | just kidding |
| 19:05:24 | <duaneb> | but seriously, is there an Hg community here? |
| 19:05:28 | <duaneb> | or at least git? :/ |
| 19:05:32 | <cypher-> | ACTION likes perforce, but it's quite exensive |
| 19:05:36 | <cypher-> | *expensive |
| 19:05:40 | <duaneb> | cypher-: yea |
| 19:05:44 | <duaneb> | nice build system, though :P |
| 19:05:47 | <duaneb> | ACTION hearts perforce jam |
| 19:06:05 | <cypher-> | the only thing I hate is CVS + whole software layer on top of it that one of my former employers used |
| 19:06:10 | <TomMD> | duaneb: One of the best known Haskellers is a centrail mercurial dev, so you don't get kicked for voicing a different opinion. |
| 19:06:15 | <cypher-> | I still have nightmares |
| 19:06:25 | <TomMD> | s/sentrail/central |
| 19:06:29 | <TomMD> | err, yeah |
| 19:07:03 | <saleop> | Hey guys. Is there a way to set up ghci to start up with whatever prompt you want it to have? |
| 19:07:08 | <duaneb> | Yea, I really don't mind USING darcs, I just couldn't fit my workflow into it |
| 19:07:15 | <duaneb> | the lack of branching is... unfortunate |
| 19:07:26 | <duaneb> | true branching, anyway |
| 19:07:28 | <TomMD> | saleop: You can add commands to the .ghci file, which is loaded at startup. |
| 19:07:31 | <koeien> | ACTION likes hg a bit more than darcs, but hates git |
| 19:07:36 | <trofi> | ACTION always complains on darcs' speed |
| 19:07:47 | <Cale> | saleop: By that do you just mean the prompt, or do you mean loading modules? Both are possible. |
| 19:07:58 | <dons> | mux: yeah, possible. |
| 19:08:11 | <dons> | yes, we have both core darcs and core hg devs |
| 19:08:13 | <TomMD> | @users |
| 19:08:14 | <lambdabot> | Maximum users seen in #haskell: 658, currently: 606 (92.1%), active: 23 (3.8%) |
| 19:08:15 | <saleop> | Cale: just the prompt.. |
| 19:08:36 | <cypher-> | oh, something that I relly need: what is the best unification algorithm that one can execute by hand? |
| 19:08:54 | <Cale> | saleop: You can just add an appropriate :set prompt line to your .ghci |
| 19:08:58 | <mauke> | echo ':set prompt "C:\>"' >> ~/.ghci |
| 19:09:11 | <mmorrow> | hah |
| 19:09:16 | <mmorrow> | DIR |
| 19:09:17 | <saleop> | ooh |
| 19:09:40 | <mmorrow> | ACTION is tempted by that |
| 19:09:48 | <saleop> | this is really dumb, but i don't know where my .ghci is :x |
| 19:09:56 | <mauke> | in ~ |
| 19:10:03 | <duaneb> | ACTION wishes you could have things like (*) :: (Num a) => String => a -> String |
| 19:10:04 | <Cale> | saleop: It might not exist yet. |
| 19:10:04 | <TomMD> | saleop: Are you on windows? |
| 19:10:05 | <mmorrow> | it doesn't exist unless you've made it |
| 19:10:09 | <saleop> | TomMD: os x |
| 19:10:15 | <saleop> | it's in ~? ok.. |
| 19:10:15 | <duaneb> | and vice versa, of course |
| 19:10:31 | <bombshelter13_> | that is why he said ~/.ghci, yeah... |
| 19:10:40 | <mauke> | duaneb: and what is "foo" * 0.5? |
| 19:11:05 | <mmorrow> | > fix error |
| 19:11:06 | <lambdabot> | "* Exception: * Exception: * Exception: * Exception: * Exception: * Excepti... |
| 19:11:35 | <duaneb> | mauke: ok, (Integral a) => String -> a -> String |
| 19:11:38 | <adamvo> | > replicate 0.5 "foo" |
| 19:11:39 | <lambdabot> | No instance for (Fractional Int) |
| 19:11:39 | <lambdabot> | arising from the literal `0.5' ... |
| 19:11:50 | <adamvo> | > replicate 6 "foo" |
| 19:11:51 | <mmorrow> | @type |
| 19:11:52 | <lambdabot> | ["foo","foo","foo","foo","foo","foo"] |
| 19:11:52 | <lambdabot> | <no location info>: not an expression: `' |
| 19:11:55 | <mauke> | duaneb: "foo" * (-2) |
| 19:11:57 | <TomMD> | > let s = "foo" in take (fromIntegral $ fromIntegral (length foo) * 0.5) foo |
| 19:11:58 | <lambdabot> | Not in scope: `foo'Not in scope: `foo' |
| 19:11:58 | <vixey> | "fooooooooooooooooooooooooooooo" |
| 19:11:59 | <duaneb> | but "foo" * 5 would be replicate 5 "foo" |
| 19:12:00 | <mmorrow> | @type \x -> (++ show x) |
| 19:12:01 | <lambdabot> | forall a. (Show a) => a -> [Char] -> [Char] |
| 19:12:08 | <TomMD> | > let s = "foo" in take (fromIntegral $ fromIntegral (length s) * 0.5) s |
| 19:12:08 | <kyevan> | Hmm... is there a "replicate indefinately"? |
| 19:12:09 | <lambdabot> | Add a type signature |
| 19:12:11 | <mmorrow> | @type \x -> (show x ++) |
| 19:12:12 | <lambdabot> | forall a. (Show a) => a -> [Char] -> [Char] |
| 19:12:13 | <koeien> | kyevan: repeat |
| 19:12:14 | <vixey> | > cycle "foo" |
| 19:12:15 | <lambdabot> | "foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofo... |
| 19:12:20 | <Cale> | > repeat "foo" |
| 19:12:22 | <lambdabot> | ["foo","foo","foo","foo","foo","foo","foo","foo","foo","foo","foo","foo","f... |
| 19:12:22 | <adamvo> | > repeat "pew" |
| 19:12:23 | <duaneb> | > replicate -2 "foo" |
| 19:12:23 | <lambdabot> | ["pew","pew","pew","pew","pew","pew","pew","pew","pew","pew","pew","pew","p... |
| 19:12:24 | <lambdabot> | No instance for (Num (Int -> a -> [a])) |
| 19:12:24 | <lambdabot> | arising from a use of `-... |
| 19:12:26 | <mmorrow> | @type \x -> flip (++ show x) |
| 19:12:27 | <lambdabot> | Couldn't match expected type `b -> c' |
| 19:12:28 | <lambdabot> | against inferred type `[Char]' |
| 19:12:28 | <lambdabot> | In the first argument of `flip', namely `(++ show x)' |
| 19:12:35 | <Cale> | > replicate (-2) "foo" |
| 19:12:37 | <lambdabot> | [] |
| 19:12:46 | <Jedai> | mauke: mauke: Perl would tell you that "foo" * 0.5 is "" |
| 19:12:47 | <duaneb> | there ye go :P |
| 19:12:48 | <kyevan> | > cycle [1, 2, 3] |
| 19:12:49 | <lambdabot> | [1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,... |
| 19:13:04 | <mauke> | Jedai: I don't think so |
| 19:13:06 | <kyevan> | There you go. That's how you count 3/4 time. IS THAT SO HARD? :P |
| 19:13:12 | <mauke> | Jedai: it's 0 |
| 19:13:16 | <kyevan> | > repeat [1,2,3] |
| 19:13:17 | <lambdabot> | [[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1... |
| 19:13:19 | <TomMD> | @check \x -> cycle (x ++ " ") == unwords (repeat x) |
| 19:13:23 | <kyevan> | If you prefer to see measures :J |
| 19:13:26 | <lambdabot> | mueval: Time limit exceeded |
| 19:13:39 | <kyevan> | Also... how does Lambdabot handle infinite lists? |
| 19:13:40 | <Jedai> | mauke: Well "foo" x 0.5 |
| 19:13:47 | <trofi> | kyevan: lazily |
| 19:13:56 | <koeien> | kyevan: just as all haskell programs do |
| 19:13:57 | <TomMD> | kyevan: Just see my previous test |
| 19:14:04 | <Jedai> | mauke: Since it's obviously what duaneb wanted to do |
| 19:14:12 | <kyevan> | No, I mean, how does she handle *displaying* them. |
| 19:14:13 | <kyevan> | :P |
| 19:14:22 | <roconnor> | > [1.. |
| 19:14:23 | <lambdabot> | <no location info>: parse error on input `;' |
| 19:14:24 | <roconnor> | > [1..] |
| 19:14:25 | <lambdabot> | [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... |
| 19:14:28 | <koeien> | > replicate 10000000 1 |
| 19:14:29 | <lambdabot> | [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,... |
| 19:14:31 | <kyevan> | Does she do her own display of them, 'giving up' at a certain point? |
| 19:14:37 | <koeien> | there is a max output size i guess |
| 19:14:39 | <Jedai> | mauke: Of course * is a numeric operator so force a numeric context on its arguments |
| 19:14:40 | <mauke> | take 100 . show |
| 19:14:47 | <trofi> | > take 100 $ show [1..] |
| 19:14:48 | <lambdabot> | "[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,2... |
| 19:14:53 | <trofi> | nothing special |
| 19:14:54 | <kyevan> | Oh, that'd work :J |
| 19:15:13 | <mauke> | > let x = flip replicate in "foo" `x` 3 |
| 19:15:14 | <lambdabot> | ["foo","foo","foo"] |
| 19:15:16 | <Cale> | > length "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," |
| 19:15:18 | <lambdabot> | 75 |
| 19:15:29 | <koeien> | > let fact n = product [1..n] in fact 1000000 |
| 19:15:31 | <lambdabot> | * Exception: stack overflow |
| 19:15:37 | <koeien> | doh |
| 19:16:02 | <Cale> | > let fact n = foldl' (*) 1 [1..n] in fact 1000000 |
| 19:16:05 | <mmorrow> | , let mutual f g a = f a (\b -> g b (\a -> mutual f g a)) in mutual (\x k -> x ++ k " HAI") (\x k -> x ++ k " OH") "OH" |
| 19:16:07 | <lunabot> | "OH HAI OH HAI OH HAI OH HAI OH HAI OH HAI OH HAI OH HAI OH HAI OH HAI OH... |
| 19:16:17 | <lambdabot> | thread killed |
| 19:16:18 | <koeien> | > 10^75 :: Integer |
| 19:16:20 | <lambdabot> | 1000000000000000000000000000000000000000000000000000000000000000000000000000 |
| 19:16:24 | <koeien> | > 10^80 :: Integer |
| 19:16:26 | <lambdabot> | 100000000000000000000000000000000000000000000000000000000000000000000000000... |
| 19:16:31 | <mmorrow> | > 10 ^ 400 |
| 19:16:31 | <koeien> | lists are not special |
| 19:16:33 | <lambdabot> | 100000000000000000000000000000000000000000000000000000000000000000000000000... |
| 19:16:39 | <bombshelter13_> | kyevan: maybe she takes x items from the list, strings it, and takes 2x characters from it, where 2x is her maximum display length in characters, such that even if each item in the list is 1 char long she still gets enough to fill her output size |
| 19:17:04 | <kyevan> | Yeah. I just wasn't thinking of take :J |
| 19:17:04 | <Cale> | No, it's just taking a certain amount of the show of the list. |
| 19:17:27 | <adamvo> | > fix show |
| 19:17:29 | <lambdabot> | "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\... |
| 19:17:39 | <mmorrow> | cat /dev/uranom | od | head -40 |
| 19:17:54 | <beelsebob> | @src product |
| 19:17:54 | <lambdabot> | product = foldl (*) 1 |
| 19:18:01 | <beelsebob> | hmm... isn't that the worst of both worlds |
| 19:18:03 | <trofi> | @dst /dev/null |
| 19:18:03 | <lambdabot> | Maybe you meant: ask dict ft let list msg |
| 19:18:17 | <kyevan> | Hmm... |
| 19:18:22 | <beelsebob> | we still get stack overflows, and we can't lazily check if lazy numbers are greater than a certain amount |
| 19:18:29 | <beelsebob> | i.e. shouldn't it be a foldr if we want to be lazy |
| 19:18:31 | <halberd> | does anybody know of any work on the modification of a proof for a statement S, to prove instead a slightly different statement S'? |
| 19:18:42 | <halberd> | modification by a computer |
| 19:19:03 | <kyevan> | map (\x -> \y -> y + x) [1..] |
| 19:19:20 | <halberd> | i.e. computer program gets as input S and a proof for S, and the statement S' which is similar to S, and the desired output is a proof for S' |
| 19:19:29 | <kyevan> | That would give you an infinite list of 'add_n_'s, right? |
| 19:19:44 | <adamvo> | ?type map (+) [1..] |
| 19:19:46 | <lambdabot> | forall a. (Enum a, Num a) => [a -> a] |
| 19:19:48 | <vixey> | halberd that sounds like hard work |
| 19:19:52 | <koeien> | kyevan: let's look at the types. |
| 19:19:58 | <vixey> | halberd is a proof of even 2 similar to a proof of even 3 ? |
| 19:20:05 | <koeien> | adamvo: almost, it's map (flip (+)) [1..] |
| 19:20:13 | <halberd> | vixey you are using some unicode symbol I can't see |
| 19:20:17 | <vixey> | no I'm not |
| 19:20:26 | <halberd> | [15:19:50] <vixey> halberd is a proof of even 2 similar to a proof of even 3 ? |
| 19:20:31 | <vixey> | that's what I wrote |
| 19:20:34 | <koeien> | i don't see anything strange there ? |
| 19:20:38 | <halberd> | oh |
| 19:20:46 | <halberd> | well I'm assuming S and S' are both true |
| 19:21:10 | <halberd> | and that they are similar in a way that changing the structure of the proof for S slightly will prove S' |
| 19:21:13 | <vixey> | if they are both true who cares |
| 19:21:19 | <vixey> | proofs are not needed |
| 19:21:22 | <koeien> | vixey: ? |
| 19:21:28 | <koeien> | what a strange statement |
| 19:21:32 | <adamvo> | you and your floating-point-non-commutative number non-algebras |
| 19:21:33 | <vixey> | If something is true you don't have to prove it |
| 19:21:40 | <halberd> | maybe you aren't sure it's true |
| 19:21:47 | <vixey> | but you said you are sure |
| 19:21:52 | <mauke> | vixey: of course you do |
| 19:21:54 | <halberd> | maybe the program is allowed to fail if it can't find a way to modify the proof for S to get a proof for S' |
| 19:22:16 | <halberd> | the reason for failure might be, S' is true but dissimilar to S, or S' is false (or S' is just unprovable) |
| 19:22:40 | <davidmccabe> | What is the distinction if any between String and [Char]? |
| 19:22:45 | <koeien> | davidmccabe: none. |
| 19:22:46 | <byorgey> | davidmccabe: none. |
| 19:22:46 | <mmorrow> | none |
| 19:22:57 | <halberd> | habit |
| 19:23:00 | <beelsebob> | the letters used when you type it |
| 19:23:01 | <byorgey> | String is a synonym for [Char], as if it had been declared type String = [Char] |
| 19:23:04 | <koeien> | type String = [Char] |
| 19:23:09 | <adamvo> | @check (\x y -> x+y == (y+x::Double)) |
| 19:23:09 | <halberd> | nun nun nun habit |
| 19:23:11 | <lambdabot> | "OK, passed 500 tests." |
| 19:23:14 | <davidmccabe> | Then why do I get, Couldn't match expected type `String' against inferred type `[a] -> [Char]' In the first argument of `putStrLn', namely ... ? |
| 19:23:19 | <mmorrow> | @check |
| 19:23:21 | <lambdabot> | <no location info>: parse error on input `;' |
| 19:23:26 | <mauke> | davidmccabe: because String is [Char], not [a] -> [Char] |
| 19:23:28 | <vixey> | um.. because of the [a] -> bit? |
| 19:23:29 | <beelsebob> | davidmccabe: because while String and [Char] are the same... |
| 19:23:33 | <koeien> | davidmccabe: because String is different from [a] -> String |
| 19:23:35 | <beelsebob> | [a] -> [Char] is not [Char] |
| 19:23:37 | <mmorrow> | @check \x y z -> (x+y)+z == x+(y+z::Double) |
| 19:23:39 | <lambdabot> | "Falsifiable, after 17 tests:\n1.2\n2.6666666666666665\n3.2\n" |
| 19:23:46 | <halberd> | also vixey there are many cases where there are statements you are pretty sure are true, but are nonetheless very interested in a proof of |
| 19:23:52 | <davidmccabe> | Wow, you make a chorus. :) |
| 19:24:02 | <koeien> | mmorrow: not being associative is even worse than noncommutativity :( |
| 19:24:05 | <byorgey> | davidmccabe: it looks like you are trying to pass a function to putStrLn. maybe you forgot an argument? or maybe you need parentheses |
| 19:24:06 | <duaneb> | how can I allow the bang strictness-modifier? |
| 19:24:11 | <davidmccabe> | Oh, it's an operator precedence problem. |
| 19:24:12 | <mmorrow> | @check \x -> x == (x+pi::Double)-pi |
| 19:24:13 | <halberd> | for example, in the construction of programs from formal specifications |
| 19:24:14 | <lambdabot> | "Falsifiable, after 6 tests:\n2.3333333333333335\n" |
| 19:24:15 | <davidmccabe> | I needed to add a $. |
| 19:24:24 | <koeien> | duaneb: {-# LANGUAGE BangPatterns #-} |
| 19:24:36 | <byorgey> | davidmccabe: yup, that ought to do it. otherwise 'putStrLn foo x' is parsed as '(putStrLn foo) x' |
| 19:24:45 | <halberd> | the formal specification is most likely a true statement (i.e. there is a program which satisies it) but you are still very interested in the program that satisfies it |
| 19:24:47 | <mmorrow> | koeien: heh |
| 19:24:53 | <duaneb> | koeien: thanks |
| 19:24:58 | <davidmccabe> | thanks byorgey, mauke, beelsebob, koeien. |
| 19:25:00 | <halberd> | that program being a proof of the specification |
| 19:25:13 | <monochrom> | That is only one way to write a formal specification. |
| 19:25:15 | <kyevan> | data MyString = SN Char MyString | EndString |
| 19:25:31 | <kyevan> | Look, I defined a string that's not [Char]! It's just structurally identical :J |
| 19:25:51 | <halberd> | monochrom: tell me another way |
| 19:26:08 | <byorgey> | kyevan: that is a string but not a String =) |
| 19:26:32 | <mauke> | Fix (Either () `O` (,) Char) |
| 19:26:44 | <trofi> | @instanceOf String |
| 19:26:46 | <lambdabot> | Couldn't find class `String'. Try @instances-importing |
| 19:26:48 | <kyevan> | Oh that reminds me... |
| 19:27:07 | <kyevan> | Is there a way to do a constructor that can take a subset of integers? |
| 19:27:16 | <kyevan> | Like... only 1-20, or something? |
| 19:27:32 | <kyevan> | Or only whole numbers. Or, yeah :J |
| 19:27:40 | <koeien> | whole numbers already exists |
| 19:27:51 | <koeien> | that's called Integer :) |
| 19:27:51 | <monochrom> | Another way is to let free variables stand for inputs and outputs. Implementation is implied-by. For example "the output should be bigger than the input": x'>x. If I implement it by increasing by 1, I have to prove the implication: x'<x implied-by x'=x+1 |
| 19:28:08 | <koeien> | kyevan: but in general in believe that the answer is no |
| 19:28:09 | <monochrom> | See also http://www.cs.toronto.edu/~hehner/aPToP/ |
| 19:28:41 | <kyevan> | Integer is NOT whole numbers, koeien... |
| 19:28:43 | <koeien> | kyevan: you can do 'smart constructors', e.g. newtype RestrictedInt = RI Int ; makeRI :: Int -> Maybe RestrictedInt |
| 19:28:45 | <bombshelter13_> | i thought it was generally defined what whole numbers could not be negative? |
| 19:28:51 | <kyevan> | > -1 :: Integer |
| 19:28:53 | <lambdabot> | -1 |
| 19:29:03 | <kyevan> | > 0 :: Integer |
| 19:29:06 | <halberd> | okay monochrom, but isn't that the same thing with just different notation? you're still specifying a type for the program |
| 19:29:06 | <lambdabot> | 0 |
| 19:29:10 | <koeien> | kyevan: in that case i am curious. what is your definition of 'whole number' ? |
| 19:29:17 | <kyevan> | If Integer was whole numbers, those would be invalid. |
| 19:29:25 | <kyevan> | Whole numbers are integers greater than zero. |
| 19:29:28 | <mauke> | you're all insane |
| 19:29:33 | <halberd> | i.e. you're implicitly saying that the program has the type of functions that return values greater than their inputs |
| 19:29:35 | <kyevan> | [1..] in haskell. |
| 19:29:46 | <mauke> | kyevan: your definitions are wrong |
| 19:29:47 | <bombshelter13_> | hmm, I've always heard [0..] for whole |
| 19:30:08 | <kyevan> | Oh, yeah, greater than or equal to. |
| 19:30:11 | <bombshelter13_> | but known that it's ambiguous |
| 19:30:12 | <koeien> | kyevan: ok, i see the whole numbers as the set Z = {...,-2,-1,0,1,2,...} |
| 19:30:14 | <kyevan> | I mixed up whole and natural. |
| 19:30:22 | <vixey> | 'whole numbers' is vauge |
| 19:30:22 | <kyevan> | koeien: That's integers. |
| 19:30:32 | <koeien> | kyevan: yes. integers = whole numbers. |
| 19:30:35 | <vixey> | even 'natural numbers' is vauge |
| 19:30:39 | <koeien> | i would regard 0 as natural, but some authors do not do that |
| 19:30:40 | <monochrom> | "<halberd> the formal specification is most likely a true statement" does not apply to x'>x |
| 19:30:55 | <vixey> | 0 being 'natural' means you're a computerologist |
| 19:30:59 | <koeien> | anyway, there is no such thing without doing smart constructors or using dependent types. |
| 19:31:09 | <halberd> | the statement made by that formal specification is, "there exists a function P where P(x) > x" |
| 19:31:10 | <kyevan> | :/ |
| 19:31:15 | <monochrom> | And in this method we are not interested in "∃x'. x'>x" either. |
| 19:31:24 | <koeien> | kyevan: i would find it useful to have such a thing sometimes. |
| 19:31:26 | <monochrom> | No. |
| 19:31:32 | <koeien> | the problem is that functions like - become partial |
| 19:31:36 | <monochrom> | x' is a free variable. there is not "there exists". |
| 19:31:47 | <davidmccabe> | Is there a function that acts like id for strings and show for other types? |
| 19:31:51 | <bombshelter13_> | Or, for 1..20, you could take the lame rout and do 'data smallInts = SI 1 | SI 2 | SI 3 | SI 4 | SI 5 ...' |
| 19:31:55 | <kyevan> | Howso, Koeien? |
| 19:31:56 | <bombshelter13_> | but this gets unwieldly for large ranges |
| 19:32:00 | <halberd> | okay but if you were to write the same constraint as a type, isn't that the statement you would get? |
| 19:32:01 | <koeien> | kyevan: what is 2-3 ? |
| 19:32:07 | <kyevan> | -1. |
| 19:32:10 | <kyevan> | But... |
| 19:32:13 | <koeien> | but that is not a natural number |
| 19:32:16 | <mauke> | davidmccabe: impossible, unless you define separate instances for every other type |
| 19:32:22 | <kyevan> | > type (-) |
| 19:32:24 | <lambdabot> | <no location info>: parse error on input `type' |
| 19:32:27 | <kyevan> | er... |
| 19:32:29 | <monochrom> | If I write a type, I still do not get a quantifier. |
| 19:32:35 | <kyevan> | :type (-) |
| 19:32:48 | <hatds> | >:t (-) |
| 19:32:49 | <bombshelter13_> | > :t (-) |
| 19:32:50 | <kyevan> | ... Gah, I forget how to get types out of lambdabot :P |
| 19:32:51 | <lambdabot> | <no location info>: parse error on input `:' |
| 19:33:03 | <koeien> | :type subtract |
| 19:33:10 | <duaneb> | could someone explain `error` to me? |
| 19:33:20 | <halberd> | types can have quantifiers |
| 19:33:22 | <hatds> | ?type (-) |
| 19:33:23 | <lambdabot> | forall a. (Num a) => a -> a -> a |
| 19:33:25 | <koeien> | duaneb: yes. error is just a fancy way to do encode "bottom" |
| 19:33:27 | <kyevan> | Anyway, - doesn't take arbetrary types that have a number in them |
| 19:33:28 | <mauke> | duaneb: it's like abort() in C, except with an error message |
| 19:33:35 | <halberd> | well |
| 19:33:39 | <duaneb> | mauke: I understand that |
| 19:33:41 | <duaneb> | I mean "how" |
| 19:33:48 | <mauke> | @src error |
| 19:33:49 | <lambdabot> | error s = throw (ErrorCall s) |
| 19:33:57 | <halberd> | the type in that case would represent the set of programs whose output is greater than their input |
| 19:34:00 | <duaneb> | but doesn't that have side effects? |
| 19:34:11 | <duaneb> | shouldn't it be wrapped in a monad or something? |
| 19:34:13 | <halberd> | and constructing a program with that type, proves that the set is nonempty |
| 19:34:26 | <mauke> | duaneb: in some sense yes, but Haskell isn't total anyway |
| 19:34:28 | <koeien> | duaneb: does f = f have side effects? |
| 19:34:29 | <monochrom> | Here is x'>x translated to type in PVS notation. (x:int) -> {x':int | x'>x}. There is no "there exists". |
| 19:34:34 | <duaneb> | koeien: no |
| 19:34:43 | <duaneb> | wait |
| 19:34:44 | <kyevan> | basically... I'm looking for a shortcut for data Foo = F1 | F2 | F3 | F4 | F5 | F6 | F7... |
| 19:34:48 | <duaneb> | no |
| 19:34:51 | <duaneb> | wait |
| 19:34:53 | <duaneb> | shit |
| 19:34:53 | <koeien> | duaneb: except that your computer gets hotter ;) |
| 19:34:59 | <duaneb> | yes, it has a stack overflow! |
| 19:35:01 | <halberd> | there's an implicit forall... it's forall x |
| 19:35:05 | <kyevan> | duaneb: error basically means "OH SHIT BREAK THE SYSTEM" |
| 19:35:17 | <grahamhutton> | dunaeb: nontermination (i.e. partiality) is an effect... |
| 19:35:21 | <duaneb> | oh, so at that point, purity is fucked anyway? :P |
| 19:35:31 | <duaneb> | what's the "nice" way to throw an error? |
| 19:35:32 | <koeien> | duaneb: exceptions are caught in the IO monad |
| 19:35:32 | <duaneb> | Maybe? |
| 19:35:39 | <mauke> | duaneb: throwIO |
| 19:35:40 | <kyevan> | WEll |
| 19:35:45 | <kyevan> | More "Your program is fucked" |
| 19:35:48 | <koeien> | duaneb: so there is not really a problem |
| 19:35:56 | <grahamhutton> | http://cs.ioc.ee/~tarmo/tday-veskisilla/uustalu-slides.pdf |
| 19:35:58 | <kyevan> | Error is basically intentional crashing :J |
| 19:36:03 | <halberd> | the way I learned type theory, a type is considered the same as the set of programs which are proofs for that type |
| 19:36:18 | <duaneb> | Oh, I see, so if you're willing to recognize the error, you also need to accept the impurity of the actions |
| 19:36:32 | <koeien> | if you want to catch it, you are in the IO monad, yes |
| 19:36:32 | <halberd> | and constructing a program with that type, shows that the set is nonempty |
| 19:36:46 | <mauke> | I think catching error is a bad idea |
| 19:37:02 | <koeien> | mauke: agreed. except perhaps on a very highlevel, where you can restart the program |
| 19:37:16 | <halberd> | well |
| 19:37:19 | <kyevan> | Well... |
| 19:37:28 | <kyevan> | Error has no more a side effect than eol |
| 19:37:28 | <koeien> | but it explains the point of it having 'side effects' |
| 19:37:39 | <kyevan> | Except that it doesn't 'keep going' |
| 19:38:01 | <halberd> | I concede that there is more than one way to express a formal specification |
| 19:38:53 | <kyevan> | (So I guess it's more like EOF) |
| 19:38:57 | <halberd> | but a specification in one notation, can be translated into another... so they are all equivalent |
| 19:39:55 | <kyevan> | That reminds me. Couldn't a language be pure even with reassignable variables, as long as those couldn't escape up or down? |
| 19:40:18 | <trofi> | > let a = 1 in let a = 2 in a |
| 19:40:19 | <lambdabot> | 2 |
| 19:40:38 | <koeien> | kyevan: you mean "hiding" ? |
| 19:40:43 | <kyevan> | Yeah. Basically that without lets all over :J |
| 19:40:49 | <mauke> | kyevan: you mean like ST? |
| 19:40:51 | <koeien> | there is one difference though |
| 19:40:57 | <trofi> | or State |
| 19:40:59 | <halberd> | or with imperative loops |
| 19:40:59 | <koeien> | > let a = 1 in let a = a + 1 in a -- diverges |
| 19:41:12 | <Cale> | Hiding old definitions is just confusing though. |
| 19:41:14 | <lambdabot> | thread killed |
| 19:41:18 | <Cale> | Use a different variable name. |
| 19:41:59 | <kyevan> | I'm just thinking, several of Haskell's "weirdnesses" aren't /actually/ necessary for pure functional with no side effects. |
| 19:42:13 | <grahamhutton> | kyevan: Haskell has precisely this kind of encapsulated state: http://research.microsoft.com/en-us/um/people/simonpj/papers/state-lasc.ps.gz |
| 19:43:18 | <kyevan> | Yeah, but my point was more that you could do a 'traditional' syntax with the same semantics :J |
| 19:43:23 | <dons> | kyevan: yes, see the ST monad. |
| 19:43:34 | <dons> | syntax is an entirely separate issue. |
| 19:43:56 | <Cale> | In fact, allowing shadowing at all is perhaps a little questionable, but is sort of necessary to allow for new definitions in modules that you import, or new definitions in the same module not to create errors. |
| 19:44:14 | <Cale> | But I would try to avoid it normally. |
| 19:44:18 | <dons> | the amazing thing about ST is that it is just a library :) we didn't have to modify the language to support it. just the type system had to be rich enough to track the property |
| 19:44:21 | <kyevan> | *nods* But I've seen people state that the syntax is necessary, which it isn't. |
| 19:44:23 | <Cale> | Er... |
| 19:44:23 | <koeien> | GHC complains loudly with -Wall |
| 19:44:31 | <Cale> | ST isn't *just* a library |
| 19:44:49 | <koeien> | creation of new variables is magical, isn't it? |
| 19:44:51 | <dons> | well, the key type properties are in userland. |
| 19:45:03 | <Cale> | Well, yes :0 |
| 19:45:05 | <Cale> | er, :) |
| 19:45:36 | <Cale> | STRefs are hard to construct without some low-level stuff going in though. |
| 19:45:51 | <Cale> | (because they can have any type) |
| 19:45:58 | <dons> | kyevan: i'd be surprised if anyone conflates the syntax and semantics , btw. since that's just wrong. |
| 19:48:24 | <njbartlett> | Trying to build Leksah on Mac OS... where can I get gtksourceview2? |
| 19:48:56 | <dons> | hmm. part of gtk |
| 19:49:25 | <njbartlett> | dons: I've installed gtk2hs (built from source, the macports version didn't work) |
| 19:50:31 | <duaneb> | so, ah |
| 19:50:39 | <duaneb> | could someone explain '<-' to me? |
| 19:50:41 | <ehird> | has wolfram alpha been rewritten in haskell yet? |
| 19:50:42 | <duaneb> | in a do context? |
| 19:50:48 | <koeien> | duaneb: do you know what (>>=) is ? |
| 19:50:51 | <mauke> | duaneb: it's syntactic sugar for >>= \ |
| 19:50:52 | <dcoutts> | njbartlett: the ./configure will tell you if it found the right stuff to be able to build the gtksourceview2 component |
| 19:51:03 | <duaneb> | hrm :/ |
| 19:51:05 | <dcoutts> | njbartlett: the gtk2hs ./configure I mean |
| 19:51:16 | <kyevan> | ehird: Eh, why? |
| 19:51:31 | <kyevan> | Also, ehird: SINE MISSES YOU |
| 19:51:35 | <ehird> | kyevan: Well, t'was done when Arc came out. I am become Haskell, destroyer of egos. |
| 19:51:40 | <ehird> | Also, aagh! |
| 19:51:44 | <njbartlett> | dcoutts: Aha, thanks... it says no |
| 19:52:08 | <njbartlett> | dcoutts: do I just need to --enable-gtksourceview2? |
| 19:52:37 | <dcoutts> | njbartlett: yes, do that and it'll tell you what it's missing |
| 19:52:59 | <njbartlett> | dcoutts: "GtkSourceView-2.0 requirement not met. Perhaps you need to install gtksourceview-2.0 or gtksourceview-devel-2.0" |
| 19:53:54 | <dcoutts> | njbartlett: right |
| 19:54:17 | <dcoutts> | it means the C libs |
| 19:54:31 | <njbartlett> | dcoutts: Yup thanks. Just looking for those now. |
| 19:55:19 | <dcoutts> | njbartlett: in particular, it's asking the pkg-config program. See pkg-config--list-all. You'll have installed the gtk+-2.0 C libs but not the sourceview ones |
| 19:56:13 | <njbartlett> | dcoutts: I don't recall installing gtk+-2.0 :-) |
| 19:56:19 | <duaneb> | ok, I installed Data.ByteString by cabal |
| 19:56:29 | <duaneb> | how can I use ghc so that --package points at it? |
| 19:56:45 | <koeien> | duaneb: -package bytestring. i normally use --make, so that GHC chases dependencies for me |
| 19:57:18 | <duaneb> | koeien: is it just the lowercase form, or do packages usually have different names? |
| 19:57:39 | <koeien> | duaneb: it differs. `ghc-pkg list` gives you the answer |
| 19:57:52 | <koeien> | sometimes it's the same, sometimes different |
| 19:58:00 | <koeien> | e.g. Cabal is with capital C |
| 19:58:46 | <duaneb> | koeien: good tip |
| 19:58:48 | <koeien> | there is no requirement for package X to export a module with X in it |
| 19:58:51 | <duaneb> | thanks! :) |
| 19:59:13 | <koeien> | you can use gh |