Experimental IRC log haskell-2009-05-02

Available formats: content-negotiated html turtle (see SIOC for the vocabulary)

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

These logs are provided as an experiment in indexing discussions using IRCHub.py, Irc2RDF.hs, and SIOC.

00:00:00<edwardk>roconnor: maybe they aren't in that version, hrmm
00:00:37<edwardk>they are, view source
00:01:10<andresj>@hoogle windowNew
00:01:11<lambdabot>No results found
00:01:22<andresj>argh, how do i search gtk2hs in hoogle?
00:02:09<dcoutts>andresj: I'm not sure if it's in the new hoogle 4, but it's in hoogle 3: http://haskell.org/hoogle/3/?package=gtk&q=foo
00:03:15<andresj>dcoutts: thank you! it gives me old results, tho. from 0.9.10 when current is 0.10.0
00:03:30<hs2m>anyone know how to convert a Maybe String to String
00:03:47<dcoutts>andresj: hopefully there's not too much changed
00:04:32<andresj>dcoutts: haha yes, well i found that the Events module is depracted now in favor of EventM, but appart from that i dont see much else :)
00:04:34<roconnor>@unmtl ContT r (State s a)
00:04:35<lambdabot>err: `ContT r (s -> (a, s))' is not applied to enough arguments.
00:04:41<roconnor>@unmtl ContT r (State s) a
00:04:42<lambdabot>(a -> s -> (r, s)) -> s -> (r, s)
00:04:55<roconnor>@unmtl StateT s (Cont r) a
00:04:56<lambdabot>s -> (a -> s -> r) -> r
00:05:00<Botje>hs2m: you don't convert it, you use pattern matching and explicitly take care of the Nothing alternative
00:05:40<hs2m>Botje: basically I have a url inside a Maybe, i just want the url as a string any ideas how to do that?
00:05:48<Botje>use pattern matching
00:05:59<Botje>case bleh of Just url -> (use url here); Nothing -> panic
00:06:19<hs2m>Botje: like function Just a = a
00:06:20<hs2m>?
00:06:22<araujo>let maybeToStr Nothing = [] ; maybeToStr (Just str) = str
00:06:26<araujo>something like that
00:06:32<hs2m>thanks a lot!
00:06:40<Botje>you could just use fromJust, yes.
00:06:53<Botje>but the whole point of Maybe a is that you handle the Nothing case..
00:08:08<Botje>maybe id (error "No url found!") is another good way of handling it
00:08:14<Botje>:type maybe
00:08:20<Botje>:t maybe
00:08:22<lambdabot>forall b a. b -> (a -> b) -> Maybe a -> b
00:08:25<Botje>bloddy lambdabot
00:08:27<gwern>andresj: I think you have to use gtk2hs's hoogle installation
00:08:36<Botje>maybe (error "No url found!") id.
00:08:47<Ralith>wouldn't that have to be
00:08:52<Ralith>(\x -> error "No url found!")
00:09:11<andresj>gwern: do they have another one? i just know bout http://haskell.org/hoogle/3/?package=gtk, which is outdated, and http://haskell.org/hoogle/package=gtk ,which does not work properly.
00:09:26<gwern>andresj: isn't it on the gtk2hs site?
00:09:36<Botje>Ralith: nah, look at the type
00:09:52<Botje>logically, if the Maybe value is Nothing you don't have any data to go on ;)
00:09:58<andresj>well http://www.haskell.org/gtk2hs/documentation/ links to the second url
00:10:17<Ralith>Botje: orite
00:12:15<gwern>andresj: in that case, dunno
00:12:39<gwern>this seems to work http://haskell.org/hoogle/3/?package=gtk&q=init but you say it's outdated
00:13:45<andresj>haha yes, it works, but on gtk2hs-0.9.10
00:13:51<andresj>plus it doesnt support operators
00:14:00<eu-prleu-peupeu>is there any way to code assembly in haskell ?
00:14:37<FliPPeh>Probably, VERY PROBABLY not
00:14:48<Saizan>well, there's harpy
00:14:54<andresj>eu-prleu-peupeu: C bindings?
00:15:04<FliPPeh>Assembler is the complete opposite of Haskell
00:15:11<dcoutts>eu-prleu-peupeu: you can compile Haskell and assembly to separate .o files and link them together and using the FFI you can have them call each other
00:15:18<FliPPeh>Extremely low level and imperative
00:15:35<eu-prleu-peupeu>hmm ok
00:15:36<eu-prleu-peupeu>i see
00:15:48<dcoutts>C + Haskell is a good combo, assembler is probably going unnecessarily low
00:15:53<gwern>andresj: operators?
00:16:25<andresj>gwern: searching operators, that is. like (:=) although i already found it in System.Glib.Attributes :P
00:17:16<andresj>btw, this keeps popping up in code i write; how do u import a data constructor? always ghc says that the module doesnt export it.
00:17:19<thoughtpolice>you fools!
00:17:23<thoughtpolice>we have DSLs for this!
00:17:24<thoughtpolice>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/harpy
00:17:30<thoughtpolice>^ x86 asm inside haskell :)
00:17:31<edwardk>FliPPeh: bah you might argue that its the closest thing to haskell =)
00:17:46<FliPPeh>Both are hard to learn, so yea.
00:17:48<edwardk>FliPPeh: after all look at all of the out of order instruction evaluation they have going on under the hood =)
00:17:58<povman>What's an example of a Poset which is not a Lattice?
00:18:05<andresj>i mean, when importing it by name; when i import the whole module ghc doesnt complain
00:18:12<gwern>andresj: 'import Foo.Bar (Baz(Quux, Urk))' or import Foo.bar (Baz(..))
00:18:18<edwardk>povman: give it two bottoms
00:18:36<edwardk>or 'draw a heart' =)
00:18:37<andresj>oooooh!!! lol, thank you gwern!! i guess i never read that part of real world haskell :P
00:18:48<povman>Such imagery!
00:19:45<edwardk>gotta run
00:20:03<povman>(thanks)
00:24:07<povman>By the way, I've figured out why http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2285 doesn't work!
00:49:35<rabideejit>> fmap (+4) $ pure 6
00:49:35<lambdabot> Ambiguous occurrence `pure'
00:49:35<lambdabot> It could refer to either `Control.Appl...
00:50:42<rabideejit>> head $ concat $ fmap fmap ( pure (+4) ) <*> pure ( pure 6 )
00:50:43<lambdabot> Ambiguous occurrence `pure'
00:50:43<lambdabot> It could refer to either `Control.Appl...
00:51:02<rabideejit>head $ concat $ fmap fmap ( pure (+4) ) <*> Control.Applicative.pure ( Control.Applicative.pure 6 )
00:51:16<rabideejit>> head $ concat $ fmap fmap ( pure (+4) ) <*> Control.Applicative.pure ( Control.Applicative.pure 6 )
00:51:17<lambdabot> Ambiguous occurrence `pure'
00:51:17<lambdabot> It could refer to either `Control.Appl...
00:51:54<rabideejit>yes, I'm spamming #haskell at 1:51 am with pointless fmaps
00:52:02<rabideejit>> head $ concat $ fmap fmap ( Control.Applicative.pure (+4) ) <*> Control.Applicative.pure ( Control.Applicative.pure 6 )
00:52:03<lambdabot> 10
00:52:05<rabideejit>yay
00:52:32<zoheb>do we have a tail function that returns newtail [] = []
00:52:42<zoheb>or similar
00:53:11<Berengal>> drop 1 []
00:53:12<lambdabot> []
00:53:29<zoheb>oh yes, :) thx
00:53:32<zoheb>berengal
00:54:05<zoheb>I am trying to write an inverse of concat
00:54:34<zoheb>very often we want to split up a list into a list of lists
00:54:51<rabideejit>zoheb: like a function which takes an int 'n' say and a list, and splits the list into sublists of length n?
00:54:58<zoheb>so, something general like foldr for use in such situations
00:55:10<zoheb>that could be one use
00:55:37<lispy>unfoldr?
00:55:39<lispy>:t unfoldr
00:55:40<lambdabot>forall b a. (b -> Maybe (a, b)) -> b -> [a]
00:55:42<zoheb>here is my first attempt http://mibbit.com/pb/VjsIGq
00:55:57<zoheb>oh there is one already?
00:56:12<lispy>Maybe. I doubt I full understand what you're after
00:56:36<lispy>unfoldr takes a generator, a seed, and returns a list
00:56:58<zoheb>that isn't what I had in mind
00:57:05<adamvo>@type map (:[])
00:57:06<lambdabot>forall a. [a] -> [[a]]
00:57:07<Berengal>> takeWhile (not.null) . map (take 2) . iterate (drop 2) $ [1..20]
00:57:08<lambdabot> [[1,2],[3,4],[5,6],[7,8],[9,10],[11,12],[13,14],[15,16],[17,18],[19,20]]
00:57:14<lispy>> unfoldr (\x -> Just (x,x)) 1
00:57:15<lambdabot> [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,...
00:57:28<zoheb>I am thinking of a fn that can be useful for writing fns like words or lines
00:57:46<lispy>you want to group things?
00:57:46<rabideejit>your definition there looks like you want g to return ( a , b ) where a is a of type A and b is of type [ A ], bu you only add k to the end of the list.
00:58:18<lispy>> groupBy (<) [1, 2, 3, 4, 1, 0, 3, 5, 7]
00:58:20<lambdabot> [[1,2,3,4],[1],[0,3,5,7]]
00:58:28<Berengal>> span isDigit "12345432asdffgwds"
00:58:29<lambdabot> ("12345432","asdffgwds")
00:58:29<lispy>(oh the weirdness of groupBy
00:58:42<lispy>:t break
00:58:43<idnar>why is that weird?
00:58:43<lambdabot>forall a. (a -> Bool) -> [a] -> ([a], [a])
00:58:56<lispy>idnar: I always have to restudy it to make sense of it :)
00:58:57<zoheb>actuually I havent found a better value for k than []
00:59:21<ManateeLazyCat>Hi, guys. How do you use QuickCheck to test program? Any document and suggestion? Thanks.
00:59:32<zoheb>here is a sample use of the function foldrs (fmap (drop 1).span isDigit) [] "1234,5678,90"
00:59:45<zoheb>["1234","5678","90"]
00:59:54<lispy>idnar: I just feel, groupBy can be very counter intuitive, and it is also a leaky abstraction. The exact way that your binary funtion works isn't enough to determin the behavior...if you give it the right ops and inputs you can reverse engineer groupBy
01:00:36<zoheb>or foldrs (splitAt 4) [] "1234,5678,90" = ["1234",",567","8,90"]
01:01:04<lispy>I'd start with the type...
01:01:14<lispy>That tends to be very telling
01:01:22<Berengal>> takeWhile (not.null) $ unfoldr (\l -> Just $ second (drop 1) . span (/=' ') $ l) "hello world how are you?"
01:01:23<lambdabot> ["hello","world","how","are","you?"]
01:01:35<rabideejit>I get foldrs :: ([t] -> (t1, [t])) -> [t1] -> [t] -> [t1]
01:01:43<Berengal>@type unfoldr
01:01:44<lambdabot>forall b a. (b -> Maybe (a, b)) -> b -> [a]
01:01:52<lispy>I knew it!
01:01:56<zoheb>yes, I was trying to simplify code like that Berengal
01:02:07<Berengal>"foldrs" seems eerily similar to unfoldr
01:02:20<zoheb>I haven't looked at unfoldr
01:02:25<zoheb>I will take a look
01:02:28<lispy>Yeah, but the type rabideejit gave is not isomorphic to unfoldr
01:02:47<rabideejit>there's a bit of a difference.
01:02:53<zoheb>I used a pair object because span, break, splitAt all return pairs
01:02:58<lispy>Specifically, Maybe (a, b) vs. (t1, [t]) and [t1]
01:03:07<skorpan>:t unfoldr
01:03:08<lambdabot>forall b a. (b -> Maybe (a, b)) -> b -> [a]
01:03:15<rabideejit>exactly.
01:03:32<rabideejit>But I think unfoldr is nearer the mark, unles zoheb, you really have a use for the list of [t1]
01:03:35<zoheb>I need to look at unfoldr
01:03:59<lispy>?src unfoldr
01:03:59<lambdabot>unfoldr f b = case f b of
01:03:59<lambdabot> Just (a,new_b) -> a : unfoldr f new_b
01:03:59<lambdabot> Nothing -> []
01:04:04<lispy>we can all look at it :)
01:04:33<Berengal>unfoldr is a generalized list-builder
01:05:10<dolio>@type \f -> foldr (((f . Just) .) . (,)) (f Nothing)
01:05:11<lambdabot>forall c a. (Maybe (a, c) -> c) -> [a] -> c
01:05:11<Berengal>It's like iterate, except it can stop by itself, and the iterated value can be separate from the collected value
01:05:38<lispy>Yes, very clever
01:06:26<zoheb>> takeWhile (not.null) $ unfoldr (\l -> Just $ second (drop 1) . span (/=' ') $ l) "hello world how are you?"
01:06:28<lambdabot> ["hello","world","how","are","you?"]
01:06:36<lispy>dolio: heh, Cool, foldr is a generalized unfolder
01:06:38<dolio>@type \f -> foldr (curry $ f . Just) (f Nothing)
01:06:39<lambdabot>forall a c. (Maybe (a, c) -> c) -> [a] -> c
01:06:40<zoheb>> unfoldr (\l -> Just $ second (drop 1) . span (/=' ') $ l) "hello world how are you?"
01:06:41<lambdabot> ["hello","world","how","are","you?","","","","","","","","","","","","","",...
01:07:03<dolio>Huh? foldr is a folder, not an unfolder.
01:07:14<dolio>@type unfoldr
01:07:15<lambdabot>forall b a. (b -> Maybe (a, b)) -> b -> [a]
01:07:21<dolio>Goes in the opposite direction.
01:07:39<Berengal>Can't foldr without a list...
01:08:15<rabideejit>( or at least a foldable if you're wanting smart alec type answers )
01:08:16<Berengal>You might be able to foldr over a repeat () list to unfold though...
01:09:15<lispy>dolio: but, you made unfoldr from foldr, therefore, foldr generalizes unfoldr ;)
01:09:15<Berengal>Actually, probably not
01:09:43<dolio>I made foldr use a Maybe (a, b). It's still foldr.
01:09:51<Berengal>lispy: That wasn't unfoldr
01:09:58<Berengal>@type \f -> foldr (((f . Just) .) . (,)) (f Nothing)
01:09:59<lambdabot>forall c a. (Maybe (a, c) -> c) -> [a] -> c
01:10:02<Berengal>@type unfoldr
01:10:02<lambdabot>forall b a. (b -> Maybe (a, b)) -> b -> [a]
01:10:34<lispy>Oh
01:10:41<lispy>I misread it
01:10:42<Berengal>They're basically inverses
01:11:13<lispy>Right, I just...ooops. I thought it might be possible to implement unfoldr interms of foldr but maybe that is silly.
01:12:06<Berengal>At this point someone will probably mention ana- and katamorphisms. I'm not sure, but I believe they're relevant...
01:12:38<lispy>In deed
01:13:17<lispy>I'm not category theory expert, but my understand was that foldr/unfoldr are the generic implementations of those concepts for the list functor
01:13:30<lispy>(I also can't seem to type worth a damn)
01:13:39<lispy>(what's new, right?)
01:13:48<EvilTerran>lispy, i'm guessing cata/anamorphisms?
01:14:08<lispy>EvilTerran: hi! How is code?
01:14:28<lispy>What do people work on here these days? I'm *here* and the loop is over *there*
01:15:06<gwern>lispy: monads today, monads yesterday, and blimey if it don't look like monads tomorrer too!
01:15:14<gwern>what I wouldn't give for a little manflesh
01:16:04<lispy>ACTION raises an eyebrow at the "manflesh" bit, and wonders if that should continue in #haskell-blah
01:16:08<lispy>gwern: hi!
01:16:18<lispy>gwern: I see you working on Darcs these days, that's good.
01:16:20<gwern>lispy: _Hobbit_ joke, but I guess that's too obscure
01:16:40<gwern>lispy: mostly gitit/filestore akually, but since the bottleneck there is darcs...
01:16:42<lispy>gwern: Bilbo! The bravest hobbit ever known...Bilbo! (another obscure hobbit ref)
01:17:14<gwern>ACTION tries again. 'Gee dons what are we going to do tonight?' 'the same thing we do every night lispy - try to figure out monads!'
01:17:23<lispy>heh
01:17:53<gwern>(I would've gone with 'monad transformers', but I need 5 syllables - 'take over the world' is 5 and so is 'figure out monads')
01:17:56<lispy>Quiz: What is the Mother of All monads? e.g., which existing Monad instance is it?
01:18:05<gwern>er. Id?
01:18:09<lispy>nein
01:18:17<gwern>zut alors
01:18:23<lispy>sigfpe has a blog about it
01:18:23<gwern>Functor then?
01:18:27<lispy>That's where I learned it
01:18:32<lispy>sigfpe++
01:18:45<lispy>http://blog.sigfpe.com/2008/12/mother-of-all-monads.html
01:19:05<MyCatVerbs>lispy: Cont?
01:19:18<gwern>hm. the mother of all things is the Tao, and monads are things; so therefore instance Tao Monad?
01:19:20<lispy>MyCatVerbs: correct
01:19:40<lispy>MyCatVerbs: now the more interesting bit is *why*
01:19:50<MyCatVerbs>Guess who else reads sigfpe's blog. ;P
01:20:11<gwern>lispy: maybe continuations are so powerful they can do just about anything even monads?
01:20:15<MyCatVerbs>Can't remember. Possibly because you can implement all functional languages in CPS?
01:20:15<lispy>hehe, I learn so much in an hour of reading his blog that I can't look at it often. My head would explode
01:20:23<gwern>someone once told me that continuations are like principaled GOTOs
01:20:40<gwern>(which certainly sounds general & powerful)
01:20:57<lispy>gwern: yes, and iirc it was Backus(sp?) that first pointed that out publicly
01:21:13<lispy>Or maybe he was talking about lambdas
01:21:16<lispy>Gosh, I can't recall
01:21:24<gwern>perhaps he meant post machines
01:21:26<dolio>People say tail recursion is like goto, as well.
01:21:42<lispy>dolio: I'd like to see how that works, care to elaborate?
01:21:55<lispy>tail recursion *uses* goto
01:21:57<Berengal>TR is _a_ goto, but not _all_ gotos
01:22:09<dolio>Functions are labels. Tail calls are goto.
01:22:14<gwern>Berengal: there are no beginnings nor ends to the goto of time
01:22:31<ivanm>ACTION thinks it would be cool to have bindings to this: http://tulip.labri.fr/
01:22:35<lispy>I liked what roconnor said about State yesterday
01:22:44<dolio>I should have said tail calls in general, not tail recursion.
01:22:53<lispy>dolio: ah
01:23:11<dolio>I'd say they're more principled than goto, but I'm not sure I can justify that. :)
01:23:13<lispy>?users
01:23:13<lambdabot>Maximum users seen in #haskell: 658, currently: 595 (90.4%), active: 16 (2.7%)
01:23:21<lispy>wow, over 600
01:23:23<MyCatVerbs>dolio: tail calls to constructors don't really behave like gotos. :)
01:23:56<gwern>(one of the nice things of WoT is that some of its writing is so unique that it's almost trivial to pardy - 'a stack frame arose and blew over the CPU. it was *a* tail recursive goto, but not *the* goto. there are no beginnings or ends to the goto of time.')
01:23:58<Berengal>dolio: More principled in that the can only goto the beginning of a function, perhaps?
01:24:11<dolio>Yeah. And only from the end of a function.
01:24:29<dolio>I don't know. It just seems like they're less spaghetti enabling. But maybe I'm wrong.
01:24:42<MyCatVerbs>I'd say that in Haskell, CPS is trivially a little more pricipled than raw goto, just because you have to continue through something which has the correct output type.
01:24:48<Berengal>So TCs have one entry point and one exit point
01:25:04<Berengal>Well, possibly several exit points, but they all exist in different branches
01:25:21<MyCatVerbs>Berengal: hrmn? No, many e... yes, many exit points, but always as the last thing done.
01:25:55<Berengal>ergo different branches
01:26:35<Berengal>And since all functions have to return a value (or you'd have bottom), the "last thing done" can't be in the middle of an expression.
01:27:35<ivanm>gwern: "WoT"?
01:27:41<gwern>ivanm: wheel of time
01:27:53<ivanm>oh, that never-ending series of fantasy novels?
01:28:23<Berengal>Well, the guy's dead now...
01:28:35<ivanm>Berengal: :o
01:28:42<ivanm>I guess it ended then... >_>
01:29:26<gwern>no. sanderson is writing the next 3
01:30:41<lispy>MyCatVerbs: also, the CPS in the Cont monad is delimited
01:30:58<lispy>MyCatVerbs: eventually you are delimited by runCont
01:31:06<MyCatVerbs>lispy: I am entirely unclear on the semantics of delimited continuations.
01:31:40<gwern>http://www.modernperlbooks.com/mt/2009/04/the-why-of-perl-roles.html <-- did - did perl 6 just reinvent type classes?
01:31:48<ivanm>gwern: OK, as I said, never-ending
01:31:50<lispy>MyCatVerbs: me too, but my vague understanding is that the delimitation is the universe that the current continuation can access. So when you delimited a continuation you cut down on the universe
01:32:04<gwern>ivanm: no, sanderson swears 3 books and that's it! :)
01:32:11<dolio>Anyhow, continuations are like goto where you can pass around which label to go to, and you don't just go to a line in the program, you go to a time.
01:32:16<Berengal>How do I get a FileChooserButton thingy out of a glade file in gtk2hs?
01:32:17<ivanm>gwern: and then someone _else_ will do 3 books! :p
01:32:47<MyCatVerbs>lispy: I've nosed around Oleg's stuff and a few other places, but haven't spotted anything that looked like an introduction rather than a "today we're going to implement delimited continuations using $atrocious_hack allowing us to embed the idea in a language that doesn't natively support it">
01:33:11<lispy>MyCatVerbs: hehe. I bet we can find a good definition if we look
01:33:19<rabideejit>also, why is the evilmangler written in perl?
01:33:33<lispy>MyCatVerbs: oh hai: http://en.wikipedia.org/wiki/Delimited_continuation
01:33:49<rabideejit>is it to emphasize its evil alignment?
01:34:06<lispy>rabideejit: because perl is good at munging, I think
01:34:14<gwern>rabideejit: no one cares enough to write it in haskell, and it's doomed anyway
01:34:15<lispy>rabideejit: and portable...
01:34:45<ivanm>lispy: well, if someone wanted to I'm sure they could use haskell regex libraries to do so
01:34:53<ivanm>but that will involve work, and possibly extra deps :s
01:35:13<lispy>ivanm: then it would be the pure mangler or something...really, much less drama and less motivation to axe it for good :)
01:35:18<rabideejit>write it in befunge and be done with it.
01:35:21<gwern>not to mention no one probably understands it by this point
01:35:26<ivanm>lispy: heh
01:35:40<ivanm>rabideejit: so you want to replace perl with yet another language? :s
01:35:43<ivanm>how does that help?
01:36:10<lispy>ivanm: it can help...in darcs we have an issue with running the test suite on windows because it is written in sh
01:36:24<lispy>ivanm: if we rewrote the tests in haskell then it would run wherever darcs runs :)
01:36:33<gwern>we can fix that! we have the shsh technology!
01:36:36<ivanm>lispy: \o.
01:36:41<ivanm>* \o/
01:36:41<dolio>MyCatVerbs: Oleg's paper on using delimited continuations in modeling operating systems is good.
01:36:42<rabideejit>ivanm: I'm kind of joking. I don't think anyone really writes in befunge ( other than people on #esoteric )
01:36:46<lispy>gwern: the thing from Stephen Hicks?
01:36:55<ivanm>lispy: I assume that you don't want to require cygwin or something on windows?
01:37:00<rabideejit>anyway, byebye :)
01:37:03<lispy>ivanm: right
01:37:04<gwern>dunno. last I looked mostly roundy seemed to be hacking on shsh
01:37:13<lispy>ivanm: cygwin/msys are bad dependencies to have
01:37:21<ivanm>lispy: *nod*
01:37:26<lispy>gwern: ah, does that mean it uses franchise?
01:37:31<ivanm>is msys that bad though, since it's pretty small (compared to cygwin)?
01:37:37<gwern>er... probably
01:37:42<lispy>ivanm: I like neither :)
01:37:49<ivanm>franchise: because the haskell community needs to be divided even further! :s
01:37:59<lispy>gwern: oof. Well, that's a turn off for me...back to my own pet projects
01:38:11<gwern>how hard could it be to cabalize?
01:38:24<lispy>ACTION wants to write a *real* type checked for annotated subsets of normal python
01:38:31<lispy>checker*
01:38:37<dolio>MyCatVerbs: http://www.cs.rutgers.edu/~ccshan/zipper/context2007.pdf
01:38:48<gwern>just maintain a careful branch; I mean, roundy cabalized franchise for hackage...
01:38:51<gwern>the irony I know
01:39:06<lispy>gwern: wow yeah, the irony of that one hurts
01:39:09<ivanm>gwern: heh
01:39:23<gwern>he's not stupid; just opinionated
01:39:38<ivanm>gwern: have you seen roundy's and arrosatto's xmonad fork?
01:39:41<lispy>he's very intelligent, but he got burt out and started resisting everything
01:39:43<gwern>like FLOSS projects supporting windows.
01:39:48<MyCatVerbs>dolio: thanks. I was going through the "Beyond Continuations" paper when you linked that. :)
01:39:58<gwern>ivanm: sure have. sent it to the xmonad ml, though I didn't look too hard at the changes
01:40:11<lispy>His code can be hard to maintain too.
01:40:12<ivanm>oh, that was you that sent it?
01:40:16<gwern>(they look hard to bring back to the mainline)
01:40:17<ivanm>ACTION thought it was someone else
01:40:20<gwern>ivanm: small world
01:40:32<ivanm>yup
01:44:49<wli>ACTION takes a stab at PE#216.
01:44:59<ivanm>wli: hmmm?
01:45:07<Zao>Project Euler, I suppose.
01:45:12<ivanm>ahhh
01:45:14<wli>Yeah.
01:45:27<ivanm>ACTION thought it was "Please Explain" or something...
01:45:46<ivanm>http://en.wikipedia.org/wiki/Pauline_Hanson <-- ;-)
01:45:50<Zao>http://projecteuler.net/index.php?section=problems&id=216
01:45:54<wli>I'm getting right answers but it's a bit slow.
01:48:07<ivanm>"It turns out that only 49 = 7*7 and 161 = 7*23 are not prime." <-- wtf?
01:48:47<lispy>ivanm: must be in a special subset?
01:48:54<ivanm>wli: the way I'd try it is get a wheel-based sieve of erasthotenes (however you spell it), add all those primes to a Set or something, then generate all t(n) and filter if they're in the set
01:48:58<lispy>Obviously those are not the only compsoites
01:49:07<ivanm>lispy: yeah, it is... they just don't say so explicitly
01:49:15<wli>2*n*n-1 for n = 5 and n = 9.
01:49:24<ivanm>so at first glanced, I didn't get the next sentence ;-)
01:49:48<ivanm>IIRC, there's a primes package on hackage...
01:49:51<gwern>ivanm: please explain?
01:50:00<ivanm>gwern: which bit? ;-)
01:50:13<gwern>the relevance of hanson, I suppose
01:50:26<lispy>> map (\n -> 2*n*n-1) [1..10]
01:50:27<lambdabot> [1,7,17,31,49,71,97,127,161,199]
01:50:35<ivanm>gwern: wli said "PE", and the first meaning of PE I thought of was "Please Explain" ;-)
01:50:42<gwern>ah
01:50:43<wli>ivanm: Right now I'm factoring 2*n*n-1, and if it's prime I tell [n], and in either case, I add n mod p and (-n) mod p to the queue.
01:51:00<ivanm>wli: hmmm.... factoring is probably rather expensive
01:51:05<wli>ivanm: For all prime divisors of 2*n*n-1
01:51:11<lispy>I bet you only have to cehck for 7
01:51:18<ivanm>lispy: heh
01:51:40<ivanm>lispy: http://www.maths.uwa.edu.au/~berwin/humour/invalid.proofs.html#1.1Proofbyexample
01:52:00<lispy>ivanm: :)
01:52:20<lispy>ivanm: it's a conjecture worth trying to prove or find a counter example of though, as it would give a nice speed up :)
01:52:30<ivanm>lispy: yeah
01:52:37<wli>http://wli.pastebin.com/md9cfabe
01:52:41<ivanm>proving it might be a little difficult
01:53:08<wli>They're actually such small numbers that more advanced factoring algorithms should make short work of them.
01:53:12<ivanm>wli: well, I suppose it's less dense than your usual examples... :p
01:53:22<ivanm>wli: but as I said, I wouldn't bother
01:53:36<gwern>"To see that infinite-dimensional colored cycle stripping is decidable, we reduce it to the halting problem." <-- ok, I like that
01:53:40<ivanm>get something to generate primes, and use that
01:53:46<lispy>> filter (==0) (map (`mod` 7) (map (\n -> 2*n*n-1) [1..100]))
01:53:47<ivanm>gwern: lol
01:53:47<lambdabot> [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
01:53:57<lispy>> filter (/=0) (map (`mod` 7) (map (\n -> 2*n*n-1) [1..100]))
01:53:57<wli>This is already a bit too slow.
01:53:58<lambdabot> [1,3,3,1,6,1,3,3,1,6,1,3,3,1,6,1,3,3,1,6,1,3,3,1,6,1,3,3,1,6,1,3,3,1,6,1,3,...
01:53:59<ivanm>lispy: heh
01:54:01<gwern>@remember BerwinTurlach To see that infinite-dimensional colored cycle stripping is decidable, we reduce it to the halting problem.
01:54:01<lambdabot>Okay.
01:54:14<lispy>that pattern of mods is a bit telling
01:54:51<ivanm>> filter (==0 . fst) (map (`mod` 7 . fst) (map (\n -> (2*n*n-1,n)) [1..100]))
01:54:53<lambdabot> Couldn't match expected type `(a, b) -> c'
01:54:55<ivanm>gah
01:55:00<wli>Well, if p|(2*n*n-1) then if m = n mod p then p|(2*m*m-1)
01:55:01<dolio>Perhaps he has a perspex machine.
01:55:42<wli>Furthermore if p|(2*n*n-1) then p|(2*(p-n)*(p-n)-1)
01:56:02<wli>That's where I use the queue.
01:56:42<lispy>> (map (`mod` 7) (map (\n -> 2*n*n-1) [1..100]))
01:56:43<lambdabot> [1,0,3,3,0,1,6,1,0,3,3,0,1,6,1,0,3,3,0,1,6,1,0,3,3,0,1,6,1,0,3,3,0,1,6,1,0,...
01:57:06<lispy>I wish lambdabot had an isPrime
01:57:36<lispy>I would like to map it on the result of dividing those that give 0 by 7 (repeatedly) then running isPrime
01:57:52<lispy>anyway, I have to go
01:57:54<lispy>good luck
02:03:08<wli>The trick is that I don't have a good way to skip over stretches of numbers.
02:04:32<wli>(in fact it doesn't appear that I actually can)
02:05:18<wli>So basically faster factoring and/or primality testing is about the only obvious way I can think of to speed it up.
02:07:27<wli>You could do something like a wheel but it's a bit hard to get much mileage out of it because you only knock out two residue classes for each prime.
02:16:31<wli>I wonder how many duplicate prime factors I'm getting.
02:16:58<wli>I just realized I don't have anything to prevent duplicates from arising.
02:17:45<wli>I probably also need the smallest number congruent to something mod p >= some lower bound.
02:18:59<ivanm>> length . filter ((/=) 0 . flip mod 7) $ map (\n -> 2*n*n - 1) [2..9]
02:19:01<lambdabot> 5
02:19:07<ivanm>so that fails...
02:20:26<ivanm>> filter ((/=) 0 . flip mod 7) $ map (\n -> 2*n*n - 1) [2..9]
02:20:27<lambdabot> [17,31,71,97,127]
02:21:09<ivanm>oh, duh, that _is_ the prime ones (excluding 7)
02:21:17<ivanm>> succ . filter ((/=) 0 . flip mod 7) $ map (\n -> 2*n*n - 1) [3..9]
02:21:18<lambdabot> No instance for (Enum [a])
02:21:18<lambdabot> arising from a use of `succ' at <inte...
02:21:36<ivanm>> succ . length . filter ((/=) 0 . flip mod 7) $ map (\n -> 2*n*n - 1) [3..10000]
02:21:38<lambdabot> 7143
02:21:45<ivanm>heh, this is definitely wrong
02:22:31<ivanm>@tell lispy for that project euler problem, we can't just assume factors of 7 :(
02:22:32<lambdabot>Consider it noted.
02:26:07<Olathe>Is there a shortcut for liftM2 id ?
02:26:56<necroforest>Is there a standard notation for the "set of all primes", like how the integers are Z, rationals are Q, etc?
02:27:03<Saizan>Olathe: ap
02:27:14<necroforest>or \mathbb{Z}, \mathbb{Q}
02:27:24<vixey>necroforest: not that I know of
02:27:42<necroforest>well i shall start one then
02:27:58<necroforest>let \mathbb{P} be the set of all primes
02:35:03<kadaver_>how can you let 2 things in a lambdabot expr?
02:36:52<ivanm>> let x = 1; y = 2 in x + y
02:36:53<lambdabot> 3
02:36:57<ivanm>kadaver_: ^^
02:43:16<HairyDude>hmm, it would appear -XOverlappingInstances doesn't affect type families.
02:44:36<monochrom>If you are paranoid, let {x=1;y=2} in x+y
02:44:55<monochrom>(necessary if you have that inside a do-block)
02:45:53<HairyDude>oh... looking at the manual, apparently you can overlap, but not in the way I'm doing it.
02:48:03<ivanm>monochrom: well, in a do-block do you actually use "in"?
02:48:54<dolio>Overlapping is unsound for type families, unless you declare all the instances in one place and resolve them a certain way, which isn't implemented yet.
02:49:11<ivanm>does anyone know if it's possible to have hlint not comment on redundant bracketing? I often put in extra brackets because IMHO, "(f x) > (g y)" looks nicer than "f x > g y" :s
02:52:45<monochrom>No, in a do-block we don't use "in", but we need { }.
02:53:25<ivanm>monochrom: or indenting?
02:53:48<monochrom>Yes but we are also talking about talking to lambdabot.
02:53:49<ivanm>you're scaring me here, making me think I've programmed everything wrong up until now! ;-)
02:53:53<ivanm>monochrom: ahhh, true
03:00:48<HairyDude>I was hoping to define an extensible class of set types, dispatching on the element type. so Set Int is Data.IntSet.IntSet and Ord a => Set a is Data.Set.Set
03:01:16<HairyDude>err, Data.Set.Set a of course
03:03:49<Smokey`>ACTION wonders why ghc packages are > 500mb
03:05:56<HairyDude>do they come bundled with lots of libraries?
03:07:35<defun>why does this form (somefunction >>= (return . otherfunction)) work, but this does not this form (somefunction >>= (return $ otherfunction))? Code snips here: (http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4475#a4475).
03:07:43<HairyDude>dolio: can you point me towards a demonstration that overlapping type instances isn't sound? all I can find is assertions
03:08:40<Olathe>defun: Because a $ b is the same as a b.
03:09:18<defun>And a . b can be thought of as... ?
03:09:28<Olathe>It means to do b, then a.
03:09:31<dolio>HairyDude: Suppose you have "type instance Foo a = Double" in one file, and in that file "foo :: Foo Int ; foo = 1.0". Then, in another file you have "type instance Foo Int = Int", and "bar :: Foo Int -> Int ; bar i = i".
03:09:40<defun>I see.
03:09:50<defun>Is this operator monadic in nature?
03:10:02<Olathe>Not really.
03:10:10<defun>I see.
03:10:22<defun>thanks.
03:10:26<Olathe>> ((+3) . (*2)) 5
03:10:27<lambdabot> 13
03:10:29<Olathe>You're welcome.
03:10:42<Olathe>> ((+b) . (*a)) 5
03:10:43<lambdabot> 5 * a + b
03:10:48<dolio>HairyDude: If you import both and call "bar foo" then it types fine, because foo :: Foo Int, and bar :: Foo Int -> Int, but that does the equivalent of "unsafeCoerce (1.0 :: Double) :: Int".
03:11:04<defun>:t (.)
03:11:05<lambdabot>forall b c a. (b -> c) -> (a -> b) -> a -> c
03:12:24<HairyDude>dolio: can't it check that some instance is already being used for Foo Int? in which case it would reject the second file's instance
03:13:16<dolio>Which one is it supposed to reject?
03:14:21<davidL>@pl \x -> (return $ boolStrToData)
03:14:21<lambdabot>const (return boolStrToData)
03:14:35<davidL>@pl \x -> (return $ boolStrToData x)
03:14:35<lambdabot>return . boolStrToData
03:14:42<HairyDude>the first file declares "type instance Foo a = Double" then "foo :: Foo Int; foo = 1.0". now implicitly there is an instance Foo Int = Double. if the second file tries to declare "type instance Foo Int = Int" it should fail
03:14:42<vixey>@w80 chrestomathy
03:14:45<lambdabot>No match for "chrestomathy".
03:15:08<dolio>Yes, but that's what disallowing overlapping instances means.
03:16:03<HairyDude>well not quite, because if you omit the definition of foo, there's still the possibility of a more specific instance for Foo Int. with it there, it's already been pinned down
03:16:07<SamB>@w80 chrestomancy
03:16:08<lambdabot>No match for "chrestomancy".
03:16:12<SamB>@google chrestomancy
03:16:13<lambdabot>No Result Found.
03:16:46<dolio>Oh, you mean overlapping should only fail if the more general instance is used somewhere?
03:16:54<SamB>@google chrestomanci
03:16:55<lambdabot>http://en.wikipedia.org/wiki/Chrestomanci
03:16:55<lambdabot>Title: Chrestomanci - Wikipedia, the free encyclopedia
03:17:00<SamB>there we go!
03:17:03<dolio>That might be fine, but it's a lot more work.
03:17:39<HairyDude>I can certainly understand it not working now, because it's still an experimental feature anyway :)
03:18:14<dolio>I mean, in that case, you could have one module declare the "Foo a" instance, and a second declare the "Foo Int" instance.
03:18:23<dolio>Importing both and using them in a third module would work fine.
03:18:45<dolio>But then if you import a fourth module that uses the "Foo a" instance at Int, it would cause your program to fail to compile.
03:19:42<dolio>So it makes things somewhat more fragile.
03:19:45<HairyDude>how does this work with ordinary classes? do you get the same kind of equivocation?
03:19:51<vixey>that's not it SamB :p
03:19:59<HairyDude>though not quite as critical since it's type safe
03:20:10<dolio>With normal classes, you just get inconsistent behavior. It doesn't defeat the type system.
03:20:14<HairyDude>right
03:20:52<dolio>Although overlapping instances there have their own oddities.
03:20:58<HairyDude>with overlapping type instances you get inconsistent behaviour at the type level, which is a Bad Thing. :)
03:21:40<SamB>vixey: well, that's what *I* was googling for
03:21:56<SamB>vixey: I thought maybe chrestomathy was a parody of that
03:22:14<HairyDude>ACTION wishes Haskell had ML's module system :)
03:22:17<dolio>Like, I think you can write "instance C a where foo = ..." "instance C Int where foo = ..." and then "bar :: a -> whatever ; bar a = foo a" and if you call foo with an Int, it will use the "C a" istance.
03:22:36<dolio>Because it's universally quantified, not constrained.
03:23:44<HairyDude>if you want the specific instance there you'd declare it "bar :: C a => a -> whatever" I suppose
03:23:53<HairyDude>cos then you get the dictionary
03:25:03<dmead>> let add a b = a + b in add == add
03:25:04<lambdabot> No instance for (Eq (a -> a -> a))
03:25:04<lambdabot> arising from a use of `==' at...
03:25:11<dolio>Hmm, doesn't seem to be working. Maybe you need existential types.
03:25:20<dolio>It definitely works with those.
03:25:20<dmead>can you test functions for equality, ever?
03:25:28<vixey>dmead: yeah sure
03:25:33<dmead>like how
03:25:43<vixey>say we have f, g : Bool -> Bool
03:25:53<dmead>k
03:26:22<dmead>> foldr == foldr
03:26:23<lambdabot> No instance for (Eq ((a -> b -> b) -> b -> [a] -> b))
03:26:23<lambdabot> arising fr...
03:26:37<Cale>dmead: There's no instance of Eq, of course.
03:26:52<dmead>i guess you couldn't really make one either
03:26:53<dmead>woops
03:26:57<Cale>dmead: But for functions with specific domains and codomains we can construct equality tests
03:27:04<dmead>right
03:27:27<blackh>m forgiving you. Please go and play club penguin with your sister. Please. I'm begging you! I wiill go and do that right now, don't youm worry. You have
03:27:52<HairyDude>instance Eq (Bool -> Bool) where f == g = (f True == g True) && (f False == g False)
03:27:58<roconnor>or functions of type (Nat -> Bool) -> Integer
03:28:01<Cale>Surprisingly, there are infinite types T for which functions of type T -> X can be compared for equality (provided we can assume they are total functions)
03:28:11<roconnor>or really any functions whose domain is compact.
03:28:11<dmead>hmm!
03:28:21<HairyDude>in fact instance Eq b => Eq (Bool -> b) where <same as above>
03:29:57<roconnor>instance Eq b => Eq (Nat -> Bool) -> b where <complex instance>
03:30:14<HairyDude>that would be an inductive proof?
03:30:33<dmead>doesn't have to be
03:30:43<roconnor>equal :: Eq y => (Cantor -> y) -> (Cantor -> y) -> Bool
03:30:45<dolio>Anyhow, OverlappingInstances + ExistentialQuantification = IncoherentInstances, more or less.
03:30:50<roconnor>equal f g = forevery(\a -> f a == g a)
03:31:04<roconnor>forevery p = not(forsome(\a -> not(p a)))
03:31:11<roconnor>forsome p = p(find(\a -> p a))
03:32:01<roconnor>> find_i :: (Cantor -> Bool) -> Cantor
03:32:01<lambdabot> Not in scope: `find_i' Not in scope: type constructor or class `Cantor' ...
03:32:01<roconnor>> find_i p = if forsome(\a -> p(Zero # a))
03:32:02<lambdabot> <no location info>: parse error on input `='
03:32:03<roconnor>> then Zero # find_i(\a -> p(Zero # a))
03:32:04<lambdabot> <no location info>: parse error on input `then'
03:32:04<roconnor>> else One # find_i(\a -> p(One # a))
03:32:05<lambdabot> <no location info>: parse error on input `else'
03:32:10<roconnor>http://math.andrej.com/2007/09/28/seemingly-impossible-functional-programs/
03:33:24<vixey>that forevery p = not(forsome(\a -> not(p a)))
03:33:27<vixey>is soooo clevel :)
03:41:05<HairyDude>oh great, libghc6-fgl-doc depends on strictly older versions of ghc6-doc than are available in the repos.
03:42:03<jackdaw>i had something like that on arch for ab it
03:42:17<HairyDude>ab it?
03:42:46<HairyDude>it doesn't help that the paper describing fgl is hopelessly out of date.
03:43:59<jackdaw>a bit
03:44:14<HairyDude>oh, I see. it uses the name "Gr" instead of "Graph"
03:44:15<jackdaw>i'm trying to go from three to four finger touch typing
03:46:28<Cale>HairyDude: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fgl
03:46:53<Cale>(docs are linked from there)
03:47:24<HairyDude>yes, I know. but haddock docs aren't that helpful in understanding how it works
03:47:25<Cale>Generally I prefer to cabal-install all the Haskell libraries I'm using, as the debian/ubuntu packages are always hopelessly out of date.
03:47:40<Cale>hmm
03:47:58<Cale>What are you wondering about how to do?
03:48:10<vixey>jackdaw change your keyboard layout
03:51:35<gwern>@quote phantom
03:51:35<lambdabot>DavidRoundy says: With a higher-kinded monad and phantom existential witness types, darcs would be very fun... (not that it isn't already...)
03:53:03<vixey>hey gwern
03:53:28<vixey>gwern, chrestomathy
03:54:57<kadaver>are arrays really O(1)?
03:55:03<kadaver>haskell arrays
03:55:13<HairyDude>also, hoogle doesn't know about fgl.
03:55:17<HairyDude>kadaver: yes
03:55:47<HairyDude>kadaver: lists aren't, though
03:56:09<roconnor>kadaver: not really, but neither are C arrays
03:56:22<roconnor>kadaver: they are limited to less than 2^64 entries
03:56:26<HairyDude>how do I tell my local hoogle about fgl?
03:56:43<HairyDude>roconnor: in what sense are they not O(1)?
03:57:30<roconnor>HairyDude: they can't grow arbitrarily large, so the whole O notation makes no sense for it
03:57:34<kmeyer>anyone familiar with the "Visitor" model? I feel like this ties into monads or monoids or functors somehow, but I'm not exactly sure...
03:57:40<Cale>There's no way to have an indexed datastructure where lookup is better than O(log n) -- it takes at least O(log n) time just to examine all the bits of the index.
03:57:41<roconnor>if they could grow arbitrarily large, they would no longer be O(1)
03:57:41<HairyDude>ah, right
03:58:12<andresj>so i am using a do block on the EventM monad (gtk2hs); I have (do canvas <- eventWindow; window <- widgetGetDrawWindow canvas; otherStatements; return True) I know the second statement is wrong (ill say the types in a bit) but I don't know how to fix it.
03:58:31<andresj>eventWindow :: EventM any DrawWindow
03:58:38<Axman6>kmeyer: i am, sort of. i couldn't see any relation though :\
03:58:51<andresj>widgetGetDrawWindow :: (WidgetClass widget) => widget -> IO DrawWindow
03:58:52<Axman6>seems a very strongly object oriented model to me
03:58:57<HairyDude>I imagine kadaver meant "constant time lookup" which I think they are.
03:59:06<Cale>Try window <- lift (widgetGetDrawWindow canvas)
03:59:10<Cale>or...
03:59:13<Cale>Try window <- liftIO (widgetGetDrawWindow canvas)
03:59:34<kmeyer>Axman6: well, the concept of applying a function to every node in a data type without caring about the structure of the data type
03:59:40<kadaver>ok but static arrays are O(1)
03:59:48<kmeyer>fmap or something
03:59:54<Cale>kadaver: If you ignore the log factor, yes :)
03:59:55<Axman6>kmeyer: sounds like Functor then
04:00:04<kmeyer>ok :)
04:00:32<Cale>kadaver: Or if you assume they're bounded in size.
04:00:45<Axman6>when we were learnig about visitors at uni this semester, i was trying to relate them to haskell, and couldn't see an easy way of doing it
04:00:47<Cale>(which kind of makes asymptotic questions meaningles)
04:00:52<Cale>meaningless*
04:01:05<HairyDude>"do something" doesn't particularly make sense in a functional context
04:01:17<Cale>Axman6: maybe Data.Traversable is what you're looking for?
04:01:27<andresj>Cale: thank you, but i still get errors: No instance for (Graphics.UI.Gtk.Types.WidgetClass Graphics.UI.Gtk.Types.DrawWindow) arising from a use of `widgetGetDrawWindow' at Main.hs:29:54-79
04:01:29<Axman6>Cale: you mean kmeyer?
04:01:37<gwern>vixey: 'a collection of choice literary passages, used especially as an aid in learning a foreign language.'
04:01:53<Cale>Axman6: Well, I just read your comment about not being able to relate visitor patterns to Haskell.
04:01:54<Axman6>but yeah, sounds about right, i don't know much (or anything really) about Data.Traversable
04:02:06<HairyDude>"applying a function" implies the question "what happens to the result?"
04:02:11<andresj>Cale: or maybe im just using the library wrong and the error has nothing to do with the Monad complexities...
04:02:17<jackdaw>i was kind of hoping that the tunes.org link was a haskell themed webradio station :(
04:02:18<andresj>i mean, this new one
04:02:22<Cale>:t Data.Traversable.for
04:02:22<lambdabot>forall (t :: * -> *) a (f :: * -> *) b. (Applicative f, Data.Traversable.Traversable t) => t a -> (a -> f b) -> f (t b)
04:02:40<HairyDude>ah, I haven't looked at Traversable
04:02:45<HairyDude>there's Foldable as well
04:03:45<kmeyer>HairyDude: right, I'm assuming it's functional and the result is just a new data type of the resultant type, but with the same structure
04:03:55<HairyDude>correct
04:03:55<Cale>andresj: I think it's complaining that the DrawWindow isn't a Widget?
04:04:10<HairyDude>in fact, that's what the functor laws mean.
04:04:16<andresj>Cale: yes, but im pretty sure it is...
04:04:22<Cale>hmm
04:05:02<andresj>although the docs http://haskell.org/gtk2hs/docs/devel/Graphics-UI-Gtk-Gdk-DrawWindow.html doesnt hint at it, so maybe im wrong
04:05:59<Cale>andresj: If you load the relevant modules up in GHCi and :info Graphics.UI.Gtk.Types.WidgetClass you should get a list of instances...
04:06:25<andresj>oh really? thank you Cale! I never knew that, haha
04:06:27<kmeyer>HairyDude: see, that's why I thought of #haskell :)
04:06:36<HairyDude>:)
04:06:37<kmeyer>my memory of typeclassopaedia isn't as sharp as it should be
04:06:49<Cale>andresj: You can also :info Graphics.UI.Gtk.Types.DrawWindow
04:06:58<povman>@hoogle (Monad m) => m a -> m ()
04:06:58<lambdabot>Control.Monad forever :: Monad m => m a -> m ()
04:06:58<lambdabot>Control.Monad replicateM_ :: Monad m => Int -> m a -> m ()
04:06:58<lambdabot>Prelude sequence_ :: Monad m => [m a] -> m ()
04:07:24<HairyDude>#haskell is nice, because it's a collection of people who are ready to have their brains picked :)
04:07:37<Cale>andresj: Oh! The canvas *already* is a DrawWindow
04:07:54<Cale>andresj: So you don't have to use widgetGetDrawWindow at all.
04:08:23<andresj>hum, apparently its a DrawableClass, and a—lol what—oh really? wow, i thought of that@the beginning but then i passed it out, lol; thank you, ill try that :)
04:08:55<wli>ACTION is running out of 32-bit address space.
04:09:08<glguy>someone should invent a processor with more address space
04:09:24<HairyDude>like a 64 bit one?
04:09:43<wli>It's preventing my Project Euler solution from running overnight.
04:09:59<glguy>the project euler rules prevent your solution from running overnight :)
04:10:12<wli>Yes, better hardware would let it complete.
04:10:30<andresj>WOW!! It worked! hahaha thank you Cale! much appreciate help :)
04:10:39<Cale>andresj: no problem :)
04:10:49<HairyDude>anyone know how to tell my local copy of hoogle about fgl?
04:10:52<wli>I don't have better hardware and it's not proper to let it run so long anyway.
04:10:58<glguy>wli, what problem?
04:11:05<wli>#216
04:11:38<wli>I'm sieving vaguely Eratosthenes -style but it's still not quite fast enough.
04:18:47<HairyDude>> let primes = 2 : filter (\n -> all (\p -> n `mod` p /= 0) (takeWhile (<= (n `div` 2)) primes)) [3..] in primes
04:18:48<lambdabot> [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101...
04:19:25<dufflebunk>wli: No project euler problem should need to run for more than a few minutes... all the ones I've done have taken less than a few minutes
04:19:57<wli>dufflebunk: Yes. That's part of why I'm not done.
04:22:27<wli>http://wli.pastebin.com/m69277a6a <-- what I've got thus far
04:23:18<kadaver>haskell is dead! long live ocaml!
04:25:43<Eridius>o_O
04:26:58<necroforest>haskell isn't dead
04:27:01<necroforest>it just smells funny
04:32:32<kadaver>who works on ML?
04:33:41<dufflebunk>willb: wouldn't it be better to go the other way around? Find all primes < the limit, then see which satisfy the other condition?
04:33:44<kadaver>python!
04:33:57<clug>@echo testing
04:33:57<lambdabot>echo; msg:IrcMessage {msgServer = "freenode", msgLBName = "lambdabot", msgPrefix = "clug!n=a98sd@cpe-066-057-078-104.nc.res.rr.com", msgCommand = "PRIVMSG", msgParams = ["#haskell",":@echo testing"]}
04:33:57<lambdabot> rest:"testing"
04:37:37<clug>@echo \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\!ops please ban me....
04:37:37<lambdabot>echo; msg:IrcMessage {msgServer = "freenode", msgLBName = "lambdabot", msgPrefix = "clug!n=a98sd@cpe-066-057-078-104.nc.res.rr.com", msgCommand = "PRIVMSG", msgParams = ["#haskell",":@echo \\\\\\\\\\
04:37:37<lambdabot>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\!ops please ban me...."]} rest:"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\!
04:37:37<lambdabot>ops please ban me...."
04:37:40<clug>@echo \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\!ops please ban me.....
04:37:40<lambdabot>echo; msg:IrcMessage {msgServer = "freenode", msgLBName = "lambdabot", msgPrefix = "clug!n=a98sd@cpe-066-057-078-104.nc.res.rr.com", msgCommand = "PRIVMSG", msgParams = ["#haskell",":@echo \\\\\\\\\\
04:37:40<lambdabot>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\!ops please ban me....."]} rest:"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
04:37:42<lambdabot>!ops please ban me....."
04:39:15<vixey>clug that's interesting
04:39:29<vixey>how does that work?
04:39:49<vixey>oh I see it always does that
04:41:59<scutigera>read doesn't parse .918, suggestions on a real parser ?
04:43:27<MyCatVerbs>If you want to special-case just that one issue, )read . (\s -> case s of ('.' : rest) -> '0' : '.' : rest; _ -> s))
04:44:05<MyCatVerbs>Otherwise, Parsec is pretty civilised.
04:44:21<scutigera>good suggestion. I'd like to leave writing a parser combinator for sometime in the future - e.g. after I understand how IO works...
04:45:14<roconnor>> .918
04:45:15<lambdabot> <no location info>: parse error on input `.'
04:47:46<scutigera>strangely, it seems that I am _always_ writing a float parser for one reason or another.
04:47:52<MyCatVerbs>scutigera: the other suggestion would be to not accept .918 as a valid number, since no language other than BASIC actually accepts that. ;)
04:48:54<roconnor>> readFloat ".918"
04:49:00<lambdabot> []
04:49:08<roconnor>@type readFloat
04:49:17<scutigera>MyCatVerbs: well, that's why I'm always writing float parsers, to handle strange input of some sort.
04:49:18<lambdabot>forall a. (RealFrac a) => String -> [(a, String)]
04:49:25<roconnor>> readFloat "0.918"
04:49:28<lambdabot> [(0.918,"")]
04:49:44<MyCatVerbs>Okay, I'm wrong there. Both Python and dc accept .918, so I suppose Perl and a few others must too.
04:49:49<scutigera>roconnor: ding-ding-ding, we have a winner !
04:49:57<MyCatVerbs>Notably C doesn't, but whatever.
04:50:53<MyCatVerbs>scutigera: I'd just take the lazy route and special case it.
04:51:19<scutigera> Real.fromString(".918") -> SOME 0.918 : real option SML likes it too, but ML also prints negative numbers with ~, which is _very_ annoying
04:51:36<roconnor>> lexDigits ".918"
04:51:40<lambdabot> []
04:51:43<scutigera>MyCatVerbs: special casing in progress
04:52:49<MyCatVerbs>> let { readUglyFloat s@('.':_) = read $ '0' : s; readUglyFloat s@('-':'.':more) = read $ '-':'0':'.':more' readUglyFloat s = read s; } in map readUglyFloat ["0.9",".9","-0.9","-.9"]
04:52:50<lambdabot> <no location info>: parse error on input `='
04:53:02<MyCatVerbs> a
04:53:04<clug>@echo lol
04:53:04<lambdabot>echo; msg:IrcMessage {msgServer = "freenode", msgLBName = "lambdabot", msgPrefix = "clug!n=a98sd@cpe-066-057-078-104.nc.res.rr.com", msgCommand = "PRIVMSG", msgParams = ["#haskell",":@echo \SOH\SOH\
04:53:04<lambdabot>SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOHlol"]} rest:
04:53:04<lambdabot>"\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\SOH\
04:53:04<lambdabot>SOHlol"
04:53:06<clug>wth?
04:53:09<MyCatVerbs>Tarnation on a stick.
04:53:14<vixey>lol
04:53:28<vixey>SOH is the code for the last ascii char I think
04:53:28<scutigera>attack of the paste key ?
04:53:33<vixey>> ord '\SOH'
04:53:34<lambdabot> 1
04:53:37<MyCatVerbs>> let { readUglyFloat s@('.':_) = read $ '0' : s; readUglyFloat s@('-':'.':more) = read $ '-':'0':'.':more; readUglyFloat s = read s; } in map readUglyFloat ["0.9",".9","-0.9","-.9"]
04:53:39<lambdabot> [* Exception: Prelude.read: no parse
04:53:41<vixey>oh the first.. not the last
04:53:57<MyCatVerbs>> let { readUglyFloat s@('.':_) = read $ '0' : s; readUglyFloat s@('-':'.':more) = read $ '-':'0':'.':more; readUglyFloat s = read s; } in map readUglyFloat ["0.9",".9","-0.9","-.9"] :: [Float]
04:53:58<lambdabot> [0.9,0.9,-0.9,-0.9]
04:54:21<roconnor> let { readUglyFloat s@('.':_) = read $ '0' : s; readUglyFloat s@('-':'.':more) = read $ '-':'0':'.':more; readUglyFloat s = read s; } in map readUglyFloat ["0.9",".9","-0.9","-.9","Infinity","NaN"] :: [Float]
04:54:32<scutigera>MyCatVerbs: that's easy for you to type ;-)
04:54:35<roconnor>> let { readUglyFloat s@('.':_) = read $ '0' : s; readUglyFloat s@('-':'.':more) = read $ '-':'0':'.':more; readUglyFloat s = read s; } in map readUglyFloat ["0.9",".9","-0.9","-.9","Infinity","NaN"] :: [Float]
04:54:36<lambdabot> [0.9,0.9,-0.9,-0.9,Infinity,NaN]
04:55:33<MyCatVerbs>scutigera: well, it doesn't have to be typed more than once. ;P
04:55:56<scutigera>what's '$' for ? I was trying to find that the other day...
04:56:12<roconnor>> readFloat "-1"
04:56:14<lambdabot> []
04:56:16<roconnor>> readFloat "1"
04:56:18<lambdabot> [(1.0,"")]
04:56:21<roconnor>pfft
04:56:24<MyCatVerbs>scutigera: (f $ a) = f a.
04:56:25<roconnor>readFloat is crap
04:56:39<MyCatVerbs>scutigera: it just has a really low precedence, so that it tends to split expressions up.
04:57:19<MyCatVerbs>It's just to save on brackets. For example, (show $ '0':more) is the same as (show ('0':more)).
04:57:40<scutigera>MyCatVerbs: ohhh, so read $ '0' : s written as read '0' : s would evaluate read '0' first ?
04:57:42<MyCatVerbs>Er, parens, not brackets, sorry.
04:58:23<scutigera>mmmm...yummy syntactic sugar
04:58:33<dropdrive>I have a (very large) text file, with each line containing 6 integers. I want to read this file, and output the second and fourth columns as 4-bit integers. I want to do this as fast as possible; can anyone suggest packages for me to look at?
04:58:40<MyCatVerbs>scutigera: yes, function application binds really tightly, so (read '0' : more) gets parsed as ((read '0') : more), which is just a big pile of type mismatch fail. :)
04:58:51<dropdrive>Ack, as 32-bit integers (i.e. in binary).
04:59:15<MyCatVerbs>dropdrive: Data.ByteString and Data.Binary.
04:59:32<scutigera>MyCatVerbs: big, _steaming_ pile of type mismatch fail ! LOL
05:00:10<dropdrive>MyCatVerbs: Ah, that's what I'm looking at now. Thanks. And do you think something like this can be parallelized well to > 1 core?
05:00:46<clug>why doesn't lambdabot support any ctcp?
05:00:55<clug>You can't even version it
05:02:07<MyCatVerbs>dropdrive: I don't think so, no.
05:02:29<MyCatVerbs>Well actually you could, quite happily enough.
05:03:07<MyCatVerbs>It's trivial if the lines are all of fixed length, a little awkward if they're of variable length, and impossible if you don't have random access to the file.
05:04:10<MyCatVerbs>Plus it's very, very unlikely to gain anything from being done in parallel if the file is really large, as the processing time will be miniscule compared to how long it'll take to read the text off disk platters.
05:06:06<scutigera>dropdrive: any chance the data can be generated as a binary file ?
05:06:08<dropdrive>Okay, that makes sense. Ultimately, I want to write something that is customizable from the command line, e.g. ignore 1,2,3 columns, convert 4th column to 64-bit floats, and 10'th column to a 5-byte string, etc.
05:06:18<dropdrive>scutigera: No, it's legacy crap :)
05:08:27<scutigera>MyCatVerbs: special case successul, luckily there weren't any other "special" floats.
05:09:41<HairyDude>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4478
05:10:44<Cale>clug: It's a bot, and it doesn't have any code to respond to CTCP.
05:11:28<HairyDude>ACTION wonders what clug is up to
05:11:47<clug>Oh, I was trying to mess with the bot but it appears to ignore itself
05:12:01<clug>I did get it to call !ops though
05:12:44<HairyDude>ignoring itself would be a very sensible thing for it to do :)
05:13:04<Cale>http://picturesforsadchildren.com/ -- hehe
05:13:19<HairyDude>yeah, that's a good one
05:14:13<HairyDude>oh, you mean that specific strip. I meant the comic in general
05:17:52<MyCatVerbs>scutigera: eeeexcellent.
05:18:22<dropdrive>Is it easy to install Data.Binary in archlinux? Do I need to install from AUR, or is there an easier way?
05:19:07<MyCatVerbs>dropdrive: pacman -S cabal-install, and then just cabal install things by their names on hackage.
05:19:32<dropdrive>Thanks!
05:19:58<HairyDude>ah, I see, you have to insert the vertices first
05:28:18<araujo>no more firefox !
05:28:22<araujo>http://haskell.org/~luisfaraujo/haskell_browser.png
05:28:24<araujo>:)
05:28:50<Cale>araujo: fun :)
05:28:57<araujo>Cale, :)
05:29:10<araujo>just a few extra handy options , a nice way to extend it, and done :P
05:29:41<wks>What is the advantage over firefox?
05:29:59<araujo>wks, i hope ... that i get less crashes
05:30:02<araujo>mainly
05:30:15<araujo>plus ... haskell as the extension language
05:30:47<dolio>You can have both memory leaks *and* space leaks.
05:32:15<araujo>the simpler, the better .... and not many of those problems
05:32:21<scutigera>dolio: I've been trying to figure out space leaks, after all haskell has GC. Lazy causes many bytes of "promises" to be saved on the heap ?
05:32:40<araujo>i don't want to have a complete suite for my browser
05:32:48<araujo>i just usually check very simple pages
05:33:08<dolio>Space leak is usually meant as your algorithm taking more memory than expected.
05:33:26<jeffwheeler>I'm trying to collapse a [String -> Maybe Integer], but I'm running into problems; there seems to be a conflicting instance of Monoid, (Monoid b) => Monoid (a -> b).
05:33:27<dolio>In long running programs, though, you can leak memory by building up unevaluated stuff, yes.
05:33:35<jeffwheeler>Here's the code that's causing the problems: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4479#a4479
05:33:52<jeffwheeler>I know that mappend is very ugly right now, but I'm trying to get it to compile, first.
05:34:05<scutigera>dolio: so strict languages (with gc) can have space leaks, but not as (potentially) as bad as lazy ?
05:34:05<jeffwheeler>The verbosity makes it easier for me to understand until I can get it working.
05:34:16<Cale>jeffwheeler: Define a newtype, perhaps.
05:35:03<dolio>People usually have better intuition about how much memory an algorithm in a strict language will use, so they tend not to be surprised.
05:35:36<dolio>Like, if you compute a powerset (with lists) in a strict language, people expect it to use lots of memory.
05:36:21<dolio>However, in Haskell, you can write a powerset function that, when printed (say) the overall program should run in O(1) space.
05:36:39<dolio>However, a small tweak will make it eat memory instead.
05:37:15<dolio>Which would likely be described as a space leak. However, most people wouldn't describe the strict program as a space leak, since everyone expects it to eat memory.
05:39:31<dolio>It is, of course, possible to write code that leaks space in a lazy language beyond that which would be used in a strict language, of course.
05:40:08<dolio>Building up thunks is a potential cause.
05:40:51<scutigera>I get a little worried when I see things like "don't use foldl, use foldl', because foldl causes space leaks". Seem like a nasty problem, although RWH says not so much in practical terms.
05:41:15<scutigera>Meanwhile I'm using foldl :-)
05:43:57<dolio>I think the usual problem with foldl is stack overflows.
05:44:11<dolio>I guess if you have a big enough list, it could start to become a memory issue.
05:44:35<edwardk>scutigera: in general if you know you have 'productive corecursion' in your fold you can use foldr, then you don't have the stack worries, etc.
05:45:37<edwardk>foldl' has its place, but mostly when you fold with arithmetic operators. foldr is typically much better when the output is a data structure, especially if you'll only partially traverse it
05:47:00<Peaker>@src foldl'
05:47:00<lambdabot>foldl' f a [] = a
05:47:00<lambdabot>foldl' f a (x:xs) = let a' = f a x in a' `seq` foldl' f a' xs
05:47:52<Peaker>will this be right? seq x y = const y $! x ?
05:48:34<scutigera>Hah : $! ?
05:48:43<dolio>const y $! x = x `seq` const y x = x `seq` y
05:52:43<jeffwheeler>Cale: Using newtype seems to have worked, thanks; however, it seems to have complicated the code a lot, adding many Bars, etc. -- http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4479#a4480
05:53:26<jeffwheeler>And I'm not quite sure how to clean up mappend; I would expect to be able to do something like: = Bar $ \s -> (f s) `mappend` (g s), but Monoid Integer doesn't exist . . .
05:53:51<jeffwheeler>Why does Maybe's Monoid instance need the Maybe's type variable to be an instance of Monoid?
05:54:17<Peaker>@pl \s -> (f s) `mappend` (g s)
05:54:17<lambdabot>liftM2 mappend f g
05:54:47<jeffwheeler>Peaker: unfortunately, the original doesn't work like I want
05:55:25<Peaker>> Just 5 `mplus` Just 6
05:55:26<lambdabot> Just 5
05:55:31<Peaker>> Nothing `mplus` Just 6
05:55:32<lambdabot> Just 6
05:55:52<Peaker>@src (->) mappend
05:55:52<lambdabot>Source not found. My brain just exploded
05:56:51<Peaker>jeffwheeler: you could define an instance of MonadPlus (->)
05:57:05<Peaker>jeffwheeler: cause MonadPlus (Maybe a) seems to do what you'd like?
05:57:29<jeffwheeler>Peaker: MonadPlus is exactly what I wanted, and the Maybe instance works just like I'd like. I needn't implement my own.
05:57:32<jeffwheeler>Peaker: thanks :)
05:58:09<Peaker>jeffwheeler: but I don't think there's a (->) MonadPlus. You can of course use the function applicative to mplus the maybes
05:58:13<jeffwheeler>So, I suppose mappend tries to combine the values within two "Just"s, while mplus just gets the first one.
05:58:24<Peaker>jeffwheeler: yep
06:00:34<MyCatVerbs>> mappend (Nothing) (Nothing) :: Maybe (Sum Int)
06:00:35<lambdabot> Nothing
06:01:04<MyCatVerbs>> mconcat [Just (Sum 5),Nothing,Nothing,Just (Sum 11),Nothing] :: Maybe (Sum Int)
06:01:05<lambdabot> Just (Sum {getSum = 16})
06:01:37<Peaker>> msum [Just (Sum 5),Nothing,Nothing,Just (Sum 11),Nothing] :: Maybe (Sum Int)
06:01:38<lambdabot> Just (Sum {getSum = 5})
06:03:53<mreh>what type constructors other than (->), [] and (type1, ... typen) that are parameterised are there?
06:04:03<mreh>can I make my own?
06:04:10<vixey>yes you can
06:04:11<mreh>Maybe....
06:04:15<mreh>that's one isnt it
06:04:30<vixey>data Tree a = Leaf a | Branch (Tree a) (Tree a)
06:04:35<vixey>for example now there is a new one
06:04:42<mreh>so, type variables are always lowercase
06:06:05<Peaker>mreh: yeah
06:06:14<mreh>i remember in miranda, you use strings of asterisks
06:06:14<Peaker>mreh: their first letter, anyway
06:06:21<mreh>uuuugly
06:06:29<mreh>unary alphabet
06:06:42<Peaker>mreh: how old are you?
06:06:47<scutigera>I think I like the ML convention of type variables : 'a. The code is a little harder to read in haskell, thought not too bad.
06:06:48<mreh>22
06:06:52<Peaker>Miranda is like ancient? :)
06:07:05<mreh>my fp tutor is anchient
06:07:15<Peaker>scutigera: I think its a little easier, but matter of taste, probably
06:08:02<scutigera>Peaker: I'm getting used to it faster than I thought I would.
06:08:27<mreh>i think the makers of Haskell parted ways with Miranda's
06:08:31<mreh>at some point
06:09:17<edwardk>mreh: well, the miranda guy wouldn't let them make his language a standard basically
06:09:43<edwardk>mreh: so the haskell folks used it as a starting point for design, but had to make it deliberately different enough that folks wouldn't be confused at his request
06:10:05<mreh>there isnt alot different
06:10:12<Peaker>was Miranda a language by one guy?
06:10:35<edwardk>http://en.wikipedia.org/wiki/Miranda_(programming_language)
06:10:37<mreh>* ** *** **** ***** etc for type variables is the only difference I'm aware of
06:10:44<mreh>oh, and comments you use ||
06:11:04<edwardk>david turner had a little company selling miranda to corporate users at the time haskell was getting started
06:11:04<Peaker>Cale: do you remember the mfoldr/append MList problem?
06:11:21<Peaker>mreh: type-classes didn't exist in Miranda, I'm pretty sure
06:11:50<mreh>oh yes, that's true also
06:11:56<edwardk>typeclasses were a "wadlerism", created for haskell
06:12:03<Cale>Peaker: Yeah, I was really tired at the time though.
06:12:06<mreh>0.o
06:12:14<mreh>Wadlerism
06:13:24<Cale>There's a fair amount of difference, especially by this point... though Haskell was designed as an open version of what Miranda was.
06:13:35<Peaker>list comprehensions originated in Miranda?
06:13:36<edwardk>ACTION is looking for a good name for a zipper which has a big consecutive gap rather than a single value hole. right now i'm just referring to it as a 'gapped' structure
06:13:59<mreh>value-hole
06:14:05<mreh>is that a technical tern
06:14:08<mreh>term*
06:14:15<edwardk>single-value hole
06:14:19<vixey>"two zippers"
06:14:25<edwardk>one-hole context.
06:14:54<Peaker>Cale: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4481#a4481 -- do you think it is possible to define append in terms of mfoldr rather than mfoldr', or possible to define either of mfoldr/mfoldr' in terms of the other?
06:15:25<edwardk>vixey: well, its the left fox derivative of a right fox derivative (or vice versa) so the zippers aren't in general position
06:16:49<edwardk>vixey: and its over a GADT based applicative, where i basically simplify everything to 'pure' functions in the gap, yielding a monoid, that knows how to sew up the edges of those fox holes.
06:16:52<mreh>do type constructors have the same precendence as function application?
06:17:08<vixey>Call it a warren!
06:17:13<Cale>mreh: yes
06:17:13<edwardk>vixey: hahahaha
06:17:50<Cale>Peaker: hmm, that seems like a tricky question. When I tried it, it seemed that the order of execution was hard to get right.
06:18:04<edwardk>i suppose 'fox hole' isn't even that bad ;)
06:18:08<mreh>how do i do local type definitions with lambdabot
06:18:41<mreh>> data MyInt = Zero | Suc MyInt
06:18:43<lambdabot> <no location info>: parse error on input `data'
06:18:52<Cale>mreh: You put them in a file and load it.
06:19:00<Peaker>Cale: yeah - I accidentally make the whole thing "strict" (in the sense of executing all of the mlist actions before getting any given action done)
06:19:57<Cale>Peaker: I think because mfoldr doesn't necessarily produce an MList, it's impossible to avoid running those actions prematurely.
06:20:48<mreh>> Maybe Maybe Maybe "Hello"
06:20:49<lambdabot> Not in scope: data constructor `Maybe'Not in scope: data constructor `Maybe...
06:21:49<Peaker>Cale: if the consFunc executes the rhs arg before executing its own thing - it will execute the whole mlist
06:25:39<wks>> Just "Hello"
06:25:40<lambdabot> Just "Hello"
06:26:14<Peaker>Cale: so if I use the (m b) in consFunc to be sort of an accumulator -- then it forces me to execute it first, which forces the whole mlist
06:26:16<mreh>> Just Just Just "Hello"
06:26:17<lambdabot> Couldn't match expected type `(a -> Maybe a) -> [Char] -> t'
06:26:34<mreh>0.o
06:26:34<jeffwheeler>> Just $ Just $ Just "Hello"
06:26:35<lambdabot> Just (Just (Just "Hello"))
06:26:39<vixey>> iterate Just "Hello"
06:26:39<mreh>right
06:26:40<lambdabot> Occurs check: cannot construct the infinite type: a = Maybe a
06:26:40<lambdabot> Ex...
06:26:49<jeffwheeler>> fix Just
06:26:50<lambdabot> Occurs check: cannot construct the infinite type: a = Maybe a
06:26:50<lambdabot> Ex...
06:27:15<Cale>> Just . Just . Just $ "Hello"
06:27:17<lambdabot> Just (Just (Just "Hello"))
06:27:38<mreh>I like Cale's better
06:27:53<jeffwheeler>Mine's shorter, though. ;)
06:28:16<mreh>but it's smelly
06:28:22<jeffwheeler>Indeed.
06:28:43<jeffwheeler>I like Yi's unicode for composition; it has a middle dot character.
06:28:48<mreh>code smell is obviously an expression of a programmers inability to express themselves
06:29:08<mreh>OH RLY?!
06:29:15<jeffwheeler>Mhmm. It's purty.
06:29:23<vixey>ACTION uses that too
06:29:43<jeffwheeler>> Just · Just · Just $ "Hello"
06:29:43<lambdabot> Not in scope: `·'Not in scope: `·'
06:29:47<jeffwheeler>:(
06:30:12<jeffwheeler>I thought GHC accepted the Unicode ones . . .
06:30:46<wli>I'm seeing almost none of the primes' residues collide, so my queue is getting huge as things progress.
06:30:48<mreh>how does it know you're typing a . instead of a middle dot
06:30:52<Cale>jeffwheeler: It allows unicode names, it doesn't mean that they're defined in the Prelude...
06:31:18<mreh>put . = ·
06:31:20<jeffwheeler>Cale: yeah; some of the common things are defined as Unicode, though, right? I think -> is
06:31:34<mreh>is there a unicode lambda?
06:31:42<Cale>Oh, if it accepts that, it would be because -> is not the name of a function.
06:31:51<vixey>mreh, There is the WHOLE greek alphabets
06:32:03<jeffwheeler>mreh: yep: λs → s ++ "test"
06:32:03<vixey>And it's got phi twice
06:32:25<Cale>I'm not sure we'd want to steal it for that... what if people want to use Greek identifiers?
06:32:59<Cale>Hmm, but if there's a special magic lambda somewhere...
06:33:56<mreh>do you memorise the unicodes for those characters?
06:34:01<Cale>𝜆
06:34:07<Peaker>I wish people wouldn't be able to start using foreign languages and symbols in their code..
06:34:15<jeffwheeler>mreh: Yi automatically renders the Unicode versions
06:34:18<Peaker>I like my ASCII, thank you
06:34:19<Cale>No, I have an IME which lets me type them.
06:34:34<RayNbow>7 bits ought to be enough for everyone, Peaker? :p
06:34:53<Cale>We could use the lambda I just provided, which is U+1D706 Mathematical Italic Small Lamda
06:35:15<MyCatVerbs>Cale: what font are you using that includes that codepoint?
06:35:19<Peaker>RayNbow: 7 bits per symbol ought to be enough for programmers writing code that English speakers understand..
06:35:40<Cale>MyCatVerbs: I don't know. I have pretty good unicode coverage provided by dozens of fonts...
06:35:56<wli>1.3 billion Chinese programmers can't be wrong. ;)
06:36:16<MyCatVerbs>1.3 billion ANYTHING can be very wrong indeed.
06:36:35<vixey>I would love to get an insight into programming in other cultures
06:36:54<MyCatVerbs>But I wouldn't argue with 1.3 gigaprogrammers at once. Discretion the better part of valour, etc.
06:37:31<Cale>I don't know about Chinese programmers, but I've been told Japanese programmers usually use (perhaps badly chosen) English identifiers.
06:37:44<RayNbow>> let löb x = fmap (\a -> a (löb x)) x in löb [length, \x->x!!0+x!!2, const 3]
06:37:45<lambdabot> [3,6,3]
06:37:55<vixey>yeah pretty much all the japanese code I saw is like that' with lots of japanese text in comments
06:38:08<wli>22655 singletons, 387 pairs, 27 triples, and 1 quadruple.
06:38:09<horms>map (\x -> "Wrong") [ 1 .. 13000000000 ]
06:38:31<jeffwheeler>> map (\x -> "Wrong") [ 1 .. 13000000000 ]
06:38:32<lambdabot> ["Wrong","Wrong","Wrong","Wrong","Wrong","Wrong","Wrong","Wrong","Wrong","W...
06:38:48<mreh>haha
06:38:49<Cale>There are some issues with using Chinese characters... in particular, there are some different characters which look identical or almost identical, and character conversion can happen differently on different systems possibly creating problems.
06:39:08<mreh>everyone in China looks the same
06:39:13<RayNbow>you should see the code of Dutch programmers... many beginners mix English and Dutch in some way :p
06:39:25<horms>there is also an issue of some codepoints mapping to different characters, depending on the dialect of Chinese in use (iirc)
06:39:40<wli>This suggests the queue is getting freaking huge. There may be a data structure problem.
06:39:42<CESSMASTER>jeffwheeler: are you sure you're using the right unicode symbol?
06:39:42<CESSMASTER>yeah i'm impressed, it doesn't show here
06:39:53<jeffwheeler>CESSMASTER: Which?
06:40:16<Cale>Though, you could get away with using kana.
06:40:16<CESSMASTER>jeffwheeler: composition
06:40:43<jeffwheeler>CESSMASTER: I copied/pasted from my terminal, so it's what Yi uses; I think it's the standard middle dot character
06:40:50<Peaker>Cale: Success! :-) http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4483#a4483
06:40:51<Cale>GHC should treat Katakana as uppercase, and Hiragana as lowercase for the purposes of identifiers. That would be nice :)
06:40:54<horms>surely the biggest problem with, for instance using the unicode lambda charcater, is people being able to type it in - i'm not sure how many people are set up to do that
06:41:23<Peaker>Cale: the secret was in "consFunc x rest = return . cons x . mmerge $ rest" -- weird that it works up simple, eventually
06:41:36<Cale>Peaker: hmmm...
06:41:46<Cale>Peaker: ah, interesting.
06:41:51<horms>eh, mixing katakana and hirugana like that would be very weird imho
06:41:54<wli>That's also a lot of distinct prime divisors.
06:41:55<Peaker>Cale: instead of executing the rhs arg of consFunc to give it to cons (thus executing the entire list) I embed the rhs action into the mlist's next with mmerge
06:42:09<horms>there isn't realy a concept of case in japanese, and thats a bizarre way to try and get around it
06:42:12<Cale>horms: Well, likely you'd just name dataconstructors entirely in katakana
06:42:24<horms>that would make more sense
06:42:25<Cale>horms: and variables in hiragana
06:42:41<horms>but it would still be a little wierd
06:43:15<Cale>I'm not sure it's any more strange than what we do with uppercase/lowercase distinction
06:44:04<horms>i'm prepared to buy that argument, though i don't agree
06:44:55<Cale>horms: Hmm...
06:45:23<horms>actually its kind of an interesting discussion
06:45:30<horms>but thinking about it
06:45:51<horms>the only times i have had trouble with regards to people being pedantic about using katakana
06:45:57<horms>is when dealing with the city office
06:46:15<horms>and thats tedium that is probably best not brought into this discussion
06:46:19<Cale>hehe
06:47:06<Cale>I'm curious what it was -- something about filling out forms?
06:47:26<horms>yes
06:47:32<horms>to cut a long story short
06:47:42<horms>if you have a name in romaji
06:47:52<horms>then legally it has to be written in katakana sometimes
06:47:55<horms>not hirugana
06:47:57<horms>or kanji
06:48:01<horms>or even romaji for that matter
06:48:05<Cale>Interesting.
06:48:15<horms>for instance
06:48:20<horms>when i got married
06:48:26<horms>and my wife took my surname
06:48:31<horms>her new name had to be in katakana
06:48:50<horms>(or we could go through a longer process of changing it to something else - though not something else in romaji)
06:49:13<horms>so you can say, my name is Mr. Fu
06:49:51<horms>and you may even choose to write that as 風
06:49:54<Cale>By romaji in this case, you mean anything written with roman letters, and not specifically a transliteration of something in Japanese.
06:50:20<horms>but you'll need to write it as フ on some forms
06:50:31<horms>and other times Fu
06:50:40<horms>sorry
06:50:44<Cale>Heh, I hope the forms specify :)
06:50:49<horms>by romaji i meant the English alphabet
06:51:02<Cale>I figured as much :)
06:51:27<horms>or specifically
06:51:37<horms>not katakana, hirugana or kanji
06:52:10<horms>actually, i didn't see that form
06:52:26<horms>but usually they do
06:52:47<horms>so in some legal sense hirugana and katakana are not interchanagble
06:53:02<horms>but that probably isn't relevant
06:53:42<Cale>Yeah, I've seen them used interchangeably in a lot of places just to make things stand out.
06:53:42<horms>to having type フ with constructor ふ
06:53:50<wli>Let's see how many distinct primes there are in 50K iterations.
06:54:02<horms>you have a point there
06:54:27<wli>11757 primes... interesting
07:04:30<wli>There must be almost no cases where more than 2 residues are eliminated for a given prime.
07:09:43<Peaker>I think introducing unicode into a language is a great way to fragment the developer base further -- causing even more code duplication than we already have
07:20:21<haskellnoob>I need a really fast sorting algorithm. Is a fast implementation of mergesort in Haskell available somewhere?
07:20:34<wli>Aha, I'm keeping track of primes larger than is strictly necessary.
07:21:33<bd_>haskellnoob: yes, it's called sort
07:21:38<bd_>@src sort
07:21:38<lambdabot>sort = sortBy compare
07:21:47<bd_>er, where was the source code link command
07:21:58<johnw>@src sortBy
07:21:58<lambdabot>sortBy cmp = foldr (insertBy cmp) []
07:22:02<bd_>haskellnoob: http://haskell.org/ghc/docs/latest/html/libraries/base/src/Data-List.html#sortBy
07:22:05<bd_>johnw: it lies
07:22:06<bd_>:)
07:22:13<bd_> @src gives the reference implementation
07:22:17<bd_>not the efficient implementation
07:22:22<johnw>ahh
07:22:26<wli>@src insertBy
07:22:27<lambdabot>insertBy _ x [] = [x]
07:22:27<lambdabot>insertBy cmp x ys@(y:ys') = case cmp x y of
07:22:27<lambdabot> GT -> y : insertBy cmp x ys'
07:22:27<lambdabot> _ -> x : ys
07:22:36<haskellnoob>bd_ : but does the built-in sort not use the usual list data structure, which is copied around and not modified in place? that would be too slow for me.
07:22:52<bd_>haskellnoob: have you benchmarked it?
07:23:53<bd_>I mean, you can go into ST and do a quicksort if you really want to. But figure out if the built-in one is fast enough for your needs first
07:24:20<haskellnoob>ok... but quicksort doesn't sort stably, does it? i need a stable sort as well.
07:24:45<bd_>It's possible to make a stable quicksort or a non-stable mergesort :)
07:25:20<haskellnoob>where can a get a fast, stable quick-or-merge sort? would i have to write one on my own?
07:25:36<bd_>haskellnoob: Is the built-in sort fast enough for you?
07:25:48<bd_>@check \l -> sortBy (compareBy fst) . map (\n -> (1, n)) l == l
07:25:49<lambdabot> Not in scope: `compareBy'
07:26:03<bd_>@check \l -> sortBy (\(a, _) (b, _) -> a `compare` b) . map (\n -> (1, n)) l == l
07:26:04<lambdabot> Couldn't match expected type `a -> [(t, t1)]'
07:26:19<bd_>@check \l -> (sortBy (\(a, _) (b, _) -> a `compare` b) $ map (\n -> (1, n)) l) == l
07:26:20<lambdabot> Occurs check: cannot construct the infinite type: a = (t, a)
07:26:20<lambdabot> Exp...
07:26:22<bd_>bleh
07:26:36<haskellnoob>bd_: i don't know, but i strongly suspect it is not fast enough for me. I could save some time by finding the fastest one that i can get to start with, is what i thought.
07:26:42<Renderwahn>depending on what you are sorting you can maybe use radix sort
07:27:15<Peaker>someone said (n+k) patterns are why Eq is required for Num, but it seems ordinary number patterns require this?
07:27:29<Peaker>@type let f 0 = 1 ; f _ = 2 in f
07:27:29<lambdabot>forall t t1. (Num t1, Num t) => t -> t1
07:27:31<haskellnoob>Renderwahn: that would require a lexicographic ordering, wouldn't it?
07:27:41<bd_>@check \l -> (sortBy (\(a, _) (b, _) -> a `compare` b) $ map (\n -> (1, n)) l) == map (\n -> (1, n)) l
07:27:42<lambdabot> "OK, passed 500 tests."
07:27:53<Peaker>it has to compare arg with (==) whereas ordinary pattern matching just has to match some specific constructor
07:28:03<bd_>haskellnoob: Er, I would suggest finding out it if the obvious thing is fast enough :)
07:28:20<bd_>You'll need to do the same work to validate whatever else if you don't end up using the built-in one after all
07:28:30<haskellnoob>bd_: ok, i will try that :)
07:28:37<wli>Peaker: I think it relies on a primitive case construct for built-in types like Int, Integer, Word, et al.
07:28:59<Peaker>wli: Surely it works on your own Num instances too
07:29:01<wli>Peaker: So it really shouldn't require Eq for those.
07:29:10<haskellnoob>bd_: but it would be good to know if would need to roll one on my own, or can depend on an existing, tested one.. for estimating how much work it is. hence my question
07:29:19<wli>Peaker: I'm not sure. I'd have to try it.
07:29:26<Peaker>wli: what I mean is that even if n+k patterns are removed, Num would still need an Eq instance
07:29:39<Peaker>and that there's an ugly pattern-match special case for nums :(
07:30:00<wli>Peaker: I think that requires some verification.
07:30:14<bd_>haskellnoob: I wouldn't know - I've always used the built-in one. And if there was a faster one I'm sure the GHC folks would love to include it in the standard distribution :)
07:30:18<haskellnoob>bd_: if the answer is not obvious (Something along the lines of "use the mergesort from the Boost library"), then that is fine. I just wanted to know that there is something that is common knowledge about fast sorting that i am not missing.
07:31:09<haskellnoob>also, how would i know if the built-in one is stable? is it documented somewhere?
07:31:27<johnw>haskellnoob: wouldn't a proper answer require us to foreknow the problem and to have already done the analysis?
07:31:41<bd_>-- | The 'sort' function implements a stable sorting algorithm.
07:31:47<bd_>^^^ from the documentation
07:32:16<haskellnoob>ok. thank you. let me try it and see!
07:34:31<Peaker>I think augustss played with a destructive in-place sort in IO or ST behind a purely functional interface -- and it was somewhat faster than the default sort
07:36:21<haskellnoob>Peaker: would you happen to know where to find this code?
07:38:22<Peaker>haskellnoob: I can't remember where it was
07:38:28<haskellnoob>ok. thank you.
07:39:13<wli>I could also try using just the smallest nontrivial prime divisor when such exists.
07:39:28<wli>That would spare the pain of the full factorization.
07:41:10<haskellnoob>how do I pick every other element from a list? pickEven [8,4,3,5,2] should evaluate to [8,3,2] .
07:41:30<haskellnoob>(should have been pickOdd, i guess)
07:42:21<wli>> let pickEven xs = [x | (x, k) <- zip xs [0..], even k] in pickEven [8, 4, 3, 5, 2]
07:42:23<lambdabot> [8,3,2]
07:43:46<jn>> let pickEven = map snd . filter (even . fst) . zip [0..] in pickEven [8,4,3,5,2]
07:43:47<lambdabot> [8,3,2]
07:45:24<wli>Well, I think I found a way to cut down space usage, at least.
07:46:26<vixey>> concat $ zipWith ($) (cycle [return,const []]) [8,4,3,5,2]
07:46:27<lambdabot> [8,3,2]
07:47:11<wli>ACTION doesn't subscribe to Golf Digest.
07:50:39<haskellnoob>pickEven (x:y:xs) = x : pickEven xs
07:50:40<johnw>i really like that solution, vixey
07:50:41<haskellnoob>pickEven x = x
07:51:56<zoheb>yes that was good
07:52:55<jn>haskellnoob: doesn't count. you need to traverse the list *at least* twice.
07:53:26<vixey>zoheb!!
07:53:36<zoheb>Hi vixey
07:53:44<zoheb>what tiime zone r u in
07:54:16<vixey>space time, 9 hundred hours incoming
07:54:36<zoheb>that was informative !!
07:55:31<zoheb>I am in space time too
07:55:43<zoheb>> map snd $ filter (odd.fst) $ zip [1..] [8,4,3,5,2]
07:55:44<lambdabot> [8,3,2]
07:55:49<zoheb>yahoo!!
07:56:18<zoheb>ok, thats the exact same ... as the one posted before
07:56:23<jn>ACTION sues
07:56:41<zoheb>so somebody somewhere thinks exactly like me
08:00:17<johnw>> let f x (y:ys) = if y < length x then x !! y : f x ys else []
08:00:18<lambdabot> <no location info>: parse error on input `;'
08:00:24<johnw>f [8,4,3,5,2] [0,2..]
08:01:21<beelsebob>> let f x (y:ys) = if y < length x then x !! y : f x ys else [] in f [8,4,3,5,2] [0,2..]
08:01:23<lambdabot> [8,3,2]
08:01:28<johnw>i thought there should be something like mapWith (!!) [0,2..] [8,4,3,5,2], but I couldn't find it
08:01:51<Peaker>johnw: do you mean zipWith?
08:01:52<beelsebob>there's also versions which aren't quadratic time
08:02:00<johnw>yeah, but the zipWith solution doesn't "stop"
08:02:07<SubStack>sure it does
08:02:08<johnw>zipWith (!!) (repeat [8,4,3,5,2]) [0,2..]
08:02:21<SubStack>just don't evaluate the whole result!
08:02:26<johnw>true
08:02:28<zoheb>@type !!
08:02:29<lambdabot>parse error on input `!!'
08:02:36<zoheb>@type (!!)
08:02:36<johnw>@type (!!)
08:02:37<lambdabot>forall a. [a] -> Int -> a
08:02:37<lambdabot>forall a. [a] -> Int -> a
08:02:57<zoheb>oh the index operator
08:03:26<Peaker>johnw: you can use zipWith after takeWhile
08:04:09<zoheb>Its 1 am here, quitting
08:04:13<zoheb>bye everyone
08:07:55<Peaker>> let f xs indices = zipWith (!!) xs $ takeWhile (<length xs) indices in f [5,4..1] [0,2..]
08:07:56<lambdabot> No instance for (Enum [a])
08:07:56<lambdabot> arising from the arithmetic sequence ...
08:08:04<johnw>why doesn't map (!!) [0,2..] return a list of partial applications?
08:08:09<QtPlaty[HireMe]>ACTION is pondering hacking on hUnit to product TAP output. "Would that e a desired thing?"
08:08:14<johnw>> map (!!) [0,2..]
08:08:15<lambdabot> Overlapping instances for Show (Int -> a)
08:08:15<lambdabot> arising from a use of ...
08:08:22<Peaker>johnw: it does
08:08:29<Peaker>@type map (!!) [0,2..]
08:08:30<lambdabot>forall a. (Enum [a], Num [a]) => [Int -> a]
08:08:49<johnw>in ghci I get No instance for (Enum [a])
08:08:50<johnw>hmm
08:08:52<Peaker>@type map (flip (!!)) [0,2..]
08:08:53<lambdabot>forall a. [[a] -> a]
08:08:55<johnw>maybe because i'm trying to print a function
08:09:06<Peaker>johnw: first arg of (!!) is a list, not the index
08:09:21<Peaker>johnw: if you flip (!!) its what you intended
08:09:25<johnw>thanks
08:10:14<Peaker>> let f xs indices = map (xs!!) $ takeWhile (<length xs) indices in f [5,4..1] [0,2..]
08:10:15<lambdabot> [5,3,1]
08:10:33<Peaker>more efficient to use drop repeatedly, probably
08:10:43<johnw>how do I apply a list of functions to a list of arguments again?
08:10:55<johnw>i'm hoogling as we spea
08:10:56<johnw>k
08:11:08<Peaker>johnw: zip-wise or cartesian-wise?
08:11:13<Jedai>johnw: zipWith ($)
08:11:18<johnw>ahh
08:11:34<Jedai>johnw: or liftM2 ($) if you want cartesian-wise
08:11:36<johnw>coming back to vixey's solution
08:12:19<Peaker>> let f xs n = map head . takeWhile (not . null) . iterate (drop n) $ xs in f [5,4..1] 2
08:12:20<lambdabot> [5,3,1]
08:13:11<Peaker>@type \f -> takeWhile (not . null) . iterate f
08:13:12<lambdabot>forall a. ([a] -> [a]) -> [a] -> [[a]]
08:13:29<Peaker>@type \f -> map head . takeWhile (not . null) . iterate f
08:13:30<lambdabot>forall a. ([a] -> [a]) -> [a] -> [a]
08:14:45<wli>I'm not really getting very many additional primes from factoring things. Maybe using only the smallest nontrivial prime divisor or no divisors at all with a more intelligent primality test would help.
08:28:03<Peaker>Haskell convention is to allow any type in when outputting a (). I am wondering if this is a good idea
08:28:11<Peaker>@type sequence_
08:28:12<lambdabot>forall (m :: * -> *) a. (Monad m) => [m a] -> m ()
08:28:22<Peaker>I mean, perhaps the type of sequence_ should be: (Monad m) => [m ()] -> m ()
08:28:52<Peaker>@type (<$)
08:28:53<lambdabot>forall a (f :: * -> *) b. (Functor f) => a -> f b -> f a
08:29:20<Peaker>@type sequence_ . map (()<$)
08:29:21<lambdabot>forall (f :: * -> *) b. (Functor f, Monad f) => [f b] -> f ()
08:29:50<Peaker>(You could always use ()<$ when you do want to throw away the value
08:30:01<Peaker>I guess in mlist I'll keep with the Haskell convention, even if it is a bad idea
08:30:43<wli>Yeah, factoring has almost no value.
08:32:31<wli>Almost all the useful primes come from when 2*n*n-1 is prime.
08:43:03<ski>Peaker : i've thought of that as well
08:50:16<zoheb>Hey vixey, I just created a fn inspired by your example
08:50:23<vixey>cool
08:50:27<vixey>what is it?
08:50:29<zoheb>(foldr1 (.) $ zipWith ($) (cycle [(:),const id]) $ [1..10] ) []
08:50:33<zoheb>>(foldr1 (.) $ zipWith ($) (cycle [(:),const id]) $ [1..10] ) []
08:50:43<zoheb>gotta leave
08:50:47<vixey>> (foldr1 (.) $ zipWith ($) (cycle [(:),const id]) $ [1..10] ) []
08:50:48<lambdabot> [1,3,5,7,9]
08:50:59<zoheb>bye
08:51:01<vixey>Ohh nice
09:03:51<cnwdup>Is there a function which marshals a haskell string into a "CU string"?
09:05:08<Peaker>@hoogle CU
09:05:08<lambdabot>Foreign.C.Types data CUChar
09:05:08<lambdabot>Foreign.C.Types data CUInt
09:05:08<lambdabot>Foreign.C.Types data CUIntMax
09:05:19<Peaker>What's a CU string?
09:05:31<Peaker>@hoogle utf8
09:05:31<lambdabot>package utf8-light
09:05:31<lambdabot>package utf8-string
09:05:31<lambdabot>Distribution.Simple.Utils fromUTF8 :: String -> String
09:05:34<cnwdup>:type withCString
09:05:43<cnwdup>@type withCString
09:05:44<lambdabot>Not in scope: `withCString'
09:05:49<Peaker>@hoogle withCString
09:05:49<lambdabot>Foreign.C.String withCString :: String -> (CString -> IO a) -> IO a
09:05:49<lambdabot>Foreign.C.String withCStringLen :: String -> (CStringLen -> IO a) -> IO a
09:06:06<Peaker>@hoogle CUString
09:06:07<lambdabot>No results found
09:06:07<cnwdup>withCString passes a (Ptr CChar) and I need a function which passes a (Ptr CUChar).
09:06:20<Peaker>@hoogle CUChar
09:06:20<lambdabot>Foreign.C.Types data CUChar
09:06:27<Peaker>is that an unsigned char?
09:06:33<cnwdup>Yes.
09:06:43<Peaker>cnwdup: I think maybe you can just coerce the ptr? signedness shouldn't matter
09:07:14<cnwdup>Peaker, okay. Thanks.
09:10:04<wli>I think this would be better as an imperative algorithm but card marking kills it.
09:20:46<Peaker>yay, my mlist is beginning to show signs of working properly :)
09:22:07<Axman6>bos: these sides from your talk are really nice and clear. I'll have to show them to a friend who i wow'd with my haskell skills today ;)
09:26:24<wli>I don't think anyone cares about my Haskell skills, not that I have any.
09:26:58<Axman6>bah, you amaze me with stuff you do all the time. i'm always totally lost and amazed :)
09:28:38<wli>I'm not any good. There are plenty of better people around the channel.
09:29:23<vixey>wli: I can do 5 monad transformers at once behind the back with a 360
09:31:09<Axman6>Velociraptors: o/
09:31:21<Velociraptors>allo :)
09:31:45<Axman6>i was wondering... have you actually tried any haskell yet? :P
09:32:06<Velociraptors>ACTION got a bit distracted
09:33:26<Axman6>dear me
09:33:40<Axman6>ACTION takes a Mac Plus hostage!
09:45:27<MrChutney>I have fallen in love with Haskell!
09:45:35<MrChutney>How did I not find out about this sooner?
09:46:33<Axman6>don't worry, we won't make fun of you for it ;)
09:46:38<Peaker>MrChutney: has Haskell fallen in love with you, too?
09:47:52<Peaker>can ST be threaded, or only IO?
09:49:15<Axman6>only IO afaik, but you could use ST in different IO threads though
09:51:24<liyang>ACTION wonders why no one has made ``My other car is a head'' bumper stickers. (And my other cdr is a tail.)
09:52:37<romildo>Hi.
09:53:08<romildo>When I get an error from gtk2hs, like (Gui:21404): Gtk-CRITICAL **: gtk_tree_view_set_cursor_on_cell: assertion `tree_view->priv->tree != NULL' failed
09:53:43<romildo>what is the number 21404 in (Gui:21404):
09:53:46<romildo>?
09:54:50<LeoD>a line number maybe?
09:56:00<romildo>LeoD, no, it is not a line number. Gui.hs has only 746 lines.
09:56:31<romildo>LeoD, at least in Gui.hs it is not a line number. Maybe in some other file?
09:56:43<LeoD>maybe it's in the C source
09:59:20<Gracenotes>hm, my IOArray quicksort isn't performing amazingly >_<
09:59:33<Gracenotes>ACTION tries it compiled
09:59:49<monadic_kid>@src Functor State
09:59:49<lambdabot>Source not found. Sorry about this, I know it's a bit silly.
10:00:08<monadic_kid>@src instance Functor State
10:00:08<lambdabot>Source not found. Are you on drugs?
10:00:24<monadic_kid>lambdabot: yes
10:00:32<monadic_kid>@botsnack
10:00:32<lambdabot>:)
10:00:32<lunabot> :)
10:02:49<Gracenotes>okay, 41 seconds for one million (Word64, Word64)s, sorting by the second
10:03:04<Gracenotes>ACTION wishes uvector wouldn't segfault ;_;
10:07:09<Athas>MultiParamTypeClasses and FunctionalDependencies are the best ever.
10:07:18<Athas>I could never write Haskell without those.
10:07:41<Athas>That was my daily excitement over those two extensions, thank you.
10:07:50<Gracenotes>oh, wow, using a better PRNG sped up my code x2
10:08:03<Gracenotes>almost
10:08:11<Gracenotes>o-o interesting
10:19:17<Peaker>Gracenotes: are you separating the time measurement of the sequence generation from the sorting?
10:21:44<Gracenotes>hm.. well.. generation time is 11% here.
10:22:18<Gracenotes>still, I'm trying to do the little optimizations that make quicksort a lot faster. maybe I should use some kind of introsort
10:22:32<Gracenotes>like I would be using if uvector wasn't segfaulting ;_;
10:22:58<Peaker>do you know why it segfaults?
10:23:38<Gracenotes>not sure. It seems to be the most innocent uses, like toU on a list
10:24:28<Peaker>I wish I could tell a refactoring tool -- express this function using this other function (e.g, rewrite a pattern match in terms of foldr, or such)
10:24:45<Peaker>Gracenotes: hmm.. debug it? :)
10:25:58<wli>ACTION continues to fail to speed up his PE#216 solution.
10:26:55<Gracenotes>Peaker: actually, the problem seems to be not the list itself but anything to do with using uvector IO or reading the list from a file
10:27:33<Gracenotes>even using unfoldU failed, with proper input
10:27:59<Peaker>@hoogle unfoldU
10:27:59<lambdabot>No results found
10:28:25<Gracenotes>how am I supposed to debug if it the code is so simple, there's no reason it shouldn't work? :\
10:28:48<Gracenotes>you can't exactly walkthrough "hPutU file (toU q)" in great detail
10:29:45<Gracenotes>I know it executes 2 or 3 times before just dying
10:32:10<Gracenotes>the only apparent variance is how many iterations it takes before it segfaults
10:32:31<Peaker>Gracenotes: look at the result assembly?
10:33:18<Gracenotes>heh. well, I don't know assembly that well
10:37:42<Peaker>is it safe to unsafePerformIO on newMVar?
10:40:05<wli>Hmm. An incredibly naive algorithm is running fast enough.
10:40:36<EvilTerran>wli, which one's PE216?
10:42:40<wli>Primes of the form 2*n^2-1 for 1 < n < 5*10^7
10:43:06<wli>Specifically counting the number of such primes.
10:44:48<EvilTerran>i see
10:48:35<wli>Just computing the intersection of two infinite ordered lists seems to work.
10:48:59<EvilTerran>snazzy
10:50:22<wli>I tried some more sophisticated things and got disastrous results.
10:57:06<wli>map (\p -> isqrt ((p + 1) `div` 2)) is slowing it down preposterously. Maybe isqrt is slow.
10:58:09<Peaker>@pl \p -> isqrt ((p + 1) `div` 2)
10:58:09<lambdabot>isqrt . (`div` 2) . (1 +)
11:01:57<Berengal>GUI programming is hard for weird reasons...
11:02:12<wli>Oh dear, I've not actually run the algorithm as it needed to be run.
11:02:52<Berengal>I can't make a "save as..." button
11:03:03<wli>I only ran it over about O(sqrt(searchspace))
11:03:06<Berengal>Apparantly a file chooser button can't save...
11:04:13<Peaker>yay - I put: mlist 0.0.2 out -- and now its really lazy, and has a "memo" that is pretty similar to lazy I/O
11:04:15<Peaker>@hoogle hGetLine
11:04:15<lambdabot>Data.ByteString hGetLine :: Handle -> IO ByteString
11:04:15<lambdabot>System.IO hGetLine :: Handle -> IO String
11:04:15<lambdabot>Data.ByteString.Char8 hGetLine :: Handle -> IO ByteString
11:04:23<Peaker>it shouldn't be
11:04:25<Peaker>is hGetLine lazy?
11:05:45<Peaker>Berengal: I don't think GUIs are intrinsically difficult
11:05:50<Peaker>Berengal: I think "save" is a stupid UI feature
11:06:14<Peaker>I think everything should always be saved by default, and revision control should be inherent in everything
11:06:43<Berengal>Peaker: Agreed on that point, but in this case it's not so much "save" as "create a new file, possibly overwriting an old one"
11:07:29<Berengal>Also, GUIs maybe aren't intrinsically difficult, but the documentation that usually exists tries to make it so
11:08:17<Berengal>Glade has been a saviour though. Far from the swing I had to hardcode back at uni.
11:08:26<Peaker>hGetLine is strict I/O and hGetContents is lazy. that's arbitrary and ugly :(
11:09:49<wli>hGetLine is most of what I use.
11:10:21<Peaker>wli: so maybe you can give me feedback about mlist which replaces lazy I/O? :)
11:10:41<wli>Peaker: wtf. is mlist?
11:10:57<Peaker>wli: do you know Python generators?
11:11:35<wli>In all honesty I've not paid attention to Python since before 2000 and I don't remember it having anything called generators.
11:11:57<Peaker>wli: well, MList is a list that's allowed to have side-effects in order to get the next elements
11:12:16<Berengal>Peaker: It forgets the previous element?
11:12:45<wli>Peaker: No big deal then.
11:12:52<Peaker>Berengal: yes, but you can use memo :: MList IO a -> IO (MList IO a) and then it doesn't
11:13:08<Peaker>Well, no more lazy I/O doing side effects as part of the evaluation
11:13:17<Berengal>Peaker: Awesome. I always wanted memoized generators in python. Well, since I got used to lazy evaluation anyway
11:13:30<Peaker>Berengal: Python has them too with itertools.tee
11:14:27<Berengal>Peaker: tee just forks them though, doesn't it?
11:15:24<Peaker>Berengal: yeah, but forking a generator lets you go forward and keep a current "ptr" at the same time, which is as good as memoizing
11:15:35<Peaker>Berengal: I think its equivalent to memoizing
11:15:47<Berengal>Except python generators can have side effects
11:15:53<Peaker>so can mlists
11:16:03<Berengal>Repeatedly?
11:16:04<Peaker>tee() prevents the side effects from re-occuring, and so does memo
11:16:26<Berengal>tee can do that? This is news to me
11:19:12<Berengal>Apparantly you're correct
11:19:15<Peaker>mlist is allowed to have side effects for each next element
11:20:26<Berengal>Yeah, I understood that was sort of the whole point
11:21:03<Peaker>so tee basically memoizes the parts of the generator that are still accessible
11:21:10<Peaker>by anyone else
11:21:47<Berengal>So is tee magic or just very clever?
11:22:01<Berengal>I'm guessing just clever
11:22:37<Peaker>Python exposes its internals so there's very little magic
11:23:17<Berengal>It seems like the iterators returned by tee just iterate over a lazy list produced by the argument iterator
11:23:33<Berengal>This has the side-effect of forcing the input generator though
11:24:07<Berengal>If something else's using that generator as well, tee will mess up
11:29:03<Peaker>Berengal: of course - if you want it not to - just tee before that
11:29:29<Peaker>Berengal: similarly with mlist memo, if you memo an mlist and someone else also uses that mlist they will both generate side effects to get the items
11:30:18<Berengal>Right
11:30:34<wli>I think the naive list intersection thing isn't working after all, though it's working far better than expected.
11:30:41<Berengal>I guess I'm just happy I don't have too much IO to deal with that can't be strict at the moment
11:31:35<Gracenotes>I'd TAPL that
11:31:40<Gracenotes>:|
11:33:59<Gracenotes>ACTION is going to take out House of Leaves from the library today
11:38:43<wli>The sieve's internal state grows out of control with the naive algorithm. :(
11:39:43<Peaker>Berengal: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4484#a4484 proves that Python's tee isn't magic (implemented it in Python)
11:40:38<Berengal>Yeah, that doesn't look too different from some lazy streams I implemented some time ago
11:51:58<lostman>haskell sux buahahahahahahhahahahahahahahahahahhahahahahahahahahahhahahahahahahahahah
11:53:11<mk15>Hi im trying to get the value out of an array...im using the function readArray which is of type "readArray :: (Ix i, MArray a e m) => a i e -> i -> m e". My question is how do I extract the "e"? My attempt so far is "let val = (\(m e) -> e) (readArray arr 1)"
11:55:29<MyCatVerbs>mk15: (readArray arr 1) on its own is what you need. No (\(m e) -> e) in sight.
11:55:59<Botje>mk15: readArray is for mutable arrays. If you are working with immutable arrays, arr ! index is what you want
11:56:52<Botje>> let arr = listArray (1,5) [ 6..10 ] in arr ! 2
11:56:53<lambdabot> 7
11:57:14<mk15>Botje: Im working with a mutable array
11:57:42<Botje>then you just need the readArray as MyCatVerbs said
12:00:01<Berengal>It turns out that once upon a time you COULD use a FileChooserButton to select non-existing files, but not anymore...
12:00:17<Berengal>Now I have to hack something together...
12:00:51<mk15>hmm ok ill look into this some more
12:10:03<wli>ACTION tries to come up with more ways to sieve.
12:10:21<wli>Or ways to sieve faster. Or something.
12:25:46<wli>Going back to lists instead of Sets helps a little on space usage.
12:26:31<wli>The sets were tiny and overlap was either rare or limited to numerous identical occurrences.
12:26:35<opqdonut>yeah, i find that Sets are very rarely worth the effort
12:27:24<wli>I find them plenty useful most of the rest of the time. This is actually the first time I've ever been so hard-pressed for space as to care about their space footprint.
12:32:20<wli>I'm literally hitting 32-bit address space limitations (and frankly that sort of space footprint would be a crippling slowdown on 64-bit too) so I've got to do something to cram it all in.
12:34:00<wli>It's taking well over 10 minutes to get to 10^6 and I've got to go to 50*10^6 so this is still not working out.
12:37:32<wli>I may need a faster primality test than trial division.
12:41:18<Botje>wli: you know about the improved sieve on haskell, right?
12:41:51<Botje>one which automatically skips all numbers divisible by 3,5 or 7, iirc
12:42:11<wli>The Eratosthenes code I have does that already.
12:42:18<Botje>okay :)
12:42:26<opqdonut>wli: using an array or merging lists or what?
12:42:48<wli>opqdonut: For the Project Euler problem or Eratosthenes?
12:42:57<opqdonut>erastothenes
12:43:07<opqdonut>i find that maintaining a "skip list" makes for a nice idiomatic sieve
12:43:14<opqdonut>of course it's not the real erastothenes
12:44:05<wli>The Eratosthenes I've got uses a priority queue and a wheel. It even saves wheel state.
12:44:29<opqdonut>ah
12:44:38<wli>That is, for each inserted prime.
12:44:52<opqdonut>yeah my skip list is basically a naive priority queue
12:47:41<lightstep>can Text.XHtml produce files with non-default encoding? i'm trying to give it utf-8 text, but get stuff like &#215;&#155;&#149; in the output
12:50:59<wli>I only use Data.Map
12:51:37<opqdonut>are there any nice functional heap implementations?
12:52:09<opqdonut> hmm, Data.Heap
12:52:11<igel>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/heap
12:52:20<opqdonut>ah, okasaki
12:53:17<wli>They might make more sense but Data.Map is easily accessible.
12:54:24<wli>The huge space overheads here are the queue for sieving the things I'm actually interested in and the Eratosthenes queue.
12:56:33<wli>There may also be some overheads for using Integer where Int would suffice.
12:59:06<wli>Hmm. I don't even have to think about where any of this could overflow.
13:01:27<wli>I might try switching everything over to Int with the same old structures just to see if it still works properly, then switch over to Int-specialized structures.
13:01:59<paul424>hi what do you think of learing haskell throught project euler ? the task looks nice but they are thery monotonic : like find all primes all fiind sum of primes such that ...
13:03:29<Stinger>monotonic or monotonous
13:03:36<wli>I only do PE to keep busy.
13:04:00<paul424>monotonous ;)
13:04:23<SamB>yeah, monotonic has some mathematical meanings
13:04:38<SamB>alone it just means "not going both up and down" ...
13:05:19<SamB>(because that's the one thing that all four meanings have in common)
13:07:36<Berengal>PE is okay for brain exercise.
13:08:34<xcthulhu>(increasing but not strictly increasing)
13:08:40<wli>ACTION converts over to Int-specialized everything.
13:08:44<xcthulhu>or decreasing but not strictly decreasing
13:09:13<SamB>ACTION is fairly certain that the Project Euler sequence is not monotonicly nondecreasing or monotonicly nonincreasing ;-P
13:09:42<necroforest>monotonically monotonous
13:09:56<xcthulhu>It roughly increases with difficulty
13:10:02<necroforest>monoton(ically ous)
13:10:23<SamB>(by the Project Euler sequence, I mean the sequence of answers, btw.)
13:10:51<Berengal>The later problems are of varying difficulty
13:13:04<wli>Hmm. I think it broke.
13:14:10<SamB>wli: that isn't too surprising!
13:16:54<wli>When the last thing you see out of it after converting it to Int everything is 32767, you know converting to Int everything broke it somehow.
13:17:33<SamB>yeah.
13:17:46<SamB>0x7fff isn't likely too relevant.
13:18:16<bidigo>Hi there, anybody uses multiple keyboard layouts with xmobar? If so, how do you show the currently active layout in xmobar?
13:18:46<SamB>bidigo: maybe that's an #xmonad question?
13:19:32<wli>> 2*32769^2-1 ::Int
13:19:34<lambdabot> 2147614721
13:19:49<wli>Well, here that's negative.
13:20:54<bidigo>SamB: you're right, I'll ask it there. thx
13:21:03<SamB>> bitSize (1 :: Int)
13:21:04<lambdabot> 64
13:21:12<SamB>wli: could that be why?
13:21:28<SamB>> 2*32769^2-1 :: Int32
13:21:29<lambdabot> -2147352575
13:21:35<SamB>I think it could
13:22:43<Tobsan>@src const
13:22:44<lambdabot>const x _ = x
13:22:53<wli>I may have trouble.
13:24:13<wli>Here bitSize (1 :: Int) is 32.
13:24:31<SamB>wli: I wouldn't exactly categorize that as trouble
13:24:41<SamB>I'm kinda used to having that ;-P
13:25:17<Berengal>> bitSize (1::Int64)
13:25:18<lambdabot> 64
13:25:46<SamB>ACTION isn't sure that Int64 is more time-efficient than Integer
13:25:55<Berengal>Me neither
13:26:04<wli>Well, I lose out on all the Int-specialized data structures if I don't find some way to keep almost everything as Int.
13:26:12<SamB>(on platforms where bitSize (1 :: Int) == 32, I mean)
13:26:35<Berengal>Yeah, I got that
13:27:07<SamB>because:
13:27:10<SamB>@src Integer
13:27:10<lambdabot>data Integer = S# Int#
13:27:10<lambdabot> | J# Int# ByteArray#
13:27:26<SamB>@src Int64
13:27:26<lambdabot>data Int64 = I64# Int64#
13:27:53<wli>The first thing that exploded on me was Eratosthenes since squares overflow very quickly.
13:28:08<SamB>and Int64, I think, has really lousy primops on 32-bit systems
13:28:19<SamB>compared to Int
13:28:28<SamB>(add #s as needed ;-p)
13:28:59<SamB>wli: well, you could upcast there
13:29:03<wli>For the most part you're hosed.
13:29:16<wli>Not if I'm using IntMap for a priority queue.
13:29:28<SamB>I mean, you don't store the squares do you ?
13:29:52<wli>You don't even start casting out until the square, which becomes the priority in the priority queue.
13:30:01<SamB>oh
13:30:07<SamB>sounds pretty crazy
13:30:25<wli>= x : sieve' xs (IntMap.insert (x*x) [map (x*) xs] table)
13:30:38<wli>Not interesting in the least.
13:31:08<igel>is using newtype Foo = Foo Bar slower than using Bar?
13:31:26<Berengal>igel: No
13:31:28<igel>especially for derived instances
13:31:32<SamB>igel: shouldn't be
13:31:40<igel>that's good :)
13:31:52<SamB>except Read/Show, of course ;-P
13:32:16<SamB>since they have to stick on that "Foo" constructor
13:32:23<SamB>and take it off
13:32:26<igel>not if "instance Show Foo where show (Foo x) = show x" right?
13:32:36<SamB>igel: that's not derived ;-)
13:32:41<igel>yep
13:33:15<SamB>also, I'd be doing that on showsPrec, not show
13:33:17<igel>i'm currently using typefamilies and newtypes to redefine Ord instances and the like
13:35:11<igel>and i was worried about the wrapping- unwrapping overhead
13:37:44<SamB>newtypes don't have any such overhead in actuality -- the thing is whether or not they confuse the optimizer ;-)
13:38:04<SamB>I'm not confinced they won't sometimes do that, but it should be mostly fine
13:39:55<SamB>and it should do a lot less harm to optimization than profiling does, that's for sure
13:41:36<SamB>ACTION sent in a kernel patch yesterday -- he sent it to x86@kernel.org
13:41:44<SamB>ACTION wonders who or what that is
13:42:04<igel>i'll have to test performance anyway
13:42:29<igel>everything looks much more complicated but it's a way more beautiful solution than before
13:42:45<SamB>igel: in short: in the machine code, there is no wrapping or unwrapping
13:43:09<SamB>but in the Core representation, there is, because that's typed
13:43:19<igel>that's what i was hoping
13:43:46<SamB>the Haskell standard basically requires that there be no wrapping or unwrapping at runtime
13:44:52<SamB>http://www.haskell.org/onlinereport/decls.html#sect4.2.3
13:45:04<SamB>(courtesy of http://www.haskell.org/haskellwiki/Newtype)
13:46:24<SamB>thankfully, it does not mandate that the optimizer not get confused by this ever ;-)
13:47:26<SamB>igel: but if you get any performance issues due to the optimizer getting confused by your newtypes, by all means report them!
13:47:42<igel>all i'm doing is using newtypes to be able to inverse the Ord of a type, the optimizer should be able to understand this...
13:47:51<igel>i will^^
13:49:12<SamB>(which of course involves manually rewriting the portion that appears to be insufficiently optimized with newtypes stripped)
13:50:14<SamB>(so you can compare the performance of the two versions)
13:50:21<wli>Okay, I think I hacked it to handle overflow at least some of the time.
13:50:54<SamB>wli: Linus would never let that into the kernel ;-P
13:51:36<wli>The memory footprint is preposterously reduced.
13:51:39<SamB>ACTION is glad his kernel patch is not supposed to have any impact on the actual kernel binary
13:51:51<SamB>wli: I mean with how confident you are that it's not buggy
13:52:41<wli>If it were something I were doing for work I'd be a lot more stressed out about how buggy and/or bugfree it is.
13:53:08<SamB>yeah.
13:53:50<SamB>my patch basically replaces "0" "VM86_SIGNAL" on one line
13:53:56<wli>The reduction in memory consumption is rather necessary in order to get this to actually be able to run since it's exhausting 32-bit address space otherwise.
13:54:07<SamB>because I got confused trying to un-stubify vm86(2)
13:54:37<SamB>wli: ah, yeah, that is kind of bad unless you happen to have a 64-bit CPU and kernel
13:54:58<SamB>and preferably a few gig of RAM
13:55:00<Berengal>Even with 64 bits you'd need more than 4GB of memory to really make use of it
13:55:12<SamB>well, ther *is* swap
13:55:14<Berengal>Once you hit swap, everything stops anyway
13:55:16<wli>Well, the space footprint is pretty catastrophic without resorting to whatever Int is on the platform.
13:55:33<SamB>Berengal: that's why I said "and preferably a few gig of RAM"
13:55:53<wli>64-bit would just not break down on the particular problem size.
13:56:15<wli>It's part of why these Project Euler problems aren't great problems.
13:56:31<Berengal>Yeah, 64 bits are usually enough
13:56:50<SamB>you mean they should break the same on 64-bit as on 32-bit ?
13:56:52<SamB>yeah, probably.
13:57:25<wli>Well, the "programming challenge" they're supposed to present is overflowing 32-bit integers in intermediate calculations.
13:57:45<wli>Most of the time Haskell blows this away by just using Integer everywhere.
13:58:07<SamB>I did also write a real sieve to use for some of them
13:58:23<SamB>with Array Int Bool
13:58:50<SamB>well, I guess I used {ST,IO}Array while doing the sieving
13:59:23<Berengal>I wrote a sieve in C once. Maybe I should go learn the FFI and bring that up to haskell...
13:59:33<Berengal>It was pretty fast if I recall
13:59:43<Berengal>And I used bits for bools
13:59:46<SamB>ACTION wishes man2html had an option to not act like a CGI script
13:59:58<wli>Yeah, I'm trying to avoid doing the ST/IO Array things because of the card marking problems.
14:00:25<Gracenotes>primes?
14:00:39<Gracenotes>Miller-Rabin isn't so bad (the probabilistic version)
14:00:46<olsner>Berengal: there's a shootout entry for that btw (bit-based prime sieve)
14:00:48<Gracenotes>er, deterministic, I mean
14:01:09<SamB>I actually solved one of those PE problems on my [sister's] Casio graphing calculator ;-P
14:01:18<SamB>well, mostly on paper I suppose
14:01:36<olsner>Berengal: depending on what you want to do, you could also play with rewriting that code using haskell arrays rather than FFI
14:02:12<SamB>Berengal: you don't have to write as much code to do that in Haskell
14:02:25<Berengal>olsner: Well, I'm usually well served by the one-liner list comprehension. I don't really have any motivation :P
14:02:44<SamB>the {ST,IO,}UArray are already bitpacked when storing Bool ;-)
14:03:08<SamB>(I tend to forget the U in conversation for some reason)
14:03:10<Berengal>Awesome, but if I did this it would be to learn FFI, not to get fast primes
14:03:22<SamB>okay then ;-)
14:03:22<wli>Can you actually mutate them without hitting bad card marking problems?
14:03:31<SamB>wli: bad card marking?
14:03:32<olsner>ah, for learning the FFI, writing it in haskell is useless :P
14:03:47<SamB>wli: I don't know what that means :-(
14:03:52<wli>SamB: The problems are bad. The card marking is nonexistant.
14:04:26<wli>SamB: The GC goes nuts on large arrays because it doesn't incrementally handle objects with high pointer fanout.
14:04:32<Berengal>olsner: I don't really have any reason to learn FFI yet either. For some reason though, whenever I want to learn something for it's own sake the meta-syntactic computation I use has something to do with primes ;)
14:04:54<SamB>wli: ur, I meant to say {ST,IO}UArray
14:05:07<olsner>heh, "meta-syntactic computation" :)
14:05:08<SamB>wli: now I think I know what you mean
14:05:14<SamB>yes, that is a problem
14:05:29<wli>SamB: Card marking is the name for incremental GC scanning of objects with high pointer fanout.
14:05:55<SamB>yes, and GHC ... doesn' do it incremantaly
14:06:26<olsner>but shouldn't it be "meta-semantic" or something? the meta-syntactic variables are, after all, meta-syntax
14:06:28<SamB>wli: but I meant to say {ST,IO}UArray in the first place, and that hasn't got high pointer fanout
14:07:08<wli>Because they're unboxed so the object has no embedded pointers.
14:07:20<Berengal>olsner: Hehe, yeah, I know. I just wasn't about to figure out what to really call it though. I guess placeholder computation is good enough...
14:07:20<olsner>ouch, ghc's rts' gc has poor handling of objects with many pointers?
14:07:41<SamB>olsner: apparantly it's just the mutable ones ...
14:07:45<SamB>http://hackage.haskell.org/trac/ghc/ticket/650
14:08:01<SamB>ACTION misses lambdabot
14:08:07<wli>olsner: Well, it's not incremental. "Poor" depending on the tradeoffs you care about.
14:08:15<EvilTerran>@bot
14:08:15<lunabot> :)
14:08:15<lambdabot>:)
14:08:30<olsner>it'd be nice to find some * to put in "meta-*ic computation", to point out the analogy to meta-syntactic variables
14:08:35<SamB>EvilTerran: I said that because she didn't give the title for that bug page
14:09:07<SamB>hah
14:09:12<SamB>they claim "1 day"
14:09:14<wli>I don't know why it would just be the mutable ones, but for some reason I think it's limited to such for reasons I don't know offhand.
14:09:50<SamB>wli: it well, they have to re-scan the whole thing when just one element gets changed, iirc
14:09:53<Berengal>wli: Something about some assumptions not holding for mutable structures
14:10:20<SamB>wli: read the ticket ?
14:10:24<wli>The all-Int version with overflow handling is only eating 19MB of RAM as opposed to running out of 32-bit address space.
14:10:36<SamB>wli: that's always nice ;-)
14:11:11<SamB>how in the world does it save that much RAM, though?
14:11:33<wli>OTOH it's not gotten very far in the search so it may yet explode. I'm also unsure of whether the answers are remotely correct once the potential overflow threshholds are blown past.
14:11:57<wli>SamB: IntMap/IntSet vs. Map/Set and Int vs. Integer for large collections.
14:12:02<SamB>which problem are you working on?
14:12:09<wli>216
14:12:26<SamB>wli: I still have trouble with the idea that IntMap/IntSet are so much better
14:12:36<olsner>heh, nice that we're using bottom as a bugtracker field value "milestone changed from 6.10 branch to _|_." :)
14:12:41<wli>I'm bombing it by virtue of algorithms too slow to get anything done in a reasonable amount of time.
14:13:02<wli>SamB: I've no idea why the difference should be quite that drastic.
14:13:39<SamB>why'd they have to go and split the list into pages?
14:13:58<SamB>wli: oh, I guess 0x7FFF was actually relevant to the problem ...
14:15:25<SamB>> 2*50000000^2-1
14:15:26<lambdabot> 4999999999999999
14:15:49<Berengal>> 2*50000000^2-1 :: Int
14:15:50<lambdabot> 4999999999999999
14:15:50<wli>SamB: Yeah, that's why.
14:15:57<Berengal>> 2*50000000^2-1 ::Int32
14:15:59<lambdabot> 937459711
14:16:22<SamB>I don't think that sieve is the right approach, somehow!
14:16:46<SamB>I would suggest a more probabalistic approach
14:16:47<wli>Which sieve?
14:16:58<SamB>well, perhaps no sieve!
14:18:17<SamB>I'd be thinking a probabalistic approach to primality testing would be appropriate here
14:18:40<Berengal>One of the first C programs I wrote found the first one million primes using a very simple test: choose a random number and check if it's coprime to the number tested, repeat a thousand times
14:18:57<Berengal>It was reasonable fast, and failed about 0.0003% of the time
14:19:02<blueonyx>hi, can someone give me a pointer how ghci loads code at runtime?
14:19:05<SamB>really?!?
14:19:10<wli>I don't know. IOUArray Int Bool seems like it may be a better idea here.
14:19:17<Berengal>SamB: Really
14:19:18<SamB>that's a bit surprising considering how stupid that sounds
14:20:08<SamB>hmm, I guess all of those failures were false positives, since there's no way to get a false negative ;-)
14:20:15<wli>Whenever I find quadratic residues cross them off, or something.
14:21:08<Berengal>SamB: Well, it might have been more than a thousand repeats... I found it spent about 5µs doing a thousand iterations, and about 1.5s to check using a more advanced algorithm I had hacked together. I might just have removed the advanced one, or I might also have upped the number of iterations for the fast one
14:21:19<SamB>anyway, if your program takes more than 5 minutes ... you should probably try a different algorithm
14:21:36<olsner>probably slightly OT in here, but what happened to ghc's move from darcs?
14:21:58<SamB>olsner: what was GHC moving to again?
14:22:17<wli>It's basically where n turns out to be the least residue of the inverse of 2 mod p.
14:22:42<wli>It's basically where n turns out to be the least residue of one of the square roots of the inverse of 2 mod p.
14:22:50<olsner>i read that they were supposed to move to git (a long time ago, maybe a year or so)
14:23:05<wli>Which is the same as the inverse of one of the square roots of 2 mod p.
14:23:17<SamB>olsner: maybe they forgot ?
14:24:08<SamB>what time zone is "UK time"?
14:24:21<SamB>ACTION is looking at http://hackage.haskell.org/trac/ghc/wiki/IRC_Meetings
14:24:52<SamB>ah, BST
14:24:54<olsner>ah, according to http://hackage.haskell.org/trac/ghc/wiki/Status/May09 it seems they added "fixing the build system" as a dependency for that task, and that some darcs problems were fixed meanwhile, so "it's not clear how high priority making this change is"
14:26:16<wli>For odd primes p, (p+1)/2 is an inverse of 2.
14:27:32<wli>If the least residue of (p+1)/2 is a perfect square, then you've found one of the primes you want.
14:29:05<EvilTerran>ACTION tries to work out why "I am not a Number, I am a Free Variable" is using this "data Stack x = Empty | Stack x :< x" type instead of []
14:29:18<EvilTerran>?go "I am not a Number, I am a Free Variable"
14:29:20<lambdabot>http://www.cs.nott.ac.uk/~ctm/notanum.ps.gz
14:30:22<olsner>EvilTerran: to differentiate lists used as stacks?
14:30:38<EvilTerran>thing is, it isn't really using them as stacks
14:30:54<wli>The bad news is that this doesn't find very many of the things you actually need to find.
14:33:37<jeffwheeler>I've got a package with several dependencies, of which one depends on another package. How can I list the dependencies of all my dependencies, to figure out which dependency has the last dependency.
14:33:42<jeffwheeler>Okay, that was rather cryptic.
14:33:44<wli>Or maybe it does... let's see.
14:34:14<jeffwheeler>My package depends on several, one depends on another. I can't seem to figure out how to find the dependency that depends on that other one . . .
14:34:35<edwardk>jeffwheeler: you have something that you don't want to depend on and you have no idea who the culprit is?
14:34:50<EvilTerran>olsner, and it isn't actually using [] *anywhere*, afaict
14:34:56<jeffwheeler>edwardk: rather, the bad package just upgraded and now depends on an older version of quickcheck
14:35:28<jeffwheeler>I'm fine depending on it, as long as it still lets people compile this package
14:36:12<edwardk>jeffwheeler: ah
14:37:04<wli>It seems to be taking a while to check for 1 < n < 10^4 (should be 2202 n such that 2*n^2-1 is prime).
14:38:07<edwardk>@seen augustss
14:38:07<lambdabot>augustss is in #haskell. I don't know when augustss last spoke.
14:38:39<olsner>EvilTerran: without really reading most of the paper, it seems it tries to make some point of it being a stack rather than something stack-like
14:40:21<wli>Starting from the primes is truly dogslow.
14:45:10<burp_>@src filter
14:45:10<lambdabot>filter _ [] = []
14:45:10<lambdabot>filter p (x:xs)
14:45:10<lambdabot> | p x = x : filter p xs
14:45:10<lambdabot> | otherwise = filter p xs
14:45:14<EvilTerran>olsner, yeah, i guess. i might ask conal about it by email sometime.
14:46:23<olsner>EvilTerran: it might be a convention borrowed from huet's zipper paper
14:46:59<EvilTerran>that's true. i'll look that up.
14:48:36<olsner>hmm, reading more about the darcs-migration of ghc, it seems to point out a lot of improper dependencies between ghc and libraries
14:49:06<SamB>there, I added a command to http://hackage.haskell.org/trac/ghc/wiki/IRC_Meetings to show when the next meeting is ;-)
14:49:55<SamB>olsner: if you're still wondering, you could try to attend the next meeting ;-)
14:50:20<SamB>I mean, I see you found out something
14:54:10<wli>5*10^7 bits is what... 5*10^4*5^3*2^3 bits so 5^4*10^4 Bytes, or 6.25*10^6 bytes, or 6.25MB, NFI how many MiB.
14:54:57<olsner>> 5*10^7 / 2^20
14:54:58<lambdabot> 47.6837158203125
14:55:17<olsner>> 5*10^7 / (2^20 * 8)
14:55:18<lambdabot> 5.9604644775390625
14:55:21<wli>> log (5*10^7)/log 2
14:55:22<lambdabot> 25.5754247590989
14:56:06<wli>Looks like a little over 4MiB.
14:56:41<olsner>I'd interpret the second line as telling us it's 5.96 MiB
14:57:04<olsner>(2^20 * 8) being the number of bits in a MiB
14:57:30<wli>Okay, 5.96MiB. No big deal.
14:58:06<Berengal>Curry me lambdas, if I didn't get the GUI to act like I wanted on the first try...
15:01:06<burp_>?src even
15:01:06<lambdabot>even n = n `rem` 2 == 0
15:01:09<burp_>?src odd
15:01:10<lambdabot>odd = not . even
15:01:57<burp_>?src mod
15:01:57<lambdabot>Source not found. There are some things that I just don't know.
15:02:12<burp_>what is the difference between rem and mod?
15:02:14<wli>Every time I find a solution of 2*n^2-1=0 mod p for some prime I can cross off two residues every time.
15:02:26<Berengal>> rem -4 8
15:02:27<lambdabot> No instance for (Num (a -> a -> a))
15:02:27<lambdabot> arising from a use of `-' at...
15:02:39<wli>So then it's a matter of scanning for the next unset bit.
15:02:39<edwardk>you know when you start using unsafeCoerce with StableName you might be going down the wrong path.
15:02:44<Tobsan>> rem (-4) 8
15:02:44<burp_>> rem (-4) 8
15:02:46<lambdabot> -4
15:02:46<lambdabot> -4
15:02:48<burp_>> mod (-4) 9
15:02:49<lambdabot> 5
15:02:50<burp_>> mod (-4) 8
15:02:51<lambdabot> 4
15:02:55<burp_>oh ok
15:03:13<ski>> -4 `rem` 8
15:03:14<lambdabot> -4
15:03:32<Berengal>Basically, quotRem and divMod are duals of eachother
15:04:39<ski>`rem' gives same sign as numerator, while `mod' gives same sign as denominator, iirc
15:04:53<Berengal>> mod 4 (-8)
15:04:54<lambdabot> -4
15:05:04<Berengal>> mod (-4) (-8)
15:05:05<lambdabot> -4
15:06:03<ski>(and `mod' is the one that usually is nicer, mathematically speaking, while `rem' usually have more direct hardware support)
15:07:18<ski>(if you do `mod n d' or `rem n d', you usually (ime) more often know the sign of `d' than the sign of `n')
15:07:48<ski>(of course, if both are non-negative, it doesn't matter, so `rem' can be used)
15:07:58<ski>> rem 4 0
15:08:00<lambdabot> * Exception: divide by zero
15:08:02<ski>> mod 4 0
15:08:03<lambdabot> * Exception: divide by zero
15:08:11<Berengal>> quoteRem (-4) 8
15:08:12<lambdabot> Not in scope: `quoteRem'
15:08:19<Berengal>> quotRem (-4) 8
15:08:20<lambdabot> (0,-4)
15:08:25<Berengal>> divMod (-4) 8
15:08:26<lambdabot> (-1,4)
15:08:32<ski>ACTION expects `mod n 0 = n' .. :/
15:09:09<Berengal>n >= 0, so n MOD 0 can't be n...
15:09:13<SamB>ACTION wishes his school's CS department's NFS server didn't have such a high per-file latency ...
15:09:17<Berengal>Well, abs n
15:09:20<ski>(s/both/both arguments/)
15:09:35<edwardk>worst typing dodge i've ever needed: lookup k (S m) = fmap unsafeCoerce ∙ Prelude.lookup (unsafeCoerce k) =<< IntMap.lookup (hashStableName k) m
15:09:37<ehird>16:08 ski expects `mod n 0 = n' .. :/ ← wat?!
15:09:40<burp_>filter even [1.100] <- is this the fastest way to get a list of all even numbers from 1 to 100?
15:09:53<ski>Berengal : imo `mod n d' should give a value `r' that is congruent to `n' modulo `d'
15:10:26<int-e>> [2,4..100]
15:10:27<lambdabot> [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,...
15:10:34<ski>and `n' is congruent to `r' modulo `0' if and only if `n' is the same as `r'
15:10:45<burp_>int-e, oh thats nice
15:11:14<burp_>I wonder if this boils down to the same
15:11:54<ski>`n' congruent to `r' modulo `d' means there exists an `k' such that `n - r = k * d'
15:11:55<wli>There has to be something beyond the search algorithm just being inefficient. Some lemma I'm missing on quadratic reciprocity or something.
15:12:19<ski>in the case above, you have `n - r = k * 0 = 0' which implies `n = r'
15:12:40<ski>so, if `mod n d' should return anything at all, it should return `n'
15:12:53<Berengal>But it doesn't return anything
15:12:58<EvilTerran>edwardk, O.o
15:13:02<ski>yes, but it ought to :)
15:13:17<mk15>Hi, if I use a do block in my function, does that imply that the function needs to return an action, or can I still return a value such as a Boolean
15:13:19<ski>> 0 * error "foo"
15:13:20<lambdabot> * Exception: foo
15:13:28<SamB>does anyone know how to forward their Unix mail without having to be able to edit /etc ?
15:13:53<int-e>burp_: no, the latter never generates the odd numbers in the first place.
15:14:06<p_l>SamB: Depends on the software you have in your system :)
15:14:52<edwardk>evilterran: i'm tracing through an applicative trying to pick up sharing information to extract a context-free-grammar, and needed some heavy duty lifting =)
15:15:07<SamB>no standard way, huh?
15:15:12<SamB>looks like sendmail :-(
15:15:30<int-e>SamB: if you're lucky you can just put an email address in .forward in your home directory.
15:15:49<SamB>int-e: will that leave those emails available locally too or not ?
15:16:26<p_l>SamB: You can use procmail to make more advanced rules
15:17:00<ski>> and [d `mult` (n `div` d) + (n `mod_` d) == n | n <- [-9 .. 9] , d <- [-9 .. 9]] where 0 `mult` _ = 0; _ `mult` 0 = 0; x `mult` y = x * y; n `mod_` 0 = n; n `mod_` d = n `mod` d
15:17:01<lambdabot> True
15:17:13<p_l>SamB: http://partmaps.org/era/procmail/mini-faq.html#forward-copy
15:17:27<dsfox>SamB: If .forward works your mails will not be available locally
15:17:49<int-e>SamB: you can keep a local copy by adding a line saying \<your user name> (i.e. \samb , say)
15:18:06<skorpan>> show ((1,2),(3,4))
15:18:08<lambdabot> "((1,2),(3,4))"
15:18:22<skorpan>@instances Sow
15:18:24<lambdabot>Couldn't find class `Sow'. Try @instances-importing
15:18:24<skorpan>@instances Show
15:18:25<ski>if we define `mod n 0 = 0', then `d * div n d + mod n d = n' for every `n',`d' (including `d' being zero), if we allow `0 * div n 0' to (lazily) evaluate to `0'
15:18:25<lambdabot>(), (a, b), (a, b, c), (a, b, c, d), All, Any, Bool, Char, Double, Dual a, Either a b, First a, Float, Int, Integer, Last a, Maybe a, Ordering, Product a, ST s a, Sum a, [a]
15:18:26<EvilTerran>?type \x -> do x -- mk15, a do-block itself must be a monadic action
15:18:27<lambdabot>forall (t :: * -> *) t1. t t1 -> t t1
15:18:39<skorpan>how do i override the instance for (a, b)?
15:18:46<wli>Okay, if a prime is ever seen, it need never be considered again, so one can keep a seen set of primes whose square roots of the inverse of 2 have already been crossed off.
15:18:52<EvilTerran>mk15, but a function can use monadic actions internally and not necessarily return something monadic
15:18:54<skorpan>or rather the instance for Show ((Int, Int), (Int, Int))
15:19:01<SamB>int-e: in .forward?
15:19:01<ski>Berengal,ehird : does that explain why i want this better ?
15:19:13<SamB>where is .forward documented?
15:19:24<EvilTerran>mk15, of course, in the case of IO, you'll have to return IO {something} if you want your do-block that's in IO to do anything
15:19:51<mk15>EvilTerran, thanks thats exactly what I was looking for
15:20:40<int-e>SamB: does a man .forward work? http://www.feep.net/sendmail/tutorial/intro/forward.html
15:21:35<burp_>int-e, ok, great
15:21:36<int-e>(but that doesn't explain everything - you can pipe the mail to external programs as well, which is how you run procmail using .forward)
15:22:45<SamB>int-e: I tried man forward but got nothing
15:22:46<mk15>EvilTerran, im still a little confused...my function is available here http://haskell.pastebin.com/m7ee4d0d9
15:23:36<EvilTerran>mk15, um, what exactly do you want it to do?
15:24:05<mk15>EvilTerran, return a True or False based on the inputs
15:24:18<EvilTerran>what about something like http://haskell.pastebin.com/m7faebfc9 ?
15:24:24<SamB>int-e: thanks, that seems to do everything I wanted ;-)
15:24:35<SamB>well, I mean, if it does anything at all, of course
15:24:57<Berengal>ski: Yeah, I can see your point
15:26:29<mk15>EvilTerran, this returns a boolean value in a monad correct? I could work with this, but thats why I was asking if its possible to return a pure boolean value (True or False)
15:27:07<EvilTerran>mk15, there's no way of getting a value out of a monadic action in general
15:27:24<EvilTerran>mk15, for some monads, there may not even be a value to extract
15:28:02<mk15>EvilTerran, ok I will work with this thanks
15:28:05<EvilTerran>mk15, some monads do support extracting values, such as State, which provides runState for that purpose
15:28:16<EvilTerran>but i suspect the monad you're working in doesn't
15:28:48<EvilTerran>BTW, mk15, the other thing to note, is that "if (some expression) then True else False" is exactly the same as just "(some expression)"
15:29:18<SamB>int-e: which it seems to do
15:29:55<wli>Hmm. The deterministic variant of Rabin-Miller is phenomenally stupid esp. for numbers within the ranges of this problem.
15:30:28<mk15>haha yea I knew that for C, but in Haskell im being overly verbose to avoid the compilers wrath :D
15:31:03<SamB>mk15: that doesn't usually help a whole lot
15:32:50<mk15>SamB: maybe not, but the compilers has bit me in the ass a couple times when i thought I was being clever by using shortcuts :)
15:32:51<wli>woops the numbers actually blow slightly past it
15:34:17<olsner>the if ... then True else False pattern is really ugly though
15:34:48<EvilTerran>olsner, at least it's not "if ... == True then True else False" :P
15:34:50<Botje>that's a keelhauling offense!
15:35:01<SamB>mk15: yeah, well, that if thing is kind of overdoing it
15:35:30<olsner>EvilTerran: true .)
15:35:54<wli>Still, [2 .. 2613] won't hurt much (I hope).
15:36:34<wli>I'm seriously thinking trial division is killing me.
15:58:34<olsner>@src on
15:58:34<lambdabot>(*) `on` f = \x y -> f x * f y
15:58:54<olsner>what's the proper fixity and precedence of `on`?
15:59:03<vixey>@info on
15:59:04<lambdabot>on
15:59:19<Twey>Same as anything else in backticks, I guess
15:59:20<Berengal>Default, I guess
16:00:17<olsner>Twey: you can decide that for yourself by adding a infixl/infixr with a different precedence, so it just depends on which definition of `on` you use
16:02:25<redline6561>i was hoping someone could help me with a scoping problem in this code (http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2296).
16:03:17<redline6561>how can i make dict available to the last function without using global variables?
16:04:11<olsner>redline6561: simplest way, by adding another parameter to findFunnies
16:04:13<Twey>redline6561: Pass it in
16:04:40<mk15>EvilTerran, if I use a do block in my code does that automatically make it impure?
16:04:52<redline6561>olsner, twey: thanks
16:04:57<mk15>in my function I mean
16:05:04<Twey> mk15 No
16:05:06<Twey>mk15: No
16:05:16<Twey>It can arguably make it ugly, but not impure.
16:05:28<Twey>Only the IO monad is impure; there are lots of pure monads.
16:05:36<olsner>redline6561: you could rewrite it to be findFunnies dict = [...] and just call (findFunnies dict) in main
16:06:34<redline6561>olsner: not quite sure i follow. given your earlier comment i was expecting something like this in main: map (findFunnies \x dict) dict
16:07:02<redline6561>with a corresponding definition of findFunnies: findFunnies word set = map (isFunnyWord word) (sameLength word set
16:07:12<redline6561>*)
16:07:17<monochrom>delete \x
16:07:19<mk15>Twey, I am using the Data.Array.IO array, which uses the IO monday...im guessing this monad is impure?
16:07:25<Twey>mk15: Yes
16:07:26<mk15>IO monad*
16:07:30<olsner>redline6561: yes, that's the most obvious way, but the "word" that you pass into findFunnies comes directly from dict anyway
16:07:46<mk15>how about the ST monad?
16:07:55<Twey>ST is pure
16:08:06<mk15>ok thanks!
16:08:16<Twey>Well, it's not really pure
16:08:18<EvilTerran>any impurity that may or may not be in a given implementation of ST is exactly that; implementation. it still has pure semantics.
16:08:24<Twey>But it acts like it's pure, which is good enough
16:08:29<Twey>Yeah
16:08:45<olsner>so by inlining the map you now have in main, findFunnies becomes a function of only one thing (the dict) rather than a function of two things (dict, word) where the second comes from the first anyway
16:09:21<olsner>it's mostly matter of taste though, since the two are basically equivalent
16:10:46<poucet>hm
16:11:25<gwern>hm. are the titles of PhD theses italicized or quoted?
16:11:31<redline6561>olsner: okay. thanks! i'll swing through again if i further issues.
16:12:49<vixey>both
16:13:14<gwern>both? madness!
16:16:15<zoheb>vixey hi!!
16:16:48<vixey>oooo~
16:18:40<FliPPeh>> let x = "Swine Flu" in x = "Cured"
16:18:41<lambdabot> <no location info>: parse error on input `='
16:18:44<FliPPeh>There is no cure.
16:19:28<novatrust>wtf, lambdabot actually parses haskell??
16:19:47<FliPPeh>> [1..8]
16:19:48<lambdabot> [1,2,3,4,5,6,7,8]
16:19:58<novatrust>[1..9]
16:20:10<novatrust>> [1..9]
16:20:11<FliPPeh>> take 10 [x*2 | x <- [1..]
16:20:12<lambdabot> [1,2,3,4,5,6,7,8,9]
16:20:12<lambdabot> <no location info>: parse error on input `;'
16:20:21<FliPPeh>> take 10 [x*2 | x <- [1..]]
16:20:23<lambdabot> [2,4,6,8,10,12,14,16,18,20]
16:20:39<novatrust>ooooh... I can learn haskell here! Goodbye evil GHC on VIsta
16:20:52<Botje>GHC isn't evil
16:20:54<FliPPeh>GHC evil on vista?
16:20:55<Zao>novatrust: Note that lambdabot accepts private messages.
16:20:57<FliPPeh>Vista is evil
16:20:57<Botje>shift that word two spaces to the right >:)
16:21:04<novatrust>lol!
16:21:07<kadaver>> take 10 $ repeat swineFluVirus
16:21:09<lambdabot> Not in scope: `swineFluVirus'
16:21:11<kadaver>> take 10 $ repeat "swineFluVirus"
16:21:13<lambdabot> ["swineFluVirus","swineFluVirus","swineFluVirus","swineFluVirus","swineFluV...
16:21:30<FliPPeh>@faw Can Haskell cure Swine Flu?
16:21:30<lambdabot>The answer is: Yes! Haskell can do that.
16:21:35<FliPPeh>@faq Can Haskell cure Swine Flu?
16:21:35<FliPPeh>!!!
16:21:36<lambdabot>The answer is: Yes! Haskell can do that.
16:21:53<Botje>remain pure and pigs cannot harm you >:)
16:22:18<FliPPeh>@faq Can Haskell heat up a burito in a microwave so much that it can not even it eat itself?
16:22:18<lambdabot>The answer is: Yes! Haskell can do that.
16:22:22<FliPPeh>Holy..
16:22:59<FliPPeh>Isn't it fun that no single pig has been infected with swine flu, but yet it's called swine flu?
16:23:03<FliPPeh>Life is random
16:23:20<Botje>pigs just shrug it off, probably.
16:23:34<FliPPeh>@faq Can Haskell do IO without Monads?
16:23:35<lambdabot>The answer is: Yes! Haskell can do that.
16:23:42<byorgey>uh... lots of pigs have swine flu.
16:23:47<p_l>FliPPeh: Pigs do get it
16:23:53<FliPPeh>;|
16:23:55<byorgey>they always have.
16:24:06<FliPPeh>I don't trust my local news sender anymoire :(
16:24:09<FliPPeh>They keep telling my lies
16:24:45<p_l>even the current variation of H1N1. it's just that what we call "swine flu" now is a mix of human, swine and avian flu, which apparently jumped from pigs and unlike avian flu, it can move from human to human
16:25:05<FliPPeh>We've got 15 infections in germany!
16:25:08<FliPPeh>Hooray
16:25:14<mk15>ok so currently im under the impression that if im using the impure IO monad in a function...then that function is required to return a monadic value correct?
16:25:25<novatrust>@faq Can haskell outperform haskell?
16:25:25<lambdabot>The answer is: Yes! Haskell can do that.
16:25:55<EvilTerran>mk15, yes; more specifically, that function is required to return IO (something)
16:25:56<byorgey>mk15: correct.
16:26:16<novatrust>When is Thomas Edison not Thomas Edison?
16:26:22<Berengal>mk15: Not neccessarily. You could discard the monadic value (but then it won't be performed) or return it inside another structure (which won't perform it eitheR)
16:26:49<FliPPeh>@faq Can Haskell divide by Zero?
16:26:49<lambdabot>The answer is: Yes! Haskell can do that.
16:26:50<FliPPeh>> 1/0
16:26:52<lambdabot> Infinity
16:27:00<EvilTerran>mk15, the reason being that, if you want to do side-effects, they have to be part of the IO action called "main"
16:27:02<Gracenotes>okay, I now have House of Leaves in my possession
16:27:04<byorgey>Berengal: I guess it depends on what mk15 meant by "using"
16:27:28<byorgey>I assumed it meant "performing I/O actions"
16:27:40<byorgey>as opposed to "taking an IO action as a parameter"
16:27:51<Berengal>byorgey: Yes, it does. I just find that IO values being first class values is awesome enough to point out
16:27:53<mk15>ok so if instead I were to use an ST monad, then my function could return a non-monadic value such as "True"? (EvilTerran this is what I was referring to earlier)
16:28:00<byorgey>Berengal: that's a good point.
16:28:23<byorgey>mk15: indeed, if you wrap the ST computation in 'runST'.
16:28:27<EvilTerran>mk15, no, you'd have to return something in the ST monad
16:28:42<byorgey>EvilTerran: ?
16:28:45<EvilTerran>mk15, unless you weren't using the same ST variables outside that function
16:29:20<byorgey>mk15: exactly what function are you trying to write?
16:29:23<EvilTerran>byorgey, i'm thinking back to the code mk15 posted earlier; it was doing something with a passed-in mutable array, from the looks of things
16:29:31<byorgey>it would probably help to be more specific
16:29:38<byorgey>EvilTerran: ah, ok, I didn't see that
16:30:04<mk15>byorgey: I am passing in a mutable array.....I was to examine this array and return a simple True or False based on some criteria
16:30:39<byorgey>mk15: ok, yeah, you can't do that.
16:30:39<novatrust>> inc (inc 3) => 5
16:30:40<lambdabot> <no location info>: parse error on input `=>'
16:30:59<byorgey>you'll have to return either (IO Bool) or (ST Bool) depending which you are using for the mutable array
16:31:22<EvilTerran>> succ (succ 3) >= 5 -- novatrust, is this what you were thinking of>?
16:31:23<lambdabot> True
16:31:24<Saizan_>mk15: you can escape from ST only if you dont' "leak" any mutable thing outside
16:32:08<novatrust>Honestly, I just picked it out of a haskell tutorial - I'm just starting to learn Haskell :-)
16:32:36<Berengal>> succ True
16:32:37<lambdabot> * Exception: Prelude.Enum.Bool.succ: bad argument
16:32:43<Berengal>huh
16:32:46<byorgey>novatrust: the => probably meant 'evaluates to'
16:32:52<byorgey>novatrust: it isn't Haskell syntax
16:33:08<byorgey>> let inc = (+1) in inc (inc 3)
16:33:09<lambdabot> 5
16:33:52<novatrust>> let inc = (+2) in inc (inc 1)
16:33:53<lambdabot> 5
16:33:57<novatrust>Hm...
16:36:28<EvilTerran>> (succ False, pred True) -- Berengal
16:36:29<lambdabot> (True,False)
16:36:54<Twey>So, how does everybody handle handles with concurrency? My standard approach is to wrap it in a couple of threads that listen to a Chan each for new input/outpu, writing it as they read it
16:37:00<Twey>output**
16:37:02<Berengal>EvilTerran: I know, I was just experimenting with succing a bit too much
16:37:04<Twey>Is that normal?
16:37:32<Saizan_>Twey: i think so, yeah
16:38:10<EvilTerran>Twey, well, i've seen a thread feeding from a many-to-one channel to an output handle a few times
16:38:40<Twey>EvilTerran: I think that's basically what I do
16:38:53<Twey>ACTION nods.
16:39:08<Berengal>I usually spawn off a bunch of threads with spesific tasks, then use message passing to communicate
16:39:15<Twey>I just find it a bit odd that there's nothing for that purpose in the standard library
16:39:24<Twey>Berengal: Yeah
16:39:44<Berengal>ACTION once wrote a simple "recieve" routine
16:40:00<Twey>It's pretty trivial to write a function that takes a handle and returns an IO (Chan String, Chan String)
16:40:33<Twey>I'm surprised it hasn't been abstracted into a separate two-way-channel type and a converter function, or something
16:41:24<Twey>Berengal: Complete with spelling error? :-P
16:45:57<Berengal>Twey: Wouldn't be the same without it, would it ;)
16:48:51<Berengal>ACTION wonders about implementing a ReversableComputation functor
16:49:42<EvilTerran>Berengal, wouldn't that be a Control.Category?
16:49:55<edwardk>evilterran: it is
16:50:04<Berengal>And also a functor, no?
16:50:16<edwardk>Berengal: not over Hask
16:50:28<EvilTerran>it wouldn't be a Functor
16:50:42<edwardk>in category extras there is an ExpFunctor class it could instantiate
16:50:47<EvilTerran>but is probably a functor in some way or another
16:51:03<edwardk>but basically its an endofunctor over the groupoid generated by Hask, not Hask
16:51:38<edwardk>there was a 'BiArrow' that got it wrong and tried to make them an Arrow
16:52:05<Berengal>Category could work as well
16:52:11<edwardk>i obsessed about these because i needed them to understand why the Weirich/Washburn catamorphism was too small to really use
16:52:12<dons>interesting. uulib defines its own IntSet and IntMap
16:52:19<edwardk>heya dons
16:52:25<edwardk>dons: did you see my adaptive state monad?
16:52:30<dons>edwardk: btw, you would totally love Conor's talk at ICFP PC Workshop about BiFunctors and IFunctors
16:52:37<dons>ooh. no.
16:52:43<dons>good idea!
16:52:44<edwardk>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4458
16:52:55<edwardk>40% faster than the previous CPS transformed state and half the calories
16:53:10<dons>really cool!
16:53:32<dons>we need to throw all these things into a paper
16:53:33<edwardk>it uses the stack layout from my ran transformed state, so basically what happens is the state sits UNBOXED two levels down on the stack! and fmapping over state, etc never partially applies enough to have to even move it
16:53:36<edwardk>yes
16:54:15<roconnor>pfft, unboxing
16:54:20<roconnor>go back to ML!!!
16:54:23<roconnor>:P
16:54:44<edwardk>roconnor: meh, its 40% faster than the previously fastest state monad i could build for a lot of useful stuff
16:54:57<roconnor>40% faster if all you care about are Ints
16:55:17<dons>unique supply!
16:55:17<edwardk>interestingly this may make UState'd code faster than writing normal code in some cases ;)
16:55:24<edwardk>dons: yeah, thats in the queue
16:55:36<dons>are there any CPS monads on hackage?
16:55:37<Cale>Well, it *is* a unique supply :)
16:55:44<edwardk>dons: what i want to do is bolt this onto the right-kan extension transformer lib i'm working on
16:55:45<dons>there's no mtl equivalent yet, iirc?
16:55:47<infoe|wk>how to build a recurrence: f(x) such that f(1) = 1; f(2x) = 2f(x) - 1 -- you see ive only done recursion where x diminishes
16:56:14<edwardk>dons: i have a lib i've been putting together of right-kan-extension transformers that can reimplement the MTL using this same stack layout
16:56:16<EvilTerran>infoe|wk, what's f(3)?
16:56:23<edwardk>dons: its not yet up on hackage
16:56:35<infoe|wk>EvilTerran: 3
16:56:35<Cale>infoe|wk: f(x) = 2 f (x` div` 2) - 1
16:56:37<edwardk>but i have a now slightly dated version of my repository up on comonad.com iirc.
16:56:38<eden_>hi, there, I'm having a little trouble defining an instance of the parsec Stream typeclass. I'm trying to define it for [(SourcePos, [Char])].
16:56:39<Cale>er...
16:56:44<Cale>infoe|wk: f(x) = 2 * f (x` div` 2) - 1
16:56:54<Cale>ACTION shouldn't mix notation...
16:56:58<Cale>infoe|wk: f x = 2 * f (x` div` 2) - 1
16:56:59<edwardk>dons: i also went through and rewrote uu-parsinglib to use Control.Applicative
16:56:59<EvilTerran>infoe|wk, er, why?
16:57:11<Saizan_>edwardk: it's a shame that you have to write distinct Functor/Monad instances for each of them
16:57:17<edwardk>saizan: yeah
16:57:37<edwardk>saizan: fortunately i _can_ inherit the Applicative, and all of the MonadFoo instances generically across all of them
16:57:41<EvilTerran>infoe|wk, f(2x) = 2f(x) - 1 implies f(3) = 2f(1.5) - 1 = ???
16:57:55<infoe|wk>evilterran: i am taking knuth's book "Concrete Mathematics" and going through it using F# in order to learn FP, i figured I would ask here as there are no F# channels with clue
16:58:01<edwardk>saizan: for the equivalent StateT
16:58:32<infoe|wk>EvilTerran: there is another component... f(2n+1) = 2f(n) + 1
16:58:36<infoe|wk>for the odd case
16:58:40<EvilTerran>infoe|wk, ah, i see
16:58:54<edwardk>saizan: all i need is an additional definition of MonadTrans, and the others come in from the general derivation, so I can bake it into AdaptStateT
16:58:59<Cale>infoe|wk: Anyway, the idea is to divide :)
16:59:05<eden_>the problem reported is: 'uncons' is not a (visible) method of class 'Stream'. I've written what I think makes sense after seing the simple definition for a list.
16:59:27<edwardk>dons: oh. another toy, i almost have a new set of Applicative parser combinators ready to go that can parse in parallel as a monoid.
16:59:42<EvilTerran>infoe|wk, well, for the first case, "f 1 = 1" would work
16:59:56<Cale>eden_: I can take a look...
17:00:04<EvilTerran>infoe|wk, and, for the other two, you could write something to the effect of
17:00:09<edwardk>dons: the api should be very much like parsec/uu-parsinglib
17:00:12<EvilTerran>f x | even x = ...
17:00:15<EvilTerran> | odd x = ...
17:00:17<Berengal>f x | even x = 2* f (x `div` 2) - 1; | odd x = 2 * f (x `div 2) + 1
17:00:29<dons>gotta get them on hackage :)
17:00:33<Cale>eden_: Ah, have you imported Text.Parsec.Prim?
17:00:42<dons>truly parallel parsing would be interesting
17:01:48<eden_>cale: Cheers. I start with: instance Stream [(SourcePos, [Char])] Identity (SourcePos, Char) where
17:02:29<edwardk>dons: i have two versions of the implementation that i've been working on. not sure which one will win out. one uses 'Fox' style derivatives of an Applicative, the other uses lots of StableName and unsafeCoerce magic to tease out the context-free grammar recognized by an Applicative and then parses bottom up.
17:02:31<eden_>cale: yes, it' found it, and the token function there.
17:02:50<Cale>eden_: But it's complaining about uncons not being a method?
17:03:19<edwardk>dons: re hackage and so forth, did you ever set up the repo for adaptive-containers on code.haskell?
17:03:19<eden_>Cale: that's right.
17:03:30<dons>i think so...
17:03:45<dons>ah no!
17:03:57<dons>http://code.haskell.org/~dons/code/adaptive-containers/ and i wondered why no one was pushing patches!
17:04:01<edwardk>=)
17:04:11<edwardk>i kept looking for it =)
17:05:05<edwardk>dons: are you aware of any issues with comparing unsafeCoerced StableName's?
17:05:21<redline6561>i had a scoping problem and hoped i could avoid a global variable through partial application. still having some issues though. help? http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2296#a2297
17:05:33<edwardk>dons: or separate stable names of the same value unsafeCoerced into different types?
17:05:39<dons>mmm
17:05:46<Cale>eden_: Can I see your code?
17:05:48<dons>i'm not aware anyone's tried.
17:06:02<Cale>eden_: I can write an instance of it...
17:06:08<edwardk>I ask because the 'a' found its way all the way down into the prim: eqStableName# :: StableName# a -> StableName# a -> Int#
17:06:42<tromp>@let f = 1 : merge (map (pred.(*2)) f) (map (succ.(*2)) f)
17:06:43<lambdabot> <local>:3:8: Not in scope: `merge'
17:06:43<lambdabot>
17:06:43<lambdabot> <local>:3:31:
17:06:43<lambdabot> Ambiguous occurrenc...
17:06:51<eden_>I guess I can list it, it pretty short.
17:07:04<Cale>redline6561: Separate the I/O from the rest of the problem.
17:07:09<tromp>@let merge (x:xs) ys) = x: merge ys xs
17:07:09<lambdabot> Parse error
17:07:13<Cale>@paste
17:07:13<lambdabot>Haskell pastebin: http://hpaste.org/new
17:07:16<tromp>@let merge (x:xs) ys = x: merge ys xs
17:07:17<lambdabot> Defined.
17:07:20<tromp>@let f = 1 : merge (map (pred.(*2)) f) (map (succ.(*2)) f)
17:07:21<lambdabot> <local>:4:31:
17:07:21<lambdabot> Ambiguous occurrence `f'
17:07:21<lambdabot> It could refer to either `L...
17:07:23<Cale>eden_: ^^ paste it on hpaste :)
17:07:26<redline6561>cale: how so?
17:07:26<edwardk>dons: the reason is i need something like: lookup :: StableName a → IntMap [(StableName Magic, f Magic)] → Maybe (f a); lookup k m = fmap unsafeCoerce ∙ Prelude.lookup (unsafeCoerce k) =<< IntMap.lookup (hashStableName k) m
17:07:30<eden_>instance Stream [(SourcePos, [Char])] Identity (SourcePos, Char) where
17:07:30<eden_> uncons [] = return Nothing
17:07:30<eden_> uncons ((pos, [c]):ts) = return $ Just ((pos, c), ts)
17:07:30<eden_> uncons ((pos, (c:cs)):ts) = return $ Just ((pos, c), (updatePosChar pos c, \
17:07:30<eden_>cs) : ts)
17:07:32<tromp>@let fs = 1 : merge (map (pred.(*2)) fs) (map (succ.(*2)) fs)
17:07:33<lambdabot> Defined.
17:07:37<tromp>> fs
17:07:39<lambdabot> [1,1,3,1,3,5,7,1,3,5,7,9,11,13,15,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,3...
17:07:40<Cale>eden_: okay then :)
17:08:00<EvilTerran>@oeis 1,1,3,1,3,5,7,1,3,5,7,9,11,13,15,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29
17:08:01<lambdabot> Josephus problem: a(2n) = 2a(n)-1, a(2n+1) = 2a(n)+1.
17:08:01<lambdabot> [0,1,1,3,1,3,5,7,1,3,5,7,9,11,13,15,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,...
17:08:03<Cale>redline6561: Have the functions take the dictionary set as a parameter.
17:08:09<edwardk>dons: and i was being somewhat paranoid about how safe that would be ;)
17:08:19<Cale>redline6561: And maybe write a pure function for constructing that dictionary from a string.
17:08:41<Cale>redline6561: The only thing which should be in the IO monad is reading the actual dictionary file, and printing the results.
17:08:52<edwardk>dons: i realize when invoking unsafeCoerce twice in one line and mixing in stuff that runs slightly outside of the operational semantics of haskell to get stable names its a little late to be paranoid, but still
17:08:56<infoe|wk>wow ok you guyes ran with the josephus problem it seems
17:09:04<infoe|wk>s/guyes/guys
17:09:04<redline6561>ah
17:09:10<redline6561>cale: thanks.
17:09:39<Cale>redline6561: I can help you more directly with it in a moment if you like... just want to sort out eden_'s problem :)
17:09:41<infoe|wk>I don't have a haskell but i have an F#, someone woke up over there and started helping me... quick with the math but no suggestions for implementing in F#
17:10:06<eden_>Cale: you're a busy person...
17:11:29<Cale>eden_: Where is updatePosChar?
17:11:33<redline6561>cale: thanks very much for the offer. let me play with it for a few minutes (3-5) and private message you.
17:11:38<Cale>Is that from Parsec too?
17:11:42<Cale>redline6561: okay
17:11:53<Cale>Ah, found it
17:12:18<skorpan>@pl \ps -> length ps > 1
17:12:18<lambdabot>(> 1) . length
17:12:18<Cale>eden_: Okay, I get a totally different error.
17:12:33<eden_>Cale: oh yes?
17:12:34<Cale>eden_: I'm getting that functional dependencies conflict between instances.
17:12:36<Berengal>Grargh! *deletes the entire .glade file he's working on*
17:13:05<Cale>Specifically, that your new instance conflicts with the default instance: instance (Monad m) => Stream [tok] m tok
17:13:17<eden_>Cale: Ah. not one I've met before...
17:13:35<Cale>eden_: What've you imported at the top of your file?
17:13:48<Cale>Did you import Text.Parsec.Prim?
17:14:33<eden_>import Text.ParserCombinators.Parsec
17:14:33<eden_>import Text.ParserCombinators.Parsec.Pos ( updatePosChar )
17:14:33<eden_>import Text.ParserCombinators.Parsec.Prim ( pzero )
17:14:33<eden_>import Text.Parsec.Prim ( Parsec, Stream, token )
17:15:24<Cale>eden_: There's your problem
17:15:35<Cale>eden_: You didn't import the class you're trying to define an instance of.
17:15:36<eden_>Cale: Have I not imported or hidden something?
17:15:52<Cale>Just import all of Prim, it'll save you trouble :)
17:16:45<Cale>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4492#a4492
17:16:53<eden_>Cale: I'll give that a go. 'Stream' is in that import list, thought it would be enough...
17:16:54<Cale>This works.
17:17:18<Cale>Ah, you did import the class, but not its methods
17:17:29<Cale>Why are you using the old deprecated module names?
17:17:47<Cale>Text.ParserCombinators.* are only there for backward compatibility
17:18:18<Cale>(perhaps the documentation should say something about that :)
17:19:07<eden_>right. pzero is not in Text.Parsec.Prim. The documentation definately should!
17:19:28<Cale>mzero is the same thing, I think
17:19:36<Cale>There's also parserZero
17:20:11<eden_>parserZero sounds interesting. I'll hoogle it....
17:20:25<Cale>Though I think you're mostly just expected to use mzero
17:20:36<Cale>Or empty, if you're an Applicative sort of person :)
17:20:49<Cale>:t mzero
17:20:50<lambdabot>forall (m :: * -> *) a. (MonadPlus m) => m a
17:21:47<Cale>:t empty
17:21:48<lambdabot>forall (f :: * -> *) a. (Alternative f) => f a
17:22:19<Cale>(The only difference is which library abstraction you like better, they're defined the same way here)
17:24:02<Berengal>parseFail = mzero?
17:26:18<edwardk>hrmm. anyone here familiar with Van Wijngaarden grammars?
17:26:41<defun>:t (>>)
17:26:42<lambdabot>forall (m :: * -> *) a b. (Monad m) => m a -> m b -> m b
17:26:45<edwardk>i'm searching for a class of synthesizable attributes where the values must be monoidal unlike a knuth style attribute grammar which permits anything
17:26:51<defun>:t (*>)
17:26:52<lambdabot>forall (f :: * -> *) a b. (Applicative f) => f a -> f b -> f b
17:27:16<Asztal>yes, parserZero is just mzero
17:28:28<gnuvince_>How do I uninstall something with cabal?
17:28:38<Berengal>gnuvince: Cabal install is forever
17:30:03<defun>:t (<$)
17:30:04<lambdabot>forall a (f :: * -> *) b. (Functor f) => a -> f b -> f a
17:30:09<dmwit>gnuvince_: unregister it, then blow away its directory
17:30:16<eden_>Cale: Okay, I've go to the point of getting function dependencies with Text.Parsec.String (imported from Text.Parsec?)
17:30:52<skorpan>is it possible to somehow define my own instance of Show for (Int, Int)?
17:31:13<Cale>eden_: Did you see my paste?
17:31:17<Cale>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4492#a4492
17:31:24<eden_>Cale: I also had to turn on FlexibleInstances and MultiParamTypeClasses
17:31:30<Cale>skorpan: Not without wrapping it in a newtype
17:31:39<Cale>eden_: yep
17:32:05<skorpan>Cale: so newtype MyPos = MyPos (Int, Int) and then instance Show MyPos where?
17:32:05<gnuvince_>dmwit: and how do I unregister a package?
17:32:23<dmwit>ghc-pkg unregister
17:32:53<Cale>skorpan: yeah
17:33:12<Cale>skorpan: While you're at it, you basically might as well turn it into a proper data declaration
17:33:21<skorpan>Cale: why?
17:33:21<Cale>data MyPos = MyPos Int Int
17:33:45<Cale>Well, this will let you strictify the fields if that ends up mattering...
17:33:52<Cale>data MyPos = MyPos !Int !Int
17:34:02<skorpan>i see
17:34:13<Cale>and it's a lighter syntax
17:34:15<skorpan>but this is basically just a matter of replacing newtype with data right?
17:34:22<Cale>Less parens and commas to type :)
17:34:25<Cale>yeah
17:34:32<skorpan>cool, thanks
17:34:52<eden_>Cale: Missed it. Is it the newtype SS thing that does the trick?
17:34:56<Berengal>skorpan: Well, you'd have to replace the tuple as well, or you'd have a constructor taking a single tuple
17:36:25<skorpan>why oh why does showList want ShowS...
17:36:33<skorpan>feels like too much continuation.
17:36:58<Cale>eden_: yes
17:37:15<Cale>eden_: You can't define the instance otherwise, because there's already an instance which covers that case.
17:37:32<Cale>skorpan: Don't define your own showList
17:37:43<Cale>skorpan: Well, unless you *really* want to...
17:37:59<Cale>skorpan: The default one is usually good enough. You can just define show
17:38:19<ski>Twey : the `IO' monad also has pure semantics, in the same sense as e.g. `ST s' (i.e. you can't write code which breaks equational reasoning)
17:38:40<ski>dons : at <http://code.haskell.org/~dons/code/adaptive-containers/> why do you talk about "polymorphic types" as opposed to "parametric types" ?
17:38:56<skorpan>Cale: i basically want [2,3,4] to become "2, 3, 4"
17:38:57<ski>dons : imo a polymorphic type would be one whose kind has an outer `forall' (similar to a polymorphic value being one whose type has an outer `forall', e.g. `[] :: forall a. [a]' is an example of a polymorphic list (value))
17:39:43<Cale>skorpan: Oh, okay, then you really would need to write your own showList, however, it's probably more advisable to write a separate function to do this.
17:39:51<skorpan>Cale: actually, i want [MyPos 3 4, MyPos 4 5] -> "L3C4, L4C5"
17:40:05<Cale>skorpan: A lot of people rely on Show instances producing valid Haskell code.
17:40:33<dropdrive>Hi, newbie question. Given a ByteString that contains the string representation of a Double, how do I get a Double? Thanks.
17:40:35<skorpan>Cale: maybe you're right
17:40:38<ski>(dons : actually, maybe "parametric types" should be "parameterized types". the former perhaps implies something with parametricity. cf. functions as parameterized values)
17:40:56<dropdrive>Is it just read?
17:41:10<Cale>dropdrive: You may have to unpack first...
17:41:34<dons>edwardk: monoids unconditionally imports Test.QuickCheck in Data/Group/Combinators.hs
17:41:35<Cale>dropdrive: though that isn't terribly efficient, I don't think there's an existing ByteString parser for Doubles.
17:41:39<dons>although QC is supposed to be optional
17:42:04<dons>ski: because we take polymorphic types, and then make them parametric
17:42:19<dons>i.e. the types in the lib are mirrors of the standard polymorphic types
17:42:19<ski>dons : imo `Maybe' is not a polymorphic type
17:42:30<dons>well, that's an interesting point.
17:42:31<ski>it is a parameterized type
17:42:38<ray>it seems to be a common haskell mistake that whenever someone wants a function a -> String they think it needs to be show
17:42:40<ski>same with tuple types, list types, et.c.
17:43:06<dons>the concept I'm getting at is that the type uses a standard boxed closure representation to hold some unconstrained type 'a'
17:43:26<ski>Flip :: forall_kind k0 k1. (k0 -> k1 -> *) -> k1 -> k0 -> * -- *this* would be a polymorphic type
17:43:39<dropdrive>Cale: right, I always see people saying that unpacking is bad. Is there an existing ByteString parser for anything else? e.g. Integer, or 32-bit integers, etc.?
17:43:45<edwardk>dons: ah woops
17:44:00<edwardk>dons: i never did finish cleanup up those flags once i added them
17:44:20<Cale>dropdrive: There's one for Int and Integer in the library
17:44:30<ski>dons : i agree that's a useful property to name. but i would prefer not using the word `polymorphic' to describe that property of a type
17:44:37<edwardk>hrmm, i need a name for a parser combinator library
17:44:40<edwardk>Parsnip?
17:44:51<roconnor>parsec
17:44:59<edwardk>roconnor: =P
17:45:01<ray>parsley
17:45:15<edwardk>ray: iirc meacham grabbed that or was it frisbee?
17:45:31<infoe|wk>sparse
17:45:34<ski>dons : i might suggest `parametric'(?), though that might easily be confused with `parameterized' (i.e. taking parameters .. having a function kind `k0 -> k1')
17:45:43<edwardk>whoa, parsley does appear to be untaken, hrmm
17:46:02<olsner>parsley sounds like it would be most appropriate for an earley parser
17:46:09<BONUS>parsony
17:46:13<BONUS>:]
17:46:41<dmhouse>ParCombLib!
17:46:46<dmhouse>Oh wait, we're being fun.
17:46:51<dropdrive>Cale: Thanks, I see it. (I keep looking in Data.ByteString and not in Data.ByteString.Char8.)
17:47:00<edwardk>olsner: well, its an earley-based parser, i just have to change the way it handles completion because it can parse in either left ro right or right to left order and has to fold together partial parses
17:47:15<olsner>parsley then :)
17:47:18<BONUS>parsetastic
17:47:26<dmhouse>Parseosaurus.
17:47:38<infoe|wk>parsalec
17:47:50<ski>(dons : anyway. i don't know what the best term to use is. i just wanted to state my opinion that `polymorphic' is not appropriate)
17:47:51<Berengal>Parseonaut?
17:48:42<edwardk>skimming /usr/share/dict/words -- parson and parsimony are the only ones not yet mentioned ;)
17:49:27<edwardk>parsimony has nice connotations
17:50:52<dmhouse>"extreme or excessive economy or frugality; stinginess; niggardliness"?
17:51:09<edwardk>dmhouse: if you are looking for a very conservative space efficient bottom up parser?
17:51:31<dmhouse>I guess so.
17:51:46<roconnor>I can't wait for the Density Comonad chapter of "learn you a haskell"
17:51:54<edwardk>woot
17:51:58<roconnor>or the zygohistomorphic prepromorphism chapter
17:52:15<roconnor>actually, I can wait for that last one
17:52:15<edwardk>roconnor: heh, you know i wound up using the yoneda lemma twice while deriving my parser combinators ;)
17:52:49<roconnor>you mean (a -> b) -> (b -> r) -> (a -> r) ?
17:52:50<edwardk>its nice because you can apply it piecemeal to individual constructors in it GADT
17:53:00<ray>learn you the definitions of scary-sounding category theory concepts
17:53:07<olsner>yeah, I'm really dying for someone to produce a legible description of the zygohistomorphic prepromorphisms
17:53:14<edwardk>nah that there is an isomorphism between forall a. (a -> b) -> f b and f a
17:53:42<roconnor>edwardk: your bound and free variables don't make sense there
17:53:50<roconnor>forall b?
17:53:53<edwardk>er forall b
17:54:12<roconnor>that's the yoneda lemma?
17:54:48<sclv>@remember roconnor I can't wait for the Density Comonad chapter of "learn you a haskell"
17:54:48<lambdabot>Good to know.
17:54:50<edwardk>i used it so i could replace constructors like Sym :: s -> Parser t s t -- with Sym :: s -> (t -> a) -> Parser t s a -- which made fmap not have to change the shape of the parser
17:55:15<edwardk>roconnor: in essence, replacing Set with Hask
17:55:21<roconnor>I had no idea that was the what Yoneda said
17:55:33<roconnor>that seems way more useful than I was thinking
17:56:32<roconnor>edwardk: why forall b. (a -> b) -> f b and not forall b. (a -> f b) -> f b ?
17:56:33<edwardk>roconnor: you can then view the yoneda lemma as a right kan extension along the identity functor
17:56:47<roconnor>edwardk: that description doesn't help me :)
17:56:56<edwardk>roconnor: because that would be the density monad =)
17:57:00<edwardk>er codensit
17:57:16<roconnor>right. But wouldn't both make things more efficent
17:57:26<roconnor>why choose one over the other?
17:57:43<edwardk>roconnor: they both have uses. i use yoneda when i just want to accumulate fmaps and force fmap fusion
17:57:57<edwardk>i use codensity when i want to do the same for binds
17:58:02<roconnor>okay, that's why it looked like
17:58:21<roconnor>but does yoneda fuse maps more efficently than codensity?
17:58:36<roconnor>codensity appears to do all that yoneda does, plus more!
17:58:59<roconnor>or does yoneda also work on plain functors?
17:59:08<edwardk>fmap f m = Yoneda (\k -> runYoneda m (k . f))
17:59:15<edwardk>and you can Yoneda anything, even a Comonad
17:59:27<edwardk>http://comonad.com/haskell/category-extras/src/Control/Functor/Yoneda.hs
17:59:44<olsner>still, you can't simply Yoneda into mordor
17:59:46<edwardk>though its more efficient to use the contravariant form of the yoneda lemma for comonads
18:00:31<ski>edwardk : probably you meant an isomorphism between `forall b. (a -> b) -> f b)' and `f a'
18:00:49<roconnor>edwardk: where is liftYoneda?
18:00:56<edwardk>the contravariant yoneda lemma basically says there exists an isomorphism between exists b. (# b -> a, f b #) and f a
18:01:11<edwardk>ski: yeah roconnor caught it shortly thereafter
18:01:21<ski>(er, s/f b)/f b/)
18:01:23<edwardk>roconnor: its hreturn
18:01:31<edwardk>roconnor: Yoneda forms a higher order functor in category-extra terms
18:01:47<ski>(edwardk : no, roconnor had `(a -> f b)' in it, not `(a -> b)')
18:02:04<roconnor>[13:53] <roconnor> forall b?
18:02:17<roconnor>[13:53] <edwardk> er forall b
18:02:17<ski><roconnor> edwardk: why forall b. (a -> b) -> f b and not forall b. (a -> f b) -> f b ?
18:02:29<edwardk>ski: i figured those were disjoint thoughts
18:02:35<roconnor>they were
18:02:36<ski>oh .. you are right
18:02:47<ski>sorry, misunderstood
18:03:21<roconnor>edwardk: strange. Yoneda f is a functor, but neither hreturn nor lowerYoneda have any (Functor f) restrictions
18:03:23<edwardk>anyways hreturn is to let Yoneda just be an instance of http://comonad.com/haskell/category-extras/src/Control/Functor/HigherOrder.hs
18:03:40<edwardk>roconnor: yep. thats the nice thing about Yoneda.
18:03:48<roconnor>that's mindboggling
18:03:53<ski>edwardk : is that similar to replacing `GetChar :: IO Char' with `GetCharBind :: (Char -> IO a) -> IO a' ?
18:04:16<edwardk>roconnor: you need to know how to make an initial value in Yoneda f a, but from there you can map it. this lets you actually put 'constraints' on a without saying what they are
18:04:30<kadaver_>hmm gtk2hs is gtk+haskell stuff?
18:04:40<roconnor>edwardk: I didn't really understand that
18:04:42<kadaver_>so to use gtk with c i dont need all that?
18:04:53<edwardk>ski: that would be closer in spirit to ContT
18:05:20<ski>yes .. i just wondered if one could think of this in terms of yoneda ..
18:05:37<dufflebunk>kadaver_: GTK /is/ C.
18:06:01<ski>hm .. with yoneda, you'd possibly get `GetCharMap :: (Char -> a) -> IO a' ..
18:06:07<edwardk>ski: its closer to codensity than yoneda
18:07:17<glguy>is there a script that posts to hpaste and uses '.' as the title and author?
18:07:37<edwardk>roconnor: basically think of Yoneda f a being a mendler style encoding of f being a Functor. you need no secret decoder ring or dictionary to get inside f to manipulate it, thats packaged up in the type of Yoneda f.
18:08:16<roconnor>I guess I would need to see some uses of Yoneda f where f isn't a functor
18:08:41<ski>glguy : <http://haskell.org/haskellwiki/Hpaste.el> might be useful, if you use emacs
18:08:43<glguy>edwardk, what kind of speedup didn't you see from the unboxed state monad?
18:08:57<roconnor>but I imagine it as you are delaying putting a inside f, so you can play with it first.
18:09:16<roconnor>hmm
18:09:19<roconnor>not sure that makes sense
18:09:23<edwardk>roconnor: ok, for that lets flip to the contravariant yoneda lemma and apply it to an f-Algebra
18:09:40<edwardk>data Foldr a b = forall c. Foldr (c -> b) (a -> c -> c) c
18:10:13<edwardk>glguy: its about 4x faster than the conventional MTL State and about 40% faster than the equivalent boxed CPS transformed State
18:10:23<roconnor>instance HPointed Yoneda where
18:10:24<roconnor> hreturn a = Yoneda (\f -> fmap f a)
18:10:27<roconnor>what fmap is that?
18:10:36<edwardk>hreturn says that f is a functor
18:10:45<roconnor>oh pfft
18:10:52<edwardk>class HFunctor m => HPointed m where hreturn :: Functor f => f a -> m f a
18:10:54<roconnor>I knew that functors would appear somewher
18:10:58<roconnor>Now I feel better
18:11:09<roconnor>the world makes sense again
18:11:13<edwardk>roconnor: hahaha
18:11:25<roconnor>edwardk: it seemed so impossible before
18:11:46<edwardk>roconnor: you need a potentially valid definition of fmap to 'package up' a Yoneda, and you need a potentially valid definition of fmap to 'unpackage' a CoYoneda.
18:11:54<edwardk>but you get the other side for free
18:12:12<glguy>edwardk, is the only difference that Int#s are passed along by the bind?
18:12:18<ski>can one have a useful example of an `f' where `HFunctor f', but no sensible `HPointed f' is possible ?
18:12:28<edwardk>but note that you don't have to be able to supply the 'packaging' operation for all a' for Yoneda, or for unpackaging operation for all a for CoYoneda so there are cases where it applies that you can't define fmap
18:12:54<ski>ACTION probably should look at the exact definition of `HFunctor'
18:13:03<wli>What's the new way if not Text.ParserCombinators.*?
18:13:09<edwardk>glguy: well, if you look at the bind and return they partially apply the continuation so they work above the Int# on the stack
18:13:19<edwardk>glguy: so it sits there unmolested
18:14:23<edwardk>glguy: normally with State you keep shuffling it around among the top few slots of the haskell stack while you call funtions fmap this that and the other thing
18:14:50<edwardk>in fact 10% of the speed win for just moving to the CPS transformed state was in swapping the order of the continuation and state just to avoid the constant flips
18:15:24<edwardk>forall o. (a -> s -> o) -> s -> o -- is ~10% faster than forall o. s -> (a -> s -> o) -> o
18:15:29<wli>Which constant flips?
18:15:51<edwardk>because if you don't use the state s you can partially apply that function
18:16:21<wli>What should one import if not Text.ParserCombinators.*?
18:16:37<edwardk>wli: Text.Parsec.*
18:16:55<edwardk>wli: or wait a few days for me to get bored and abandon my shiny new monoidal parser combinators
18:17:57<edwardk>wli: you love all the obscura of various parser types. do you know a name for a class of grammars that only allows monoidal synthesized attributes?
18:18:14<wli>edwardk: No clue.
18:18:28<edwardk>wli: its close to a van wijngaarden grammar, in that the vW grammars used strings as the only form of attribute they allowed
18:18:34<edwardk>and a string is a free monoid
18:19:48<glguy>edwardk, does the story stay as fast if you make it a transformer?
18:20:09<Cale>Well, the set of all strings is a free monoid ;)
18:20:40<edwardk>glguy: what i have is a family of 'right kan extension transformers' that transform monads in right kan extension form into other right kan extensions, basically it only CPS transforms once.
18:20:48<edwardk>glguy: in that case it does
18:20:59<edwardk>glguy: and those extend apparently to cover the entire MTL
18:21:17<edwardk>glguy: and you can codensity or yoneda the basic monads to get them into this form
18:21:47<edwardk>so what i'm doing is making a data family RanT :: (* -> *) -> * -> *
18:21:58<edwardk>and instantiating it for the different members of the MTL
18:22:06<edwardk>its not _quite_ a MonadTrans, but its close
18:22:09<glguy>I don't know what any of those category-theoretic terms are :)
18:22:09<dufflebunk>ACTION wonders why people say Haskell is only for academics, when there are discussions like this
18:22:14<edwardk>and you'll be able to say
18:22:28<edwardk>RanT (StateT s (ReaderT m IO)) a
18:22:30<Twey>dufflebunk: Blub factor
18:22:44<edwardk>and it'll CPS transform it once into an efficient form that looks like
18:22:54<edwardk>forall o. (a -> s -> o) -> r -> s -> o
18:22:59<edwardk>after the newtype noise is gone
18:23:24<roconnor>edwardk: your m disappeared
18:23:35<roconnor>er
18:23:38<roconnor>your IO disappeard
18:23:39<edwardk>er IO did =)
18:23:41<edwardk>yeah
18:23:44<roconnor>your m turned into an r
18:23:51<Lemmih>Why is nofib called nofib?
18:23:59<roconnor>edwardk: D-
18:24:00<edwardk>ok, pretend i used StateT s (Reader r) a =)
18:24:07<edwardk>you get the general idea
18:24:24<Cale>Lemmih: Because it's designed to provide something better than fibonacci for benchmarking. :)
18:24:46<edwardk>the goal is to make a nice easy to use type that you can just bolt in and it 'does the right thing'
18:24:59<edwardk>btw- there are a number of yoneda and coyoneda cases in there of non-Hask functors
18:25:05<Lemmih>Cale: Ah, thanks.
18:25:06<roconnor>Lemmih: as such it is a less lying benchmark
18:25:07<Igloo>It's a pun of both what Cale said, and also "not a lie" (like benchmarks generally are)
18:25:16<edwardk>i need the yoneda lemma of Endo for instance
18:25:20<Cale>dufflebunk: I prefer to say that it's for both academics and practical use. That's actually what I like about it.
18:26:06<Twey>I would say that any serious academic language (i.e. not Iota) should be perfectly suitable for practical use
18:26:11<Twey>If it's not, it's something of a failure :-P
18:26:23<Twey>The one thing that does tend to be lacking is libraries.
18:26:23<Cale>hmm...
18:26:26<roconnor>dufflebunk: you may be laughing now, but when edwardk's code is only 50% slower than C, then we will see who is laughing!
18:26:28<edwardk>i.e. -- Maybe a ~ Yoneda Endo a ~ ∀o. (a → o) → o → o ~ ∀o. (a → Identity o) → Endo o
18:26:32<monochrom>Q: "Is Haskell of academic interest or practical interest?" A: "Yes!"
18:26:32<dufflebunk>Cale: So do I. I still have no idea what they were talking about for the last 15 minutes though ;)
18:27:06<edwardk>roconnor: and the last one you can see is Ran Identity Endo -- Maybe can be encoded as a right kan extension
18:27:10<Cale>dufflebunk: They're talking about making use of ideas from category theory to make programs run faster.
18:27:14<dufflebunk>roconnor: Probably me, because I'll be using it... well, if I ever figure out what it is
18:27:19<Twey>@faq Can Haskell be used for practical or purely academic uses?
18:27:19<lambdabot>The answer is: Yes! Haskell can do that.
18:27:36<edwardk>dufflebunk: the goal is to make it opaque so you can use it like the MTL and not have to think about it
18:28:09<edwardk>dufflebunk: same with the adaptive-container and adaptive-monad-ran stuff i've been obsessing about
18:28:30<roconnor>edwardk: endo isn't a functor?
18:30:04<dolio>It's not a Functor, certainly.
18:30:27<roconnor>What is the use of Yoneda Endo then?
18:31:16<roconnor>oh it is a CPSed Maybe
18:31:16<gwern>ACTION stifles a star wars joke
18:31:23<roconnor>that is so bizarre
18:31:44<wli>ACTION tries to get deterministic Rabin-Miller going.
18:32:06<cypher->what kind of literature would you recommend to bring one up to speed with understanding what the heck you guys are alking abou?
18:32:09<cypher->*about
18:32:32<roconnor>PhD in mathematics
18:32:37<roconnor>j/k
18:32:50<edwardk>gotta run
18:32:58<cypher->so it seems LOL
18:33:36<roconnor>if it helps only edwardk and Cale even know what a Kan extension is.
18:33:57<dolio>Endo is an ExpFunctor, from category-extras, or whatever. But I don't know where those come from in category theory, exactly.
18:34:51<roconnor>cypher-: step 1 would be to study continuation passing style
18:35:13<roconnor>I think that underlies a lot of the motivation of this conversation
18:35:29<roconnor>and CPS is well documented
18:35:37<cypher->roconnor: I was trying to do that lately
18:35:55<cypher->and I saw an evil CPS exam question that I could not solve :-/
18:36:12<cypher->from last year's lambda calculus exam
18:36:19<roconnor>I used a CPS transform to make my code 4x faster 2 years ago
18:36:31<roconnor>that started me down this path of slow understanding
18:36:50<roconnor>it really helps to have practical examples that you yourself have used and can relate to
18:37:42<roconnor>I now know (2 years later) that my CPS transform was more accurately a codensity monad transform, which is similar in flavour to these Yoneda transforms
18:37:59<roconnor>but if it weren't for that work 2 years ago, I'd be totally lost
18:38:23<roconnor>My point is, it takes time an experience.
18:38:39<cypher->I see
18:38:46<roconnor>perhaps it could be taught, but I think all this stuff is pretty new and maybe not well understood yet.
18:38:58<roconnor>so few resources are available.
18:39:23<cypher->and now you're doing PhD or post-doc in computer science?
18:39:28<roconnor>yes
18:40:54<roconnor>cypher-: also, this stuff is only needed to develop these sorts of libraries (which of course is intersting), but won't be needed to use the libraries
18:43:06<Cale>Heh, and in my case, saying that I know what a Kan extension is might be pushing it a little ;)
18:43:18<Cale>I can understand the definition anyway :)
18:43:27<glguy>that adaptive container instance for () seems to discard the (), which thanks to async exceptions can be any number of types
18:43:36<roconnor>okay, only edwardk knows what a Kan extension is
18:43:52<dolio>The thing about Kan extensions is that you need to know what (co)ends are first. And the only immediate resource is this: http://en.wikipedia.org/wiki/End_(category_theory)
18:43:56<Cale>Apparently all concepts are Kan extensions.
18:43:58<monochrom>Piaget's theory implies that you need concrete experience at one level of abstraction to learn the next. (It is a necessary condition, sometimes not sufficient, but nothing else is sufficient.) The idea that you can learn anything by just reading and talking is flawed. You have to play.
18:44:45<dolio>Which doesn't really give you any intuition about what (co)ends are, or what motivates them.
18:44:46<roconnor>monochrom: sounds like my advice on getting experience with CPS first is good advice.
18:45:51<monochrom>Yeah, your conversation reminds me of that.
18:45:52<dolio>There's also an edwardk blog post that shows how to encode them in Haskell, but I'm not sure that explains their motivation either. :)
18:46:58<monochrom>Another point. Intuition is a person's own generalization of his/her concrete experience. It is very personal. The idea that someone else can tell you their intuition and it will make sense to you is flawed.
18:48:01<monochrom>Until one day humans come with USB ports for downloading and uploading raw brain images.
18:49:07<dufflebunk>damn, my brain image machine uses serial ports.
18:49:11<dolio>I mean, I can watch edwardk say, "look, if I stick Endo in for g, and Id in for f, I get the type of CPSed Maybe," but that doesn't mean much to me.
18:50:05<roconnor>dolio: well, it is pretty clear when you expand out the definitions
18:50:18<roconnor>... assuming you know what a CPSed Maybe looks like
18:50:27<roconnor>which I suppose might be a big assumptions
18:50:50<dolio>No, I get CPSed Maybe. I don't get why I should be thinking about Kan extensions with regard to that.
18:50:58<roconnor>:)
18:51:25<dolio>Other than "Ran f g a = forall o. (a -> f o) -> g o", and if we stick in certain things for f and g, we get the right thing.
18:51:41<roconnor>I'm with you on that
18:52:52<dufflebunk>ACTION saunters back the relative simplicity of the FFI
18:53:53<Philippa_>monochrom: yeah. I tell people my intuitions, and ones that I'm aware of but discard, but they're to offer people a partial map to try to attach their own intuitions to
18:54:51<Philippa_>btw: anyone got any advice on idioms for using open recursion in haskell without driving yourself nuts?
18:55:06<Philippa_>(I probably /really/ want it coupled with extensible records, but that's life for you)
18:55:13<olsner>what's open recursion?
18:56:00<FliPPeh>You and me baby ain't nothin' but mammals~
18:56:01<FliPPeh>Lala.
18:56:06<monochrom>I just mechanically turn "f ... = ... f ..." into "f ... s = ... s ...". Or maybe I make s the first parameter rather than the last.
18:56:19<FliPPeh>@faq Can Haskell do it like they do on the discovery channel?
18:56:20<lambdabot>The answer is: Yes! Haskell can do that.
18:56:34<Botje>first is better because you can still do partial application :)
18:57:04<monochrom>Last is probably more convenient for fix.
18:57:22<monochrom>Or is it? I can't think.
18:57:41<ski>Philippa_ : would something like they use in the interpreters in "The Essence of Dataflow Programming" work ?
18:58:11<monochrom>Yes, always make it first. Turn "f = \params -> ... f ..." into "f s = \params -> ... s ...".
18:58:33<Philippa_>ski: I haven't read that in a while and it went over my head a bit at the time - it might do, the comonad/context link makes sense
18:58:38<EvilTerran>ACTION notes that going from "foo ... = ..." to "foo foo ... = ..." (usually) works
18:59:03<monochrom>Heh, evil reuse of names and use of shadowing.
18:59:05<Philippa_>monochrom: in particular, I want a sensible idiom for doing open recursive record update
18:59:13<EvilTerran>because the parameters' scope is inside the function name's scope
18:59:18<ski>Philippa_ : this issue doesn't really have with monads or comonads to do .. i just mean how they define a class with a method `ev', and use that for a kind of open recursion
18:59:41<EvilTerran>ACTION is Evil.
18:59:51<ski>(Philippa_ : that paper was just where i'd seen that style used)
18:59:59<wli>Okay, this thing is cooking.
19:00:00<ski>ACTION is i
19:00:02<Philippa_>ski: hmm, will read. If I need lots of boilerplate per field, it's going to be painful
19:00:29<EvilTerran>ski, so "i" is your identity, then? :P
19:01:16<ski>Philippa_ : btw, note that they use it for open recursion on a variant type (if haskell had variant type super-typing, they should have used that as well, coupled with this) .. but i suspect the open recursion on records would not be much different
19:01:29<Philippa_>ski: *nod* - duality ahoy
19:01:51<Philippa_>in fact, rather appropriately so: I'll be working with records of parsers, 'nuff said?
19:01:56<ski>EvilTerran : no, `s k i' is the same function as `i'
19:02:06<EvilTerran>ACTION expands...
19:02:25<ski>(Philippa_ : btw, you are making a function that *returns* a record, right ?)
19:02:30<EvilTerran>skix = kx(ix) = x, i c wut u did thar.
19:03:51<Philippa_>ski: well, what I /want/ to encode is a module-of-parsers I'll keep applying deltas to. I have to admit, I'm reaching that level of old-fartness where the level of encoding on nearasdammit anything tires me out
19:05:33<skorpan>:t undefined
19:05:34<lambdabot>forall a. a
19:05:43<skorpan>:t ()
19:05:44<lambdabot>()
19:05:49<skorpan>which is bottom?
19:05:54<monochrom>undefined
19:07:15<FliPPeh>> undefined
19:07:16<lambdabot> * Exception: Prelude.undefined
19:07:25<ski>> let x = x in x
19:07:36<JuanDaugherty>ACTION cautions Phillippa about the old-fartness event horizon.
19:07:38<ski>.
19:07:38<skorpan>> let x = undefined in x
19:07:40<lambdabot> * Exception: Prelude.undefined
19:07:40<lambdabot> thread killed
19:07:40<ski>..
19:07:57<skorpan>> let x = undefined in 5 * (x / x)
19:07:58<lambdabot> * Exception: Prelude.undefined
19:08:08<JuanDaugherty>Philippa_ even
19:08:16<skorpan>> let x = undefined in 5 * (x * 0)
19:08:18<lambdabot> * Exception: Prelude.undefined
19:08:27<monochrom>undefined is not the only bottom. the other bottom is infinite loop. and how can you or anyone be sure that a loop is an infinite loop?
19:08:31<ski>Philippa_ : you mean you're constructing a record of parsers ? mutually recursively defined in terms of "smaller instances of themselves" ?
19:08:37<skorpan>monochrom: halting problem?
19:08:49<monochrom>yes
19:08:56<Philippa_>JuanDaugherty: I suspect how fast you get there depends on just how full of beans you are
19:09:08<skorpan>why is the infinite loop bottom?
19:09:18<ski>because it doesn't return a valid value
19:09:23<wli>Okay, moving from trial division to deterministic Rabin-Miller reduces the space footprint to ca. 3MiB and vastly accelerates the progress through the search space.
19:09:28<Philippa_>ski: sort of, yeah. Building up from a simple STLC surface syntax to something larger and more sugary, say
19:09:35<Philippa_>(obviously that one wants extensible records)
19:09:44<skorpan>does that mean that anything which doesn't return a valid value is bottom in haskell?
19:09:44<monochrom>It doesn't give an answer. bottom is used to model that. no answer.
19:09:47<Philippa_>I actually want to have one of these per sort too, mind
19:10:08<dropdrive>How do I see what GHC thinks the signature of one of my functions is?
19:10:17<Philippa_>but half of the point is being able to say "the usual, only..." with the difference being the record update. You can see where the recursion fits in there, right?
19:10:35<monadic_kid>dropdrie: :t in the repl
19:10:50<monadic_kid>dropdrie: :t <exper>
19:10:58<monadic_kid>*<expr>
19:11:18<ski>Philippa_ : ok
19:11:23<dropdrive>monadic_kid: Ah. Is there a way from the cmdline? That would make like easier.
19:11:26<Twey>:t (+)
19:11:27<lambdabot>forall a. (Num a) => a -> a -> a
19:11:41<ski>(Philippa_ : i once did a monad whose actions was records that included actions from two other monads. the monad operations constructing a new record with actions used both sub-actions of the records arguments .. i was thinking what you did was maybe somewhat similar to this)
19:11:53<monochrom>skorpan: Yes, both "head []" and infinite loops are bottom.
19:12:22<skorpan>monochrom: but head [] is only bottom because its value is undefined?
19:12:26<EvilTerran>skorpan, yeah, bottom is anything which doesn't have a value
19:12:42<skorpan>so what is the bottom *type*?
19:12:44<ski>(Philippa_ : maybe .. if you care for it, i think i would better understand what you mean with code example)
19:12:45<EvilTerran>be it because an exception gets thrown, or because it never evaluates
19:12:51<ski>skorpan : no
19:12:53<EvilTerran>skorpan, types aren't ordered in haskell
19:13:17<monochrom>bottom has to be polymorphic since all sorts of programs of all sorts of types may end up giving no answer.
19:13:37<ski>(except unboxed)
19:13:39<EvilTerran>(well, i guess they are, but not like that)
19:13:53<skorpan>in which languages are types ordered? are there any programming languages which implement an ordered type system?
19:14:05<yitz>dropdrive: :t *is* from the ghci command line. do you mean from the shell command line?
19:14:12<ski>skorpan : type systems with subtyping ?
19:14:20<dropdrive>yitz: Yes, sorry, from the shell cmdline.
19:14:26<EvilTerran>skorpan, "is a subtype of" is a partial ordering
19:14:30<skorpan>oh, i see
19:14:39<EvilTerran>Scala has a bottom type in that regard
19:15:01<EvilTerran>(a type that is a subtype of all types, so contains no values)
19:15:02<EvilTerran>iirc
19:16:04<yitz>dropdrive: umm... how about echo ':t map' | ghci? it gives a whole mess, but the type is in there somewhere.
19:16:32<redline6561>excuse me. what pattern match cases do i need for a function :: [(String, String)] -> Bool
19:16:38<dolio>Well, if you look at (impredicative?) higher-rank polymorphism, you can order some types.
19:16:58<yitz>redline6561: depends what you're looking for
19:17:02<dolio>Like (forall a. a) < any other type, in that the values in the first are contained in the second.
19:17:05<monochrom>perhaps (x,y):rest
19:17:17<ski>redline6561 : depends .. you could define `function _ = False' .. but that's probably not what you want
19:17:28<dolio>And any-type < (exists a. a), since the latter contains every value of the former.
19:17:47<dropdrive>yitz: I'll give it a shot, thanks.
19:17:59<dolio>And so on.
19:18:06<redline6561>yitz, ski: cale was helping me with this earlier -- http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2296#a2297
19:18:14<redline6561>ski: that might not be a problem actually
19:20:01<Cale>redline6561: [] and (x,y):xs would do
19:20:04<unC0Rr>hello! what would be a good approach of getting asynchronous reply from mysql server? currently I use TChan and forkIO'd thread, but it freezes all program in mysql driver. With forkOS it seems nothing goes through TChan
19:20:31<Cale>unC0Rr: Are you using the threaded runtime?
19:20:34<redline6561>Cale: thanks!
19:20:39<yitz>redline6561: you also might want just x, if you can work with the [(String, String)]
19:20:48<redline6561>ski: that actually helped a bit, playing further...
19:21:06<Cale>redline6561: Oh, you're looking for mapM or forM, I think
19:21:08<unC0Rr>Cale: yes, or it would complain
19:21:11<Cale>redline6561: from Control.Monad
19:21:22<redline6561>Cale: i'll have a peek
19:21:31<Cale>redline6561: printFunnies xs = forM xs $ \(x,y) -> print (...)
19:21:40<redline6561>yitz: what do you mean by just x?
19:22:01<yitz>redline6561: or xs. like what Cale just said.
19:22:10<redline6561>yitz: okay. thanks.
19:22:29<redline6561>cale: aha. much nicer than this monster ... printFunnies [[(a,b)]] = print (a ++ tail b ++ "\n")
19:23:36<Cale>unC0Rr: hmm... I've never really tried interacting with mysql from Haskell... which database library are you using? (Or are you writing your own?)
19:24:05<unC0Rr>Cale: hdbc with hdbc-mysql driver
19:24:30<Cale>If you compile a program without -threaded and it does an FFI call which blocks, the whole program blocks.
19:25:30<unC0Rr>I have already realized that
19:25:36<Cale>okay
19:25:56<ski>redline6561 : if you want your function to do something more interesting, but still non-recursive, you can do stuff like
19:25:59<ski> function [] = False
19:26:02<Cale>I wonder what else it could be...
19:26:06<ski> function [("foo",_)] = True
19:26:17<ski> function [(s,t)] = s == t
19:26:30<ski> function (_:_) = False
19:27:08<yitz>Cale: what do you think of my proposal for XNoMR by default in ghci?
19:27:21<Cale>yitz: I think it should be by default in GHC.
19:27:41<yitz>Cale: well, that will be harder to get everyone to agree upon
19:27:42<Cale>I currently add it to my .ghci
19:27:49<ski>redline6561 : but often, if you want a recursion, it suffices to consider two cases : `function [] = ...' and `function ((s0,s1):ss) = ..s0..s1..ss..' where the latter case includes a recursive call to `function'
19:27:52<yitz>Cale: I think just about everyone does.
19:28:04<Cale>But the only problem with that is that when I go to compile the program, sometimes I trip over that.
19:28:21<lispy>yitz: I would prefer it as an overall default because I worry that turning it off in one and not the other will create confused newbies.
19:28:22<lambdabot>lispy: You have 1 new message. '/msg lambdabot @messages' to read it.
19:28:25<yitz>Cale: really? what goes wrong?
19:28:55<Cale>yitz: Well, I forget to put {-# LANGUAGE NoMonomorphismRestriction #-} in my code, and it doesn't compile.
19:29:09<Cale>yitz: So I end up having to go back and edit it at that point.
19:29:12<yitz>lispy: I think they get tripped up a lot more by having it on in ghci than they would by that.
19:29:20<Cale>(just a small annoyance, but it would be moreso for a beginner)
19:29:22<redline6561>ski: sorry. was away. thanks for that pointer.
19:29:31<yitz>lispy: and I am pessimestic about the chances of getting it turned off by default in both
19:29:51<lispy>yitz: yeah, may be best to get this for Haskell'
19:29:55<Cale>Better than getting it turned off, perhaps, would be having it turned into a *warning*
19:30:06<Zao>Is Leksah in any usable state or is it still quite experimental?
19:30:06<Cale>The MR never should have been an error in the first place.
19:30:10<lispy>Cale: good point
19:30:17<yitz>Cale: when MR is off in ghci and you :load, it is also off when compiling the module?
19:30:23<unC0Rr>Cale: added some tracing putStrLn, and I see it works when I do forkIO, and mysql driver refuses to connect when I do forkOS
19:30:26<lispy>Zao: Never tried it, but the threads on -cafe made it sound quite usable
19:30:28<Cale>yitz: I think so, yes
19:30:37<yitz>Cale: hmm. maybe it'
19:31:03<yitz>maybe it's possible for it to be off for stuff typed in ghci scope, but still on for :load ?
19:31:28<redline6561>Zao: my impression was it's pretty usable. there's a cabal package for it. you'll need gtk2 installed on your OS though.
19:31:35<Zao>lispy: I don't want to go through all the dependency hell to try it out :)
19:31:56<redline6561>Zao: cabal install leksah should deal with dependencies provided gtk is installed
19:31:59<yitz>I would be against a warning. it would be really annoying, it would come up all the time.
19:32:02<Cale>unC0Rr: Interesting.
19:32:16<Cale>unC0Rr: Is there a good reason to use forkOS?
19:32:17<Zao>redline6561: I'm on Windows. No gtk, no editline, no pie.
19:32:18<redline6561>Zao: of course if you don't have cabal...
19:32:22<redline6561>Zao: ouch.
19:32:54<Zao>Although I have msys and mingw installed so I could build all the packages that stupidly rely on sh.
19:33:03<unC0Rr>Cale: my program is game server, so it's not good for it to freeze from time to time for seconds
19:33:28<Cale>unC0Rr: Yeah, but Haskell threads are usually sufficient.
19:33:41<Cale>unC0Rr: GHC's scheduler is not that bad.
19:33:49<unC0Rr>Cale: not in this case, it seems
19:36:20<Saizan>are you compiling with -threaded ?
19:36:40<Cale>It's interesting, usually you only need forkOS to make something work with a foreign library that uses thread-local state.
19:36:58<unC0Rr>Saizan: yes, I do
19:37:29<Cale>forkIO/forkOS should not make any difference when it comes to how the program is scheduled
19:37:48<Cale>Except that threads created by forkOS will always run on the same OS thread.
19:38:21<redline6561>Zao: there are native gtk binaries for windows and editline shouldn't be needed for leksah...if you have cabal install it might not be too painful. Note issues 57 and 60: http://code.google.com/p/leksah/issues/list
19:39:32<Zao>redline6561: The wiki mumbled about libedit.
19:39:58<monochrom>yo dawg, we heard you like haskell, so we put haskell in your editor config files so you have to write haskell before you have an editor up for writing haskell.
19:40:03<redline6561>Zao: ah, sorry. my bad.
19:40:31<Zao>I'll probably not use it anyway, unless it happens to have an awesome vim mode.
19:43:11<Twey>Bah, humbug.
19:43:22<Cale>monochrom: hahaha
19:43:32<Twey>How are we supposed to deal with varying linebreaks in Haskell?
19:43:40<Twey>\n gets converted to the system linebreak, right?
19:43:40<dons>silkworm looks awesome, http://www.reddit.com/r/programming/comments/8hcfl/silkworm_a_2d_physics_game_in_haskell_built_with/
19:43:52<Twey>So how can we safely write \r\n, say for HTTP?
19:44:08<Twey>If the program is run on Windows, that'll become \r\r\n
19:44:17<Zao>Twey: Open files in binary?
19:44:27<Twey>Zao: It's actually a socket
19:44:30<Zao>Use bytestrings and write those?
19:45:18<Twey>Seems a bit daft, for what's actually a text- and line-oriented protocol
19:45:22<Philippa_>Twey: IIRC, that particular case works okay. Been a while since I ran into it
19:48:45<Cale>Silkworm's cabal file seems a little broken. It's missing required deps.
19:48:53<Cale>(Like Hipmunk, in particular :)
19:49:31<Cale>ACTION adds things to make cabal happier.
19:51:43<Zao>redline6561: No Leksah for me, gtk2hs doesn't do 6.10.2 yet, and I sure am not building _that_ :)
19:52:29<kadaver_>anyone here use CLojure?
19:53:19<Cale>ACTION grumbles about the hard-coded paths...
19:53:35<kadaver_>ACTION grumbles about Cale
19:53:37<Twey>Cale: Half the Cabal files are missing deps, it seems :-\
19:53:47<Twey>Philippa_: Oh really? \n isn't expanded on sockets?
19:54:05<kadaver_>SPJ grumbles about kadavers mental health
19:54:36<Twey>What's wrong with your mental health? :-P
19:56:00<pk>suppose I have f .. = .. g .. where (g = .. h .. where h = ..)
19:56:16<pk>can h have acces of what's in f 's scope ?
19:56:30<Twey>pk: Yes, so long as it's not shadowed somewhere
19:57:03<pk>ho !
19:57:08<dons>silkworm is addictive!
19:57:14<Botje>unless h depends on stuff bound in g, you can just define it in parallel
19:57:17<dons>Cale: i have a .cabal if you want it.
19:57:52<dons>http://www.galois.com/~dons/Silkworm.cabal
19:57:55<Cale>dons: That might be good, though I got it to compile. Did you manage to fix the problem with the game being unable to find its resources?
19:58:08<dons>yeah, run it in Silkworm/Resources/
19:58:11<dons>type 'haq'
19:58:11<Cale>ah
19:58:23<dons>then hit Return to start. then use the arrow keys to navigate the little silkworm
19:58:25<Cale>It might be a good idea to make it install them somewhere under ~/.cabal
19:58:27<dons>its kinda hard!
19:58:31<pk>but can it access "do variables" ?
19:58:38<Botje>no
19:58:40<Twey>No
19:58:43<pk>k
19:58:48<pk>I need a let for that right ?
19:59:02<dons>ah, in the screenshots the author gets further than i can get.
19:59:04<Botje>yes
19:59:08<dons>i can't get past the columns with gaps
19:59:47<dons>it needs to use datadir though, to find where the resources are installed
20:00:00<mercury^>dons: why can't I cabal install it?
20:00:02<mercury^>:(
20:00:14<Lemmih>ACTION falls out over the edge.
20:00:28<dons>oh, you finished the game, Lemmih ?
20:00:31<Lemmih>Time to become a butterfly, little worm.
20:00:36<dons>or did you go the wrong way :)
20:00:47<Lemmih>Yeah, I think I finished it.
20:00:59<dons>was it just the arrow keys you used?
20:01:19<Cale>I just made it past those
20:01:29<Cale>Hold right, and wiggle up and down a bit :)
20:01:58<Cale>Heh, I've fallen off the edge of the world, it seems.
20:03:52<Cale>The level is really short...
20:04:06<dons>i wonder how you make new levels...
20:04:18<dons>cabal install silkworm-levels
20:04:41<Cale>It's a good start on a game though :)
20:04:45<dons>Lemmih: duane might like a patch to have it use datadir in cabal to install the resources
20:05:12<Cale>Yeah, it should be on hackage :)
20:05:20<pk>m = do .. g .. let f = lala .. where g = .. f ..
20:05:31<pk>does that work ?
20:05:35<Botje>no
20:05:39<pk>why ?
20:06:23<Botje>in the do block, f is only visible from its declaration to the end of the block
20:06:47<pk>ok
20:07:00<pk>wait, why ?
20:07:43<Botje>because that's how do blocks work
20:08:04<Botje>the transformation from do blocks to regular haskell code is very simple, really
20:08:45<Botje>@undo do { a; b ; c; let f = d; g; z <- h; i return $ d + z }
20:08:45<lambdabot> Parse error at ";" (column 28)
20:08:52<Botje>@undo do { a; b ; c; let f = d; g; z <- h; i; return $ d + z }
20:08:53<lambdabot> Parse error at ";" (column 28)
20:08:58<Botje>@undo do { a; b ; c; let f = d; g; z <- h; i; return $ d + z; }
20:08:58<lambdabot> Parse error at ";" (column 28)
20:09:03<Botje>what.
20:09:04<Botje>bleh
20:09:06<mauke>@undo do { a; b ; c; let {f = d}; g; z <- h; i return $ d + z }
20:09:06<lambdabot>a >> b >> c >> let { f = d} in g >> h >>= \ z -> i return $ d + z
20:09:12<Botje>oh.
20:09:17<Botje>thanks, mauke
20:09:38<davidL>dons: how do I install the build dependency's based on the .cabal you linked?
20:09:52<dons>cabal install
20:10:03<davidL>ahh
20:10:08<dons>in the Silkworm directory, after putting the .cabal file in the same dir as the current Silkworm stuff
20:10:09<davidL>without arguments
20:10:13<dons>yeah
20:10:21<pk>>> is left associative ?
20:10:22<davidL>there we go
20:10:35<mauke>right associative, I hope
20:10:44<Cale>pk: >> is actually associative, but I believe it associates to the right anyway
20:11:04<Cale>x >> (y >> z) means the same thing as (x >> y) >> z anyway though
20:11:12<pk>ok thx
20:11:16<mauke>preflex: zdec z666U
20:11:16<preflex> ٦
20:11:56<a_guest>When reading a file, should I use the Data.yteStream library or use hGetContents(etc.) on a handle?
20:12:09<pk>got it
20:12:13<pk>thx a lot
20:12:15<a_guest>Data.ByteStream
20:12:19<davidL>gah [6 of 7] Compiling Physics.Hipmunk.Space failed
20:12:27<dons>galois.com/~dons/silkworm-linux-x86_64.tar.gz
20:12:35<dons>binary for linux/x86_64
20:12:50<dons>unpack; cd Resources ; ../dist/build/haq/haq ; play
20:13:02<dons>davidL: yeah, likely you don't have chipmunk.
20:13:05<dons>are you using arch linux?
20:13:07<davidL>yeah
20:13:15<dons>yaourt haskell-hipmunk
20:13:21<dons>use yaourt instead of cabal install for things with C libs.
20:13:26<dons>since it resolves them.
20:13:38<dons>yaourt --noconfirm --lightbg --aur -S
20:14:07<davidL>excellent
20:14:27<yitz>dons: how do you pronounce yaourt?
20:14:41<mauke>frenchly
20:14:49<yitz>ok
20:15:12<dons>i don't pronounce it :)
20:15:26<gwern>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4500 <-- I have an evaluation-related question
20:15:41<dolio>Hey dons, is the UIO stuff in uvector known to not work so great?
20:15:47<Cale>ヤオールト :)
20:15:48<dons>dolio: yeah. totally just a toy
20:15:53<dolio>Okay.
20:15:53<gwern>if I define 'getFileStore = darcsFileStore "./"', would that make each function get run everytime I do something like 'fs <- getFileStore'?
20:15:57<dons>dolio: pumpkin has an alpha bytestring interface
20:16:05<dons>which i think we should merge in.
20:16:14<dolio>Probably a good idea.
20:16:18<gwern>I ask because these functions are very expensive and I can't seem to track down some calls, and I think maybe things inside the record are getting run
20:16:18<yitz>Cale: c'est francais aussi
20:16:56<roconnor>gwern: what do you mean by run?
20:17:06<roconnor>gwern: evaluation or execution?
20:17:07<Cale>gwern: fs <- getFileStore means to run the action denoted by getFileStore
20:17:11<gwern>they're IO functions all; that's what I mean
20:17:16<Cale>gwern: That is, to execute it.
20:17:33<Cale>Evaluation of IO actions doesn't mean a whole lot.
20:17:50<gwern>Cale: oh. so 'darcsLog :: repo -> string' would actually run, generate a string?
20:17:58<Cale>?
20:18:14<roconnor>gwern: well, if you bind getFileStore twice, and execute it, it will of course be executed twice.
20:18:33<gwern>huh. maybe that is the problem
20:18:35<roconnor>gwern: but any evaluation that happens will generally only occur once
20:18:39<Cale>gwern: I'm not certain of what you are asking.
20:18:51<davidL>woo, it works, I think
20:19:08<Cale>If you define getFileStore = darcsFileStore "./" what you are doing is defining an action getFileStore which is the same as darcsFileStore "./"
20:19:24<Cale>You can substitute one for the other without changing the meaning of your program.
20:20:03<gwern>Cale: I am trying to call 'darcsLog' as little as possible. darcsLog is explicitly called, like once now, but when Heffalump edits a page, darcsLog is apparently running, even though manually looking over the gitit code, there should be no calls to darcsLog in the editing code - but there are f<- getFileStore calls, and I'm trying to figure out whether these bindings are the reason for darcsLog being run and wasting entire seconds
20:20:06<Cale>Mind you, if there's a lot of computation which goes into working out just *which action* darcsFileStore "./" is.
20:20:07<Cale>..
20:20:09<roconnor>Cale: well, let x = dacrsFileStore "./" in x >> x could have different performace than dacrsFileStore "./" >> dacrsFileStore "./"
20:20:18<Cale>Then it might be more efficient like that
20:20:21<Cale>roconnor: right
20:23:24<mae>dcoutts, dcoutts_, dcouts__: you around?
20:23:32<gwern>Cale: so how would I make a record that does the same thing except that getFileStore doesn't force all these IO functions?
20:23:57<Cale>gwern: If you want to run an IO action, there's nothing for it but to run the IO action.
20:23:59<mae>I need some help, which flag can i use to differentiate between a windows and non-windows platform with the c preprocessor built into ghc
20:24:14<Cale>gwern: You could instead store the result of the IO action the first time it is run.
20:24:19<gwern>Cale: I don't want the IO actions in the record to be run unless they're actually used
20:24:29<Cale>They won't.
20:25:05<Cale>An IO action never gets run unless it is main or it is part of another IO action which gets run.
20:25:55<roconnor>they won't even be evaluated either
20:26:27<Cale>(but you could force an IO action to be evaluated without running it by using seq)
20:26:49<mauke>or evaluate!
20:26:49<BrokenClockwork>hey is there an amount function in Haskell? amount -3 = 3 .... amount 3 = 3
20:26:59<gwern>abs?
20:26:59<BrokenClockwork>eh
20:27:00<mauke>heh
20:27:01<BrokenClockwork>absolute valute
20:27:02<Cale>BrokenClockwork: you mean absolute value? It's called abs
20:27:06<mauke>you are now German!
20:27:08<BrokenClockwork>thanks
20:27:13<roconnor>(but you can also execute IO using unsafePerformIO :P )
20:27:32<roconnor>> abs (-3)
20:27:34<lambdabot> 3
20:27:37<roconnor>> abs (3)
20:27:38<lambdabot> 3
20:27:38<BrokenClockwork>well I am not just now a german, I was and will be a german :D
20:27:46<roconnor>> deriv abs x
20:27:48<lambdabot> signum x * 1
20:27:57<mauke>@let abdomen x = abs x
20:27:58<lambdabot> Defined.
20:28:18<mauke>> abdomen (-pi)
20:28:20<lambdabot> 3.141592653589793
20:28:20<mercury^>@t deriv
20:28:20<lambdabot>Maybe you meant: tell thank you thanks thx ticker time todo todo-add todo-delete topic-cons topic-init topic-null topic-snoc topic-tail topic-tell type . ? @ ft v
20:28:32<mercury^>:t deriv
20:28:33<lambdabot>forall a b. (Num b, Num a) => (Dif a -> Dif b) -> a -> b
20:28:51<roconnor>:t x
20:28:52<lambdabot>Expr
20:28:57<mercury^>@src deriv
20:28:57<lambdabot>Source not found. My mind is going. I can feel it.
20:29:03<mercury^>What does deriv do?
20:29:06<Jedai>> deriv (^ 3) x
20:29:07<lambdabot> (1 * x + x * 1) * x + x * x * 1
20:29:16<mauke>derives derivations
20:29:18<roconnor>mercury^: takes a derivative
20:29:22<gwern>what about CAFs? if darcsLog appears in the profiling output as a CAF, does that mean it was run?
20:29:42<mercury^>How is it implemented?
20:30:02<roconnor>mercury^: using automatic forward differentiation
20:30:11<roconnor>aka dual numbers
20:31:28<roconnor>dual numbers add a new number called epsilon where epsilon^2 = 0
20:31:59<roconnor>(as opposed to complex numbers which add a new number i where i^2 = -1)
20:32:40<roconnor>functions are suitably extended to operate on this epsilon
20:33:06<roconnor>differentiation essentially takes the "epsilon component" of these numbers
20:33:22<roconnor>(similar to taking the imaginary component of complex numbers)
20:33:50<roconnor>for example
20:34:20<roconnor>sin(a + epsilon*b) = sin(a) + b*epsilon*cos(a)
20:34:28<roconnor>IIRC
20:34:55<roconnor>cos(a + epsilon*b) = cos(a) - b*epsilon*sin(a)
20:34:55<mercury^>But how can you implement all that on top of Haskell 98?
20:35:12<mercury^>Giving x as an argument alone puzzles me...
20:35:14<mauke>uh. easily?
20:35:18<roconnor>by defining a datatype Dif a = Dif a a
20:35:21<mauke>mercury^: x is a predefined variable there
20:35:24<mauke>> x
20:35:25<lambdabot> x
20:35:30<roconnor>and making suitable Num ... Floating instances
20:35:47<roconnor>> diff (^2) 5
20:35:48<lambdabot> Not in scope: `diff'
20:35:52<roconnor>> deriv (^2) 5
20:35:53<lambdabot> 10
20:36:04<roconnor>the x thing is totally different
20:36:13<roconnor>the x is part of the simple reflection package
20:36:28<roconnor>> foldr (+) z [a,b,c]
20:36:29<lambdabot> a + (b + (c + z))
20:36:44<roconnor>> foldr f a [x,y,z]
20:36:45<lambdabot> f x (f y (f z a))
20:36:55<roconnor>:t x
20:36:57<lambdabot>Expr
20:37:13<roconnor>Expr is a type of Number that prints like an expression
20:37:20<roconnor>> sinh x
20:37:21<lambdabot> sinh x
20:37:38<mauke>> sin 10 ^ 3 :: Expr
20:37:39<lambdabot> sin 10 * sin 10 * sin 10
20:38:02<mercury^>Is there a paper on it?
20:38:48<roconnor>so (+) :: Expr -> Expr -> Expr is simply defined as foo + bar = AddExpr foo bar
20:38:59<roconnor>where AddExpr is one of the constructors for Expr
20:39:10<roconnor>then a suitable show instance is given to render the expressions
20:39:34<roconnor>Expr and Dif are developed totally independent of each other
20:39:40<roconnor>but you put them together
20:39:48<roconnor>> deriv sinh x
20:39:49<lambdabot> (1 * exp x - negate 1 * exp (negate x)) * recip 2
20:39:53<roconnor>and this is what you get
20:40:03<mercury^>Quite neat.
20:40:42<roconnor>> deriv sinh 1 :: CReal
20:40:43<lambdabot> 1.5430806348152437784779056207570616826015
20:41:08<roconnor>> deriv sinh 1 :: Double
20:41:09<lambdabot> 1.5430806348152437
20:41:13<roconnor>> deriv sinh 1 :: Expr
20:41:14<lambdabot> (1 * exp 1 - negate 1 * exp (negate 1)) * recip 2
20:41:30<roconnor>> deriv sinh 1 :: Complex Expr
20:41:31<lambdabot> No instance for (RealFloat Expr)
20:41:31<lambdabot> arising from a use of `sinh' at...
20:41:35<ManateeLazyCat>Hi, all, i have function "keymapTest :: [Window] -> E.Event -> WindowListT Bool", and function `onKeyPress` is "onKeyPress :: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w)", so how to make expression "liftIO $ onKeyPress rootFrame $ \event -> keymapTest winList event" success? I added ">> return False" after "keymapTest winList event", but failed. Any suggestions? Thanks!
20:41:39<roconnor>ah well
20:42:03<roconnor>Complex Expr was really pushing it.
20:42:32<ManateeLazyCat>Now, type is mismatch.
20:42:41<roconnor>mercury^: there are several blog postings out there on simple reflection and on automatic differentiation in Haskell
20:43:36<ManateeLazyCat>I try use ">> return False" to fix, but can't work.
20:47:18<Cale>> 2 * deriv sinh 1 :: CReal
20:47:19<lambdabot> 3.0861612696304875569558112415141233652031
20:47:26<Cale>hmm
20:48:43<roconnor>hmm?
20:49:22<yitz>> cosh 1 :: CReal
20:49:23<lambdabot> 1.5430806348152437784779056207570616826015
20:49:49<yitz>> 2 * cosh 1 :: CReal
20:49:51<lambdabot> 3.0861612696304875569558112415141233652031
20:50:05<mauke>kosh :: Vorlon
20:50:11<mercury^>:t (deriv (+ 3) x)
20:50:11<lambdabot>Expr
20:50:25<mercury^>Can you convert those back into functions?
20:50:40<yitz>:t deriv (+3)
20:50:41<lambdabot>forall a. (Num a) => a -> a
20:50:57<ManateeLazyCat>If "expression -> argument" need argument's type is "IO Bool", but argument is "OtherType Bool", so how to make this expression work, "expression -> argument >> return False" can't work.
20:51:10<ManateeLazyCat>Any tips?
20:51:37<roconnor>> fromExpr x
20:51:38<lambdabot> Not in scope: `fromExpr'
20:51:54<yitz>ManateeLazyCat: what is OtherType?
20:51:57<roconnor>> reduce (deriv sinh x)
20:51:58<lambdabot> (1 * exp x - (-1) * exp (negate x)) * recip 2
20:52:08<roconnor>> (deriv sinh x)
20:52:09<lambdabot> (1 * exp x - negate 1 * exp (negate x)) * recip 2
20:52:19<roconnor>> reduce $ reduce (deriv sinh x)
20:52:21<lambdabot> (1 * exp x - (-1) * exp (negate x)) * 0.5
20:52:29<ManateeLazyCat>yitz: "OtherType" is "StateT WindowList IO"
20:52:34<roconnor>> reduce $ reduce $ reduce (deriv sinh x)
20:52:35<lambdabot> (1 * exp x - (-1) * exp (negate x)) * 0.5
20:52:49<ManateeLazyCat>yitz: Now my `argument` is "StateT WindowList IO Bool"
20:52:57<ManateeLazyCat>yitz: But need "IO Bool"
20:52:57<roconnor>> reduction (deriv sinh x)
20:52:59<lambdabot> Not in scope: `reduction'
20:53:14<yitz>ManateeLazyCat: you can get that to plain IO using evalStateT
20:53:30<yitz>ManateeLazyCat: but you need to tell it what the initial state it
20:53:31<yitz>is
20:53:44<ManateeLazyCat>ACTION pasted "my code" at http://paste2.org/get/196634
20:53:44<ManateeLazyCat>yitz: See above
20:53:58<roconnor>mercury^: in principle it is possible to convert back from an Expr, but I don't see a function in the lib
20:54:00<ManateeLazyCat>yitz: Failed at line `53`
20:54:06<RayNbow>http://www.reddit.com/r/haskell/comments/8hbgu/an_adaptive_state_monad_40_faster_than_our_best/ <-- will there be an adaptive state monad transformer, dons?
20:54:47<ManateeLazyCat>yitz: I have do that, but i think must have something wrong.
20:56:00<Saizan>RayNbow: yup
20:56:25<ManateeLazyCat>yitz: I don't know how to transform `WindowListT Bool` to `IO Bool`. (`WindowListT` is `StateT WindowList IO`)
20:56:42<yitz>ManateeLazyCat: where is line 53?
20:56:56<RayNbow>Saizan: that will be interesting :)
20:57:04<ManateeLazyCat>yitz: I mean error occur at line 53.
20:57:05<Twey>ManateeLazyCat: With runState
20:57:08<Twey>Er, runStateT
20:58:43<ManateeLazyCat>yitz: GHC report error at 53 line of http://paste2.org/get/196634 ,
21:00:55<ManateeLazyCat>yitz: If i remove ">> return False" from `53 line`, GHC will report "WindowListT Bool" mismatch "IO Bool", and looks ">> return False" is wrong.
21:02:01<kaol>has anyone used cabal build system to set rpath for an executable?
21:02:12<ManateeLazyCat>Now "liftIO $ onKeyPress rootFrame $ \event -> keymapTest winList event >> return False" will got can't match expected type `IO a`, against inferred type `WindowListT Bool'
21:03:53<ManateeLazyCat>yitz: Have a way to fix?
21:03:55<ski>ManateeLazyCat> :t keymapTest
21:04:00<ski>ManateeLazyCat> :t onKeyPress
21:04:00<Botje>what's the type of onKeyPress ?
21:04:13<ManateeLazyCat>"onKeyPress :: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w)"
21:04:19<ski>ACTION suspects some kind of "monad tunneling" is needed
21:04:22<ManateeLazyCat>"keymapTest :: [Window] -> E.Event -> WindowListT Bool"
21:04:27<ski>right
21:05:00<ManateeLazyCat>ski: http://paste2.org/get/196634 and failed at `53` line
21:05:17<ski>yes, i saw the paste
21:06:02<ski>you need an operation `(IO a -> IO b) -> (StateT s IO a -> StateT s IO b)', i think
21:06:36<paolino>which is the way to catch IO exception in a MonadTrans t => t IO ?
21:08:36<ManateeLazyCat>ski: `(IO a -> IO b) -> (StateT s IO a -> StateT s IO b)'?
21:08:36<paolino>catch looks not polymorphic in the monad
21:08:44<paolino>:t catch
21:08:45<lambdabot>forall a. IO a -> (IOError -> IO a) -> IO a
21:08:48<Saizan>paolino: use the MonadError typeclass
21:08:55<Saizan>?type catchError
21:08:56<lambdabot>forall (m :: * -> *) a e. (MonadError e m) => m a -> (e -> m a) -> m a
21:08:59<ski>ManateeLazyCat : wait a moment, i'm trying to define it
21:09:09<ManateeLazyCat>ski: Thanks
21:09:24<paolino>ok, thnx
21:10:05<ski>ManateeLazyCat : the basic problem is that `onKeyPress' only (directly) supports taking an `IO'-action as callback .. you can convert `IO' into `StateT s IO' .. but here the other direction is also needed
21:10:19<ski>ManateeLazyCat : hence we need to do something special
21:10:58<ski>hm
21:11:14<ski>i wonder if the solution i'm coding will work here
21:11:38<ski>i suppose that depends on how often the callback will be called .. and when
21:12:00<ManateeLazyCat>ski: So `onKeyPress` just look the *first* `IO`-action, and ignore ">> return False"?
21:13:42<ManateeLazyCat>ski: callback will respond when i `press key` with `rootFrame`.
21:14:47<ski>@type let tunnelStateTinIO :: (IO a -> IO b) -> (StateT s IO a -> StateT s IO b); tunnelStateTinIO wrap ma = StateT (\s0 -> do ref <- newRef s0; b <- wrap (do s2 <- readRef ref; (a,s3) <- ma `runStateT` s2; writeRef ref s3; return a); s1 <- readRef ref; return (b,s1)) in tunnelStateTinIO
21:14:48<lambdabot>Not in scope: `newRef'
21:14:48<lambdabot>Not in scope: `readRef'
21:14:48<lambdabot>Not in scope: `writeRef'
21:15:09<ski>@type let tunnelStateTinIO :: (IO a -> IO b) -> (StateT s IO a -> StateT s IO b); tunnelStateTinIO wrap ma = StateT (\s0 -> do ref <- newIORef s0; b <- wrap (do s2 <- readIORef ref; (a,s3) <- ma `runStateT` s2; writeIORef ref s3; return a); s1 <- readIORef ref; return (b,s1)) in tunnelStateTinIO
21:15:10<lambdabot>Not in scope: `newIORef'
21:15:10<lambdabot>Not in scope: `readIORef'
21:15:10<lambdabot>Not in scope: `writeIORef'
21:15:16<ski>hrmpf
21:15:33<tew88>Hmmm. How would I go about partially applying the modular function? Say if I wanted to apply `mod` 2 to a list of integers.
21:15:35<MyCatVerbs>ski: lambdabot has no access to anything in IO.
21:15:49<MyCatVerbs>tew88: map (`mod` 2) [1..]
21:16:03<Zao>> map (flip mod 2) [0..10]
21:16:04<lambdabot> [0,1,0,1,0,1,0,1,0,1,0]
21:16:16<Cale>> map (`mod` 2) [1..]
21:16:17<lambdabot> [1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,...
21:16:19<ski>@type let tunnelStateTinIO :: (IO a -> IO b) -> (StateT s IO a -> StateT s IO b); tunnelStateTinIO wrap ma = StateT (\s0 -> do ref <- Data.IORef.newIORef s0; b <- wrap (do s2 <- Data.IORef.readIORef ref; (a,s3) <- ma `runStateT` s2; Data.IORef.writeIORef ref s3; return a); s1 <- Data.IORef.readIORef ref; return (b,s1)) in tunnelStateTinIO
21:16:20<lambdabot>forall a b s. (IO a -> IO b) -> StateT s IO a -> StateT s IO b
21:16:32<ski>MyCatVerbs : i know .. i just wanted to check the type
21:16:42<tew88>Gah, I was trying that and it's throwing up parse errors. I guess it's something else.
21:16:45<tew88>Cheers =)
21:16:48<MyCatVerbs>ski: didn't even realise it had the types in scope at all.
21:17:18<Cale>tew88: make sure they're actually backticks and not apostrophes
21:17:43<ski>MyCatVerbs : so, whether using this will work depends on exactly what you want `onKeyPress rootFrame $ \event -> keymapTest winList event >> return False' to do
21:17:44<Cale>But yeah, it could be something else :)
21:18:12<ski>MyCatVerbs : `keymapTest' depends on an implicit `WindowList' state
21:18:49<ManateeLazyCat>ski: Yep, i need transfor `WindowList` state to deeply function to handle state.
21:18:49<ski>MyCatVerbs : *which* instance of that state do you want `keymapTest' to get as input state, whenever it is called in the callback ?
21:19:09<MyCatVerbs>ski: what? I never actually read what you were typing.
21:19:22<ManateeLazyCat>MyCatVerbs: Is me.
21:19:25<ManateeLazyCat>ski: Me?
21:19:29<ski>MyCatVerbs : sorry, wrong person :)
21:19:29<ski>yes
21:19:38<MyCatVerbs>Phew.
21:19:54<ski>ManateeLazyCat : do you want `keymapTest' to always get the state that exists at the time the callback is registered ?
21:20:07<ski>or maybe you want it to access some "current" state ?
21:20:17<ManateeLazyCat>ski: Current state.
21:20:30<ManateeLazyCat>ski: Wait, i paste my WindowList.hs
21:20:44<ManateeLazyCat>ACTION pasted "WindowList.hs" at http://paste2.org/get/196644
21:20:46<ManateeLazyCat>ski: See above
21:20:57<ski>since it's just an `IO'-callback, it has no direct way of knowing what the "current" state in the `WindowListT' monad is
21:21:46<ManateeLazyCat>ski: onKeyPress just respond `rootFrame`, then i use `winList` to get current state of WindowList
21:21:56<ManateeLazyCat>ski: onKeyPress just entry.
21:22:25<ManateeLazyCat>ski: Then i use function `windowListGetList` get current monad state of WindowList in `evalStateT`.
21:22:46<ski>(the solution with `tunnelStateTinIO' would work if `onKeyPress' called the callback directly after setting up some dynamic state, *before* `onKeyPress' returned .. but i think that's not the case here)
21:24:38<ManateeLazyCat>ski: I try your `tunnelStateT`
21:24:56<ski>i don't think it will work in your case
21:25:00<kadaver_>if you created an mp3player and wanted to store playstatistics and playlists. wouldyou use a database or just serialize it somehow?
21:26:18<ski>(i.e. the types should work out, but the behaviour would be wrong)
21:26:35<MyCatVerbs>kadaver_: serialize the playlists as .m3u files since that's what every other mp3 player on the planet seems to support.
21:28:06<MyCatVerbs>kadaver_: for play statistics, whatever. SQLite database maybe, just so you'd be able to run queries on it.
21:28:42<ski>(ManateeLazyCat : currently looking at `keymapTest',`handleKeyPress' to see where you actually use the `WindowList' state)
21:29:43<ManateeLazyCat>ski: `134` line
21:30:02<ski>(the paste doesn't show line numbers)
21:30:22<ManateeLazyCat>ski: " -- windowSplitVertically window"
21:30:47<ManateeLazyCat>ski: function `windowSplitVertically` use monad state of `WindowList`.
21:30:52<MyCatVerbs>ManateeLazyCat: no instance for Num (a -> (String -> [String]) -> b), required by expression (`134` line) ;)
21:31:08<MyCatVerbs>Well, lines rather than line, but still.
21:31:18<ManateeLazyCat>ski: `windowSplitVertically` is "windowSplitVertically :: Window -> WindowListT (Window, Window)"
21:31:24<ManateeLazyCat>ski: I show my Window.hs
21:31:36<ManateeLazyCat>ACTION pasted "Window.hs" at http://paste2.org/get/196657
21:31:38<ManateeLazyCat>ski: See above
21:32:01<ski>hm, ok .. (missed that code before since it was in a comment :)
21:32:34<ManateeLazyCat>ski: Now i comment it, and test type, i will un-comment it if type match pass. :)
21:32:43<jre2>is there a package for translating haskell records to python dictionaries?
21:33:29<ski>ManateeLazyCat : ok .. i was for a while thinking the whole of `keymapTest' could be written in `IO' since it didn't appear to actually use `WindowListT'-specific effects ..
21:33:33<ManateeLazyCat>ski: Now i integrate `callback` and `moand state` to handle `runtime state` with GTK application.
21:34:03<ski>ManateeLazyCat : so, the problem is the callback will at unknown times want to access the "current" `WindowList' state
21:34:10<kadaver_>MyCatVerbs: serialize? according to wikipedia it is just a text filewith a specified format
21:34:34<ManateeLazyCat>ski: Yep.
21:34:44<ski>ManateeLazyCat : the state that is passed around in `StateT WindowList' doesn't have a "current" state as far as some random `IO'-action is concerned
21:34:51<ManateeLazyCat>ski: Exactly when i type key with `rootFrame`
21:35:07<ski>(ManateeLazyCat : since that state is passed around in a "pure" fashion)
21:35:41<MyCatVerbs>kadaver_: yes. If your playlists are just lists of filenames then an m3u file is one of many possible serialization formats for your playlists.
21:35:42<ski>ManateeLazyCat : first, you want the callback to access the global state, not just a local state to that callback, right ?
21:35:50<ManateeLazyCat>ski: I keep many function with `WindowListT`, then i can pass current state through *function-list*.
21:36:55<ManateeLazyCat>ski: yep, but i don't want use *global state*, even some haskeller tell me *global state* is ugly and unnecessary.
21:37:06<ManateeLazyCat>ski: I keep *local state* in main function.
21:37:15<ski>ManateeLazyCat : e.g. are there other parts of the program that might change that state, except for that callback ?
21:38:02<ski>(i don't mean "global state" as in a top-level variable of `IORef ..' type .. just in the sense of accessible from "all" of your program)
21:38:20<ski>ManateeLazyCat : sorry, s/change/change or depend on/
21:38:33<ManateeLazyCat>ski: Then won't change state, but other module need access current state, so i build many function to pass current state.
21:39:02<ManateeLazyCat>s/then/them
21:39:14<ski>ok .. what i'm thinking you possibly must do is .. keep the global state in an `IORef' cell instead of passing it around with `StateT'
21:39:37<ski>(you may pass it around in `StateT' if you wish for local computations .. but your main loops should not do that)
21:39:48<ManateeLazyCat>ski: IORef is ugly, and i don't want keep a global state.
21:40:10<ski>i don't see any other way for the callback to communicate the state with the rest of the program
21:40:32<ski>i'm assuming you have no idea when in the program the callback will actually be called
21:40:56<Saizan>ReaderT (IORef s) IO seems the best approach here
21:41:07<ski>so, whatever the current value in an `IORef'-cell is when the callback is invoked by the system, that's the state the callback will see
21:41:36<ski>yes, you can make things nicer by accessing the `IORef' itself from `ReaderT'
21:41:46<ski>but it's basically the same thing
21:43:12<ManateeLazyCat>ski: See the implement of `windowHandleSynchronous` ( I use it in main loop for synchronous windows content) in Window.hs
21:43:27<ManateeLazyCat>Window.hs at http://paste2.org/get/196657
21:43:38<ski>(btw, to make things clear .. i don't mean "global state" in the sense that you couldn't have several instances of the main program, each with its own callbacks and `IORef'-cell)
21:44:42<Baughn>ACTION notes that javascript would be ever so much nicer with partial application. Why am I writing this again?
21:44:55<skorpan>Baughn: i agree
21:44:56<ManateeLazyCat>ski: I keep *local state* in main loop, but it looks like *global state*, because i do many thing in `evalSateT`.
21:45:03<ski>(btw, you may want to consider the potential issue of race conditions in updating the state, if that's possible from more than one point in a running program)
21:45:30<skorpan>Baughn: it *almost* has that though, since you don't have to provide all arguments to functions...
21:45:36<skorpan>Baughn: so in a sense you could hack it :P
21:45:39<ski>(ManateeLazyCat : we're probably using different definitions of "global" vs. "local" :)
21:45:47<ManateeLazyCat>ski: I don't know how to write a better version now.
21:46:14<Baughn>skorpan: Heh. I suppose I could, at that.
21:46:24<ski>(hint : i used them as relative terms .. "global to foo", "local to bar")
21:46:25<skorpan>Baughn: javascript is awesome, yes?
21:46:31<Baughn>skorpan: No.
21:46:41<skorpan>yes, it is, you're wrong
21:46:43<Baughn>skorpan: It's just barely good enough. ^_^
21:46:47<Baughn>ACTION has high standards
21:47:11<ski>it might be that there would be a nicer way to do this if the callback system supported that nicer way (i'm not sure what it would be, but i can imagine it might be possible)
21:47:23<ManateeLazyCat>ski: So simple, my idea is use access state in main loop, and pass to other-module to handle *current* state, and pass entry is use gtk2hs callback.
21:47:58<ski>but given that you can't change `onKeyPress', you need to communicate the state through state *in* `IO', such as `IORef'
21:48:31<Baughn>skorpan: Still, it is at least good enough that I'm now writing my first.. software renderer.
21:48:57<skorpan>Baughn: javascript is actually one of my top-three favorite languages
21:49:27<Baughn>skorpan: Fourth place, here. Python and CL beat it.
21:49:28<ManateeLazyCat>ski: Now gtk2hs's callback is not use Haskell style, I think if Haskell have own GUI libraries is better, but now i try to mix Haskell and gtk2hs.
21:49:42<skorpan>Baughn: and haskell is no. 1?
21:49:54<ManateeLazyCat>ski: yep, i can't change `onKeyPress`.
21:49:54<skorpan>Baughn: for me it's python, javascript and haskell, in no particular order
21:50:02<ManateeLazyCat>ski: That's the problem.
21:50:08<ski>right
21:50:12<Baughn>skorpan: But of course. :P
21:50:24<povman>Good morning everyone!
21:50:34<ManateeLazyCat>povman: morning.
21:50:41<ski>povman : night
21:51:07<Baughn>skorpan: I find myself missing the syntax support for functional programming in both CL and javascript. Python's.. hm, actually I think that's about on par with JS
21:51:08<ManateeLazyCat>ski: `gtk2hs callback` use different (not Haskell style) to handle problem.
21:51:17<Baughn>skorpan: But unlike javascript, CL has the MOP
21:51:25<ManateeLazyCat>s/different/different way/
21:51:57<ski>ManateeLazyCat : yes, i think you have to bite the bullet
21:52:00<skorpan>Baughn: what's MOP?
21:52:11<ski>Meta-Object-Protocol
21:52:39<ski>ACTION has only a very vague idea what that's actually about, though
21:52:50<skorpan>is that some sort of super-reflection?
21:53:04<ManateeLazyCat>ski: I have try IORef before, but many haskeller tell me that's a bad solution.
21:53:10<Baughn>Kind of. It's an object system implemented in itself (think metacircularily).
21:53:22<skorpan>Baughn: and python doesn't have this? (i'm thinking metaclassing)
21:53:32<p_l>skorpan: Python is nowhere near this
21:53:33<Baughn>skorpan: It has a pale shadow
21:53:47<ski>ManateeLazyCat : yes, it's preferrable to avoid it. but given the design of gtk, it may be unavoidable in this situation
21:54:03<ManateeLazyCat>ski: IORef give you global state, then any module can change it.
21:54:44<ski>ManateeLazyCat : only any module that is passed the `IORef' in question as an argument
21:54:54<Baughn>skorpan: As for exactly what I was missing from JS now.. well, this annoys: ' get("/maps/"+map[0], function(r) { showMap_list(divId,r); });'
21:54:59<ski>(actually s/module/function/ .. but you said the former)
21:55:15<ManateeLazyCat>ski: Gtk use the C style to handle problem, but hard to do those work in Haskell, sometimes.
21:55:36<skorpan>Baughn: you mean shorter lambda?
21:56:28<skorpan>in haskell, that would be kind of 'get ("/maps/" ++ head map) (showMap_list divId)'
21:56:39<Baughn>Quite
21:56:52<skorpan>no biggie
21:56:54<Baughn>It's no big deal, it's just.. annoying
21:56:54<ManateeLazyCat>ski: I think i need write some convertor if i use current solution.
21:57:00<skorpan>yeah
21:57:13<ski>ManateeLazyCat : doing what conversion ?
21:57:18<skorpan>but javascript 1.8 has the new "lambda" syntax: function (r) showMap_list(divId, r)
21:57:29<skorpan>that's perfectly valid in 1.8, which is in firefox 3
21:57:40<ManateeLazyCat>ski: I don't know, but i don't want to use IORef.
21:57:42<Baughn>skorpan: That said, I think I could easily grow to like JS a lot more, once I've gotten Prelude.hs written. :P
21:57:51<Baughn>Er, .js
21:58:11<skorpan>Baughn: there's always jquery ;P
21:58:11<ManateeLazyCat>ski: I will add multi-thread in the future, so i think IORef will be a problem....
21:58:21<skorpan>jquery is like a completely new javascript...
21:58:26<ski>then maybe `MVar', instead of `IORef'
21:59:18<ManateeLazyCat>ski: Do you mean concurrent?
21:59:36<ski>or maybe `SampleVar'
21:59:38<ski>yes
21:59:41<Baughn>ACTION recently had occasion to implement MVars in C++. They are.. well, one wonders why they aren't standard, that's what.
21:59:59<dons>how'd you implement them?
22:00:02<dons>reuse ghc's rts code?
22:00:11<Baughn>Ah, no. Nothing that big.
22:00:26<Baughn>Just the API, by a template class.. parametric polymorphism for the win
22:00:59<dons>right, but the tricky bit is the synchronization, no?
22:01:19<Baughn>Right, but at least I only had to write it /once/
22:01:34<p_l>Baughn: What about Boost libraries?
22:01:43<Baughn>Of course, five minutes later I spent half an hour figuring out why the compiler was complaining about missing types.. I'd forgotten it doesn't infer them
22:01:53<ManateeLazyCat>ski: I study Haskell through my project, and i write a *works* version, and keep simple, if test pass, i will add more complex thing... I'm try to evolution my code.
22:02:08<Baughn>p_l: I can't use them. They're fine if they work, but one tiny miss and you get half a book of error messages, and I'm not that good with C++.
22:02:21<p_l>hahaha
22:02:34<p_l>I heard that you always get those kind of sizes with templates :D
22:02:57<Baughn>Yep, obviously parametric polymorphism absolutely /requires/ giant errors. >_>
22:03:18<ski>ManateeLazyCat : i see
22:03:22<p_l>heh. Unfortunately, no debugger support for that ;P
22:03:29<Baughn>Well, I know it's a bit more than that, but.. seriously, haskell manages to keep the message size down
22:03:52<ski>i can't give more advice that using `IORef' or one of it's concurrent cousins `MVar',et.c. ..
22:03:54<sclv_>Baughn: until you start with the hlists that is.
22:04:00<ski>s/that/than/
22:04:09<Baughn>sclv_: I'm not planning to do type-level programming anytime soon
22:04:18<ManateeLazyCat>ski: Thanks for your help.
22:04:23<sclv_>it'll sneak up on ya.
22:04:28<ski>(blame gtk !)
22:04:45<ManateeLazyCat>ski: But i try to find other solution.
22:05:25<Baughn>Nah. Although, GHC recently told me to turn on rank-n types, so I'm thinking I should learn a /little/ more about that type-checker now
22:06:01<ski>(rank-n is not type-level programming)
22:06:02<ManateeLazyCat>ski: Haskell haven't a complete GUI libraries now, so i try to use gtk2hs, even it's not perfect
22:06:15<Baughn>ski: See? I'm still avoiding it. ^_^
22:07:48<ManateeLazyCat>ski: If Haskell have complete GUI libraries like GTK, then my life will be more easier.
22:08:05<dons>ManateeLazyCat: what's incomplete about gtk2hs?
22:08:22<dons>people are building some pretty impressive systems with it. see e.g. leksah.org
22:09:03<SamB>dons: well, it probably doesn't bind all GTK widgets in existance
22:09:08<SamB>and so forth
22:10:44<yitz>where is there more info about atom? no link from the hackage page.
22:10:50<Baughn>skorpan: Incidentally, is "eval(xhr.responseText)" a reasonable way to deserialize JSON when I'm serving both the JSON and the script doing this?
22:11:10<dons>yitz: funhdl.org
22:11:12<SamB>Baughn: from the same server?
22:11:18<Baughn>SamB: Same process, even
22:11:24<SamB>probably
22:11:31<skorpan>Baughn: it's reasonable, but i wouldn't call it very safe
22:11:45<Baughn>skorpan: Well, how can it go wrong?
22:12:02<dons>anyone have thoughts on a DPH version of gmp?
22:12:10<SamB>if they can MitM you, they could just as well MitM the script as the JSON
22:12:16<Lemmih>DPH?
22:12:17<dons>how many gmp math ops can be written in a parallel fashion?
22:12:21<ManateeLazyCat>dons: gtk2hs can't handle problem with Haskell style, maybe i missing something.
22:12:21<dons>data parallel arrays
22:12:23<skorpan>Baughn: i don't know the underlying rationale behind this, but it's generally considered harmful... i don't know. i never deal with fetching javascript through ajax.
22:12:35<dons>ManateeLazyCat: oh, you mean its not a purely functional gui?
22:12:42<ManateeLazyCat>dons: Yep
22:12:55<yitz>dons: not much there either
22:13:06<dons>yeah, if you want both comprehensive, and purely functional, you're out of luck. but there are purely functional gui libs (look at the reactive guis)
22:13:34<SamB>ACTION isn't even sure GTK is comprehensive -- hasn't found a character matrix widget yet :-(
22:13:48<Lemmih>dons: Aren't the arrays too small to compensate for the overhead?
22:13:54<dons>Lemmih: i think maybe for very large integers, with ops that are parallelisable, it might be ok.
22:13:59<dons>big big bums
22:14:01<dons>nums!
22:14:22<dons>so not the typical Integer which is barely > Word64
22:14:30<p_l>Baughn: eval is usable, but not necessarily sane
22:14:51<yitz>dons: you'd need some new math for parallel mp. know of any work on it?
22:15:16<dons>yitz: no, that's what i was wondering. surely people have published parallel math algos.
22:15:38<dons>not my background though, so not sure what the standard refs. are.
22:15:45<ManateeLazyCat>dons: I hope Haskell will develop a COMPLETE and PURELY functional GUI libraries, now i use gtk2hs, even code is ugly sometimes. At least it's the easiest way to build Haskell GUI program.
22:15:56<dons>ManateeLazyCat: right. that's a good idea.
22:16:09<dons>gtk2hs is merely as concise as every other language.
22:17:43<yitz>dons: i don't know either, but i wouldn't be surprised if it's still pretty rough
22:18:11<ManateeLazyCat>dons: Now i use gtk2hs develop a dynamic environment, after it complete, i will try to build PURELY functional GUI libraries, then will be perfect....
22:18:15<dons>maybe very large integers are a bit of a niche.
22:18:21<dons>unlike say, giant matrices.
22:18:52<yitz>dons: they used to be a niche, not anymore, but math is still catching up
22:19:15<yitz>dons: i'll bet nsa knows something about it :)
22:19:21<dons>heh.
22:22:17<ManateeLazyCat>ski: Thanks all for help, I will other way to fix my problem. :)
22:22:27<necroforest>how do you have a purley function gui toolkit
22:23:16<dons>MVC style.
22:23:27<dons>you describe the gui, and hand that off to something to render
22:23:34<dons>rather than directly manipulating the world.
22:24:07<ManateeLazyCat>dons: But still low-code to render?
22:24:12<ManateeLazyCat>s/still/still need
22:24:29<dons>something's got to get into the graphics card, and rewriting the graphics libs is boring and needless.
22:25:15<thoughtpolice>ManateeLazyCat: you describe things 'declaratively'
22:26:37<sclv_>or declare things 'describatively'
22:26:38<yitz>dons: google "parallel integer multiplication" actually turned up stuff
22:26:50<yitz>dons: algos, conferences, etc.
22:27:08<dons>mmm
22:27:24<dons>yes. interesting!
22:27:26<thoughtpolice>dons: oh, I went ahead and grabbed a copy of harrison's new book. i'm only on ch. 2, but I definitely need to spend more time with it
22:27:57<sclv_>rah: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.56.671
22:28:29<dons>cool
22:28:46<dons>killer dph app. simple, declarative, efficient large integers?
22:29:16<ManateeLazyCat>dons: BTW, leksah's not enough powerful, I think i can write a better GUI program use gtk2hs.
22:29:30<dons>please do!
22:29:36<ManateeLazyCat>dons: yes
22:29:40<ManateeLazyCat>dons: I have do it.
22:30:01<dons>you could write a gtk2hs gui tutorial while you're at it.
22:30:03<ManateeLazyCat>dons: I think i will release it after some months later.
22:30:47<ManateeLazyCat>dons: I have success develop synchronous buffer program use gtk2hs.
22:30:49<sclv_>and something using ~9 instead if zillions of processors: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.49.7271
22:31:51<Sentinel19>how do you convert an IO String to a String?
22:32:24<dons>s <- getLine
22:32:26<dons>that kind of thing.
22:32:46<Sentinel19>getPage :: String -> String
22:32:46<Sentinel19>getPage url = do
22:32:46<Sentinel19> s <- openURL url
22:32:46<Sentinel19> return s
22:32:50<Sentinel19>that doesn't work
22:33:00<dons>sclv_: oh, that last one looks good.
22:33:11<dons>Sentinel19: getPage :: String -> IO String
22:33:19<lhoersten>dons: whats up! great book
22:34:17<novatrust>Is the person responsible for learnyouahaskell.com here by any chance?
22:34:35<thoughtpolice>novatrust: BONUS is around here, yeah
22:34:49<novatrust>I want to buy that man a beer. That website is pure win.
22:35:02<dons>BONUS: <--
22:35:09<dons>lhoersten: hi!
22:35:14<novatrust>lol
22:35:24<ManateeLazyCat>Bye all.
22:35:35<lhoersten>dons: keep posting cool stuff on reddit and twitter. i like getting those random links =)
22:36:18<dons>hehe
22:36:34<ski>Sentinel19 : the `return s' converts the `s' back from `String' to `IO String'
22:36:45<Sentinel19>oh
22:36:48<kadaver_>i wrote a 400 LOC mp3player in Clojure. I am 100% confident it would be shorter and cleaner written in Haskell. it also wouldn't have this one really annoying bug because of threading.
22:36:55<Sentinel19>so how do you return just String?
22:37:06<ski>Sentinel19 : that's how the `IO'-monad works .. if you want to do `IO'-actions in a function, the return type must include `IO' somewhere
22:37:38<ski>Sentinel19 : you can't .. instead you pass that string to some other pure function
22:37:48<ski> do s <- openURL url
22:38:00<ski> let result = pureFunction s
22:38:06<ski> return result
22:38:08<ski>e.g.
22:38:13<Sentinel19>ohh ok
22:38:15<ski> pureFunction : String -> Foo
22:38:44<dons>kadaver_: and probably hella faster too
22:39:06<dons>so why not write it in haskell?
22:39:43<dons>lol "hack: a sexy Haskell Webserver Interface"
22:39:46<yitz>dons: the paper by Jebelean found that straight parallel Katsuba is good for mult, but for div isn't worth it for < 10^4 bits even after some clever tricks
22:40:03<kadaver_>dons: because I did it as an exercise there are already a million ones out there
22:40:06<dons>i think to justify DPH we'd want even bigger limits
22:40:22<dons>yitz: what parts of Num can be done in parallel?
22:40:36<dons>(*), obviously. xor... (and other Bits things)
22:40:45<yitz>yeah
22:40:59<yitz>well, also div, but it's hard
22:41:23<yitz>probably sqrt and stuff
22:41:25<roconnor>4 `div` 2 :: Expr
22:41:29<roconnor>> 4 `div` 2 :: Expr
22:41:30<lambdabot> 4 `div` 2
22:41:40<roconnor>> div 4 2 :: Expr
22:41:42<lambdabot> 4 `div` 2
22:46:10<hs2>what does this mean " The last statement in a 'do' construct must be an expression"
22:46:28<roconnor>hs2: cannot be of the form x <- foo
22:47:03<hs2>umm not sure if i get you
22:47:35<roconnor>> do { x <- return 7; y <- return 8 } :: Maybe Int
22:47:36<lambdabot> <no location info>:
22:47:36<lambdabot> The last statement in a 'do' construct must be an ...
22:47:43<roconnor>> do { x <- return 7; return 8 } :: Maybe Int
22:47:44<lambdabot> Just 8
22:49:30<novatrust>I would just like to say, the haskell community is probably the coolest group of people I've found online. If the RoR community is on one end of a spectrum, Haskell is on the far opposite.
22:50:55<dons>heh
22:51:02<dons>sigh. interwebs.
22:51:19<Nafai>interwebs rock!
22:51:21<gnuvince_>dons: what has they done now?
22:51:23<MyCatVerbs>novatrust: thank you, everybody does their best.
22:51:24<roconnor>RoR?
22:51:36<novatrust>*Ruby on Rails
22:51:42<roconnor>ah
22:51:44<dons>roconnor is trapped in the interwebs.
22:51:47<roconnor>I was thinking WoW clone
22:52:03<roconnor>ACTION checks out #rails
22:52:17<roconnor>hmm
22:52:21<roconnor>must be the wrong channel?
22:53:09<hs2>so this should return string right? s <- getLine
22:53:09<hs2> let str = purefunction s
22:53:10<hs2> return str
22:53:32<roconnor>well, it will return an IO String
22:53:36<Baughn>hs2: Well, thereabouts. It's a bit verbose, but looks right.
22:53:50<hs2>it doesnt seem to... :(
22:53:58<roconnor>could be an indentation issue
22:54:03<Baughn>"purefunction <$> getLine" does the exact same thing as those three lines. That said.. paste your code on hpaste
22:54:13<roconnor>or a fundamental misunderstanding of monadic programming
22:54:19<roconnor>one of the two :)
22:54:32<hs2>probably both.. let me paste it on hpaste
22:54:42<novatrust>Ah, here are a few explanations: http://cubiclemuses.com/cm/articles/2009/04/28/a-community-of-rockstars/ http://wooga.drbacchus.com/geek-arrogance-and-chauvinism
22:56:59<roconnor>I'm not sure if haskell has rockstars. Just a bunch of folk as various levels of ignorance ... and Oleg.
22:57:09<hs2>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4504#a4504 thats a link to it
22:57:36<roconnor>hs2: getData :: String -> IO String
22:57:38<adamvo>The ((->) r) monad doesn't seem to be used much in practice: does anybody have any opinions about it?
22:57:50<hs2>roconnor: thats the think i dont want IO String there
22:57:54<roconnor>adamvo: it is used a lot in #haskell
22:57:55<hs2>thing*
22:58:03<adamvo>roconnor: exactly
22:58:08<roconnor>hs2: must be there. Don't worry. It'll be good
22:58:20<centrinia>hs2, Put "unsafePerformIO $" before the "do" :p
22:58:26<roconnor>adamvo: I think it might be used more if it weren't such a pain to import
22:58:37<roconnor>centrinia: stop that. :)
22:58:41<Cale>adamvo: It's one of my favourite monads actually
22:58:47<Cale>adamvo: I use it all the time
22:58:49<Baughn>centrinia: Stop telling newbies to hit the shiny button. The shiny, red button.. the jolly, candy-like button...
22:59:05<hs2>what does the red button do/
22:59:12<p_l>Baughn: Covered in blood?
22:59:13<Baughn>Nobody knows
22:59:16<Baughn>It's undefined!
22:59:25<zerosoul>What is the best RAT soft do you guys think?
22:59:26<centrinia>It launches missiles unpredictably.
22:59:30<adamvo>hmm, in the newest base, its hidden away in Control.Monad.Instances
22:59:37<Baughn>centrinia: Don't be too sure of that
22:59:43<roconnor>hs2: when you want to use getData :: String -> IO String, #haskell will be here to help teach you to use it. Basically you will still be able to use it inside do blocks
22:59:45<Baughn>p_l: That makes.. sense
23:00:07<Baughn>hs2: You can call pure functions from IO code, but not ever the other way around..
23:00:21<Cale>hs2: unsafePerformIO takes an IO action and turns it into a magical value whose evaluation causes that IO action to execute. Because the evaluation order of a Haskell program isn't well-defined, this can result in lots of nonsense, and programs whose behaviour changes drastically under optimisations.
23:00:24<Baughn>hs2: If you don't want an IO tag on the function, you'll have to read your input elsewhere
23:00:54<Cale>hs2: Basically, you should treat using unsafePerformIO with the same level of seriousness as modifying your compiler. :)
23:00:55<hs2>Ok that clears things up..
23:01:14<Cale>(as it lets you cheat all kinds of safeguards)
23:01:57<Baughn>I was about to protest, but..
23:02:14<Baughn>ACTION has the compiler upside down with various tubes hanging loose
23:03:09<Sentinel19>does it take a lot of seriousness to modify a compiler/
23:03:12<novatrust>Better not put those tubes in a series.
23:03:37<Baughn>novatrust: That's just it. I'm trying to build a series of.. tubes, but the tubes keep /leaking/
23:03:54<novatrust>Same problem Al Gore had?
23:03:56<adamvo>Cale: agreed, but it doesn't seem to save much LOC, since the implicit argument can be added back with a couple of characters lost
23:03:57<Baughn>Sentinel19: As you can tell, not very.
23:05:07<kerlo>hs2: you can't (without Cale yelling at you) turn an IO String into a String, but you can easily turn a function taking a String into a function taking an IO String.
23:05:09<p_l>Baughn: You should switch to avian UDP
23:05:30<novatrust>lol
23:05:39<Baughn>p_l: That works well in metropolitan area networks, but there are too many packet droppings to be useful indoors
23:07:10<hs2>Ok so can you just move everything that you do with the input in a "do" and return the results instead?
23:08:32<roconnor>sounds about right
23:08:50<Sentinel19>return the results instead? didn't you always want to return the results?
23:09:22<QtPlaty[HireMe]>Is there any way to abstract out patten matches, for example in case?
23:09:43<hs2>I need to return a list of inputs for example.. but i guess it only will let me return a IO List not just a List
23:09:46<kadaver_>example?
23:09:53<adamvo>hs2: sure, but why not put that stuff in a separate pure function (which may be easier to test)?
23:10:56<QtPlaty[HireMe]>I have a whole lot of functions that are basicly. Send message to server, get reply from server, check reply to see its an error, parse the rest of the output.
23:11:22<roconnor>QtPlaty[HireMe]: sounds like a job for a monad
23:11:49<roconnor>Arguably the Maybe monad abstracts out it's pattern match
23:12:01<roconnor>for a loose understanding of abstracting a pattern match
23:12:17<roconnor>it certainly eliminates a series of nested case statements
23:12:25<QtPlaty[HireMe]>I would like to abstract this out into a function that takes the thing to send, the responce that is expected and the parsing function.
23:22:33<QtPlaty[HireMe]>It doesn't need to deconstruct the data, so I can just have a function 'foo -> Bool' and have that trip the parser.
23:23:22<sclv_>in general it sounds like catamorphisms
23:23:33<QtPlaty[HireMe]>sclv_: How so?
23:24:41<novatrust>Are unit tests needed/used in haskell?
23:25:15<sclv_>:t maybe
23:25:16<lambdabot>forall b a. b -> (a -> b) -> Maybe a -> b
23:25:24<sclv_>:t either
23:25:25<lambdabot>forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
23:25:43<Cale>novatrust: Sure, though we also have richer alternatives like QuickCheck
23:26:04<novatrust>googling QuickCheck now
23:26:05<QtPlaty[HireMe]>novatrust: I've been working with hUnit and it works well.
23:26:13<dons>quickcheck is heavily used
23:26:15<dons>hunit less so
23:26:44<Cale>novatrust: Unit tests are not needed quite as much as in a dynamically typed language, but if you want to make sure that your program works, testing it is always a good idea :)
23:27:03<novatrust>Thanks - very interesting
23:27:39<Cale>There are some nice things about Haskell code which make it easy to test -- one in particular is that functions produce results which only depend on their input parameters.
23:28:05<novatrust>And, if I understand correctly, that's how all pure functional languages should behave?
23:28:06<Cale>So there's usually no need to construct elaborate contexts to test the pure bits of your program, at least.
23:28:09<Cale>yeah
23:29:14<Cale>And you can be sure that if a function gives the right value when testing it, it'll still give the right value when the actual program runs.
23:29:24<novatrust>got it
23:29:38<Sentinel19>> unwords ["aa","index.php?page=2"]
23:29:40<lambdabot> "aa index.php?page=2"
23:31:41<Cale>novatrust: The other thing is that since there's no mutation going on, it's easier to compare the value you started with to the result -- you don't have to make a copy of it to stash somewhere.
23:32:11<Cale>Again something sort of obvious, but nice to notice.
23:32:51<novatrust>thanks for pointing that out - I hadn't thought of that
23:43:43<Sentinel19>> head (repeat "Nothing")
23:43:44<lambdabot> "Nothing"
23:43:58<dons>hpong is also pretty nice.
23:44:04<dons>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HPong-0.1.2
23:47:40<byorgey>I got all excited about Silkworm and then realized that it only compiles on Macs =(
23:47:54<thoughtpolice>gaaah
23:48:01<dons>byorgey: ?
23:48:04<dons>works fine on linux...
23:48:05<thoughtpolice>byorgey: I can't even get glfw on my OS X box
23:48:17<byorgey>dons: really? maybe I just didn't do it right.
23:48:21<thoughtpolice>because ghc 6.10.2 apparently causes the build to fail with some weird sse-related error that shouldn't happen
23:48:31<dons>http://www.galois.com/~dons/silkworm-linux-x86_64.tar.gz
23:48:32<thoughtpolice>ACTION treks over to #ghc
23:48:58<dons>ACTION wonders where the 'no linux' idea came from.
23:49:17<thoughtpolice>byorgey: I say this because, I installed glfw on OS X with ghc 6.10.1, and the next day tried to install it when I upgraded to 6.10.2, and it no longer worked.
23:49:31<byorgey>dons: it says so in the README.
23:50:05<dons>weird.
23:50:05<byorgey>and indeed, when I followed the instructions in the README, it compiled fine but then when I tried to run it gave some error messages which referred to some Mac stuff.
23:50:30<dons>look at the .cabal file: http://www.galois.com/~dons/Silkworm.cabal
23:50:33<dons>'sfine.
23:50:55<byorgey>except the executable name is still 'haq' =)
23:51:01<byorgey>looks like someone copy-pasted =)
23:51:07<dons>haha
23:51:22<kadaver_>what si hpong
23:51:30<Sentinel19>> head (tail (drop 3 [8,4,2,1,5,6]))
23:51:32<lambdabot> 5
23:51:35<dons>pong. in haskell. with opengl. helloworld for haskell games
23:52:24<monadic_kid>need something like that in in reactive form
23:52:37<dons>one of the reactive fans should do such a thing. yeah.
23:53:48<byorgey>hmm, I've gotten further than before, now it is complaining that background.png does not exist
23:53:55<byorgey>seems like it's looking in the wrong directory for it
23:54:20<byorgey>ah, it works if I cd to the Resources dir first
23:57:56<dons>yes.
23:57:58<byorgey>woohoo, I won!
23:58:24<byorgey>at least, I seem to be in infinite freefall off the end of the level =)
23:58:52<dons>heh
23:59:17<dolio>Someone should rewrite I Wanna be the Guy in Haskell.
23:59:37<Cale>You Have To Burn The Rope

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