Experimental IRC log haskell-2009-06-01

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:18:01<Peaker>maybe foldl' could use rnf?
00:20:21<christastrophe>Peaker: what does 'rnf' mean in this context?
00:20:38<coscrotum>Reduced Normal Form?
00:21:09<Peaker>I like to see it as "deep forcing" (but I may be misunderstanding)
00:21:31<byorgey>yes, reduced normal form. 'rnf' is for fully evaluating things.
00:21:44<byorgey>I think 'deep forcing' is the right intuition.
00:22:03<ik>hot.
00:22:49<christastrophe>basically meaning that the function argument to foldl' would require its arguments be evaluated eagerly?
00:23:37<byorgey>right. foldl' is already "strict"---but in fact that means its arguments are evaluated eagerly with 'seq', which only reduces things to weak head normal form.
00:23:58<byorgey>for things like Int (say), weak head normal form is the same as reduced normal form.
00:24:06<byorgey>but for other things (like lists) they are very different.
00:24:31<christastrophe>is that something that can currently be expressed in the Haskell type system?
00:24:36<byorgey>weak head normal form for a list means it is only evaluated far enough to tell whether it is empty, or a cons.
00:24:48<byorgey>christastrophe: no
00:24:58<byorgey>there's nothing in the type system that can express strictness properties.
00:25:06<byorgey>which is too bad.
00:25:46<byorgey>not that I really know what would be involved in a type system that *could* express strictness properties. but it sounds neat.
00:26:45<christastrophe>yeah that is still above my paygrade too .. but it seems that since you can define a functions arguments to be strictly evaluated, it would be possible to define a functions type in a simmilar manner ...
00:28:52<uzytkownik>Are Char always 4-byte or is is implementation-dependent? If always is the encoding UTF32 or something else?
00:29:04<byorgey>not really. Haskell-the-language is actually pretty agnostic about operational issues such as strictness.
00:29:13<byorgey>er, that was to christastrophe
00:29:18<Zao>uzytkownik: It's large enough to represent all unicode codepoints, I believe.
00:29:46<Peaker>if whnf was called flat forcing, and rnf was called deep forcing, wouldn't it be nicer?
00:30:08<Zao>uzytkownik: http://www.haskell.org/onlinereport/basic.html
00:30:20<Zao>uzytkownik: The report doesn't seem to say much about sizes, as it's rather irrelevant.
00:30:25<byorgey>Peaker: those are good terms to start using as synonyms.
00:30:25<Zao>It's at least 21 bits.
00:30:32<christastrophe>byorgey: oh sure. but if I can say foo = \!x -> ..., why not say foo :: !Int -> ...?
00:30:55<byorgey>Peaker: but I don't see the wisdom in abandoning accepted terminology that's used in lots of related research.
00:31:01<Zao>There may be a relation to the size of Int, as it mentions toEnum/fromEnum.
00:31:05<Peaker>byorgey: backwards compatibility :(
00:31:23<christastrophe>but I digress since my understanding here is quite shallow
00:31:29<byorgey>Peaker: well, I see your point.
00:32:05<byorgey>christastrophe: oh, I see, actually, you can indeed do that
00:32:27<byorgey>christastrophe: but it doesn't give you a whole lot of control.
00:32:41<byorgey>christastrophe: and I'm not sure whether it's anything more than a recommendation to the compiler
00:33:07<christastrophe>byorgey: I imagine this is a very GHC specific feature too
00:33:16<byorgey>yeah, probably.
00:33:38<uzytkownik>Zao: Unless someone tries to find out a way of CString UTF8 -> Haskell String. I can have it converted to UTF16 or UTF32. But CWString is not suitable as it is implementation-dependent so I don't know if it is UCS2 (UTF16?) or UTF32.
00:35:10<Zao>uzytkownik: What are you trying to do? If you're just trying to convert UTF-8 to String, you can just use the utf8-string package or the Data.Text module.
00:38:53<uzytkownik>Zao: OK. Thanks (BTW. I don't have Data.Text module in ghc 6.10.1)
00:42:17<Zao>uzytkownik: Yeah, it's third party one. You can find it on Hackage.
00:42:21<byorgey>uzytkownik: Data.Text is from the 'text' package available on Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/text
00:42:21<Zao>It's nice though.
00:44:37<mmorrow>> rnf
00:44:38<lambdabot> Overlapping instances for GHC.Show.Show
00:44:39<lambdabot> (a -> ...
00:45:24<mmorrow>@let foldl'' _ z [] = z; foldl'' f z (x:xs) = let a = f z x in a `rnf` foldl'' f a xs
00:45:25<lambdabot> Couldn't match expected type `a -> a' against inferred type `Done'
00:45:50<mmorrow>@let foldl'' _ z [] = z; foldl'' f z (x:xs) = let a = f z x in rnf a `seq` foldl'' f a xs
00:45:51<lambdabot> Defined.
00:46:10<mmorrow>(probably a loss?)
00:48:42<mmorrow>> foldl'' M.union mempty (fmap (\(m,n) -> M.fromList (zip [m..n] [0..])) (take 20 $ fmap (\x -> (x,x+100)) [0,101..]))
00:48:43<lambdabot> fromList [(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,1...
00:48:53<mmorrow>> foldl'' M.union mempty (fmap (\(m,n) -> M.fromList (zip [m..n] [0..])) (take 1000 $ fmap (\x -> (x,x+100)) [0,101..]))
00:48:58<lambdabot> mueval-core: Prelude.read: no parse
00:48:58<lambdabot> mueval: ExitFailure 1
00:49:06<mmorrow>> foldl'' M.union mempty (fmap (\(m,n) -> M.fromList (zip [m..n] [0..])) (take 200 $ fmap (\x -> (x,x+100)) [0,101..]))
00:49:08<lambdabot> fromList [(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,1...
00:49:12<mmorrow>> foldl'' M.union mempty (fmap (\(m,n) -> M.fromList (zip [m..n] [0..])) (take 500 $ fmap (\x -> (x,x+100)) [0,101..]))
00:49:17<lambdabot> fromList [(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,1...
00:49:20<mmorrow>> foldl' M.union mempty (fmap (\(m,n) -> M.fromList (zip [m..n] [0..])) (take 500 $ fmap (\x -> (x,x+100)) [0,101..]))
00:49:21<lambdabot> fromList [(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,1...
00:49:34<mmorrow>hmm, worth benchmarking maybe
00:49:40<dmwit>Maps are pretty strict already.
00:49:45<mmorrow>hmm, true
00:50:32<mmorrow>can you think of any structure/type where foldl' and foldl'' would be noticeably different?
00:51:06<mmorrow>nothing's coming to mind
00:52:05<dmwit>How about constructing a list where the elements are deeper and deeper thunks of compositions of (+1) or something?
00:52:12<dmwit>Not sure how to be precise about what I mean...
00:52:38<mmorrow>but would you use foldl' for that in the first place?
00:53:42<mmorrow>but yeah i see what you're going for
00:53:53<dmwit>Yeah, I don't know.
00:53:56<dmwit>dunno dunno
00:54:24<mmorrow>@pl \dunno -> dunno dunno
00:54:24<lambdabot>join id
00:54:33<dmwit>I guess it can't be deeply nested thunks at a function type.
00:54:38<dmwit>As you say, it has to be a structure.
00:54:41<skorpan>what the hell
00:55:46<mmorrow>yeah, it'd have to be some structure where the recursive part is more than one-level deep, and isn't strict (in that going to whnf doesn't force the recursive part(s) to whnf)
00:56:20<mmorrow>data Foo = Foo ... (Blah ... Foo ..)..
00:56:27<mmorrow>unionFoo
00:57:17<mmorrow>data Foo = Foo ... !(Blah ... !Foo ..).. -- would make rnf (wrt Foo) == whnf
00:57:19<mmorrow>(i think)
00:57:39<mmorrow>err, that should be
00:57:46<mmorrow>data Blah = Blah ... !Foo ...
00:57:58<mmorrow>data Foo = Foo ... !Blah
00:58:31<mmorrow>which i can't even begin to think of an example of
00:59:46<mmorrow>ooh, a simple case would be with nested tuples, where you'd have to manually bang them in foldl'
01:00:14<mmorrow>> foldl' (\(a,b) c -> (a+c,b+c)) (0,0) [0..10000000]
01:00:24<lambdabot> mueval-core: Prelude.read: no parse
01:00:24<lambdabot> mueval: ExitFailure 1
01:00:28<mmorrow>> foldl'' (\(a,b) c -> (a+c,b+c)) (0,0) [0..10000000]
01:00:33<lambdabot> mueval-core: Prelude.read: no parse
01:00:33<lambdabot> mueval: ExitFailure 1
01:01:21<mmorrow>> foldl' (\(a,b) c -> (a+c,b+c)) (0,0) [0..1000000]
01:01:25<lambdabot> (* Exception: stack overflow
01:01:26<mmorrow>> foldl'' (\(a,b) c -> (a+c,b+c)) (0,0) [0..1000000]
01:01:29<lambdabot> (500000500000,500000500000)
01:01:32<mmorrow>> foldl' (\(!a,!b) c -> (a+c,b+c)) (0,0) [0..1000000]
01:01:33<lambdabot> <no location info>: Illegal bang-pattern (use -XBangPatterns)
01:01:35<mmorrow>, foldl' (\(!a,!b) c -> (a+c,b+c)) (0,0) [0..1000000]
01:01:38<lunabot> (500000500000,500000500000)
01:02:06<mmorrow>(but you can always just bang the tuples and avoid the annoying NFData constraint)
01:03:40<mmorrow>, foldl' (\(!a,((!b,!c),!d)) e -> (a+e,((b+e,c+e),d+e))) (0,((0,0),0)) [0..1000000]
01:03:44<lunabot> (500000500000,((500000500000,500000500000),500000500000))
01:04:17<mmorrow>ACTION thinks the moral is that bang patterns r00l
01:04:39<augustss>when you want strictness
01:04:45<mmorrow>yes
01:06:10<mmorrow>, foldr (\x !xs -> x : xs) [] [0..]
01:06:12<lunabot> Stack space overflow: current size 8388608 bytes.
01:06:12<lunabot> Use `+RTS -Ksize' to increase it.
01:09:03<gwern>well, I'll be. conal has a beard
01:09:07<ExamTommorowHELP>hiya
01:09:12<gwern>somehow my mental image of him was much like SPJ
01:09:36<gwern>except with more steel-rimmed glasses
01:09:39<ExamTommorowHELP>Im in need of some programming help, could anyone offer me a hand?
01:10:09<gwern>ExamTommorowHELP: well, your nick doesn't inspire much empathy y'know
01:10:23<ExamTommorowHELP>: (
01:10:23<gwern>ExamTommorowHELP: but you might as well spit out your questions & see what happens
01:10:35<ExamTommorowHELP>well I need to write an ask method in Java 5
01:10:46<ExamTommorowHELP>like with the buffered stream reader in stuff
01:10:49<inimino>somehow I was expecting Java questions
01:10:50<ExamTommorowHELP>I forgot how to do it
01:10:53<gwern>java.
01:11:00<inimino>why don't you try the channel devoted to that language
01:11:02<mauke>how is that a Haskell question?
01:11:03<inimino>just a thought...
01:11:07<inimino>#java
01:11:07<ExamTommorowHELP>oops..
01:11:08<gwern>ExamTommorowHELP: you're in the wrong place..
01:11:12<ExamTommorowHELP>ok thanks
01:11:15<ExamTommorowHELP>sorry about that
01:11:22<gwern>ACTION knows how to do that, but refuses on principle to help
01:14:08<xian>I'm not sure, but somehow it occurs to me that ExamTommorowHELP might not have been entirely serious.
01:14:24<ExamTommorowHELP>yeah I was
01:14:36<ExamTommorowHELP>I cant find a #java room
01:14:42<ExamTommorowHELP>do you know where one is
01:14:56<gwern>there is no #java or ##java?
01:14:56<xian>It's ##java on this network.
01:14:57<Zao>Consult your course literature?
01:15:08<ExamTommorowHELP>I have no course literature Zao
01:15:08<gwern>Zao: that'd be too hard!
01:15:11<ExamTommorowHELP>just a computer
01:15:16<ExamTommorowHELP>thats it
01:15:19<mauke>#java redirects to ##java
01:15:21<ExamTommorowHELP>my teacher sucks
01:15:25<mauke>in summary, you fail
01:15:41<Zao>A bad craftsman blames his tools.
01:15:42<ExamTommorowHELP>how do I fail he never gave out books
01:15:46<gwern>mauke: ah, so it does
01:15:52<ExamTommorowHELP>All I have is my memory
01:15:56<Zao>Doesn't one usually purchase books?
01:15:59<Zao>Or take notes?
01:15:59<luqui>wow, don't be nice or anything
01:16:04<mauke>ExamTommorowHELP: you're asking in #haskell. and you can't find #java when you're pointed at it.
01:16:12<gwern>ExamTommorowHELP: you know, there are dozens of great java textbooks online
01:16:16<ExamTommorowHELP>Not when im in High School
01:16:35<gwern>I liked thinking in java, personally
01:16:39<ExamTommorowHELP>I dont know where to look
01:17:05<luqui>the great Google is your friend
01:17:08<Zao>I should probably not say anything, I'm stuck in procrastination aftermath myself.
01:17:11<Gracenotes>gwern: definitely. The Java design decisions might be somewhat arbitrary, but they are a fun labrynth to navigate
01:17:12<ExamTommorowHELP>I tried nothing came up
01:17:25<luqui>what did you search for?
01:17:30<ExamTommorowHELP>java5 ask method
01:17:34<Gracenotes>*eek, labyrinth
01:17:45<xian>ExamTommorowHELP: How did you manage to end up here?
01:17:56<ExamTommorowHELP>I typed in programming chat
01:17:59<luqui>or better yet... why don't you go to #java and ask for help?
01:18:01<duaneb>@src ($)
01:18:02<lambdabot>f $ x = f x
01:18:04<ExamTommorowHELP>this came up like #1
01:18:10<Zao>ExamTommorowHELP: "make a ask method" isn't really understandable either.
01:18:10<ExamTommorowHELP>I cant find #java
01:18:10<luqui>ExamTommorowHELP, just type "/join #java"
01:18:16<luqui>without the quotes
01:18:19<ExamTommorowHELP>oh ok
01:18:22<duaneb>@src (.)
01:18:22<lambdabot>(f . g) x = f (g x)
01:18:26<Zao>@type interact
01:18:26<ExamTommorowHELP>sorry Ive never used irc before thanks
01:18:29<lambdabot>(String -> String) -> IO ()
01:18:35<luqui>ExamTommorowHELP, yes it's a bit daunting
01:18:41<Gracenotes>the issue is that you need to register before joining ##java
01:18:46<luqui>ohhh
01:18:48<Gracenotes>it's a +r channel
01:18:53<Zao>Competence filter, in other words.
01:18:55<Gracenotes>/msg nickserv register password email
01:18:58<ExamTommorowHELP>yeah I typed it in nothing happened
01:18:59<ik>still trying to figure out how he joined #haskell
01:19:04<troutwine>Silly question: How do I escape a double quote in a string literal when using parsec? "[Event \"?\"]" includes the '\' character.
01:19:05<Gracenotes>..yeah
01:19:12<ExamTommorowHELP>@ik it just popped up on google
01:19:12<lambdabot> it just popped up on google
01:19:16<mauke>troutwine: no, it doesn't
01:19:18<ik>ExamTommorowHELP: haha what
01:19:27<Gracenotes>@help ik
01:19:27<ik>ExamTommorowHELP: what on earth did you search for?
01:19:27<lambdabot>help <command>. Ask for help for <command>. Try 'list' for all commands
01:19:31<ExamTommorowHELP>programming chat
01:19:35<ik>-_-
01:19:41<ik>Ok- be more specific in the future
01:19:44<Gracenotes>:)
01:19:49<xian>He's right. Just search for "Programming Chat" on google and the first result is a link to a browser client directing you here.
01:19:53<Gracenotes>/msg nickserv help register
01:19:58<ik>xian: oh, brilliant
01:20:04<ExamTommorowHELP>I was in a programming chatroom for java but no one would help : (
01:20:16<luqui>yeah those guys are jerks. (j/k)
01:20:35<Gracenotes>IRC channels don't necessarily take kindly to people wanting others to do their homework or cramming for exams
01:20:36<ExamTommorowHELP>I tried that /msg nickserv but it said insufficent parameters
01:20:41<Zao>Heh, the "expert mode" requires mirc :)
01:20:54<ExamTommorowHELP>I know, but all I need is one lousy method
01:21:03<Gracenotes>ExamTommorowHELP: ugh. what is it >:]
01:21:04<mauke>congratulations on misspelling "tomorrow"
01:21:09<Gracenotes>did I mention that I mean >:[
01:21:30<luqui>ExamTommorowHELP, oh, one method on one class? which class?
01:21:31<Zao>Gracenotes: Interpreting earlier text, asking the user something and reading the response.
01:21:34<ExamTommorowHELP>I need to ask the user a question
01:21:42<ExamTommorowHELP>like what is your name
01:21:53<ExamTommorowHELP>just need to know the buffered stream reader part
01:21:53<Zao>So you need to find out how to print something to the console and how to read something from the console.
01:22:00<Gracenotes>java.util.Scanner. google it.
01:22:06<Peaker>Gracenotes: what's interesting about "navigating Java's design choices"?
01:22:14<Peaker>Gracenotes: Java seems to be all about mediocrity/boredom...
01:22:28<Zao>Peaker: Guess what language I currently have to code in? :)
01:22:30<troutwine>mauke: http://pastebin.com/m62d6ac67
01:22:44<Peaker>Zao: Boredom extreme
01:22:44<Gracenotes>Peaker: but suppose you're not a mediocre programmer. It at least is interesting.
01:23:01<ExamTommorowHELP>@ zao I ask the user to input their name then be able to bring it out later
01:23:10<Zao>Haskell has damaged my ability to code in more verbose languages.
01:23:18<Zao>I keep trying to generalize and write elegant code.
01:23:24<dibblego>Zao, you might try http://functionaljava.org/
01:23:27<mauke>troutwine: what
01:23:28<Peaker>Gracenotes: I don't know, having known C++, Java seemed to be C++ without templates, and with GC/refs instead of manual/pointers
01:23:29<Zao>While in Java you're supposed to be horribly verbose and spammy.
01:23:30<Gracenotes>dibblego: nooo
01:23:45<Gracenotes>ExamTommorowHELP: google "java.util.scanner". Oh god what a troll
01:23:45<dibblego>Gracenotes, better than Java without it at least
01:23:57<ExamTommorowHELP>im not a troll I dont want to be in here lol
01:24:10<ExamTommorowHELP>I would be playing UT3 right now if I could
01:24:19<Peaker>Zao: I work with Python/C at work. C is supposed to suck, but Python I find myself thinking "This whole thing would be a simple liftA2 ..." and stuff :)
01:24:22<Zao>dibblego: I'd say that my cow-orkers would disagree with me about using that :)
01:24:22<Gracenotes>okay, sorry then. But the class should be all you need. If you can't get much from the documentation, then you might have more serious troubles
01:24:37<dibblego>Zao, tell them to harden the fuck up
01:24:39<Gracenotes>here's a link, even: http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html
01:25:26<xian>ExamTommorowHELP: Check out: http://academic2.strose.edu/math_and_science/goldschd/spring2007-java-week01-ex.html
01:25:34<dmwit>Isn't there a ##java?
01:25:40<Zao>private void rethrow(Throwable throwable) throws Throwable { throw throwable; }
01:25:42<Gracenotes>many people have been in your shoes before, myself included. don't underestimate googling... or taking notes? :
01:25:50<dmwit>Yes, there is.
01:25:56<ik>dmwit: yes, but it is +r and (apparently) registration is difficult for this one
01:25:58<Gracenotes>dmwit: requires registration.
01:26:01<xian>dmwit: There is, but he can't join, because he's not identified.
01:26:01<troutwine>mauke: Unless I'm mistaken, parsec is barfing on the escaped double quote.
01:26:08<troutwine>mauke: Better paste here: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5458#a5458
01:26:16<dmwit>ik, Gracenotes, xian: Tough.
01:26:27<Gracenotes>okay, I'm going to watch TV now. adieu
01:26:30<ik>dmwit: oi, don't blame me
01:26:45<ik>dmwit: just summing up the last few for ya.
01:26:49<Zao>Had this been ##C, he'd been banned within three lines.
01:26:50<mauke>troutwine: it's barfing on the quote because " is not a letter
01:26:54<mauke>troutwine: as far as I can tell
01:26:54<Zao>Thankfully this isn't C.
01:27:19<troutwine>mauke: Oh, damnit. Thanks.
01:27:32<xian>Zao: The friendliness of the Haskell community is remarkable.
01:27:43<dmwit>ACTION feels grumpy, not friendly
01:27:54<ExamTommorowHELP>hey xian thanks so much that link was great! found just what I needed
01:28:14<dmwit>I must be getting old. =/
01:28:21<ExamTommorowHELP>you guys have been a great help better than the ppl in the java room lol
01:28:24<Zao>ACTION hands dmwit a lambda-shaped cane.
01:28:31<Gracenotes>ExamTommorowHELP: next time don't cram
01:28:56<Gracenotes>again look into java.util.Scanner; some courses prefer that approach to the one xian linked. Just saying.
01:29:10<ExamTommorowHELP>no Gracenotes its not that
01:29:18<ExamTommorowHELP>Ive used the one xian sent me
01:29:22<dmwit>My band teacher used to have a sign on his door that said, "Poor planning on your part does not constitute an emergency on my part."
01:29:56<ExamTommorowHELP>what the hell is a haskell anyway?
01:30:00<ExamTommorowHELP>jk lol
01:30:16<mauke>a dog
01:30:18<Gracenotes>ExamTommorowHELP: hm... perhaps you should learn yourself one.
01:30:25<Gracenotes>@where lyah
01:30:26<lambdabot>www.learnyouahaskell.com
01:30:26<roconnor>@where lyah
01:30:27<lambdabot>www.learnyouahaskell.com
01:30:29<Gracenotes>lol
01:30:36<MyCatVerbs>dmwit: your *band* teacher? Now I hear that a lot from sysadmins and tech support personell, but what does it have to do with music?
01:30:57<Gracenotes>ExamTommorowHELP: okay then. mystery solved. You do know of a search engine called Google though, right?
01:30:58<MyCatVerbs>Great minds think alike! That doesn't explain you two, though. ;)
01:31:02<dmwit>You'd be surprised how many opportunities he found to point at it and stare at you disapprovingly.
01:31:24<ExamTommorowHELP>yeah it didnt work though
01:31:34<MyCatVerbs>dmwit: I am surprised, indeed. Would you care to elaborate, perhaps with an example? ^_^
01:31:34<dmwit>Google... didn't work.
01:31:39<ExamTommorowHELP>nope
01:31:49<ExamTommorowHELP>type in java 5 ask method nothing comes up
01:31:57<ExamTommorowHELP>nothing useful atleast
01:32:15<mauke>why would I type that in?
01:32:29<dmwit>MyCatVerbs: hum; can't find the hat for the uniform and the bus is leaving; can't find the music and the all-state competition is tomorrow; didn't practice for the lesson this week and so can't play the assigned piece; etc.
01:32:31<mauke>how about "free java book"?
01:33:14<ExamTommorowHELP>I wasnt looking for a free java book
01:33:27<ExamTommorowHELP>just 2 lines of code
01:33:37<MyCatVerbs>dmwit: I see! Yes, those would seem to constitute emergencies on the parts of the victims.
01:33:39<mauke>insert appropriate yoda quote here
01:33:54<MyCatVerbs>ExamTommorowHELP: what in the blazes is an "ask method", please?
01:33:57<dmwit>ExamTommorowHELP: If what you tried didn't work, perhaps you should graciously accept the advice of the people here.
01:34:06<Zao>MyCatVerbs: s/ask/interact/
01:34:10<ExamTommorowHELP>I did they zao helped alot
01:34:35<MyCatVerbs>Zao: ?
01:34:44<ExamTommorowHELP>mycatverbs an ask method is this InputStreamReader isr = new InputStreamReader(System.in);
01:35:50<inimino>we're calling those whats now?
01:36:22<hatds>what's a good symbol to use for xor?
01:36:26<hatds>or symbols
01:36:37<dmwit> /=
01:36:42<mauke>xor
01:36:44<dmwit>> True /= False
01:36:45<lambdabot> True
01:36:46<MyCatVerbs>hatds: Data.Bits just uses xor.
01:37:00<mauke>(Data.Bits should have used .^.)
01:37:08<harlekin>
01:37:40<MyCatVerbs>harlekin: I'll go for that when I get a keyboard that has a key for it. ;P
01:37:48<hatds>hmm I kinda like ^ (or variations thereof)
01:38:09<Twey>mauke: It looks too phallic
01:38:09<MyCatVerbs>(Or, more to the point, when I get around to adding a lot of extra compose key sequences to my machine's config.)
01:38:13<mmorrow>mauke: .>>. and .<<. too
01:38:32<mauke>Twey: but .|. is obviously fine, amirite
01:38:34<mmorrow>Twey: what about
01:38:36<mmorrow>yeah
01:38:39<Twey>Haha, touché
01:41:57<Twey>> foldl (,) [1..5]
01:41:58<lambdabot> Occurs check: cannot construct the infinite type: a = (a, b)
01:42:10<Twey>Those infinite type errors always catch me out
01:42:47<aavogt>> (,,,,,,,,,,,,,) 1 2 3 4 5 6 7 8 9 10 11 12 13
01:42:49<lambdabot> Overlapping instances for GHC.Show.Show
01:42:49<lambdabot> (n -> ...
01:43:28<aavogt>> (,,,) 1 2 3 4
01:43:29<lambdabot> (1,2,3,4)
01:43:33<mauke>preflex: calc ++++++++++++ 1 2 3 4 5 6 7 8 9 10 11 12 13
01:43:33<preflex> 91
01:43:56<Twey>A prefix calculator? But why?
01:44:00<Twey>Postfix is the natural order.
01:44:10<mauke>preflex: calc 1 2 3 4 5 6 7 8 9 10 11 12 13 ++++++++++++
01:44:10<preflex> 91
01:44:15<Twey>\o/
01:44:27<Twey>preflex: calc + 1 2 3 +
01:44:27<preflex> 6
01:44:32<Twey>preflex: calc - 1 2 3 -
01:44:32<preflex> -4
01:44:42<idnar>Twey: pah, "natural"
01:44:50<aavogt>preflex: + 1 2 3 + 4 5 +
01:45:04<Twey>idnar: It is!
01:45:17<Twey>It annoys me when I have to use infix notation in maths, now.
01:45:19<mmorrow>preflex: zenc (,,,,,,,,,,,,,)
01:45:19<preflex> ZLz2cUz2cUz2cUz2cUz2cUz2cUz2cUz2cUz2cUz2cUz2cUz2cUz2cUZR
01:45:22<MyCatVerbs>What the HELL fixity does preflex use? oO
01:45:35<Twey>MyCatVerbs: It's OMNIFIX
01:45:37<mauke>MyCatVerbs: AWESOME
01:45:45<Gracenotes>YOU'RE SERIOUS??1!?!?
01:46:00<mmorrow>infixAWESOME + 11 -- ?
01:46:14<Gracenotes>really though, wtf
01:46:16<Twey>Hahahaha
01:46:23<dmwit>MyCatVerbs: I think it maybe uses separate number and operator stacks.
01:46:25<mauke>preflex: calc (+ 1 2) * (6 3 -)
01:46:26<preflex> 9
01:46:32<Gracenotes>the plus at the beginning
01:46:33<Twey>aavogt: You missed the ‘calc’ keyword.
01:46:47<Gracenotes>is that mixing prefix and postfix? .. and infix? .... oooohh.
01:46:50<Twey>preflex: calc + 1 2 3 + 4 5 +
01:46:50<preflex> Too many operands
01:46:56<Twey>Hoo.
01:46:59<Twey>preflex: calc + 1 2 3 + 4 5 6 +
01:47:00<preflex> Too many operands
01:47:13<Twey>Oh, operands. Duh.
01:47:14<MyCatVerbs>preflex: calc + 1 2 3 -
01:47:14<preflex> 0
01:47:15<Twey>preflex: calc + 1 2 + 4 5 +
01:47:15<preflex> 12
01:47:23<Twey>preflex: calc - 1 2 - 4 5 -
01:47:23<preflex> -10
01:47:28<MyCatVerbs>preflex: calc + 1 2 - 3
01:47:28<preflex> 0
01:47:32<mauke>best parsing algorithm ever.
01:47:35<Gracenotes>preflex: calc 1 + 2 + 3 + 4 + 5
01:47:36<MyCatVerbs>preflex: calc + - 1 2 3
01:47:36<preflex> 15
01:47:37<preflex> 0
01:47:37<Twey>I'm having some trouble figuring out the order of operations there.
01:47:54<dmwit>Twey: 1 - 2 - 4 - 5
01:47:56<dmwit>= -10
01:48:06<Twey>Yeah
01:48:07<sohum>preflex: - 3 + 1 2
01:48:10<Twey>I guess
01:48:12<mauke>preflex: calc +) 1 2 * 6 3 ((-
01:48:12<preflex> 9
01:48:21<dmwit>gah
01:48:22<Twey>Hm... so basically on reading an operator...
01:48:22<Gracenotes>but but... mommy... ;_;
01:48:29<sohum>that's ... off
01:48:30<Twey>If it has enough operands on the stack, it performs it
01:48:44<Gracenotes>well. is it context-free?
01:48:45<Twey>Otherwise, it reads more operands until it has enough
01:48:56<Gracenotes>if it uses two stacks, I'm guessing no
01:49:03<dmwit>Twey: I still think it's simpler to think of it as two separate stacks.
01:49:05<sohum>preflex: 3 1 2 + -
01:49:17<dmwit>sohum: needs moar calc
01:49:22<Twey>dmwit: I don't think so
01:49:22<dmwit>preflex: calc 3 1 2 + -
01:49:22<preflex> 2
01:49:27<sohum>ah, right
01:49:30<sohum>thankee
01:49:32<Gracenotes>so if it has a plus, it waits for two numbers. if it has two numbers, it waits for an operator
01:49:38<Twey>preflex: calc + 1 2 3 + 4 5 +
01:49:38<preflex> Too many operands
01:49:41<Twey>See?
01:49:56<sohum>yea, you should be able to simplify the code with just one stack
01:50:14<sohum>(wait, is this meant to be prefix or postfix?)
01:50:21<mmorrow>, readP_to_S (sepBy1 (choice [munch isDigit, string "+", string "-", string "*"]) skipSpaces) "+ 1 2 * 3 -"
01:50:22<lunabot> [([""],"+ 1 2 * 3 -"),(["",""],"+ 1 2 * 3 -"),(["","",""],"+ 1 2 * 3 -"),...
01:50:52<mmorrow>goo
01:50:56<Gracenotes>oog
01:50:56<mauke>preflex: calc + + 1 2 3 4 *
01:50:56<preflex> 15
01:51:16<Gracenotes>two stacks is pretty Turing-machine-ish, though
01:51:40<aavogt>@type munch
01:51:41<lambdabot>Not in scope: `munch'
01:51:44<mmorrow>, let lexemeP p = do a <- p; skipSpaces; return a in readP_to_S (many1 (lexemeP . choice $ [munch isDigit, string "+", string "-", string "*"])) "+ 1 2 * 3 -"
01:51:45<sohum>a turing machine can be simulated with a two stack PDA
01:51:46<lunabot> [([""],"+ 1 2 * 3 -"),(["",""],"+ 1 2 * 3 -"),(["","",""],"+ 1 2 * 3 -"),...
01:51:49<mmorrow>gah
01:51:52<Gracenotes>, [$ty | munch |]
01:51:54<lunabot> luna: parse error on input `|]'
01:52:02<mmorrow>, 'munch
01:52:03<lunabot> Text.ParserCombinators.ReadP.munch
01:52:05<Gracenotes>sohum: my point quite
01:52:07<mmorrow>, [$ty| munch|]
01:52:10<lunabot> (Char -> Bool) -> ReadP String
01:52:15<Gracenotes>eek
01:52:19<mmorrow>wteef
01:52:22<sohum>ACTION blinks
01:52:25<sohum>the 'syntax?
01:52:40<sohum>, 'show
01:52:41<lunabot> GHC.Show.show
01:52:42<mmorrow>template-haskell
01:52:45<sohum>shiny
01:52:49<Gracenotes>I'm more surprised about the $ty parsing thing
01:52:52<mmorrow>, [$ty| 'ty |]
01:52:52<mauke>IIRC calc uses no stacks
01:52:54<lunabot> Name
01:53:00<mmorrow>, src ''Name
01:53:02<lunabot> data Name = Name OccName NameFlavour
01:53:05<mmorrow>, 'Name
01:53:06<lunabot> Language.Haskell.TH.Syntax.Name
01:53:10<Gracenotes>mauke: well. you know how it is with recursion... :?
01:53:22<Gracenotes>hrm.
01:53:28<mmorrow>, let lexemeP p = do a <- p; skipSpaces; return a in last $ readP_to_S (many1 (lexemeP . choice $ [munch isDigit, string "+", string "-", string "*"])) "+ 1 2 * 3 -"
01:53:29<Gracenotes>would love to check it out
01:53:30<mauke>Gracenotes: it's not recursive
01:53:34<lunabot> Killed.
01:55:01<mauke>hmm, I should make a pure haskell version of it some day
01:55:45<mmorrow>what the frig is happening?!
01:55:54<mmorrow>, let lexemeP p = do a <- p; skipSpaces; return a in readP_to_S (many1 (lexemeP . choice $ [munch isDigit, string "+", string "-", string "*"])) "+ 1 2 * 3 -"
01:55:55<lunabot> [([""],"+ 1 2 * 3 -"),(["",""],"+ 1 2 * 3 -"),(["","",""],"+ 1 2 * 3 -"),...
01:55:57<Twey>Terror and chaos
01:56:07<mmorrow>how is it accepting empty strings?
01:56:15<mmorrow>oh
01:56:18<mmorrow>, let lexemeP p = do a <- p; skipSpaces; return a in readP_to_S (many1 (lexemeP . choice $ [munch1 isDigit, string "+", string "-", string "*"])) "+ 1 2 * 3 -"
01:56:20<lunabot> [(["+"],"1 2 * 3 -"),(["+","1"],"2 * 3 -"),(["+","1","2"],"* 3 -"),(["+",...
01:56:38<mmorrow>, let lexemeP p = do a <- p; skipSpaces; return a in fst . last $ readP_to_S (many1 (lexemeP . choice $ [munch1 isDigit, string "+", string "-", string "*"])) "+ 1 2 * 3 -"
01:56:39<lunabot> ["+","1","2","*","3","-"]
01:56:59<mmorrow>guess munch,choice,many* don't play well
01:57:03<dmwit>and the first shall be last
01:57:25<mauke>"+ 1 2 * 3 -"? that's not even valid
01:58:25<mauke>preflex: calc + 1 2 * 3 -
01:58:25<preflex> Not enough mana
01:58:27<gwern>mauke: it's just a partially applied function :)
01:59:03<mauke>preflex: calc + 1 2 * 3 - 5
01:59:03<preflex> 2
02:00:55<Qriva>How hard would it be to make a symbolic calculator that does some basic stuff? like diff. of two squares?
02:01:06<dmwit>> x^2 - y^2
02:01:07<lambdabot> x * x - y * y
02:01:17<dmwit>?where twanvl
02:01:17<lambdabot>I know nothing about twanvl.
02:01:25<dmwit>?where simplexpr
02:01:25<lambdabot>I know nothing about simplexpr.
02:01:30<dmwit>hmph
02:02:39<dmwit>http://twan.home.fmf.nl/blog/haskell/simple-reflection-of-expressions.details
02:02:46<Gracenotes>@hackage simple-reflect
02:02:47<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/simple-reflect
02:10:52<hackagebot>txt-sushi 0.3.0
02:16:39<Qriva>Gracenotes: dmwit thanks
02:18:02<Qriva>I'd like to build something to rotate 3d objects around an axis and calculate the volume or surface area
02:18:07<Qriva>is that really hard for a newbie?
02:19:29<Gracenotes>2D and 3D plotting tends to not vary too much from language to language.
02:19:46<Qriva>yeah, so far from the HSoE things look fairly straightforward
02:20:12<Qriva>Haskell makes doing plain math pretty easy, it's the symbolic stuff that looks difficult
02:20:30<Gracenotes>definitely up Haskell's alley -- especially with ADTs and the like... depends on the algorithm
02:20:50<roconnor>> deriv (sin . cos) x
02:20:52<lambdabot> 1 * negate (sin x) * cos (cos x)
02:21:03<Qriva>deriv x^3
02:21:09<Qriva>> deriv x^3
02:21:10<lambdabot> Couldn't match expected type `Data.Number.Dif.Dif a
02:21:12<roconnor>> deriv (^3) x
02:21:14<lambdabot> (1 * x + x * 1) * x + x * x * 1
02:21:16<Qriva>ahhhh
02:21:24<roconnor>> deriv (\x -> x^3) x
02:21:25<lambdabot> (1 * x + x * 1) * x + x * x * 1
02:21:30<Qriva>what is \x?
02:21:44<roconnor>\param is how we write anonymous function
02:21:47<wli>Now you just need to find an integral basis ...
02:21:53<Qriva>also, what is v', where v is any binding
02:22:00<Zao>@type \x y -> x + y
02:22:02<lambdabot>forall a. (Num a) => a -> a -> a
02:22:14<Qriva>Zao: is that a monad?
02:22:22<Zao>' is a valid glyph in names.
02:22:24<Qriva>it's not, nevermind
02:22:29<Gracenotes>@type deriv
02:22:29<Zao>x, x' and x'' are independent names.
02:22:30<lambdabot>forall a b. (Num a, Num b) => (Dif a -> Dif b) -> a -> b
02:22:38<roconnor>\ is lambda x y are Zao's parameters -> separates parameters from the body, x + y is the body.
02:22:44<Qriva>Zao: awesome, thank you
02:22:59<Qriva>so i know this is almost cliche in here, but i have to ask:
02:23:03<Qriva>got a good monad tutorial?
02:23:07<Zao>A named function like mine would be f x y = x + y
02:23:11<gwern>@quote monad.*tutorial
02:23:11<lambdabot>Pseudonym says: A "newbie", in Haskell, is someone who hasn't yet implemented a compiler. They've only written a monad tutorial.
02:23:17<gwern>@quote monad.*tutorial
02:23:17<lambdabot><BMeph> says: psygnisfive: In #haskell, you can't hardly be taken seriously w/o writing a monad tutorial...
02:23:22<Qriva>haha
02:23:22<gwern>@quote monad.*tutorial
02:23:22<lambdabot>Pseudonym says: A "newbie", in Haskell, is someone who hasn't yet implemented a compiler. They've only written a monad tutorial.
02:23:22<InabaAtsuyoshi>lol
02:23:27<gwern>@quote Wadler
02:23:27<lambdabot>lambdabot says: I know nothing about wadler.
02:23:30<psygnisfive>O_O
02:23:33<Gracenotes>sure you don't
02:23:36<psygnisfive>damnit lambdabot >|
02:23:36<idnar>bwahaha
02:23:40<gwern>@quote endofunctor
02:23:41<lambdabot>wadler says: A monad is a monoid in the category of endofunctors, what's the problem?
02:23:42<InabaAtsuyoshi>@quote curry
02:23:43<lambdabot>VirginiaCurry says: "You know, Haskell actually never liked the name Haskell." -- Virgina Curry (Haskell B. Curry's widow)
02:23:48<Qriva>>>=
02:23:52<Gracenotes>=<<
02:23:59<idnar>>=>
02:24:02<Gracenotes><=<
02:24:02<Qriva>lol
02:24:04<Qriva>well played
02:24:05<gwern><->
02:24:07<Qriva>:=:
02:24:11<Gracenotes>>-<
02:24:12<idnar>>=< -- oh noes!
02:24:16<Gracenotes><=>
02:24:18<gwern>:-;
02:24:21<Gracenotes>-:-
02:24:26<InabaAtsuyoshi>^-^
02:24:31<Gracenotes>( ≖‿≖)
02:24:33<Qriva>((_)=======D
02:24:33<roconnor>^-v
02:24:38<Gracenotes>okay okay
02:24:44<InabaAtsuyoshi>rofl
02:24:47<gwern>Qriva: actually, that's not valid because of the parentheses
02:24:48<idnar>(:[])
02:24:57<gwern>@quote monkey
02:24:57<lambdabot>DanPascu says: For God's sake, have mercy on us. I'm no mathematician, yet I find 'patch commutation' to sound reliable and trustworthy. 'Patch Flipping' sounds like a drunken monkey doing rollovers
02:24:58<roconnor>> (:[]) 5
02:25:00<lambdabot> [5]
02:25:04<Absolute0>Is there something like a functor but returns the inner object after applying fmap? ie fmap (+1) (Just 10) -> 11
02:25:09<Qriva>(_)==D
02:25:10<Qriva>-> True?
02:25:14<gwern>@quote monkey
02:25:15<lambdabot>DanPascu says: For God's sake, have mercy on us. I'm no mathematician, yet I find 'patch commutation' to sound reliable and trustworthy. 'Patch Flipping' sounds like a drunken monkey doing rollovers
02:25:18<dmwit>Absolute0: comonad
02:25:22<gwern>dang it, the monkey quote is gone
02:25:25<Qriva>> (_) == D
02:25:27<lambdabot> Pattern syntax in expression context: _Not in scope: data constructor `D'
02:25:35<Qriva>> (_) == o
02:25:36<lambdabot> Pattern syntax in expression context: _
02:25:42<Qriva>i give up
02:25:51<Gracenotes>_ is used with pattern matching
02:25:57<Qriva>> _ == _
02:25:58<lambdabot> Pattern syntax in expression context: _Pattern syntax in expression context...
02:26:07<Apocalisp>Maybe is not a comonad is it?
02:26:34<hatds>no, what would coreturn be?
02:26:42<Absolute0>Maybe is a functor
02:26:48<Gracenotes>pattern matching is a kind of declarative programming
02:26:49<Absolute0>iirc
02:26:53<idnar>extend :: Comonad w => w a -> (w a -> b) -> w b
02:27:20<Apocalisp>yea, coreturn would be undefined for the Nothing case
02:27:22<idnar>wait, no, I guess you want extract :: Comonad w => w a -> a
02:27:24<Gracenotes>not really found in other languages...
02:28:09<bremner>Gracenotes: err, pattern matching is found in many languages
02:28:10<idnar>Gracenotes: hmm, there are limited forms of pattern matching in quite a few languages
02:28:18<Gracenotes>I mean, declarative programming isn't
02:28:29<Gracenotes>oops. and I mean, not found in many other languages.
02:28:35<Apocalisp>Absolute0: In general, you don't want to get things "out" of monads. You want to put computations in.
02:28:48<bremner>Gracenotes: if by other languages you mean Java.
02:29:07<Absolute0>Apocalisp: I know, it's just a convenience to extract as well...
02:29:18<Absolute0>like ad hoc computation and print
02:29:32<Gracenotes>declaring classes? Yeah, not sure data structures count...
02:30:02<Gracenotes>anyway. silly point.
02:30:02<Absolute0>Is it right to view type classes as interfaces and instances as implementations?
02:30:11<Gracenotes>sorry
02:31:08<dmwit>Absolute0: That's about right, yeah.
02:31:17<Absolute0>:)
02:31:26<dmwit>Absolute0: The main difference is that you can mix several interfaces (which Java definitely does Not Allow).
02:31:30<bremner>Gracenotes: I guess it would be fair to say few "mainstream" languages support declarative programming
02:31:43<dmwit>i.e. (Ord a, NFData a) => a -> a -> a -- or whatever
02:31:43<Qriva>How does one do random numbers in haskell?
02:31:53<bremner>Gracenotes: that is all I meant with the java reference
02:31:55<Gracenotes>bremner: that sounds like much less of a careless phrasing :)
02:31:55<Peaker>Absolute0: There's little point in having an fmapAndExtract. You could just have class Extractable f where extract :: f a -> a -- but Maybe could not be an instance -- how could you implement extract in the case of Nothing?
02:31:57<Absolute0>dmwit: you can mix interfaces, you can't subclass many classes...
02:32:15<Absolute0>dmwit: in Java that is.
02:32:20<idnar>Absolute0: you can't apply multiple interface constraints to a variable, though
02:32:24<dmwit>Absolute0: A type can implement many interfaces, but a function can't ask for a value that is an instance of several interfaces.
02:32:36<dmwit>Qriva: System.Random?
02:32:38<Gracenotes>"not really found in other languages" -- you can only make "really" mean so much...
02:32:39<idnar>you could create a new interface that inherits from both, but that has to be explicit then
02:32:56<idnar>anyway, the main difference is universal vs. existential quantification
02:32:59<dmwit>Qriva: Once you've grokked the State monad, MonadRandom is a nice layer over System.Random.
02:33:24<Peaker>dmwit: is there a transformer?
02:33:29<Peaker>@hoogle RandomT
02:33:30<lambdabot>No results found
02:33:31<idnar>in Haskell, you typically have forall a. (SomeClass c) => c a
02:33:39<dmwit>Peaker: You bet there is!
02:33:42<dmwit>?hackage MonadRandom
02:33:42<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MonadRandom
02:33:51<idnar>er
02:33:57<Gracenotes>interfaces also have this whole inheritance thing...
02:34:00<idnar>forall a. (SomeClass a) => a I mean
02:34:11<Peaker>cool
02:34:17<idnar>in java, you effectively have exists a. (SomeClass a) => a
02:34:19<Peaker>Baughn: you there?
02:34:44<Gracenotes>idnar: ...interesting.. how so?
02:35:05<Gracenotes>is this because of some kink in the type system?
02:35:09<Peaker>idnar: in C++ too, yeah, and this has often overlooked efficiency problems too - as well as dividing the language into the generics world, and subclassing world, where each thing can be implemented in either way
02:35:16<idnar>Gracenotes: I wouldn't really say it's a "kink"
02:35:27<Gracenotes>instanceof-ing? Because inheritance implementation is open-ended polymorphism, just like typeclasses
02:35:38<Peaker>Gracenotes: when in C++ or Java you say that you take a variable of type Blah, then actually you're saying that the variable is *any subclass* of Blah, and not necessarily a Blah
02:35:41<Gracenotes>interface implementation rather
02:36:16<idnar>Gracenotes: interface inheritance is pretty similar to subclassing in haskell, though
02:36:18<Peaker>Gracenotes: In Haskell, Eq a => a -> a -> Bool -- sure "a" is *any instance* of Eq, like any subclass, *but* the two a's are the same
02:36:22<Gracenotes>mm. and for SomeClass a => a, a is any instance of SomeClass.
02:36:50<Peaker>Gracenotes: in Java/C++ you can't express that at all -- and each of Eq -> Eq -> Bool is carrying its own vtable which makes it a serious problem choosing which to use
02:37:13<idnar>yeah, if you have "bool somefunc(Comparable x, Comparable y)", x and y can be of different types
02:37:19<dmwit>Gracenotes: Right, the difference is in who gets to decide what 'a' is: the caller or the callee.
02:37:19<Peaker>Gracenotes: not to mention having an array of many objects always has each one carrying a vtable ptr, rather than just having the vtable ptr outside (e.g as an arg), when the type is universally quantified
02:37:37<Gracenotes>hm. I see. But you can discern more about a type in Java/C++ than you could in a simple exists (Blah a) => a system
02:37:42<idnar>it's more like (Eq a, Eq b) => a -> b -> Bool
02:37:53<Gracenotes>due to casting and whatnot
02:37:54<dmwit>ACTION never thought of it this way; it's very instructive
02:37:55<dmwit>idnar++
02:38:23<Peaker>idnar: Well, since you can't really use "a" and "b" anywhere else, I'd say its less like that
02:39:02<idnar>((Eq a) => a) -> ((Eq a) => a) -> Bool, then?
02:39:19<Peaker>compare :: (exists a. Eq a => a) -> (exists a. Eq a => a) -> Bool
02:39:23<Peaker>I think
02:39:28<idnar>oh, well, yeah
02:39:36<idnar>we're comparing apples with particle accelerators, let's not pick too many nits ;)
02:39:40<Gracenotes>I think this is simplifying their type system just a bit. But, anyway >_>
02:39:45<idnar>Gracenotes: well, Haskell has unsafeCoerce and so on
02:40:02<Gracenotes>in language disputes, unsafe* is off-limits :P
02:40:04<idnar>"casting" is actually a whole bunch of separate things
02:40:12<gwern>no, you said their names!
02:40:24<idnar>jumping over to C++ for a moment; you have static_cast<> which is more like fromIntegral and friends
02:40:31<idnar>you have reinterpret_cast<> which is like unsafeCoerce
02:40:35<Gracenotes>idnar: but it really does make a different, casting and whatnot
02:40:39<Gracenotes>difference
02:40:41<gwern>ia! ia! p'fthagan unsafeCoerce# shubboth!
02:41:00<idnar>you have const_cast<> which is a mild form of unsafeCoerce
02:41:12<idnar>and you have dynamic_cast<> which is somewhat magic
02:42:32<Peaker>@hoogle cast
02:42:33<lambdabot>Data.Typeable cast :: (Typeable a, Typeable b) => a -> Maybe b
02:42:33<lambdabot>Foreign.C.String castCCharToChar :: CChar -> Char
02:42:33<lambdabot>Foreign.C.String castCharToCChar :: Char -> CChar
02:42:42<idnar>dynamic_cast does runtime introspection to check whether the value you have is actually the subclass you want to cast it to, and bails out if it's not
02:42:48<Peaker>dynamic_cast is like Data.Typeable cast
02:42:57<idnar>yeah
02:43:07<Peaker>> cast 5 :: Double
02:43:09<lambdabot> Couldn't match expected type `GHC.Types.Double'
02:43:16<dmwit>> cast 5 :: Maybe Double
02:43:17<lambdabot> Nothing
02:43:23<dmwit>> cast 5 :: Maybe Integer
02:43:24<lambdabot> Just 5
02:43:42<Peaker>idnar: except Typeable cast has a nicer mechanism than exceptions :)
02:44:43<idnar>@type let f = (\x -> x) :: (Num a) => a -> (forall b. (Num b) => b) in f 5
02:44:45<lambdabot> Couldn't match expected type `b' against inferred type `a'
02:44:45<lambdabot> `b' is a rigid type variable bound by
02:44:45<lambdabot> the polymorphic type `forall b. (Num b) => b' at <interactive>:1:9
02:44:47<Peaker>const_cast is like id in Haskell :)
02:45:00<idnar>hrm, nevermind
02:45:18<idnar>Peaker: eh, it's more like unsafePerformIO than id :P
02:45:38<Peaker>idnar: everything is const and remains const in Haskell, so its id :)
02:46:11<Peaker>Perhaps you could say its a readIORef -- if you start with a mutable IORef
02:46:19<idnar>unsafePerformIO . readIORef
02:46:44<Peaker>I wouldn't say anything in C++'s const_cast means its Haskell "equivalent" shouldn't be in IO
02:46:47<idnar>except it's inside-out
02:47:10<idnar>Peaker: it falsifies the type of a value in a way that doesn't cause corruption
02:47:39<idnar>as opposed to reinterpret_cast<> which can produce undefined behaviour
02:47:59<Gracenotes>hm. Isn't this article a bit odd? http://en.wikipedia.org/wiki/Composite_data_type
02:48:12<idnar>I'm struggling to find a Haskell analogue of that
02:48:15<Gracenotes>describes a record. or an ADT
02:48:21<Gracenotes>but it's only about C++
02:48:32<Gracenotes>methinks it doesn't really exist >_>
02:49:43<idnar>it's kinda like using unsafeCoerce to unwrap a newtype whose constructor isn't exported
02:50:03<Peaker>Gracenotes: it sounds like a named type product
02:50:09<idnar>you're not going to get garbage out, but you're being naughty, and you're still open to "semantic" breakage
02:50:19<Gracenotes>Peaker: quite
02:50:23<Peaker>idnar: a const_cast is just a readIORef -- not sure why you think it has not to be in IO
02:50:26<Gracenotes>so many other names
02:50:36<Gracenotes>the article doesn't really have sources >_>
02:51:15<idnar>Peaker: a const_cast doesn't "do" anything, though
02:51:35<idnar>Peaker: in the sense that the compiler doesn't emit any code for it
02:51:52<Peaker>idnar: yeah, its the other way around, and you can't make an immutable mutable, so it just doesn't exist
02:52:24<idnar>Peaker: the trick is that const doesn't actually mean immutable
02:52:30<idnar>the real meaning of const is pretty much up to the programmer
02:52:50<Peaker>idnar: C++ adds "immutablity" on top of mutability, and Haskell does the other way around, so in C++ dropping a compile-time qualifier is possible while converting a value whose semantics are truly as simple as that of immutability into a mutable value is just not possible
02:53:06<Peaker>idnar: its supposed to mean immutable at some level
02:53:07<idnar>because you can declare members as "mutable"
02:53:41<Peaker>yeah, and they're supposed to be "caches" and such
02:54:36<idnar>anyhow, I have to be up in 2 hours, so I bid you all adieu
03:01:32<Gracenotes>hmmmmmmm. In both Haskell and C-style languages. there is a unit type, but only in one of those does it have a value :)
03:02:24<Gracenotes>not like the value is that too useful
03:03:07<Peaker>What's the unit type in c?
03:03:19<Peaker>doesn't it have to have a value if its a unit-type?
03:03:21<dmwit>void
03:03:31<dmwit>it has value "return"
03:03:43<Peaker>that's not a value :-P
03:03:44<Zao>An uncompletable incomplete type.
03:04:06<dmwit>Peaker: It's just an implicit, unboxed unit.
03:04:20<dmwit>You can't store it in a variable because that would be stupid.
03:04:30<kpreid>I wish sizeof(void) == 0
03:04:48<mauke>void v = (void)1;
03:05:20<kpreid>Oh, now I remember. The way in which void is Definitely Not An Ordinary Type: you can't write void foo() { return bar(); } where bar's return type is void.
03:05:23<kpreid>This annoys me.
03:05:31<kpreid>But in Haskell, () is a value!
03:05:58<Peaker>well, the only utility that particular example would have is avoiding code change to propagate new return values, but you'd still have to change that void there. However, if it was a typedef...
03:06:19<kpreid>or a macro.
03:06:29<mauke>template<typename T> T foo() { return bar<T>(); }
03:06:52<kpreid>that's not C :)
03:07:01<Gracenotes>although, there is http://java.sun.com/javase/6/docs/api/java/lang/Void.html :)
03:07:09<mauke>well, then you should have written void foo(void) {!
03:07:13<Gracenotes>but still uninstantiable
03:07:58<Peaker>foo :: () -> t ; foo () = bar ()
03:08:34<sdf>Hello. I'm a newbie who's just begun the wormhole that is Haskell's type system. I understand what data is, and I understand how and why to do a type synonym, but I don't understand how a newtype declaration is useful to a beginner. I've read http://www.haskell.org/haskellwiki/Newtype , but I don't see any immediate reason why I should drop what I'm doing to
03:08:37<sdf>learn based on that.
03:08:39<mauke>foo :: () -> t; foo () = foo (bar ())
03:08:58<mauke>sdf: newtype isn't useful to a beginner
03:09:10<kpreid>sdf: the *use* of newtype is to distinguish things that are represented the same
03:09:19<kpreid>sdf: without any inefficiency as a result
03:09:23<aavogt>@type (==) `on` round
03:09:24<lambdabot>forall a. (RealFrac a) => a -> a -> Bool
03:09:28<aavogt>@type (==) `on` round 5.5
03:09:29<lambdabot>forall b a. (Eq b, Integral (a -> b)) => a -> a -> Bool
03:09:35<kpreid>e.g. newtype HTML = HTML String --
03:09:46<aavogt>@type (==) `on` round $ 5.5
03:09:47<lambdabot> Precedence parsing error
03:09:47<lambdabot> cannot mix `on' [infixl 0] and `$' [infixr 0] in the same infix expression
03:10:02<kpreid>or newtype Length = Inches Double
03:10:23<dmwit>> ((==) `on` round) 5.5 6.5
03:10:25<lambdabot> True
03:10:34<hatds>there is one place where newtype is useful beside efficiency: newtype deriving
03:11:24<aavogt>dmwit: infix functions with 4 arguments can be awkward sometimes
03:11:52<dmwit>> let (~=) = (==) `on` round in 5.5 ~= 6.5
03:11:54<lambdabot> True
03:12:04<idnar>kpreid: you can have an expression of type void in C, you just can't store it or use it ;)
03:12:15<mauke>preflex: calc (1 2 + 3 4) --
03:12:15<kpreid>I didn't say you couldn't!
03:12:16<preflex> -4
03:12:22<sdf>I'm still having trouble conceptualizing the importance. Are you saying I should just basically not worry about it until I need to worry about performance issues? I read the examples given my kpreid, but they seem to be things that could be accomplished in other ways. Am I correct?
03:12:42<idnar>kpreid: void foo() { return bar(); } does compile, btw
03:12:44<mauke>everything can be done in some other way
03:13:02<kpreid>idnar: hum...
03:13:05<mmorrow>sdf: 'newtype' only exists at the source-code level, it's gone at runtime. whereas 'data' puts its content(s) into a box that has ptrs to them
03:13:05<Peaker>idnar: that surprises me, no warnings with -Wall?
03:13:14<idnar>Peaker: no warnings
03:13:17<kpreid>idnar: is that with -std=c99 or -std=c89?
03:13:29<idnar>kpreid: both work fine
03:13:37<mmorrow>sdf: so newtype is "free" and data isn't
03:13:41<idnar>I'm slightly surprised that it works, but only slightly
03:13:45<kpreid>hold on, did you declare bar returning void?
03:13:46<mauke>try.c:7: warning: ISO C forbids ‘return’ with expression, in function returning void
03:13:58<sdf>mmorrow: okay. that helps.
03:14:01<idnar>kpreid: yes, void bar() {}
03:14:01<kpreid>mauke: that's what I expected to see.
03:14:20<hatds>I like how C warnings are "ISO C says you shouldn't do this dangerous thing
03:14:30<idnar>mauke: how did you get that?
03:14:38<idnar>ah, -pedantic
03:14:44<mauke>with my default c flags
03:14:45<hatds>and not like "type rejected: returning Int where expecting void"
03:14:47<mauke>preflex: ? cflags
03:14:48<preflex> gcc -std=c89 -pedantic -Wall -W -Wno-missing-field-initializers -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -O2
03:15:17<idnar>g++ -pedantic is fine with it, though
03:15:54<idnar>hmm, what is sizeof(void)?
03:15:56<mauke>(note: gcc doesn't even claim to be a C compiler without -std=c89 -pedantic)
03:16:14<mmorrow>mauke: c89??
03:16:18<mauke>yes
03:16:26<mauke>it definitely doesn't conform to c99
03:16:32<idnar>oh, 1 (and a warning)
03:17:03<idnar>not that it matters
03:17:27<idnar>does a value of type () consume memory in GHC?
03:17:55<hatds>typeclasses and alternatives (sum types) provide similiar but distinct roles -- is there an analogue for product types?
03:18:20<mauke>hatds: sounds like a record system!
03:18:30<allbery_b>idnar: it does, because it could be _|_
03:18:41<hatds>mauke: it doesn't to me
03:19:13<hatds>or is it extensible records?
03:24:09<hackagebot>hsSqlite3 0.0.6
03:24:20<gwern>hatds: I'm guessing a sum type is data Foo = Bar | Quux, but what's a product type?
03:24:36<mauke>data Foo = Foo Bar Baz
03:24:38<hatds>gwern: tuples or data types with one constructor
03:25:13<gwern>hum
03:25:13<mauke>and you can build everything from (), Either, (,) and recursion
03:32:15<dmwit>...and ->
03:39:10<idnar>mauke: man, that would be painful :P
03:43:56<dmwit>idnar: Go to bed!
03:59:04<roconnor>mauke: I don't think that is true
03:59:45<roconnor>mauke: you need type-level combinators: SK or BCKW or some such thing.
04:00:29<gio123>is here any english speaker?
04:00:38<MyCatVerbs>No, we all speak Haskell.
04:01:07<MyCatVerbs>I mean, yes. Everybody here speaks English. What can I do for you?
04:01:09<gio123>ok
04:01:24<gio123>nothing
04:01:28<gio123>just wanted to know
04:02:17<Twey>.oi mi pi-so'u-roi vi tavla fo la .lojban.
04:02:31<osfameron>tu croix?
04:03:05<MyCatVerbs>Well okay, Twey and osfameron can only be communicated to through obscenely complicated strings of typeclass declarations.
04:03:10<MyCatVerbs>But pretty much everyone else is alright.
04:04:19<roconnor>gio123: there are a few non-english Haskell channels.
04:04:37<roconnor>#haskell.es for example
04:05:13<roconnor>El Lenguaje de Programación Puramente Funcional Haskell
04:05:33<osfameron>and -it
04:05:48<osfameron>consistency ftw
04:06:25<roconnor>god damn inconsistency
04:06:25<MyCatVerbs>I don't think there's a #haskell.ge yet, though.
04:06:33<roconnor>@where lambdabot
04:06:33<lambdabot>http://www.cse.unsw.edu.au/~dons/lambdabot.html
04:06:35<osfameron>ge?
04:06:39<roconnor>@seen lambdabot
04:06:39<lambdabot>Yes, I'm here. I'm in ##english, #haskell-hacphi, ##hrg, #unicycling, #scannedinavian, #scala, #rosettacode, #perl6, #macosxdev, #jtiger, #jhc, #haskell_ru, #haskell.se, #haskell.ru, #haskell.no, #
04:06:39<lambdabot>haskell.jp, #haskell.it, #haskell.hr, #haskell.fr, #haskell.fi, #haskell.es, #haskell.dut, #haskell.de, #haskell.cz, #haskell-soc, #haskell-books, #haskell-blah, #haskell-in-depth, #haskell-freebsd,
04:06:39<lambdabot>#macosx, ##freebsd, #gentoo-uy, #gentoo-haskell, #friendly-coders, #dreamlinux-es, #concatenative, #arch-haskell, #functionaljava, #novalang, #darcs, #yi, #xmonad, #ghc, ##logic, #haskell-overflow
04:06:39<lambdabot>and #haskell
04:07:03<mmorrow>void **fix(void*(*f)(void**)) {return f(malloc(sizeof(void*)));}
04:07:06<mmorrow>/kinda
04:07:09<osfameron>ah! it /is/ .it, my mistake
04:07:31<MyCatVerbs>osfameron: Georgia. I got curious and poked a geoip service.
04:07:38<osfameron>aha
04:07:46<Twey>mmorrow: !!!
04:08:05<monochrom>That is evil.
04:08:25<osfameron>wossit do?
04:08:26<MyCatVerbs>What, GeoIP is evil?
04:08:37<monochrom>The C code of mmorrow is evil.
04:09:18<MyCatVerbs>Oh! Yes.
04:09:23<MyCatVerbs>Evil indeed.
04:09:49<monochrom>I think it works for suitably defined f.
04:11:38<monochrom>No, it doesn't recurse f. I don't know its purpose now.
04:12:09<monochrom>And his computer has just crashed because he is testing his code. :)
04:12:26<Twey>Forgot to free.
04:12:27<osfameron>unless malloc happens to return fix?
04:12:47<osfameron>meh, do not understand C
04:13:29<monochrom>malloc is not supposed to happen to return fix. It is not like we're running it in DOS.
04:13:29<alvarezp>ACTION is away:
04:13:41<mmorrow>laptop dies
04:13:52<osfameron>ACTION crashes (due to lack of sleep, as well as evil c)
04:14:05<monochrom>You spewed evil C code and your laptop dies in punishment.
04:21:01<mmorrow>monochrom: haha
04:21:05<mmorrow>http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2535#a2535
04:21:14<mmorrow>, fix (42:)
04:21:16<lunabot> [42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,...
04:21:53<mmorrow>malloc just for the indirection ptr
04:22:17<mmorrow>gah, my session fontsize is borked.. re-logging in
04:25:44<mmorrow>that abstract out into its own function pretty poorly
04:25:48<mmorrow>*abstracts
04:26:09<mmorrow>forces you to have **'s all over
04:26:52<mmorrow>, levels (fix (\x -> Node () [x,x]))
04:26:54<lunabot> [[()],[(),()],[(),(),(),()],[(),(),(),(),(),(),(),()],[(),(),(),(),(),(),...
04:27:29<osfameron>:t levels
04:27:31<lambdabot>forall a. Tree a -> [[a]]
04:27:55<osfameron>ah
04:28:07<mmorrow>perfect infinite binary tree :)
04:28:40<mmorrow>, vacuum (fix (\x -> Node () [x,x]))
04:28:43<lunabot> [(0,[1,2]),(1,[]),(2,[0,3]),(3,[0,4]),(4,[])]
04:29:06<mmorrow>, vacuum (fix (\x -> () : x))
04:29:09<lunabot> [(0,[1,0]),(1,[])]
04:32:26<Gracenotes>mmorrow: how do you know about which number is which node..? no way to tell? >_>
04:32:50<mmorrow> (nodeid,[ptrs])
04:33:30<mmorrow>and if (nodeif,[]) ==> it's a literal (Int#,Double#,(possibly many of them))
04:33:38<mmorrow>(nodeif,[])
04:33:39<mmorrow>gah
04:33:41<mmorrow>(nodeid,[])
04:34:02<mmorrow>, vacuum [0..100]
04:34:05<lunabot> [(0,[1,2]),(1,[]),(2,[3,4]),(3,[]),(4,[5,6]),(5,[]),(6,[7,8]),(7,[]),(8,[...
04:34:56<mmorrow>Gracenotes: but yeah, you have to guess which pair corresponds to which node ;)
04:35:25<Gracenotes>mmorrow: well, the diagrams have it
04:35:25<mmorrow>it walks it (for the most part) breadth-first though
04:35:30<mmorrow>yeah
04:35:42<Gracenotes>might mighty useful... quizas
04:35:44<mmorrow>this just ditches all info other than the graph structure
04:36:13<Gracenotes>aw.
04:36:23<mmorrow>(it actually use essentially the same algo that a cheney copying gc uses)
04:36:59<mmorrow>except the "tospace" is the (IntMap HNode) in the state monad's state rather than a chunk of memory
04:43:00<mmorrow>love million line csv files
04:44:35<mmorrow>oops, that should be:
04:44:44<mmorrow>void **fix(void**(*f)(void**))
04:44:46<mmorrow>not
04:44:50<mmorrow>void **fix(void*(*f)(void**))
04:45:00<mmorrow>(not that it really matters in C)
04:45:37<luqui>why void**?
04:46:45<mmorrow>that fix is basically just abstracting out allocating the idirection ptr that `f' 'll use to set it's result to and to embed within itself
04:46:55<Pseudonym>template<type T> T fix(std::unary_function<T,T>);
04:47:21<mmorrow>so it's actually pretty worthless as a C function since it forces you to have another level of indirection
04:47:37<mmorrow>for not really any gain (woo, not have to call malloc once yourself :)
04:48:10<luqui>Pseudonym, of course, that's no good because C++ is strict
04:48:17<luqui>Pseudonym, need to eta expand
04:48:33<mmorrow>Cons *xs; xs = malloc(sizeof(Cons)); xs->head = 42; xs->tail = xs; return xs; //without the need for **'s
04:48:35<Pseudonym>Of course, none of this is any good because not all types in C or C++ have a least fixed point.
04:49:36<luqui>template<class T. class U> std::unary_function<T,U> fix(std::unary_function<std::unary_function<T,U>, std::unary_function<T,U> >) // ugh
04:49:50<luqui>all function types do
04:49:55<mmorrow>the single-fix is more about self-reference than recursion though
04:50:00<mmorrow>*single-arg fix
04:50:03<luqui>ah
04:50:30<mmorrow>it hands you the result of what you'll eventually do with the result
04:50:53<mmorrow>which is just an uninitialized chunk of memory
04:51:08<luqui>that sentence made me think of fixed points of continuations...
04:51:20<luqui>which is probably unremarkable, but i can't grok it at
04:51:21<luqui>atm
04:51:58<mmorrow>how do you mean?
04:53:00<mmorrow>@type \f a -> fix (\k -> f a k)
04:53:02<lambdabot>forall t a. (t -> a -> a) -> t -> a
04:53:10<mmorrow>hmm
04:53:20<mmorrow>@type \f -> fix (\k -> f k)
04:53:22<lambdabot>forall a. (a -> a) -> a
04:53:27<mmorrow>heh,
04:53:32<mmorrow>oh
04:54:40<mmorrow>hard without newtypes to get infinite types
04:55:17<mmorrow>(hard [to mess with fix+continuations] without newtypes [as a way to get] infinite types)
04:56:04<mmorrow>luqui: the monadLib `Label' datatype is really neat
04:56:26<mmorrow>it lets you grab the cont from callCC and stick it places
04:57:42<mmorrow>, runCont (do (a,here) <- label 0; when (a < 100) (jump here (a+3)); return a)
04:57:44<lunabot> luna: Not in scope: `label'
04:58:15<luqui>oh, first-class goto
04:58:23<mmorrow>, runCont (do (a,here) <- labelCC 0; when (a < 100) (jump here (a+3)); return a)
04:58:25<lunabot> luna: Occurs check: cannot construct the infinite type:
04:58:29<mmorrow>, runCont id (do (a,here) <- labelCC 0; when (a < 100) (jump here (a+3)); return a)
04:58:31<lunabot> luna: Occurs check: cannot construct the infinite type:
04:58:45<mmorrow>, [$ty| jump |]
04:58:49<lunabot> forall a b c . ContM b => c -> Label b c -> b a
04:58:50<luqui>I like monadlib
04:58:54<mmorrow>, runCont id (do (a,here) <- labelCC 0; when (a < 100) (jump (a+3) here); return a)
04:58:56<lunabot> 102
04:59:09<mmorrow>luqui: yeah, it's nice
04:59:39<roconnor>newtype Label m a = Lab ((a, Label m a) -> m ())
04:59:49<roconnor>ACTION mind boggles
05:00:01<roconnor>that does seem strictly positive to me.
05:00:11<roconnor>that doesn't
05:00:13<mmorrow>you need to define jump as
05:00:54<mmorrow>jump a l@(Lbl k) = k (a,l) >> undefined
05:01:03<mmorrow>or something like that
05:01:19<mmorrow>(or at least how i defined it i did)
05:01:49<luqui>roconnor, does it need to be?
05:02:26<mmorrow>jump :: a -> Label m a -> Cont o a
05:02:30<mmorrow>jump a l@(Lbl k) = k (a,l) >> undefined
05:03:04<mmorrow>label a = callCC (\k -> return (a, Lbl k))
05:10:00<roconnor>It's nice that Haskell's char was able to change from 8 bit to 16 bit to 24 bit without trouble.
05:10:06<Gracenotes>@djinn (t -> t -> a) -> t -> a
05:10:07<lambdabot>f a b = a b b
05:18:35<Athas>What's the proper way to compile a Haskell program using Data.Binary and Data.Bytestring.Lazy with GHC from the command-line? I get linker errors about undefined symbols with plain ghc Main.hs.
05:18:43<Athas>I can load the program just fine in ghci, though.
05:19:52<QtPlaty[HireMe]>ghc --build Main.hs
05:19:55<mmorrow>@pl \a b c -> a b c
05:19:56<lambdabot>id
05:20:44<Athas>ghc: unrecognised flags: --build
05:21:06<hotaru2k3>isn't it "--make"?
05:21:27<Athas>--make indeed works, thanks!
05:21:53<roconnor>ACTION doesn't know how to use ghc without --make
05:22:56<mmorrow>@pl \f -> \a b c -> a (f b) c
05:22:57<lambdabot>flip (.)
05:23:08<Twey>ACTION chuckles.
05:23:11<mmorrow>@pl \f -> \a b c -> g a (f b) c
05:23:12<lambdabot>flip ((.) . g)
05:23:12<Twey>That showed you!
05:23:17<mmorrow>heh
05:54:42<hydo>Ugh... gotta put haskell on pause to clean up perl code so I can put it up on github and (hopefully) get a damn job. *sniff*
05:56:04<Twey>By ‘clean up’ you of course mean ‘convert to Haskell’ :-P
06:13:53<hackagebot>hack-frontend-happstack 2009.6.1
06:50:21<copumpkin>epic bindings in hackage
07:24:31<dibblego>@src dropWhile
07:24:31<lambdabot>Source not found. :(
07:24:36<ClaudiusMaximus>@check (\x -> unlines (lines x) == x)
07:24:37<lambdabot> "Falsifiable, after 1 tests:\n\"\\658972\\64216\"\n"
07:26:52<ClaudiusMaximus>@check (\x -> all ((< 256) . ord) x || unlines (lines x) == x)
07:26:53<lambdabot> "Falsifiable, after 0 tests:\n\"\\221350\"\n"
07:27:55<ClaudiusMaximus>@check (\x -> not (all ((< 256) . ord) x) || unlines (lines x) == x)
07:27:57<lambdabot> "OK, passed 500 tests."
07:31:57<Beelsebob>I expect your initial condition there probably accounts for 59% of strings QC is generating
07:32:01<Beelsebob>(40% of them being empty)
07:36:03<ClaudiusMaximus>i'm wondering if it's safe to assume unlines . lines = id for strings i get inside interact (\s -> ...)
07:36:34<Beelsebob>no
07:36:39<Beelsebob>the reverse is true
07:36:41<Beelsebob>but not that way
07:36:53<Beelsebob>> (unlines . lines) "5\n\n6"
07:36:55<lambdabot> "5\n\n6\n"
07:37:01<Beelsebob>wait...
07:37:08<Beelsebob>maybe it is
07:37:10<ClaudiusMaximus>ah, trailing newline
07:37:20<Beelsebob>well, yeh, I thought it would be worse
07:37:28<Beelsebob>I expected it to delete the blank line
07:37:39<Beelsebob>> lines "5\n\n6"
07:37:41<lambdabot> ["5","","6"]
07:37:43<Beelsebob>interesting
07:37:50<ClaudiusMaximus>> words "a b c "
07:37:52<lambdabot> ["a","b","c"]
07:38:07<Beelsebob>oh well, I guess it is... other than the trailing newline
07:38:26<Beelsebob>ACTION wonders...
07:38:36<Beelsebob>> (lines . unlines) ["5","6"]
07:38:38<lambdabot> ["5","6"]
07:38:55<Beelsebob>okay, so that bins the final newline and is id
07:39:12<ClaudiusMaximus>> lines ""
07:39:13<lambdabot> []
07:39:22<ClaudiusMaximus>> unlines []
07:39:23<lambdabot> ""
07:39:32<Beelsebob>heh
07:39:33<Beelsebob>annoying
07:39:40<luqui>> lines "x\n"
07:39:41<lambdabot> ["x"]
07:40:01<Beelsebob>so it's not so much that it adds a trailing newline – it's that it doesn't detect only one elemnt left
07:40:09<Beelsebob>which I guess makes sense
07:40:13<Beelsebob>it couldn't be lazy without it
07:40:17<Beelsebob>and would be near useless
07:44:16<ClaudiusMaximus>@src lines
07:44:17<lambdabot>Source not found. Just what do you think you're doing Dave?
07:48:20<ski>@check \ss -> (lines . unlines) ss == id ss
07:48:22<lambdabot> "Falsifiable, after 398 tests:\n[\"\\1105281\\800718\\1021131\\228503\\4654...
07:48:41<ski>@scheck \ss -> (lines . unlines) ss == id ss
07:48:44<lambdabot> "Falsifiable, after 366 tests:\n[\"\\240664\\800786\\197244\\160928\\757345...
07:48:55<Twey>What is happening there?
07:49:01<Twey>@src unlines
07:49:01<lambdabot>unlines = concatMap (++ "\n")
07:49:04<Twey>Ahhh
07:49:06<Twey>Of course
07:49:11<halberd>trailing newline
07:49:17<Twey>unlines . lines is identity, but lines . unlines is not
07:49:28<Twey>Since one of the strings in the list may itself have a newline in
07:49:30<ski>@scheck \s -> (unlines . lines) s == id s
07:49:32<lambdabot> "Falsifiable, after 0 tests:\n\"\\952912\\242651\"\n"
07:49:40<Twey>Which will be broken up when it gets to lines
07:49:42<Twey>Huh.
07:49:48<Twey>Ah, right
07:50:04<ski>> lines "\952912\242651"
07:50:06<lambdabot> ["\952912\242651"]
07:50:12<ski>> unlines (lines "\952912\242651")
07:50:13<lambdabot> "\952912\242651\n"
07:51:01<ski>> lines "a\nb\n\nc"
07:51:02<lambdabot> ["a","b","","c"]
07:51:29<ski>> words "a b c"
07:51:30<lambdabot> ["a","b","c"]
07:51:42<ski>interesting
07:52:22<halberd>lines "a\n" is the same as lines "a"
07:52:30<ski>one might expect `lines . unlines = id' or `words . unwords = id', but not the other directions
07:52:34<halberd>so it's not 1-1 so can't be inverted
07:53:03<ski>would it be tolerable if `lines "a\n"' was `["a",""]' ?
07:53:40<ski>hm
07:53:42<halberd>the Unix convention is that every file has a trailing newline
07:53:53<halberd>so it would not be good if that counted as an extra blank line at end of file
07:54:43<ski>actually, i suppose one might only expect `lines . unlines = id' on lists of strings not containing any newlines
07:57:50<ski>hm, what's the conditional testing operation named again ?
07:58:06<ski>@check \x -> x == False ==> x == False
07:58:08<lambdabot> Not in scope: `==>'Precedence parsing error
07:58:08<lambdabot> cannot mix `GHC.Classes.==...
07:58:29<Gracenotes>unfortunate..
07:58:39<ski>.. oh
07:58:43<ski>@index ==>
07:58:44<lambdabot>Test.QuickCheck, Debug.QuickCheck
07:58:57<ski>@check \x -> x == False Test.QuickCheck.==> x == False
07:58:58<lambdabot> Not in scope: `Test.QuickCheck.==>'Precedence parsing error
07:58:58<lambdabot> cannot mix...
07:59:13<ski>*sigh*
07:59:14<Gracenotes>parens
07:59:18<ski>@check \x -> (x == False) Test.QuickCheck.==> (x == False)
07:59:20<lambdabot> Not in scope: `Test.QuickCheck.==>'
07:59:29<ski>@check \x -> (x == False) Debug.QuickCheck.==> (x == False)
07:59:31<lambdabot> Not in scope: `Debug.QuickCheck.==>'
08:00:01<Gracenotes>suspect, @check is
08:01:22<ski>i was going to try
08:01:23<ski>@check \ss -> all (all ('\n' /=)) ss =>> (lines . unlines) ss == id ss
08:01:25<lambdabot> Not in scope: `=>>'
08:01:40<ski>(fsvo `=>>', such as `==>')
08:02:33<cads>why is it that it's extra fun to have discussions on a programming language other than the one featured in the topic
08:02:53<ski>which one ? :)
08:03:26<Tarrant>Hey I'm just playing around with "Learn you some haskell". I have this block of code http://codepad.org/JOVMoWvR and it just doesn't seem to want to work. I'm sure it is something very moronic that I'm missing.
08:03:54<cads>ski, was talking about erlang in jruby
08:04:10<ski>Tarrant : first, try indenting all the `|' lines at least one whitespace
08:04:21<ziman>Tarrant, i guess it's the indentation in the `where' block
08:04:27<cads>real web services oriented stuff, revolving around twitter and hypothetical poker servers that host thousands of concurrent games and such
08:04:53<ski>yes, the definitions after the `where' must line up their starting characters
08:05:10<cads>mostly bsing about what we think about it, what we've heard and some details of how it works
08:05:13<halberd>Tarrant: you need to show sum
08:05:18<cads>ever do that ski?
08:05:59<cads>note, I don't think any of us were erlang programmers :)
08:06:04<ski>cads : talked about one language in a channel for another ? or implemented web-y things ?
08:06:13<cads>the former
08:07:14<ski>Tarrant : also, i would factor out the `xs ++ "+" ++ ys ++ ":" ++ sum' part. DRY (Don't Repeat Yourself)
08:07:53<ski>cads : sure
08:08:41<cads>for example with erlang, the channel seems to be pretty quiet for some reason
08:09:05<ski>Tarrant : note that if you factor out this part, then you don't need to factor out the `xs',`ys',`sum' part .. unless you think that improves readability for you
08:09:53<Tarrant>ski: Thanks. This was really just an elaborate test for using multiple 'where's
08:09:57<ski>(cads : i think that is partly related to there not being that many members of it)
08:10:17<Tarrant>Once I change vim to use tabstop=4 spaces and reindented everything it started working.
08:11:02<ski>Tarrant : you had no multiple `where's in the pasted code. (however you had (or attempted to have) multiple *definitions* inside a *single* `where'-clause)
08:12:02<Tarrant>ski: Yes thats what I mean... :) As I said new here.
08:12:23<ski>yw :)
08:13:26<Ping_Pong>Google Wave to "redefine" E-mail communication... Will this killer attempt succeed ?? people who aren't ware of Google wave ..check out at my blog for more details http://www.techfancy.co.cc
08:13:51<ski>Tarrant : fyi, the brackets in the definitions of `xs' and `ys' are extraneous
08:14:16<ski>ACTION raises left eyebrow
08:14:48<Ralith>ACTION wonders if anyone has reported 117.195.204.105 for spam
08:14:57<cads>google wave will be the shit
08:15:10<Ralith>IRC will be the shit
08:15:11<Ralith>oh wait
08:15:13<Ralith>it already is
08:15:21<Ralith>glad that's resolved
08:15:26<cads>irc will still be here.
08:16:06<cads>wave will be better than shit like facebook
08:16:31<cads>have you guys seen the demo?
08:16:37<Ralith>that's not saying much
08:16:38<Tarrant>cads: Facebook had its place until they allowed these ridiculus spam applications in.
08:18:13<ski>ACTION mentions The speed, size and dependability of programming languages <http://gmarceau.qc.ca/blog/2009/05/speed-size-and-dependability-of.html> while we're OT
08:18:35<Ralith>now that's actually an interesting topic
08:18:52<Ralith>amusing misnomer of a url, too
08:19:06<ski>how ?
08:19:10<copumpkin>not sure where he got the dependability from
08:19:58<Ralith>ski: "Speed, size, and dependability of .html"
08:20:04<ski>(copumpkin : afaiu, how "wide" the appropriate diagram was)
08:20:32<copumpkin>well, our diagram is particularly wide because one of our benchmarks just fails
08:20:37<copumpkin>due to the lack of a regex package
08:21:14<copumpkin>pulling dependability out of that seems particularly far-fetched :) but hey, it's a benchmark I guess
08:21:24<ski>ACTION was imagining failing benchmarks would just be missing data-points
08:21:47<copumpkin>I dunno, we have one line going way far off to the right
08:22:14<copumpkin>and the only benchmark where we aren't within a few x of gcc is the one we fail
08:23:19<brian6>if one function f :: StateT S IO () is 'forever' watching something and updating S, can some forkIO'd thread share S, like get the current state with 'get'?
08:25:18<sjanssen>ski: what is that crap?
08:25:32<sjanssen>looks like a bunch of sophistry about shapes
08:25:44<quicksilver>brian6: not automagically, no.
08:25:44<lambdabot>quicksilver: You have 1 new message. '/msg lambdabot @messages' to read it.
08:25:50<quicksilver>brian6: you will want to use an MVar
08:25:59<sjanssen>(note, I haven't actually read the post yet)
08:26:23<brian6>quicksilver: ok. so i have to come up with my own communication stuff, like Chan, etc.
08:26:23<quicksilver>if you're feeling really clever, you can write a special MonadState instance for a custom monad where "get" calls readMVar, and put calls writeMVar
08:26:37<quicksilver>and modify is guaranteed to be atomic.
08:26:44<quicksilver>@messages
08:26:45<lambdabot>ivanm said 1d 19h 29m 59s ago: after playing with kuribas' indentation mode, I recall using it once and discarding it because I keep expecting tab to indent no matter where in the line I am (and
08:26:45<lambdabot>backspace doesn't unindent the same amount as tab indents either) :s
08:27:47<quicksilver>@tell ivanm Backspace does unindent the same amount as tab indents.
08:27:47<lambdabot>Consider it noted.
08:28:17<quicksilver>@tell ivanm and tab not working anywhere in the line should be easy to fix - and seems much less important than haskell-mode getting it completely wrong :P
08:28:17<lambdabot>Consider it noted.
08:31:43<ski>(sjanssen : just something that might be interesting to discuss ..)
08:33:32<quicksilver>I think sophistry is a little unfair
08:33:48<quicksilver>it's an attempt at high level qualitive analysis, which is always a bit dodgy
08:34:10<quicksilver>but the star charts are certainly an interesting way to visualise it.
08:49:38<cads>wow
08:49:45<cads>I've been hanging our here about a year
08:50:32<cads>and compared to what I knew about computation a year ago, and the papers I could read, and the code in any language that I could understand, the difference is truly amazing
08:50:37<QtPlaty[HireMe]>ACTION gives cads a paper.
08:50:47<cads>why thankyous good kindsir
08:50:53<Twey>ACTION gives cads a piece of paper
08:50:57<Twey>Your turn to write :-P
08:51:05<Berengal>cads: Autodidact?
08:51:40<cads>just passionate about a few things
08:52:08<cads>it's real fun to think about languages and theory
08:52:28<cads>twey, I might have an idea in mind
08:53:49<Baughn>Peaker: Well, I am now
09:07:32<mmorrow>@seen sw17ch
09:07:33<lambdabot>I saw sw17ch leaving #haskell 6d 5h 11m 43s ago, and .
09:07:40<mmorrow>@preflex sw17ch
09:07:41<lambdabot>Unknown command, try @list
09:07:43<mmorrow>@preflex seen sw17ch
09:07:44<lambdabot>Unknown command, try @list
09:07:50<mmorrow>preflex: seen sw17ch
09:07:51<preflex> sw17ch was last seen on #haskell 26 days, 8 hours, 25 minutes and 52 seconds ago, saying: sweet! atom-0.0.3 is out.
09:08:16<mmorrow>@tell i love libtask :)
09:08:17<lambdabot>Consider it noted.
09:08:47<mmorrow>(which is this: http://swtch.com/libtask/)
09:15:30<jaj>mmorrow: don't you have to say "@tell sw17ch" ?
09:16:04<mmorrow>haha
09:16:09<mmorrow>jaj: thanks
09:16:14<jaj>:)
09:16:23<mmorrow>@tell sw17ch i love libtask :)
09:16:24<lambdabot>Consider it noted.
09:29:05<cads>Lor' luv a duck! Hey man, can we rock an' roll ter da stawer an' get some beers, I'm rarfer thirs'y if winnie da pooh know what I mean. Lets get some food along da way, chips an' gravy a cheezburger, I'm fuckin' starved. And lets cuff an' choke some chicken feed . Know what I mean?
09:29:49<cads>cockney rhyming slang is the shizzle!
09:30:15<cads>http://www.cockneyrhymingslang.co.uk/rabbit translator
09:30:31<tux-foo>cads, is it haskell based?
09:31:41<tux-foo>cads, ah, that is what you meant with slang.
09:34:01<tux-foo>\msg memoserv
09:39:07<cads>tux-foo, it has to be a simple set of varying substitution rules
09:39:35<cads>sometimes it replaces each s with debby laboos
09:40:02<cads>so translator turns into trandebby labooslator
09:42:13<ski>(tux-foo has quit)
10:03:59<Peaker>Baughn: hey?
10:04:10<Baughn>ACTION pokes Peaker with a stick
10:04:27<Peaker>Baughn: how's the unamb/joinE stuff doing?
10:04:38<Peaker>Baughn: Do you know what bugs still remain in there?
10:04:42<Baughn>Oh, it's not. Got another exam in two days, so I'm focusing on that right now.
10:04:52<Baughn>Near as I can tell, unamb is now bugless
10:04:59<Baughn>joinE is not, nor apparently is mappend
10:05:14<Beelsebob>IIRC mappend's bug is caused by joinE's bug
10:05:16<Beelsebob>via snapshot
10:05:33<Beelsebob>or maybe it's the other way round
10:05:37<Beelsebob>either way, they're connected
10:06:37<Baughn>Right
10:06:44<Peaker>Beelsebob: does anyone need joinE? Do Reactive values need it for a monad instance?
10:06:55<Baughn>Peaker: joinE is used for the Monad instance
10:06:57<Beelsebob>hell yes!
10:07:09<Baughn>And yes, it's incredibly useful. Or it would be, anyway
10:07:09<Beelsebob>join is one of the more useful things you need to do
10:07:23<Peaker>ah, any idea why it is broken?
10:07:27<Beelsebob>join on behaviors would be super-useful too, but is near impossible to write right
10:07:27<Peaker>what part of it is broken?
10:07:30<Beelsebob>Peaker: lazyness
10:07:34<Baughn>None. It's also incredibly involved.
10:07:38<Beelsebob>it's very hard to get it to make enough progress
10:07:42<Baughn>Well, "lazyness" is a good guess. :)
10:08:02<Beelsebob>last time I went through it I came to the same conclusion as Conal...
10:08:04<quicksilver>I don't think the Event monad instance is useful.
10:08:11<quicksilver>but, I do think joinE is useful.
10:08:13<Beelsebob>that the MaxBound type is not right
10:08:16<quicksilver>you need to to define filterE
10:08:29<quicksilver>it's the only way to get an event that has fewer occurrences than the one you put in...
10:08:33<Baughn>Never mind filterE, joinE is useful on its own
10:08:35<Beelsebob>quicksilver: because the monad instance doesn't agree with the applicative one?
10:08:56<quicksilver>Beelsebob: >>= just doesn't seem to be useful, for events. To me.
10:09:15<Beelsebob>ACTION tries to remember where he found that useful
10:09:21<quicksilver>although return, ap and join are all independently useful
10:09:24<Beelsebob>maybe it only was behaviors that I found it useful
10:09:31<quicksilver>hell yeah.
10:09:32<Beelsebob>(and not implemented)
10:09:37<quicksilver>behaviours are *definitely* monads
10:09:38<Beelsebob>(because it's bloody hard)
10:09:43<quicksilver>reactives too.
10:09:50<quicksilver>in an obvious natural way
10:09:57<Beelsebob>hmm?
10:09:58<quicksilver>(which may indeed be impossible to implement :P)
10:10:10<quicksilver>it's just that events don't seem right, to me.
10:10:12<luqui>quicksilver, that is a wish, or do you have evidence? :-)
10:10:13<Beelsebob>the issue with implementing it is that you lose the ability to find the constant parts
10:10:16<quicksilver>still, doesn't make joinE any less important.
10:10:23<Beelsebob>and hence lose all your efficiency
10:12:05<Peaker>quicksilver: you can get less events than you put in, as join multiplies the amounts, it can be multiplied by 0 :-)
10:12:19<quicksilver>Peaker: that's exactly what I said.
10:12:33<quicksilver>Peaker: join is the *only* way to get an event with fewer occurrences than you put in.
10:12:34<Peaker>quicksilver: I thought you said only filterE can get a lesser event
10:12:35<Beelsebob>Peaker: he said without joinE you can't get fewer events than you put in
10:12:47<quicksilver>that's why it's so important.
10:12:49<Beelsebob>no, he said filterE relied on joinE
10:12:58<Beelsebob>because joinE is the only way of taking away events
10:12:59<Peaker>oh, didn't know filterE was on top of joinE
10:13:12<quicksilver>fmap and <*> always give you occurrences based on incoming events
10:13:25<quicksilver>so joinE is really really importasnt.
10:13:39<quicksilver>Yeah, if you think about filterE for a while it's obvious that the sensible way to implement it is using joineE
10:13:52<quicksilver>of course, you could inline + specialise and implement it directly.
10:16:48<Peaker>what does blah <*> mempty get?
10:17:17<quicksilver>oh, that's a good point.
10:17:31<quicksilver><*> does let you trim initial segments.
10:19:40<Peaker>quicksilver: How does Deus/whatsitsname compare to Reactive?
10:20:05<quicksilver>Deus/Reactive ;)
10:20:17<LeCamarade>@tell conal I'd like to talk to you about the weird behaviour I get with threads. I didn't manage to get you to reply last week, before I had to go away.
10:20:18<lambdabot>Consider it noted.
10:20:25<defun>hi. out of sheer curiosity, why didn't cabal use haskell as a package description format, and instead made their own?
10:20:34<quicksilver>its mappend is not guaranteed deterministic for nearly simultaneous events
10:20:41<quicksilver>(futures, rather)
10:20:57<quicksilver>and it doesn't share as aggressively as reactive is intended to
10:21:03<quicksilver>however it does work, including joinE/filterE
10:21:26<quicksilver>the stars demo I uploaded shows most of the working bits working.
10:21:28<dcoutts>defun: using a fully featured language to describe a package makes it much harder to translate into other languages. Using a deliberately less expressive language makes that feasible.
10:21:55<defun>I see.
10:22:33<Baughn>As it is, it's feasible to, f.ex., automatically translate cabal packages to Arch packages
10:22:37<Gracenotes>:>
10:25:25<defun>dcoutts: however, it would have been feasible, correct?
10:25:34<dcoutts>defun: it'd be possible to use a Haskell data structure to represent the same info, but that gains little over a text representation of the same
10:26:03<Baughn>defun: Translating to other languages would /not/ have been possible
10:26:03<dcoutts>defun: the key point is that the description language be inexpressive.
10:26:15<Baughn>Seeing as most of the package description formats are not, in fact, turing-complete
10:26:26<defun>I see. Makes sense.
10:27:03<dcoutts>defun: think how hard it'd be for an IDE to edit a package description if it's general purpose code
10:27:17<Baughn>We have an IDE?
10:27:31<dcoutts>Baughn: we've got half a dozen :-)
10:27:55<quicksilver>Baughn: well, that's not strictly fair. For example, using haskell code as a description, the specification could have been that it defines top-level values which evaluate to the various fields. A translator could just 'run' that code and then output that to the alternative package description.
10:28:11<quicksilver>Baughn: that would effectively 'freeze' any dynamism present in the haskell language description.
10:28:17<quicksilver>This is not a criticism of the decision however.
10:28:23<quicksilver>It's merely unproductive pedantry.
10:28:33<dcoutts>quicksilver: right, but that was my point, it doesn't gain much over just storing the output of that program
10:28:40<dcoutts>quicksilver: and it allows editing
10:28:42<quicksilver>agreed.
10:29:04<dcoutts>quicksilver: it'd allow redundancy in the data to be shared in the generator
10:29:06<Baughn>And besides, people /would/ stick code in there that depends on the current state of the system
10:29:15<Baughn>Even if they have to use unsafePerformIO
10:29:42<dcoutts>Baughn: heh, yeah. You should look at Setup.hs scripts some time. I've found the worst code in there.
10:30:07<RayNbow>ACTION feels odd after having sent his first email to the Haskell cafe mailing list...
10:30:16<Baughn>dcoutts: I have some idea why. I've been trying, unsuccessfully, to make cabal test do anything useful for unamb for a while now.
10:30:48<dcoutts>Baughn: yep, the api was never designed
10:31:09<Baughn>..you're not going to say "for that", are you?
10:32:07<dcoutts>Baughn: nope
10:32:28<Baughn>I thought so.
10:32:45<Baughn>*not, I suppose. Bloody english language.
10:32:52<dcoutts>I mean there's a definite lack of design in the API exposed to Setup.hs scripts
10:33:02<Baughn>ACTION snorts
10:33:18<Baughn>All I really want to do is have it build the library.. build an executable... and run it.
10:33:45<mmorrow>i think haskell data (already evaluated a la output of Show) is win win. most of all because you can Read it in.
10:33:58<Baughn>Say. How come, if you have executables in the same package as a library, it'll build any files the executables depend on twice?
10:34:04<mmorrow>and prettyprint it with (eg) haskell-src-exts
10:34:44<mmorrow>ACTION use hstidy (which is just main = prettyPrint . parse) constantly
10:35:07<mmorrow>hstidy -e < package.conf | HsColour -tty | less -r
10:35:12<dcoutts>Baughn: because you cannot yet say that the exe depends on the lib
10:35:33<dcoutts>Baughn: but blackh and I finished the changes to let you do that yesterday
10:35:46<Baughn>That's good timing. :)
10:35:52<dcoutts>Baughn: in general you might be using different options, so we cannot share them
10:36:01<dcoutts>Baughn: eg different cpp options
10:36:01<Baughn>Shouldn't it figure.. ah
10:36:20<Baughn>dcoutts: It can't check if that happens to not be the case?
10:36:39<dcoutts>also, we cannot share between a lib and an exe anyway because they use different package names in the compiled code
10:37:12<dcoutts>the right solution is not ad-hoc sharing I think, but explicit sharing
10:37:24<dcoutts>that also allows one to share the options rather than duplicating them
10:38:30<Baughn>So, how will that work? build-depends: foo in foo.cabal?
10:43:57<byorgey>dcoutts++ blackh++
10:50:22<mmorrow>unix pipes are pure friggin genius
10:51:00<defun>if, however, cabal /was/ designed to use haskell as a pkg description language, how would the devs implement a way of 'loading/reading' the description? Through ghci? Could, theoretically, the pkgs descriptions be pre-compiled and loaded by GHCI/Cabal? Or am I way off?
10:52:23<Baughn>ACTION deletes 111GB of logfiles. I was wondering why /home was full...
10:54:54<Baughn>defun: You could in theory compile to bytecode and distribute that, but I don't think ghci's bytecode is designed to be serializable
10:55:09<Baughn>defun: Meanwhile, actual executable code would be inherently machine-specific
10:55:13<mmorrow>http://www.cs.dartmouth.edu/~doug/
10:56:07<mmorrow>defun: read
10:56:21<defun>on it.
10:56:25<defun>thanks.
10:56:29<mmorrow>@type read
10:56:31<lambdabot>forall a. (Read a) => String -> a
11:05:18<mjrosenb>hrmm, i would like to use haskell somplace rather unorthodox
11:05:26<mjrosenb>i don't think that this is going to work
11:16:56<osfameron>erlang factory http://www.erlang-factory.com/conference/London2009 looks nice... but it's *expensive*
11:17:03<osfameron>.summon a grassroots FP conference!
11:23:37<mjrosenb>ACTION wants haskell merch that probably does not exist
11:29:00<Baughn>> (33*1024*1024) * (8 * 2 + 8 + 8 + 8 + 8)
11:29:01<lambdabot> 1660944384
11:29:25<Baughn>..well, that explains it. This has to be among the least efficient memory formats I've ever seen.
11:29:43<Baughn>ACTION just saw a 66MB WAV file eat all his memory
11:29:57<Beelsebob>haha
11:30:30<quicksilver>NOM.WAV
11:31:30<mjrosenb>Baughn: did you attempt to load the raw data in as a list of bytes?
11:31:41<Baughn>mjrosenb: Worse. I used the WAVE package.
11:32:03<Baughn>mjrosenb: It loads samples as lists of Int, one element per channel.
11:32:17<Baughn>The entire file is, of course, a list of samples.
11:32:22<mjrosenb>oic
11:32:30<quicksilver>that's probably OK if you manage to produce + consume that list lazily
11:32:30<mjrosenb>sexy-fun time
11:32:40<quicksilver>it's not OK if you are doing global analysis on it ;)
11:32:43<mjrosenb>it'll have your g.c. crying out in pain
11:32:55<Baughn>Fortunately I managed to press C-\ fast enough
11:32:58<quicksilver>the GC is surprisingly good at that
11:33:05<quicksilver>given a modern CPU with a large cache
11:35:22<mxc>hi everyone.. question about newtype vs data performance.. specfically, declaring something like:
11:36:00<mxc>newtype T = Int vs data T = T {-# UNPACK #-} !Int
11:36:18<Baughn>newtype T = T Int, I hope.
11:36:56<Baughn>mxc: Okay, so what's the question?
11:36:58<mxc>actually, i guess newtype T Int# would be the fastest
11:37:23<Baughn>I wouldn't bet on it. Overruling the optimizer that way can lead to terrible performance.
11:39:26<mmorrow>this is good: http://www.cs.dartmouth.edu/~doug/components.txt
11:39:43<mmorrow>(from 1968)
11:40:03<mmorrow>(creator of unix pipes)
11:41:23<quicksilver>mxc: Int itself is already unpacked
11:41:37<quicksilver>mxc: so, AFAIK, there is no performance difference between Int and Int#
11:41:41<mxc>ty
11:41:47<quicksilver>it's just the latter is a GHC primitive
11:41:55<quicksilver>I would use the newtype not the data.
11:42:02<quicksilver>the newtype is guaranteed zero-overhead
11:42:05<quicksilver>the data just probably is.
11:42:15<quicksilver>they have slightly different semantics, too.
11:43:16<Athas>My Haskell program runs out of stack space when I run it, where should I start in figuring out why?
11:43:33<Athas>The main loop is tail-recursive.
11:43:44<quicksilver>are you compiling with optimisation?
11:43:58<Athas>With -O, yes.
11:44:05<ziman>maybe you're building a large thunk elsewhere
11:44:42<Athas>I considered that, but almost all my functions are strict in their arguments (via BangPatterns).
11:44:49<Athas>So I can't really see where it would be built.
11:44:52<mjrosenb>i've found that 'tail recursive' does not always mean that it doesn't use alot of stack space
11:45:12<mjrosenb>since laziness can make assumptions go to hell
11:45:26<quicksilver>well it may use zero stack space, building a large thunk
11:45:33<quicksilver>but that thunk takes stack space when you later force it :)
11:46:41<byorgey>Athas: note that bang patterns only force things to weak head normal form.
11:46:52<byorgey>So depending what it is you are "forcing" it may not get forced very far.
11:47:11<byorgey>Athas: if you paste your code somewhere (e.g. hpaste.org) we could take a look at it
11:47:31<cads>I'm tired of programming in ascii, I would buy a special keyboard to type a programming language where special symbols are used predominantly
11:47:49<Athas>It's 223 lines, though, but pretty simple: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5468#a5468
11:47:54<cads>there apl
11:47:57<byorgey>ACTION thinks we should have !! for forcing via deepSeq
11:47:58<quicksilver>@go optimus maximus keyboard
11:48:01<lambdabot>http://www.artlebedev.com/everything/optimus/
11:48:01<lambdabot>Title: Optimus Maximus keyboard
11:48:01<cads>there's*
11:48:01<Athas>It's a simplistic implementation of the virtual machine from ICFP 2006.
11:48:03<byorgey>ACTION humbly proposes the name "
11:48:08<quicksilver>cads: that one?
11:48:10<byorgey>"WhizBang patterns"
11:48:13<Athas>You will also note that I went a bit overboard with the exclamation marks out of desperation.
11:48:14<cads>quicksilver: had that in mind :)
11:48:21<quicksilver>byorgey: deepSeq is generally a mistake
11:48:29<byorgey>quicksilver: oh?
11:48:34<quicksilver>byorgey: it costs O(n)
11:48:42<quicksilver>byorgey: you don't want to do that without thinking about it carefully :)
11:48:47<cads>can I get rich typing apl code?
11:48:50<quicksilver>it least seq is O(1) at worst.
11:48:56<byorgey>quicksilver: hmm, true =)
11:49:01<cads>if so I will buy that keyboard.
11:49:07<ziman>cads, edwardk has a vim plugin that replaces -> with → and so on, i use it and i like it much :)
11:49:36<byorgey>cads: try programming in Agda =)
11:49:44<cads>wow
11:49:46<ziman>but i'd welcome a keyboard with a mathpad, definitely :)
11:49:47<cads>absolutely!
11:49:48<quicksilver>Athas: and yet, you don't have ! in any of the places that matter :)
11:50:02<quicksilver>Athas: your big record MachineState has all lazy fields.
11:50:04<cads>byorgey: why didn't I think of that, you're the man!
11:50:06<Athas>quicksilver: actually, I do! At least, the program rapidly ran out of heap space on many inputs beforehand.
11:50:22<Athas>What's the notation for strict fields?
11:50:33<Athas>I only just realised that 'seq' isn't the only strictness-controlling function today.
11:50:42<Baughn>data Foo = Foo !Int Double -- the Int is strict, the Double isn't
11:50:56<quicksilver>"const $!" is not useful, as far as I can see.
11:51:15<byorgey>Athas: being strict in a MachineState argument is useless. it will only evaluate it far enough to find out that, sure enough, it really is a MachineState, and not _|_
11:51:22<byorgey>but it won't actually evaluate any of the fields.
11:52:37<Athas>Most (all) of the $!'s were inserted out of desperation. I will try your suggestion, thanks.
11:53:27<byorgey>if you make all the MachineState fields strict (and you can also remove all the bang patterns matching on MachineState arguments in various functions) it should improve.
11:54:05<byorgey>although the Map may still be a problem, depending on how it is used.
11:54:18<quicksilver>if you update values in the map, make sure you do that strictly
11:56:13<Athas>How do I make the map strict? I can't figure out the syntax.
11:56:19<quicksilver>you can't.
11:56:28<quicksilver>you can't change someone else's data type.
11:56:36<quicksilver>if you update the values in the map, make sure you do that strictly.
11:56:47<quicksilver>Oh, the whole map?
11:56:53<Baughn>(Or else use rnf)
11:56:56<quicksilver>{ ... myMap :: !(Map Foo Bar) ... }
11:56:59<quicksilver>if that's what you meant.
11:57:27<quicksilver>ACTION doubts that adding a O(size of map) rnf operation to every update is a good idea.
11:57:41<maltem>I'd call that “be strict in the map”
11:57:47<quicksilver>except, perhaps, as an experiment to see if it makes the stack overflow goes away.
11:57:49<Athas>Of course, parentheses! I kept getting errors about "Unexpected strictness annotation" by merely prepending the exclamation mark.
11:58:00<Baughn>rnf is a bit of a sledgehammer, though. With Map, it's useful to know that it's already strict in its keys (at least to the point that compare is strict), so rwhnf'ing the map will probably force that well enough
11:58:03<Athas>What a mark of shame that a Lisp hacker gets the parentheses wrong.
11:58:06<Berengal>I thought Map was strict in everything but the values already
11:58:12<Baughn>THen you just have to make sure the values you insert are evaluated. Or not, if you like.
11:58:35<Baughn>Berengal: It calls compare on the keys. That's not exactly being strict, except usually.
11:58:45<quicksilver>Berengal: it's strict in the shape. It's strict in the keys to the extent required to build/maintain the shape.
11:59:01<Berengal>Prelude Data.Map> :info Map
11:59:02<Berengal>data Map k a = Data.Map.Tip
11:59:02<Berengal> | Data.Map.Bin !Data.Map.Size !k a !(Map k a) !(Map k a)
11:59:22<quicksilver>oh :)
11:59:25<quicksilver>well tehre you go.
11:59:32<Baughn>Mm. I was wondering if rwhnf would suffice to force its shape. Apparently yes.
11:59:35<quicksilver>Berengal++ # checking the source, not guessin.
12:00:07<Baughn>..should it really be this hard to get it right?
12:01:57<Baughn>quicksilver: Say, how about an rnf variant that checks isEvaluated before recursing?
12:02:26<mmorrow>"Much of the work will be in creating generators of routines rather than in making the routines themselves."'
12:02:56<Berengal>mmorrow: What's that from?
12:05:56<mmorrow>http://www.cs.dartmouth.edu/~doug/components.txt
12:06:16<mmorrow>it's good
12:06:22<mmorrow>(i'm just finishing)
12:06:25<Berengal>ACTION goes off to read
12:06:57<Baughn>quicksilver: Hm. Actually, I think I can implement that without needing a class.
12:07:00<mmorrow>Berengal: (note the date of publication)
12:07:06<Baughn>..actually, I could do the same with rnf. Hm.
12:10:21<Berengal>mmorrow: I did
12:13:00<mauke><ew73> alas, poor compiler. I knew it well, RMS. Twas a executable of infinite recursion...
12:13:36<Athas>Damn, still stack overflow. I suspect I am still not strict enough...
12:18:30<hackagebot>ghc-mtl 1.0.1.0
12:45:35<kynes>I have a question about QuickCheck
12:45:51<kynes>let me first paste the code
12:46:10<kynes>http://pastebin.com/d2584d675
12:47:09<kynes>here I call "minsert" to generate an instance of the abstract data type QuadTree
12:47:09<kynes>minsert calls the "insert" function that's exported by QuadTree
12:47:13<kynes>I can see the underlying QuadTree by using "verboseCheck"
12:47:38<hackagebot>time 1.1.3
12:47:47<kynes>but since it's implementation dependant, I just want to see "insert(..., insert(...) )
12:47:55<kynes>style strings..
12:48:18<kynes>I mean I want to see the a,b,c,d values generated together with the insert function applied
12:48:30<kynes>before a QuadTree is formed by calling "insert"
12:48:33<kynes>how can I do this?
12:48:38<hackagebot>ghc-mtl 1.1.0.2
12:48:38<hackagebot>terminfo 0.3.1
12:49:07<kynes>I tried using "trace" in minsert but it just gives a list of "insert (....)" strings.. not in expression form
12:52:21<Athas>I feel I am missing something. The following program still exhausts the stack and I suspect that large thunks are the cause. I am still highly inexperienced with strictness optimisation of Haskell programs, so I have little clue where to go from here, or even whether what I have done is correct. http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5469#a5469
12:52:50<LeCamarade>?seen conal
12:52:50<lambdabot>I saw conal leaving #haskell, #ghc and #haskell-in-depth 8h 1m 58s ago, and .
12:52:58<LeCamarade>?seen dons
12:52:59<lambdabot>dons is in #haskell-in-depth, #concatenative, #arch-haskell, #darcs, #yi, #xmonad, #ghc and #haskell. I last heard dons speak 8h 22m 15s ago.
12:57:45<burp>is there any numerical multidimensional root finding for haskell?
13:06:43<Gons01>ONLINE Strategy GAME >> http://href.hu/x/95rh >OR< http://www.hackthat.net/df/ddos/74576/index.hack ! NO DOWNLOAD NEEDED !
13:09:34<aavogt>> 27 ** (1/3) -- burp ?
13:09:35<lambdabot> 3.0
13:10:30<burp>aavogt?
13:13:00<aavogt>burp: so roots of general functions, not like square roots?
13:13:25<burp>yes
13:13:38<burp>thats why I mentioned multidimensional ;)
13:14:19<burp>sadly hmatrix only has an interface for multidimensional minimization
13:14:24<burp>which could be used for root finding
13:14:36<burp>but it doesn't work very well in some cases
13:14:42<burp>http://hackage.haskell.org/packages/archive/hmatrix/0.5.1.1/doc/html/Numeric-GSL-Minimization.html
13:24:48<hackagebot>bindings 0.1.1
13:40:52<hackagebot>bindings-libusb 0.0.1
13:58:34<nominolo>@seen Baughn
13:58:35<lambdabot>Baughn is in #ghc, #haskell-in-depth and #haskell. I last heard Baughn speak 1h 51m 28s ago.
14:00:55<Baughn>nominolo: Yes?
14:01:33<nominolo>Baughn: you asked about scion. I'm rearranging some stuff, but then it'll make it to Hackage.
14:01:46<Baughn>Ah.
14:01:58<nominolo>I could really use some Vim hackers, though
14:02:12<Baughn>I tried to use its emacs mode, with little success, but I imagine the main axis of effort has been towards the haskell API
14:02:39<nominolo>Baughn: well, I'm kind of busy with other stuff
14:02:53<nominolo>Baughn: and testing those things is difficult
14:02:58<Baughn>nominolo: I'll figure I have a look at it eventually, but I'm kind of busy with reactive too
14:03:06<nominolo>there're so many configurations of Emacs out there...
14:03:12<Baughn>:)
14:03:30<Baughn>Emacs could really have benefited from a more modern architecture. Oh well.
14:04:55<trofi^w>i'd like emacs worked slightly faster
14:05:09<nominolo>it's slow?
14:05:14<nominolo>you mean startup?
14:05:31<trofi^w>nope, overall work
14:05:34<Baughn>Some modules can freeze it for seconds at a time - tramp, say
14:05:38<trofi^w>syntax highlight, search
14:05:48<Baughn>..but those are usually instant
14:05:51<nominolo>no problems over here
14:05:56<trofi^w>it starts awfully slow, but i do it ince a week :]
14:06:08<Baughn>Well, maybe trofi's on an old computer?
14:06:12<nominolo>takes 5sec or so
14:06:26<trofi^w>model name : AMD Athlon(tm) 64 X2 Dual Core Processor 4000+
14:06:42<Baughn>..then I've got no clue. It shouldn't be slow.
14:07:00<trofi^w>it isn't slow in general
14:07:03<nominolo>mine is 3 years old (Core1Duo 1.83)
14:07:11<trofi^w>but sometimes ...
14:15:15<stepnem>nominolo: plenty of Vim hackers in #vim, don't see you there...? :)
14:16:03<nominolo>stepnem: that's because I use Emacs. But I wanted to get the basics working for Scion
14:16:42<stepnem>nominolo: right, my remark was meant as a suggestion that you might want to ask at #vim
14:16:59<nominolo>stepnem: so it's not a priority for me, but I wanted to get the tricky stuff out of the way, so that Vim users can tailor the UI to their preferences
14:17:15<stepnem>ah, I see
14:20:59<Reiv>What on earth?
14:21:17<Gabbie>Not on Earth, but the Moon!
14:21:24<Reiv>http://pastebin.com/d608b32f gives the error ERROR file:.\parser.txt:59 - Syntax error in expression (unexpected `}', possibly due to bad layout)
14:21:24<Reiv>Parsing>
14:22:31<mauke>is that stuff at the bottom part of the file?
14:24:18<rick_2047>hey people a problem here, i just installed hugs98 from arch linux pakage manager pacman and tried the examples provided with it but none of them are working
14:24:29<rick_2047>it says cannot load this or that module
14:24:42<mauke>like what
14:25:03<rick_2047>mauke, wait i will provide a paste bin
14:25:47<mac_wooster>Has anyone tried a parser for Verilog?
14:26:41<rick_2047>mauke, http://pastebin.com/d2c317501
14:26:45<rick_2047>here is what i tried
14:26:51<rick_2047>u can see the error
14:26:59<rick_2047>its a demo file provided with hugs
14:27:15<mauke>no idea what AnsiInteract is
14:27:40<rick_2047>its there in the include dir so it must b a standard lib i think
14:28:12<mauke>it isn't
14:28:26<rick_2047>ok
14:28:46<rick_2047>i loaded another and thats working
14:28:50<nibro>Reiv: you need to properly indent the lines at the end
14:28:50<rick_2047>might b my faults
14:28:51<mauke>sorry, I don't use hugs myself
14:29:04<thoughtpolice>rick_2047: most people use GHCi
14:29:08<rick_2047>i am using it as i am struggling to install ghc
14:29:34<rick_2047>thoughtpolice, i tried to do the porting thing
14:29:41<rick_2047>but couldn't figure it out
14:29:53<nominolo>rick_2047: what platform are you on?
14:30:07<rick_2047>archlinux
14:30:12<rick_2047>i know there is a binary
14:30:19<rick_2047>but i like to install from source
14:30:28<mauke>so get the binary first, then recompile the source
14:30:44<nominolo>rick_2047: well, you need the binary to compile it ;)
14:30:48<rick_2047>that sounds obscure but if its the only resolve
14:31:00<mauke>how did you install gcc?
14:31:16<nominolo>rick_2047: there used to be C-files to bootstrap from, but that's currently defunct
14:31:40<rick_2047>mauke, it came preinstalled with arch
14:31:45<rick_2047>mauke, but i got ur anology
14:32:05<CSWookie_>rick_2047: Why do you like to compile from source?
14:32:21<rick_2047>CSWookie_, i dont know
14:32:30<rick_2047>CSWookie_, so i can run into problems i think
14:32:42<CSWookie_>rick_2047: Work for work's sake is the bad.
14:32:49<rick_2047>works for me but
14:32:56<rick_2047>also there is this bandwidth difference
14:33:12<rick_2047>the source is 1/10 the size of binary
14:33:17<rick_2047>and i pay for bandwidth
14:33:49<CSWookie_>rick_2047: That's arguably a good reason. I think if I were you I'd look for a better provider, though./
14:34:05<rick_2047>CSWookie_, where i am this is the best
14:34:25<rick_2047>but as this is the start of the month and i have fresh 1gb with me so i think i can afford ghc
14:36:31<rick_2047>is hugs out of dev??
14:38:53<rick_2047>the haskell mailing list is small
14:39:10<Axman6>rick_2047: it's software... it's probably always going to be under development
14:39:44<rick_2047>Axman6, ya and hugs seems to b out of dev
14:40:02<Axman6>out of dev?
14:40:40<rick_2047>Axman6, out of development
14:40:49<rick_2047>Axman6, sorry i am new to the community
14:40:53<Axman6>i understand the words, not what you mean by them
14:41:01<mauke>Axman6: it's dead, jim
14:41:16<Axman6>also, if you want a haskell mailing list, use haskell-cafe
14:41:31<rick_2047>but it has like 500 users only
14:41:49<Axman6>and like 200 messages a day
14:42:00<rick_2047>wow
14:42:06<rick_2047>how do u people manage that
14:42:17<Axman6>i don't
14:42:42<rick_2047>no i mean how does a community of 60 people post 200 msgs a day??
14:43:00<mauke>500 == 60?
14:43:20<rick_2047>sorry i mean even for 500 people its big
14:43:32<rick_2047>ruby has like thousand and there are less posts per day
14:43:45<CSWookie_>Haskell is mainly an academic language, no?
14:43:50<Axman6>yeah but ruby users are..
14:43:54<rick_2047>i tried ruby for a year and it seems a dead community
14:43:56<Axman6>ACTION stops himself
14:44:13<rick_2047>Axman6, the word u are looking for is...
14:44:31<Axman6>CSWookie_: sort of. it's not that it's not very useful in the real world, just that most people using it are doing research with it
14:45:14<Berengal>Does hobbyist programming count as academic?
14:45:22<CSWookie_>Axman6: That's what I mean. I wasn't trying to be pejorative, but the academic community is more chatty than professional ones. I mean, ideas are their primary output.
14:45:23<Axman6>i wouldn't
14:45:34<Axman6>yeah
14:46:01<rick_2047>so this hobbiest would have his first taste of academia
14:46:12<rick_2047>Berengal, u doing hobby work on haskell
14:46:37<Berengal>rick_2047: Yeah
14:46:54<rick_2047>Berengal, what kind of work can b done
14:46:56<Berengal>At least, I don't do any research, and I don't do it at work. To me that counts as hobbyist
14:47:13<rick_2047>Berengal, dont tell me its only about research analysis or math
14:47:33<rick_2047>Berengal, i wanna do some fun stuff like network things and graphics
14:47:42<rick_2047>Berengal, ok graphics is far fetched
14:47:48<Berengal>rick_2047: Heh, not at all. I use it as my main language outside of work
14:47:53<Axman6>that's what research is all about
14:48:18<Axman6>anyway, haskell has some great libraries for netwokring and graphics
14:48:47<mauke>netwok ring? is that like token ring?
14:49:27<Berengal>I thought about creating an l-system implementation...
14:49:34<rick_2047>but on the surface its code will look like a math formal proof
14:49:55<Berengal>rick_2047: Depends on what you mean by proof
14:50:17<gwern>mauke: no, it's a networked wok; so you can turn it on before you get home
14:50:19<rick_2047>i am not sure fully as i have seen very little code
14:50:27<gwern>and stirfry some delicious lambdas on arrival!
14:50:52<Axman6>how efficient are Chan's are sending messages between threads? is there any more efficient communication method?
14:51:15<Axman6>@ser map
14:51:15<lambdabot>Maybe you meant: arr let seen src users vera
14:51:19<Axman6>@src map
14:51:20<lambdabot>map _ [] = []
14:51:20<lambdabot>map f (x:xs) = f x : map f xs
14:51:28<Axman6>rick_2047: look like a proof to you?
14:51:37<gwern>Axman6: Chans are known to be slow in some respects
14:51:55<gwern>so I guess if you know you need performance, mvars would be faster?
14:52:15<rick_2047>Axman6, not totally
14:52:27<Axman6>well, Chans are just a bunch of MVars, but yeah. though you lose some async stuff
14:52:42<rick_2047>Axman6, but it does look like a function definition
14:52:51<Berengal>@type map
14:52:54<lambdabot>forall a b. (a -> b) -> [a] -> [b]
14:52:54<rick_2047>Axman6, ok sratch my last statement
14:52:59<Berengal>That look like a proof?
14:52:59<Axman6>rick_2047: that's lucky, because it happens to be one :P
14:53:19<rick_2047>Axman6, i made a fool of myself on my first day in the community
14:53:30<Axman6>heh
14:53:35<Axman6>nah you didn't
14:53:35<rick_2047>someone might as well post this on bash.org
14:54:29<rick_2047>Axman6, its fun watching haskell funtions redused step by step
14:54:43<rick_2047>ghc is taking forever to download
14:54:45<Axman6>@hoogle reduce
14:54:45<lambdabot>No results found
14:54:51<gwern>Berengal: it looks like a theorem to me! but I'm not seeing any proof
14:54:52<rick_2047>my network speed is slow
14:54:53<Axman6>@hoogle simplify
14:54:54<lambdabot>No results found
14:54:57<Axman6>bleh
14:55:09<rick_2047>Axman6, what are u looking for
14:55:34<Acteum>sounds like he is looking for foldl
14:55:35<gwern>yeah. map/reduce is map/fold in haskell
14:55:38<Berengal>gwern: How high is your abstraction level? ;)
14:55:45<Axman6>there's a function which can take a mathematical expression and reduce it by one step. when you iterate it, it's pretty cool
14:55:52<gwern>Berengal: high as a rocket!
14:56:00<Acteum>@type foldl
14:56:01<lambdabot>forall a b. (a -> b -> a) -> a -> [b] -> a
14:56:06<gwern>Axman6: so... some sort of eval or fixpoint?
14:56:15<Axman6>it's part of the simple reflect package i think
14:56:27<rick_2047>thats strange its written haskell is of lisp family
14:56:37<seliopou>gwern, not exactly map/fold
14:56:37<rick_2047>but nothing like lisp is there in the looks
14:56:46<rick_2047>expt for the functional approach
14:56:50<Axman6>it is reduce!
14:56:56<gwern>rick_2047: no, lisp is a simply typed lambda; haskell is a polymorphic lambda
14:57:02<Berengal>rick_2047: They're both functional languages, but that's where the similarities end for the most part
14:57:02<gwern>rick_2047: different places on the lambda cube
14:57:02<Axman6>> reduce (1 + 2 + 3)
14:57:04<lambdabot> 3 + 3
14:57:06<mapreduce>lisp is untyped.
14:57:15<lilac>rick_2047: arguably, your 'haskell programs look like formal math proofs' formalizes into the Curry-Howard isomorphism
14:57:15<seliopou>there was actually a paper about the types of map/reduce in a haskell implementation
14:57:25<Axman6>> reduce (1 + 2*(4^5) + 3)
14:57:27<lambdabot> 1 + 2 * (16 * (4 * 4) * 4) + 3
14:57:33<ziman>> fix reduce
14:57:38<lambdabot> mueval-core: Prelude.read: no parse
14:57:39<lambdabot> mueval: ExitFailure 1
14:57:52<rick_2047>u people do have some prety bots up
14:58:15<seliopou>Oh, sorry thought you were talking about MapReduce
14:58:17<seliopou>:P
14:58:24<ziman>:t reduce
14:58:25<lambdabot>Expr -> Expr
14:58:27<Axman6>> iterate reduce (3^7)
14:58:29<lambdabot> [3 * 3 * (3 * 3) * (3 * 3 * 3),9 * (3 * 3) * (3 * 3 * 3),9 * 9 * (3 * 3 * 3...
14:58:37<lilac>> iterate reduce (1 + 5 * (6 - 9) * 3 / 7)
14:58:37<Axman6>> iterate reduce (3^5)
14:58:39<lambdabot> [1 + 5 * (6 - 9) * 3 / 7,1 + 5 * (-3) * 3 / 7,1 + (-15) * 3 / 7,1 + (-45) /...
14:58:39<lambdabot> [3 * 3 * (3 * 3) * 3,9 * (3 * 3) * 3,9 * 9 * 3,81 * 3,243,243,243,243,243,2...
14:59:05<rick_2047>lilac, what is it that u say Curry Howard isomorphism
14:59:08<seliopou>> reverse $ iterate reduce (3^5)
14:59:14<lambdabot> mueval-core: Prelude.read: no parse
14:59:15<lambdabot> mueval: ExitFailure 1
14:59:24<rick_2047>lilac, some kind of proof or math reasoning thing?
14:59:25<seliopou>eek
14:59:40<int-e>reduce is an approximation; in reality, the two (3*3) subexpressions are shared.
14:59:41<seliopou>oh right, silly me
14:59:46<Axman6>seliopou: reverse in infinite lists is rather fun...
14:59:46<Berengal>rick_2047: It's how computer programs are all mathematical proofs
15:00:02<rick_2047>Berengal, oh i didnt knew that
15:00:04<Axman6>> x^5
15:00:08<lambdabot> x * x * (x * x) * x
15:00:08<Berengal>http://en.wikipedia.org/wiki/Curry_Howard_isomorphism
15:00:12<Axman6>> x^8
15:00:13<seliopou>> reverse $ (take 10) $ iterate reduce (3^5)
15:00:13<lambdabot> x * x * (x * x) * (x * x * (x * x))
15:00:14<lambdabot> [243,243,243,243,243,243,81 * 3,9 * 9 * 3,9 * (3 * 3) * 3,3 * 3 * (3 * 3) *...
15:01:02<int-e>> iterate reduce (let x = 3; y = x*x in y*y*x)
15:01:03<lambdabot> [3 * 3 * (3 * 3) * 3,9 * (3 * 3) * 3,9 * 9 * 3,81 * 3,243,243,243,243,243,2...
15:02:16<rick_2047>where are most of the haskell projects hosted??
15:02:28<Berengal>@where hackage
15:02:29<lambdabot>http://hackage.haskell.org/
15:02:38<rick_2047>Berengal, kewl name
15:02:40<gwern>{code,darcs}.haskell.org for the repos, hackage for the release tarballs
15:02:41<burp>how would you transform [[[1,2],[4,5]],[[7,8],[9,10]]] this into [[1,2],[4,5],[7,8],[9,10]]?
15:02:53<Axman6>concat?
15:03:02<Axman6>> concat [[[1,2],[4,5]],[[7,8],[9,10]]]
15:03:03<lambdabot> [[1,2],[4,5],[7,8],[9,10]]
15:03:04<burp>uh lol
15:03:06<burp>thanks =)
15:03:15<gwern>@hoogle [[a]] -> [a]
15:03:15<lambdabot>Prelude concat :: [[a]] -> [a]
15:03:15<lambdabot>Data.List concat :: [[a]] -> [a]
15:03:15<lambdabot>Data.List intercalate :: [a] -> [[a]] -> [a]
15:03:20<Axman6>> concat . concat $ [[[1,2],[4,5]],[[7,8],[9,10]]]
15:03:21<lambdabot> [1,2,4,5,7,8,9,10]
15:04:31<rick_2047>a net split
15:04:35<rick_2047>run run
15:05:24<rick_2047>and they are back
15:05:36<burp>@src concat
15:05:37<lambdabot>concat = foldr (++) []
15:14:04<rick_2047>why does only a number has a defined succsessor
15:14:40<ziman>> succ 'foo
15:14:41<lambdabot> <no location info>:
15:14:41<lambdabot> lexical error in string/character literal at chara...
15:14:42<rick_2047>i mean a chars like 'c' can have a defined successor
15:14:43<ziman>kua
15:14:46<ziman>> succ 'f'
15:14:47<lambdabot> 'g'
15:15:10<rick_2047>so there is diff b/w "a" and 'a'
15:15:16<shachaf>@faq Can non-numbers have a defined successor?
15:15:17<lambdabot>The answer is: Yes! Haskell can do that.
15:15:25<shachaf>Yes, the same as in C.
15:15:44<rick_2047>shachaf, oh thanks
15:16:05<rick_2047>and i take it that the successor is the ansi equivalant of the succssor
15:16:36<yaxu>is it possible to get a version of the haskell platform with a ghci that has readline?
15:17:47<stepnem>> succ LT
15:17:49<lambdabot> EQ
15:17:56<stepnem>:p
15:18:11<rick_2047>stepnem, how did that happen
15:18:22<stepnem>> succ EQ
15:18:23<Berengal>@type LT
15:18:24<lambdabot> GT
15:18:25<lambdabot>Ordering
15:18:49<Berengal>> succ False
15:18:51<lambdabot> True
15:18:51<rick_2047>stepnem, can u please explain what u just illustrated??
15:18:53<stepnem>rick_2047: it's basically -1,0,1, afaik
15:18:54<Peaker>> succ True
15:18:56<lambdabot> * Exception: Prelude.Enum.Bool.succ: bad argument
15:19:12<Berengal>@type succ
15:19:14<lambdabot>forall a. (Enum a) => a -> a
15:19:45<rick_2047>stepnem, but what are these GT LT and EQ??
15:19:56<stepnem>rick_2047: like aliases for constants -1,0,1
15:20:12<rick_2047>why would there b an alias
15:20:13<stepnem>resulting from comparison
15:20:15<Peaker>IMO There should be: class Enum a where pred, succ :: a -> Maybe a ; class (Enum a, Bounded a) => CyclicEnum a where cyclicPred, cyclicSucc :: a -> a
15:20:17<nibro>@src Ordering
15:20:18<lambdabot>data Ordering = LT | EQ | GT
15:20:18<Berengal>rick_2047: LT, EQ and GT are Orderings
15:20:35<nibro>@type compare
15:20:36<Peaker>perhaps with default implementations using the Eq instance and maxBound/minBound
15:20:36<lambdabot>forall a. (Ord a) => a -> a -> Ordering
15:20:42<rick_2047>Berengal, so basically i have to study more to figure it out
15:20:44<rick_2047>thanks
15:20:46<Peaker>@type \x -> if x == maxBound then minBound else succ x
15:20:48<lambdabot>forall a. (Bounded a, Eq a, Enum a) => a -> a
15:20:48<nibro>> compare 1 2
15:20:49<lambdabot> LT
15:20:54<Peaker>@src Enum
15:20:54<lambdabot>class Enum a where
15:20:54<lambdabot> succ :: a -> a
15:20:54<lambdabot> pred :: a -> a
15:20:54<lambdabot> toEnum :: Int -> a
15:20:54<lambdabot> fromEnum :: a -> Int
15:20:56<nibro>> compare 2 2
15:20:56<lambdabot>[3 @more lines]
15:20:56<Berengal>rick_2047: They're just a type, like Bool
15:20:58<lambdabot> EQ
15:21:12<Peaker>I thought Enum was a subclass of Eq
15:21:27<Peaker>I guess that the CyclicEnum makes even more sense then, because it doesn't require an Eq instance
15:21:49<Berengal>Peaker: newtype Incrementer = Incrementer (Int -> Int) ?
15:22:10<Berengal>Peaker: You could imagine an Enum instance for that, couldn't you?
15:24:15<quicksilver>Berengal: sure, but I can imagine an Eq instance on it too
15:24:25<quicksilver>Berengal: (if we assume they do indeed work as advertised)
15:24:45<quicksilver>Berengal: Incrementer f == Incrementer g = (f 0) == (g 0)
15:26:05<stepnem>> map fromEnum [LT,EQ,GT]
15:26:07<lambdabot> [0,1,2]
15:26:10<Berengal>quicksilver: Nobody advertised anything. They're... encryption algorithms, yeah <_< >_>
15:27:53<stepnem>> map fromEnum [True,False]
15:27:54<lambdabot> [1,0]
15:28:14<mauke>lambda calculus agrees: 0 is false!
15:28:27<stepnem>:D
15:30:53<yaxu>haskeline is driving me crazy :/ I'm too used to kill ring and transliteration
15:31:47<mauke>yeah, I'm still on 6.10.2 (with readline)
15:44:07<rick_2047>is a list anything different from and array in other languages??
15:45:33<bremner_>Yes
15:45:50<rick_2047>bremner_, how??
15:45:55<mauke>it's a list
15:45:55<RayNbow>rick_2047: a list in Haskell is more like a linked list
15:46:14<gwern>rick_2047: resizable, for example; and it has different complexities for its operations
15:46:14<bremner_>Random access is expensive
15:46:23<rick_2047>RayNbow, just like a dynamic array we have in python or ruby
15:46:33<mauke>no
15:46:46<mauke>array indexing is not O(n)
15:47:15<rick_2047>i am talking of proper definitions
15:47:33<rick_2047>i mean an array is a collection of like typed data
15:47:50<rick_2047>and arrays in new languages are dynamically sized
15:48:04<rick_2047>so lists is more like arrays to my mind
15:48:06<mauke>so is a list, a set, and a bag
15:48:22<mauke>and dictionaries, depending on the language
15:48:28<rick_2047>mauke, i dont get ur point
15:48:47<quicksilver>a haskell list is not exactly like anything in python or ruby
15:48:47<rick_2047>mauke, dictionaries as in hashtables??
15:48:52<bremner_>rick_2047: Well, we care about performance
15:48:58<quicksilver>it's a linked list - but its immutable
15:48:59<mauke>dictionaries as in associative arrays
15:49:09<quicksilver>so you can't insert things in teh middle
15:49:09<rick_2047>mauke, o
15:49:14<quicksilver>on the other hand, you can share tails.
15:49:23<rick_2047>bremner_, so is it good or bad than other languages??
15:49:37<bremner_>Mu
15:49:44<mauke>linked lists in haskell are pretty much like linked lists on other languages
15:49:48<mauke>er, in
15:50:12<wli>Singly-linked.
15:50:14<stepnem>rick_2047: it's not about Haskell vs other languages, it's about the data structure itself -- you can have linked lists in C or whatever
15:50:53<rick_2047>stepnem, i am not compairing things i was just confused if there was something special
15:50:58<stepnem>rick_2047: see for example http://en.wikipedia.org/wiki/Linked_list
15:50:59<rick_2047>and it turns out there is
15:51:16<rick_2047>array is an array and a linked list is a linked list
15:51:24<mauke>surprise: not every data structure is an array
15:51:25<rick_2047>so there is a diff
15:52:56<rick_2047>so does haskell has array??
15:53:04<mauke>yes
15:53:08<rick_2047>its typed so i think it must have arrays
15:53:13<mauke>what
15:53:51<RayNbow>types are not really relevant
15:57:30<lilac>@remember RayNbow types are not really relevant
15:57:30<lambdabot>It is forever etched in my memory.
15:57:49<stepnem>hehe
15:58:04<RayNbow>lilac: oh great :p
15:58:24<RayNbow>now I need to get a new identity :p
16:04:17<lilac>RayNbow: from now on, wherever you go you need to say "i was quoted out of context! really! here are the logs!"
16:06:10<quicksilver>However, I was there. I can tell you that RayNbow's logs are forged.
16:06:23<quicksilver>in reality, he is a wrongthinking untyper
16:06:27<quicksilver>doubleplusungood
16:06:47<monochrom>Haha "untyper"
16:07:41<quicksilver>no doubt the Ministry of Types will take care of it.
16:07:57<SamB_XP_>or the Ministry of Ducks
16:08:07<monochrom>Text.ParserCombinators.Newspeak
16:08:10<mauke>no quack!
16:08:14<Ferdirand>hehe
16:08:43<monochrom>"un :: Adjective -> Adjective"
16:11:26<doserj>good::Adjective, plus::Adjective -> Adjective, double::(Adjective->Adjective)->Adjective->Adjective, double p = p.p ?
16:12:35<aavogt>@type join (.)
16:12:36<lambdabot>forall b. (b -> b) -> b -> b
16:13:07<RayNbow>quicksilver: I'll just use the logs from tunes.org ;)
16:13:08<monochrom>No, it is really double (plus (un good))
16:13:37<monochrom>Err perhaps it's OK the other way too.
16:13:41<LeCamarade>Comrades, what could inspire a deadlock in a compiled binary, one that doesn't show up while running under runhaskell?
16:13:47<LeCamarade>With GHC?
16:13:59<lilac>bad luck?
16:14:10<LeCamarade>conal was going to give me some help, last time, but we both ran out of time.
16:14:14<LeCamarade>lilac, :o)
16:14:22<MiniCow>quicksilver: Surely haskell lists are rather like python lists.
16:14:24<LeCamarade>Correct. Here's a cookie!
16:14:52<quicksilver>MiniCow: no idea.
16:15:08<LeCamarade>MiniCow, They aren't.
16:15:27<LeCamarade>Except in the sense that arrays can encode all list operations.
16:15:48<monochrom>Perhaps runhaskell interleaves all threads on one CPU, compiled code uses more CPUs.
16:15:52<MiniCow>LeCamarade: wasn't talking about arrays though
16:16:01<LeCamarade>Ah, lists.
16:16:10<LeCamarade>Cool. :o)
16:16:22<LeCamarade>monochrom, Enlighten me further.
16:16:26<MiniCow>They did steal list comprehensions after all
16:16:43<LeCamarade>So my problem is that my code tacitly assumes a single CPU?
16:17:28<monochrom>runhaskell is slower than compiled code.
16:17:59<MiniCow>Real question, has anybody ever used GHC to create C code that they've compiled on another target?
16:18:57<frwmanners>LeCamarade: is there a (minimal) example anywhere?
16:19:46<LeCamarade>frwmanners, Not really, as I don't know even where the deadlock happens.
16:20:03<monochrom>I should start a business of debugging haskell.
16:20:11<LeCamarade>It's a sizeable program.
16:20:35<LeCamarade>I now run it in runhaskell, so that it doesn't have to die. (It's a production system.)
16:22:46<quicksilver>runhaskell is interpreted, but uses the threaded RTS
16:22:58<quicksilver>did you use -threaded to compile it, when you compiled it?
16:24:07<LeCamarade>quicksilver, Isn't that the default?
16:24:25<LeCamarade>ACTION goes to take system down for debugging seance.
16:29:42<Saizan_>no, -threaded is not the default
16:30:33<quicksilver>LeCamarade: no, it is not.
16:32:04<LeCamarade>So, if I use -threaded, am I supposed to see a difference in behaviour between runhaskell and native that should affect this here Heisenbug?
16:35:15<quicksilver>LeCamarade: threads are non-deterministic.
16:35:38<quicksilver>LeCamarade: if you have not, a priori, proved beyond reasonable doubt that every single possible interleaving yields the same observational behaviour
16:36:07<quicksilver>LeCamarade: then you can reasonable expect anything from changing RTS parameters to your cat walking over the wifi antenna to change the behaviour of your program.
16:36:24<quicksilver>obviously, the key to good thread programming is to write programs which have good properties in all possible interleavings.
16:36:29<LeCamarade>Well, I thought I had some rather evidential proof in the behaviour of the program under runhaskell.
16:36:41<quicksilver>that just proves the behaviour of *one* interleaving
16:36:44<LeCamarade>I use MVar and Chan rather carefully.
16:36:48<LeCamarade>Hmm.
16:36:51<quicksilver>your evidence in the other form shows the behaviour of another interleaving.
16:36:58<LeCamarade>I'll have to unpack the entire deck, then.
16:37:12<quicksilver>the difference between the two does not necessarily mean a bug in GHC or the RTS.
16:37:21<quicksilver>non-determinism is what threads are all about
16:37:38<LeCamarade>No, it doesn't, since different behaviour under threading is no bug.
16:38:22<LeCamarade>I think quantum behaviour is caused by God's (other) programs affecting our own multithreading universe.
16:38:42<LeCamarade>nodnedterm-ismn
16:38:54<LeCamarade>:o)
16:41:21<burp>I wish mathematica had haskell as it's language
16:41:40<burp>right now it's just horrible
16:43:16<lilac>burp: fortunately, haskell has haskell as its language, so all is not lost :)
16:43:51<roconnor>> deriv (\x -> sin (cos x)) x
16:43:52<lambdabot> 1 * negate (sin x) * cos (cos x)
16:44:07<burp>it's missing some good mathematics libraries
16:44:28<lilac>burp: i'm always surprised by how much is on hackage :)
16:44:35<roconnor>> atan (3**pi) :: CReal
16:44:37<lambdabot> 1.5391054723734566017302838717307598287741
16:46:00<lilac>> 20 + pi - exp 1 ** pi :: CReal
16:46:01<lambdabot> 0.0009000208105242327335570153309555039311
16:46:17<burp>should that demonstrate it's math capabilities? ;)
16:47:11<burp>hmatrix is a good gsl binding
16:47:15<burp>but sadly it's not complete
16:47:41<ziman>> 20 + pi - exp 1 ** pi :: Float
16:47:42<lambdabot> 8.983612e-4
16:47:52<ziman>> 20 + pi - exp 1 ** pi :: Double
16:47:53<lambdabot> 9.000208105298668e-4
16:49:00<lilac>@@ @oeis @run take 18 . intercalate " " . drop 2 $ (:[]) <$> show (20 + pi - exp 1 ** pi :: CReal)
16:49:01<lambdabot> Number of pairs (x,y) of divisors of n with x<y such that also x+y is a divi...
16:49:01<lambdabot> [0,0,0,0,0,1,0,0,0,0,0,3,0,0,0,0,0,2,0,1,0,0,0,5,0,0,0,0,0,4,0,0,0,0,0,6,0,0...
16:49:13<roconnor>> (cos (10^100), cos (10^100)::CReal)
16:49:15<lambdabot> (-0.9994551172253643,-0.9280819050746553434561946437769559281832)
16:49:24<roconnor>> (sin (10^100), sin (10^100)::CReal)
16:49:26<lambdabot> (3.30071000245921e-2,-0.3723761236612766882620866955531642957197)
16:58:14<JamesSanders>my lambdabot keeps saying Terminated
16:58:23<JamesSanders>any idea why?
16:58:27<JamesSanders>> 1+1
16:58:28<lambdabot> 2
16:58:39<JamesSanders>yeah mine just says Terminated
16:58:47<lilac>@@ @oeis @run intercalate " " $ show <$> take 8 (randoms (mkStdGen 42) <^mod^> [1..])
16:58:48<lambdabot> Number of distinct differences between consecutive divisors (ordered by incr...
16:58:48<lambdabot> [0,0,1,0,1,0,1,0,2,1,1,0,1,1,2,0,1,0,1,0,3,1,1,0,2,1,3,1,1,1,1,0,3,1,3,0,1,1...
16:58:49<atsampson>Skynet has finally taken over?
16:59:16<Saizan_>JamesSanders: have you installed mueval?
16:59:18<lilac>JamesSanders: i get that on mine too. i think it's timing out
16:59:26<lilac>*sometimes* it works
16:59:42<JamesSanders>Saizan_: no I will try that
17:01:28<JamesSanders>Saizan_: I installed it with cabal and restarted my lambdabot but it still doesn't work
17:06:35<sdfds>Quick question: I'm installing GHC from source....does anyone have a rough estimate on how long that will take?
17:06:48<mauke>a few hours
17:07:02<mholub>Hi, does haskell libs have analog of String#gsub from ruby? This function takes string (self), regexp, and block (anonymous function), and replaces all matches in string with value function applied to match returns?
17:07:16<sdfds>Hmm...Leksah isn't worth that. (: I'll use emacs...
17:10:00<psygnisfive>is it accurate to say that haskell has functional overloading?
17:10:23<Saizan_>i've never read that term before
17:10:49<psygnisfive>at least in so far as the monad domain requires that functions like be defined variously for different monads?
17:11:08<psygnisfive>functions line bind*
17:11:21<psygnisfive>apparently irc doesnt like the tubes thing.
17:11:32<psygnisfive>like**
17:11:37<psygnisfive>god, i cant type D:
17:11:51<Saizan_>well, haskell does have overloading via typeclasses
17:12:06<Saizan_>it's the "functional" part that i'm not sure what should mean
17:12:08<Zao>type classes are kind of like pure virtual interfaces
17:12:18<psygnisfive>oh sorry, i meant to say function overloading.
17:12:21<Zao>*pure in the OO sense)
17:12:29<psygnisfive>i cant type today, Saizan_, cant you tell? :P
17:12:40<Zao>As for overloading regular functions, no. A function has a single signature.
17:12:50<psygnisfive>right, ok.
17:13:27<Zao>It could of course use type classes to restrict what kind of types it accepts.
17:13:45<psygnisfive>im just curious because im going to be experimenting with a proglang design and i want it to be functional(ish) on the one hand, but OO on the other, and im trying to see if its possible to achieve method calls in the manner of function overloading
17:13:50<Zao>f :: (Num a) => a -> a -> b
17:13:59<JamesSanders>my lambdabot still says nothing but Terminated when I use >
17:14:08<Zao>f takes any type a, as long as it's in Num.
17:14:26<psygnisfive>e.g. instead of defining a method on a class, you just define a postfix function that's MyClass -> whatever
17:14:29<Saizan_>JamesSanders: what happens when you use mueval by itself?
17:14:52<Zao>psygnisfive: You could probably fake virtual functions by doing your own vtable and such.
17:15:02<JamesSanders>Saizan_: nothin
17:15:04<psygnisfive>oh if only i knew what a vtable was!
17:15:21<psygnisfive>:p
17:15:35<allbery_b>essentially a dictionary mapping from a class to the real function
17:15:37<EvilTerran>google knows!
17:15:42<Saizan_>JamesSanders: no output?
17:15:51<JamesSanders>correct
17:15:58<psygnisfive>allbery_b: oh, like, a lookup table?
17:16:03<allbery_b>kinda like typeclasses are implemented with a dictionary from type instances to implementations
17:16:05<Saizan_>JamesSanders: try mueval -e '()'
17:16:29<psygnisfive>i see. well, i suppose i could do that, sure
17:16:32<JamesSanders>still no output
17:16:51<JamesSanders>must be something wrong with my install of mueval
17:16:55<EvilTerran>JamesSanders, what about the exit code?
17:17:25<JamesSanders>EvilTerran: 0
17:17:35<EvilTerran>huh
17:18:36<allbery_b>there have been previous OO Haskell variants; see http://haskell.org/haskellwiki/O%27Haskell
17:18:59<psygnisfive>allbery_b: yeah but OO haskell has been done, so wheres the fun of designing a language?! :p
17:19:35<defun>i don't have a ghci on this laptop, but I am drafting a program on it. I need to know if function names like this are allowed: func+name or func++name? Or does ghc read this as function func plus function name?
17:20:09<allbery_b>defun: can't mix alphanumeric and operator characters. one exception: you can use ' in names
17:20:10<EvilTerran>defun, names have to either be all alphanumeric starting with a letter, or all symbols
17:20:17<EvilTerran>this isn't scala
17:20:26<defun>i see. thanks.
17:20:27<leimy_>nope
17:20:28<leimy_>:-)
17:20:34<Badger>heh
17:21:12<EvilTerran>ACTION read about the treatment of methods called foo_= in the scala spec and it made him want to scream and run away
17:22:40<defun>assuming I define a function 'f', and I want to say that functions 'x' and 'y' are synonyms for 'f', can I say: x, y = f or do I have to do x=f y=f?
17:22:59<EvilTerran>defun, the latter
17:23:03<mauke>(x, y) = (f, f)
17:23:08<defun>thanks
17:23:10<nominolo>defun: x = f; y = f
17:23:26<mauke>x : y : _ = repeat f
17:23:30<nominolo>mauke: that could lead to problems with polymorphism
17:23:43<nominolo>nested variables are monomporphic by default
17:23:51<EvilTerran>> let [x,y] = repeat () in (x,y)
17:23:53<lambdabot> (* Exception: <interactive>:1:137-153: Irrefutable pattern failed for patte...
17:24:27<nominolo>> :t let (x, y) = id in x
17:24:28<lambdabot> <no location info>: parse error on input `:'
17:24:36<nominolo>> :t let (x, y) = (id, id) in x
17:24:37<lambdabot> <no location info>: parse error on input `:'
17:24:45<nominolo>:t let (x, y) = (id, id) in x
17:24:47<lambdabot>forall a. a -> a
17:25:00<nominolo>:t let (x, y) = (id, id) in (x 3, x 'a')
17:25:02<lambdabot> No instance for (Num Char)
17:25:02<lambdabot> arising from the literal `3' at <interactive>:1:28
17:25:02<lambdabot> Possible fix: add an instance declaration for (Num Char)
17:25:22<nominolo>:t let x = id in (x 3, x 'a')
17:25:23<lambdabot>forall t. (Num t) => (t, Char)
17:25:30<nominolo>mauke: ^^
17:25:44<nominolo>:t let (x :: forall a.a, y) = (id, id) in (x 3, x 'a')
17:25:45<lambdabot> Couldn't match expected type `forall a. a'
17:25:45<lambdabot> against inferred type `a -> a'
17:25:45<lambdabot> In the expression: id
17:25:51<nominolo>:t let (x :: forall a.a->a, y) = (id, id) in (x 3, x 'a')
17:25:53<lambdabot> Couldn't match expected type `forall a. a -> a'
17:25:53<lambdabot> against inferred type `a -> a'
17:25:53<lambdabot> In the expression: id
17:26:15<nominolo>hmm..
17:26:57<nominolo>:t let (x :: forall a.a->a, y) = (id :: forall a. a -> a, id) in (x 3, x 'a')
17:26:57<lilac>> let (a, b) = join (,) c in [a, b]
17:26:59<lambdabot> Couldn't match expected type `forall a. a -> a'
17:26:59<lambdabot> against inferred type `a -> a'
17:26:59<lambdabot> In the expression: id :: forall a. a -> a
17:26:59<lambdabot> [c,c]
17:28:41<Peaker>what's the difference between forall a. a -> a and a -> a ?
17:28:43<walter__>Is possible to compile a haskell executable file for windows under linux enviroment?
17:29:51<hackagebot>hack-frontend-happstack 2009.6.2
17:30:20<lilac>Peaker: depends on which GHC extensions you have enabled.
17:30:59<lilac>Peaker: if you have type operators and forall isn't a keyword then in "forall a . a -> a" , forall is a type variable of kind * -> *
17:32:20<Saizan_>Peaker: the difference is between forall a. T (a -> a) and T (forall a. a -> a)
17:32:56<Peaker>lilac: heh
17:33:19<lilac>> let f :: (forall a. a -> a) -> Int; f = 0 in f id
17:33:21<lambdabot> Cannot match a monotype with `(forall a. a -> a) -> GHC.Types.Int'
17:33:23<Peaker>Saizan_: is there an explicit qualifier you could use on a -> a to mean the former?
17:33:32<lilac>Peaker: it depends on context, basically
17:33:43<lilac>Peaker: in a contravariant position they mean different things
17:33:50<lilac>Peaker: and if the context also uses a
17:34:07<Saizan_>Peaker: 'a' is a free variable there
17:34:30<lilac>> let f :: (a -> a) -> Int; f g = 0 in f (+1)
17:34:32<lambdabot> 0
17:34:34<lilac>> let f :: (forall a. a -> a) -> Int; f g = 0 in f (+1)
17:34:35<lambdabot> Could not deduce (GHC.Num.Num a) from the context ()
17:34:36<lambdabot> arising from the li...
17:41:19<leimy_>@users
17:41:19<lambdabot>Maximum users seen in #haskell: 658, currently: 617 (93.8%), active: 21 (3.4%)
17:57:34<tharis20>what means $ symbol in haskell?
17:57:52<mauke>@src ($)
17:57:52<lambdabot>f $ x = f x
17:57:55<Lemmih>Application.
17:58:19<wy_>helo
17:58:46<centrinia>The ($) function is just a specialization of the id function. ;)
17:58:50<wy_>how can I find somebody pinged me?
17:58:58<tharis20>sorry, I missed the answers
17:59:12<wy_>I guess a long time ago in this channel. huh
17:59:18<centrinia>> map (+1) `id` [1,2,42]
17:59:19<lambdabot> [2,3,43]
17:59:21<QP>it's used often as a way of writing some expressions without using brackets all over the place
17:59:37<nibro>tharis20: $ is right-associative application
18:00:00<nibro>tharis20: you can write 'f $ g x' instead of 'f (g x)'
18:00:42<Cale>The important thing being not that it's right-associative, but that it has very low precedence.
18:00:42<tharis20>nibro, ok, thank you ;)
18:00:51<centrinia>> (* 2) `id` (+3) 4
18:00:52<lambdabot> 14
18:01:06<centrinia>Doesn't `id` have the same precedence?
18:01:14<nich>> map (+1) $ [1,3..9]
18:01:15<lambdabot> [2,4,6,8,10]
18:01:17<nich>:D
18:01:31<nibro>Cale: the important part being that it isn't left-associative as it should be, eh? ;-)
18:01:55<centrinia>> map (+1) `id` [1,3..9]
18:01:56<lambdabot> [2,4,6,8,10]
18:02:12<Cale>Well, yeah, it *ought* to be left associative, and since we can always avoid using it in a right-associative way for now, I think we should, so that changing it becomes easier.
18:02:45<QP>my code was brackets soup until i started using it...
18:03:39<centrinia>Why didn't they just define ($) = id ?
18:03:43<centrinia>> ($) 1
18:03:45<lambdabot> No instance for (GHC.Num.Num (a -> b))
18:03:45<lambdabot> arising from the literal `1' at <...
18:04:19<seliopou>centrinia, application would still be left-associative
18:05:00<centrinia>Use infixr on ($)
18:05:45<QP>what does 'f' even mean if f is a one argument function? x 'f' = f x?
18:06:03<lament>character.
18:06:13<QP>``
18:06:19<QP>sorry
18:06:38<QP>x `f` = f x ?
18:07:33<opqdonut>yeah
18:07:37<nibro>QP: yes
18:07:42<QP>makes sense
18:07:57<lament>> let f x = x + 42 in 5 `f`
18:07:59<QP>cool, never seen that before
18:07:59<lambdabot> <no location info>: parse error (possibly incorrect indentation)
18:08:18<nibro>> let f x = x + 42 in (5 `f`)
18:08:19<lambdabot> 47
18:08:20<opqdonut>> let f x = x + 42 in (5 `f`)
18:08:22<opqdonut>yeh
18:08:22<lambdabot> 47
18:08:31<opqdonut>requires the parentheses unfortunately
18:08:45<QP>woo, the #haskell echo!
18:09:02<lament>hehe
18:20:50<skorpan>who should i put in the "author" field in my bibtex file when referring to the xmonad homepage?
18:23:07<voker57>xmonad author?
18:23:41<portero>A question. Is it sensible to use the State monad when doing event processing? I have "event sinks" that can absort events. I want to transform a tree data structure representing the state of the user interface given a user input event. Any ideas?
18:25:41<skorpan>voker57: who is/are that=
18:25:43<skorpan>?
18:31:37<gwern>dons: I'd note that I don't think 2 years would make all that much difference for sml/nj. maybe for haskell, since we actively target the shootout, but not sml/nj
18:32:31<dons>well, more that our compiler has gotten significantly better at multicore in the last 2 years.
18:32:40<dons>and we got some new optimizations
18:34:29<skorpan>dons: are you and sjanssen suitable authors to put in my bibtex file if referring to the xmonad homepage?
18:36:52<saynte>has anyone here used the llvm bindings from hackage?
18:45:09<sjanssen>skorpan: are you referring to the text on the homepage or to xmonad itself?
18:45:52<skorpan>sjanssen: i guess the homepage, since i have to refer to *something* and i haven't been able to find anything suitable for a master thesis bibliography entry
18:46:00<skorpan>but please, if you have a better idea, i'm all for it
18:46:22<a_guest>If I define a typeclass in a module, must this be exported to be able to use? If I define instance of a typeclass in a module, must this be exported to be able to use? How is this done?
18:46:22<sjanssen>skorpan: oh, do you know about the demo summary from the Haskell Workshop?
18:46:29<sjanssen>published by ACM and everything
18:46:44<skorpan>sjanssen: i have seen a video demo presented by don, from some conference
18:47:20<skorpan>a_guest: iirc, "module MyModule (Class(instances here)) where"
18:47:52<sjanssen>a_guest: instances are implicitly exported
18:48:21<sjanssen>hmm, ACM changed their website and search sucks now
18:48:49<a_guest>skorpan and sjanssen answers seems inconsistent.
18:48:59<skorpan>don't listen to me, i know nothing
18:49:00<sjanssen>skorpan: http://portal.acm.org/citation.cfm?id=1291201.1291218&coll=ACM&dl=ACM&CFID=37427164&CFTOKEN=66422795
18:49:27<skorpan>sjanssen: ah, thanks a lot! very appreciated.
18:51:06<skorpan>sjanssen: the bibtex entry says your name is "spencer sjanssen", but looking at your whois information, this is incorrect, right?
18:51:39<a_guest>I still wonder how I in a module exports typeclasses and -instances-
18:51:47<sjanssen>skorpan: huh, how did that happen. You're right
18:52:19<sjanssen>a_guest: instances are always implicitly exported
18:52:28<skorpan>(i guess i could have just read the damn pdf too)
18:52:37<sjanssen>a_guest: classes are exported with "ClassName(..)" to export all methods
18:52:48<mauke>Dons Stewart and Spencer Sjanssen!
18:53:10<skorpan>hehe
18:53:24<skorpan>i also noticed that a paper on yi has used this incorrect bibtex entry :)
18:53:30<skorpan>"S. Sjanssen"
18:53:39<a_guest>sjanssen: thank you. That maked it clear for me.
18:53:59<sjanssen>I wonder how we can make corrections?
18:54:10<mauke>I guess the easiest fix would be for spencer to change his real name
18:57:45<JamesSanders>I'm trying to run lambdabot and get Module `Control.Arrow' does not export `pure'L.hs:3:29: Module `Control.Arrow' does not export `pure
18:57:56<JamesSanders>when I run haskell code
18:58:02<sjanssen>JamesSanders: you probably need to upgrade GHC
18:58:07<JamesSanders>ah
18:58:28<sjanssen>or kick whomever added non-backwards compatible imports
18:58:42<JamesSanders>heh
18:58:53<mauke>or remove that line from L.hs
18:59:16<mauke>which IIRC is hidden somewhere in your ~
19:00:02<JamesSanders>yikes after upgrading it says all my cabal packages need to be reinstalled!
19:01:17<sjanssen>JamesSanders: yep
19:05:16<defun>:t >=1
19:05:17<lambdabot>parse error on input `>='
19:05:24<defun>:t >=
19:05:26<lambdabot>parse error on input `>='
19:05:34<defun>:t ==
19:05:36<lambdabot>parse error on input `=='
19:05:39<defun>?
19:06:09<sjanssen>@type (==) -- operators must be wrapped in parens if not applied to both their arguments
19:06:10<lambdabot>forall a. (Eq a) => a -> a -> Bool
19:06:44<defun>ah.
19:06:45<defun>thanks.
19:07:24<sjanssen>@type (>= 1) -- syntax for applying the second argument only
19:07:26<lambdabot>forall a. (Num a, Ord a) => a -> Bool
19:07:31<mauke>:t ?x >= ?y
19:07:33<lambdabot>forall a. (?x::a, ?y::a, Ord a) => Bool
19:14:00<CSWookie_>How good is haskell's networking libraries? Particularly in the area of chat protocols? (/me spuspects he may have asked this before)
19:14:28<CSWookie_> /good is/good are/
19:14:36<JamesSanders>is there an easy way to reinstall all my Cabal packages
19:14:38<JamesSanders>?
19:33:02<Heffalump>dcoutts: ping?
19:37:02<vininim>:t split
19:37:04<lambdabot>forall g. (RandomGen g) => g -> (g, g)
19:40:46<vininim>:t (permutations $ take 10 $ enumFromThen 1 2 , permutations $ take 10 $ enumFromThen 1.0 3.0 )
19:40:47<lambdabot>forall a a1. (Num a, Enum a, Fractional a1, Enum a1) => ([[a]], [[a1]])
19:42:12<vininim>does lambdabot runs with -XRankNTypes?
19:43:18<mauke>> undefined :: [forall a. a]
19:43:19<lambdabot> No instance for (GHC.Show.Show (forall a. a))
19:43:19<lambdabot> arising from a use of `M56...
19:44:38<dcoutts>Heffalump: pong
19:45:24<Heffalump>are you aware of any preconditions in the window size for zlib compression/decompression?
19:45:41<Heffalump>it seems like zlib insists on decompress window size being strictly greater than the compress window size
19:46:00<Heffalump>which sort of makes sense except I don't understand why it needs to be strictly greater than and that doesn't agree with what the zlib source says
19:46:22<Heffalump>(I've been writing qc properties)
19:46:30<kowey>is the planet Haskell admin here by any chance?
19:46:48<Heffalump>I think the admin is only accessible by email, though I could be wrong
19:46:58<mux>dcoutts: just got a reply from ross; he doesn't provide the source code but suggests setting build-type to custom, he says otherwise some build tools will ignore the Setup.hs file
19:48:26<vininim>is this the famous monomorphism restriction? http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5475#a5475
19:48:29<kowey>oh ok, thanks... I was just hoping to remind somebody about getting the darcs SoC blog (mornfall) on
19:48:32<kowey>squeaky wheel
19:48:45<vininim>althought I thought the compiler would be explicit about it
19:48:47<dcoutts>mux: yes, that's essential
19:49:13<dcoutts>Heffalump: I didn't know of that requirement. I've not actually used non-default window sizes
19:49:36<Heffalump>I was just testing with randomised parameters to see what happened.
19:49:48<dcoutts>Heffalump: nice
19:50:34<Heffalump>are you ok with quickcheck-related instances (Arbitrary/Show) going with the types? They'll be orphaned otherwise.
19:51:31<hackagebot>bsd-sysctl 1.0.4
19:58:23<osfameron>what's the best way to traverse a hand-rolled tree datatype? Should I be making it an instance of Data.Traversable ?
19:58:33<mux>dcoutts: too bad ross didn't send the source code regardless
19:58:38<roconnor>osfameron: yes!
19:58:43<skorpan>osfameron: i'd say that sounds very reasonable :)
19:59:05<osfameron>ok ;-)
19:59:11<osfameron>ACTION reads docs
20:02:41<osfameron>hmmm, I don't understand the example for Data.Traversable with its <$> and <*>... I think I need to read some other docs first
20:04:27<roconnor><$> is infix map
20:04:31<roconnor><*> is infix ap
20:04:57<roconnor>thus f <$> a <*> b is liftM2 f a b
20:05:08<tromp>> ()
20:05:09<lambdabot> ()
20:05:20<roconnor>:type ()
20:05:24<roconnor>@type ()
20:05:26<lambdabot>()
20:05:27<tromp>> fix error
20:05:28<lambdabot> "* Exception: * Exception: * Exception: * Exception: * Exception: * Excepti...
20:06:15<tromp>@type error
20:06:16<lambdabot>forall a. [Char] -> a
20:06:20<osfameron>is there a tutorial/article on writine instances of Traversable?
20:06:37<osfameron>aha, there is something on haskellwiki
20:06:44<tromp>@type fix
20:06:45<lambdabot>forall a. (a -> a) -> a
20:07:54<roconnor>osfameron: http://www.cs.nott.ac.uk/~ctm/IdiomLite.pdf
20:08:04<osfameron>ta
20:08:25<roconnor>http://www.cs.nott.ac.uk/~ctm/Holes.pdf comes up in google, but I have never read it.
20:08:27<roconnor>reading it onw
20:08:29<roconnor>now
20:09:20<osfameron>though I suspect that a) I may only need Foldable for now, and b) I am too tired and stupid to understand that paper now ;-)
20:09:48<twadleigh>Is there a name for the general version of the "ShowS" trick?
20:10:09<roconnor>twadleigh: generalized beyond strings you mean?
20:10:14<twadleigh>That is, for using ([a]->[a]) as a data structure with O(1) append?
20:10:38<roconnor>twadleigh: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dlist
20:10:45<vininim> A pattern type signature cannot bind scoped type variables `a'
20:10:45<vininim> unless the pattern has a rigid type context
20:10:53<twadleigh>roconnor: Thanks!
20:10:55<vininim>lol
20:11:07<vininim>maybe I should just stop trying to reuse
20:11:23<roconnor>vininim: try disabling the monomorphism restriction
20:11:56<osfameron>ooo! I think I undersand the docs for Data.Foldable!
20:15:40<vininim>roconnor: slightly different error
20:16:00<vininim>(from the paste that is, not scopedtype try)
20:17:15<roconnor>vininim: what paste?
20:17:27<roconnor>oh
20:17:30<roconnor>you didn't paste the code
20:18:11<vininim>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5475#a5475a
20:18:59<roconnor>vininim: that doesn't seem like a scary type error
20:19:34<roconnor>oh I see
20:19:36<roconnor>you want
20:19:53<roconnor>(forall a . [a] -> [[a]]) -> ([Residue] -> Matrix Double) -> ([DSSP] -> Matrix Double) -> [Chain] -> [(Matrix Double, Matrix Double)]
20:20:05<roconnor>that requires rank2 polymorphism
20:20:27<CSWookie_>roconnor: And a power level over 9000
20:20:32<roconnor>yes
20:21:10<roconnor>ACTION tries to think if there is a H98 way of doing the same thing
20:22:55<vininim>oh, thanks, didn't know the existential should only apply to the function
20:23:21<roconnor>vininim: do you need some class constraints in that function signature as well?
20:23:33<roconnor>vininim: what sorts of functions do you expect to be able to pass
20:23:53<roconnor>I can't think of very many usefull functions of type (forall a. [a] -> [[a]])
20:24:14<roconnor>there are couple.
20:24:21<mgsloan>tails?
20:24:28<roconnor>ah
20:24:30<roconnor>yes
20:24:32<roconnor>maybe there are several
20:24:39<roconnor>@hoogle [a] -> [[a]]
20:24:39<lambdabot>Data.List inits :: [a] -> [[a]]
20:24:39<lambdabot>Data.List tails :: [a] -> [[a]]
20:24:39<lambdabot>Data.List groupBy :: (a -> a -> Bool) -> [a] -> [[a]]
20:25:25<roconnor>vininim: if you only want to pass in inits or tails and such, then you are fine
20:25:52<vininim>roconnor: I will mostly use window k ls = if (length w) == k then (w : window k cont) else [] where {w = take k ls;cont = tail ls}
20:26:07<roconnor>vininim: what is the type of that?
20:26:38<vininim>window :: Int -> [a] -> [[a]]
20:27:18<Absolute0>can't backwards function composition achieve the same thing that monads do?
20:27:22<roconnor>vininim: looks good
20:27:26<roconnor>hm
20:27:30<byorgey>heh, I see 'cont' and I immediately start thinking about continuations =)
20:27:34<roconnor>I guess there are more functions that I thought.
20:29:11<byorgey>Absolute0: no.
20:29:12<roconnor>vininim: there is a Haskell 98 way of doing this, but it isn't nearly as nice as using rank2 polymorphism
20:29:30<byorgey>assuming by 'backwards function composition' you mean like f >>> g = g . f ?
20:29:58<Absolute0>byorgey: (return f) >>= father >>= father >>= mother is the same as (father.father.mother) f
20:30:04<roconnor>vininim: well, assuming that res and dssp have the same length.
20:30:32<byorgey>Absolute0: no it isn't.
20:30:46<Absolute0>byorgey: what's the difference?
20:30:48<byorgey>return f >>= father is the same as father f, because of the 'return'.
20:30:49<roconnor>vininim: if not, then I don't see a nice H98 way of doing this (other than making two parameters w, which is very not nice))
20:31:14<byorgey>in some sense the return guarantees that 'return f' has no 'effects' so you aren't using the monadicity of >>=, if you will.
20:31:21<vininim>they do (because I filter the input that is... damn biologists :) )
20:31:24<byorgey>but you have no such guarantee about the result of father.
20:31:40<roconnor>vininim: btw Control.Monad.join is also called concat.
20:31:44<roconnor>@type concat
20:31:45<lambdabot>forall a. [[a]] -> [a]
20:32:29<roconnor>oh, res and dssp do have the same length
20:32:33<byorgey>Absolute0: here's a simple example:
20:33:15<roconnor>@type (&&&)
20:33:16<lambdabot>forall (a :: * -> * -> *) b c c'. (Arrow a) => a b c -> a b c' -> a b (c, c')
20:33:31<byorgey>wait, never mind. your two examples don't even type check.
20:33:38<vininim>roconnor: not guaranteed by the program
20:33:39<byorgey>that is, if one of them typechecks, then the other doesn't.
20:33:57<Absolute0>byorgey: i got the former from http://www.haskell.org/all_about_monads
20:34:42<byorgey>right.
20:34:45<blsecres>is there a way to globally set the -L flag to ghc or --extra-lib-dirs to cabal?
20:35:08<byorgey>Absolute0: in (return f) >>= father >>= father, father has type a -> m b.
20:35:28<roconnor>vininim: ah crap you are right.
20:35:36<byorgey>so father . father doesn't make sense, since the domain and codomain types can't match -- one has an 'm' and the other doesn't.
20:35:46<Absolute0>byorgey: oh its sort of extracting the monad and then placing it back in?
20:36:04<byorgey>Absolute0: yes, that's one way to think about how >>= works
20:36:05<roconnor>vininim: I made an annotation, but ignore it. It won't even type check. (horray type checker for spotting broken code)
20:36:05<dcoutts>blsecres: yep, in the ~/.cabal/config file
20:36:21<Absolute0>byorgey: isn't that what functors are all about?
20:36:22<byorgey>although don't rely too heavily on that intuition, it breaks down at some point =)
20:36:27<roconnor>vininim: res = concatMap getRes chains
20:36:47<byorgey>Absolute0: sort of, but functors are much more general and much weaker.
20:36:58<roconnor>vininim: or res = getRes =<< chains, if you want to be a bit more obtuse.
20:37:03<byorgey>Absolute0: in particular, every monad is a functor.
20:37:31<Peaker>Absolute0: Functors can take it out into a pure function and put it back in. But Functors can't take it into a monadic function that sequences the original action with the result action
20:37:33<blsecres>dcoutts: hmm, seems I've already got that set. guess it's ghc --make that needs the -L flag
20:38:08<dcoutts>blsecres: you uncommented the extra-lib-dirs line right?
20:38:12<Peaker>Absolute0: Taking the value out into an (a->b) function and putting it back in is easier than taking it into an (a -> m b) function and then "sequencing" the (m a) and (m b) together
20:38:15<vininim>roconnor: oh, that ones is nice
20:38:21<vininim>-s
20:38:33<roconnor>vininim: to bad it is totally broken
20:38:36<Peaker>Absolute0: Functors don't need to know to sequence at all, whereas here we have an (m a) and (m b) and the result (m b) has the "effects" of both
20:38:44<Absolute0>using simple OOP seems more elegant :-P
20:39:02<Absolute0>monads/functors seem to simply solve OOP in FP
20:39:13<mauke>how do they solve OOP?
20:39:21<Absolute0>change state
20:39:26<mauke>what state?
20:39:32<Absolute0>to boxed items
20:39:43<mauke>I'm thinking of Maybe here
20:39:51<mauke>not very stateful
20:40:06<byorgey>Absolute0: monads and functors are way more general. they really have very little to do with OOP.
20:40:43<Absolute0>to me it seems like they provide manipulation on blackboxes through abstractions which objects really are..
20:41:06<jmcarthur_work>data OOPish = forall a . Num a => OOPish a -- better approximation of OOP-like ideas
20:41:20<Peaker>Absolute0: "OOP" isn't very well-defined. Functors and Monads are generalized interfaces that lots of code can use and be far more general than "OOP" code typically is
20:41:32<jmcarthur_work>basically, you know what it can do, but not what it is, in OOP
20:41:45<mauke>Absolute0: ok, how do you implement [] and Cont, OO style?
20:41:52<jmcarthur_work>and you can have collections of things that are not the same types in OOP
20:41:53<byorgey>Absolute0: in some sense, programming is all about manipulating black boxes through abstractions. everything is an abstraction on some level. OOP is just one particular type of abstraction, that isn't the solution to everything.
20:41:54<Peaker>Absolute0: All polymorphic Haskell types work on "black boxes", not just Monads, and "information hiding" or "encapsulation" isn't really an OOP-only concept
20:42:17<byorgey>what Peaker said.
20:42:43<Absolute0>Peaker: well functors in particular seem like adding simple object methods..
20:42:49<jmcarthur_work>Absolute0, Functors are closer to C++ templates, especially if you look at STL containers as examples
20:42:53<Absolute0>just getting started with monads :)
20:43:01<Peaker>Absolute0: Functors are nothing like "simple object methods"
20:43:10<byorgey>Absolute0: you are correct to notice that the important thing about functors and monads is the interface they provide, for dealing with common patterns in an abstracted way.
20:43:27<Absolute0>Peaker: better: object method factories.
20:43:32<jmcarthur_work>Absolute0, what is the object if you are looking at a functor? what are its methods?
20:43:39<Peaker>Absolute0: how so?
20:44:13<Absolute0>fmap (+1) Just 5 = Maybe.addOne
20:44:27<Absolute0>fmap (*2) Just 5 = Maybe.twice
20:44:28<Absolute0>etc..
20:44:32<byorgey>Absolute0: a humble observation: it seems like you are trying very hard to connect these new things you are learning with things you already know. while that's not bad per se, I might recommend just trying to learn about functors, monads, etc. more on their own terms, and only later try to make connections back.
20:44:48<byorgey>at this point I think you are just bound to confuse yourself.
20:44:54<vininim>Absolute0: how is that oop and not macro?
20:44:55<Absolute0>probably :)
20:45:08<jmcarthur_work>Absolute0, that doesn't seem quite right. what would Maybe.addOne do with a Maybe String?
20:45:09<mauke>Absolute0: functions are functors
20:45:17<Peaker>Absolute0: No, your methods are aware of the operation, and fmap isn't
20:45:33<Absolute0>anyways is there a more practical use of Monads beside the popular IO Monad?
20:45:41<vininim>xD
20:45:44<byorgey>there are lots!
20:45:44<jmcarthur_work>Absolute0, monads are useful everywhere! :)
20:45:47<Absolute0>something used in nothing to do with IO
20:45:50<Peaker>Absolute0: "more practical"? What do you mean?
20:45:52<Absolute0>like simple algorithms
20:45:54<mux>dcoutts: yay, the haddock docs are finally generated as expected :)
20:45:54<jmcarthur_work>@instances Monad
20:45:55<lambdabot>((->) r), ArrowMonad a, Cont r, ContT r m, Either e, ErrorT e m, IO, Maybe, RWS r w s, RWST r w s m, Reader r, ReaderT r m, ST s, State s, StateT s m, Writer w, WriterT w m, []
20:45:58<Peaker>Absolute0: Monads are used everywhere
20:46:28<mauke>Absolute0: functions are monads
20:46:53<jmcarthur_work>:t join (*)
20:46:55<lambdabot>forall a. (Num a) => a -> a
20:47:00<jmcarthur_work>join (*) 4
20:47:01<mauke>the Maybe monad provides simple exception handling
20:47:05<jmcarthur_work>> join (*) 4
20:47:06<lambdabot> 16
20:47:16<mauke>the ST monad gives you local mutable variables
20:47:45<hackagebot>authenticate 0.0.1
20:47:56<jmcarthur_work>:t runReader -- a wrapper for the function monad to make its functionality explicit
20:47:58<lambdabot>forall r a. Reader r a -> r -> a
20:48:00<Peaker>@let liftedTuple = liftM2 (,)
20:48:01<lambdabot> Defined.
20:48:06<Peaker>> liftedTuple [1,2,3] [4,5,6]
20:48:07<lambdabot> [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]
20:48:10<Peaker>> liftedTuple (Just 5) (Just 6)
20:48:12<lambdabot> Just (5,6)
20:48:20<Peaker>@type liftedTuple
20:48:21<lambdabot>forall (m :: * -> *) a1 a2. (Monad m) => m a1 -> m a2 -> m (a1, a2)
20:48:26<jmcarthur_work>:t runState -- a monad that allows you to read and update the "state" of a variable
20:48:28<lambdabot>forall s a. State s a -> s -> (a, s)
20:48:38<mauke>> liftedTuple (+1) (*2) 21
20:48:39<lambdabot> (22,42)
20:48:44<Peaker>Absolute0: note liftedTuple -- its a general function that can work on any monad, not just Maybe or List or IO
20:48:45<hackagebot>hack-middleware-jsonp 0.0.1
20:48:49<jmcarthur_work>list is also a monad
20:49:09<Absolute0>Maybe another weeek of googling will help :)
20:49:22<jmcarthur_work>> [1,2,3] >>= return . (+1)
20:49:24<lambdabot> [2,3,4]
20:49:25<Peaker>maybe liftA2/liftM2 should be called fmap2?
20:49:25<Absolute0>just got functors yesterday..
20:49:26<dcoutts>mux: so you'd been using build-type: Simple all along?
20:49:29<jmcarthur_work>(same as fmap, there)
20:49:37<mux>dcoutts: yup, pretty stupid heh.
20:49:45<hackagebot>hack-handler-cgi 0.0.1
20:49:47<dcoutts>mux: and thus your custom Setup.hs was being ignored. Ok, glad we worked it out.
20:50:26<mux>dcoutts: too bad we didn't get to the sources of the build bot though
20:50:48<dcoutts>mux: people have suggested before that we should look at the Setup.hs in that case and see if it looks like it's really that simple and warn if not.
20:50:56<dcoutts>mux: aye, did he say why?
20:51:00<jmcarthur_work>@hoogle [a] -> Maybe a
20:51:01<lambdabot>Data.Maybe listToMaybe :: [a] -> Maybe a
20:51:01<lambdabot>Data.List find :: (a -> Bool) -> [a] -> Maybe a
20:51:01<lambdabot>Prelude head :: [a] -> a
20:51:08<mux>dcoutts: nope, he didn't mention anything about that
20:55:47<Peaker>> listToMaybe [1..3]
20:55:48<lambdabot> Just 1
20:55:53<Peaker>I think listToMaybe should have been called head, and head discarded :P
20:57:49<Absolute0>quit
20:58:22<mreh>can anyone tell me why cabal is using a library that isn't listed as a dependancy when I'm installing something from hackage
20:58:34<osfameron>Peaker: it would make lots of simple things more verbose though?
20:58:35<mreh>could it be a secondary dependancy?
20:59:18<dcoutts>mreh: what do you mean exactly? that it's downloading several packages and you're wondering why a particular one is an indirect dependency?
20:59:48<mreh>dcoutts: one of the dependancies causes a bug, but I can't determine which one to use to solve the problem
20:59:52<Peaker>osfameron: Possibly, but that would only be a catalyzator for the solution of the next problem
21:00:05<mreh>Loading package unix-2.3.2.0 ... <command line>: can't load .so/.DLL for: rt (/usr/lib/librt.so: symbol __librt_multiple_threads, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference)
21:00:05<mreh>cabal: Error: some packages failed to install:
21:00:08<osfameron>Peaker: heh, I guess so ;-)
21:00:25<dcoutts>mreh: cabal install --dry-run will give you the list to be installed, one of them will depend on the failing one
21:00:30<Peaker>osfameron: Each solution brings with it new problems -- if you throw it away because of those, you're stuck with old problems. I prefer new problems in a research language :)
21:00:49<dcoutts>mreh: you don't want to be re-installing the unix package anyway
21:01:06<Peaker>osfameron: its possible that nobody's seeing those new problem solutions because they've abandoned that path already (e.g abandoning purity because of not having IObind and IOreturn)
21:01:47<mreh>yi-0.6.0 <- that's the only package it is listing to be installed, and unix isn't even down as a dependancy
21:02:05<osfameron>Peaker: I'm coming at haskell from a very different place... so I'm glad of the simple functions I can get my head around while I'm learning... but I take your point for development/new ideas
21:04:10<mreh>dcoutts: is there a reason why a dependancy isn't listed in hackag?e
21:04:46<dcoutts>mreh: yeah, there's some weirdity with conditional deps in the current way hackage displays deps
21:04:47<mreh>oh, unix-compact, that exports bits of unix
21:05:26<mreh>dcoutts: why shouldn't i reinstall unix?
21:05:30<mreh>the package
21:06:22<dcoutts>mreh: there's no need and it's got the potential to mess things up
21:06:53<mreh>dcoutts: nothing wrong with having two versions and forcing the installer to use one?
21:07:16<dcoutts>mreh: oh, adding an extra version is ok, replacing one is a bit dodgy
21:08:19<olsner>is there any nice typeclass which is 0 for numbers and an empty list for lists?
21:08:34<roconnor>olsner: almost monoid
21:08:42<roconnor>> mempty :: [a]
21:08:43<lambdabot> []
21:08:49<olsner>yeah, definitely monoidy
21:08:54<conal>mempty :: Sum a
21:08:54<lambdabot>conal: You have 1 new message. '/msg lambdabot @messages' to read it.
21:08:54<roconnor>> mempty :: (Sum Int)
21:08:55<lambdabot> Sum {getSum = 0}
21:09:03<roconnor>> mempty :: (Sum Double)
21:09:04<lambdabot> Sum {getSum = 0.0}
21:09:25<olsner>hmm, I could use Sum (or Max, which I assume also exists as a monoid)
21:09:26<roconnor>> mempty :: (Product Int)
21:09:27<lambdabot> Product {getProduct = 1}
21:09:54<roconnor>I'm not sure there is a Max instance of monoid, but you could write one.
21:10:03<olsner>> mempty :: (Max Int)
21:10:04<lambdabot> Not in scope: type constructor or class `Max'
21:10:08<olsner>> mempty :: (Maximum Int)
21:10:10<lambdabot> Not in scope: type constructor or class `Maximum'
21:10:27<roconnor>0 really isn't the identity for Int
21:10:34<roconnor>under max
21:10:38<olsner>yeah, I just realized that
21:10:45<Berengal>> minBound :: Int
21:10:46<lambdabot> -9223372036854775808
21:10:50<Berengal>There it is
21:11:14<roconnor>olsner: If you want natural numbers, you have a second reason for making your own newtype
21:11:22<olsner>minBound is also wrong though, I wouldn't say Max has a defined value on an empty "list"
21:11:37<Berengal>olsner: minBound isn't wrong
21:11:59<roconnor>> maximum [] :: Int
21:12:01<lambdabot> * Exception: Prelude.maximum: empty list
21:12:12<roconnor>Berengal: prelude agrees with olsner
21:12:19<olsner>something like, data Max a = EmptyMax | Max a
21:12:19<roconnor>so they are both wrong! :D
21:12:23<Berengal>roconnor: maximum isn't mconcat for Max
21:12:38<Berengal>@src maximum
21:12:38<olsner>with an error for getMax EmptyMax
21:12:39<lambdabot>maximum [] = undefined
21:12:39<lambdabot>maximum xs = foldl1 max xs
21:13:06<roconnor>I guess the problem is that maximum doesn't want to have a Bounded constraint.
21:13:28<Berengal>roconnor: Indeed. Max requires such
21:14:08<roconnor>newType Max a = Max {getMax :: a}
21:14:17<Berengal>instance (Bounded a, Ord a) => Monoid (Max a) where mempty = minBound; mappend = max
21:14:33<Berengal>Monoid laws hold for that one
21:14:40<roconnor>ship it!
21:15:20<roconnor>newtype Natural = Natural Integer
21:15:22<roconnor>hmm
21:15:30<roconnor>Berengal: Natural isn't an instance of Bounded.
21:15:33<roconnor>:(
21:15:44<mreh>installing yi on ghc 6.10 doesn't work
21:15:59<Berengal>roconnor: I know, but it does have minBound
21:16:05<roconnor>bah, we need to redo the whole Ord hierarchy anyways
21:16:22<Berengal>BoundedBelow, BoundedAbove?
21:16:33<roconnor>I would call it SemiLattice
21:16:57<roconnor>possibly UpperSemiLattice and LowerSemiLattice, but I don' think I'd do that.
21:17:24<roconnor>I could be convinced
21:17:55<roconnor>but I think UpperSemiLattice and LowerSemiLattice are really the same structure, so there isn't a need for two of them.
21:18:09<Berengal>Would be nice to have more than one, for structures that have several bounds
21:18:20<Berengal>But there's nowhere to stop...
21:18:35<roconnor>I certainly would have Lattice
21:19:07<roconnor>class (SemiLattice a, SemiLattice (Dual a) => Lattice a)
21:19:11<olsner>how do you get more than two bounds?
21:19:19<roconnor>something like that using type families
21:19:26<Berengal>olsner: More than one dimention
21:19:31<Berengal>e.g. (Int, Int)
21:19:33<roconnor>obviously what I wrote isn't legal, but I think you could do something nice with type families.
21:19:51<mreh>is the darcs repo more likely to be up to date than hackage>
21:20:19<Berengal>roconnor: With Dual a being a newtype with bounds inverted?
21:20:19<roconnor>class (PartialOrd a) => SemiLattice a
21:21:02<roconnor>Berengal: I'm not sure, I haven't really worked it out. If it cannot work out, I'd just drop the Dual restriction.
21:21:50<roconnor>or if we want to stay Haskell 98, then I'd just do class (SemiLattice a) => Lattice a
21:22:13<roconnor>newtype Dual a = Dual a
21:22:26<roconnor>instance (Lattice a) => Lattice (Dual a)
21:22:55<roconnor>but I suspect there is something nifty that can be done with associated type families
21:23:12<Berengal>Yeah, quite possibly... type families seem nice
21:23:22<skorpan>i always think "lettuce" when i read "lattice"
21:23:33<roconnor>mmm
21:23:36<roconnor>semilettuce
21:23:39<roconnor>:P
21:25:43<mreh>is there a better tool than wget for downloading lots of source files
21:25:55<ik>A tarball
21:26:07<ik>+ wget
21:26:07<mreh>im getting them all from a darcs repo
21:26:22<pejo>mreh, why not use darcs?
21:26:27<mreh>good question
21:26:49<Heffalump>rsync if the other end supports it
21:46:41<mholub_>Can anyone build little haskell source under linux and send me a static-linked binary? Please.. I am under OSX and have no quick access to linux machine with ghc
21:57:09<tim____>Hey - would anyone mind giving a n00b a bit of advice on a weird (but presumably basic) type system error?
21:57:37<skorpan>tim____: just ask!
21:58:05<tim____>heh, thanks :-) so i've got a couple of really basic functions defined like this: http://gist.github.com/121834
21:58:24<tim____>and hugs complains that "Inferred type is not general enough"
21:58:45<edwardk>@remember Chris Okasaki: It happened around midnight, when I was quite exhausted already. I typed ":r", read the first line of the message "My brain just exploded." and said, "Yeah, tell me about it...". And then I jumped off the chair, having realized what I've been talking with.
21:58:46<lambdabot>Done.
21:58:55<skorpan>tim____: it's probably complaining about the Double
21:58:59<tim____>my question is why? presumably it's to do with how perm and comb call factorial - but since they all take an Integral as args and return an Integral, where's the problem?
21:59:16<tim____>aah
21:59:18<skorpan>tim____: change the type signature to "perm :: (Integral a, Fractional b) => a -> a -> b"
21:59:26<skorpan>not sure if that will work, but that's what i'd try
21:59:28<tim____>aha!
21:59:29<tim____>thanks
21:59:36<tim____>not sure how that Double crept in there tbh
21:59:47<skorpan>come back if that doesn't work (which it probably won't) :)
22:00:25<byorgey>no, I think the Double is fine
22:00:39<byorgey>tim____: the problem is that you are trying to divide things which are Integral.
22:00:47<skorpan>oh, right, uhm...
22:00:48<tim____>aah yes
22:00:49<skorpan>that was silly
22:00:52<tim____>that makes sense :-)
22:00:54<byorgey>division (/) only works on Fractional things. so you must explicitly convert them first.
22:00:59<byorgey>Haskell doesn't have implicit conversion.
22:01:02<tim____>so can i coerce an Integral to a Fractional?
22:01:04<byorgey>@quote fromIntegral
22:01:05<lambdabot>lilac says: <drdozer> gha! I'm drowning in the haskell number hierarchy again <lilac> drdozer: magic 8-ball says 'add calls to fromIntegral'
22:01:10<byorgey>@quote fromIntegral
22:01:10<lambdabot>lilac says: <drdozer> gha! I'm drowning in the haskell number hierarchy again <lilac> drdozer: magic 8-ball says 'add calls to fromIntegral'
22:01:19<byorgey>hmm, there was another quote...
22:01:23<skorpan>> (fromIntegral 1) :: Fractional
22:01:24<lambdabot> Class `GHC.Real.Fractional' used as a type
22:01:26<skorpan>meh
22:01:27<byorgey>anyway, yes, with fromIntegrel =)
22:01:32<skorpan>> (fromIntegral 1) :: Double
22:01:33<lambdabot> 1.0
22:01:34<byorgey>fromIntegral*
22:01:38<tim____>aah
22:01:39<tim____>fantastic
22:01:41<tim____>thanks all :-)
22:01:46<byorgey>sure =)
22:02:00<skorpan>is there any way to use fromIntegral to coerce it into any Fractional a?
22:02:06<skorpan>instead of the narrow-minded Double
22:02:14<byorgey>:type fromIntegral
22:02:21<byorgey>@type fromIntegral
22:02:21<skorpan>> (fromIntegral 1) :: (Fractional a)
22:02:23<lambdabot>forall a b. (Integral a, Num b) => a -> b
22:02:23<lambdabot> Class `GHC.Real.Fractional' used as a type
22:02:31<edwardk>@type fromIntegral
22:02:33<lambdabot>forall a b. (Integral a, Num b) => a -> b
22:02:40<byorgey>skorpan: anything which is Fractional is also in Num, so that should work fine.
22:03:13<byorgey>skorpan: i.e. you can assign fromIntegral the (more specific) type signature (Integral a, Fractional b) => a -> b
22:04:07<Peaker>@hoogle (\\)
22:04:07<lambdabot>Data.IntMap (\\) :: IntMap a -> IntMap b -> IntMap a
22:04:07<lambdabot>Data.IntSet (\\) :: IntSet -> IntSet -> IntSet
22:04:07<lambdabot>Data.List (\\) :: Eq a => [a] -> [a] -> [a]
22:04:22<mholub>Sorry for repeating... please help me - compile little haskell program for tomorrow test, i don't ask you to run it, only compile and send me binary
22:04:37<mholub>(on linux machine)
22:04:38<Peaker>mholub: just install ghc
22:05:01<skorpan>byorgey: what do you mean?
22:05:27<mholub>Peaker, I am on osx, and my second machine with ubuntu has only 6.8.2, compiling 6.10.* on it will take hours
22:05:34<byorgey>skorpan: I mean the answer to your question (about using fromIntegral to convert to any Fractional) is yes. what do *you* mean? =)
22:05:41<Peaker>mholub: you don't need to compile 6.10.* on it, just install from binaries
22:05:53<edwardk>skorpan: you are misusing Fractional, its a typeclass, not a type
22:05:53<Peaker>mholub: it takes 2 minutes after the download
22:05:55<mholub>Peaker, do you know repository with 6.10 for ubuntu?
22:06:08<skorpan>edwardk: yeah, i know :) so is it possible to do what i want?
22:06:09<edwardk>> (fromIntegral 1) :: (Fractional a => a)
22:06:11<lambdabot> 1.0
22:06:13<skorpan>ah!
22:06:15<byorgey>skorpan: note you can't actually convert a number into a value of type (Fractional a) => a, that doesn't make sense
22:06:23<Peaker>mholub: http://www.haskell.org/ghc/download_ghc_6_10_3.html -- download the Linux 32/64 binaries for your system, and just ./configure --prefix=/usr/local && sudo make install
22:06:25<byorgey>that is a value of EVERY Fractional type
22:06:25<skorpan>byorgey: but edwardk just did? :P
22:06:36<byorgey>skorpan: that got defaulted to Double.
22:06:41<skorpan>oh
22:06:45<byorgey>it's cheating =)
22:06:52<edwardk>the constraint should be that 'a' is an instance of Fractional, not that your type is 'Fractional a'
22:06:54<skorpan>hehe
22:07:01<skorpan>edwardk: yup, i understand :) thanks
22:07:06<Peaker>is there a destructive-write fold on mutable arrays?
22:07:08<skorpan>oops, gotta go!
22:07:32<mholub>Peaker: thanks, don't notice binary package on haskell.org
22:07:42<mholub>*didn't*
22:07:46<Peaker>mholub: http://www.haskell.org/ghc/download_ghc_6_10_3.html#binaries
22:07:51<edwardk>peaker: hrmm, never tripped over one
22:08:09<edwardk>you want a fold or a map or what?
22:08:19<Peaker>edwardk: a fold
22:08:34<byorgey>'destructive-write fold' doesn't make sense. do you mean something like a mapAccum* ?
22:08:45<edwardk>by destructive write you mean, foldr-like traversal and replace the values as you go?
22:09:17<Peaker>edwardk: ya
22:09:26<Peaker>not sure I want that, just wondering :)
22:10:48<edwardk>the signature would look something like: MArray arr a m => (a -> b -> (a,b)) -> b -> arr i a -> m b -- kinda ugly
22:11:17<edwardk>and once you've gone that far you might as well allow the map action itself to be monadic, etc.
22:12:48<edwardk>i think too many variants suggest themselves for it to come anywhere near a standard library ;)
22:13:52<byorgey>and then edwardk would start hitting it up with parazygohistomorphisms and it would all be downhill from there. ;)
22:14:12<Saizan_>well, you can put it in the split package
22:14:14<edwardk>bah, no point in parazygo
22:14:23<byorgey>haha, touche =)
22:15:57<edwardk>=)
22:18:15<edwardk>ACTION has been tortured by a desire to write a horrible xmonad plugin all day for chrome style tabs, just so I can call it chromulent. After all, it embiggens the prose.
22:18:41<byorgey>hah!
22:19:04<byorgey>you totally should.
22:19:17<edwardk>that said, even as a standalone window manager, it'd be a pretty spiffy toy
22:19:43<inimino>hey edwardk how's your parsing stuff going?
22:19:44<byorgey>ACTION doesn't know how 'chrome-style tabs' work
22:19:45<sjanssen>what makes the tabs chrome style?
22:19:53<sjanssen>just the trapezoidal shape?
22:20:13<edwardk>sjanssen: they replace the title bar, and you can rip them off and dock them
22:20:26<sjanssen>edwardk: xmonad doesn't have title bars
22:20:53<byorgey>edwardk: coming to Hac phi?
22:20:54<edwardk>sjanssen: thats why i said it'd be a horrible xmonad plugin, perhaps better as a standalone app.
22:21:04<edwardk>byorgey: where is it located?
22:21:11<byorgey>edwardk: Philly!
22:21:20<edwardk>byorgey: hrmm, when?
22:21:23<byorgey>the same place I am located =)
22:21:27<byorgey>July 24-26
22:21:40<byorgey>http://haskell.org/haskellwiki/Hac_%CF%86
22:21:50<edwardk>might be tight i have a wedding to attend that same week
22:22:00<byorgey>ah, gotcha
22:22:01<edwardk>but i'll see if i can make it down there and maybe drag shapr
22:22:18<byorgey>yes! please do. =)
22:24:42<edwardk>added to my calendar
22:25:22<byorgey>awesome, hope you can make it =)
22:26:23<edwardk>i have a ton of vacation time I might as well take some of it
22:26:59<byorgey>yup. otherwise it just accrues to The Man.
22:27:21<edwardk>inimino: they are coming along slowly. i've been kind of sucked into other things these last couple of weeks. i'm hoping to find some time to package stuff up into a coherent whole in the next couple of weeks.
22:28:36<edwardk>inimino: the biggest problem i've run into is that i need to refactor the monoid library's notion of a reducer to allow for seminearring reducers, so i can define the notion of a 'module over an applicative' in a manner analogous to a 'module over a seminearring'
22:28:40<Peaker>@hoogle runSTArray
22:28:41<lambdabot>Data.Array.ST runSTArray :: Ix i => ST s (STArray s i e) -> Array i e
22:28:58<Peaker>@hoogle runST
22:28:59<lambdabot>Control.Monad.ST runST :: ST s a -> a
22:28:59<lambdabot>Control.Monad.ST.Lazy runST :: ST s a -> a
22:28:59<lambdabot>Data.Array.ST runSTArray :: Ix i => ST s (STArray s i e) -> Array i e
22:29:08<Peaker>oh
22:29:20<edwardk>because i'm finding thats a nice way to think about how certain kinds of applicatives interact.
22:29:50<inimino>edwardk: I'll look forward to reading what you have
22:30:28<edwardk>inimino: heh, well, each iteration there is less and less there ;)
22:30:43<inimino>I've got a parser generator and now I need to make it handle arbitrary edits without reparsing the whole document
22:30:46<inimino>that's a good sign of progress :-)
22:30:59<edwardk>inimino: ah thats basically the approach i've been going for
22:31:18<inimino>a well-designed library is the tip of the iceberg of code that had to be written and deleted to get to that point
22:31:21<edwardk>the monoidal parsing stuff is proving to be hard to demonstrate any sort of win for on a sufficiently complicated grammar though
22:31:54<inimino>ah, that's interesting
22:32:10<edwardk>my best bet so far is to work with LALR grammars with error annotations that have some side conditions on them and run the parser as if it was GLR, that seems competitive
22:32:24<Peaker>@type iterate
22:32:26<lambdabot>forall a. (a -> a) -> a -> [a]
22:32:27<Peaker>yairchu: ^^
22:32:43<inimino>ok
22:32:44<Peaker>@hoogle (a -> a) -> a -> [a]
22:32:46<lambdabot>Prelude iterate :: (a -> a) -> a -> [a]
22:32:46<lambdabot>Data.List iterate :: (a -> a) -> a -> [a]
22:32:46<lambdabot>Data.Generics.Schemes everywhere :: (a -> a) -> a -> a
22:33:37<thoughtpolice>woot
22:33:49<thoughtpolice>ACTION just got done adding support for module/function annotations to hint
22:33:53<edwardk>i've also been playing with a funny kind of packrat parser where i 'light off' sparks on k columns of rules, and pursue the follow-sets of the rules i started. you can use the same worst-case asymptotics of a packrat parser and then divide out the # of chunks if you're careful
22:33:59<edwardk>but the constants are ridiculous
22:34:47<edwardk>that should give O(ng/k) time parsing for a PEG but with a huge constant
22:35:10<edwardk>n byte string, g grammar complexity, on k nodes.
22:35:27<edwardk>er k cpus/cores/what have you
22:35:43<inimino>edwardk: that's interesting
22:36:17<inimino>the line I'm persuing is starting with a PEG and then analyzing it and optimizing things away where possible
22:36:37<aledge>hey d00ds
22:37:03<inimino>but yeah... large constant factors especially with memory
22:37:14<edwardk>inimino: the LALR with some global restart conditions is pretty competitive though, since you can run it like a normal parser, you just need some information about the fact that i.e. when you see a < in an xml file its usually something interesting
22:37:43<aledge>wrong, because xml files are never interseting
22:37:51<Peaker>@djinn ((a -> b) -> Maybe a -> Maybe b)
22:37:52<lambdabot>f a b =
22:37:52<lambdabot> case b of
22:37:52<lambdabot> Nothing -> Nothing
22:37:52<lambdabot> Just c -> Just (a c)
22:37:57<aledge>jk
22:38:11<inimino>edwardk: alright, I'll look into that
22:38:15<edwardk>i mean in that case, running in parallel you still have to parse as if you could be in the middle of a CDATA, DOCTYPE or <!-- --> section
22:38:31<edwardk>but thats where i've been going as my main 'fallback' parallel parser
22:38:43<inimino>yeah
22:39:21<edwardk>i got a 4x speedup on 8 cores in a quick test that i didn't optimize very well, so i'm hopeful there.
22:39:31<Peaker>@djinn-add Not a = (a -> Void)
22:39:32<lambdabot>Cannot parse command
22:39:42<Peaker>@djinn-add type Not a = a -> Void
22:39:55<Peaker>@djinn (a -> Not a)
22:39:56<lambdabot>-- f cannot be realized.
22:40:01<Peaker>@djinn (a -> Not (Not a))
22:40:02<lambdabot>f a b = b a
22:40:11<edwardk>and its not like parsing xml is an uncommon task these days, unfortunately ;)
22:40:15<inimino>edwardk: you could also make some assumptions about likely parser states at the beginning of a chunck, and then reparse if they fail to hold
22:41:21<edwardk>inimino: yeah, though i've been trying to deal with the parse 'online' to avoid retraversing the chunk. in the xml case i figure i can accrete a bytestring of the contents of the chunk, and fold them together into a bytestring for the cdata section if it turns out i'm in that case
22:41:59<inimino>ok
22:42:08<edwardk>that said my current approach is probably lazy enough that its effectively doing what you said ;)
22:42:43<inimino>ah :-)
22:42:50<inimino>how much of this do you think you can automatically generate from a grammar?
22:42:59<edwardk>i'm hoping basically all of it
22:43:09<inimino>ok, cool
22:43:14<edwardk>my current version rederives sharing from the grammar using terrible hacks
22:43:25<edwardk>StableNames, etc.
22:43:43<inimino>heh
22:43:45<inimino>oh, yeah, yuck
22:43:47<edwardk>but it means you can just use nice applicative combinators as long as the resulting tree is finite
22:44:00<kpreid>rederiving sharing? that reminds me of that FPF paper on LtU
22:44:06<edwardk>and all my builtin combinators are careful to get proper sharing
22:44:25<edwardk>FPF?
22:44:35<kpreid>http://lambda-the-ultimate.org/node/3331 (link to pdf)
22:45:16<kpreid>http://www.lexifi.com/downloads/frankau.pdf section 5.1 talks about rederiving sharing and has 3 citations about it
22:45:18<edwardk>i based my approach on the debug.traced stuff that lennart was monkeying around with. andy gill had a -very- similar DSL with rederived sharing info as well
22:45:43<inimino>bbiab
22:46:19<edwardk>kpreid: hrmm they appear to just be hash consing, which is a bit easier
22:47:00<kpreid>well, they mention other techniques (I haven't followed those refs)
22:47:34<MyCatVerbs>Is cabal-install not included in the ghc base install for some reason?
22:47:37<edwardk>in the case of my stuff, andy's and lennart's, it works for arbitrary functions, etc. by spotting shared use of the same thunk by giving the thunks stable names
22:47:48<edwardk>that way you avoid needing to use horrible 'fix' like combinators in the DSL.
22:48:30<edwardk>and you can just code fairly naturally using let and where clauses, etc
22:49:29<edwardk>many p = ps where ps = (:) <$> p <*> ps <|> pure [] -- is a little unnatural because you need the worker/wrapper to force sharing, but its not a hard style to use
22:51:07<edwardk>MyCatVerbs: correct. though that looks like its changing and iirc there was a distribution of ghc with it rolled in (care of dons?) but i don't recall what happened with it
22:51:59<Peaker>is there an R DSL in Haskell?
22:52:17<edwardk>peaker: as in for use with the stats package r?
22:52:39<Peaker>edwardk: A reimplementation of the R language as a DSL -- I'd find it easier to learn that way
22:52:46<Peaker>edwardk: Giving Haskell types to stuff :)
22:53:05<edwardk>peaker: ah not that i know, though, there is a DSL for bayes using gibbs sampling by Hal Daume called hbc. ;)
22:53:24<Peaker>I don't know what bayes, gibbs, or Hal Daume are :)
22:53:25<MyCatVerbs>edwardk: oh, the batteries-included thing? Yeah, I'll be glad to see it in the base install instead of that.
22:53:30<edwardk>sadly too many projects are called hbc, so it doesn't really stand out
22:53:33<Peaker>was just wondering if I could learn R quick by reading the types of its DSL :)
22:53:41<Peaker>tla's suck
22:53:57<MyCatVerbs>edwardk: IMHO it makes no sense to put all the work that dons dcoutts and everybody have into Cabal and then not have cabal install in the base so that it Just Works. :/
22:54:09<edwardk>peaker: speaking as a guy who used R every day for a couple of years, i doubt it an really be learned quickly to any depth ;)
22:54:22<MyCatVerbs>I mean. Hackage rocks. Let's have it usable right away. ^_^
22:54:24<dcoutts>MyCatVerbs: the platform is the base install
22:54:26<pastorn>does anyone know where the paper about the "real" prime sieve is? the one that's all fast and stuff :)
22:54:40<edwardk>peaker: and statistics is basically a cesspool of TLAs unfortunately.
22:54:47<dcoutts>MyCatVerbs: well, currently we say it's in beta, from ghc-6.12 onwards it is the base install
22:55:03<edwardk>pastorn: like a sieve of atkin or on wheel sieve techniques?
22:55:32<sjanssen>so I'm making a Text.PrettyPrint.HughesPJ version of 99 bottles of beer on the wall, and I'm trying to tackle capital letters at the beginning of sentences. Is it possible to write a function capital :: Doc -> Doc?
22:55:44<pastorn>edwardk: probably with a wheel
22:55:58<pastorn>there was a cool pdf, but i lost it when i reinstalled ubuntu
22:55:59<Botje>pastorn: i think it's on the functional pearls section of haskell.org
22:56:07<pastorn>Botje: cool, thanks
22:56:22<edwardk>well, you might look up the sieve of atkin on wikipedia there is a link from there to a fast c implementation of it, that uses a wheel sieve mod 60 iirc
22:58:31<edwardk>peaker: bayes using gibbs sampling (BUGS) is a nice way to train complicated statistical models that don't have the nice closed forms that a frequentist statistician likes. hbc is a BUGS compiler that compiles the model to yield a program that can run over big data sets and detect fitting/overfitting/lack of convergence of the model, etc.
22:59:38<Peaker>edwardk: I don't know enough statistic to understand that, I guess
22:59:42<edwardk>BUGS is a nice tool when you know the general 'shape' of the model, but you have no idea how to generate a pretty closed form to derive all the values of the posterior distribution's hyperparameters as you see elements.
22:59:48<pastorn>Botje: the one there was from 97, i remember this one being quite newer
23:01:18<edwardk>i.e. you think that that you have a normal distribution. and that its mean and standard deviation are distributed according to some other distributions that you have a good reason to suspect, etc. so you just want to see how good of a fit that model is and if you can train it without starting from calculus all over again for each model variant
23:01:41<pastorn>or maybe not... you might look up the sieve of atkin on wikipedia there is a link from there to a fast c implementation 0xB aleator
23:01:47<pastorn>whoops
23:01:50<jimmyjazz14>I'm trying to install haskell-language-exts and keep getting this error: Test/Runner.hs:5:7: Could not find module `Language.Haskell.Exts'
23:01:52<pastorn>http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf
23:02:23<edwardk>with a traditional tool like R, you're basically stuck starting from first principles, with BUGS you basically get a nice way to specify that in a couple of lines and can start checking to see if the model is plausible.
23:03:01<edwardk>look up winBUGS, openBUGS and Hal Daume's hbc to get a feel for the difference
23:03:20<mreh>has anyone used the fp plugin for eclipse?
23:03:50<jimmyjazz14>actually I'm trying to install haskell-src-exts
23:03:53<edwardk>it has the benefit that it works well in the face of partially missing data, and all sorts of crazy cases
23:04:03<edwardk>gah, gotta run
23:04:37<jimmyjazz14>when I try to install it with cabal is complains that: happy version >=1.17 is required but it could not be found
23:04:53<sclv_>you should install happy then
23:04:59<jimmyjazz14>but I know I installed happy >1.17
23:05:16<sclv_>cabal installs things by default in ~/.cabal/bin/
23:05:22<dcoutts>jimmyjazz14: it's probably not on your $PATH
23:05:22<sclv_>you might need to move it to the right place
23:05:49<sclv_>(by things I of course only mean binaries)
23:07:01<dcoutts>and/or tell cabal to symlink binaries somewhere useful in future, or adjust your $PATH
23:07:10<jimmyjazz14>hmm okay
23:07:16<dcoutts>see the symlink-bindir setting in the ~/.cabal/config file
23:07:25<pastorn>where is the function 'fix' in GHC 6.8.2?
23:07:27<jimmyjazz14>thanks
23:07:32<pastorn>ACTION can't find it
23:07:33<sclv_>?hoogle fix
23:07:33<lambdabot>Data.Function fix :: (a -> a) -> a
23:07:34<lambdabot>Control.Monad.Fix fix :: (a -> a) -> a
23:07:34<lambdabot>module Control.Monad.Fix
23:07:50<pastorn>heh, MonadFix
23:07:52<pastorn>cool :)
23:08:01<sclv_>^^ teach a man to hoogle, and he can find anything
23:08:16<sjanssen>are there any packages on hackage for converting numbers to their English words?
23:11:57<olsner>can IntSets be used for lazily generated infinite lists?
23:12:08<sclv_>no
23:12:24<olsner>not even when you know the list is ascending and distinct?
23:13:02<sclv_>i don't think so.
23:13:19<olsner>hmm, I probably want to work on the original lists anyway
23:14:40<Saizan_>you might want to use an immutable infinite trie, IntSet's spine depends on the actual elements present, iirc
23:17:29<aavogt>sjanssen: I've done this for printing words http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5477#a5477 a while ago, maybe it would be useful?
23:17:52<aavogt>it could definitely be cleaned up
23:18:25<sjanssen>aavogt: what I really want is something on Hackage, so my program looks small and self-contained
23:18:38<sjanssen>aavogt: making a nicer version of http://www.reddit.com/r/haskell/comments/8ovah/
23:20:52<MyCatVerbs>dcoutts: ah, fair enough. I will be looking forward to that. :)
23:25:34<aavogt>hmm, I suppose printing numbers in English (or other languages for that matter) could be useful on Hackage
23:26:06<wli>ACTION is stoked.
23:26:56<defun>i can't seem to find any documentation that describes how one would make a module that re-exports other modules. i.e. if I import module 'a' I would also like to *automatically* import modules 'b' and 'c'... can it be done? Even a hackish way is fine...
23:28:09<aavogt>defun: I look at other libraries for such features. module Foo (module Foo.Bar,module Foo.Baz) where import .... works IIRC
23:28:12<mauke>module A (module B, module C) where
23:28:57<defun>mauke: thanks! :)
23:29:29<mreh>is there anyone I can help with their haskell? I'm bored for the next few weeks
23:33:53<Twey>mreh: Write a monad tutorial :-P
23:34:05<Peaker>mreh: maybe you could debug my lui toolkit?
23:34:44<aavogt>mreh: could you help me write a liftBox :: (C x, C y) => (x -> y) -> Box -> Box
23:35:04<aavogt>where Box is existential and requires the C constraint
23:35:33<aavogt>also, the y type depends on the x type
23:35:41<mreh>aavogt, what's a box?
23:35:43<Twey>Peaker: What's a LUI?
23:35:47<mreh>haha
23:35:50<Twey>Heh
23:36:06<aavogt>data Box = forall a. C a => Box a
23:36:52<Peaker>Twey: my GUI toolkit that I started working on
23:37:15<Twey>Peaker: What does the L stand for?
23:37:16<aavogt>@quote hype
23:37:17<lambdabot>jcreigh says: I've found learning Haskell makes me feel vastly inferior to Haskell coders. ("Oh,", they say, "That's just a fold over the hyper-monad fluxbox list. Here's the one-line replacement
23:37:17<lambdabot>for your entire program.")
23:37:27<Twey>Hahahaha
23:37:31<Peaker>Twey: Something silly, might as well say nothing :)
23:37:45<Twey>Peaker: Aw :<
23:38:01<Twey>I thought it was going to be some revolutionary new approach to UI design
23:38:13<Peaker>I totally sympethize with jcreigh - though after about a year here, I can make most of the folds over hyper-monads myself :)
23:38:20<Twey>Haha, aye
23:38:32<Peaker>Twey: Its very very different to Gtk/Qt, and I think it has a bit of revolution in it :)_
23:38:47<Berengal>ACTION contemplates the nature of a hyper-monad
23:38:47<Twey>Oh good :-P
23:39:10<Peaker>Twey: Its a purely functional widget-set where each widget edits a part of a model functionally, via a Data.Accessor
23:39:11<Twey>Berengal: It's obviously just a monad with more than one type parameter.
23:39:21<Peaker>Twey: parameterized-monads? :P
23:39:22<Twey>Peaker: Cool!
23:40:03<Berengal>I read something about those not long ago...
23:40:29<Peaker>Twey: the semantic model of a Widget is: Widget model = model -> (Image, Size, Map Event model) where Image is an "infinite mapping from coordinates to colors", so (Image, Size) gives you a bounded image
23:41:00<Twey>Interesting
23:41:23<Peaker>Twey: actually the map is Map EventGroup (Documentation, Event -> model) -- so you get "reflection" about what operations the widget supports to show the user, and each event generates a new "edited" model.
23:41:25<Twey>What about scaling widgets, though?
23:41:32<Berengal>So, what does the L stand for?
23:41:48<Berengal>Loleelay?
23:41:54<Twey>Hehehe
23:41:56<Twey>Lola
23:41:57<Berengal>Loveable?
23:42:06<Berengal>Linguistic?
23:42:11<Peaker>Berengal: My name is Lotem, nickname Lotex. So Lotex's User Interface, where the idea was that another dude joins called Simon, and it can be added to the end yielding LUIS - which happens to be the name of a 3rd dude also might work on it later :)
23:42:12<Berengal>Lazy?
23:42:28<Berengal>Haha
23:42:46<Peaker>Twey: Image can be scaled -- its an "infinite map from coordinate to color" with supposed infinite resolution
23:44:49<Peaker>Twey: Now, this model has a bunch of very nice properties. A) simplicity: its clear how the widget can affect the world - by returning new models. B) transactional: The widget returns a whole new model, so if it edits text and a cursor at the same time, its automatically transactioned. C) the widget gets a data-accessor to the model to access what it needs, so it can edit text inside a real model, and cursor buried in some GUIState corner of the model
23:45:32<Peaker>Transactioned, as opposed to Gtk/etc where the text and cursor are destructively updated separately - and that causes problems, if you want to version everything, for example, including the cursor
23:46:12<Peaker>Twey: also, I think I have a pretty simple/composeable model of focus/layout handling instead of the complicated/messy ones in Gtk+/Qt
23:47:30<Peaker>basically, the keyboard focus isn't a global thing. Each widget is aware if it has the focus (from its ancestors) or not. Focus "flows" down children from the root. Grids have child widgets in a grid and pass on focus to one of them. Box is a Grid with hsize or vsize of 1
23:48:12<Peaker>there's a Focus Delegation Widget that can wrap around a Grid, or Text Edit, or whatever, which can take the focus to itself, or pass it on to a child, so by wrapping stuff in a focus delegator, you make the thing itself selectable
23:48:50<Twey>Peaker: It can be scaled, but if (0, 0) yields black and (5, 5) yields blue, then those basically represent an abstract sort of pixel — if ‘scaled’ they'll end up either non-central (if you just increase the bound) or pixellated (if you increase the area to which each ‘pixel’ applies)
23:49:06<Peaker>Twey: you're assuming a particular implementation
23:49:30<Twey>It's a map, right?
23:50:06<Twey>You'd need to pass in the bound to make it scaleable
23:50:12<Twey>And have it be a function
23:50:25<Peaker>Twey: its a continuous map
23:50:39<Peaker>Twey: mathematically-speaking. In implementation/representation, its not necessarily a map at all
23:51:02<Twey>But it still needs to know its own bounds to render itself at an appropriate resolution
23:51:23<Peaker>Twey: well, Image represents a continuous/infinite-resolution image, only when you actually render it, it is "sampled"
23:51:37<Peaker>you scale it before "rendering it"
23:52:41<Peaker>Twey: http://lukepalmer.wordpress.com/2008/07/18/semantic-design/ explains the idea nicely
23:53:47<defun>In System.Process, what scenario would make rawProcess more desirable to use than runProcess, or vice versa. These two functions seem to do the same thing...
23:54:22<Twey>Peaker: So it's not actually coördinate-based at all?
23:54:52<mmorrow>defun: i'm not sure off-hand, but you can always view-source in the haddock docs
23:54:55<Peaker>Twey: coordinates are passed as arguments in the implementation
23:55:24<defun>ah. I am still getting used to the awesomeness of haddock. thanks.
23:56:29<Peaker>Twey: I represent Image as something like: SDL.Surface -> Position -> BoundingRect -> IO () -- because I don't need to currently support scaling. This supports moving by simply applying a function to the Position argument before passing it on. To support scaling I can just add a Scale argument and apply on that too
23:57:30<vininim> %GC time 63.7% (63.5% elapsed)
23:57:34<vininim>heh
23:58:12<Peaker>vininim: doing a lot of mutating?
23:58:31<newsham>http://gmarceau.qc.ca/blog/2009/05/speed-size-and-dependability-of.html
23:58:56<newsham>"The shape of the Haskell star, specifically the way that it bends up, suggest to me that writing high-performance programs in Haskell is a bit of a black art, and that some of the benchmarks submissions could be improved if someone got around to it. It also suggests that the tweaks introduced to boost the performance occupy a lot of code space. (I hope someone from the Haskell community will be able to confirm whether this is the case)"
23:59:55<vininim>Peaker: yeah, kind of

Back to channel and daily index: content-negotiated html turtle