Experimental IRC log haskell-2009-05-30

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:15:10<phenrique>ex = [2,4,7]
00:15:11<phenrique>ex1 = [ a | a <- ex, a 'mod' 2 == 0]
00:15:22<phenrique>
00:15:37<phenrique>lexical error in string/character literal at character 'o'
00:15:39<phenrique>why?
00:15:53<phenrique>only work if mod a 2
00:15:57<phenrique>ghci
00:16:12<ClaudiusMaximus>you probably mean `mod` (infix operator) instead of 'mod' (character literal)
00:16:35<ClaudiusMaximus>> 42 `mod` 5
00:16:36<lambdabot> 2
00:17:36<Jedai>phenrique: the ` around `mod` are backquotes
00:20:53<phenrique>Thanks Jedai :)
00:22:20<phenrique>Thanks CladiusMaximus
00:29:35<PetRat>I'm trying to install HDBC-mysql on a Windows box. HDBC is already installed. I downloaded the tar file and put it in a directory. I went into that directory and ran cabal install. cabal got as far as saying "Linking .\dist\setup\setup.exe and has now hung for ten minutes. What should I check next?
00:34:23<jaredj>help, my brain isn't quickcheck shaped
00:34:38<Gracenotes>:o
00:34:41<MyCatVerbs>jaredj: just write a function from random data to Bool.
00:34:47<Baughn>ACTION grabs jaredj's brain and starts cutting it in shape
00:34:47<lambdabot>Baughn: You have 1 new message. '/msg lambdabot @messages' to read it.
00:34:59<jaredj>owowow
00:35:05<MyCatVerbs>@check \a b c -> (a + b) + (c :: Int) == a + (b + c)
00:35:06<lambdabot> "OK, passed 500 tests."
00:35:37<PetRat>I'm trying to install HDBC-mysql on a Windows box. HDBC is already installed. I downloaded the tar file and put it in a directory. I went into that directory and ran cabal install. cabal got as far as saying "Linking .\dist\setup\setup.exe and has now hung for ten minutes. What should I check next?
00:35:38<MyCatVerbs>Okay, easy version. You need to write an expression which is Testable.
00:35:44<MyCatVerbs>A Bool is Testable.
00:36:12<MyCatVerbs>A function from something that QC knows how to generate random instances of is Testable too.
00:36:16<MyCatVerbs>@check True
00:36:17<lambdabot> "OK, passed 500 tests."
00:36:30<MyCatVerbs>jaredj: does that make sense?
00:37:12<jaredj>MyCatVerbs: for little simple things
00:37:29<jaredj>MyCatVerbs: i'm trying to test a parser, so i need to make arbitrary strings
00:38:09<MyCatVerbs>Oh, so you need to write an Arbitrary instance.
00:38:22<jaredj>of the form "KEY:VALUE\r\nKEY2:VALUE2\r\n\r\n"
00:38:38<MyCatVerbs>Right. Make a newtype for it, and put an Arbitrary instance together for the newtype.
00:38:51<PetRat>Okay I tried again to get it from the web and got this error: http://www.mibbit.com/pb/nM797u
00:39:01<PetRat>(tried to get HDBC-mysql)
00:39:32<MyCatVerbs>So, newtype TestString = TS [Char]. instance (Arbitrary TestString). Then your checks look like (\(TS input) -> ...)
00:39:54<jaredj>MyCatVerbs: i think i have too many newtypes
00:40:13<jaredj>i made a newtype Key and a newtype Value
00:40:29<Gracenotes>newtypes for instances... a necessary evil? News at 11
00:40:35<MyCatVerbs>So? That doesn't even necessarily matter, it'll just be a bit verbose.
00:40:35<jaredj>and an Arbitrary Key (a choice from a fixed list)
00:41:02<jaredj>and an Arbitrary Value (made via an Arbitrary String out of Arbitrary Chars)
00:41:41<jaredj>I think arbitrary 2-tuples are constructed for me, and arbitrary lists are too
00:42:15<MyCatVerbs>jaredj: sounds like you're getting along just fine. What's your issue?
00:43:21<jaredj>those last two things that get automatically constructed
00:43:37<jaredj>they make my mind slip off of what type my property function should be
00:44:21<jaredj>out of an Arbitrary [(Key,Value)] i make a String, then parse the String into [(String, String)]
00:44:54<MyCatVerbs>Yep.
00:45:30<jaredj>so - prop_blabla :: [(Key, Value)] -> Bool?
00:46:09<MyCatVerbs>So you want something like (\keyvaluepairs -> parse (buildString keyvaluepairs) == map (\(Key k,Value v) -> (k,v)) keyvaluepairs)
00:46:53<MyCatVerbs>i.e. run the constructed string through your parser, and check that the output of that was correct for the keys and values that were passed in.
00:48:54<jaredj>:d
00:51:18<PetRat>Okay I tried to get HDBC-mysql and got this error: http://www.mibbit.com/pb/nM797u
00:52:15<gwern>PetRat: guessing you didn't install mysql
00:57:07<PetRat>gwern: I installed mysql in the sense of downloading a thing from the mysql website and extracting it. I now have several programs available on the start menu including the query browser. Is there something else I need to do?
00:57:24<gwern>find out where the missing binary comes from
00:57:34<gwern>a complex package like mysql may be broken up several ways
00:58:17<PetRat>is the error telling my that mysql_config can't be found? That doesn't sound like a binary.
00:58:33<PetRat>Or is that a file that would come with the source for mysql?
00:58:36<jaredj>got it! thanks MyCatVerbs
00:59:12<gwern>PetRat: mysql_config sounds like a binary to me
00:59:45<PetRat>gwern: by the way I'm not installing a mysql db itself on my machine... I only need the interface to connect to a mysql server on another machine. Can you give me any clue what to search for to find this binary?
00:59:53<gwern>nope
01:12:17<Badger>PeakerWork: ping
01:18:24<Qriva>What is "Literate Haskell"?
01:21:09<dolio>It's haskell where the default mode is commenting.
01:21:16<dolio>And you have to put delimiters around the code.
01:21:31<dolio>(Or in front of it on a line, as the case may be.
01:21:36<Qriva>dolio: ahh
01:21:37<Qriva>thanks
01:21:46<MyCatVerbs>There are two formats for it. Bird script, where the Haskell lines have > at the front and everything without a > is a comment.
01:22:15<MyCatVerbs>The other one is TeX notation, where Haskell code is between \begin{code} and \end{code} markers, and everything else is treated as a comment.
01:22:37<MyCatVerbs>The markers have to be on lines by themselves in that one.
01:23:32<dolio>I'm not sure if you can mix and match, so it may not be strictly the inverse of commenting.
01:23:39<dolio>Converse?
01:24:15<dolio>Obviously you can't mix and match if you want to produce correct looking latex at the end.
01:24:30<MyCatVerbs>AFAIK mixing and matching is not supported at all.
01:25:49<MyCatVerbs>Oh, no, you're right. You can mix and match them freely. It's just that nobody thinks that that is a good idea.
01:26:19<J11>Is the TeX notation used much?
01:26:45<SamB>J11: not too unoften
01:27:11<SamB>the bird feet are used in a lot of the emails that Oleg writes ...
01:27:17<MyCatVerbs>J11: AFAIK people sometimes use it in papers.
01:27:33<MyCatVerbs>You see Bird notation an awful lot more online, in people's blogs and such.
01:28:06<J11>Because I use Literate.lhs to delit lhs, but I only see bird notation there
01:28:38<povman>My brother wanted me to make a set of functions e.g. isOne = (== 1), isTwo = (== 2) etc.
01:28:46<povman>I got the chance to say
01:28:47<povman>@faq
01:28:47<lambdabot>The answer is: Yes! Haskell can do that.
01:29:07<SamB>> map (==) [1..]
01:29:08<lambdabot> Overlapping instances for GHC.Show.Show (a -> GHC.Bool.Bool)
01:29:08<lambdabot> arising fro...
01:29:14<MyCatVerbs>povman: better yet, don't hardcode the values directly into the code like that!
01:29:19<SamB>> map (==) [1..] :: [Int -> Bool]
01:29:20<lambdabot> Overlapping instances for GHC.Show.Show
01:29:20<lambdabot> (GHC.T...
01:29:25<povman>I was thinking of TH
01:29:26<SamB>> map (==) [1..] :: [Expr -> Bool]
01:29:27<lambdabot> Overlapping instances for GHC.Show.Show
01:29:27<lambdabot> (Simpl...
01:29:39<povman>He doesn't care what it actually does, he just wants the symbols there
01:29:42<MyCatVerbs>povman: {-# LANGUAGE Cpp #-}, then #define ONE 1... isOne = (== ONE)
01:30:10<povman>Even better, use an english number generator in TH
01:30:58<povman>But then I decided that was entirely useless and didn't.
01:31:09<povman></story>
01:31:16<Qriva>I don't think Haskell is working properly -- it doesn't seem to know what putStrLn is, and it doesn't like me using "name <- getLine"
01:31:58<povman>Qriva: moonpatio.com
01:32:41<MyCatVerbs>povman: the disturbing thing is that the TH solution almost sounds appealing.
01:32:55<povman>:D
01:33:40<Qriva>povman: it's up there
01:33:41<povman>The only downside is that it's completely RIDICULOUS
01:34:32<Qriva>povman: something messed up with my indentation i guess
01:34:43<povman>Qriva: I see your indenting is all out of whack. All the stuff in the 'do' should be lined up. I'd use spaces rather than tabs.
01:34:54<Qriva>povman: i have textmate setting my tabs as 2 spaces
01:35:00<Qriva>but for some reason it used actual tabs
01:35:02<povman>not in that paste
01:35:06<Qriva>yeah i know that's weird
01:35:09<Qriva>thanks though
01:35:11<povman>hang on
01:35:28<povman>make sure it's set to 'soft tabs'
01:35:38<Qriva>povman: yeah it is now, i think it's on a per bundle basis
01:35:44<povman>ah
01:36:14<Qriva>i have to do it: "damn kids and their fancy textmates"
01:36:30<Qriva>in MY day we had to hit the space bar
01:36:40<povman>you still do in tm
01:36:47<Qriva>well sure, it was a joke
01:36:56<povman>it's emacs users that get it easy
01:37:02<Qriva>not at first ;)
01:37:46<Qriva>and by "not at first" i mean: i've tried to learn emacs a few times now with limited amounts of success
01:38:16<povman>I'm quite sure it's possible to make emacs work exactly like textmate, but noone has yet
01:39:28<thoughtpolice>for snippet functionality there's the yasnippet extension
01:39:32<thoughtpolice>there's one for vim too
01:39:49<povman>say, isn't haskell ~ yi == lisp ~ emacs ?
01:39:58<thoughtpolice>something like that, yes :)
01:40:12<povman>I ought to have a go at it
01:47:20<povman>ha. ghc-6.10.1 requires old-time ==1.0.0.2 however old-time-1.0.0.2 was excluded because ghc-6.10.1 requires old-time ==1.0.0.1
01:55:27<shapr>@seen luqui
01:55:27<lambdabot>I saw luqui leaving #haskell 4m 10d 20h 25m 26s ago, and .
01:59:10<kniu>de bruijn representations,
01:59:20<kniu>as described in TaPL, confuse me.
01:59:38<kniu>why define a "family of sets" containing the terms?
02:00:25<kniu>also, by just choosing a hard number with which to represent free variables, what if the lambda terms extend too far and collide with the chosen numbers?
02:00:36<kniu>Ain't that the same problem as before?
02:06:56<iop>> Just 5 >>= (+1)
02:06:57<lambdabot> No instance for (GHC.Num.Num (Data.Maybe.Maybe b))
02:06:57<lambdabot> arising from the lite...
02:07:02<iop>> Just 5 >>= return (+1)
02:07:03<lambdabot> The section `GHC.Num.+ 1' takes one argument,
02:07:03<lambdabot> but its type `Data.Maybe.May...
02:07:06<iop>> Just 5 >>= return . (+1)
02:07:08<lambdabot> Just 6
02:07:22<iop>> Just 5 >>= return $ (+1)
02:07:23<lambdabot> Couldn't match expected type `a -> a1'
02:07:31<iop>> Just 5 >>= \j -> return $ (+1) j
02:07:32<lambdabot> Just 6
02:07:39<iop>> Just 5 >>= return . (+1)
02:07:41<lambdabot> Just 6
02:07:54<iop>> fmap (+1) (Just 5)
02:07:55<lambdabot> Just 6
02:08:00<iop>> <$> (+1) (Just 5)
02:08:01<lambdabot> <no location info>: parse error on input `<$>'
02:08:07<iop>> (+1) <$> (Just 5)
02:08:08<lambdabot> Just 6
02:08:27<iop>> (+1) . (Just 5)
02:08:28<lambdabot> Couldn't match expected type `a -> b'
02:08:41<iop>do you use fmao a lot?
02:08:53<iop>fmap
02:09:00<glguy>iop, you can send those commands to lambdabot in /msg
02:09:05<glguy>if you want to avoid flooding the channel
02:10:28<iop>is there a funcvtion mapcat?
02:13:29<enolan>:t concatMap
02:13:31<lambdabot>forall a b. (a -> [b]) -> [a] -> [b]
02:13:33<ski>> concatMap show [1,23,456]
02:13:34<lambdabot> "123456"
02:14:45<ski>> concatMap tails . inits $ [0,1,2,3]
02:14:46<lambdabot> [[],[0],[],[0,1],[1],[],[0,1,2],[1,2],[2],[],[0,1,2,3],[1,2,3],[2,3],[3],[]]
02:29:36<jaredj>i'm a text-only terminal. w3ming through hathe docs is killing me. is there any text command to list functions in a module, or show documentaton for one function?
02:30:46<MyCatVerbs>:browse
02:31:05<MyCatVerbs>e.g. :browse Data.Map, prints all the function names and types exported by Data.Map.
02:31:46<MyCatVerbs>Unfortunately there's no exporting of plaintext documentation to anywhere where GHCi can see it.
02:33:20<jaredj>ah. well thx. stuff gets old over screen at 19200 bps
02:33:41<MyCatVerbs>Ouch. Slow terminals suck. :/
02:34:06<MyCatVerbs>Might lynx be a better choice of browser for a slow terminal than w3m?
02:34:27<jaredj>486 running kermit in dos, serial port -> gumstix running linux, wifi -> ssh -> normal box :)
02:34:35<jaredj>probably
02:34:37<hdh>BONUS: the sentence before http://learnyouahaskell.com/syntax-in-functions#case-expressions says "and some that's more readable."
02:34:41<MyCatVerbs>Dear me. Why...?
02:34:51<hdh>missing a "think"
02:35:05<p_l>jaredj: any chance of modding it to use >1MBit serial? :)
02:35:54<jaredj>two computers, one screen, one wife on facebook :)
02:36:19<MyCatVerbs>Ye gods, that's inhumane.
02:37:07<jaredj>look out, she got off facebook and now she's watching ;)
02:37:37<Ralith>tell her her treatment of you is cruel and unusual
02:38:59<MyCatVerbs>Better idea, tell her she looks gorgeous in whatever she's wearing, and that perhaps she might like to take it off.
02:39:08<MyCatVerbs>Then forget about IRC and facebook for a few hours.
02:39:20<jaredj>*blush*
02:39:37<MyCatVerbs>Bah, humbug. Married humans should be banned from blushing.
02:39:55<gwern>and married women should be in wimples
02:39:59<gwern>and burkhas!
02:40:26<MyCatVerbs>gwern: let's please have exactly the opposite of that rule.
02:40:33<jaredj>i agree (says the wife who is typing this sentence) and for teh record he's just too lazy to move and go back to the other computer which i did offer him
02:40:38<gwern>thye... should be naked?
02:40:54<gwern>ACTION ponders the opposite of wearing a wimple. becoming bald?
02:41:10<jaredj>bahaha bad timing
02:41:31<MyCatVerbs>gwern: no, they should be wearing more or less whatever they feel like, rather than constrained to any given outfit. :P
02:50:11<iop>> return . (+1) =<< Just 5
02:50:12<lambdabot> Just 6
02:58:23<hatds>is there a way to view fixities in ghci?
02:58:39<bos>:info
02:59:01<bos>as in, ":info (+)"
02:59:30<hatds>thanks
03:01:10<chessguy>:info (+)
03:01:14<chessguy>@info (+)
03:01:15<lambdabot>(+)
03:01:28<chessguy>wow. thanks, LB...
03:01:37<chessguy>@help info
03:01:38<lambdabot>help <command>. Ask for help for <command>. Try 'list' for all commands
03:08:46<BMeph>bos: Actually, I don't think you even need the parens around it.
03:09:08<dmwit>chessguy: ?info corrects to ?undo
03:09:23<chessguy>uh
03:09:25<chessguy>wow
03:09:27<chessguy>@help undo
03:09:29<lambdabot>undo <expr>
03:09:29<lambdabot>Translate do notation to Monad operators.
03:09:37<chessguy>oh, _that_ undo
03:09:38<dmwit>?info do { x <- f; return (g x) }
03:09:39<lambdabot>f >>= \ x -> return (g x)
03:09:54<chessguy>that's...awesome
03:09:58<dmwit>?undo do { (Foo x) <- f; return (g x) }
03:09:59<lambdabot>f >>= \ a -> case a of { (Foo x) -> return (g x); _ -> fail ""}
03:10:07<dmwit>Wow, it actually gets that right!
03:10:10<dmwit>undo++
03:12:43<hatds>?undo return ()
03:12:44<lambdabot>return ()
03:12:48<hatds>?undo do return ()
03:12:49<lambdabot>return ()
03:12:51<hatds>:)
03:14:38<BMeph>I wish I had "undo" on my system... :)
03:14:52<Berengal>Ctrl-Z
03:14:57<Berengal>:)
03:15:09<gwern>BMeph: you could install lambdabot
03:15:27<Gracenotes>FAIL
03:15:42<BMeph>gwern: Well, I could _try_, you mean. ;p
03:16:12<gwern>lambdabot isn't as impossible to install as it used to be...
03:17:08<chessguy>so it only requires one advanced degree instead of 4?
03:17:11<Berengal>lambdabot doesn't do bf anymore :(
03:17:12<Gracenotes>man the cabal
03:17:14<MyCatVerbs>I swear lambdabot used to rely on bugs in GHC at one point.
03:17:15<Berengal>@bf .,
03:17:16<lambdabot> fd:7: hClose: resource vanished (Broken pipe)
03:17:33<gwern>Berengal: that's because the brainfuck interpreter isn't installed on the machine lambdabot is running on
03:17:33<MyCatVerbs>But that's just a pessimistic overstatement, I think.
03:17:36<gwern>(probably)
03:17:38<Gracenotes>you need to pass Computer Science III to install a lambdabot
03:17:43<Gracenotes>fact
03:17:52<gwern>Gracenotes: really, a 'cabal install lambdabot' should work!
03:19:08<MyCatVerbs>ACTION tries it.
03:19:29<MyCatVerbs>Compiling HTTP... binary...
03:19:49<MyCatVerbs>Brainfuck? It seriously has a brainfuck interpreter in it? ô_Ô
03:19:59<Berengal>@help bf
03:20:00<lambdabot>bf <expr>. Evaluate a bainf*ck expression
03:20:02<michaeljt>so far, that's all thats installed for me
03:20:48<michaeljt>now unlambda....
03:20:48<MyCatVerbs>@oeis map (join (*)) [1..10]
03:20:48<lambdabot> Sequence not found.
03:21:06<MyCatVerbs>@oeis [1,4,9,16,25]
03:21:06<lambdabot> Sequence not found.
03:21:35<gwern>MyCatVerbs: no, it shells out to a bf interpreter
03:21:42<MyCatVerbs>Oh, right. It doesn't want the args in list notation or anything.
03:21:48<gwern>since I thought it was silly to have a bf interpreter in lambdabot...
03:22:11<MyCatVerbs>Hrmn. The lambdabot build failed loading ncurses.
03:22:23<Berengal>ncurses?!
03:22:34<Berengal>What does \b need ncurses for?
03:22:36<gwern>template haskell. what a flaky tech
03:23:03<gwern>sometimes I wish for a haskell-scheme hybrid, with macros and all
03:23:05<MyCatVerbs>TH uses ncurses!?
03:23:25<outchanter>liskell?
03:23:29<Berengal>gwern: liskell
03:23:34<gwern>Berengal: dead
03:24:01<gwern>(and that doesn't get us various advantages of scheme like a less bdsm type system)
03:24:03<Berengal>gwern: "Make it live again, then", I suppose is the reply I should be making
03:24:13<gwern>Berengal: it's a fork of ghc; that's madness
03:24:17<bnijk>what is this "pony" package?
03:24:21<bnijk>i want to install it real badly
03:24:38<bnijk>in hackage
03:24:42<gwern>bnijk: everyone wants a pony
03:24:45<gwern>just give in already'
03:24:49<Berengal>gwern: Haskell without the types is basically lisp with ml-syntax already...
03:24:49<bnijk>what is it!
03:25:36<gwern>MyCatVerbs: also, TH probably links in ncurses because of the whole ghci infrastructure; lambdabot itself isn't declaring or using anything with ncurses
03:25:52<gwern>it has a prompt, yes, but it's your normal repl
03:26:09<MyCatVerbs>Hrmn.
03:27:56<bnijk>is there a list somewhere of really weird linux programs
03:28:00<bnijk>stuff like amor and cowsay
03:28:13<p_l>bnijk: afaik no such list
03:28:47<p_l>bnijk: unfortunately that's why sometimes you need to grab a book or get a course - a lot of interesting stuff passes by unnoticed without those :)
03:29:11<gwern>(well, lambdabot installs and runs without a problem here)
03:29:18<bnijk>hm
03:29:19<gwern>psnively says: All your Data.Foldable are belong to base.
03:29:19<outchanter>wouldn't it be easy to reimplement liskell as a scheme preprocessor that produces .hs files?
03:29:26<michaeljt>oh, here's the you-can-have-pony film http://www.youtube.com/watch?v=Tu0iuHxL3z8
03:29:49<dolio>What's the deal with -XMonoLocalBinds?
03:30:04<kniu>bnijk, for some fun, check out "sex"
03:30:09<gwern>outchanter: what happens when you write something that doesn't type in haskell but would be fine scheme?
03:30:27<michaeljt>repent
03:30:29<kniu>I've had my share of amusement trolling IRC channels with its output.
03:30:37<MyCatVerbs>ACTION grumbles about Arch Linux and linker scripts.
03:30:56<bnijk>²²ooo
03:31:05<bnijk>this looks funny
03:31:06<gwern>michaeljt: repent and rethink one's sins^Wsource eh
03:31:13<bnijk>i write poetry like this
03:31:32<bnijk>"Help!" stammered the saucy sausage abuser as the pile-driving faggot butler sucked her rosebud paps and crammed his miniscule meat loaf into her gobbling slot machine.
03:31:50<bnijk>hmmm
03:32:04<outchanter>gwern: a scheme embedded in Haskell as a scripting language?
03:32:33<MyCatVerbs>gwern: lambdabot doesn't seem to depend on mueval for some reason?
03:32:36<michaeljt>gwern: lambdabot cabal-installed, amazing
03:32:51<gwern>MyCatVerbs: cabal can't express runtime deps on executables
03:33:24<gwern>MyCatVerbs: since mueval also exposes a library, I *could* add a dep on mueval-library, but I feel like dcoutts turns in his grave everything I do that hack
03:33:37<MyCatVerbs>Heh. Good reason. :)
03:33:41<gwern>outchanter: or maybe the other way around ala typed scheme
03:34:14<outchanter>gwern: qi? http://en.wikipedia.org/wiki/Qi_(programming_language)
03:34:41<Gracenotes>hm, GHC says it doesn't recognize -XNoHugeExecutable!
03:34:56<gwern>outchanter: well, qi is weird. but any language with a easily turing complete type system is weird
03:35:20<dolio>Qi's type system seems to be very programmable.
03:35:34<gwern>Gracenotes: just as well. the pragma could only throw an error telling you to go try jhc
03:35:53<gwern>dolio: well, yeah. that's the point of qi, iirc
03:36:03<dolio>The author posted something about implementing a dependent type theory checker on comp.lang.functional not too long ago.
03:37:16<p_l>publishing it under GPL was a clever trick (Qi, that is)
03:37:41<PHO_>Bigloo the Scheme compiler has an optional type annotations. http://www-sop.inria.fr/mimosa/fp/Bigloo/bigloo-1.html#Features
03:37:50<dolio>At least, I thought he did.
03:38:02<gwern>p_l: why? gpl is pretty common
03:38:19<gwern>PHO_: are those stronger than just common lisp's hints?
03:38:24<dolio>It seems to no longer be in my news reader, due to spam.
03:38:33<p_l>gwern: because publishing Qi under GPL makes sure no one can use any other license unless they pay the authors for the commercial one
03:38:51<PHO_>dolio: I don't know well about common lisp
03:39:05<gwern>I'm not familiar with how gpl interacts with interpreters, but surely that doesn't mean that any qi code must be gpl...
03:39:18<p_l>gwern: GPL interacts badly with Lisp
03:39:38<p_l>gwern: Also, in this case, there's no interpreter, afaik
03:39:40<PHO_>ah, sorry. I mean gwern
03:40:59<p_l>gwern: the closest to GPL license that is used which doesn't mess up licensing of every other part of your app is LLGPL, which is a relaxed variant of LGPL
03:41:24<gwern>hard to believe rms would write the gpl to be so obnoxious for lispers
03:42:42<SamB>he doesn't seem to understand that not everyone can give away all of their code all the time :-(
03:42:44<p_l>gwern: rms doesn't seem to have much clout in Lisp world ;-)
03:43:03<MyCatVerbs>gwern: RMS has a somewhat different idea of "obnoxious" to most people.
03:43:19<outchanter>IIRC clisp was going to be released under another license but because it was linked with GNU readline it had to move to GPL.
03:43:20<p_l>also, afaik, he started GNU after he got whooped for breaking copyrights on Symbolics LispM code
03:43:30<SamB>he's always "But NOOOOOO that could allow people to use this with PROPRIETARY CODE!"
03:43:34<p_l>outchanter: yup
03:43:35<gwern>p_l: well, his favored dialects are dead.
03:44:05<gwern>p_l: if he had started emacs using scheme, instead of rejecting scheme as impossible to run efficiently, then the story would probably be quite different
03:44:28<p_l>gwern: Last versions of Symbolics' Lisp are ANSI Common Lisp compatible, afaik
03:44:43<p_l>haven't tried running test suite on it
03:44:52<gwern>outchanter: my recollection was that clisp was proprietary, but it linked to readline and one couldn't swap out gnu readline for another readline, and this latter part was why clisp had to be gpl
03:45:11<gwern>p_l: sure, I could believe that. they were involved in the process after all
03:45:22<p_l>gwern: clisp wasn't much proprietary, more like freeware/public domain stuff
03:45:36<gwern>freeware is proprietary :)
03:45:50<PHO_>I heard that RMS even created the GCC in really non-modular way just to prevent GCC from being stolen by proprietary softwares
03:46:00<p_l>PHO_: AFAIK that one is true
03:46:10<gwern>yeah, it's been covered recently
03:46:31<p_l>because of that, there's a chance LLVM will kick its ass ;-)
03:46:37<gwern>on the other hand, I can't really blame him for that. it's not paranoia when they really are out to get you...
03:47:00<p_l>gwern: more like the other way around, he is out to get them... :P
03:47:40<SamB>gwern: I don't think most of them are out to make proprietary distributions of Emacs ...
03:48:19<p_l>and proprietary compilers enjoy good life
03:48:30<bnijk>what's the best c compiler
03:48:38<kyevan>Ok. I am an idiot.
03:48:38<bnijk>or the top 5
03:48:46<gwern>bnijk: well, there aren't too many to choose from these days
03:48:51<kyevan>I just reimplemented modulo.
03:48:58<kyevan>Without realizing that's what I was doing
03:49:00<p_l>I recall someone saying that the only reason GCC ever got any foothold was because of Sun decoupling their C compiler from standard SunOS license
03:49:06<gwern>I remember reading material from before the 90s; there used to be so many c compilers around
03:49:14<jaredj>everyone had one
03:49:27<p_l>bnijk: there is still quite a lot of them, mostly specialized stuff
03:49:32<gwern>these days we have like gcc, icc, llvm, and then niche products like whatever the bsds are trying to use these days
03:49:48<p_l>gwern: also ton of platform-specific and HPC compilers
03:50:12<jaredj>e.g. plan 9, portland group (pgi), respectively
03:50:28<gwern>plan 9? people're still using that? :)
03:50:30<SamB>plan9 still comes with some
03:50:34<bnijk>plan9++
03:50:39<gwern>ACTION decides to call it a night, though
03:50:40<SamB>gwern: he WAS using the past tense
03:50:41<p_l>bnijk: swallow that
03:50:52<bnijk>people are mostly using inferno now gwern
03:50:54<p_l>gwern: Plan9 still enjoys some life :)
03:50:54<Berengal>ACTION wonders if plan9 will ever have a comeback
03:50:58<bnijk>to the extent they use it
03:51:10<kyevan>Plan 9 is awesome :J
03:51:12<SamB>bnijk: nah
03:51:26<p_l>Berengal: it enjoys comeback in form of crippled mods to other OSes :P
03:51:26<kyevan>Conceptually, anyway
03:51:27<jaredj>i'm a fan. but i don't run it. that pisses off #plan9 :)
03:51:34<SamB>inferno can't run C apps -- kinda crippled, don'tcha think ?
03:51:35<p_l>jaredj: haha
03:51:36<kyevan>The implementation, eh. :P
03:51:42<Berengal>p_l: I wouldn't call that "enjoy" as much as "suffer"
03:51:47<bnijk>you run inferno inside of another OS i mean
03:51:48<kyevan>jaredj: EXISTING pisses off #plan9
03:51:49<p_l>SamB: Because C is unmanaged
03:52:02<SamB>p_l: still ?
03:52:04<jaredj>it's sorta like #lisp that way :(
03:52:07<SamB>it seems managed to me ;-P
03:52:26<jaredj>you can do c + inferno - from outside the system
03:52:50<SamB>jaredj: well, wouldn't it be nicer to run the C in a VM or something ?
03:52:53<p_l>SamB: C is certainly "unmanaged code". Inferno was designed for usage in places where a runaway pointer wasn't an option, and MMU was too costly/slow ;-)
03:52:55<jaredj>given that it was supposed to be for embedded / set top box sorts of things, that's not bad
03:53:08<SamB>p_l: oh. well, okay. sure, it's good for that
03:53:33<SamB>but it's hardly appropriate for machines that HAVE mmus
03:53:39<Berengal>If it can't run C, what can it run?
03:53:43<jaredj>limbo
03:53:45<SamB>Berengal: limbo!
03:53:50<bnijk>LIMBO
03:53:52<SamB>rc!
03:53:52<jaredj>it's a pretty interesting little language
03:53:57<SamB>mk!
03:54:01<p_l>SamB: Even those that have MMUs run faster without memory protection :)
03:54:06<Berengal>ACTION wikis
03:54:07<bnijk><3 arch
03:54:20<bnijk>how many of you guys are arch users
03:54:23<jaredj>arch ... linux?
03:54:23<SamB>p_l: not worth the time it takes to rewrite everything from scratch, though
03:54:29<bnijk>yes
03:54:44<SamB>no, I use nifty doorways
03:54:49<p_l>SamB: Usually if you're going to use Inferno you're not going to replace your OS - it wasn't and isn't for that :)
03:54:54<SamB>ACTION actually uses Debian
03:54:57<jaredj>ACTION too
03:55:02<p_l>ACTION uses Arch64
03:55:07<SamB>p_l: yeah
03:55:09<bnijk>arch rocks
03:55:14<jaredj>it's sad: inferno is so small and simple i wish i could replace my os with it
03:55:21<jaredj>but it doesn't run firefox :/
03:55:30<SamB>but, I mean, if you want to use plan9-style stuff on your desktop, there are more flexible ways
03:55:43<SamB>jaredj: that's the thing in a nutshell!
03:55:47<p_l>jaredj: ... getting a small and simple OS only too run one of the most bloated programs in the world?
03:55:52<bnijk>there's 9p compatability for arch
03:55:56<outchanter>in the future, firefox will BE an OS
03:55:56<bnijk>i don't remember what the name is
03:56:03<bnijk>plan9port
03:56:03<p_l>jaredj: man, it would be easier to add OS to firefx
03:56:16<Berengal>The trouble with plan9 is that it sucks
03:56:16<p_l>bnijk: it's Plan9's equivalent of Cygwin :P
03:56:18<jaredj>p_l: yeah #plan9 loves to hear that too. "does it run firefox?" "bugger off"
03:56:22<bnijk>yep
03:56:23<SamB>outchanter: thankfully, Chromium will run on Linux/X by then
03:56:38<Berengal>Does it run emacs?
03:56:47<SamB>jaredj: at least plan9 is capable of running firefox
03:56:55<SamB>it's just that firefox hasn't been ported
03:56:58<jaredj>who was it, pike, who made the "operating systems research is irrelevant" presentation?
03:57:07<bnijk>chromium's already in the arch repos
03:57:17<p_l>SamB: Well, properly compiled Firefox runs in Plan9 :)
03:57:25<jaredj>thanks to browsers and web apps, operating systems practice is also irrelevant :P
03:58:02<Berengal>Sometimes I wish someone would make a WebOS
03:58:08<jaredj>they have dude
03:58:09<SamB>I think operating system research is like rat research
03:58:10<jaredj>(ette)
03:58:14<PHO_>I don't want to develop any applications for Firefox because I dislike JavaScript...
03:58:15<SamB>bnijk: is it now?
03:58:18<bnijk>yes
03:58:18<Berengal>Just so people could be scared off the idea for good
03:58:19<p_l>jaredj: till you find out that you waste so much time because of webapps being broken, internet failing etc. that you wish someone found the inventor of "Web Apps" and hanged him
03:58:26<SamB>bnijk: I hope I see it in Debian soon ...
03:58:41<bnijk>don't count on it ;)
03:58:43<p_l>Berengal: There's several of them. People seem enthusiastic
03:58:51<SamB>PHO_: JS isn't so bad
03:58:56<SamB>it's just that the APIs are terrible
03:59:09<SamB>and not nearly standardized enough
03:59:27<SamB>p_l: say what ?
03:59:42<SamB>what's a "web os"?
03:59:52<bnijk>a bad idea
04:00:04<SamB>I haven't figured out how to launch program on the web
04:00:21<SamB>and if I had, the security people would be after me by now!
04:00:22<bnijk>i'm going to port virtualbox to php
04:00:24<bnijk>just watch me
04:00:33<PHO_>SamB: If JS had a type checker I could like it
04:00:41<p_l>SamB: Imagine an OS which runs in web browser...
04:00:43<SamB>bnijk: you might get, like, 2 minutes per frame!
04:00:46<bnijk>lol
04:00:56<bnijk>i'll make it distributed while i'm at it
04:00:58<SamB>bnijk: including the time for transferring
04:00:58<Berengal>PHO_: Write one
04:01:01<bnijk>through some insane sort of magic
04:01:19<PHO_>yuck
04:01:36<Berengal>Or just write a fully fledged haskell interpreter...
04:01:52<SamB>I don't think JS offers sufficiently standard introspection tools to allow a typechecker to be written
04:02:13<PHO_>Berengal: like yhc's JS backend?
04:02:32<Berengal>PHO_: Don't know, haven't check that out properly yet
04:02:40<Berengal>But possibly
04:03:27<PHO_>I think no programs can run fast if they're written in JS
04:03:57<SamB>PHO_: you'd be surprised
04:04:02<SamB>chrome does pretty well
04:04:07<Berengal>JS is pretty fast compared to other scripting langauges...
04:04:19<bnijk>depends on the interpreter Berengal
04:04:20<PHO_>humm
04:04:25<bnijk>i want to make a pizza the size of an umbrella
04:04:34<bnijk>i just need the right oven
04:04:42<p_l>ACTION was disgusted with chrome perf.
04:04:44<Berengal>bnijk: Well, yes. I should've qualified that to mean the most recent interpreters
04:04:45<SamB>bnijk: I was just going to point that out
04:04:48<SamB>p_l: hmm ?
04:05:02<bnijk>can you imagine it
04:05:32<p_l>SamB: at least the version that was available in Arch (cxChromium), left me disgusted with Chrome :)
04:06:26<SamB>p_l: oh, well, I tried it on XP
04:07:21<SamB>and suddenly I noticed animations on rainwave.cc that I'd never known had been there
04:07:42<bnijk>what's the matter with it p_l
04:07:58<jimmyjazz14>any good games written in haskell?
04:08:02<bnijk>jimmyjazz14: yes
04:08:02<p_l>bnijk: slower than FF ;P
04:08:10<bnijk>p_l: wow
04:08:23<bnijk>http://www.haskell.org/haskellwiki/Applications_and_libraries/Games
04:08:43<PHO_>http://hackage.haskell.org/packages/archive/pkg-list.html#cat:game
04:09:23<SamB>p_l: I'm guessing they didn't port V8 too good yet ...
04:09:23<jimmyjazz14>well yes there is that but has anyone tried any of them?
04:09:54<SamB>or maybe the sandbox code performed poorly ...
04:10:18<p_l>Also, Chromium lacks way too many things to displace Firefox for me
04:10:26<SamB>I'm not sure Linux provides sufficient facilities for the sandboxing
04:10:41<SamB>well, yah, chromium is missing lots at the moment ...
04:10:54<bnijk>chromium has a pretty interface
04:10:56<bnijk>seems to work like shit
04:10:56<PHO_>jimmyjazz14: I tried Shu-thing but it wasn't so amusing
04:11:21<SamB>... but it seems like a reasonable escape plan from the potential Firefox-OS problem
04:11:22<p_l>SamB: Google is making kernel patches to seccomp to be used with Chrome
04:11:39<SamB>p_l: sensible of them
04:11:46<bd_>about time someone did something useful with seccomp
04:12:01<p_l>SamB: Except that I have much better sandboxing already running on my system :P
04:12:28<bd_>wouldn't uid/net namespaces be closer to what chrome is looking for though? that way it can still open o+rx libraries, etc
04:12:31<SamB>Chrome is, like, the most sandboxed app I've ever seen ...
04:12:51<p_l>bd_: they want to specify what type of syscalls an app can call
04:13:34<SamB>... and that's based mostly on looking at it in Process Explorer
04:13:36<p_l>also, linux devs are still against letting normal users mount anything (like it's done in Plan9). "Security Reasons"
04:13:47<bd_>p_l: fuse lets you do that today :)
04:13:53<SamB>indeed
04:13:55<p_l>bd_: No it doesn't.
04:13:57<SamB>yes it does
04:13:59<bd_>and there are some patches floating around for user mounts
04:14:25<bd_>p_l: It does. If you're in the fuse group, you can mount a fuse filesystem on any directory you own and mangle its contents in any way you like :)
04:14:25<p_l>Eh, you're mixing it up with something different. What I meant was editing namespaces by users
04:14:27<halberd>is it possible in type theory to "automatically generate" the inference rules for a set, given the formation rule?
04:14:27<SamB>you have to be in some group, maybe, but that can be made ordinary easily enough
04:14:39<bd_>However, it'll return EPERM for accesses from another user
04:14:40<p_l>bd_: that's far from changing namespace
04:15:00<SamB>p_l: oh, no, you can't shadow /usr/ or anything
04:15:07<SamB>I dunno why ...
04:15:18<halberd>and perhaps also given the introduction rule
04:15:19<p_l>SamB: Because they fear that someone will exploit /etc/
04:15:27<SamB>I guess because they're afraid you'll horribly confuse some suid thing
04:15:57<p_l>SamB: If they repaired security model, they wouldn't have that problem...
04:15:57<halberd>that is, deriving the primitive non-canonical constant, and the elimination and equality rules, automatically from the formation and introduction rules
04:15:58<SamB>reasonable fear, really
04:16:09<bd_>p_l: changing uid namespace is theoretically quite safe - as long as it's implemented completely... But you'll need fs namespaces too for it to be useful for anything other than sandboxing, I think...
04:16:16<SamB>p_l: do you have any idea how much code would need changing to deal with potential shadowing ?
04:16:33<p_l>SamB: I have it done on my system :P
04:16:47<SamB>p_l: oh?
04:16:58<p_l>Never bothered to actually use it, cause I don't have a need, but I can set it with few lines of rules
04:17:45<SamB>you mean every suid program or potentially-used-from-suid library checks whether all the config files it accesses are coming from the right place ?
04:17:53<p_l>like "changes to namespaces that touch /etc are locked down to people with those and those perms"
04:18:02<SamB>not just /etc, but that they actually have the appropriate permissions and so forth ?
04:18:05<SamB>oh.
04:18:26<SamB>(I guess plan9 probably doesn't have suid?)
04:18:55<p_l>SamB: Also, "Any setuid program launched from non-root namespace has it's setuid perms dropped" is a possible rule
04:19:15<p_l>SamB: Plan9 doesn't have that problem at all, because of slightly different security model
04:19:33<SamB>p_l: well, google needs to be able to do their sandbox thing without user configuration ...
04:19:57<SamB>I mean, besides maybe applying kernel patches
04:20:33<SamB>but, you know, without having to set up some whole complicated infrastructure with all those decisions about how to make things safe ;-)
04:21:01<p_l>SamB: Yes, but I think getting private namespaces and apriopriate guards as default setting would be simpler than crazy seccomp patches
04:21:40<p_l>ACTION needs a new fan for his router
04:21:51<SamB>p_l: they may not be crazy patches!
04:22:12<SamB>I mean, really, anything that helps us catch up with NT where we've been lagging behind -- is it crazy ?
04:22:22<SamB>(besides bloat, I mean ;-)
04:23:18<bd_>Really, seccomp's existing design is laughable. Once it's activated, you're only allowed to use read(), write(), _exit() - and the latter has to be via syscall(1, exitcode), since glibc will invoke exit_group() for _exit(). You can't allocate memory, pass file descriptors over sockets, etc.
04:23:43<bd_>Passing a bitfield or something to describe what syscalls are allowed would be a minor and sensible extension
04:24:21<SamB>and changing default settings would require a lot more coordination with ALL distributions then adding a few system calls and whatnot that we should've had anyway ...
04:24:44<p_l>bd_: Getting equivalent of TOMOYO's access policies + API that would only allow you to drop permissions/increase restrictions would give you a much more flexible system
04:25:42<SamB>who's tomoyo?
04:26:24<p_l>SamB: long story. http://tomoyo.sourceforge.jp/
04:27:32<p_l>I'm joking that TOMOYO is the perfect stalker (due to her namesake from CCS)
04:28:45<PHO_>Sakura and Tomoyo http://www.kaenbin.com/sakura24.html
04:29:22<SamB>p_l: I'm thinking google wanted to minimize the size of the patches needed ...
04:29:46<p_l>SamB: It's just that I consider current default Linux security flawed in that aspect
04:30:01<ClaudiusMaximus>i'm writing an untyped lambda calculus interpreter. i've almost added desugaring to the input, but not sure how to approach making the output look pretty too (as False and 0 and [] are all represented by (\x.(\y.y)) ). any ideas?
04:31:16<p_l>with private namespaces the way they work in Plan9, I could rfork() with new namespace, mount a filesystem to talk with parent app (provided by the app), mount network stack (possibly a special filtering one) etc., then drop mount capability and exec into sandboxed code
04:33:04<p_l>PHO_: BTW, TOMOYO Linux in fact consists of SAKURA, TOMOYO, SYAORAN, CERBERUS and YUE :)
04:33:16<ClaudiusMaximus>also, why does getLine in ghci not provide any editing capabilities? it's hard typing unsugared lambda expressions when a typo means restarting the line
04:33:34<PHO_>p_l: yeah. I know that :)
04:33:39<hatds>are you on windows, Claudius?
04:33:48<ClaudiusMaximus>no
04:34:13<p_l>ACTION was really nicely surprised by TOMOYO Eclipse plugin. It's the only reason I have Eclipse installed :D
04:34:15<ClaudiusMaximus>editing works fine within ghci, but as soon as i type "main" (which uses getLine) those editing abilities disappear
04:34:42<idnar>@src getLine
04:34:43<lambdabot>getLine = hGetLine stdin
04:35:24<bos>you'd need to use one of the packages that provides input with line editing.
04:35:29<bos>e.g. haskeline
04:37:36<PHO_>ACTION has a full set of comics of the Card Captor Sakura, if he hasn't discarded them
04:38:04<p_l>ACTION has them but still haven't got around to reading
04:38:37<hatds>hm, my getLine handle editing
04:38:52<hatds>*handles
04:39:12<bos>hatds: using an old ghci?
04:39:25<hatds>probably
04:39:29<hatds>it's not the newest for sure
04:39:48<hatds>they changed it?
04:40:08<Berengal>The newest ghci uses haskelline
04:41:34<Berengal>And I can't delete characters in ghci, but I can outside of it
04:41:47<hatds>so there was an intermediate period where they didn't have editing capabilities?
04:42:04<Berengal>No, they used editline before switching
04:42:45<bos>we used to use readline, which i think gave editing capabilities to hGetLine (maybe)
04:43:00<bos>then switched to editline, which had a better license but made everyone sad because it's crap
04:43:12<bos>now haskeline, which i haven't used yet
04:43:49<Berengal>Fortunately editline and readline are binary compatible. I removed editline.so on my machine and replaced it with readline without any problems
04:44:22<hatds>readline lets you edit but editline only reads.. eiya
05:08:10<hatds>:t fix
05:08:12<lambdabot>forall a. (a -> a) -> a
05:33:06<DOKKA>hey yall
05:36:53<DOKKA>http://learnyouahaskell.com/ I just found this
05:39:21<Nafai>great site :)
05:39:40<outchanter>it's the first language tutorial I've seen that goes right into simulated annealing
05:40:06<DOKKA>Yeah, way better than real world haskell
05:42:05<Twey>« Simulated annealing (SA) is a generic probabilistic metaheuristic for the global optimization problem of applied mathematics »
05:42:15<Twey>ACTION decides he doesn't want to know after all
05:43:21<DOKKA>that went right over my head
05:43:48<DOKKA>but it's okay :-)
05:44:01<outchanter>it's just a search heuristic...
05:46:03<DOKKA>I see.
05:46:04<outchanter>although I can't find that part in the new version of Learn You a Haskell. Maybe they decided to move it to a later chapter
05:47:22<DOKKA>well, that's fine with me. I was doing just fine without them
05:48:11<DOKKA>anyways I wanted to ask yall, when do you use a guard vs. an if statement
05:49:22<DOKKA>or rather, is there something that a guard can't do as compared to an if statement?
05:50:17<outchanter>it can only be used as part of a function definition?
05:51:48<DOKKA>so that's really the only thing a guard is limited by? can one contain a let block?
05:52:41<hatds>you mean a let block for the boolean part of the guard?
05:52:56<DOKKA>right
05:53:10<hatds>if you can cram it in there, I think any boolean expression is allowed. But you normally would keep it short
05:53:39<outchanter>> let f x | (let y = x in y > 0) = x+1
05:53:40<lambdabot> not an expression: `let f x | (let y = x in y > 0) = x+1'
05:54:07<outchanter>> f x | (let y = x in y > 0) = x+1
05:54:08<lambdabot> <no location info>: parse error on input `|'
05:54:17<byorgey>> let f x | (let y = x in y > 0) = x+1 in f 3
05:54:18<hatds>you need to put the guard on the next line
05:54:18<lambdabot> 4
05:54:38<hatds>ah nvm ignore me :)
05:54:45<DOKKA>wow
05:54:50<byorgey>just needed an 'in' to go with the 'let' =)
05:55:14<outchanter>yep, sorry, I initially just copied what worked in ghci. Not familiar with lambdabot
05:55:59<hatds>you can use guards in case expressions too, but the syntax is a little different
05:57:07<DOKKA>that makes sense, so guards are just as powerful
05:57:42<DOKKA>I just couldn't find an example of a let block in a guard
05:57:45<hatds>"patern | boolexpr -> expr" instead of "function pattern | boolexpr = expr"
06:14:01<DOKKA>then why won't this work?
06:14:13<DOKKA>test xs let x="asdf" in | xs==x=xs++x | otherwise=xs
06:14:30<DOKKA>> test xs let x="asdf" in | xs==x=xs++x | otherwise=xs
06:14:31<lambdabot> <no location info>: parse error on input `let'
06:16:17<outchanter>I think you can't put them both on one line, at least not without adding braces/semicolons
06:17:28<DOKKA>but even then, where should they go?
06:18:09<Gracenotes>otherwise.... :o
06:18:49<Gracenotes>DOKKA: maybe you want a "where" clause.
06:19:32<Gracenotes>test xs | blahblah = this
06:19:37<Gracenotes> | yadda = that
06:19:44<Gracenotes> where x = something
06:19:51<DOKKA>Gracenotes: yeah, I know about them, i just want to see what I am allowed to do
06:20:46<Gracenotes>well, you can do let guards
06:21:14<Gracenotes>But essentially, where you can do guards is limited to (afaik) either in functions or in let clauses
06:21:37<hatds>hmm.. let guards?
06:21:40<hatds>what's that?
06:21:51<DOKKA>ah, cool
06:22:00<Gracenotes>let x | blah = this
06:22:06<Gracenotes> | whatev = that
06:22:13<Gracenotes>oops. indentation. but you get the idea
06:22:46<Gracenotes>acts somewhat like let x = case True of { blah -> this; whatev -> that; }.
06:28:17<DOKKA>test xs
06:28:17<DOKKA> | let {xd="asdf"}
06:28:17<DOKKA> in xs==xd=xs++xd
06:28:39<DOKKA>oops sorry
06:29:06<Cale>the xd there, being defined inside the let inside the guard, won't be in scope after the = ... provided that even parses
06:29:34<DOKKA>Yeah, but why won't it be in scope?
06:30:33<DOKKA>Oh, wait, I understand
06:31:17<DOKKA>it only works for the conditional half
06:32:13<Cale>Well, (let ... in ...) only makes the declarations in scope for the 'in' part
06:32:30<Cale>They don't extend any further outside the let :)
06:32:40<DOKKA>exactly, thanks
06:32:51<Cale>brb
06:40:46<Bacta>@fag can Haskell get me a girlfriend?
06:40:47<lambdabot>The answer is: Yes! Haskell can do that.
06:43:06<ray>@faq can haskell get me his girlfriend?
06:43:07<lambdabot>The answer is: Yes! Haskell can do that.
06:43:09<Cale>Bacta: btw, the command is @faq, you're misspelling it :)
06:44:08<Bacta>Yeah I know @fag is acceptable, that's what makes it funny
06:46:15<hatds>let me = (=="hatds") in find me ["a girlfriend"]
06:46:19<hatds>> let me = (=="hatds") in find me ["a girlfriend"]
06:46:21<lambdabot> Nothing
06:46:23<hatds>hehe
06:47:39<DOKKA>> Just a
06:47:41<lambdabot> Just a
06:47:58<walter_>In
06:48:30<walter_>In "renderJValue (JString s) = show s
06:48:30<walter_>" is (JString s) a pattern method ?
06:49:00<hatds>starts with a capital and appears in a pattern, so JString is a constructor
06:49:59<walter_>Still don't understand how can a type JString s conver to a s
06:50:33<hatds>Constructors don't really convert, they just box up the values
06:50:51<hatds>pattern matching opens the box and assigns names ('s', in this case) to the values inside
06:51:09<walter_>hatds, I see. Thanks!
06:52:37<Reiv>Hrm.
06:52:54<Reiv>I'm trying to write a parser for the language TINY.
06:53:03<Reiv>Anyone mind giving a quick look to see if my Haskell is on the right track?
06:54:10<Reiv>http://pastebin.com/d7a6dddea
06:55:15<Bacta>girlHasA = Pussy
06:56:31<jbjohns>Hi. GHC on windows has no dependency on Cygwin, MGW or any of that stuff right?
06:58:18<hatds>I don't believe so
06:59:29<Saizan_>Reiv: it seems weird that you can use symbol for Strings
07:00:16<Cale>Reiv: What kind of loop do you want? Usually it's easiest to just recurse.
07:00:18<Saizan_>jbjohns: you might need a mingw installation for some C bindings, but otherwise no
07:02:05<jbjohns>Saizan_: Thanks for the answer. Is there any plan to do something so that mingw wouldn't be needed anymore?
07:02:54<jbjohns>Like, for example, maybe instead of just Thing.C, the files might be named: Thing.Platform.C so the right one can be selected depending on the build platform
07:03:45<Saizan_>i don't see why that would help
07:03:47<hatds>ghc on windows comes with its own gcc
07:04:19<hatds>although you can pass options to change it to another one
07:04:47<Saizan_>the problme is that, for example, to compile HOpenGL you need the opengl library installed with its headers and reachable by your compiler/linker
07:05:08<jbjohns>Saizan_: Because if mingw is needed to supply C bindings that means whatever is using these C bindings (presumably a C program) was written in a platform dependent way. If platform support is needed it should be provided for all platforms instead of just unix and make everyone else use emulation
07:05:33<Saizan_>it's not emulation
07:05:53<Saizan_>portable libraries still need to be compiled for each particular platform
07:06:25<Saizan_>executables produced by GHC won't need anything special to run, if you're afraid of that
07:06:29<jbjohns>ok, not exactly emulation but it's a platform layer
07:06:35<Saizan_>nono
07:06:58<Saizan_>with mingw you produce win32 executables, it's not like cygwin
07:07:26<jbjohns>ah, it converts to the right calls at preprosses time, so what is compiled is for the platform it's build on?
07:08:26<Saizan_>some of the lower level libraries have some CPP #ifdef's for that, yeah
07:08:57<jbjohns>ok, I'll read about it
07:09:11<Saizan_>or let the C lib do that, like in the case of gtk
07:11:23<jbjohns>I'm just not a fan of cygwin. I mean, it serves a purpose in the same way Wine does, but saying "oh our product runs just fine on linux, you just need Wine" is kind of dishonest imo
07:11:45<jbjohns>same as saying "our product runs on windows, you just need cygwin".
07:11:58<Saizan_>mingw is considerably different
07:13:09<jbjohns>ok, reading about it now
07:13:39<jbjohns>I came onto this when I noticed that, using the Haskell Platform, I don't seem to be able to cabal install any packages
07:13:54<Saizan_>that shouldn't be the case
07:13:59<Saizan_>what's your problem?
07:14:01<jbjohns>I suppose if I look long enough I'll find one that works, but happs tutorial didn't work and hxt doesn't work
07:14:23<jbjohns>hxt fails on curl. it says: sh: runGenProcess failed: does not exist
07:14:33<jbjohns>I opened a ticket on it on the haskell platform bug site
07:15:07<Saizan_>"happstack" should install on windows without problems
07:15:19<Saizan_>and it has some demo project
07:15:55<Saizan_>however yeah, for curl you'd need to install the C lib first, and have an sh to run the configure script
07:16:39<jbjohns>that's a shame. Haskell feels like a fundamentally platform independent language.
07:17:22<jbjohns>I mean, I'm not a windows fan boy or anything, I plan to switch to a mac if I get a bonus next month, but until then my laptop is windows
07:18:33<DOKKA>use linux
07:18:41<hatds>the devil of all programming is linking
07:19:01<jbjohns>DOKKA: For my server I do. Otherwise, no
07:19:48<DOKKA>aw, well, I understand. few people have the time to play around with it to make it work
07:20:23<jbjohns>it's not that, I feel pretty comfortable in linux and at the moment I wouldn't consider anything else for my server
07:20:24<Cale>Ubuntu is pretty easy to set up. :)
07:20:48<^Someone^>^ That's about it
07:21:00<^Someone^>But, if you want to install other things, it's not always that easy
07:21:20<jbjohns>but for my laptop I want something nice and easy. Windows isn't that, but at least I can play all my games. Mac is just liquid beauty and since it can do all my dev stuff I've decided to switch
07:21:24<DOKKA>I think it's easy too, but then again, I run gentoo
07:22:06<jbjohns>afk a min
07:22:38<DOKKA>Macs are pretty though, I have to give'em that
07:22:54<Cale>^Someone^: I've found it pretty nice :)
07:23:05<^Someone^>ACTION uses Ubuntu too
07:23:19<Cale>^Someone^: Of course, the Haskell support is pretty lacking, but I just get the generic linux binary.
07:23:19<^Someone^>That is to say, that's all I've been using for nearly a year
07:23:54<DOKKA>try buuilding it from source, it's really not that hard
07:24:07<walter_>what difference between [Char] and "String"
07:24:31<Cale>walter_: nothing, String is a synonym for [Char]
07:24:46<Cale>DOKKA: No need for that
07:25:11<walter_>you mean in Haskell type String and [Char] can be regard as the same type?
07:25:18<Cale>Building GHC from source is generally a waste of time unless: 1) There is no GHC binary for your platform, or 2) You are hacking on it.
07:25:20<hatds>yes
07:25:35<Cale>walter_: yeah, in the Prelude, there's a definition type String = [Char]
07:25:35<DOKKA>>['a','b','c']
07:26:08<walter_>Thanks, clear.
07:26:58<Cale>> ['a','b','c'] -- the space after > is not optional ;)
07:27:00<lambdabot> "abc"
07:27:12<DOKKA>oh, whoops
07:28:11<^Someone^>Well, it annoys me that so many simple things that are available in Windows aren't in Linux : s
07:28:50<^Someone^>Like, an MSN client which supports features like webcam and voice chat? Okay at least offline messaging?
07:29:13<^Someone^>Even eBuddy can handle offline messaging, why not IM clients for Linux?? : S
07:29:28<DOKKA>I think ekiga might do that
07:29:42<^Someone^>But that's not MSN : /
07:31:14<DOKKA>yeah, it's not a complete substitute for windows
07:31:19<Nafai>^Someone^: The benefits of Linux far out weigh the disadvantages. Especially compared to Windows or OS X.
07:31:20<DOKKA>and it never will be
07:31:21<^Someone^>Skype does it. Okay. I love Skype for Linux. But I have at least one stubborn friend who refuses to install Skype because it's going to be largely unused and all that
07:31:39<^Someone^>Nafai: Certainly, that's why I still have only Linux on my laptop
07:31:55<^Someone^>(Dunno about OS X, haven't used it)
07:32:09<Nafai>I had to use OS X for about 6 months and I went running back to Linux.
07:32:30<^Someone^>But it certainly does annoy me that eBuddy has offline messaging and Emesene or Pidgin or Kopete or any other MSN client I've seen in Linux have not : /
07:32:31<Nafai>I'm annoyed at the state of sound and bluetooth on Linux. Most everything else I love.
07:32:58<Nafai>^Someone^: That's the problem when you are replicating a proprietary protocol. :(
07:33:11<^Someone^>Hm, but how can eBuddy do it?
07:33:21<DOKKA>yeah, but with pulseaudio, things should be getting better
07:33:48<Cale>^Someone^: Does Pidgin not do offline messaging?
07:33:49<Nafai>^Someone^: I'm not saying it is impossible, I'm just saying that it's not easy and often open source (remember, often volunteer) applications have to prioritize
07:33:51<^Someone^>Ubuntu 9.04 is a great deal of improvement on 8.04, I must say
07:34:00<^Someone^>Cale: No, it can't send offline messages
07:34:13<Cale>Interesting. I don't really use it much anyway though.
07:34:21<Nafai>DOKKA: Supposedly, but I still have great problems with bluetooth audio in 9.04. Problems as in I'm unable to get it to work
07:34:41<Nafai>^Someone^: Have you filed a bug or feature request with the pidgin developers?
07:35:07<^Someone^>Nafai: No. I'll try that
07:35:56<DOKKA>I realize it will always be second best, but the rediculous amount of customization,and control you have is why it will never disappear
07:36:28<Nafai>Admittedly, it took a bit of effort to get bluetooth audio working on my wife's Windows laptop too :)
07:37:55<Saizan>^Someone^: i do send and receive offline messages with pidgin, fyi
07:38:09<DOKKA>yeah, I have to agree about bluetooth, I had to compile an old version of bluez-tools to get mine to work
07:38:27<Saizan>^Someone^: on the msn protocol
07:38:46<Saizan>however this whole conversation is quite off topic :)
07:39:05<^Someone^>Saizan: Do you mean while the other user is `appearing` offline?
07:39:32<^Someone^>(Receving always works, sure)
07:39:42<Saizan>^Someone^: yup
07:39:45<Nafai>Anyway, haskell is awesome :)
07:40:06<Nafai>(is that more on topic?)
07:40:13<Saizan>^Someone^: maybe the version on ubuntu is too old
07:40:42<^Someone^>Saizan: No, I meant when the other user is actually offline. OR even when the other user is appearing offline but has been inactive for more than two-three minutes. Like when I want to tell them about how awesome Haskell is >.>
07:44:46<Reiver>Cale: I'm after a recursive while loop, yes
07:45:02<Reiver>(Sorry about the delay in answering, I was on the wrong nick and it wasn't triggering highlights. >_>)
07:45:41<Twey>Cale, ^Someone^: It can do offline messages. It works for me, too.
07:45:48<Twey>On AIM, YIM, and MSN.
07:46:56<Cale>Reiver: I suppose it's possible to ascribe a meaning to a while loop for parsers, but it seems unusual.
07:47:43<Cale>Reiver: are you perhaps looking for one of these? http://hackage.haskell.org/packages/archive/parsec/3.0.0/doc/html/Text-Parsec-Combinator.html
07:48:00<Reiver>Yeees, I probably am. Except I'm trying to do it by hand. :)
07:48:17<Reiver>(Learing Haskell, best way to learn is to start small work your way up, etc)
07:48:21<Saizan>well, you can just use the name of the parser you're defining to recurse
07:49:15<Cale>Reiver: the source for those is provided and possibly enlightening
07:49:23<Reiver>Hm. Okay, I'll have a look.
07:49:35<Reiver>Does the code otherwise look okay? I've not been able to run it to test just yet.
07:49:45<Reiver>(Given I've incomplete lines, etc... >_>)
07:49:51<Saizan>i.e. list = (do x <- elem; symbol ":"; xs <- list; return (x:xs)) <|> (do symbol "[]"; return [])
07:50:19<Saizan>Reiver: what's the type of your symbol function?
07:50:19<ErhardtMundt>yo Saizan :)
07:50:29<Saizan>hi :=
07:51:10<Cale>Yeah, though I might go with >> instead of do-blocks for the little two-line things
07:51:24<Reiver>> symbol :: String -> Parser String
07:51:24<Reiver>> symbol xs = token (string xs)
07:51:26<lambdabot> <no location info>: parse error on input `='
07:51:26<lambdabot> Not in scope: type constructor or class `Parser'Not in scope: `symbol'
07:51:41<Reiver>... oops, sorry Lambdabot
07:51:58<Cale>You might define something like...
07:52:27<Cale>xs ~> v = do symbol xs; return v
07:53:15<jbjohns>Nafai: You don't represent the average person (in your OS choice) and never will.
07:53:19<^Someone^>(Got disconnected after that last thing I said to Saizan : / )
07:53:21<jbjohns>and frankly I'm very glad of that. :)
07:54:13<Twey>Yeah, everybody these days uses Arch. Ubuntu is so last year. :-P
07:55:07<jbjohns>Linux+SElinux is probably the best right now for internet facing servers, but I can't imagine a volunteer system ever competing on user interface. Apple and MS have invested so much to find out what people learn the easiest
07:55:31<lars9>im using arch. it's good. but i'm stilling considering gentoo
07:56:02<DOKKA>you should try gentoo
07:56:03<jbjohns>I don't like Ubuntu, reboots more than my windows machines. I went back to debian. Gentoo is ok but if it's only going to add 8% or so the compile time isn't worth it to me
07:56:15<DOKKA>...for educational purposes only...
07:57:00<lars9>maybe you should try Archlinux, it's much more agile than debian
07:57:09<DOKKA>these days it dosen't even do that. if youhave a core 2 or something the performance gain is marginal
07:57:17<hatds>can't you just turn off automatic updates to avoid reboots?
07:57:21<jbjohns>for my internet facing servers I'm only concerned about stability
07:57:46<DOKKA>I believe gentoo is a great learning tool
07:57:50<jbjohns>hatds: I shouldn't need to. Those same packages update on debian and don't need a reboot. Ubuntu is just overly cautious with that stuff
07:58:01<jbjohns>DOKKA: Agree! I learned a ton from Gentoo
07:58:43<jbjohns>hatds: Sorry, it's not rebooting my machine. It's just making that annoying pop up every time I log on my ubuntu machine
07:59:20<jbjohns>so what is the story on ghc on OS X? Totally native right? No issues installing libraries and so on?
07:59:40<astrobunny>hmm does anyone use parsec on a kubuntu machine?
08:00:06<astrobunny>ghc hello.hs -o hello -lparsec
08:00:09<Twey>DOKKA: Agree too. Gentoo is very interesting to play with.
08:00:13<DOKKA>jbjohns: you shouldn't have any issues
08:00:17<Saizan>astrobunny: use --make
08:00:17<astrobunny>cannot find -lparsec
08:00:18<Twey>astrobunny: Try --make
08:00:53<astrobunny>ah
08:00:54<astrobunny>thanks
08:01:11<DOKKA>it's fun, but the only drawback is the time you have to devote to it
08:01:27<Twey>ACTION nods.
08:01:32<jbjohns>personally I hope to get time to make my own linux distro
08:01:40<DOKKA>wow
08:01:47<Twey>Which is why the usual path is Gentoo -> Arch, not the other way around :-P
08:01:57<Twey>Yeah, self-building distros sounds like fun
08:02:00<jbjohns>out of the box it will use open ldap. As little in config files as possible
08:02:08<Twey>I would probably base it on GoboLinux
08:02:39<jbjohns>and SELinux. DACs is just a ridiculous security model. Linux is lucky it is so niche or it would have a really bad rep for security
08:02:45<DOKKA>cool, I would want to base one on tinycore linux
08:02:52<hatds>what's DAC?
08:03:10<jbjohns>the security model unix has. Just user+group+everyone file permissions
08:03:23<jbjohns>it's a really old, very obsolete way of doing security on a system
08:04:17<DOKKA>what do yall think about opensolaris?
08:04:34<jbjohns>now that Vista/Windows 7 no longer makes the user be admin they are finally more secure than default linux. But luckily Redhat and Debian come with SELinux, which I think is more powerful than the windows security model
08:05:17<Twey>ACTION tends to distrust anything associated with the NSA on principle
08:05:53<jbjohns>I don't know how much they have to do with what it is now. But it is the best model I've seen for doing security
08:05:53<joga>err, I thought that both vista and w7 still make the user have admin rights, maybe they just prompt to click ok...
08:06:18<jbjohns>joga: I'm not sure, maybe it's like root works in Ubuntu
08:06:39<Twey>It is a good model, but it currently is a bit *too* good. Many false positives.
08:06:47<jbjohns>but that's better than what it was before: go to some web page and suddenly have a new kernel32.dll
08:07:08<DOKKA>Twey: yeah, i know. but at least Sun is trying to play nice now
08:07:13<Twey>joga, jbjohns: Yeah, it's just-click-OK, but the point is that until you click OK it's running with limited permissions
08:07:40<Twey>DOKKA: Solaris' containers look interesting, but I hear it's horribly slow.
08:08:12<DOKKA>it's a little slow and really, it's only good for servers so far
08:08:14<jbjohns>I haven't looked much into other unix' since linux started getting really capable/stable
08:08:23<jbjohns>I just wish they would fix their broken thread model
08:08:30<DOKKA>their only advantages are xfs and RBAC
08:09:12<Twey>Linux has both, nowadays
08:09:43<jbjohns>Sun has a more advance thread model though afaik. Not enough to give them a nod, but enough that I would be sad to see it go away
08:09:44<DOKKA>true
08:12:03<jbjohns>I've never heard of anyone planning to fix threading on linux either. "It works how it is" strikes again. :)
08:14:14<Twey>jbjohns: What's up with the threading model, exactly?
08:14:27<jbjohns>threads should be like this:
08:14:41<jbjohns>data Thread = Thread InstructionPointer Stack
08:14:52<trofi>hi. I have a lambdabot question: can i send raw messages to server from my lambdabot instance w/o patching bot?
08:14:56<jbjohns>data Process = Process UserInfo MemoryInfo [Thread]
08:15:03<jbjohns>in linux they just go:
08:15:20<jbjohns>data Process = Process UserInfo MemoryInfo InstructionPointer Stack
08:15:33<jbjohns>and to make a thread they just copy one of those and set MemoryInfo to be the same in both things
08:15:35<Twey>ACTION tilts his head.
08:15:40<Twey>Ew, yuck
08:15:46<jbjohns>yes, very ew yuck
08:15:52<jbjohns>but it was easy/quick to do
08:16:41<Gracenotes>eesh.
08:16:47<trofi>something like @rawmsg CODEPAGE UTF-8
08:25:43<Reiver>Augh. My apologies; life is hectic at the moment - I keep getting distracted. :/
08:27:19<Reiver>So... v = do symbol xs; return v
08:27:34<Reiver>That would be recursing through, yes? How would I make it /find/ something?
08:28:33<Saizan>just v
08:28:36<Saizan>not return v
08:28:58<Saizan>Reiver: well, you need a base case for your recursion
08:29:14<Saizan>Reiver: and add that with +++ judging from the rest of your code
08:29:35<inbuninbu>question for you fine people...
08:29:57<Reiver>+++ is the "Or" command, if that follows
08:30:06<Saizan>Reiver: yeah
08:30:07<inbuninbu>i've created some custom get and put methods (Data.Binary.Put, etc)
08:30:25<inbuninbu>not liking pattern matching, i'm happy with my get method
08:30:28<inbuninbu>getData :: Get ()
08:30:29<inbuninbu>getData = liftM2 Data get32 get64
08:31:04<inbuninbu>however, i'm thinking there must be a way to simplify my put, for which i've got to copy out all arguments
08:31:06<Saizan>Reiver: e.g. v = (do x <- symbol foo; xs <- v; return (x:xs)) +++ (do symbol base; return [])
08:31:13<inbuninbu>putData :: Word32 -> Word64 -> Put ()
08:31:13<inbuninbu>putData (Data a b) = put32 a >> put32 b
08:31:18<Saizan>Reiver: that'll return the list of foo parsed
08:31:34<inbuninbu>any suggestions on how to improve the put action?
08:32:01<Reiver>ACTION puts that into a document and starts indenting in an attempt to make sense of what that thing actually /does/
08:32:28<jbjohns>thanks for the info about mingw etc. Bye all
08:37:27<Beelsebob>inbuninbu: other than the type not matching the function?
08:38:04<Saizan>how was the definition of (~>)?
08:38:32<Saizan>the one to write thing like (>>) $. put32 ~> put32 ~> id
08:38:35<inbuninbu>Beelsebob: oh yeah, second should be 64; it's dummy code i put down for simplicity's sake
08:38:56<Saizan>inbuninbu: no, the problem is (Data a b) vs. Word32 -> Word64 ->
08:40:37<inbuninbu>Saizan: sorry, brainfart, type should be putData :: Data -> Put
08:41:10<Beelsebob>then that seems fairly reasonable to me as a definition
08:41:55<Taejo>is there a regex library that works on arbitrary lists instead of just Strings?
08:42:09<inbuninbu>what i was wondering was if there's a nice trick that would let me map out the internals of the argument to a sequence, with less messy code
08:42:45<Saizan>no
08:44:14<inbuninbu>rats, i was afraid of that. thanks though!
08:46:36<zeroflag>excuse me, I'm looking for a lunatic who calls himself mauke.
08:47:01<zeroflag>ACTION pokes mauke with a long stick
08:49:33<Reiver>Hmmm.
08:50:45<Reiver>Is:
08:50:45<Reiver>>do symbol "("
08:50:46<Reiver>> do e <- expr
08:50:46<Reiver>> symbol ")"
08:50:46<Reiver>> return e
08:50:48<lambdabot> Not in scope: `symbol'
08:50:48<lambdabot> <no location info>:
08:50:48<lambdabot> The last statement in a 'do' construct must be an ...
08:50:48<lambdabot> No instance for (GHC.Show.Show (m SimpleReflect.Expr))
08:50:48<lambdabot> arising from a us...
08:50:59<Reiver>(... okay, stop using > as a spacemarker)
08:51:04<Reiver>Is that the right track?
08:51:22<Lemmih>Reiver: There's a 'do' too many.
08:51:29<Reiver>hm
08:51:41<Reiver>So it just Does e <- expr then?
08:51:58<Reiver>How does it know when to check for a ")"?
08:53:00<Beelsebob>:( why not just use symbol "(" *> expr <* symbol ")"
08:53:09<Saizan>what do you mean by "when"?
08:53:36<Saizan>Beelsebob: he's a beginner starting to use some unknown (to me) parsing lib
08:53:42<Cale>Beelsebob: Perhaps because the monadic notation is more straightforward :)
08:53:52<Beelsebob>well, no, it's not
08:54:15<Beelsebob>the monadic notation introduces silly ideas like sequences, rather than just writing down the grammar and having a parser magically work
08:54:45<Cale>sequences?
08:54:56<Beelsebob>do x, then y, then z, then ....
08:55:05<Beelsebob>we're functional programmers, remember ;)
08:55:28<Cale>Well, strings are sequences of characters, so it makes sense for parsers to concatenate...
08:55:49<Beelsebob>parsers don't have to parse in sequence
08:55:51<Saizan>Reiver: the parser "expr = do symbol "("; e <- expr; symbol ")"; return e" will only parse infinitely nested parentheses, but if you add other cases with (+++) you can get the recursion to stop
08:55:54<Beelsebob>it's overspecification
08:56:28<Saizan>well, the conjuctive part of a grammar is sequential in semantics
08:56:42<Saizan>regardless of how you parse it
08:56:44<Cale>Huh? The concatenation of parsers is a sequence of parsers...
08:56:58<Reiver>Oh, I could throw the parsing lib up if that would help.
08:57:08<Reiver>Hadn't even occoured to me >_>
08:57:26<Beelsebob>Cale: not necessarily - if I want to, I could write parsers that work from the end of the file backwards (don't ask why I might want to though)
08:57:39<Beelsebob>the grammar has order, that doesn't mean we have to *do* it in that order
08:57:46<Cale>Beelsebob: Sure.
08:57:53<Cale>Beelsebob: What's your point there?
08:58:04<Saizan>but what's wrong in expressing the order of the grammar with order?
08:58:05<Beelsebob>that *do* x, then y then z is over specification
08:58:06<Reiver>It's from Hutton's Introduction To Haskell book.
08:58:08<Reiver>sec
08:58:18<Beelsebob>and that the applicative version that merely writes the grammar down is simpler
08:58:23<Cale>Beelsebob: *do* doesn't mean that it actually evaluates the parser in that order
08:58:26<Reiver>Er, "Programming in Haskell", sorry.
08:58:31<Reiver>Getting my books mixed up :P
08:58:37<Beelsebob>Cale: no, but the coding style suggests it
08:58:45<Saizan>Reiver: it's not strictly necessary, since the parsing lib all look quite similar :)
08:58:53<Beelsebob>(yes, I realise I'm yet again arguing merely that do is a *really* shit word for that syntactic sugar)
08:59:03<Cale>I don't think it's bad.
08:59:07<Cale>It's just a word.
08:59:15<Cale>and it's nice and short :)
08:59:35<Reiver>Oh. Er. Here it is anyway? http://pastebin.com/dfd7bfa
09:00:00<Beelsebob>Cale: it's a word that's been specifically constructed to make it seem like we're doing imperative programming
09:00:16<Beelsebob>which is exactly what we don't want when specifying a grammar
09:00:24<Cale>Beelsebob: But it's only an illusion anyway
09:00:34<Cale>I don't see the problem with it :)
09:00:34<Saizan>Reiver: ok
09:00:44<Beelsebob>yeh sure... so lets use the nice style that doesn't create an illusion we don't want ;)
09:01:00<hatds>we always write code however we think looks best, so just use >>= if you think it looks best
09:01:15<Cale>I don't see why we don't want that illusion. Monadic code can be concise in its own way too.
09:01:31<Reiver>Er. I admit this conversation is going a bit over my head, here...
09:01:37<Saizan>Reiver: so, what i wrote so far made any sense?
09:01:40<Beelsebob>Cale: well... what's the illusion we're creating... that it's imperative code, that happens in sequence
09:01:45<Cale>Reiver: It's not really intended for you at this point :)
09:01:46<Beelsebob>that's exactly what we don't want to express
09:01:49<Beelsebob>because it's not happening
09:01:55<Reiver>Saizan: Clear as mud, though I appreciate you're trying... ;)
09:01:59<Cale>I don't see the illusion as being that strong.
09:02:11<hatds>yea, no one ever said 'do' does sequencing
09:02:17<Reiver>ACTION suspects he needs a quick explanation of The Small Simple Stuff.
09:02:19<Saizan>Reiver: maybe you should start experimenting with little parsers at the ghci prompt
09:02:21<Beelsebob>the dictionary did hatds ;)
09:02:24<Beelsebob>do as about actions
09:02:27<Beelsebob>about verbs
09:02:30<Reiver>(I'm using Hugs, actually, but okay)
09:02:39<Cale>Also, the monadic notation gives you a clear name for results of subcomputations, which the applicative notation doesn't.
09:02:44<Saizan>yeah, it's the same
09:02:45<Reiver>I did get a parser to read math equations.
09:02:52<Beelsebob>Cale: yeh, that's actually what I like about the applicative version
09:03:00<Saizan>Reiver: but without recursion?
09:03:03<Beelsebob>there isn't a need to name a computation I don't actually want to refer to except as the result
09:03:07<Cale>With applicative, if you need to use the result of a computation in more than one place, it can be very awkward.
09:03:10<Reiver>Saizan: I'd imagine so.
09:03:23<Beelsebob>Cale: oh, sure - but he doesn't want to in this example
09:03:24<Beelsebob>...
09:03:32<Reiver>I did have parethesis in the language, but even now I'm not entirely sure /how/ they ended up working...
09:03:37<Cale>Beelsebob: right, but in general when writing a parser you may want to
09:03:51<Cale>(and in fact it is pretty common)
09:03:58<Beelsebob>Cale: so I guess that's a general argument about point free style then?
09:03:59<Saizan>Reiver: hah, do you have that parser around?
09:04:01<Beelsebob>we shouldn't use it
09:04:07<Beelsebob>because we might want to use variables more than once
09:04:12<Cale>Beelsebob: It's okay to use it when it's appropriate.
09:04:14<Reiver>I do.
09:04:21<Beelsebob>Cale: yeh... and it's appropriate here
09:04:35<Cale>But for parsers, I think it's easiest to start with monadic notation, and maybe learn the applicative shorthands for things later.
09:04:35<Saizan>Reiver: if you paste it we can have a look
09:04:41<Reiver>do symbol "("; e <- expr; symbol ")"; return e
09:04:47<Beelsebob>ACTION really really doesn't get that
09:04:55<Reiver>Same as I'm trying to use now, 'cept this time round I'm trying to /understand/ what it's doing.
09:04:56<Beelsebob>for parsers it's easiest surely to just write down the grammar
09:04:58<Beelsebob>and be finished
09:05:08<Cale>Beelsebob: But you're not just writing a grammar.
09:05:17<Saizan>Reiver: expr = do symbol "("; e <- expr; symbol ")"; return e ?
09:05:21<Beelsebob>sure you are
09:05:32<Reiver>Saizan: Replace ; with newlines in actual code.
09:05:36<Cale>Beelsebob: Not many people write parsers that say "Yes, this is a member of this language." or "No, it isn't."
09:05:49<Reiver>That's the parsing for parenthesis I had in the math parser
09:05:50<mm_freak>as soon as the main thread exits, all threads are killed… can i prevent this without having to introduce heavy inter-thread communication?
09:05:56<Reiver>I just never quite understood how it actually /worked/
09:05:59<Beelsebob>Cale: no, they tend to read it into some structure - which is easy to do with a liberal application of fmap and <*>
09:06:02<Cale>Beelsebob: You're usually interested in extracting meaningful information from the parsing.
09:06:21<Saizan>Reiver: yeah, but my question is if you've something else combined with (+++) in the expr parser
09:06:22<Cale>Beelsebob: So long as that structure exactly reflects the structure of the grammar, it's okay.
09:06:32<Reiver>Umm...
09:06:35<Beelsebob>Cale: which it should do anyway
09:06:41<Cale>Beelsebob: No, not necessarily.
09:06:46<Saizan>Reiver: because that alone will only parse infinitely nested parentheses
09:06:48<Reiver>+++ natural
09:06:56<Reiver>Which then dealt with natural numbers.
09:06:58<Beelsebob>Cale: if it doesn't, you've missed a step imho
09:07:05<Beelsebob>that's not just parsing, it's processing as well
09:07:14<Reiver>Saizan: You mean that the thing will do nothing but parse ((((((((... ?
09:07:30<Reiver>Or ((())) ?
09:07:36<Beelsebob>it won't parse ((()))
09:07:39<Saizan>Reiver: it will try to parse (((...)))
09:07:43<Beelsebob>because "" isn't a valid expr
09:08:03<Reiver>Aha, okay
09:08:28<Saizan>that's why adding a base case with +++ is important
09:08:35<Reiver>Right.
09:08:43<Reiver>So could I have an Idiots Guide To What The do Statement Is Doing?
09:09:05<Reiver>I can see that it picks up the "(" symbol, then parses the code after it as if it were an expr - which can include another "(" symbol.
09:09:16<Cale>Reiver: You see the definition of >>= in the parsing library?
09:09:21<Saizan>Reiver: do you understand what the (>>=) method in the Monad Parser instance is doing?
09:09:23<Reiver>But I'm not sure how it moves on from the expr bit to find the ")" in it.
09:09:33<Cale>It translates a do-block into applications of that
09:09:35<Beelsebob>Reiver: this may be an apropriate such guide... http://noordering.wordpress.com/2009/03/31/how-you-shouldnt-use-monad/
09:09:35<Reiver>Not really, no.
09:09:52<Cale>Okay, so let's look at >>= first
09:09:56<Reiver>Okay.
09:10:14<Cale>Beelsebob: Stop it! :)
09:10:28<Beelsebob>what... it even goes into monadic parser combinators!
09:10:35<Beelsebob>and what do means
09:10:47<Cale>Reiver: So let's first write down the type of >>= in this context
09:10:59<Cale>(>>=) :: Parser a -> (a -> Parser b) -> Parser b
09:11:13<Cale>So it takes a parser whose result is a value of type a
09:11:29<Cale>and a function from values of type a to parsers whose result has type b
09:11:51<Cale>and it combines those together somehow to get a new parser whose results have type b
09:12:30<Cale>So here in the definition, p is a parser, and f is a function which is going to take the result of parsing with p and give another parser to continue parsing with
09:12:42<Cale>That's kind of a mouthful, I know :)
09:12:54<Cale>But does it at least make a bit of sense?
09:13:22<Reiver>So: Takes type a, (outputs type a, which is fed to Parser b), outputs a type Parser b?
09:13:52<Reiver>If I've got that right, the second part is fine, yes.
09:13:54<Cale>Parsing with p produces a value v :: a
09:14:09<Reiver>Okay
09:14:14<Cale>and then f v :: Parser b, and it continues parsing with that, returning its result
09:14:33<Cale>So, now we can look at how it does that
09:14:58<Cale>It has to produce a parser, and since at this point in the library, we don't have many ways to make those yet, it starts off with the data constructor P
09:15:16<Taejo>in Parsec, I'd use (p >> q) to run parser p, discard its result and then run parser q; is there a neat way to discard the result of the second parser and return the result of the first?
09:15:28<Beelsebob>Taejo: <*
09:15:36<Beelsebob>(and *> to do what you just said)
09:15:37<Taejo>Beelsebob: thanks
09:15:54<Beelsebob>so his example there is symbol "(" *> expr <* symbol ")"
09:16:08<Reiver>Cale: Righto
09:16:10<Cale>Reiver: Do you understand the Parser type?
09:16:19<Cale>newtype Parser a = P (String -> [(a,String)])
09:16:51<Cale>A parser for things is a function from strings to lists of pairs of things and strings.
09:17:10<Reiver>Yep, I'm following what Parser does
09:17:16<Cale>That is, it returns a list of possible parses
09:17:27<Cale>along with the remainder of the string in each case
09:17:46<Cale>Oh, this definition for >>= in your library is bad.
09:17:56<Reiver>... it is?
09:18:10<Cale>Yeah, it doesn't handle the case when p produces more than one result
09:18:25<Reiver>Er. Bad in a sense of "Will break the program", or "flawed in certain situations"?
09:18:53<Cale>In a sense that it will randomly die if a parser returns more than 0 or 1 results.
09:19:09<Taejo>argh, old parsec without applicative instance
09:19:16<Cale>(that is, it's forcing parsers to be deterministic)
09:19:28<Cale>but, okay
09:19:42<Cale>Reiver: let's look at this incomplete version anyway
09:20:01<Cale>Reiver: It gives the function which takes the input string, and parses it with p
09:20:05<Cale>and if the result is []
09:20:14<Cale>then that means parsing with p failed
09:20:19<Cale>and so the whole parse fails
09:20:24<Taejo>anyone know which GHC is in Ubuntu Jaunty?
09:20:26<Cale>so in that case the result is []
09:20:43<Reiver>(Ah, yes. I think later chapters deal with nondeterminism; it could be a deliberate flaw.)
09:20:46<Reiver>Right.
09:20:48<Cale>If, instead we get a list of length 1, [(v,out)]
09:21:13<Cale>then that means p succeeded in parsing with one result v, and the remainder of the string, which it didn't eat is 'out'
09:21:31<Cale>and so then it parses out using the parser (f v)
09:21:39<Cale>Clearer now?
09:21:53<Reiver>I think so, yes.
09:22:00<Cale>While we're at it, we can look at what return does
09:22:05<mm_freak>it's interesting to see how real world problems (threading, I/O, network) are almost entirely ignore here, while 'interesting' problems (types, algorithms (and how to elegantly notate them), monads, theory) usually cause endless discussion =)
09:22:31<Cale>return v gives the parser which always succeeds, producing the result v and passing the entire input string to the output
09:22:57<Taejo>mm_freak: Haskell is so awesome that we solve our real world problems in a tenth of the time, so we have plenty of time to talk about interesting things
09:23:10<Cale>mm_freak: Oh, I missed your question. The answer is don't let the main thread die.
09:23:17<Taejo>@faq Can Haskell solve real world problems in a tenth of the time?
09:23:17<lambdabot>The answer is: Yes! Haskell can do that.
09:23:22<mm_freak>hehe
09:23:47<mm_freak>Cale: my questions are almost always missed, unless they're 'interesting' =)
09:23:59<Reiver>Cale: Righto.
09:24:02<Cale>mm_freak: So, if you have to, have the main thread wait on MVars from the threads that it creates, or something.
09:24:27<mm_freak>Cale: yeah, that's what i'm doing currently, but i thought, maybe the RTS can just wait for all threads instead of only one
09:24:28<Cale>Reiver: okay, so now that you understand >>=, you just need to understand how do-notation translates
09:24:51<Cale>mm_freak: If you figure out a way that it can, I might be interested to hear it :)
09:25:06<Cale>mm_freak: But as far as I know, the main thread is special in that way.
09:25:12<Cale>Reiver: So...
09:25:26<Reiver>>>= is parsing the output of Parser a; aka recursively parsing stuff?
09:25:28<mm_freak>maybe i should make the main thread a pure thread manager, nothing else
09:25:39<paper_cc>mm_freak: http://www.haskell.org/ghc/dist/current/docs/libraries/base/Control-Concurrent.html <-- see paragraph "Terminating the program"
09:26:17<Cale>Reiver: x >>= f parses the input with the parser x, passing the result of that parsing to f to get another parser, which it uses to parse whatever is left of the input
09:26:27<mm_freak>paper_cc: i've got there already and it's not satisfying =/
09:26:34<mm_freak>well, i'll just use MVars
09:26:45<Reiver>Okay, right.
09:26:47<mm_freak>it's sucks though to have MVar ()
09:26:56<Reiver>So then the do notation...
09:27:10<Taejo>:t break
09:27:11<lambdabot>forall a. (a -> Bool) -> [a] -> ([a], [a])
09:27:26<Cale>do { x } = x
09:27:40<paper_cc>mm_freak: at least it says that threads are always daemonic
09:27:41<Cale>If a do-block has only one statement, then there was no point in using do :)
09:27:50<paper_cc>mm_freak: (it == the documentation)
09:27:53<Cale>but this makes a nice base-case for the recursive translation :)
09:28:12<Cale>do { v <- x ; <stmts> } = x >>= (\v -> do { <stmts> })
09:28:29<mm_freak>next thing is: killThread kills threads immediately, even if they are in a 'block', is there anything i could do here?
09:29:18<Cale>do { x ; <stmts> } = x >>= const (do { <stmts> }) -- so, this means ignore the result of x, and always parse the rest using the same parser
09:29:41<Cale>and, just for completeness
09:29:57<Cale>do { let <decls> ; <stmts> } = let <decls> in do { <stmts> }
09:30:56<Reiver>decls?
09:31:00<Cale>declarations
09:31:03<Reiver>Oh, of course
09:31:23<Reiver>Okay, so
09:31:27<paper_cc>mm_freak: this means the behavior of 'block' is simply wrong
09:31:38<Cale>For example, you see the parser 'ident'
09:32:08<Cale>ident = do x <- lower; xs <- many alphanum; return (x:xs)
09:32:37<Cale>= lower >>= \x -> do { xs <- many alphanum; return (x:xs) }
09:32:40<paper_cc>mm_freak: or your block has some "interruptible operations" (cf. docs) inside
09:32:50<Cale>= lower >>= \x -> many alphanum >>= \xs -> do { return (x:xs) }
09:32:55<Cale>= lower >>= \x -> many alphanum >>= \xs -> return (x:xs)
09:33:06<Reiver>Cale: ... those two look awfully similar.
09:33:17<Reiver>Or are those refactoring code?
09:33:26<Cale>Those are all equal
09:33:33<Reiver>Right! Okay.
09:33:34<Cale>I'm expanding out the do-notation for you
09:33:40<Cale>To show you how it works :)
09:33:44<mm_freak>paper_cc: i've tested this with threadDelay… it gets interrupted
09:33:54<Reiver>Aha. Aye, it's making more sense.
09:34:07<Reiver>So there's not much point to the do notation then?
09:34:21<Cale>It just makes code a little nicer to read.
09:34:31<Cale>Than having long chains of >>='s
09:34:36<Cale>and lambdas :)
09:34:56<Cale>But yeah, it's syntax sugar.
09:35:00<mm_freak>do char '('; c <- anyChar; char ')'; return c
09:35:10<outchanter>ah, the sweet, sweet taste of syntactic sugar
09:35:19<mm_freak>instead of: char '(' >> anyChar >>= \c -> char ')' >> return c
09:35:35<Cale>I probably should also mention that x >>= const y has another name, which is x >> y
09:35:56<Reiver>Okay.
09:36:03<Cale>So if you ever want to ignore the first parser's result (but it still eats some initial part of the string), you can use >>
09:36:15<Reiver>Right.
09:36:19<Reiver>ACTION hmns.
09:36:20<Cale>and so another way to translate:
09:36:32<Cale>do { x ; <stmts> } = x >> do { <stmts> }
09:37:00<paper_cc>mm_freak: don't know actually... what if you put something like (factorial 10000) instead of the delay?
09:37:06<Reiver>OK.
09:37:17<mm_freak>not to forget that do-notation can be layed out nicely in source code without the need for ';'
09:37:42<Cale>Right, I'm only including the semicolons and braces for clarity when everything is smashed onto one line here :)
09:37:46<mm_freak>paper_cc: let me test
09:38:05<Reiver>ACTION figured that much; 'tis appreciated. :)
09:39:46<mm_freak>paper_cc: indeed, then it works
09:39:58<mm_freak>now i tested with: return $! fix (\r n -> if n == 0 then () else r (n-1)) 10000000
09:40:48<Reiver>Hmm.
09:41:07<Reiver>I'm going to look at this again and think about it. Also shift my car. BBIAB.
09:41:09<Cale>Reiver: So, in general, any sort of library where we have things that represent computations that have results, where we have a 'return v' which is a kind of computation that does nothing and results in v, and an operation like this >>=
09:41:16<Cale>is called a monad.
09:41:48<Cale>Well, more specifically, 'monad' refers to the type constructor, in this case, it's Parser which is the monad.
09:42:09<Cale>and do-notation works in any monad that way :)
09:42:38<mm_freak>paper_cc: what still doesn't work is: 'finally' doesn't react to the ThreadKilled exception
09:42:49<mm_freak>so i have no means of doing cleanup before the thread exits
09:44:06<Berengal>Cale: I like to think of monads as the triplet (Type constructor, return, >>=). Saying it's just the type constructor confused me some when I was starting out
09:45:38<Berengal>Of course, the term "Monad" has be overloaded to mean quite a lot of things...
09:45:50<Cale>Well, it's a type constructor which has definitions of those things, yes
09:46:07<Cale>But if you say "Foo is a monad", then Foo had better be a type constructor.
09:46:29<Cale>(or a functor on some category anyway)
09:50:31<paper_cc>mm_freak: strange. and what if you throw something other than ThreadKilled?
09:52:06<mm_freak>paper_cc: doesn't work either… very strange
09:52:23<mm_freak>wait, i'll paste the code
09:53:38<mm_freak>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5409
09:54:14<mm_freak>"Done blocking" appears, but "Done" doesn't
09:58:44<mm_freak>Reiver: side note, the 'do' notation is very useful in the IO monad, as you can see in the pasted code
09:59:07<mm_freak>it would be tiring to have to write this in combinator style (>>, >>=, lambdas)
09:59:21<mm_freak>IO is a monad, just like Parser
10:04:23<Saizan>well, when the main thread exits the other are not killed with an exception but just stopped i guess
10:08:07<paper_cc>mm_freak: your code does work if I remove the threadDelay in the finally handler. Look carefully at the output: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5409#a5411
10:08:36<paper_cc>mm_freak: looks like the exception arrives too late - into the threadDelay in the finally handler
10:08:37<mm_freak>Saizan: that's why there is a 10 second threadDelay at the end of the main thread
10:08:51<mm_freak>Saizan: it ensures that the subthread exits first in all cases
10:09:14<paper_cc>ACTION tries (putStrLn "Started finally" >> threadDelay 1000000 >> putStrLn "Done)
10:09:23<mm_freak>paper_cc: looks like threadDelay simply re-raises the exception
10:09:36<mm_freak>such that the putStrLn is never reached
10:09:59<paper_cc>mm_freak: yes, because exceptions are not blocked inside threadDelay
10:10:14<mm_freak>hmm, so threadDelay has an implicit unblock?
10:10:42<paper_cc>mm_freak: http://www.haskell.org/ghc/dist/current/docs/libraries/base/Control-Exception.html#13
10:11:12<paper_cc>it is not documented if threadDelay is interruptible, but it looks so
10:14:36<paper_cc>mm_freak: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5409#a5412
10:18:03<mm_freak>hmm
10:18:38<mm_freak>that essentially says that there is no secure way to do cleanup, unless you implement some cleaner way of quitting threads
10:18:56<mm_freak>like messaging and MVar
10:19:13<mm_freak>but there are a few things, for which this simply won't work, like an 'accept'ing server
10:19:13<paper_cc>mm_freak: no it doesn't... this simply says there's no secure way to do blocking operations during cleanup
10:19:48<mm_freak>paper_cc: yeah, but most cleanup tasks would use some operations, for which you don't know whether they block
10:19:52<mm_freak>like hClose
10:21:10<paper_cc>ACTION writes mapM_ print $ foldl1 (*) [1..100000] instead of threadDelay
10:22:49<paper_cc>ACTION fails at printing a list of factorials
10:23:01<ivanm>@seen quicksilver
10:23:02<lambdabot>quicksilver is in #macosxdev, #haskell-soc, #haskell-blah, #ghc, #haskell-overflow and #haskell. I last heard quicksilver speak 17h 9m 31s ago.
10:23:53<paper_cc>ACTION couldn't tell foldl from scanl
10:28:01<paper_cc>mm_freak: hmm, print is interruptible
10:32:27<paper_cc>mm_freak: ... that means the thread shouldn't receive the exit signal during important cleanup blocks
10:36:39<Cale>http://www52.wolframalpha.com/input/?i=how+to+program -- lol
10:37:05<Beelsebob>heh
10:37:14<Beelsebob>seems to be about the only thing alpha is good at
10:37:28<Beelsebob>coming up with stupid answers to questions you didn't really want to ask
10:37:39<Heffalump>rotfl
10:38:01<Cale>http://www32.wolframalpha.com/input/?i=the+light+of+1000+suns is also kind of funny :)
10:38:36<Cale>(less funny if you know the sense of the word 'sun' that it seems to think you mean)
10:39:32<Cale>http://chrishecker.com/images/f/fc/Wspector2-small.png
10:39:56<ivanm>Cale: lol (for the image)
10:40:12<^Someone^>Lol
10:40:12<ivanm>but what "sun" is alpha referring two?
10:40:25<ivanm>"sum"?
10:40:48<ivanm>Cale: also, for the first one... shameless plug?
10:40:52<paper_cc>is "sun" a unit of length?
10:41:01<Cale>a unit of area
10:41:12<ivanm>never heard of it before
10:41:27<Cale>寸 [すん] /(n) sun (approx. 3.03 cm)/
10:41:32<Cale>er
10:41:34<ivanm>http://en.wikipedia.org/wiki/Sun_unit
10:41:35<ivanm>?
10:41:38<Cale>oh, no it is length
10:41:44<Cale>Right
10:42:17<Cale>(which is why when multiplied by the speed of light, you get area/time)
10:47:16<mm_freak>paper_cc: i'll refrain from using exceptions for quitting threads
10:47:42<Baughn>..but it's so convenient!
10:47:57<mm_freak>paper_cc: up to now i've just used MVars, which worked fine, but it seems like that can be solved more elegantly
10:52:01<paper_cc>mm_freak: you can actually use QSemN
10:59:13<Reiver>Well that took longer than planned...
10:59:20<Reiver>ACTION mutters at Murphy and his minions
11:00:32<Cale>Man, 82 comments on reddit on a post about whether -2^2 should be interpreted as 4 or -4
11:01:41<uzytkownik>Hello. I'm tring to learn Haskell and I'm tring to use Foreign.C. How should I map structs to haskell?
11:02:08<Cale>By writing an instance of Storable which reads them
11:02:27<Cale>http://www.haskell.org/ghc/docs/latest/html/libraries/base/Foreign-Storable.html
11:02:32<Baughn>hsc2hs can help, as can c2hs
11:02:34<zepard>hi all
11:02:47<Cale>Yeah, there are tools for automatically generating that code, if it's going to be complicated.
11:03:27<Baughn>Well, hsc2hs doesn't really do it /automatically/, but its tools for calculating the alignment of struct members is pretty vital
11:03:39<uzytkownik>Cale: Thanks
11:04:09<Cale>uzytkownik: So you create a Haskell datatype which corresponds to the C structure, and then implement sizeOf, alignment, peek and poke (minimally)
11:04:34<olsner>woah, why is this one using fixIO? peekElemOff addr idx = IOExts.fixIO $ \result -> [...]
11:05:23<Cale>olsner: In order to refer to the sizeOf the result.
11:05:52<mm_freak>paper_cc: then i'd need to control the number of threads spawed
11:05:53<Cale>Er, it's kind of a silly usage
11:06:14<Cale>olsner: it could also have used scoped type variables which might have been clearer :)
11:06:19<paper_cc>mm_freak: yes
11:06:50<mm_freak>paper_cc: i rather have a tree-like thread model, where each thread controls a number of sub-threads and where usually the order of killing is relevant
11:07:05<Cale>peekElemOff :: forall a. Ptr a -> Int -> IO a; peekElemOff addr idx = peek (addr `plusPtr` (idx * sizeOf (undefined :: a)))
11:07:35<mm_freak>currently i use this idea: startSomething :: SomethingCfg -> IO (IO ())
11:07:35<eivuokko>Yeah, that's a bit funny fix. o.O
11:07:46<mm_freak>startSomething returns a function, which can be used to kill the thread safely
11:08:01<mm_freak>that function internally uses an MVar
11:08:58<paper_cc>mm_freak: I just made something for guarded finally blocks
11:08:59<paper_cc>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5409#a5413
11:10:09<mm_freak>paper_cc: i go another approach… all my threads take commands from other threads through an MVar anyway
11:10:16<mm_freak>so i just added a Quit command
11:10:32<Reiver>hrn.
11:10:36<olsner>Cale: maybe you could also use a dummy variable, take the sizeOf that, then use asTypeOf or something to make the dummy have the same type as the result
11:10:43<Twey>mm_freak: Try throwTo?
11:10:47<olsner>(if you don't want to use type system extensions)
11:10:48<Reiver>Cale: Okay, I think I've got the () syntax understood now.
11:10:53<paper_cc>mm_freak: ah, you poll for commands... then it's good
11:10:56<mm_freak>Twey: see above
11:11:00<Reiver>I'm now looking at the prospect of trying to deal with Identifiers.
11:11:06<mm_freak>Twey: long above that is =)
11:11:18<Reiver>... I have no idea where to even start; maybe I've gotten lax but I'm used to having a symbol avalable. ;)
11:11:57<mm_freak>paper_cc: yeah, i take commands in a 'forever'… upon Quit, the thread now does cleanup work and then kills itself
11:13:58<paper_cc>mm_freak: also, there's (maybe) something interesting in http://www.haskell.org/haskellwiki/Concurrency_demos/Graceful_exit
11:14:11<paper_cc>*interesting for you
11:15:11<paper_cc>ACTION DUZ WANT asyncronous signals in the GHC scheduler
11:16:21<mm_freak>the STM method looks interesting, but this can be done without STM
11:16:43<mm_freak>i think, i'll go this way for the accepting code
11:17:13<paper_cc>ACTION or unsafeYellFeatureRequest#ghc?..
11:17:49<mm_freak>too impatient for that
11:18:42<paper_cc>mm_freak: actually it's the third time I see a request for signals on #haskell =)
11:19:22<Baughn>paper_cc: Hang on, what's wrong with throwTo?
11:20:41<mm_freak>hmm
11:20:43<paper_cc>Baughn: see above^W^W"interruptible operations": putStrLn/takeMVar/whatever CAN receive asyncronous exceptions even in scope of a 'block'. imagine receiving a kill signal inside a finally handler
11:20:51<mm_freak>that was your request, not mine =)
11:21:16<mm_freak>throwTo works fine to interrupt some blocking operation, but not fine to terminate a thread
11:22:15<uzytkownik>I cannot find this option - how to remove a package in cabal?
11:22:41<Baughn>paper_cc: Hmm. I wonder what the rationale for that is
11:22:55<eivuokko>uzytkownik, you can't really. Assuming ghc, you have to use ghc-pkg unregister and remove the files by hand.
11:22:59<dcoutts>uzytkownik: you can unregister a package using ghc-pkg unregister $name [--user]
11:23:11<paper_cc>uzytkownik: no wonder you can't find it... it doesn't exist. AFAIK the best you can do is ghc-pkg unregister <package>; rm <list-package-files-by-hand>
11:23:11<dcoutts>uzytkownik: if you want to delete the files too then use rm
11:24:02<Peaker>Baughn: just read your response on the mailing list and was about to say "a hopefully dead thread" is not a good idea, then I saw you already noticed the problem :)
11:24:27<Baughn>Peaker: I noticed the problem, which turned out to be a non-problem
11:24:31<mm_freak>paper_cc: rather than an entirely concept of 'signals' i'd rather like to see an 'abort current blocking operation' function
11:24:32<paper_cc>Baughn: Control.Exception docs say something about a possibility of deadlock, but this doesn't explain why putStrLn should be interruptible (for me)
11:24:42<Peaker>Baughn: why not?
11:25:20<Baughn>Peaker: I'd misunderstood the semantics of unsafePerformIO. After the throwTo, it restarts by executing the /next/ action
11:25:39<mm_freak>killThread always kills the thread before returning, right?
11:25:41<Baughn>Peaker: So the exception only ever gets thrown once, which is what we want
11:25:53<paper_cc>mm_freak: yes
11:26:03<mm_freak>k, that's useful
11:26:05<Peaker>Baughn: so throwTo is just to avoid the synchronous exception thing, as in the next reply?
11:26:14<paper_cc>mm_freak: (so my example first prints 10^3 factorials and then "Killed")
11:26:14<Baughn>Peaker: Yes
11:26:24<Peaker>Baughn: ah
11:26:46<uzytkownik>eivuokko, dcoutts, paper_cc: Thanks.
11:26:46<Baughn>Peaker: That is to say, because if I used throw/throwIO the exception would be continually re-thrown
11:26:55<paper_cc>@quote fugue
11:26:55<lambdabot>monochrom says: Welcome to #haskell, where your questions are answered in contrapuntal fugues.
11:27:17<Baughn>Peaker: Meanwhile, the original unamb implementation (apart from incorrectly placing that code in race instead of unamb, and a couple other issues) forgot to /unblock/ before calling throwTo
11:27:21<Baughn>Making it deadlock
11:27:27<Peaker>Baughn: yeah
11:27:38<Peaker>Baughn: that's the original issue I had encountered
11:28:00<cnwdup>How can I format a DiffTime? Converting it to Int would suffice for me. But I don't know how to do that, either.
11:28:14<Peaker>@hoogle DiffTime -> Int
11:28:15<lambdabot>Data.Generics.Schemes gdepth :: GenericQ Int
11:28:15<lambdabot>Data.Generics.Schemes glength :: GenericQ Int
11:28:15<lambdabot>Data.Generics.Schemes gnodecount :: GenericQ Int
11:28:56<Baughn>cnwdup: It's an instance of Num
11:29:02<paper_cc>@ty toInteger
11:29:03<Baughn>So, fromIntegral will do it
11:29:04<lambdabot>forall a. (Integral a) => a -> Integer
11:29:10<cnwdup>@ty divMod
11:29:12<lambdabot>forall a. (Integral a) => a -> a -> (a, a)
11:29:19<Baughn>Or fromFractional if you want better precision
11:29:33<cnwdup>Baughn, thanks.
11:31:24<dcoutts>uzytkownik: if you want to help implement cabal uninstall that would of course be great :-)
11:32:42<uzytkownik>dcoutts: I know. However I have at least a few projects I'm already working on ;) (besides the fact I have a session of exams in a week)
11:33:03<dcoutts>uzytkownik: good luck with the exams!
11:33:12<uzytkownik>dcoutts: Thanks
11:33:13<kynky>in gentoo, i just use hackport, that converts the cabals into ebuilds then just my distro package manager to handle it, thought was an easy way to make sure everything got removed
11:33:41<dcoutts>kynky: yep, that's a reasonable way of integrating the two
11:34:02<cnwdup>Baughn, fromIntegral does not have anything to do with the Num class, does it?
11:34:08<cnwdup>@ty fromIntegral
11:34:10<lambdabot>forall a b. (Integral a, Num b) => a -> b
11:34:24<cnwdup>I could convert Int to DifffTime, yes. But I'd like to convert DiffTime to Int.
11:35:11<paper_cc>cnwdup: DiffTime is an instance of Fractional
11:35:14<paper_cc>@src Fractional
11:35:15<lambdabot>class (Num a) => Fractional a where
11:35:15<lambdabot> (/) :: a -> a -> a
11:35:15<lambdabot> recip :: a -> a
11:35:15<lambdabot> fromRational :: Rational -> a
11:35:29<paper_cc>oh, sorry, that's not what I wanted :(
11:35:36<paper_cc>ACTION dislikes numeric classes
11:35:40<paper_cc>@src Real
11:35:41<lambdabot>class (Num a, Ord a) => Real a where
11:35:41<lambdabot> toRational :: a -> Rational
11:35:47<paper_cc>cnwdup: ^^ that's it
11:36:09<paper_cc>> toRational $ secondsToDiffTime 123
11:36:10<lambdabot> Not in scope: `secondsToDiffTime'
11:36:20<paper_cc>, toRational $ secondsToDiffTime 123
11:36:22<lunabot> luna: Not in scope: `secondsToDiffTime'
11:36:26<paper_cc>grr
11:36:30<Baughn>cnwdup: True. Sorry about that.
11:36:31<cnwdup>paper_cc, I want diffTimeToSeconds. Not the other way round.
11:36:44<cnwdup>Baughn, np. (:
11:37:44<hatds>fromEnum?
11:38:20<cnwdup>hatds, that might work. Thank you. (:
11:38:30<Peaker>@src Integral
11:38:30<lambdabot>class (Real a, Enum a) => Integral a where
11:38:31<lambdabot> quot, rem, div, mod :: a -> a -> a
11:38:31<lambdabot> quotRem, divMod :: a -> a -> (a,a)
11:38:31<lambdabot> toInteger :: a -> Integer
11:38:40<Peaker>@src Real
11:38:40<lambdabot>class (Num a, Ord a) => Real a where
11:38:40<lambdabot> toRational :: a -> Rational
11:39:17<Peaker>Why is Integral a subclass of Real?
11:39:38<ivanm>@src Real
11:39:39<hatds>because things representing integers are things representing reals
11:39:39<lambdabot>class (Num a, Ord a) => Real a where
11:39:39<lambdabot> toRational :: a -> Rational
11:39:43<Peaker>Why is Real called Real and not Rational, and the Rational data-type replaced with an instance?
11:39:54<FunctorSalad>wait, if DiffTime is fractional, I doubt fromEnum will work
11:39:56<Berengal>Peaker: Real is non-complex
11:40:07<FunctorSalad>floor . toRational or something?
11:40:19<Peaker>hatds: wouldn't that make it a sub-type, rather than a sub-class?
11:41:02<kpreid>Haskell doesn't have subtypes.
11:41:41<hatds>take note that "Real" is a bit unusual in that instances aren't always capable of representing most real numbers (which is the case for most of the other type/typeclass relationships)
11:41:49<FunctorSalad>> fromEnum (1%2)
11:41:50<lambdabot> 0
11:41:56<FunctorSalad>eh
11:42:23<dancor_>> fromEnum (13%25)
11:42:25<lambdabot> 0
11:43:18<hatds>> fromEnum 100%9
11:43:20<lambdabot> 100 % 9
11:43:26<hatds>> fromEnum (100%9)
11:43:28<lambdabot> 11
11:43:56<FunctorSalad>Peaker: I guess a more correct sig for the method of Real a would be "Int -> a -> Rational" :)
11:44:05<FunctorSalad>the frist arg specifying the precision
11:44:28<Peaker>this class hierarchy sucks :-P
11:44:30<hatds>well, floats are real but don't have arbitrarily precision
11:44:41<hatds>*arbitrariy
11:44:50<hatds>whatever
11:44:51<hatds>:)
11:45:09<Peaker>there should be no "Real" class, its impossible to represent Reals
11:45:15<FunctorSalad>that's not a problem hatds
11:45:32<hatds>Peaker: see subtle point above. Ints disprove your claim :)
11:45:51<FunctorSalad>I mean the semantic would be: "distance(x,toRational n x) < 1/n"
11:46:01<FunctorSalad>for floats you could always make the distance 0
11:46:49<hatds>I see what you mean
11:47:22<hatds>there is a fixed point type/typeclass somewhere which seems like it would be useful
11:50:35<hatds>showing fractional and floating results is the one big painful thing that sticks out with my experience
11:52:21<FunctorSalad>printf?
11:52:34<hatds>hmm?
11:52:55<FunctorSalad>> printf "%.3f" (1/3)
11:52:56<lambdabot> Add a type signature
11:53:00<FunctorSalad>> printf "%.3f" (1/3 :: Double)
11:53:01<lambdabot> Add a type signature
11:53:05<FunctorSalad>> printf "%.3f" (1/3 :: Double) :: String
11:53:06<lambdabot> "0.333"
11:53:09<FunctorSalad>:D
11:53:25<hatds>I mean I always want to show fractional/floating results with a specified number of places -- and no trailing zeroes!
11:53:33<hatds>you can't do that easily
11:53:56<paper_cc>> printf "%.3f" (1/2 :: Double) :: String
11:53:58<lambdabot> "0.500"
11:54:07<paper_cc>> printf "%3f" (1/2 :: Double) :: String
11:54:08<lambdabot> "0.5"
11:54:16<paper_cc>> printf "%3f" (1/3 :: Double) :: String
11:54:18<lambdabot> "0.3333333333333333"
11:54:22<paper_cc>grr
11:54:27<paper_cc>> printf "%3.3f" (1/2 :: Double) :: String
11:54:29<lambdabot> "0.500"
11:54:58<hatds>hey, neat
11:55:41<FunctorSalad>there a dynamic version in Text.Printf and a TH one in Text.Printf.TH
11:57:00<Twey>Ooooh!
11:57:02<Twey>TH printf!
11:57:05<Twey>Is it typesafe?
11:57:25<FunctorSalad>yes
11:57:29<Twey>:-D
12:04:39<povman>Ideally there'd be a QQ printf
12:05:00<Baughn>QQ? Ah, quasiquoting
12:05:04<Baughn>Write one. :D
12:05:45<ivanm>povman: what would a QQ printf look like?
12:06:04<ivanm>and what advantage does a TH printf have?
12:07:10<Berengal>ivanm: Type safety
12:08:40<ivanm>how does QQ or TH ensure type safety?
12:08:51<paper_cc>why is [$printf| foobar |] better than $(printf "foobar") ?
12:09:09<ivanm>also, doesn't TH usage require you to basically run ghci on it?
12:09:11<paper_cc>ivanm: the generated AST is passed through the normal typechecker
12:09:27<ivanm>*nod*
12:10:21<povman>paper_cc: I was thinking something like printf [$format | %3.3f |] etc - because then you can use your own formatting thingy
12:10:25<povman>syntax
12:10:52<paper_cc>ivanm: and the result for $(printf "number %d string %s") would have type Int -> String -> String
12:11:08<ivanm>I take it $(..) is QQ?
12:11:25<paper_cc>ivanm [$name| <quoted> |] is QQ
12:11:35<paper_cc>ivanm: $(...) is a splice
12:11:58<povman>I'm very impressed with the dynamic version actually
12:12:00<ivanm>oh, I thought the [..] stuff was TH
12:12:05<ivanm>paper_cc: what's a "splice"?
12:12:26<povman>I think [| ... |] is TH
12:12:27<Twey>It executes the given code and inserts its result into the code at that point
12:12:31<paper_cc>ivanm: $(foo ...) means "call foo with arguments (...) and put the result here
12:12:32<ivanm>povman: ahhh
12:13:08<povman>Oh - what's [| |] then?
12:13:33<povman>I think [| |] is like [$haskell | |]
12:13:47<paper_cc>ivanm, povman: [| ... |] (or [d| ... |], or something else with one character) is the inverse of $( ... )
12:14:10<paper_cc>povman: [$haskellExpr| ... |] rather, but yes.
12:14:13<povman>put haskell code in, syntax tree comes out?
12:14:13<Twey>It takes chunk of Haskell and returns an expression
12:14:17<Twey>ACTION nods.
12:14:38<paper_cc>povman: [d| ... |] is [$haskellDef| ... |]
12:15:08<FunctorSalad>, [|1+1|]
12:15:10<lunabot> InfixE (Just (LitE (IntegerL 1))) (VarE +) (Just (LitE (IntegerL 1)))
12:15:28<FunctorSalad>nice, it actually runQ's automatically
12:15:40<paper_cc>, [d| foo :: Int; foo = 1 |]
12:15:42<lunabot> SigD foo (ConT Int)
12:15:42<lunabot> ValD (VarP foo) (NormalB (LitE (IntegerL 1))) []
12:16:23<paper_cc>, [p| x |]
12:16:24<lunabot> luna: Tempate Haskell pattern brackets are not supported yet
12:16:30<paper_cc>s/yet/still/ :(
12:16:56<FunctorSalad>, [t|gfoldl|]
12:16:57<lunabot> luna: Not in scope: type variable `gfoldl'
12:17:02<FunctorSalad>;)
12:17:56<paper_cc>, [t| Integer |]
12:17:58<lunabot> ConT Integer
12:18:18<FunctorSalad>oh, right
12:18:30<FunctorSalad>it's not :type
12:18:31<paper_cc>, [$ty| gfoldl |]
12:18:34<lunabot> forall a b . Data a => (forall c d . Data d => b (d -> c) ->
12:18:34<lunabot> d -> b c) ->
12:18:34<lunabot> (forall e . e -> b e) -> a -> b a
12:19:03<FunctorSalad>, [t| [$ty|gfoldl|] |]
12:19:04<lunabot> luna: parse error on input `ldl|]'
12:19:18<paper_cc>ACTION closes his eyes and waits for the horrendous type to scroll up
12:19:25<FunctorSalad>, [t| [$ty| gfoldl |] |]
12:19:26<lunabot> luna: parse error on input `dl |]'
12:19:32<FunctorSalad>hmm? :(
12:20:16<paper_cc>o_O
12:20:41<Saizan>8~, [t| [$ty| gfoldl \|\] |]
12:20:46<Saizan>, [t| [$ty| gfoldl \|\] |]
12:20:47<lunabot> luna: parse error on input `\] |]'
12:20:52<Saizan>, [t| [$ty| gfoldl \|] |]
12:20:53<lunabot> luna: parse error on input `|] |]'
12:21:15<paper_cc>, [t| $([$ty| gfoldl |]) |]
12:21:17<lunabot> luna: parse error on input `$('
12:21:37<paper_cc>, $([$ty| gfoldl |])
12:21:40<lunabot> luna: Couldn't match expected type `Language.Haskell.TH.Lib.ExpQ'
12:22:04<povman>paper_cc: what would such an expansion do in this context?
12:22:26<Wraithan>I didn't see it in the JSON module but I was wondering if anyone knew of a function that takes a JSON string, formatted in {"key" "value", "Key" "va;ue"} amd turned it into either a String list or a (String, String) list
12:22:30<povman>i.e. what is lunabot to do with $( )
12:22:58<Wraithan>some of the values are not " " else I would just parse it out myself
12:23:12<paper_cc>povman: well, it was supposed to check if I could QQ inside a $(...)
12:24:01<povman>Wraithan: You're using json library?
12:24:42<Wraithan>povman: I have it installed, not sure if that is the library I want to use though, as I just want a simple function like I described
12:24:57<Wraithan>povman: preferably that uses String pairs in a list
12:25:53<povman>Wraithan: did you use fromJSObject?
12:25:54<Wraithan>er, that returns string pairs in a list, it should take a string containing a JSON object as a argument
12:26:36<povman>oh, you want to read from string and convert
12:26:49<Wraithan>povman: That askes for a JSString, I am rather new to this, should I use read to convert my string to a JSString?
12:27:36<povman>Wraithan: It looks like you should use readJSObject
12:28:20<povman>Wraithan: Something like runGetJSON readJSObject "{ blah: whatever }"
12:29:09<povman>This will either return Left with some error message, or Right with your object
12:32:29<Wraithan>Ok, getting closer,thank you
12:33:15<povman>I suppose the object you get from that is more usefull than a list of (String, String)
12:35:05<Wraithan>povman: kind of, it lists all the types, while would be useful for some, it isn't really useful to me, at least not at this time
12:35:50<Wraithan>povman: I appreciate your help, this will get me a lot further
12:35:59<povman>Yeah it depends what you're trying to do. JSValue is an instance of Show, so it should be pretty simple to convert it.
12:36:24<povman>np, I've asked for help so many times on here and it's good to help others sometimes!
12:37:14<Wraithan>povman: that is an option, going to play with this a bit, the type information might be useful later so I shouldn't write it off completely
12:49:31<paper_cc>ACTION reads sources for cabal-install
12:49:59<paper_cc>... what can (configConfigurationFlags configFlags') mean?..
12:54:03<ivanm>anyone here use kuribas' indentation mode?
12:54:19<ivanm>paper_cc: it could mean absolutely nothing... >_>
12:56:43<ivanm>@tell quicksilver after playing with kuribas' indentation mode, I recall using it once and discarding it because I keep expecting tab to indent no matter where in the line I am (and backspace doesn't unindent the same amount as tab indents either) :s
12:56:47<lambdabot>Consider it noted.
13:05:28<olsner>btw, I hacked Data.Binary.Get into a monad transformer for a project of mine, but I'd like to know if using GetT Identity rather than Get affects performance (which is apparently a big thing about the binary package) ... how would I test that?
13:06:15<olsner>or maybe I should just send a patch to whomever built it and let them worry about making it fast again :)
13:10:43<paper_cc>@seen dcoutts
13:10:44<lambdabot>dcoutts is in #darcs, #gentoo-haskell, #ghc, #haskell, #haskell-in-depth, #haskell-overflow and #haskell-soc. I last heard dcoutts speak 31m 55s ago.
13:10:56<Igloo>...but it doesn't help, because then I need to find out what depends on funsat
13:10:58<Igloo>Oops
13:11:16<ivanm>lol
13:21:08<walter_>>
13:21:23<walter_>> Just "a"
13:21:25<lambdabot> Just "a"
13:21:39<walter_>>2
13:22:03<walter_>what on earth doesn "Just" mean?
13:22:13<leimy>Wow...
13:22:26<leimy>I can immediately see how I'm going to want a Haskell Google Wave binding :-)
13:23:27<kpreid>walter_: Just one string...
13:23:36<kpreid>@type Just
13:23:38<lambdabot>forall a. a -> Maybe a
13:23:56<kpreid>you can think of Maybe as being sort of like a list that has at most one element
13:24:09<ivanm>a better question: what does "Just" mean _off_ Earth?
13:24:10<kpreid>> listToMaybe []
13:24:10<ivanm>:p
13:24:11<lambdabot> Nothing
13:24:14<kpreid>> listToMaybe [1]
13:24:15<lambdabot> Just 1
13:24:23<ivanm>@djinn [a] -> Maybe a
13:24:25<lambdabot>Error: Undefined type []
13:24:32<ivanm>dammit, that's right, @djinn doesn't know lists
13:24:40<kpreid>ivanm: djinn doesn't do lists, because it doesn't do recursion
13:24:48<ivanm>yeah, I know, I know, I know...
13:24:51<leimy>, :t flip id
13:24:52<lunabot> luna: Couldn't match expected type `((a1 -> b -> c) -> b -> a1 -> c)
13:24:56<leimy>hmmm?
13:25:00<ivanm>@type flip id
13:25:02<lambdabot>forall b c. b -> (b -> c) -> c
13:25:04<leimy>:t flip id
13:25:05<lambdabot>forall b c. b -> (b -> c) -> c
13:25:08<AllNight^>hello all :)
13:25:23<ivanm>ACTION does a vague wave-like motion with his hand
13:25:30<walter_>then why Prelude return Just "a" with Just a, but not a
13:25:38<ivanm>walter_: hmmm?
13:25:51<ivanm>the Prelude is a _library_, it doesn't return _anything_! ;-)
13:25:58<ivanm>> Just "a"
13:26:00<lambdabot> Just "a"
13:26:02<ivanm>@type Just "a"
13:26:04<lambdabot>Maybe [Char]
13:26:08<AllNight^>does anyone here know about calling lisp code from haskell / haskell code from lisp?
13:26:11<ivanm>where [Char] == String
13:26:26<ivanm>AllNight^: don't recall hearing anything like that
13:26:31<ivanm>though there is liskell, etc.
13:26:33<walter_>Why dont return 2 with Int 2
13:26:49<ivanm>walter_: ummmm... return returns a Monad
13:26:52<ivanm>Int isn't a Monad
13:26:58<AllNight^>I've seen liskell ivanm - and a couple of 'write a lisp in Haskell' tutorials
13:27:00<ivanm>Maybe is a Monad
13:27:08<walter_>so Just is a Monad?
13:27:09<Petrosian>H'okey
13:27:15<ivanm>walter_: no, Maybe is a Monad
13:27:16<AllNight^>I guess it could be done using the FFI
13:27:19<ivanm>Just is a constructor for Maybe
13:27:22<ivanm>@src Maybe
13:27:23<lambdabot>data Maybe a = Nothing | Just a
13:27:25<walter_>I see
13:27:27<AllNight^>but I was hoping for something a little more elegant :)
13:27:36<ivanm>@src Maybe return
13:27:37<lambdabot>return = Just
13:27:41<ivanm>walter_: ^^
13:27:50<ivanm>@src [a] return
13:27:51<lambdabot>Source not found. Do you think like you type?
13:27:53<walter_>ivanm, thank you
13:27:54<ivanm>@src [] return
13:27:55<lambdabot>return x = [x]
13:27:57<ivanm>walter_: no worries
13:31:00<Gracenotes>:O
13:31:42<ivanm>Gracenotes: what?
13:31:58<Gracenotes>twist in a TV episode I'm watching
13:32:43<ivanm>well, are you going to share the TV episode with us?
13:34:45<Gracenotes>:. I think I'm fine.
14:36:39<ManateeLazyCat>ACTION pasted "my code" at http://paste2.org/get/232971
14:36:40<ManateeLazyCat>In above code, have function `pageClone`, i need use `case ... of` with `PageType`: i need write "Type -> Fucntion (x :: Type)" for different Type, so have a better programming style to fix those problem, those code is ugly. Thanks
14:39:24<ManateeLazyCat>I wonder have a better way to avoid use "case type of A -> F (x :: A); B -> F (x :: B); C -> F (x :: C)", it can apply Type automatically?
14:41:50<aavogt>@type asTypeOf
14:41:52<lambdabot>forall a. a -> a -> a
14:42:49<aavogt>so maybe f $ x `asTypeOf` type
14:43:11<aavogt>ManateeLazyCat: applying the same function, right?
14:43:25<aavogt>@src asTypeOf
14:43:25<lambdabot>asTypeOf = const
14:43:26<ManateeLazyCat>Now my problem is i use `Dynamic` contain `pageBuffer`, but i need transform `Dynamic` to practicality Type, and this programming style is troublesome
14:43:53<ManateeLazyCat>aavogt: I try it, thanks.
14:44:43<aavogt>I'm not too familiar with Dynamic, but it does have functions for (safely) coercing Dynamics
14:45:36<ManateeLazyCat>aavogt: Some haskeller suggestion me use GADTs instead Dynamic, but i don't know how to write right code for my situation.
14:46:06<ManateeLazyCat>aavogt: But i will try to use `asTypeOf` first...
14:50:53<dcoutts>paper_cc: pong
14:53:36<ManateeLazyCat>dcoutts: I have question about gtk2hs, if i have SourceView is a child widget of VPaned, i want VPaned get keyPress action when i type character in SourceView, how do it? Thanks!
14:53:42<paper_cc>dcoutts: I was just wondering around cabal code and thought that implementing "cabal uninstall" would require cabal-install to store configured versions of packages. But now the whole idea seems a lot more problematic :(
14:53:57<ManateeLazyCat>keyPress event
14:54:25<dcoutts>ManateeLazyCat: I'm not sure you can if the SourceView has the focus
14:54:38<dcoutts>ManateeLazyCat: except perhaps by preventing the SourceView from getting the focus
14:55:00<ManateeLazyCat>dcoutts: Yep, SourceView has the focus
14:55:02<dcoutts>ManateeLazyCat: or you could forward the event from the source view perhaps
14:55:56<ManateeLazyCat>dcoutts: Have a way make Container can get keyPress event when i focus on it's child widget?
14:56:00<dcoutts>paper_cc: what you'd need for starters is some way of storing the list of installed files
14:56:35<dcoutts>paper_cc: then a way to get that list during install, and finally of course to use the list to uninstall
14:56:47<paper_cc>dcoutts: the initial idea was that uninstall is analogous to install and copy
14:57:05<dcoutts>paper_cc: from the ui pov you mean?
14:57:57<dcoutts>ManateeLazyCat: I think only by getting the event in the child and then sending it somewhere else. I don't think there's any chain where parent widgets can intercept key press events
14:58:27<dcoutts>paper_cc: to get the list, yes you'd copy to a temp dir, make the list and then copy to the final location. So it involves an extra copy.
14:58:42<paper_cc>dcoutts: (about the POV) no. the three commands manipulate the installed files (install and copy against uninstall)
14:59:08<dcoutts>paper_cc: I don't understand. we've already got copy and install commands
15:00:28<ManateeLazyCat>dcoutts: If i use EventBox wrap VPand, EventBox still can't intercept key press event before child widget?
15:01:22<dcoutts>ManateeLazyCat: check the docs for event box, but I'd guess not. The event box is for widgets that do not normally receive events, like labels etc. SourceView is not like that
15:01:37<mathijs>Hi all, some time ago I got 2 nice practice-programming links from here, 1 was project euler but I forgot the other one. does anyone of other sites like these?
15:02:36<paper_cc>dcoutts: maybe I am thinking a layer down: make Distribution.Simple implement uninstall analogously to install and copy. It already knows the list of files involved, so no extra copies
15:03:31<dcoutts>paper_cc: you mean you'd need to be in the original source dir to be able to uninstall something?
15:03:47<dcoutts>paper_cc: you're not thinking of storing a list of the files that were installed?
15:04:02<dcoutts>paper_cc: like make uninstall?
15:04:08<dcoutts>if so I think that's not a good design
15:04:18<paper_cc>dcoutts: yes, I'm thinking of letting the original cabal script perform the uninstall
15:04:23<ManateeLazyCat>dcoutts: `Window` is root window of my GUI application, it's TOP parent container, why it can intercept key press event when SourceView is child widget?
15:04:26<dcoutts>paper_cc: it's harder to use and likely to be very fragile
15:04:48<dcoutts>paper_cc: any change to the package will mean that the installed version is out of sync and then you cannot uninstall it correctly
15:05:14<ManateeLazyCat>dcoutts: I use "window `onKeyPress` (\_ -> print $ show "test")", it can intercept key press event.
15:06:04<dcoutts>ManateeLazyCat: but when you do the same for another container it doesn't?
15:06:23<ManateeLazyCat>dcoutts: Yep.
15:06:44<ManateeLazyCat>dcoutts: window `onKeyPress` can work, but panedExample `onKeyPress` can't work.
15:06:59<paper_cc>dcoutts: is it guaranteed (for any builder) that runhaskell Setup install <=> mkdir temp; runhaskell Setup copy --destdir=temp; cp -R temp/* /; rm -R temp?
15:07:00<dcoutts>ManateeLazyCat: did you try the event box?
15:07:01<ManateeLazyCat>panedExample is child widget of `window`
15:07:19<paper_cc>dccouts: (that is, that install can only create and register things)
15:07:46<dcoutts>paper_cc: runhaskell Setup can do whatever it likes
15:08:04<dcoutts>paper_cc: in general, it's a custom script written by the package author
15:08:11<ManateeLazyCat>dcoutts: No.
15:08:13<dcoutts>paper_cc: typically it calls into the Cabal lib of course
15:08:20<ManateeLazyCat>dcoutts: I just test VPaned or HPaned.
15:08:35<dcoutts>ManateeLazyCat: did you try the event box?
15:08:47<ManateeLazyCat>dcoutts: No, i have try event box.
15:08:52<ManateeLazyCat>haven't
15:09:04<ManateeLazyCat>i haven't try event box
15:09:21<dcoutts>ManateeLazyCat: because I don't think the panned widgets get events, I expect they're "windowless"
15:10:09<paper_cc>dcoutts: but there should be some explanation of what 'runhaskell Setup copy' should do in a sensible package (that is, make a "patch" for the root filesystem)
15:10:28<ManateeLazyCat>dcoutts: So use eventBox wrap Paned is a solution?
15:10:53<dcoutts>ManateeLazyCat: does it work?
15:11:07<dcoutts>paper_cc: in a sensible package copy will only copy, nothing else
15:11:28<ManateeLazyCat>dcoutts: Thanks for your help, i try to use eventBox wrap Paned, then test again. :)
15:11:32<dcoutts>paper_cc: install will typically copy and register, but sometimes also other post-install actions
15:11:52<dcoutts>paper_cc: usually not because such post-install actions cannot be done for distro packages
15:12:19<dcoutts>paper_cc: uninstall should be a feature of the cabal-install program, not the Cabal library
15:12:33<dcoutts>the Cabal lib can help with collecting the list of things to be installed though
15:12:48<dcoutts>which can avoid an extra copy in the case of a packages that use build-type: Simple
15:13:05<paper_cc>dcoutts: post-install actions should be somehow reverted, and how can they be reverted if one knows nothing about them?
15:13:39<paper_cc>dcoutts: (or just assume that install = copy + register and so uninstall = rm + unregister?)
15:14:06<dcoutts>paper_cc: yep, we cannot know about other actions
15:14:43<dcoutts>paper_cc: for custom Setup.hs we would use copy anyway, not install
15:15:05<wy_>uhh... I forgot to log myself out on my office machine. Is there a command to kick that login out?
15:15:53<Twey>wy_: /msg nickserv ghost <username> <password>
15:17:19<wy>thanks a lot!
15:31:25<Absolute0>Is there an elegant way of getting a number n closer to 0 by 1 unit without checking if its negative in an if else expression?
15:33:08<Lemmih>max 0 (n-1)?
15:33:30<Absolute0>1 unit closer..
15:33:54<Absolute0>max 0 (any negative) -> 0
15:34:20<Absolute0>i guess guards will work..
15:34:35<Shurique>n - signum n?
15:34:40<jaredj>^
15:34:53<Twey>What do you want to happen if n = 0.5 and you subtract 1?
15:35:14<Absolute0>Twey: no floating point numbers
15:35:35<Twey>So the only case in which anything special would happen is where n = 0
15:36:07<Twey>So you can just do foo n = 0 `max` n - 1
15:36:15<Absolute0>I basically have 2 points and a distance and I want to iterate over all the points from point a to point b
15:36:24<Absolute0>just to fucking lazy to write if else
15:36:31<Absolute0>i am sort thinking about performance..
15:36:33<byorgey>Absolute0: does Shurique's solution above work?
15:37:05<byorgey>> 5 - signum 5
15:37:06<lambdabot> 4
15:37:07<Absolute0>yeah signum works..
15:37:12<byorgey>> (-5) - signum (-5)
15:37:14<lambdabot> -4
15:38:07<Absolute0>let subOne x = x - signum x
15:42:17<roconnor>> subOne 0
15:42:18<lambdabot> Not in scope: `subOne'
15:42:25<Absolute0>:-P
15:42:31<roconnor>> (0) - signum (0)
15:42:32<lambdabot> 0
15:42:49<Absolute0>> x = 5
15:42:50<lambdabot> <no location info>: parse error on input `='
15:42:54<Absolute0>> let x = 5
15:42:55<lambdabot> not an expression: `let x = 5'
15:43:01<jaredj>data Foo = Foo { fields i like } what's that thing called again?
15:43:10<Absolute0>record syntax
15:43:10<roconnor>@let subOne x = x - signum x
15:43:11<lambdabot> Defined.
15:43:12<jaredj>thx
15:43:18<roconnor>> subOne 0
15:43:20<lambdabot> 0
15:43:21<Absolute0>@ let x = 5
15:43:29<Absolute0>@let x = 5
15:43:30<lambdabot> Defined.
15:43:32<Absolute0>> x
15:43:34<lambdabot> Ambiguous occurrence `x'
15:43:34<lambdabot> It could refer to either `L.x', defined at <local...
15:43:42<Axman6>don't redefine x :(
15:43:58<Absolute0>sweet lambdabot keeps sessions
15:44:20<jaredj>good grief. "haskell record syntax" -> seven pages arguing about it, THEN lyah
15:44:31<EvilTerran>not for very long
15:44:46<EvilTerran>all @lets disappear if someone does an @undef
15:44:47<Absolute0>jaredj: i read somewhere that it might be removed in future versions of haskell
15:44:50<EvilTerran>jaredj, yeah, it's not very popular
15:45:20<Absolute0>EvilTerran: are function definitions for each field the preferred method?
15:45:29<Heffalump>improved rather than removed, I hope
15:45:38<Heffalump>the two big flaws are the name clashes and the non-extensibility
15:45:46<Heffalump>and perhaps the non-first-class-ness
15:46:01<jaredj>but how will you parse things into data structures?
15:46:01<Heffalump>Some kind of record syntax is essential.
15:46:10<Absolute0>so i should define getters like in Java? :-P
15:46:18<Heffalump>well, not essential as you can always use tuples, but very useful
15:46:37<EvilTerran>Absolute0, seeing as the record syntax is part of the language, there's no point not using it where it's appropriate
15:46:50<EvilTerran>Absolute0, it's just a lot of hot air is expended wrt making it better
15:47:02<jaredj>yeh it's in haskell 98 right?
15:47:22<Heffalump>yes, and there are no serious or active proposals to remove it
15:47:34<jaredj>well - you can't remove it from haskell 98 if it's there
15:47:39<jaredj>just haskell'
15:47:51<Twey>The H98 record system is Just Fine®.
15:48:03<Twey>Leave it alone and stop picking on the poor thing.
15:48:03<Absolute0>do you need to have a phd to make proposals for haskell 98 improvements? :)
15:48:19<EvilTerran>Just Fine :: Maybe CouldBeBetter
15:48:45<Twey>I don't think it can, at least without damaging its beautiful simplicity.
15:49:15<Twey>There have been all sorts of daft proposals to make it do automatic namespacing of getters and so on
15:49:37<Twey>That's what we have modules for. Try them. They are eager to please.
15:49:54<Heffalump>modules are a real pain because of the one module per file thing
15:49:55<Twey>One thing I would like is the ability to have multiple modules in a single file.
15:49:58<Twey>Yeah.
15:50:08<Heffalump>I'd think it'd be quite easy to implement, too.
15:50:16<Twey>With hierarchical records, yeah.
15:50:19<Heffalump>Now that we have hierarchical modules, just allow defining Foo.Bar in Foo.hs
15:50:25<Twey>ACTION nods.
15:50:27<Twey>Er, modules**
15:50:35<Absolute0>Doesn't one module per file promote good coding style?
15:50:41<Twey>Absolute0: No
15:50:49<Absolute0>why not?
15:50:54<Twey>I mean, it does in one sense
15:51:03<Twey>Big modules should have a file to themselves
15:51:13<Absolute0>people will end up having everything in the same file
15:51:19<Absolute0>leading to 1000 line files
15:51:21<Twey>But sometimes you want a collection of small namespaces
15:51:36<Twey>Personally I would rather have the option
15:51:42<Heffalump>or an Internal module and an exported API
15:51:46<Twey>Bad code is bad code. You can't stop people writing it.
15:52:00<Twey>Heffalump: That's a nice idea
15:52:20<Heffalump>it's the main reason I want it, so I can refactor modules without moving most of the contents into a new file
15:53:06<Twey>Absolute0: Actually, no, it doesn't promote good coding style at all anyway.
15:53:16<true\\false>Absolute0: Proof of fact?
15:53:21<Twey>There's nothing to stop people putting everything in one file.
15:53:25<Twey>In one module, even.
15:53:40<Absolute0>well it at least guides them not to do so :)
15:53:42<true\\false>C#, Java, oh so many languages allow multiple files per equiv of module, and they rarely lump all in one
15:53:43<Absolute0>damn morons
15:54:04<Twey>Morons are screwed anyway
15:54:17<Twey>Give them guiderails if you like, but don't take away power from the rest of us to suit them
15:54:20<true\\false>So are Mormons.
15:54:32<jaredj>not trusting your users will only get you so far
15:54:50<Absolute0>jaredj: that what steve jobs does..
15:55:02<jaredj>i don't buy his stuff
15:55:10<Absolute0>neither do i
15:55:30<Absolute0>but he does have a huge market share
15:55:42<jaredj>i take your point, and my aphorism lives partly in the real world and partly in the world that should be
15:56:44<Apocalisp>Mormonads
15:56:49<Absolute0>=)
15:57:11<Absolute0>for someone interested in haskell is ocaml worth learning?
15:57:45<Twey>I don't think they have anything over us
15:57:45<Absolute0>theres this place in nyc janestreet.com, they use ocaml
15:57:53<Apocalisp>Absolute0: You'll find the syntax infuriating :)
15:58:05<Philippa>Heffalump: a multiple-module-per-file thing without nesting ought to be trivial to define syntax for, too
15:58:08<Absolute0>thinking i can't get a job in haskell
15:58:11<Absolute0>maybe i can in ocaml
15:58:15<Philippa>what I don't know is how much change to GHC would be required
15:58:18<Twey>Just strictness and impurity
15:58:32<Heffalump>the existing syntax is fine
15:58:44<Heffalump>Absolute0: there's a couple of places in NYC that use Haskell
15:58:59<shapr>whee
15:59:03<Heffalump>at least two, that is, though one of those definitely isn't hiring now and the other probably isn't
15:59:03<Absolute0>Heffalump: which job boards do you look at?
15:59:34<Heffalump>Absolute0: I don't, since I'm happily employed. I know of them because I work for the first (in London) and have spoken to people at the second.
15:59:36<Philippa>Heffalump: technically isn't there no syntax for multiple modules in one file? Or did I just not pay enough attention to the report?
16:00:13<Heffalump>module Foo where ... is only a special kind of where in the sense that there is no indentation required for the ...
16:00:16<Absolute0>Heffalump: care to give the names?
16:00:23<Heffalump>Absolute0: Credit Suisse, Deutsche Bank
16:00:29<Absolute0>thanks
16:00:39<Heffalump>Philippa: so I don't see any bar to parsing module Foo where ... module Foo.Bar where ... correctly
16:00:43<Philippa>sure, and that's a layout thing. But I didn't think there was a grammar construct for a sequence of module decls
16:00:51<Heffalump>surely that's implicit?
16:00:56<Heffalump>there's no grammar construct for a filesystem either
16:01:14<jaredj>aagh, i can't easily name my record field id
16:01:18<Philippa>it's not so much implicit as left for external definition
16:01:28<Philippa>I mean yeah, we pretty much know what we want, sure
16:01:30<jaredj>Heffalump: no indentation required??
16:01:32<Heffalump>that's another way of looking at it :-)
16:01:37<jaredj>doh
16:01:50<Philippa>jaredj: yeah, you don't have to indent /everything inside a module/ thankfully
16:01:52<Heffalump>IM no indentation required by dint of being a subclause of the module...
16:05:45<jaredj>argh. Text.HTML.TagSoup.Parsec is full of parsers matching open tags and close tags
16:05:55<jaredj>but how do you parse the TextTags in between?
16:06:36<jaredj>can't find in docs, and the type system gets angry when i mix TagParsers and generic ones from Text.Parsec.Combinator
16:08:15<Philippa>yeah, it's a Parsec implementation of TagSoup rather than TagSoup-for-Parsec, isn't it?
16:09:19<jaredj>no, the latter
16:09:39<jaredj>i.e. you take the output from parseTags and feed it into your TagSoup.Parsec parser as the tokens
16:10:18<jaredj>as such, i expected to be able to use the Text.Parsec.Combinator parsers
16:10:33<jaredj>maybe i haven't dug deep enough
16:13:47<jaredj>expected ParsecT s u m t; inferred Text.ParserCombinators.Parsec.Prim.GenParser Tag () t
16:14:04<jaredj>GenParser tok st = Parsec [tok] st
16:14:06<EvilTerran>jaredj, ahh, ParsecT is parsec 3, GenParser is parsec 2
16:14:21<jaredj>that explains things...
16:14:50<jaredj>tagsoup-parsec Dependencies: base, parsec (<3), tagsoup
16:16:07<jaredj>so if i import things from Text.ParserCombinators.Parsec.[...] instead of Text.Parsec
16:32:13<azdtt>hi, is there any easy way to print a Floating number without using scientific notation, just with all the decimals or rounding/truncating the number?
16:32:58<uzytkownik>I have a function returning const char *. How should I do marshalling to not free the result?
16:34:37<sbahra>azdtt, you could use printf, see "f" specifier.
16:34:47<sbahra>azdtt, Text.Printf
16:34:57<sbahra>> printf "%f" 0.0001
16:34:58<lambdabot> Add a type signature
16:35:03<sbahra>> printf "%f" 0.0001 :: String
16:35:05<lambdabot> "0.0001"
16:35:12<sbahra>> show 0.0001
16:35:13<lambdabot> "1.0e-4"
16:35:37<azdtt>ok thanks
16:40:43<mux>azdtt: or use showFFloat
16:40:59<sbahra>:t showFFloat
16:41:00<lambdabot>forall a. (RealFloat a) => Maybe Int -> a -> String -> String
16:41:04<mux>> showFFloat Nothing 0.12345
16:41:06<lambdabot> Overlapping instances for GHC.Show.Show
16:41:06<lambdabot> (GHC.B...
16:41:15<mux>> showFFloat Nothing 0.12345 ""
16:41:17<lambdabot> "0.12345"
16:41:24<mux>> showFFloat (Just 2) 0.12345 ""
16:41:26<lambdabot> "0.12"
16:41:29<sbahra>> show FFloat Nothing 0.1234 "crap"
16:41:30<lambdabot> Not in scope: data constructor `FFloat'
16:41:35<sbahra>> showFFloat Nothing 0.1234 "crap"
16:41:37<lambdabot> "0.1234crap"
16:41:42<azdtt>in which module is showFFloat?
16:41:49<sbahra>@hoogle showFFloat
16:41:50<lambdabot>Numeric showFFloat :: RealFloat a => Maybe Int -> a -> ShowS
16:41:55<sbahra>printf seems nicer.
16:41:57<mux>@index showFFloat
16:41:58<lambdabot>Numeric
16:42:05<mux>printf is nicer but printf is unsafe
16:42:11<Badger>@src signum
16:42:11<lambdabot>Source not found. Have you considered trying to match wits with a rutabaga?
16:42:28<sbahra>Fair enough. :-)
16:42:36<mux>uzytkownik: usually with peekCString
16:43:36<azdtt>is it possible to map printf to a list of Floating?
16:43:41<uzytkownik>mux: Thanks. It's documentation did not stated anything about freeing.
16:44:02<mux>uzytkownik: what do you mean exactly about that freeing stuff?
16:44:16<mux>if the function returns a malloc()'ed string and you peekCString it, you still need to free it
16:44:38<sbahra>azdtt, why not?
16:44:45<sbahra>> map (printf "%f") [0.001, 0.002] :: [String]
16:44:47<lambdabot> ["0.001","0.002"]
16:45:22<aavogt>@type printf
16:45:23<lambdabot>forall r. (PrintfType r) => String -> r
16:45:24<uzytkownik>mux: I mean that I cannot free it (unless I love core dumps). And documentation does not state if it dispose the argument or not.
16:45:40<azdtt>thanks sbahra , without the signature it failed
16:45:57<mux>uzytkownik: how would C code deal with that string?
16:46:13<uzytkownik>mux: It does not deal. It returns it
16:46:18<aavogt>> printf "%f" 1e10 :: IO ()
16:46:20<lambdabot> <IO ()>
16:46:38<mux>uzytkownik: I'm asking you how would C code using that function would deal with it, so that I can give you advice on how to deal with it in haskell
16:49:48<uzytkownik>mux: Sorry. I don't understend. I have a function in C - lets call it "const char *give_me_a_string(...)". In Haskell I want to use it importing it with type :: ... -> CString. I wanted to convert to String knowing that I cannot free it (it is used and managed by C code). As the documentation (at least ghc's) did not stated anything about freeing I prefered to ask then have segfaults (or worst undefined behaviours).
16:50:53<mux>uzytkownik: ok, so the memory management of the string is dealt with by the C code and you don't need to do anything about it, so you can just peekCString it
16:51:05<mux>but the type of your function will be ... -> IO String
16:53:23<eivuokko>You can import functions as pure, as well. Although in this case it hardly matters as peeking is in IO.
16:54:10<eivuokko>In fact, I wouldn't be suprised if his function is as pure as you get, since it returns CString that doesn't need lifetime-control.
16:54:21<SamB>eivuokko: which is why unsafePerformIO is in the FFI library ...
17:00:11<mpwd>Hey haskell
17:00:37<byorgey>hi mpwd
17:00:44<mpwd>So in about a week, we're getting ready to teach a class on functional programming here in Hanoi
17:00:55<mpwd>(as part of Thomas Hales flyspeck project)
17:01:12<Heffalump>time for some programs with discs and towers, then?
17:01:20<Heffalump></obvious-joke>
17:01:25<mpwd>And I was wondering if any of you have some good ideas for intro functional programming problems?
17:02:03<mpwd>(we should probably do that one... I'd feel silly presenting it though)
17:07:41<monochrom>The other day I was attending a talk, I got bored, and I took out three coins and played.
17:07:56<defun>Just curious, how do FRP frameworks like Yampa, etc. keep track of time? Is it via I/O?
17:08:50<davidL>how can I go from a list of functions [f,g,h] to f . g . h ?
17:08:51<Cale>defun: At present, that's perhaps ultimately true, but they provide a more abstract interface to the current time.
17:08:58<Cale>davidL: foldr (.) id
17:09:07<defun>I see.
17:09:21<davidL>hmm, foldr1 wasn't doing it
17:09:23<davidL>thanks
17:09:33<thoughtpolice>ACTION attempts to build valgrind for Mac OS X
17:09:41<Cale>davidL: If there's a possibility that the list is empty, you should never use foldr1
17:10:00<davidL>right, thanks
17:11:44<Cale>defun: They might also provide access to something like the current frame number, which would just be a counter, and not involve doing any actual I/O of course :)
17:14:02<conal>defun: i could probably answer, but i'm unclear on what you mean by "keep track of time".
17:15:13<conal>defun: semantically, frp keeps track of time in the same way any function keeps track of its argument.
17:16:39<conal>defun: implementations usually do the same (time is a function argument)
17:18:16<conal>since frp semantics is simple, precise & deterministic, it can't depend on IO
17:23:08<saml>i can help your problem
17:23:53<byorgey>saml: ?
17:24:25<eivuokko>My problems don't need help, they are big enough already.
17:25:04<saml>that was a random greeting
17:25:28<aavogt>conal: so how is the internal use of System.IO.Unsafe stuff not leak out?
17:26:46<conal>aavogt: not sure i understand what you're asking. are you asking how i keep unsafePerformIO from compromising functional semantics?
17:32:41<conal>defun: did i address your frp question?
17:34:03<aavogt>conal: yeah, though it seems mostly used for racing threads where it doesn't matter which one wins
17:34:29<aavogt>right?
17:34:46<conal>aavogt: right. oh. i guess you're asking about unamb.
17:35:22<conal>aavogt: that was a key aha! for me. my puzzle was how to get deterministic semantics out of a nondeterministic thread scheduler.
17:36:00<conal>i noodled over that problem for quite a while before the idea of unamb hit me, along with its use in reactive.
17:36:33<conal>doodled, paced, and talked to myself for several days.
17:37:24<thoughtpolice>conal: cool to see reactive development going smooth again!
17:37:36<thoughtpolice>ACTION needs to get lazysmallcheck working with GHC HEAD so he can install reactive-0.11
17:38:27<conal>thoughtpolice: :) "going smooth" might be an overstatement. i'm still wondering what can be a sustainable model for getting reactive and some other libs into solid shape.
17:40:14<cayennext>Currently I am trying to implement a functional language interpreter in Haskell. I have choosen Dialogs as IO implementing method. It's based on two lists - list of requests (read,write) and list of responses. Having list of requests I am trying to build the second list, but it involves IO, so type is IO (). How can I write a function that returns both IO and list?
17:41:56<saml>IO [a] ?
17:41:59<Twey>cayennext: Return an IO [Response]
17:42:21<Absolute0>Is there a way to express a pattern where 2 parameters are equal? let foo x x = ... fails
17:42:34<tromp>nope
17:42:39<Twey>Absolute0: let foo x y | x == y = ...
17:42:42<saml>let foo x y | x == y
17:42:43<tromp>need guard or test
17:42:51<cayennext>and how to get this argument from IO [Response]?
17:42:52<Absolute0>quards are ugly
17:43:07<saml>cayennext, arg <- command
17:43:09<Absolute0>saml: shouldn't you be coding?
17:43:16<conal>anyone know why these non-linear patterns tend not to be supported in functional languages?
17:43:28<cayennext>thank you, I'll try it.
17:43:38<saml>just finished one module Absolute0
17:43:58<Cale>Well... it is possible to make a mistake where you accidentally reuse a variable name in a pattern
17:44:34<Absolute0>ACTION dreams of a language with no condition checking
17:44:51<Cale>and then it's possible that it's even the same type, and in Eq, and so the problem isn't caught until runtime when you get a pattern match failure because your cases are incomplete :)
17:45:00<thoughtpolice>guards are useful IMO
17:45:04<thoughtpolice>view patterns are nice as well
17:45:10<Cale>But otherwise, it's quite doable.
17:45:10<thoughtpolice>although it's really annoying GHC throws warnings for it
17:45:12<Absolute0>but patterns rule
17:45:31<Cale>Guards are part of patterns, more or less...
17:45:46<Absolute0>i mean foo 0 1 =
17:45:48<Cale>Every place where a pattern is allowed, guards are too.
17:46:08<Cale>thoughtpolice: Yeah, also the syntax is broken.
17:46:23<eivuokko>Except lambda and do notation?
17:46:28<Absolute0>Cale: isn't that in only function headers?
17:46:36<thoughtpolice>Cale: SPJ says it gives a shift/reduce in the parser for a change (or something,) but it shouldn't require really deep knowledge
17:46:47<Absolute0>_ == _ is an illegal expression
17:46:59<thoughtpolice>Cale: they're useful, though
17:47:00<monochrom>> (\ x | x>0 -> x) 2
17:47:02<lambdabot> <no location info>: parse error on input `|'
17:47:08<Cale>hmm, I suppose that's true.
17:47:13<thoughtpolice>Cale: on that note, I like all the new record features (puns, disambiguation etc.)
17:47:42<Absolute0>condition checking is error prone
17:47:42<Cale>thoughtpolice: Yes, it was about time they brought record punning back.
17:47:49<monochrom>> do { x | x>0 <- [2,0-1]; return x }
17:47:50<thoughtpolice>'back'?
17:47:51<lambdabot> <no location info>: parse error on input `|'
17:47:59<Cale>thoughtpolice: Yeah, it went away at some point.
17:48:00<monochrom>Interesting
17:48:23<aavogt>should record puns really trigger warnings for shadowed names?
17:48:45<Cale>aavogt: I would say no, but they do shadow names.
17:48:59<Philippa><conal> anyone know why these non-linear patterns tend not to be supported in functional languages? <- they're potentially misleading? Also, they're not available on as wide a range of types because they desugar into == guards
17:48:59<Cale>(in particular, they shadow the field extractors)
17:49:21<Cale>Compiling with -Wall is irritating. A lot of the warnings are stupid.
17:50:08<aavogt>I guess those selectors could be fully qualified if you need the original ones when they are shadowed
17:51:07<conal>Cale, Philippa: could be. i wonder if there were other reasons.
17:51:12<Cale>Philippa: Those are reasonable reasons, though we do have n-patterns which are fairly uncontroversial and similar in terms of requiring Num and Eq. The best reason I found when examining it in the past was that if you reuse a variable by accident it's harder to catch.
17:51:12<Baughn>Cale: It also leads to my using hungarian notation to avoid shadowing
17:51:32<Philippa>conal: well, the sugar's a pain in the arse to write :-)
17:51:34<thoughtpolice>Cale: but yeah, the view pattern warnings are *really* annoying; there's a flag to turn it off, -fno-warn-overlapping-patterns iirc
17:51:35<Baughn>..though that /has/ caught several possible errors. SHadowing /is/ a bad idea
17:51:46<Philippa>but you could always ask someone from the committee of old why that choice in Haskell?
17:53:04<thoughtpolice>Cale: yeah, we compile lhc with -Wall and a lot of patterns are really annoying
17:53:14<thoughtpolice>s/patterns/warnings/
17:53:50<Absolute0>-Wall just helped me clean up my code :)
17:53:53<thoughtpolice>most are fixable, except the functions generated by template haskell
17:54:02<thoughtpolice>which warns about no type signatures
17:55:42<monochrom>The most important utility of shadowing is in exams to trick students.
17:55:47<aavogt>Cale: I'd expect that confusing the record selectors with the puns would be a type error
17:56:24<Cale>aavogt: yes, typically.
17:59:00<Baughn>@seen nominolo
17:59:01<lambdabot>I saw nominolo leaving #haskell-soc, #yi, #ghc, #haskell-in-depth and #haskell 5h 3m 55s ago, and .
17:59:26<Baughn>@ask nominolo Is Scion going to make it to hackage?
17:59:26<lambdabot>Consider it noted.
18:06:16<eivuokko>Is it silly to stay in (near) Haskell 98-compatible nowdays?
18:08:56<thoughtpolice>i use extensions somewhat liberally, myself
18:09:53<thoughtpolice>not sure i would say staying haskell98 is silly, though
18:10:25<thoughtpolice>eivuokko: also, invariably many packages on hackage use them, which is important to remember
18:10:26<Baughn>eivuokko: Pretty much. You'd have to do without more or less every library on hackage.
18:10:42<Baughn>It's not just the extensions; Haskell'98 lacks the base library too
18:11:20<eivuokko>Yeah, meant on language level, choosing libraries depends how much the interface uses extensions.
18:20:35<aavogt>@hoogle [a] -> Int -> a
18:20:36<lambdabot>Prelude (!!) :: [a] -> Int -> a
18:20:36<lambdabot>Data.List (!!) :: [a] -> Int -> a
18:20:36<lambdabot>Data.List genericIndex :: Integral a => [b] -> a -> b
18:20:41<aavogt>@hoogle [a] -> Int -> Maybe a
18:20:42<lambdabot>Prelude (!!) :: [a] -> Int -> a
18:20:42<lambdabot>Data.List (!!) :: [a] -> Int -> a
18:20:42<lambdabot>Data.List genericIndex :: Integral a => [b] -> a -> b
18:21:26<aavogt>@type \n -> listToMaybe . drop n
18:21:27<lambdabot>forall a. Int -> [a] -> Maybe a
18:22:33<aavogt>is there some alternative, or do I have to make a safe index like that?
18:37:24<rubendv>> let b = sqrt
18:37:25<lambdabot> not an expression: `let b = sqrt'
18:37:40<rubendv>hm well
18:37:50<rubendv>if you type 'let b = sqrt' in ghci
18:37:56<rubendv>and then :t b
18:38:02<rubendv>you get Double -> Double
18:38:10<rubendv>but sqrt is Floating a -> a -> a
18:38:13<rubendv>why is that?
18:38:22<aavogt>rubendv: ghci let bindings are like in do blocks
18:38:51<rubendv>and why does it do that in do blocks?
18:38:55<aavogt>and your second concern is that ghci defaults types
18:39:06<aavogt>> show 4
18:39:07<lambdabot> "4"
18:39:25<rubendv>I see
18:39:54<aavogt>@type 4
18:39:55<lambdabot>forall t. (Num t) => t
18:40:03<aavogt>@type 4.5
18:40:04<lambdabot>forall t. (Fractional t) => t
18:44:00<BMeph>I still think that (!!)'s type is false advertising - if you say "as!!(-1)" it doesn't give you the last element in the list, it just gives an error message. Boo! I say, Boo!
18:45:16<aavogt>BMeph: because "last as" is shorter?
18:46:33<aavogt>> show (4::Rational)
18:46:34<lambdabot> "4 % 1"
18:50:28<BMeph>aavogt: Okay, wiseacre, what's the "sorted" form for "as!!(-3)", huh? Huh?!? ;p
18:50:47<BMeph>Err, *"shorter"
18:51:43<dmwit>not shorter, but more honest: reverse as !! 3
18:51:53<dmwit>... or maybe reverse as !! 2
18:52:18<Baughn>@src reverse
18:52:19<lambdabot>reverse = foldl (flip (:)) []
18:52:30<dmwit>After all, why should it be 0-indexed from the front, but 1-indexed from the back? That seems stupid.
18:53:02<ray>"because other languages do it"
18:53:15<dmwit>heh
18:53:25<aavogt>ACTION is consistently inconsistent?
18:53:49<ray>we need a natural number type anyway
18:54:04<dmwit>Word8
18:54:11<dmwit>> -1 :: Word
18:54:12<lambdabot> 18446744073709551615
18:54:22<dmwit>Not *quite* a natural number type, yes.
18:54:34<dmwit>But it's as much a natural number type as Int is an integer type.
18:54:37<dmwit>:t (!!)
18:54:38<lambdabot>forall a. [a] -> Int -> a
18:54:56<ray>Ints suck too
18:54:57<dmwit>[a] -> Word -> a -- this would be more honest, I agree
18:55:03<aavogt>> (4::Nat)
18:55:04<lambdabot> Not in scope: type constructor or class `Nat'
18:55:09<aavogt>> (4::Natural)
18:55:11<lambdabot> 4
18:55:33<dmwit>> 4 < (fix succ :: Natural) -- the fact that this terminates guarantees inefficiency
18:55:34<lambdabot> True
18:55:55<ray>Integers should be the "default", and Ints should be a freely-chosen concession to performance
18:56:09<dmwit>The default for Integral a is, indeed, Integer.
18:56:18<aavogt>> genericDrop (fix succ :: Natural) [1..]
18:56:23<lambdabot> mueval-core: Prelude.read: no parse
18:56:23<lambdabot> mueval: ExitFailure 1
18:56:27<dmwit>However, it was deemed that Int was big enough for indexing, and therefore you might as well concede performance every time.
18:57:16<aavogt>> maxBound :: Int -- if your lists are longer than this, you have other performance issues
18:57:17<lambdabot> 9223372036854775807
18:57:22<dmwit>exactly
18:57:24<BMeph>What ray said is really my point - we need a Natural type comparable to Integer. And it needs to be if not the default, more of a default for stuff than Int. Int blows. :\
18:57:41<dmwit>ACTION nods
18:57:51<aavogt>> 1 - 3 :: Natural -- what here?
18:57:53<lambdabot> * Exception: Natural: (-)
18:58:07<dmwit>> -3 :: Natural
18:58:08<lambdabot> * Exception: Natural: (-)
18:58:27<dmwit>It's the only reasonable thing to do with negative numbers, I guess.
18:59:03<dmwit>other than have a constructor Infinity :: Natural, which doesn't seem very mathematical. =)
18:59:42<sclv>there's also a case for a type where (1 - 3) = 0
18:59:48<aavogt>efficiency?
18:59:55<BMeph>What do we do when we ask for square roots of negative numbers? Even is what we do sucks to you, a similar thing should happen with subtracting Naturals. IMWO, anyway. :)
19:00:06<sclv>or Maybe Natural...
19:00:17<dmwit>> sqrt (-3)
19:00:18<lambdabot> NaN
19:00:23<rubendv>aavogt: I get a similar thing in a file
19:00:28<rubendv>b = sqrt
19:00:28<BMeph>Er, Even *if
19:00:37<dmwit>BMeph: eww, you want NaN in your Natural? Really?
19:00:38<rubendv>sqrt2f = b 2::Float
19:00:42<rubendv>that loads fine
19:00:52<ray>error is better than NaN
19:00:53<BMeph>dmwit: Similar, not identical. ;p
19:00:58<rubendv>but if you add: sqrt2d = b 2::Double
19:01:01<dmwit>?wiki monomorphism restriction
19:01:01<lambdabot>http://www.haskell.org/haskellwiki/monomorphism_restriction
19:01:06<dmwit>rubendv: Learn it, love it.
19:01:07<rubendv>it gives another error
19:01:17<ray>learn it, hate it
19:01:18<dmwit>The dreaded MR.
19:01:33<rubendv>ah so we meet at last :p
19:01:33<ray>learn it, blog about how haskell should lose it
19:01:34<sclv>> sqrt ((-4) :+ 0)
19:01:35<lambdabot> 0.0 :+ 2.0
19:01:46<fracture>if I have a function that takes a value with a given type constructor in its pattern match, is there any performance penalty to re-wrapping it with a data constructor to give the same value to call another function?
19:01:55<fracture>like foo (Blah asd) = something (Blah asd)
19:02:06<BMeph>dmwit: If anything, it might give incentive to change that NaN answer for negative sq. roots. :)
19:02:09<fracture>as opposed to foo blah@(Blah asd) = something (Blah asd)
19:02:11<dmwit>You can't have type constructors in pattern matches.
19:02:13<fracture>err blah
19:02:21<fracture>blah@(Blah asd) = something blah
19:02:21<dmwit>However, the answer to your question is yes: there is a performance penalty.
19:02:33<fracture>err sorry; guess that's also a data constructor
19:02:35<dmwit>But only for "data", not for "newtype".
19:02:43<fracture>so I should use the @ notation if I wanna avoid that?
19:02:48<byorgey_>this is what really happens when we do sqrt on negative numbers:
19:02:55<byorgey_>> sqrt ((-3) :: Int)
19:02:56<lambdabot> No instance for (GHC.Float.Floating GHC.Types.Int)
19:02:56<lambdabot> arising from a use of...
19:02:58<fracture>(I just don't like having two names for the "same" variable there)
19:03:01<sclv>ghc should really optimize that case...
19:03:05<dmwit>fracture: And there *has* to be a performance penalty: the type for (Blah asd) may not be the same as the type for blah.
19:03:05<byorgey_>the same thing should happen when you use (-) on Natural.
19:03:15<byorgey_>that is, the Num class blows and we need a new one.
19:03:32<dmwit>ACTION sides with byorgey_, as always
19:03:40<fracture>ok
19:03:47<byorgey_>win 3
19:03:56<byorgey_>that... was supposed to be prefixed with a / .
19:04:01<bremner>lose 3
19:04:01<aavogt>fracture: common subexpression elimination (CSE) should catch that one, as sclv suggested
19:04:22<sclv>ACTION doesn't feel like looking at core today, so take the "should" worth a grain of salt.
19:04:40<dmwit>I promise you it hurts performance.
19:04:43<dmwit>I've had to fix it myself.
19:04:54<sclv>i never trust cse to do a damn thing for me in ghc.
19:05:25<sclv>hackphi idea -- a usable replacement for Num that doesn't drag in all the complexities of the numeric prelude or the other big towers of abstractions?
19:05:35<dmwit>Hey, there's an idea.
19:05:50<dmwit>byorgey_: We should invite the Haskell' committee to Hac Phi. =)
19:05:53<sclv>a simple useable subset of kmett's monoid library, maybe (emphasis on simple!)
19:06:17<aavogt>what of the class alias proposal, or something similar?
19:06:21<hatds>reworking Num is better than creating an incompatible typeclass
19:06:35<sclv>reworking Num involves changing the standard.
19:06:43<dmwit>Actually, Edison does something interesting for class aliasing.
19:07:05<sclv>haskell', by the way, is for language changes and extensions. as i recall, the library process is a "step 2".
19:07:09<dmwit>He does something along the lines of "class (Foo a, Bar a) => FooBar a where; instance (Foo a, Bar a) => FooBar a".
19:07:10<ksf>reworking Num's is a good idea.
19:07:25<sclv>speaking of which, whatever happened to the new haskell' proposal presented at last year's icfp?
19:07:46<ksf>...starting with means to combine different monoids to get something confusing.
19:07:51<wli>Feh, can we get some Haskell 2 proposals?
19:08:07<sclv>about making it a more community driven process or somesuch.
19:08:57<aavogt>dmwit: what's the benefit of having to manually declare alias instances?
19:10:08<dmwit>aavogt: hm?
19:11:19<dmwit>aavogt: I don't understand; how would you do class aliases without class alias declarations?
19:11:58<aavogt>dmwit: sorry, I misread what you originally wrote
19:12:53<aavogt>I don't see any shorter way of accomplishing aliases for classes
19:25:02<byorgey_>dmwit: good idea =)
19:25:22<byorgey_>win 4
19:25:33<byorgey_>ok, seriously, there must be something wrong with my / key
19:26:01<thoughtpolice>hm
19:26:12<thoughtpolice>ACTION wonders about the status of class alias work at the last hackathon
19:38:55<int-e>byorgey++ ("The key to understanding monads is that they are Like Burritos.", http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/)
19:39:42<ksf>@quote wadler
19:39:42<lambdabot>wadler says: Curried food and curried functions are both acquired tastes
19:39:44<ksf>@quote wadler
19:39:44<lambdabot>wadler says: The way we can tell it's C# instead of Haskell is because it's nine lines instead of two.
19:39:46<ksf>@quote wadler
19:39:46<lambdabot>wadler says: Curried food and curried functions are both acquired tastes
19:39:48<ksf>@quote wadler
19:39:48<lambdabot>wadler says: The way we can tell it's C# instead of Haskell is because it's nine lines instead of two.
19:39:50<ksf>hmmm.
19:41:47<ksf>@remember wadler A monad is a monoid in the category of endofunctors, what's the problem?
19:41:47<lambdabot>Nice!
19:48:21<int-e>@quote fuzzy
19:48:21<lambdabot>gzl says: <ricebowl> what does >>= do? <basti_> ricebowl: monads are cute pink fuzzy little things. <gzl> with plutonium inside.
19:50:16<fracture>I have a [[Int]], and I want a function that returns [[Int]] containing any elements that contain at least one int that is in no other lists in the list
19:50:19<fracture>(if that makes sense)
19:50:23<fracture>anyone have any ideas on that?
19:50:35<fracture>(it's seeming tough for me thus far)
19:51:29<fracture>so like, theFunc [[1,2,3,4], [2,3,4], [2,3,4,5], [3,4,5]] would return [[1,2,3,4]]
19:52:21<Heffalump>do something with zip (inits xs) (tails xs) I guess
19:52:38<fracture>I just had an idea... maybe I can concat the list and count the occurances of each item
19:54:18<Heffalump>oh, yes, nice
19:54:26<Heffalump>assuming that the input lists don't have any duplicated elements themselves
19:54:49<aavogt>@src nub
19:54:50<lambdabot>nub = nubBy (==)
19:54:56<aavogt>@src nubBy
19:54:56<lambdabot>nubBy eq [] = []
19:54:57<lambdabot>nubBy eq (x:xs) = x : nubBy eq (filter (\ y -> not (eq x y)) xs)
19:56:18<fracture>Heffalump: yeah they won't
19:56:22<fracture>(they're effectively sets)
19:57:03<Heffalump>> map (head &&& length) . sort . concat $ [[1,2,3,4], [2,3,4], [2,3,4,5], [3,4,5]]
19:57:05<lambdabot> No instance for (GHC.Num.Num [a])
19:57:05<lambdabot> arising from the literal `1' at <inter...
19:57:14<Heffalump>> map (head &&& length) . group . sort . concat $ [[1,2,3,4], [2,3,4], [2,3,4,5], [3,4,5]]
19:57:16<lambdabot> [(1,1),(2,3),(3,4),(4,4),(5,2)]
19:58:16<fracture>what's &&& ?
19:58:31<centrinia>:t (&&&)
19:58:32<lambdabot>forall (a :: * -> * -> *) b c c'. (Arrow a) => a b c -> a b c' -> a b (c, c')
19:58:57<aavogt>> (+1) &&& (+2) $ 0
19:58:58<lambdabot> (1,2)
20:01:47<aavogt>> nubBy (\x y -> null $ y \\ x) [[1,2,3,4], [2,3,4], [2,3,4,5], [3,4,5]]
20:01:48<lambdabot> [[1,2,3,4],[2,3,4],[3,4,5]]
20:02:03<aavogt>> nubBy (\x y -> null $ x \\ y) [[1,2,3,4], [2,3,4], [2,3,4,5], [3,4,5]]
20:02:04<lambdabot> [[1,2,3,4],[2,3,4,5]]
20:03:25<centrinia>> nubBy (\x y -> null $ x \\ y) [[1,2,3,4], [2,3,4,5], [3,4,5],[2,3,4]]
20:03:26<lambdabot> [[1,2,3,4],[2,3,4,5]]
20:03:49<aavogt>the nubBy doesn't accumulate the values already seen
20:05:19<matt>I'm trying to apt-get ghc6, and i get version 6.8
20:05:25<matt>instructions on haskell.org say otherwise
20:06:11<aavogt>> foldr (\x xs -> if null $ x \\ concat xs then xs else x:xs) [] [[1,2,3,4], [2,3,4], [2,3,4,5], [3,4,5]]
20:06:13<lambdabot> [[1,2,3,4],[2,3,4,5],[3,4,5]]
20:06:38<aavogt>> foldr (\x xs -> if null $ x \\ concat xs then xs else x:xs) [] $ reverse [[1,2,3,4], [2,3,4], [2,3,4,5], [3,4,5]]
20:06:39<lambdabot> [[2,3,4,5],[1,2,3,4]]
20:06:43<eivuokko>matt, maybe you are in old version of your disribution?
20:07:05<matt>i'm using the latest stable version of debian, it is probably lagging behind though
20:07:21<matt>I'll try to manually install 6.10 i think
20:13:29<mreh>is "tar -xvvf" different from "tar -xvf"?
20:14:00<mike-burns>On BSD it is.
20:14:17<mike-burns>"Additional -v options will provide additional detail." - from the man page
20:14:48<mike-burns>Is this a decent channel to ask about Gtk2hs issues?
20:15:24<mreh>tar -xvvvf?
20:15:26<mreh>hehe
20:15:52<aavogt>mike-burns: ask away
20:16:44<mike-burns>I'm trying to build a GUI app using Glade and Gtk2hs. I made a GnomeApp window, but when I run the program it tells me: GnomeUI-ERROR **: You must call gnome_program_init() before creating a GnomeApp
20:16:52<mike-burns>How do I do that in Gtk2hs? Or am I doing it wrong?
20:17:40<dcoutts>mike-burns: avoid using the gnome widgets in glade, stick to the gtk+ ones
20:18:08<dcoutts>mike-burns: it's no great loss anyway, the gnome ones hardly add anything
20:18:47<mike-burns>dcoutts: Good to know. I'll try again with a window and add the menu, etc, myself.
20:26:27<mreh>hang on, I install 6.10, and I dont have cabal installed
20:26:43<mreh>whut?
20:27:11<dcoutts>mreh: perhaps you're thinking of the Haskell Platform which bundles ghc along with the cabal program and other tools and libs
20:27:19<mreh>scunthorpe
20:27:25<dcoutts>ghc on it's own is just the compiler (and some libs)
20:27:46<mreh>ah, it's alright, i need 6.10 to get yi working anyway
20:27:46<dcoutts>mreh: but you can install the cabal-install package, which provides the 'cabal' program. It's not hard.
20:27:56<mreh>dcoutts: thanks
20:28:02<ray>you should have cabal the library, but not cabal the binary from cabal-install
20:30:07<mreh>do haskell binaries get installed using ghc?
20:30:22<mreh>i'm not experienced enough to know how package managers work
20:31:44<ksf>libraries register themselves with ghc-pkg.
20:31:53<Peaker>Baughn: apparently even the unblock thing was not a bug. But man, this mailing list exchange better be summarized in those comments, heh
20:31:57<ksf>...aside from that, ghc doesn't care.
20:49:38<mike-burns>More on Gtk2hs: I've created a window using Glade and put a menubar in there. I'm trying to connect File -> Quit to `mainQuit' but it's not totally clear how. I looked at the actionMenu example that comes with gtk2hs but that's not what Glade outputs. I think.
20:51:39<dcoutts>mike-burns: you cannot set handlers from within glade
20:51:47<dcoutts>that only works for C
20:52:09<mike-burns>How can I set a handler from Haskell?
20:52:10<dcoutts>mike-burns: take a look at the glade demo that comes with gtk2hs, or see the glade tutorial on the gtk2hs website
20:52:41<dcoutts>mike-burns: actually the tutorial is probably best, it explains how to set handlers
20:53:46<mike-burns>Is `onClicked' the function I need?
20:55:23<int-e>Use onActivateLeaf for menu entries.
20:55:35<mike-burns>int-e: Thank you.
21:25:48<Baughn>Peaker: I wonder about that. I mean, /something/ caused it to malfunction in recursive unambs..
21:29:00<Baughn>Peaker: I'm learning a lot from this, at least. Especially about physics..
21:49:27<defun>conal: sorry, I fell asleep at my keyboard before I read your messages. You seem knowledgable on the subject of FRP. Perhaps you could recommend some papers/resources that would help me build some fundemental knowledge of how FRP works in general?
21:51:26<conal>defun: there are various angles: conceptual paradigm (mind-space), semantics, examples, implementation.
21:51:52<conal>defun: i could, e.g., point you to the orignal papers and later ones.
21:52:09<aavogt>@src putStrLn
21:52:09<lambdabot>putStrLn s = do putStr s; putChar '\n'
21:52:26<conal>defun: or tell you about its history.
21:54:13<conal>defun: btw, i invented frp.
22:02:04<BMeph>Heh-heh, conal : FRP :: augustss : Haskell implementation
22:02:23<enolan>Is there a way to launch ghci with options derived from a cabal file? Extensions are set the same as when building the package, the same packages are in scope, etc
22:03:21<Saizan_>enolan: no automated way yet, but there's a ticket on cabal-install's trac about it, iirc
22:03:37<Saizan_>enolan: it shouldn't be hard to implement
22:04:22<mreh>manually compiling these binaries is taking forever, is linking a memory intensive operation?
22:05:32<enolan>Alright. Too bad.
22:05:34<mreh>my laptop only has 256mb of memories
22:05:41<inimino>conal: I think I am reinventing FRP... what's a good early paper on the topic?
22:06:33<conal>inimino: looking ...
22:07:19<gwern>@remember defun [defun] conal: you seem knowledgable on the subject of FRP ... [conal] defun: btw, i invented frp.
22:07:20<lambdabot>I will never forget.
22:07:23<gwern>@flush
22:07:46<mreh>excellent
22:07:49<conal>gwern: what's flush?
22:07:54<conal>inimino: check out http://conal.net/papers . start with TBAG, ActiveVRML, and functional reactive animation.
22:07:57<gwern>conal: while you're looking if there's any paper titled 'FRP for people unconvinced of the value of FRP' I'd like that one :)
22:08:04<gwern>conal: backs up to disk
22:08:12<conal>inimino: then http://haskell.org/haskellwiki/FRP for more.
22:08:15<conal>gwern: oh!
22:08:31<gwern>(as in 'flush buffers/state [to disk]')
22:08:41<inimino>conal: alright, thanks
22:08:57<conal>also http://conal.net/fran/tutorial.htm
22:09:55<inimino>alright
22:10:12<conal>gwern: hm. about "unconvinced", my guess is most people will either resonate with FRP right away and need no convincing, or will be quite resistant to the ideas.
22:10:34<conal>gwern: do you have someone you want to convince?
22:10:37<mreh>I'm undecided
22:10:59<gwern>conal: myself, mostly. the ideal seems nice enough, but then when I read your blog posts, I keep thinking 'epicycles'
22:11:28<conal>gwern: epicycles?
22:11:33<aavogt>@wordnet epicycle
22:11:33<lambdabot>Unknown command, try @list
22:11:37<gwern>'if this is the right thing, then why does it seem so hard'?
22:11:45<conal>oh
22:11:48<mreh>copernican model of the solar system
22:11:48<defun>conal: thanks.
22:11:52<mreh>had epicycles
22:12:04<mreh>ptolmey changed that
22:12:05<conal>defun: :)
22:12:09<gwern>mreh: no :) other way around
22:12:15<gwern>@wn epicycle
22:12:16<lambdabot>*** "epicycle" wn "WordNet (r) 2.0"
22:12:16<lambdabot>epicycle
22:12:16<lambdabot> n : a circle that rolls around (inside or outside) another
22:12:16<lambdabot> circle; generates an epicycloid or hypocycloid
22:12:31<mreh>copernican revolution is a phrase that springs to mind
22:12:31<conal>gwern: a favorite test of mine also.
22:12:36<mreh>any kind of decentering
22:13:09<gwern>well, copernican systems were more valuable because they were simpler; not because they worked better
22:13:12<inimino>in 2001 or so I did a lot of thinking about how to build arbitrary 3d stuff with functions alone
22:13:17<aavogt>hmm, reminded me more of gear arrangments (epicyclic or planetary gearing)
22:13:31<conal>gwern: about 'so hard', do you meant correct & efficient implementation? something else?
22:13:47<inimino>I mean pure functions
22:13:58<mreh>gwern: to astrologers, yes
22:14:20<conal>inimino: that's what i've been doing as well. did you get stuck?
22:14:24<hatds>sounds tricky, inimino, did you find a answer?
22:14:40<inimino>I think this is basically what I had in mind (though I don't really know yet)
22:15:01<inimino>conal: no, I wrote a bunch of text files and then moved on to other stuff; I didn't get as far as getting stuck
22:15:19<gwern>conal: it's not just the difficulty of getting something sufficient performant, but all the variant frp libraries is scary from not just a dev perspective; there are more ways to accomplish a wrong thing than a right thing
22:16:02<aavogt>@wn spirograph
22:16:03<lambdabot>*** "spirograph" wn "WordNet (r) 2.0"
22:16:03<lambdabot>spirograph
22:16:03<lambdabot> n : a measuring instrument for recording the depth and rapidity
22:16:03<lambdabot> of breathing movements
22:16:11<gwern>@more
22:16:31<conal>gwern: i think iswym. my personal perspective is that we still haven't found quite the right (graceful) frp formulation.
22:16:34<mreh>respiration?
22:16:39<conal>s/formulation/model/
22:17:06<gwern>mreh: maybe the geometry tool is too recent a term for wordnet
22:17:25<mreh>gwern: tool?
22:17:40<aavogt>@go spirograph
22:17:41<lambdabot>http://en.wikipedia.org/wiki/Spirograph
22:17:41<lambdabot>Title: Spirograph - Wikipedia, the free encyclopedia
22:17:50<hatds>what are the base examples where FRP is likely to be used in practice?
22:17:51<mreh>useful for keeping children quiet
22:17:57<gwern>conal: but what makes you so confident that there *is* a right formulation?
22:18:34<conal>gwern: my faith in math / semantics / simplicity
22:18:54<conal>gwern: i can smell it
22:19:01<gwern>well, I suppose I can't really argue with faith...
22:19:23<hatds>(ever heard of kill your darlings?) not that I'm suggesting that at this point
22:19:35<conal>and i could have said "trust" in place of "faith"
22:21:17<aavogt>@remember <hatds>: what are the base examples where FRP is likely to be used in practice? <mreh> useful for keeping children quiet
22:21:18<lambdabot>Nice!
22:21:18<mreh>is it completely unreasonable for cabal plus zlib and http to take hours to link and compile?
22:21:40<inimino>this is also where I started
22:21:41<aavogt>ACTION is too out of context?
22:21:47<hatds>ACTION thinks so
22:21:51<wli>ACTION is faithless.
22:21:53<gwern>mreh: yes, unless you are on a very old box
22:22:05<gwern>mreh: did you specify split-objs or something odd?
22:22:24<mreh>i only have 256mb of memories, it must be paging the whole time
22:22:28<aavogt>@forget <hatds>: what are the base examples where FRP is likely to be used in practice? <mreh> useful for keeping children quiet
22:22:28<lambdabot>Done.
22:22:33<gwern>oh, that could do it
22:22:35<gwern>aavogt: I liked it
22:23:11<inimino>for example it seems very obvious that we can define things much more simply, but then it takes a lot of intelligence in the system to turn that into something that modern hardware can run fast
22:23:18<aavogt>gwern: your choice
22:23:19<hatds>is FRP hoping to be useful for GUIs? I've been banging my head over gui abstractions lately
22:23:46<conal>hatds: i've used frp for guis.
22:23:55<mreh>gwern: my comment was directed @ spirographs
22:23:56<conal>hatds: and another functional approach i like even better.
22:24:10<gwern>aavogt: i'd lean to keeping it. it's an amusing putdown
22:24:26<conal>hatds: http://conal.net/blog/posts/tangible-functional-programming-a-modern-marriage-of-usability-and-composability/
22:24:27<hatds>conal: so GUIs are not your motivation examples for FRP?
22:24:45<conal>hatds: not my only motivation.
22:24:48<gwern>and funny since I was reading http://conal.net/fran/tutorial.htm 's intro mentioning kids when you said it
22:25:11<gwern>hatds: oh, in theory frp seems to be very general. for example, cli utils using 'interact' can be see as FRP
22:25:18<gwern>*be seen
22:25:31<mreh>aavogt: stop quoting me out of context!
22:25:50<gwern>mreh: all quotation is out of context
22:25:53<defun>conal: Most FRP frameworks (eg: yampa) use the arrows abstraction. Is that strictly neccessary? I find arrows (the syntax) very annoying; but that's just me.
22:26:07<conal>defun: no. not strictly necessary.
22:26:34<conal>defun: like Monad, Arrow is a convenient structuring tool, but has almost no semantic content.
22:26:50<conal>defun: i think of FRP more in terms of Applicative and Comonad
22:27:11<defun>conal: Cool. I was about ask you about Applicative.
22:27:31<conal>defun: btw, have you read "Simply efficient functional reactivity" http://conal.net/papers/simply-reactive/ ? it's partly about relating FRP to various type classes.
22:27:46<defun>I see. Bookmarked!
22:28:06<aavogt>mreh: its gone :(
22:28:17<gwern>pansies
22:28:29<mreh>it wasn't even funny
22:28:29<conal>defun: i like Applicative. ask away.
22:28:40<aavogt>@quote funny
22:28:40<lambdabot>lispy says: one thing that's funny about programming in haskell is, it's the only language i know where i sometimes rewrite code so it will work on 'infinite' datastructures
22:28:53<gwern>@quote even
22:28:53<lambdabot>ghc says: even with cunning newtype deriving the newtype is recursive
22:29:40<mreh>@quote university
22:29:41<lambdabot>qwe1234 says: it all boils down to standard first-year university-level computational theory.
22:29:55<aavogt>@quote mreh
22:29:56<lambdabot>No quotes match. Just what do you think you're doing Dave?
22:30:05<gwern>@quote aavogt
22:30:05<lambdabot>No quotes match. There are some things that I just don't know.
22:30:08<mreh>as it should be
22:30:43<mreh>can you remember that quote from 1337_h4x0r or whatever his name was?
22:30:52<mreh>@quote 1337_h4x0r
22:30:53<lambdabot>No quotes match. I am sorry.
22:31:01<aavogt>@quote 1337
22:31:02<lambdabot>No quotes match.
22:31:05<gwern>@quote 3
22:31:05<lambdabot>ddarius says: [re: a40a15cb.0304160038.585f3e8@posting.google.com ] The best thing to get out of this, I guess,is that Haskell IS becoming more mainstream and even morons have heard of it.
22:31:19<gwern>(oh, that's a great quote -_-)
22:31:35<gwern>does anyone know how to even turn that into a url?
22:31:43<gwern>googling doesn't work
22:32:04<mreh>what sending a message to lambdabot asa a url?
22:32:10<RayNbow`>@quote byorgey zip
22:32:10<lambdabot>byorgey says: if math, haskell :: [Knowledge], the problem with learn $ math ++ haskell (or vice-versa) is that both lists are infinite, so you'll never get to the second one. Better to do something
22:32:10<lambdabot>like learn $ zip math haskell.
22:32:48<mreh>genius
22:33:06<gwern>we were discussing _the haskell road to mathematics_ at the time, iirc
22:33:32<int-e>mreh: somewhere in here: http://int-e.home.tlink.de/tmp/l33t_h4x0r_on_%23haskell
22:34:03<mreh>i better not open a browser, I need all the memory i can
22:34:07<mreh>cheers though
22:34:24<int-e>use wget and less :P
22:34:43<mreh>lateral thinking
22:35:35<gwern>@remember ValarQ l33t_h4x0r: could you help me port GHC to the AVR architecture?
22:35:35<lambdabot>It is stored.
22:35:41<gwern>@forget ValarQ l33t_h4x0r: could you help me port GHC to the AVR architecture?
22:35:41<lambdabot>Done.
22:35:43<gwern>ack
22:35:51<gwern>@remember ValarQ l33t_h4x0r: could you help me port GHC to the AVR architecture? <-- l33t_h4x0r (n=l33t_h4x@88-104-102-8.dynamic.dsl.as9105.com) has left #haskell
22:35:51<lambdabot>Okay.
22:36:03<gwern>even leet hackers don't want to work on ghc ports!
22:36:21<gwern>hm. probably should remove the hostmask to make it more concise
22:36:25<gwern>@forget ValarQ l33t_h4x0r: could you help me port GHC to the AVR architecture? <-- l33t_h4x0r (n=l33t_h4x@88-104-102-8.dynamic.dsl.as9105.com) has left #haskell
22:36:25<lambdabot>Done.
22:36:32<gwern>@remember ValarQ l33t_h4x0r: could you help me port GHC to the AVR architecture? <-- l33t_h4x0r has left #haskell
22:36:32<lambdabot>Okay.
22:36:57<mreh>int-e: was that a joke uri?
22:37:58<int-e>mreh: no.
22:38:09<mreh>int-e: mistyped ;)
22:38:50<int-e>no problem.
22:39:46<mreh>is 1337 someone's alter ego
22:39:49<mreh>he's too good to be true
22:39:56<defun>conal: Applicative has a very terse syntax in comparison to arrows/monads, and I've found myself using Applicative in place of Monads in my programs. I've rewritten a bunch of code in my previous programs with Applicative, because applicative simply composes better than Monads/Arrows. It seems to me that for combinators Applicative is well suited, and so naturally, I assumed that it might work well for FRP. I was going to ask you if yo
22:40:30<Cale>defun: your message was cut off at " I was going to ask you if yo"
22:40:41<defun>1 sec
22:40:52<defun>I was going to ask you if you have considered using Applicative, but the answer to that is apparent. I have some more questions, but first I will read some of those papers, so that I don't waste anybody's time. Thanks for your help.
22:42:06<conal>defun: i'm glad to hear you've gotten hooked on Applicative! i think a lot of Monad use is just habit on top of historical accident. Monad was discovered before the simpler & more general Applicative.
22:48:25<jcazevedo>hi. I'm unable to compile the syslog example on real world haskell in windows, some functions are not in scope
22:48:27<jcazevedo>any clues?
22:48:36<sclv>which functions?
22:48:46<Alpounet>did you look at previous chapters for these functions ?
22:48:59<jcazevedo>getAddrInfo, defaultHints
22:49:01<jcazevedo>...
22:49:03<jcazevedo>hmm
22:49:35<jcazevedo>they're from the socket module, I guess
22:49:37<Alpounet>@hoogle getAddrInfo
22:49:38<lambdabot>No results found
22:50:25<sclv>if you import Network.Socket it should work then? as I recall it is cross-platform.
22:51:25<Alpounet>jcazevedo, do you compile with ghc --make (so that it guesses which modules you're using by itself) ?
22:52:20<sclv>--make doesn't guess which modules you're using. you still have to declare imports. it just ensures linking happens correctly.
22:53:17<jcazevedo>I'm declaring the imports, and compiling with ghc --make doesn't solve it
22:53:37<sclv>try :browse Network.Socket from ghci
22:53:37<jcazevedo>from what I've seen on the web, this seems to only happen on windows
22:56:39<sclv>what version of the network package are you using?
22:57:04<sclv>looking at the documentation on hackage, it looks like those functions were only added in v. 2.1
22:57:30<jcazevedo>how can I check that? I've just installed ghc 6.10.3
22:57:44<sclv>then it should be there. hmm.
22:58:49<Saizan_>jcazevedo: ghc-pkg list network will tell you
22:59:12<jcazevedo>2.2.1
23:12:31<McManiaC>is there something like map for tupels?
23:12:47<McManiaC>(a -> b) -> (a,a) -> (b,b) ?
23:13:21<idnar>@pl \f (a,b) -> (f a, f b)
23:13:22<lambdabot>(`ap` snd) . (. fst) . (flip =<< (((.) . (,)) .))
23:13:25<idnar>ugh
23:13:29<idnar>@type (&&&)
23:13:30<lambdabot>forall (a :: * -> * -> *) b c c'. (Arrow a) => a b c -> a b c' -> a b (c, c')
23:13:39<idnar>@type join (&&&)
23:13:40<byorgey>@type \f -> f *** f
23:13:40<lambdabot>forall (a :: * -> * -> *) b c. (Arrow a) => a b c -> a b (c, c)
23:13:41<lambdabot>forall (a :: * -> * -> *) b c. (Arrow a) => a b c -> a (b, b) (c, c)
23:13:57<idnar>oh, yes, ***
23:13:59<byorgey>you could do something like that. probably not worth it though.
23:14:07<byorgey>McManiaC: the short answer is, 'no' =)
23:14:10<idnar>heh
23:14:11<McManiaC>ok
23:14:12<McManiaC>^^
23:16:34<jaredj>jaredj@harpster:~/src-mine/ofx1$ cabal uninstall
23:16:34<jaredj>unrecognised command: uninstall (try --help)
23:17:39<byorgey>yeah, there's no such thing
23:17:45<byorgey>you can unregister packages
23:18:03<byorgey>ghc-pkg unregister foo
23:18:25<byorgey>that doesn't actually delete them, but it's the next best thing.
23:18:40<byorgey>or ghc-pkg unregister --user foo, if it's installed locally
23:19:15<jaredj>cool.
23:20:11<jaredj>AWESOME it worked.
23:20:23<jaredj>no more parsec 3 to provisionally ruin my day
23:31:12<hatds>why can't you uninstall a package?
23:32:01<hatds>I mean, I don't really know what's going on under the hood with packages, but is there a simple obstruction?
23:36:39<Saizan>hatds: cabal doesn't keep track of the files installed, yet
23:36:58<Saizan>(until someone implements it)
23:37:09<hatds>so it's a matter of getting around to it, not a design problem with packages
23:37:28<ray>hehe
23:37:40<ray>in a way, you can think of it as a design problem with filesystems
23:38:04<hatds>I like that thinking
23:40:24<ray>making ghc forget about it does everything but free the disk space
23:40:32<ray>(if it's a library, anyway)
23:40:51<ray>and who's in charge of freeing unused disk space? the filesystem
23:44:56<McManiaC>@pl \f o -> o f
23:44:56<lambdabot>flip id
23:44:59<McManiaC>:)
23:50:38<fracture>what's the most efficient way to determine if all members of a list are the same?
23:50:47<fracture>(I can think of a lot of ways... just not sure what's idiomatic)
23:51:38<skorpan>fracture: the easy way is probably something like "(==1) . length . nub"
23:52:03<fracture>how efficient is nub?
23:52:21<fracture>I was thinking maybe all (\x -> x == head a) a
23:52:26<fracture>... if a is not []
23:52:32<skorpan>that's another way
23:52:38<skorpan>but maybe it works even with a == []
23:52:41<skorpan>@src all
23:52:41<lambdabot>all p = and . map p
23:52:46<fracture>the head fails though, no?
23:52:50<fracture>ohhhh it won't call the lambda
23:52:51<fracture>got it
23:52:55<skorpan>> let xs = [] in all (\x -> x == head xs) xs
23:52:57<lambdabot> True
23:52:58<skorpan>yep
23:52:59<fracture>ok I'll just do that
23:53:24<InabaAtsuyoshi>perhaps foldr (==) (head theList) theList
23:53:48<fracture>but foldr won't short circuit, no?
23:54:04<skorpan>> let xs = [] in foldr (==) (head xs) xs
23:54:05<lambdabot> * Exception: Prelude.head: empty list
23:54:36<InabaAtsuyoshi>mmm yeah it wont work on an empty list
23:55:08<skorpan>i'm not sure there's anything to gain using foldr
23:55:17<skorpan>apart from being slightly prettier

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