Experimental IRC log haskell-2009-06-06

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:01:43<gwern>(bleh. as ever with gitit plugins, the bloody type system just gets in the way)
00:02:09<Cale>Hmm... I just had a parameter for the step length, and allowed the user to set the initial point and angle with the mouse
00:02:53<Cale>It seems that the nymphaea on hackage is drastically out of date.
00:03:00<Cale>I should work on it a bit
00:03:06<Berengal>Ah. I'm still at the point where I'm inputting the parameters by hand in the source
00:03:13<Berengal>Well, I've got some structures to put them in...
00:04:02<gwern>Cale: don't look at me! I sent you all my changes to nymphaea
00:06:25<Berengal>Not sure if I quite like the structure though... I've got one datatype 'LSys' for systems (start :: String and rules :: [(Char, String)]), one for "renderable" L-Systems, containing things like which symbol draws forward, which jumps forward, which turns etc. and one for the Cairo Render monad config...
00:06:29<Cale>gwern: I got it from hackage :)
00:06:57<Cale>gwern: The latest version of gtk2hs seems to have changed some things
00:17:37<Cale>Yay, got it running again at least :)
00:17:54<Cale>Now I just have to finish converting from the deprecated event system
00:17:56<shapr>What are the changes with gtk2hs? I just failed to build hsclock.
00:18:22<Cale>shapr: The way that event handlers work has drastically changed, it seems
00:18:49<shapr>so search and replace won't fix it...
00:18:57<shapr>Is there a description of the changes?
00:19:47<Cale>http://haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Gdk-EventM.html
00:19:59<shapr>thanks
00:20:09<Cale>and stuff in http://haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Abstract-Widget.html
00:22:37<Cale>Er, odd.
00:22:57<Cale>ACTION wonders where clickedEvent is
00:27:10<Berengal>ACTION stumbles upon a crooked sierpinsky triangle
00:30:47<shapr>Ok, is there a tutorial on writing gtk2 programs with the latest version of the bindings?
00:31:38<shapr>foozles
00:33:22<Cale>shapr: The basic idea is that you use something like widget `on` buttonPressEvent $ do ...
00:34:06<Cale>and that do-block will then be in an appropriate EventM monad, in this case EventM EButton
00:34:26<Cale>The (EventM t) monad is always a MonadIO, so you can use liftIO for IO actions
00:34:47<Cale>But it also has extra actions for obtaining information about the event which occurred
00:35:07<Cale>eventButton :: EventM EButton MouseButton
00:35:33<Cale>eventCoordinates :: HasCoordinates t => EventM t (Double, Double)
00:35:55<Cale>eventModifier :: HasModifier t => EventM t [Modifier]
00:35:58<Cale>etc.
00:38:55<shapr>Funny, I was just reading about how people need to see examples and compilers do not.
00:39:08<shapr>Cale: So, um, is there an example of this working somewhere?
00:39:30<shapr>ACTION points at BONUS, thus creating bonus points.
00:41:23<chessguy>@pl p n = r ()
00:41:23<lambdabot>p = const (r ())
00:41:30<Cale>ACTION just uploaded a new version of nymphaea to hackage which uses it
00:42:27<Cale>It's kind of funny to use, since almost all of your event handler is likely to be IO stuff anyway
00:43:34<Cale> drawingArea `on` exposeEvent $
00:43:34<Cale> do r <- eventRegion
00:43:34<Cale> -- Get the pixmap and pin and the drawing area.
00:43:34<Cale> liftIO $ do ...
00:43:41<Cale>But you can always do something like that
00:44:21<shapr>Cale: 0.2 should build?
00:44:25<Cale>0.3
00:44:30<Cale>I just uploaded it
00:44:31<shapr>oops, cabal update first :-/
00:50:06<lindzeyn>What might cause ghci to think that some operators (that I have defined in .hs file) are not in scope? I am using the (!#$%&*+./<=>?@\^|-~) :: a -> etc... syntax
00:50:38<Cale>lindzeyn: Is there a similar .o file hanging around?
00:51:02<lindzeyn>I've just been using the interpreter, so no.
00:51:10<Cale>lindzeyn: If values are not exported from a module, and ghci loads the compiled module instead of the source, then that can happen
00:51:13<Cale>hmm
00:51:29<Cale>What are the operators called?
00:51:42<Cale>You have given them definitions of course, right?
00:52:00<lindzeyn>yes. they are +~ and -~
00:52:39<int-e>dcoutts: if you're still awake: I'm going to test this patch: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5590#a5590
00:52:42<roconnor>What's the Dutch word for "Monad"?
00:52:53<bremner>goto
00:52:58<roconnor>:D
00:53:09<Cale>lindzeyn: Can I see the first line of each of their definitions?
00:53:20<lindzeyn>roconnor, Djikstra didn't get around to that, so there is none. :)
00:53:21<Cale>You should have something like x +~ y = ...
00:53:30<shapr>@seen sw17ch
00:53:30<lambdabot>Last time I saw sw17ch was when I left ##english, ##freebsd, ##hrg, ##logic, #arch-haskell, #concatenative, #darcs, #dreamlinux-es, #friendly-coders, #functionaljava, #gentoo-haskell, #gentoo-uy, #
00:53:30<lambdabot>ghc, #haskell, #haskell-blah, #haskell-books, #haskell-freebsd, #haskell-in-depth, #haskell-overflow, #haskell-soc, #haskell.cz, #haskell.de, #haskell.dut, #haskell.es, #haskell.fi, #haskell.fr, #
00:53:30<lambdabot>haskell.hr, #haskell.it, #haskell.jp, #haskell.no, #haskell.ru, #haskell.se, #haskell_ru, #jhc, #jtiger, #macosx, #macosxdev, #novalang, #perl6, #rosettacode, #scala, #scannedinavian, #unicycling, #
00:53:30<lambdabot>xmonad and #yi 1d 20h 3m 5s ago.
00:53:33<shapr>aww
00:53:35<roconnor>lindzeyn: I sort of figured.
00:53:38<shapr>Man, that was some serious spam.
00:53:43<int-e>that's a lot of channels
00:53:55<Cale>In German, it's apparently Monade
00:53:58<lindzeyn> 17 >(-~) :: PitchClass -> PitchClass -> Bool
00:53:59<lindzeyn> 18 >cs (-~) ds = cs +~ i(ds)
00:54:01<roconnor>ACTION wonders if Bart Jacobs has and Dutch papers on the subject
00:54:06<Cale>lindzeyn: aha
00:54:13<Cale>lindzeyn: you're defining cs there
00:54:32<Cale>lindzeyn: you want cs -~ ds = cs +~ i ds
00:54:35<roconnor>lindzeyn: "monade" is tempting
00:55:03<lindzeyn>doh! Nice catch Cale.
00:55:16<lindzeyn>roconnor, if there is a german word for it, use it.
00:55:18<shapr>roconnor: And in french that would be ..
00:55:29<roconnor>Bij de Pythagoreërs was de monade het eerste ding dat 'was'.
00:55:29<Jedai>lindzeyn: you either want (-~) cs ds =... or cs -~ ds = ...
00:55:38<lindzeyn>got it.
00:55:39<shapr>Instead of saying you drink the kool-aid, it'd be drinking Le Monade.
00:55:42<lindzeyn>Thanks everyone
00:55:44<roconnor>lindzeyn: German uses "monade"
00:55:57<Cale>圏論 is Japanese for Category Theory
00:56:08<Jedai>shapr: French say monade
00:56:17<roconnor>well "Monade"
00:56:19<lindzeyn>I'd go with monade
00:56:27<Berengal>Cale: Looks like a box, a woman and a man
00:56:34<Cale>モナド
00:56:35<Berengal>Suitcase, maybe
00:56:49<Cale>mo na do
00:57:07<Cale>http://ja.wikipedia.org/wiki/モナド_(圏論)
00:57:08<Jedai>shapr: and you would say "la monade", not "le"
00:57:11<Berengal>ACTION wonders if there's a unicode symbol for monad
00:57:21<shapr>Jedai: That totally kills the joke, you realize?
00:57:33<shapr>quel dommage :-/
00:57:45<Cale>hehe コモナド
00:57:53<Cale>komonado
00:57:59<shapr>oi Time`s_Witness, como vai?
00:58:09<shapr>er wait, wrong channel.
00:58:19<Jedai>shapr: Yes, too but que veux-tu :)
00:58:29<shapr>Jedai: Yeah
00:58:31<Berengal>
00:58:59<Berengal>I don't know what that is, but it's the only symbol in "Yi" I my font knows how to draw...
01:00:02<Cale>U+A079 YI SYLLABLE NBIP
01:00:12<Berengal>Yes
01:00:37<Cale>My font displays it, but incorrectly
01:00:47<Cale>http://www.fileformat.info/info/unicode/char/a079/index.htm
01:02:18<Berengal>Heh, ␍␊
01:02:43<Berengal>
01:02:55<Cale>http://en.wikipedia.org/wiki/File:Yiwen.jpg
01:03:48<Berengal>Looks like some sort of runic chinese...
01:04:57<Botje>aargh! chikings!
01:26:42<lindzeyn>Can you define unary operators in Haskell?
01:26:43<gwern>@seen dcoutts
01:26:43<lambdabot>dcoutts is in #darcs, #gentoo-haskell, #ghc, #haskell, #haskell-in-depth, #haskell-overflow and #haskell-soc. I last heard dcoutts speak 1h 46m 41s ago.
01:26:46<gwern>@seen dcoutts_
01:26:46<lambdabot>dcoutts_ is in #haskell-in-depth, #gentoo-haskell, #ghc and #haskell-overflow. I last heard dcoutts_ speak 6h 57m 41s ago.
01:26:50<gwern>@seen dcoutts__
01:26:50<lambdabot>dcoutts__ has changed nick to dcoutts.
01:26:50<lambdabot>dcoutts is in #darcs, #gentoo-haskell, #ghc, #haskell, #haskell-in-depth, #haskell-overflow and #haskell-soc. I last heard dcoutts speak 1h 46m 48s ago.
01:28:00<gwern>@ask dcoutts do you know if darcs cabal/cabal-install broke library/executable sections? I've been banging my head over why cabal refuses to install an updated gitit library (even with bumped version) when it will the executable
01:28:00<lambdabot>Consider it noted.
01:31:07<gwern>@tell dcoutts my suspicious are drawn to cabal inasmuch as I updated yesterday and I hadn't for quite some time; and ghc-pkg turns up no trace of my bumped version of gitit - but the executable's --help says the right thing...
01:31:07<lambdabot>Consider it noted.
01:31:56<BMeph>lindzeyn: Yes, you can. :)
01:32:23<lindzeyn>Hmph, I must be using improper syntax
01:32:35<lindzeyn>All the tuts out there only give binary examples
01:34:54<BMeph>lindzeyn: (If you're using GHC) http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#postfix-operators
01:35:43<BMeph>lindzeyn: If you were looking for postfix operators. I think prefix ones are easier, but that's just opinion.
01:36:09<lindzeyn>I prefer prefix
01:37:08<BMeph>Is there a tutorial to how to use haddock to get your packages' docs integrated into GHC's main ones?
01:42:06<BMeph>lindzeyn: I don't believe there's a provision for making operators prefix, since that comes automatically with parens. :)
01:48:57<sclv>a prefix operator is called a "function"
01:50:17<lindzeyn>I want something shorthand, like: ##[1,2,3,4,5]
01:50:41<lindzeyn>where ## = func :: [a] -> [a]
01:51:14<gwern>> let ($$) = map (+1) in $$[1..10]
01:51:15<lambdabot> <no location info>: parse error on input `$$'
01:51:16<lindzeyn>I use func alot and it sucks having to wrap parens around
01:51:19<Cale>Well, normal function names are prefix...
01:51:27<gwern>drat
01:51:54<lindzeyn>right
01:53:21<gwern>> let ($$) = map (+1) in $$ [1..10]
01:53:22<lambdabot> <no location info>: parse error on input `$$'
01:53:24<Cale>> let (!) n = product [1..n] in (5!)
01:53:26<lambdabot> 120
01:53:37<gwern>> let ($$) x = map (+1) x in $$ [1..10]
01:53:38<lambdabot> <no location info>: parse error on input `$$'
01:53:52<gwern>-_- guess $ must be reserved like #
01:54:09<Cale>gwern: It's an infix operator
01:54:23<Cale>> let ($$) x = map (+1) x in ($$) [1..10]
01:54:24<lambdabot> [2,3,4,5,6,7,8,9,10,11]
01:54:31<Cale>> let ($$) x = map (+1) x in ([1..10] $$)
01:54:32<lambdabot> [2,3,4,5,6,7,8,9,10,11]
01:55:32<Cale>http://www.marriedtothesea.com/060509/fake-insect-id.gif
01:55:32<edwardk1>@seen luqui
01:55:32<lambdabot>luqui is in #haskell-blah and #haskell. I last heard luqui speak 44m 43s ago.
01:55:58<Cale>Something tells me that BONUS would love that one :)
01:56:34<luqui>edwardk, ping
01:57:09<newsham>hi
03:12:31<F>hi all. I know no haskell. what is the sanest (not quickest) way to learn haskell? I already know C.
03:13:11<F>(i.e. specific books to choose over others? are there authors or books to avoid?)
03:13:33<ksf>forget all of it, then head over to Learn you a Haskell, Real World Haskell, and then the Typeclassopedia
03:13:39<ksf>...the rest follows from there.
03:13:47<F>are those sites or books?
03:14:08<F>just googled. nvm.
03:14:12<ksf>the first is a site, the second book and site, and the last a journal submission.
03:14:46<F>I appreciate it. thanks.
03:14:51<ksf>no bother
03:17:33<Cale>F: and ask lots of questions here whenever you get stuck!
03:17:50<Cale>F: There are lots of people who like to help beginners :)
03:18:27<Cale>You should get set up with ghc and ghci, if you're not already
03:23:11<F>Cale: ah. let me grab that.
03:23:23<F>what do you mean by "get set up" though? its just a compiler.
03:23:35<Cale>Well, you should install it :)
03:23:55<F>doing so now.
03:23:58<Cale>6.10.3 if you can get it :)
03:24:07<F>yessir.
03:40:03<mmorrow>pumpkin: having the "run-once-at-startup" ability is essentially having a "top-level <-" for IO, which got shot down (for ghc at least).
03:40:25<edwardk>mmorrow: yeah makes me sad, jhc has it at least
03:41:07<mmorrow>edwardk: yeah, that reminds me i've meant to try that out in jhc
03:43:25<malouin>how do I get a ByteString out of a string literal?
03:43:41<edwardk>pack?
03:43:53<mmorrow>pumpkin: if you can manage to hook into the module_init (or whatever the label is) that the asm does, i guess that's the only way i can think of (each module has a .long or something that's set to 1 when it's "intialized" (not sure what triggers that)
03:45:00<malouin>edwardk: well, apparently in my world a string literal is not [Word8]
03:45:33<malouin>Expected type: [GHC.Word.Word8] Inferred type: [Char]
03:45:46<edwardk>malhouin: then you might want to modify your world to import the data.bytestring.char8 ;)
03:46:03<edwardk>er Data.Bytestring.Char8 module instead
03:46:31<mmorrow>pumpkin: here the asm that every module has http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2568#a2568
03:47:04<mmorrow>(not sure if it's different on diff arches)
03:48:08<edwardk>malouin: i tend to import qualified Data.ByteString.Char8 as Char8 -- and then use Char8.pack as needed
03:48:09<malouin>edwardk: awesome, thank you!
03:48:19<edwardk>no problem
03:51:40<goldenpuffs>quick question: if I have a list of functions [a->b] and I want to apply function1 to value1 in a list of values [a], and function2 to value2 and so on... how would I do that?
03:52:03<mmorrow>zipWith ($)
03:52:13<goldenpuffs>what does the dollar do?
03:52:20<mmorrow>@src ($)
03:52:20<lambdabot>f $ x = f x
03:53:08<edwardk>@type zipWith ($)
03:53:10<lambdabot>forall b b1. [b -> b1] -> [b] -> [b1]
03:53:13<edwardk>@type zipWith id
03:53:14<lambdabot>forall b c. [b -> c] -> [b] -> [c]
03:53:23<mmorrow>@type [($),id]
03:53:24<lambdabot>forall a b. [(a -> b) -> a -> b]
03:58:02<goldenpuffs>hm I'm not sure I understand that definition, so I would do: zipWith ($) [a->b] [a] ?
03:58:30<mmorrow>, zipWith ($) [(*2),negate,const 42] [1..]
03:58:32<lunabot> [2,-2,42]
03:58:43<mmorrow>, zipWith id [(*2),negate,const 42] [1..]
03:58:44<lunabot> [2,-2,42]
03:59:44<mmorrow>and `zip' is essentially
03:59:47<mmorrow>zipWith (,)
03:59:53<Axman6>goldenpuffs: basically, zipWith ($) is the same as writing zipWith (\f x -> f x)
04:00:29<Axman6>> zipWith ($) [f,g,h] [x,y,z] :: [Expr]
04:00:30<lambdabot> [f x,g y,h z]
04:00:44<Axman6>> zipWith (\f x -> f x) [f,g,h] [x,y,z] :: [Expr]
04:00:46<lambdabot> [f x,g y,h z]
04:01:01<mmorrow>> zipWith id [f,g,h] [x,y,z] :: [Expr]
04:01:02<lambdabot> [f x,g y,h z]
04:01:14<goldenpuffs>oh that helped, thanks for the examples
04:01:44<mmorrow>i always forget about Expr/SimpleReflect.. it's handay
04:01:57<goldenpuffs>so ($) is just an infix operator for function application?
04:02:01<mmorrow>exactly
04:02:10<goldenpuffs>sweet
04:02:35<Axman6>but it's the fixity that's the importat part
04:02:50<mmorrow>yes, this makes it different from `id'
04:02:54<mmorrow>s/this/which/
04:03:01<Axman6>lets you write (f . g . h) x as f . g . h $ x
04:03:02<mmorrow>well, both work i guess :)
04:03:23<mmorrow>("well, both work i guess :)" @ s/this/which/)
04:04:02<goldenpuffs>and another (unrelated) question: when is it preferable to use parentheses and when is it better to use (.) ?
04:04:19<mmorrow>goldenpuffs: personal style preference
04:04:51<goldenpuffs>ok, so both work exactly the same?
04:04:56<mmorrow>yes
04:05:11<goldenpuffs>good to know
04:10:37<luqui>:t ($) 42
04:10:38<lambdabot>forall a b. (Num (a -> b)) => a -> b
04:25:51<Cale>Is it just me, or does nubBy suddenly seem backward?
04:26:21<Axman6>how so?
04:26:33<kpreid>:t nubBy
04:26:34<lambdabot>forall a. (a -> a -> Bool) -> [a] -> [a]
04:26:35<sclv>?ty nubBy
04:26:36<lambdabot>forall a. (a -> a -> Bool) -> [a] -> [a]
04:26:57<Axman6>> nubBy (/=) [1,2,3,5,2,5,2,35,31,6]
04:26:58<lambdabot> [1]
04:27:03<Axman6>> nubBy (==) [1,2,3,5,2,5,2,35,31,6]
04:27:04<lambdabot> [1,2,3,5,35,31,6]
04:27:19<Cale>In that it appears to put the arguments to the comparator in the wrong order
04:27:22<Axman6>ACTION always thought it could be called uniq and uniqBy
04:27:40<Cale>nubBy eq (x:xs) = x : nubBy eq (filter (\y -> not (eq x y)) xs)
04:27:45<Cale>according to the report
04:27:53<Axman6>@src nubBy
04:27:54<lambdabot>nubBy eq [] = []
04:27:54<lambdabot>nubBy eq (x:xs) = x : nubBy eq (filter (\ y -> not (eq x y)) xs)
04:28:14<Cale>So this means that nubBy (<) [1..10] should give what?
04:28:31<Axman6>> nubBy (<) [1..10]
04:28:32<lambdabot> [1,2,3,4,5,6,7,8,9,10]
04:28:38<Axman6>> nubBy (>) [1..10]
04:28:39<lambdabot> [1]
04:28:45<Cale>hmm...
04:28:56<Cale>Maybe I'm just being silly :)
04:29:04<Cale>yeah, that's all it is
04:29:05<Axman6>> nubBy (<) ([1..10]++ [5..10])
04:29:06<lambdabot> [1,2,3,4,5,6,7,8,9,10,10]
04:29:24<Axman6>hmm, i find that sort of strange...
04:29:29<kyagrd>@. hstats
04:29:29<lambdabot>Not enough arguments to @.
04:29:31<Cale>wait, no
04:29:38<Axman6>oh right, that makes sense
04:29:38<kyagrd>Oops
04:29:48<Cale>> filter (\y -> not (1 < y)) [2..10]
04:29:49<lambdabot> []
04:29:52<Cale>see?
04:29:54<Cale>I'm not crazy
04:29:59<Cale>It's backward.
04:30:01<Jedai>Axman6: uniq in Unix isn't nub though
04:30:12<Axman6>> nubBy (const even) [1..10]
04:30:14<lambdabot> [1,2]
04:30:22<Axman6>> nubBy (const even) [2..10]
04:30:23<lambdabot> [2]
04:30:27<Axman6>> nubBy (const even) [3..10]
04:30:28<lambdabot> [3,4]
04:30:34<kyagrd>> :k 1
04:30:35<lambdabot> <no location info>: parse error on input `:'
04:31:44<kyagrd>@hoogle average
04:31:44<lambdabot>No results found
04:31:56<inimino>Jedai: what's the difference?
04:31:58<kyagrd>huh ...
04:32:25<Jedai>Cale: You're supposed to use an equivalence relation for nubBy so there really is no "right" order
04:32:39<Cale>Jedai: No, there is a right order.
04:33:31<Cale>nubBy with non-equivalence relations is quite useful
04:33:36<Jedai>inimino: uniq remove identical _sequential_ elements, nub remove all duplicates
04:33:54<kyagrd>>:k 1
04:34:03<Cale>> nubBy (\x y -> x `mod` y == 0) [2..]
04:34:04<lambdabot> [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101...
04:34:05<Axman6>:k 1
04:34:05<lambdabot>*
04:34:11<kyagrd>> :k 1
04:34:12<lambdabot> <no location info>: parse error on input `:'
04:34:28<inimino>Jedai: true, uniq requires sorted input
04:34:51<Axman6>Jedai: that's not true, uniq removes all duplicate entries from its input
04:34:52<kyagrd>@type undefined
04:34:53<lambdabot>forall a. a
04:35:02<Twey>Axman6: No it doesn't
04:35:04<Axman6>or does it
04:35:06<inimino>(to act like nub that is)
04:35:06<Axman6>hmm
04:35:20<Twey>Axman6: Try it
04:35:27<Cale>similarly, groupBy (<) is quite useful
04:35:28<inimino>no
04:35:30<inimino>sort | uniq is basically nub though
04:35:32<Axman6>reading the man page seems to agree with you. how odd
04:35:39<Twey>inimino: Except that the order is changed
04:35:42<Cale>> groupBy (<) [1,2,3,4,3,1,2,3,1,2]
04:35:43<Twey>nub doesn't change the order
04:35:44<lambdabot> [[1,2,3,4,3],[1,2,3],[1,2]]
04:36:00<inimino>Twey: true
04:36:01<Axman6>i don't like how that groupBy works
04:36:02<Cale>> map (drop 1) . groupBy (<) $ [1,2,3,4,3,1,2,3,1,2]
04:36:03<lambdabot> [[2,3,4,3],[2,3],[2]]
04:36:05<Jedai>inimino: with better complexity though
04:36:17<Cale>I love the way that groupBy works
04:36:23<Cale>I hope they never change it.
04:36:52<lindzeyn>This sounds silly, but is there a way to coerce an Integer into a List in Haskell? Ex. 123456 = [1,2,3,4,5,6]
04:36:57<Axman6>i prefer another version i've seen, which in that case would give [[1,2,3,4],[3],[1,2,3],[1,2]]
04:36:59<Cale>Consider if my example list there had been the depths of document subheadings.
04:37:12<lindzeyn>Or, is there a way to modify a single index of a list?
04:37:12<Axman6>which gets all ascending groups
04:37:12<kyagrd>lindzyen: In GHC you can do something like that
04:37:13<Cale>groupBy automatically does the right thing to separate them into groups
04:37:23<Jedai>lindzeyn: the simple way is "map digitToInt . show"
04:37:52<Axman6>Cale: depends on your definition of 'the right thing'
04:38:10<Cale>Axman6: I mean the document subheadings
04:38:11<Jedai>lindzeyn: the efficient way is to use divMod and unfoldr
04:38:36<Axman6>eh?
04:38:37<kyagrd>lindzeyn: Lennart even overloaded integer numeric literals to have function types
04:38:43<Jedai>lindzeyn: or something equivalent
04:38:55<kyagrd>lindzeyn: no reason list cant be
04:39:04<Cale>Axman6: Consider a document with headings like 1, 1.1, 1.2, 1.2.1, 1.2.2, 1.2.3,...
04:39:14<Axman6>the version of groupBy i like is nice, because it can be used for a somewhat efficient implementation of mergesort
04:39:17<Cale>Axman6: Suppose we want to turn that into a tree.
04:39:43<lindzeyn>Thanks everyone
04:39:48<Axman6>because it automatically groups the input into ascending groups
04:40:18<Cale>Axman6: The current groupBy is perfect for splitting up the list at the top-level to the cases to be handled recursively
04:40:59<Cale>You want all the stuff after 1, up to the first heading of the same depth, say 2, to be in the same group
04:41:32<Cale>So it's groupBy ((<) `on` headingDepth)
04:41:48<Cale>and then map (drop 1)
04:41:54<Axman6>i guess
04:42:08<Axman6>i'm just more interested in numbers than documents i guess :P
04:42:36<Cale>Well, there are other numerical problems you can take on with this sort of groupBy too
04:42:52<Cale>I think it's the most natural thing, recursively.
04:43:09<Cale>But it would be nice to have the other one around too
04:43:34<Axman6>yeah
04:43:53<Axman6>someone's written a package that does that, and a few other things that they feel were broken too
04:46:21<mmorrow>Axman6: are you referring to the "group" in the mergesort in ghc/other places (w/ an email fragment in the comment)?
04:49:15<mmorrow>Axman6, Cale: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5595
04:49:54<mmorrow>heh, looks like andyjgill wrote that `group' in 1996
04:52:18<Cale>anyway, I think I should complain on the mailing list about nubBy having its parameters swapped
04:52:29<Gracenotes>lamby!! Come back!
04:52:41<Cale>I'm bringing it back in a moment :)
04:53:42<mmorrow>ACTION guesses that Cale will get extreme resistance, even if he is "right"
04:54:02<Cale>mmorrow: I just want it to match the report!
04:54:08<mmorrow>oh, it doesn't?
04:54:18<Cale>The current behaviour in recent GHCs swapped it
04:54:25<mmorrow>ah, in that case :)
04:54:31<Cale>and it broke my cheesy implementation of primes :)
04:54:34<mmorrow>hah
04:55:03<sshc>what is a graphics API for Haskell that preferably works with Haskell?
04:55:20<Cale>Oh, apparently it is fixed in head?
04:55:25<mmorrow>sshc: OpenGL?
04:55:27<Cale>wait... this message is from 2008
04:55:35<Cale>Did they screw it up again?
04:55:38<sshc>yes, opengl
04:55:45<sshc>that preferably works with OpenGL
04:55:55<mmorrow>sshc: OpenGL? :)
04:56:20<sshc>what is HOpenGL, then?
04:56:27<mmorrow>oh, not sure
04:56:47<mmorrow>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/OpenGL
04:56:55<mmorrow>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GLUT
04:57:50<mmorrow>sshc: (random fact: if you're planning on using forkIO with OpenGL, you need to use forkOS instead, since OpenGL uses thread-local-state)
04:57:55<mmorrow>ACTION found that out the hard way
05:02:04<Axman6>heh
05:02:11<mmorrow>(the "hard way" being inexplicable randomly occurring segfaults and cryptic failed assertions from the C opengl driver)
05:14:29<luqui>what's the type theory symbol for greatest fixed point?
05:14:31<luqui>the dual of mu?
05:14:57<Cale>Is there a libraries trac?
05:15:05<Cale>Or do I report bugs to the ghc trac?
05:15:34<ski>luqui : it often seems to be called `nu'
05:15:59<luqui>ski, thanks
05:16:22<ski>Stream a = nu s. a * s
05:26:53<Cale>http://hackage.haskell.org/trac/ghc/ticket/3280 :)
05:35:01<chowmeined>how well does ghc work on solaris?
05:37:21<Tarrant>chowmeined: I doubt you would have an issue.
05:40:04<Beelsebob>works fine on solaris at many unis I know of
05:40:14<kyagrd>is there a nice documentation for the chart library?
05:40:28<kyagrd>Even the hompage API docs has broken links :-(
05:47:36<cygnus>Library preference / stability / usefulness question: nanocurses or hscurses?
05:51:52<kyagrd>If anynoe has pointers to examples of Chart library using error bars I would appreciate it.
05:57:39<bos>@seen dons
05:57:40<lambdabot>dons is in #haskell-in-depth, #gentoo-haskell, #concatenative, #arch-haskell, #darcs, #yi, #xmonad, #ghc and #haskell. I don't know when dons last spoke.
06:00:25<mriou>I have something that sounds like a very simple question but I've been searching for an hour without finding
06:00:35<mriou>how do you get the current time in ms
06:00:38<mriou>?
06:00:54<mriou>preferably as an Int :)
06:11:58<sm>mriou: find it ?
06:36:37<Cale>mriou: Data.Time.Clock.getCurrentTime :: IO UTCTime
06:37:15<Cale>mriou: Oh, I suppose that measures it in seconds
06:37:34<Cale>oh... gone
06:40:21<dmwit>UTCTime is supposed to have as much accuracy as your machine offers, up to picoseconds.
06:40:23<pumpkin>you seem to have bad luck with that :)
06:40:26<dmwit>...I thought.
06:40:48<Cale>oh, yes, I see
06:40:49<dmwit>I guess I'd better check that before I claim it, huh?
06:40:59<Cale>That DiffTime in there is arbitrary resolution
06:41:13<dmwit>right
06:41:15<Cale>up to 10^-12 seconds anyway
06:42:23<Cale>If you're going to go that far, why not just use Planck time units? :)
06:42:30<dmwit>=)
06:44:36<Cale>Heh, measure all times as integers in Planck time units since the big bang.
06:44:49<Cale>type Time = Nat
06:46:01<pumpkin>lol
06:46:49<dmwit>ACTION proposes a Prelude category on Hackage.
06:46:51<pumpkin>1e-44 s
06:46:59<dmwit>Prelude.Dmwit, Prelude.Cale, Prelude.Pumpkin, etc.
06:46:59<pumpkin>that might be a little extreme
06:47:11<pumpkin>Prelude.Chopin
06:47:14<dmwit>=D
06:47:44<Cale>It takes about 10^20 Planck time units for light to travel the diameter of a proton.
06:48:05<hatds>I''d still want Time = Integer though for negative times
06:48:23<pumpkin>http://www96.wolframalpha.com/input/?i=age+of+universe+in+planck+time
06:48:25<Cale>To refer to times before the time at which time has meaning?
06:48:31<hatds>yes
06:49:07<pumpkin>wolfram alpha disappointed me
06:49:12<pumpkin>I asked planck time since big bang
06:49:15<pumpkin>and it hadn't a clue
06:49:23<pumpkin>had no clue?
06:49:30<pumpkin>hadn't a clue feels a little awkward
06:49:47<dmwit>Expand the contraction for even more awkwardness.
06:50:03<dmwit>How about making it a positive statement?
06:50:07<dmwit>"It was clueless."
06:50:12<pumpkin>:)
06:50:13<cads>"ain't had no clue"
06:50:19<Cale>It was without clue.
06:50:29<pumpkin>of clues, it certainly had none
06:50:40<cads>"di'n kno shiut"
06:50:49<Cale>As for clues, didn't exist.
06:51:03<cads>I'd like to see if it knows the topological genus of random objects
06:51:04<pumpkin>wow, I can tell it's early saturday morning
06:51:21<pumpkin>I'm such a cool kid
06:51:28<pumpkin>waiting for my GHC to compile on a friday night
06:52:16<sm>evening all
06:52:27<sm>anyone interested in hacking on dons' rss2irc a little ?
06:52:31<pumpkin>sm: it ain't evening here, you insensitive clod!
06:52:45<dmwit>I for one welcome our new zoneless overlords.
06:52:51<sm>good {timeofday} pumpkin
06:53:07<sm>just a little local colour
06:53:11<pumpkin>NOT EVERYONE HAS SOPHISTICATED IRC CLIENTS THAT PERFORM SUBSTITUTIONS, YOU INSENSITIVE CLOD
06:53:16<pumpkin>:(
06:53:27<dmwit>Ew, you spilled some 'u' in your color.
06:53:35<pumpkin>remind me how shitty my nc client is
06:53:47<pumpkin>:)
06:53:52<Gracenotes>:d
06:53:53<Cale>こんばんは、みんなさん!
06:53:59<pumpkin>:o
06:54:10<Gracenotes>:O
06:54:18<Cale>へ_へ
06:54:20<pumpkin>こんばんはってじゃない!
06:54:23<pumpkin>lol
06:54:27<Gracenotes>what you say
06:54:29<pumpkin>my japanese has gotten so terrible
06:54:48<pumpkin>ACTION needs to go back
06:56:36<pumpkin>鉛筆は赤いですよ!
06:56:42<pumpkin>there, back to basics :P
06:56:54<Gracenotes>ay. I never learned any of the alphabets
06:57:09<Cale>基地はすべて我々の物だ!
06:57:23<pumpkin>lol
06:57:32<Gracenotes>¡What is this now!
06:57:39<pumpkin>somebody set up us the bomb!
06:57:48<Cale>"All your base are belong to us."
06:58:41<Gracenotes>what you say
06:59:00<Cale>ACTION invents an even worse literal translation: as for base, all us's thing is
06:59:15<pumpkin>wow, that is awesomely bad
06:59:33<pumpkin>+5 points for genitivizing us
06:59:50<Gracenotes>genitivizing? sounds painful
06:59:59<Cale>us's
07:00:06<pumpkin>couldn't think of a better word
07:00:08<pumpkin>so I made one up
07:01:11<Gracenotes>ACTION is now watching Ponyo on the Cliff by the Sea
07:01:26<Gracenotes>sort of, uh, Little Mermaid. Except Japanese and with toddlers.
07:01:42<Cale>base <topic marker> all/entirely we <genitive marker> thing <declarative particle>
07:02:07<Gracenotes>and without the musical
07:02:13<Millz|CERN>did you guys know that IT guys at cern dont even know haskell? ;o thats an outrage
07:02:21<pumpkin>terrible!
07:03:15<Millz|CERN>indeedo
07:03:30<Millz|CERN>if they'd run haskell on lhc it wouldnt have broken
07:03:31<ski>(Gracenotes : not Mizuno's "Princess Mermaid", then ?)
07:03:31<Millz|CERN>!
07:03:38<Cale>I ACCIDENTALLY ALL YOUR BASE
07:04:01<pumpkin>zomg (xzibit meme)
07:04:27<Gracenotes>ski: uh... don't think so :3
07:04:38<ski>ACTION grins
07:04:50<Cale>Millz|CERN: They could even have used the LHC compiler.
07:05:06<Millz|CERN>Large Haskell Compiler??
07:05:14<pumpkin>lemmih's haskell compiler
07:05:19<Gracenotes>How is anime formed?
07:05:22<Gracenotes>How cels become shadded?
07:05:28<Millz|CERN>ah
07:05:30<Millz|CERN>never heard of it
07:05:38<pumpkin>you need to do way instain fullmetal alchemist
07:05:43<Millz|CERN>Gracenotes, you dont want to know...
07:05:50<p_l>Gracenotes: no longer done this way, now it's digital and quite often with procedural stuff and 3D
07:05:52<Cale>http://lhc.seize.it/
07:05:54<pumpkin>who kill thier mothers because these mother cant frigth back?
07:06:09<Gracenotes>p_l: yeah :)
07:06:20<Gracenotes>even south park uses 3D rendering
07:06:37<p_l>Gracenotes: Though, look at Hoshi no Koe.
07:06:47<pumpkin>it was in the news this mroing, two brothers in ar who had used 錬金術 on their 母!
07:06:51<Millz|CERN>pumpkin, is the code faster than with ghc?
07:06:57<pumpkin>Millz|CERN: it plans to be
07:07:01<Millz|CERN>lol
07:07:06<Millz|CERN>gud
07:07:31<p_l>Gracenotes: author (yes, singular) got a distinctive CG style and seems to have used rather frame-by-frame animation (though completely on his Mac, not analog)
07:09:12<pumpkin>ACTION is punishing gmp's integers
07:09:47<pumpkin>and GHC's
07:10:33<hatds>is it possible to import constructors unqualified without importing the type unqualified?
07:10:48<dons>bos: pong.
07:12:10<Cale>hatds: I think it might be possible using more than one import
07:12:41<Cale>hatds: But why? Qualified imports in types usually look terrible :)
07:12:45<kyagrd>Cale: oh when has been nubBy been broken?? that's scarey I just saw your post
07:13:00<Cale>kyagrd: I'm pretty sure it wasn't broken in 6.8
07:13:33<hatds>doesn't look like you can say import Mod(constructor)
07:14:03<dmwit>hatds: Oh, does import Mod(Type(Constructor)) import both Type and Constructor?
07:14:36<Cale>dmwit: I'm afraid it does.
07:14:50<dmwit>ACTION doesn't know any other way to import constructors
07:14:51<pumpkin>hac phi needs some hardcore optimization projects
07:14:52<sm>hmm, cabal-install no longer needs Setup.hs ?
07:15:00<dmwit>pumpkin: Bring one!
07:15:01<dmwit>=D
07:15:02<kyagrd>Cale: In Hugs it's still right. What an odd.
07:15:13<hatds>dmwit: yes
07:15:27<pumpkin>dmwit: I'm tempted to, but I'm not sure which, and I don't know whether many people will want to work on stuff like that
07:15:42<Cale>kyagrd: Someone must have messed with it, and didn't think to check that the behaviour was the same for an asymmetric relation :)
07:16:11<Cale>kyagrd: after all, people usually expect that it'll get used with equivalence relations, but it's much more useful than that.
07:17:11<cads>> foldl (\ (a1, a2) (b1, b2) -> (b1 + a1 * (1 - b2), a2)) (0,0)
07:17:12<lambdabot> Overlapping instances for GHC.Show.Show ([(t1, t1)] -> (t1, t))
07:17:12<lambdabot> arising ...
07:17:27<hatds>the reason I want to qualify types is that I have a feature matrix situation, and having a module of functions that look like f :: Backend.Type -> Frontend.Type is clearer, but the constructor names are clear from context
07:19:24<cads>> foldl (\ (a1, a2) (b1, b2) -> (b1 + a1 * (1 - b2), a2)) (0,0) [(1 ,1), (0.5, 1), (0.1, 1), (0.3, 3)]
07:19:24<lambdabot> (9.999999999999998e-2,0)
07:19:44<cads>> foldr (\ (a1, a2) (b1, b2) -> (b1 + a1 * (1 - b2), a2)) (0,0) [(1 ,1), (0.5, 1), (0.1, 1), (0.3, 3)]
07:19:45<lambdabot> (9.999999999999998e-2,1.0)
07:20:27<kyagrd>> [1..] :: Integer
07:20:28<lambdabot> Couldn't match expected type `GHC.Integer.Internals.Integer'
07:20:37<kyagrd>> [1..] :: [Integer]
07:20:38<lambdabot> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28...
07:20:52<kyagrd>> [1,-1..] :: [Integer]
07:20:54<lambdabot> [1,-1,-3,-5,-7,-9,-11,-13,-15,-17,-19,-21,-23,-25,-27,-29,-31,-33,-35,-37,-...
07:21:29<pumpkin>, length . show $ 123456789 ^ 54321
07:21:31<lunabot> 439540
07:21:41<kyagrd>> filter (0>) [1,-1..] :: [Integer]
07:21:42<lambdabot> [-1,-3,-5,-7,-9,-11,-13,-15,-17,-19,-21,-23,-25,-27,-29,-31,-33,-35,-37,-39...
07:21:43<pumpkin>mmorrow: what machine does lunabot run on?
07:21:53<kyagrd>> filter (<0) [1,-1..] :: [Integer]
07:21:54<lambdabot> [-1,-3,-5,-7,-9,-11,-13,-15,-17,-19,-21,-23,-25,-27,-29,-31,-33,-35,-37,-39...
07:22:01<kyagrd>> filter (>0) [1,-1..] :: [Integer]
07:22:06<lambdabot> mueval-core: Prelude.read: no parse
07:22:06<lambdabot> mueval: ExitFailure 1
07:22:15<mmorrow>pumpkin: what do you mean by what machine? (the arch or the url/location?)
07:22:25<pumpkin>mmorrow: I mean, what is its POWA
07:22:30<pumpkin>that was a pretty fast response
07:22:35<mmorrow>heh
07:22:37<kyagrd>> :t forkIO
07:22:38<lambdabot> <no location info>: parse error on input `:'
07:22:41<mmorrow>um, i'll check
07:22:44<kyagrd>> @type forkIO
07:22:45<lambdabot> <no location info>: parse error on input `@'
07:22:48<pumpkin>not important, was just curious :P
07:22:52<kyagrd>@type forkIO
07:22:53<lambdabot>Not in scope: `forkIO'
07:23:01<kyagrd>@type Control.Concurrent.forkIO
07:23:02<lambdabot>IO () -> IO GHC.Conc.ThreadId
07:23:05<mmorrow>pumpkin: it has 8 cores, not sure about mem off the top of my head
07:23:10<pumpkin>ah ok
07:23:17<mmorrow>pumpkin: (it's a hosted box though, so in a vm surely)
07:23:21<pumpkin>ah
07:23:54<kyagrd>> print "hello, world"
07:23:55<lambdabot> <IO ()>
07:24:08<cads>hey you guys, is it possible to find g and a such that foldr g a = foldl f (0,0) where f = (\ (a1, a2) (b1, b2) -> (b1 + a1 * (1 - b2), a2))? Here, f is neither associative nor commutative
07:24:39<mmorrow>pumpkin: hehe,
07:24:46<mmorrow>Mem: 8192 1109 7082 0 0 0
07:24:52<pumpkin>nice :)
07:24:59<mmorrow>can that be right? (it's a Xeon, can they have > 4GB??)
07:25:15<pumpkin>yeah, my mac pro's xeon supports way more mem than that
07:25:17<cads>and if that is impossible, would it be possible to find h, g, and a such that h (fold g a v) = fold f (0,0) v
07:25:19<pumpkin>depends on the xeon though
07:25:26<mmorrow>, maxBound :: Int
07:25:27<lunabot> 2147483647
07:25:34<pumpkin>oh, you're on a 32-bit OS?
07:25:35<mmorrow>, maxBound :: Word
07:25:36<lunabot> 4294967295
07:25:38<mmorrow>yeah
07:25:43<MyCatVerbs>> maxBound :: Word
07:25:43<kyagrd>@type System.IO.Unsafe.unsafePerformIO
07:25:43<mmorrow>which is why i'm confused
07:25:44<lambdabot> 18446744073709551615
07:25:44<lambdabot>forall a. IO a -> a
07:25:44<pumpkin>must be using PAE then
07:25:50<mmorrow>hmm
07:25:58<kyagrd>@type unsafePerformIO
07:25:59<lambdabot>Not in scope: `unsafePerformIO'
07:26:00<pumpkin>it's a linux?
07:26:04<mmorrow>pumpkin: http://hpaste.org/cpu.txt
07:26:10<mmorrow>pumpkin: yeah, centos
07:26:23<kyagrd>> System.IO.Unsafe.unsafePerformIO (print "hello world")
07:26:24<lambdabot> Not in scope: `System.IO.Unsafe.unsafePerformIO'
07:26:25<MyCatVerbs>Technically there's nothing stopping you from building a machine where sizeof(int)==4 and sizeof(void*)==8. It's entirely allowed by the C standard.
07:26:40<pumpkin>sizeof(int) is usually 4 isn't it? even on 64-bit machines?
07:26:44<pumpkin>it's long that changes, I thought
07:26:47<mmorrow>yeah
07:27:09<kyagrd>Alas, I can do unsafePerformIO with lambdabot :)
07:27:12<pumpkin>but yeah, the worst bit of c, I think, is the ****ing numeric types
07:27:15<kyagrd>Alas, I can't do unsafePerformIO with lambdabot :)
07:27:19<Twey>kyagrd: Oh?
07:27:20<Twey>Oh
07:27:21<Twey>Haha
07:27:22<mmorrow>pumpkin: ah, did you see my comment on running initialization code?
07:27:28<Twey>That's less interesting :-P
07:27:36<pumpkin>mmorrow: yeah, but my damn client cut it off... what was the URL for the code?
07:27:40<mmorrow>pumpkin: (you'd need to mess with ghc's codegen ;), but ,,)
07:27:46<mmorrow>pumpkin: one sec
07:27:52<MyCatVerbs>pumpkin: nnnn... no, I think it's usually set at 8 too anyway.
07:28:04<pumpkin>MyCatVerbs: not on my machine, but as you said the standard allows it :)
07:28:05<mmorrow>pumpkin: http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2568
07:28:25<pumpkin>mmorrow: well, I'm pulling GMP out of GHC and wanted to set GMP's allocation functions without having to check a "runonce" thingy with every function call
07:28:27<MyCatVerbs>pumpkin: AFAIK people set sizeof(int)==sizeof(void*) just because so much faulty-ass C code assumes that. :/
07:28:42<mmorrow>pumpkin: so it looks like the first jump into a module sets off a chain of jumps that recursively init all its dep modules
07:28:46<pumpkin>mmorrow: interesting
07:29:06<mmorrow>pumpkin: so all you'd need to do is add a single call in there to your init code
07:29:13<pumpkin>I could be sneaky and set up an ffi export that does that, but then I'd need to find a way to rename the default one
07:29:26<pumpkin>and jump into it
07:29:28<kyagrd>> head (filter (<0) [1,..]) :: Integer
07:29:29<lambdabot> <no location info>: parse error on input `..'
07:29:38<kyagrd>> head (filter (<0) [1..]) :: Integer
07:29:42<lambdabot> mueval-core: Prelude.read: no parse
07:29:43<lambdabot> mueval: ExitFailure 1
07:29:49<pumpkin>gmp is pretty fast!
07:29:53<mmorrow>yeah, i was trying to think of a way to do it without needing to tweak ghc's asm output, but i came up with no ideas
07:30:02<mmorrow>pumpkin: yeah, lightning
07:30:15<pumpkin>I'm coming to appreciate it as I'm nearing half an hour on integer-simple for that calculation I just gave lunabot
07:30:25<mmorrow>hehh
07:31:58<pumpkin>mmorrow: I guess since I'm playing with GHC, I could add in some sort of facility to have a "call me on startup" function
07:32:03<kyagrd>> nubBy (<) [1,2]
07:32:04<lambdabot> [1,2]
07:32:20<pumpkin>mmorrow: and maybe a "on shutdown do this" function too
07:32:21<mmorrow>pumpkin: totally, that could be interesting
07:32:33<pumpkin>since many libraries need initialization
07:33:06<mmorrow>pumpkin: just be careful how you phrase what you're doing ;) on account of the "top-level <-" uproar :)
07:33:18<pumpkin>lol, I haven't heard of that
07:33:38<pumpkin>people don't like the idea?
07:33:50<mmorrow>i'm trying to find the haskell-cafe thread for you now..
07:33:58<pumpkin>it seems like it should be possible as part of the FFI interface as that's the only kind of case in which it's useful
07:34:13<pumpkin>as it's rare for haskell libraries to have global state
07:35:04<mmorrow>pumpkin: heh, i think it started in this month http://www.haskell.org/pipermail/haskell-cafe/2008-August/
07:35:13<kyagrd>> read "1e10" :: Integer
07:35:14<lambdabot> 10000000000
07:35:27<kyagrd>> read ("1e"++show 10) :: Integer
07:35:28<lambdabot> 10000000000
07:35:31<pumpkin>mmorrow: found it, thanks
07:35:40<kyagrd>> read ("1e"++show(10^10)) :: Integer
07:35:45<lambdabot> mueval-core: Prelude.read: no parse
07:35:45<lambdabot> mueval: ExitFailure 1
07:35:57<kyagrd>> read ("1e"++show(2^10)) :: Integer
07:35:59<lambdabot> 100000000000000000000000000000000000000000000000000000000000000000000000000...
07:36:13<pumpkin>mmorrow: can only find two mentions of it though
07:36:17<pumpkin>http://www.haskell.org/pipermail/haskell-cafe/2008-August/046437.html
07:36:26<pumpkin>oh, there's more further down
07:36:29<mmorrow>heh
07:37:23<mmorrow>pumpkin: it continues into the next month as well
07:37:27<pumpkin>ack
07:37:31<kyagrd>> even (read ("1e"++show(2^10)))
07:37:33<lambdabot> True
07:37:41<kyagrd>> even (read ("1e"++show(3^10)))
07:37:42<lambdabot> True
07:37:45<kyagrd>> even (read ("1e"++show(4^10)))
07:37:46<lambdabot> True
07:37:50<kyagrd>> even (read ("1e"++show(5^10)))
07:37:54<lambdabot> True
07:37:58<kyagrd>> even (read ("1e"++show(6^10)))
07:38:03<lambdabot> mueval-core: Prelude.read: no parse
07:38:03<lambdabot> mueval: ExitFailure 1
07:38:39<Axman6>> 6^10
07:38:40<lambdabot> 60466176
07:38:48<Axman6>> 5^10
07:38:49<lambdabot> 9765625
07:38:50<pumpkin>mmorrow: what's ACIO?
07:39:38<mmorrow>pumpkin: i don't know/recall really
07:39:48<sm>dear lazyweb.. how would you refactor this rss2irc code ? I want to give help an explicit type signature. http://gist.github.com/124760
07:40:15<sm>currently it seems to have two types depending on context, I'm surprised it compiles
07:41:25<dmwit>:t exitWith
07:41:27<lambdabot>Not in scope: `exitWith'
07:41:35<dmwit>:t System.Environment.exitWith
07:41:36<lambdabot>Not in scope: `System.Environment.exitWith'
07:41:57<dmwit>Anyway, exitWith :: Something -> IO a
07:42:06<dmwit>It never returns, so you can assign it any type you like.
07:42:18<mmorrow>pumpkin: this looks like the (a?) first mention of it http://www.haskell.org//pipermail/haskell-cafe/2004-November/007680.html
07:42:34<dmwit>sm: Couldn't you have just loaded that in ghci and asked for the type of help?
07:42:45<ski>@hoogle exitWith
07:42:46<lambdabot>System.Exit exitWith :: ExitCode -> IO a
07:42:54<sm>sure, I can see that type
07:43:17<sm>but you see how help is used twice ? it's a different type in each case. I can't add an explicit signature
07:43:24<sm>why does this work ?
07:43:54<ski> help :: IO a
07:43:56<ski>should work
07:44:21<sm>aha! right you are
07:44:26<dmwit>sm: Why can't you add an explicit signature?
07:45:04<sm>so it has a single type, it's just not fully specified
07:45:14<sm>neat
07:45:16<Axman6>> return undefined
07:45:18<lambdabot> No instance for (GHC.Show.Show (m a))
07:45:18<lambdabot> arising from a use of `M8863138728...
07:45:24<Axman6>:t return undefined
07:45:25<lambdabot>forall a (m :: * -> *). (Monad m) => m a
07:47:08<ski>@type System.Exit.exitWith System.Exit.ExitSuccess
07:47:09<lambdabot>forall a. IO a
07:47:11<pumpkin>mmorrow: I see
07:47:25<pumpkin>mmorrow: wow, integer-simple is still chugging away at that calculation :) maybe I should've tried something smaller
07:47:41<mmorrow>heh
07:48:07<mmorrow>(what's the calculation? is it one where gmp would be using a fourier transform?)
07:48:16<pumpkin>yeah
07:48:20<pumpkin>it's what I gave lunabot before
07:48:26<pumpkin>length . show $ 123456789^54321
07:48:26<mmorrow>oh, i missed that
07:48:30<mmorrow>ah
07:48:40<sm>next question: seconds = 10 ^ 6 gives: Warning: Defaulting the following constraint(s) to type `Integer' `Integral t' arising from a use of `^' ... and I haven't been able to silence it by adding :: Int or ::Integer . What's this all about ?
07:48:51<pumpkin>so it should involve several very large multiplications
07:48:55<pumpkin>which are quadratic in integer-simple
07:49:09<dmwit>:t (^)
07:49:10<lambdabot>forall a b. (Num a, Integral b) => a -> b -> a
07:49:21<dmwit>sm: The (6) there has unknown type.
07:49:49<pumpkin>how many multiplications will ^54321 result in I wonder
07:49:51<pumpkin>@src (^)
07:49:52<lambdabot>x ^ 0 = 1
07:49:52<lambdabot>x ^ n | n > 0 = f x (n-1) x
07:49:52<lambdabot> where f _ 0 y = y
07:49:52<lambdabot> f x n y = g x n
07:49:52<lambdabot> where g x n | even n = g (x*x) (n `quot` 2)
07:49:54<lambdabot> | otherwise = f x (n-1) (x*y)
07:49:56<lambdabot>_ ^ _ = error "Prelude.^: negative exponent"
07:49:56<pumpkin>should be 15 + something
07:50:09<dmwit>> logBase 2 54321
07:50:10<lambdabot> 15.729222418074684
07:50:23<sm>right.. how would I get it to no warn me, by changing the code ?
07:50:29<pumpkin>won't be just 16 though
07:50:41<dmwit>sm: 10 ^ (6 :: Integer)?
07:51:44<sm>right
07:51:58<sm>hmm
07:52:14<sm>when I just added ::Integer it applied to the whole expression ?
07:52:26<dmwit>right
07:52:32<Cale>sm: type annotations extend to the largest expression they can
07:53:17<dmwit>> x ^ 54321
07:53:19<lambdabot> x * x * (x * x) * (x * x * (x * x)) * (x * x * (x * x) * (x * x * (x * x)))...
07:53:22<dmwit>hmm
07:54:05<sm>ah, I never understood that. great
07:54:33<roderyk>I'm writing an app where it looks more and more like I should be heading slowly towards an EDSL, because I have a graphical app for tagging layers / groups with different kinds of metadata and then a set of scripts (I don't mind if these are in haskell for v 0.1) for running experiments on the data. The scripts are numerous in variety, but I think I can keep it sane by keeping them typed (accept specific input and output; chain together as necessary).
07:54:34<roderyk>I'm leaning towards a generic method of tagging the metadata as a tree/map - Map StringKey Val, but I don't want to explicitly write out all the possibilites of Val as an algabraic data structure. Instead I would prefer a generic 'a' (but this of course won't typecheck - Map doesn't allow storing both Double and [Double] in the same instance)
07:54:58<roderyk>any ideas on which direction I should be moving in... (maybe I'm simply trying to do too much at once :))
07:55:12<Cale>roderyk: What *operations* are important for you?
07:55:26<dmwit>> let count 0 = 0; count n | n > 0 = count' (n-1) where count' 0 = 0; count' n = count'' n; count'' n | even n = 1 + count'' (n `quot` 2) | otherwise = 1 + count' (n-1) in count 54321
07:55:28<lambdabot> 21
07:55:32<dmwit>pumpkin: 21!
07:55:34<Cale>If you have a value and all you know is that it's of some type, there is precisely nothing you can actually do with it.
07:55:56<pumpkin>dmwit: excellent! 21 multiplications have taken 50 minutes so far :D
07:55:57<Cale>That is, there are no operations on values of type (exists a. a)
07:56:27<dmwit>ACTION is sure there's a less brain-dead way to calculate that but doesn't care to waste cycles on it
07:56:32<roderyk>lots of things of the sort of: take (x,y,z) groups from [list]; do math/analysis operations; plot result (maybe graphical result, print to file, modify original data)
07:57:04<Cale>So if you want to be able to store many different sorts of values, what is it that they all have in common which will make them useful once you extract them from the datastructure given that you no longer know what type they are?
07:57:55<sm>hmm, sometimes I'd really like an ide that reliably explains any word in the code. Like "get"
07:58:11<roderyk>Cale: well, that's my point. Each specific script knows what "interesting" thing to extract from the same data; you mark up the data once but each script uses it differently
07:58:38<dmwit>sm: "get" is a monad action that returns the current state of a MonadState instance
07:58:44<pumpkin>mmorrow: I'm jealous that your xeon seems to have the monitor cpuid bit set
07:58:45<roderyk>eg. if data is a bezier curve, one script may be interested in its curvature while another in what max/min (x,y) pixel it uses
07:58:52<dmwit>sm: (P.S. that IDE would require an interface to #haskell ;-)
07:58:58<sm>thanks :)
07:59:00<pumpkin>mmorrow: that feature is the bane of my frankenmac pro
07:59:01<sm>not a bad idea
07:59:14<mmorrow>pumpkin: what does that do?
07:59:43<Cale>roderyk: But what if the thing which expects to be looking at a Bezier curve gets something entirely different?
08:00:06<sm>dmwit: course you are just as unaware of this code's namespace as emacs.. are you sure that's the get I'm looking at ?
08:00:17<Cale>roderyk: There are a few solutions to this problem...
08:00:19<pumpkin>mmorrow: some sort of power management thing I think... haven't really looked into it much... apparently it can be turned off and somehow it gets turned off on my CPU just in time for mac os to panic on startup when it looks for it
08:00:39<mmorrow>pumpkin: ooh, yay
08:00:40<Cale>roderyk: There is Data.Dynamic which is ugly and heavy-handed, but rather flexible.
08:00:41<sm>http://joyful.com/darcsweb/darcsweb.cgi?r=rss2irc;a=headblob;f=/Main.hs line 162
08:00:57<roderyk>Cale: well for now we can assume the stringKey is specific to datatype (and we just die/ignore serious issues)
08:01:27<Cale>(In that you can take any Typeable type and stuff it in your Map and later extract the value as a Maybe, and if we try to extract it at the wrong type, we get Nothing
08:01:29<Cale>)
08:01:48<roderyk>Cale: it's more about tagging up the document will sorts of meta-data once; then running lots of separate analysis scripts on it (we assume the scripts are responsible with figuring out if the data is what it wants to use; throws error or something otherwise0
08:02:03<dmwit>sm: No, I'm not sure; and that link doesn't link to Main.hs for me.
08:02:32<dmwit>Actually it does, but my terminal's URL grabber bites.
08:02:38<dmwit>so scratch that
08:02:44<sm>not to worry. I see it's defined 10 lines below :-) Still, I'm interested in tools
08:02:50<jeffwheelerPhone>sm: the definition is just a few lines lower, no?
08:03:05<jeffwheelerPhone>Ah, nevermind me.
08:03:09<sm>thx
08:03:12<dmwit>Right, tools would be nice.
08:03:24<sm>leksah would know, wouldn't it ?
08:03:28<dmwit>Maybe.
08:04:07<sm>still cabal uninstallable for me :/
08:04:09<jeffwheelerPhone>If you used Hasktags with Yi, that might get you the solution.
08:04:12<sm>what's up with that
08:04:16<Cale>ACTION wonders if lambdabot has Data.Dynamic in scope...
08:04:27<Cale>> toDynamic 5
08:04:28<lambdabot> Not in scope: `toDynamic'
08:04:40<Cale>> toDyn 5
08:04:41<lambdabot> <<Integer>>
08:04:44<Cale>aha, good
08:04:45<sm>jeffwheelerPhone: not hasktags with emacs ?
08:04:58<Cale>> [toDyn 5, toDyn "hello", toDyn [1,2,3]]
08:04:59<lambdabot> [<<Integer>>,<<[Char]>>,<<[Integer]>>]
08:05:18<Cale>> map fromDynamic [toDyn 5, toDyn "hello", toDyn [1,2,3]] :: [Maybe Integer]
08:05:19<lambdabot> [Just 5,Nothing,Nothing]
08:05:21<kyagrd>@type toDyn
08:05:22<lambdabot>forall a. (Typeable a) => a -> Dynamic
08:05:23<Cale>> map fromDynamic [toDyn 5, toDyn "hello", toDyn [1,2,3]] :: [Maybe String]
08:05:24<lambdabot> [Nothing,Just "hello",Nothing]
08:05:26<sm>never mind, ignore me.. I do use hasktags and know it works for local code
08:05:29<jeffwheelerPhone>sm: I suppose that'd probably work just as well.
08:05:36<Cale>> map fromDynamic [toDyn 5, toDyn "hello", toDyn [1,2,3]] :: [Maybe [Integer]]
08:05:37<lambdabot> [Nothing,Nothing,Just [1,2,3]]
08:06:03<jeffwheelerPhone>Sorry, I'm oblivously very slow at typing on my phone. ;)
08:06:04<sm>and M-x haskell-hoogle works for things hoogle knows about
08:06:11<sm>heh
08:06:18<jeffwheelerPhone>* obviously
08:06:18<kyagrd>If you want more static type hacking you can also use HList
08:06:28<roderyk>Cale: will look at Data.Typeable, Dynamic, and Generic.... maybe it's time to finally get around to reading syb as well, eh?
08:06:36<Cale>kyagrd: Well, in this case we need a multi-typed Map
08:07:09<roderyk>Cale: thanks for the input, will skim the apis and see if it sounds like the best approach for a prototype :)
08:07:09<Cale>roderyk: Generic is... probably not relevant to this specific thing, though the problem vaguely sounds like it might be useful
08:07:19<Cale>roderyk: Another solution is completely different
08:07:25<roderyk>Cale: yes?
08:07:35<jeffwheelerPhone>sm: On the bright side, those issues should be over in about 5 hours.
08:08:02<Cale>roderyk: It's essentially the OO-solution. Decide the operations you want to have on this metadata, and fix that up front. Rather than storing values of different types, store records consisting of the operations.
08:08:14<sm>oh goody, which issues ?
08:08:51<Cale>and use the fact that functions capture the values (of any type!) of variables which occur in their definitions.
08:09:18<jeffwheelerPhone>sm: phone typing, via the Pre
08:09:54<roderyk>Cale: that might be difficult; I'll think about it, but that's how I've been doing it and I keep hitting the wall that essentially the number of kinds of meta-data are smaller than the possible operations (which will grow at much faster rate than the data)
08:10:08<sm>Pre ?
08:10:17<Cale>roderyk: okay, then that sounds like the algebraic type way is better
08:10:21<sm>new toys from apple ?
08:11:38<Cale>roderyk: Remember that every function which includes a fall-through case for data which is tagged with the wrong data constructor will not necessarily have to be updated if you add a case to the datatype
08:11:53<Gracenotes>:#
08:12:39<Cale>another possibility is just constructing multiple Maps, one for each type of meta-data you're collecting
08:13:25<Cale>(possibly all collected together into one record which you thread through the algorithm which is meant to collect it)
08:14:10<roderyk>Cale: right, I'm going to see if I can map out all the possibilities over a cup of tea. Thanks for the insights :)
08:15:04<Cale>roderyk: It's a rare case where you really don't know all the possible types for the program you're writing.
08:15:22<Cale>It happens with libraries, but not so much for applications.
08:16:13<roderyk>Cale: I think the issue stems from the variable combination of primitives available. Given a small set of primitives, each actual operation may require a different tuple/list of them
08:16:26<roderyk>this is why started converting it multiple maps
08:17:32<roderyk>so I started adding group primitives like 'GroupList :: [Primitive], GroupTuple (Primitive, Primitive)', etc
08:18:21<roderyk>so I figured it might be easier to just provide a generic Map key val, and have each operation figure out if it has all necessary data to continue
08:19:36<ziman>what's the preferred way to work with a mysql database from haskell (which lib to use)?
08:19:46<hatds>even when you "know" the types for your program, you don't really know until it's actually done. There are many isomorphic and nearly isomorphic ways of nesting types, and there are decisions to be made on whether two related types should be wholly separate or alternatives of a unified type
08:20:32<mux>mmm, a type-safe printf via TH - Oleg strikes again
08:39:41<pltonik>hello all. could someone explain to me how 'flip id' works? both from a technical and conceptual level? i must be missing something obvious but 'flip id' makes no sense to me nor do i understand what it does. i found it's use in the System.Console.GetOpt second example
08:40:00<dmwit>id :: (a -> b) -> (a -> b)
08:40:02<mauke>pltonik: every function takes exactly one argument
08:40:03<pltonik>i know what the individual functions do
08:40:10<dmwit>flip id :: a -> (a -> b) -> b
08:40:30<pltonik>yup and thats where i get stuck
08:40:49<dmwit>So flip id takes an argument and a function, then applies that function to the argument.
08:41:04<dmwit>flip id argument f = id f argument = f argument
08:42:19<Cale>It might help to realise that (a -> b) -> (a -> b) is the same as (a -> b) -> a -> b
08:42:26<pltonik>why does 'flip id arg f = id f arg'? flip requires a function which takes two arguments but here you are passing a function which takes one argument plus f
08:42:27<Cale>since -> associates to the right
08:42:42<Cale>> id reverse "hello"
08:42:43<lambdabot> "olleh"
08:42:53<mauke>pltonik: every function takes exactly one argument
08:43:01<mauke>pltonik: there are no functions with two arguments
08:43:07<Cale>pltonik: As you can see, you can think of id as a two parameter function which takes a function and an argument and applies the function to that argument.
08:43:07<Twey>(((flip id) argument) f) = ((id f) argument) = (f argument)
08:43:20<dmwit>pltonik: flip takes a function of one argument that returns another function.
08:43:26<Cale>flip ($) would have been clearer though
08:43:37<dmwit>pltonik: id can play the role of a function that takes one argument and returns another function, provided that argument is itself a function.
08:43:43<pltonik>mauke: indeed, but i still have trouble looking at it that way or to put it in other words it doesnt make it any clearer for me.
08:43:48<dmwit>pltonik: So id can be a valid argument to flip. =)
08:44:11<Cale>pltonik: I think the two-parameter way is easier to think about in this cas
08:44:14<Cale>case*
08:44:20<Cale>id f x = f x
08:44:36<Cale>and flip g x y = g y x
08:45:00<pltonik>oh man, i need to digest this. give me a sec guys, but thanks for the input thusfar :).
08:45:09<Twey>Hehe
08:45:10<Cale>so flip id x f = id f x = f x
08:45:18<Twey>Hooray for the brain-bendingness of n-ary functions
08:45:59<FunctorSalad>I wonder why they're less intuitive to us than tuples
08:46:25<Twey>‘flip id f x’ can also be written as ‘($ x) f’
08:46:34<Twey>FunctorSalad: Speak for yourself
08:46:48<dmwit>FunctorSalad: Tuples aren't usually n-ary. Perhaps you should ask why they're less intuitive than lists.
08:46:49<Twey>It took me ages to puzzle out the point of tuples when I first encountered them
08:46:59<mauke>dmwit: what
08:47:10<pltonik>ohhhhhh there it is, the proverbial lightbulb
08:47:35<dmwit>ACTION pauses to consider whether what he just said really makes sense
08:47:45<pltonik>lol no no it does
08:47:53<FunctorSalad>dmwit: I meant as args... so lists would correspond to variadics functions
08:48:02<pltonik>it was staring at me the whole time, but yea, went right over my head
08:48:26<mauke>ACTION stares at pltonik the whole time
08:48:32<ray>dmwit: i don't think it makes sense
08:48:41<ray>:)
08:48:52<dmwit>Yeah, I guess not.
08:49:05<ray>better luck next time
08:49:15<FunctorSalad>Twey: really? ;)
08:49:41<FunctorSalad>granted, the point in haskell maybe
08:49:42<pltonik>mauke: umm are you implying that you're over my head? ...how'd u get there?
08:50:02<mauke>WEEED
08:50:32<Twey>Hahahaha
08:50:33<pltonik>come down... lol
08:51:58<sm>success.. rss2irc now supports atom feeds
09:14:51<pltonik>grr i'm doing my head in again looking at this flip id thing... i get it using Cale's two-parameter approach but looking at the type signitures puts me in an endless cycle - and the more i stir the muddier it gets
09:18:45<pltonik>dmwit: when you say flip takes a function of one argument and returns another function do you mean: flip :: (a->b)->(c->b->a->c)?
09:18:51<ray>:t flip
09:18:52<lambdabot>forall a b c. (a -> b -> c) -> b -> a -> c
09:19:06<mauke>flip :: (a -> b -> c) -> (b -> a -> c)
09:19:24<pltonik>mauke: but then it takes a function of two arguments not one?
09:19:26<dmwit>pltonik: What I actually said was that flip takes a function of one argument that returns another function.
09:19:27<mauke>> let other_function = flip (-) in other_function 3 5
09:19:28<lambdabot> 2
09:19:42<mauke>flip :: (a -> (b -> c)) -> (b -> (a -> c))
09:19:45<dmwit>pltonik: i.e. flips first argument is a (a function that takes one argument and returns another function)
09:20:08<pltonik>dmwit: ahhhhhh
09:20:39<pltonik>another meal to digest...
09:29:51<pltonik>bah, i was hoping to figure out how id fits into that type signiture for filp but i just cant. help?
09:30:05<dmwit>pltonik: id :: a -> a
09:30:11<dmwit>pltonik: However, "a" is a type variable.
09:30:17<dmwit>pltonik: So you can put any type you like there.
09:30:18<dmwit>So!
09:30:19<dmwit>:t flip
09:30:21<lambdabot>forall a b c. (a -> b -> c) -> b -> a -> c
09:30:22<mauke>flip takes (a -> (b -> c))
09:30:33<dmwit>pltonik: Let's rename some variables.
09:30:40<pltonik>yes, lets lol
09:30:49<dmwit>flip :: (b -> c -> d) -> (c -> b -> d)
09:30:50<mauke>can't I just set a = b -> c?
09:30:54<pltonik>im getting royally brainwashed
09:31:05<dmwit>pltonik: Okay?
09:31:10<pltonik>ok
09:31:29<dmwit>pltonik: So, we need to match (a) with (b -> c -> d).
09:31:41<pltonik>still with yo
09:31:42<dmwit>sorry
09:31:43<pltonik>*you
09:31:44<dmwit>That's not right.
09:31:50<dmwit>We need to match (a -> a) with (b -> c -> d).
09:32:01<pltonik>yea i know what you meant
09:32:11<dmwit>Now, we can notice that (b -> c -> d) = (b -> (c -> d)).
09:32:26<pltonik>mkay
09:32:26<dmwit>So (a -> a) = (b -> (c -> d)) means both (a = b) and (a = c -> d).
09:32:33<dmwit>i.e. b = c -> d.
09:32:42<dmwit>Substituting, we end up with
09:32:48<dmwit>id :: (c -> d) -> (c -> d)
09:32:49<dmwit>and
09:33:15<dmwit>flip :: ((c -> d) -> (c -> d)) -> (c -> (c -> d) -> d)
09:34:13<Twey>i.e. id :: (c -> d) -> c -> d, and flip :: ((c -> d) -> c -> d) -> c -> (c -> d) -> d
09:34:18<dmwit>pltonik: And, in fact, this is exactly the algorithm the type-checker uses; it's called unification. When you have an equation for an arrow type, you reduce it into two equations, one for each side of the arrow.
09:34:42<dmwit>pltonik: That was the step where we went from (a -> a = b -> c -> d) to (a = b and a = c -> d).
09:36:04<pltonik>that looks like it does simple algebra to solve for the 'unknown'
09:36:14<dmwit>Pretty much, yup!
09:36:20<mauke>only stupider
09:36:23<pltonik>lol
09:36:38<pltonik>at the moment i'd say only im stupider
09:37:10<mauke>we've all been there
09:37:51<hackagebot>geniconvert 0.17.1
09:39:14<mauke>'flip id' is the concentrated essence of currying/polymorphism
09:39:36<Twey>Hehe
09:39:40<ivanm>mauke: concentrated into only 7 chars!
09:39:42<ivanm>;-)
09:39:52<pltonik>yea i hate being a newbie again. back where i'm from - 'imperative land' - i was king in my little town. here - 'functional land' - i just dont know who i am anymore lol.
09:39:56<mauke>I'd say once you really get it, you've mastered currying
09:39:58<Twey>Slash Haskell's specific approach to function application :-P
09:40:06<pltonik>mauke: it sure is concentrated!
09:40:46<mauke>more concentrated awesome/brain damage: fmap fix return
09:41:18<ivanm>Twey: "Slash Haskell"?
09:41:24<ivanm>what is it slashed with?
09:41:36<ivanm>mauke: that's less concentrated, is it not?
09:41:42<Twey>Common Lisp. It's a very hot fanfic.
09:42:02<ivanm>ahhh
09:42:15<dmwit>:t fix const
09:42:16<lambdabot> Occurs check: cannot construct the infinite type: a = b -> a
09:42:16<lambdabot> Probable cause: `const' is applied to too few arguments
09:42:17<lambdabot> In the first argument of `fix', namely `const'
09:42:23<dmwit>:t fix . const
09:42:24<lambdabot>forall a. a -> a
09:42:25<mauke>this one requires type classes (constructor classes at that), the Y combinator, functors, monads, the ((->) e) instance, currying (+ at the type level, see previous point)
09:42:28<dmwit>uh huh
09:42:45<Twey>mauke: Bloody hell.
09:42:54<Twey>That's beyond me.
09:42:57<Twey>:(
09:43:01<mauke>doh ho ho
09:43:05<dmwit>Twey: You can get it. It's a fun puzzle. =)
09:43:19<dmwit>Twey: When you figure it out the first time, you'll be delighted.
09:43:19<pltonik>dmwit: there still seems to be a step missing after getting to that final signiture for flip and id - to me at least. i mean what the hell does that signiture imply?
09:43:24<dmwit>After that it's just disgust. ;-)
09:43:28<mauke>@quote fmap.fix.return
09:43:28<lambdabot>mauke says: fmap fix return is the e^(i*pi)+1 of haskell
09:43:32<ivanm>AFAICT, it does nothing.... maybe I'm not using fancy enough examples?
09:43:40<dmwit>ivanm: exactly right
09:43:56<ivanm>dmwit: identity monad?
09:43:57<pltonik>dmwit: besides, how do you go from that signiture to the simplicity of 'flip id x f = f x'?
09:44:00<dmwit>pltonik: "imply"?
09:44:09<dmwit>ivanm: No, ((->) e) monad (surprise!).
09:44:18<dmwit>ivanm: It ends up being the identity function, though.
09:44:23<ivanm>dmwit: duh
09:44:44<dmwit>pltonik: Oh, the signature is not how you get that equation.
09:44:51<dmwit>pltonik: You get that equation from the definition of flip.
09:44:53<dmwit>?src flip
09:44:53<lambdabot>flip f x y = f y x
09:45:14<mauke>flip id x y == id y x == y x
09:45:18<dmwit>flip id x f = id f x = (id f) x = f x
09:45:46<ivanm>heh
09:45:49<ivanm>@quote stereo
09:45:49<lambdabot>omnId says: geez, how many metastereo quotes are going to be @remembered? >_>
09:46:04<Gracenotes>@quote metastereo
09:46:04<lambdabot>omnId says: geez, how many metastereo quotes are going to be @remembered? >_>
09:46:10<Gracenotes>apparently, 1?
09:46:26<Gracenotes>anyway. glorious stereo.
09:46:33<pltonik>hmm maybe i dont know what im asking for here. i was hoping to trace the signiture along with the function currying etc. to see ...mmm something lol. god, this is not the best thing to do right before sleep.
09:46:33<EvilTerran>@quote fugue
09:46:33<lambdabot>monochrom says: Welcome to #haskell, where your questions are answered in contrapuntal fugues.
09:46:42<ivanm>EvilTerran: lol
09:47:06<Gracenotes>better
09:47:09<EvilTerran>in this case, the question being "geez, how many metastereo quotes are going to be @remembered?"
09:47:10<EvilTerran>:D
09:47:20<mauke>@djinn flip :: ((c -> d) -> c -> d) -> c -> (c -> d) -> d
09:47:20<lambdabot>Cannot parse command
09:47:23<mauke>@djinn ((c -> d) -> c -> d) -> c -> (c -> d) -> d
09:47:23<lambdabot>f a b c = a c b
09:47:37<pltonik>i'll keep my questions to myself untill they make sense lol
09:47:49<mauke>so you can recover the definition from the type
09:48:23<pltonik>oh there we go i think thats what i was after.
09:48:50<dmwit>pltonik: Ask mauke how to come up with those definitions. ;-)
09:49:04<mauke>I'm an experienced perl programmer.
09:49:10<pltonik>mauke: how to come up with those definitions. (smily face) lol
09:49:30<dmwit>That's a real rabbit-hole, that one is. Full of parametric polymorphism, logical relations, and some very beautiful mathematics.
09:49:41<dmwit>Or maybe I'm thinking of ?free.
09:49:53<dmwit>Both are harder than they seem like they should be, anyway. =)
09:50:18<mauke>wait, do you mean what @djinn just did?
09:50:46<dmwit>Yeah, it's proof search, isn't it?
09:51:34<dmwit>With some heuristics about what are "good" proofs.
09:51:56<EvilTerran>curry-howard correspondence!
09:52:39<pltonik>mauke: ok i don't see which parts of that signiture 'map' to which f a b or c... in the words of an annoying red head "please explain?"
09:53:10<mauke>how about we write this function uncurried
09:53:20<mauke>flip' :: ((c -> d, c) -> d, c, c -> d) -> d
09:53:39<mauke>hrml, that makes more sense in my head
09:53:55<dmwit>Oh, this should be fun.
09:54:03<pltonik>lol, silence you!
09:54:09<EvilTerran>pltonik, there, @djinn invented an 'f' such that it had the given type
09:54:14<dmwit>You're going to explain flip id using uncurry ($)?
09:54:22<dmwit>That sounds like a losing proposition. =P
09:54:53<mauke>anyway, flip' takes a 3-tuple consisting of: some function, a 'c', and a function from 'c' to 'd'
09:54:57<mauke>it also returns a 'd'
09:54:59<EvilTerran>ACTION finds flip id pretty straightforward
09:55:25<mauke>that first function argument is another function. it takes a function from 'c' to 'd' and a 'c', and returns a 'd'
09:56:03<pltonik>ahh its getting closer to finish now
09:56:14<mauke>we can easily write code of that type: simply call that first function, passing it our 3rd and 2nd argument
09:56:38<mauke>because c = c and c -> d = c -> d
09:56:44<Gracenotes>"flip id" *is* the same as "flip ($)" after all
09:56:55<mauke>flip' (a, b, c) = a (c, b)
09:57:13<mauke>the real flip works the same way, but instead of using tuples for parameter lists, it's all curried
09:57:42<mauke>I still read a -> b -> c -> d as "a function taking a,b,c and returning d"
09:58:27<EvilTerran>but it helps to also be able to read it as, say, "a function taking a, and returning a function taking b, and returning a function taking c, and returning d". or whatever.
09:59:25<mauke>you simply have to know that 'a -> b -> c -> d' is the same as 'a -> (b -> c -> d)' or 'a -> (b -> (c -> d))'
09:59:56<mauke>map is a good example, actually
09:59:57<Gracenotes>EvilTerran: but, there are so many simpler ways of saying it
10:00:06<mauke>map :: (a -> b) -> [a] -> [b]
10:00:07<Twey>I read it as ‘a function from a to be to c to d’
10:00:20<Twey>Which I think captures the essence nicely
10:00:23<EvilTerran>Gracenotes, yeah, it just can help to expend it out mentally as an intermediate step when thinking about partial application
10:00:32<mauke>you can read that as "map takes a function from a to b and a list of a's, and returns a list of b's"
10:00:44<EvilTerran>map :: (a -> b) -> ([a] -> [b])
10:01:06<mauke>but it's equally valid to think of it as "map takes a function from a to b, and returns a function from a list of a's to a list of b's"
10:01:22<pltonik>mauke: they how i usually read things but flip id escape(d/s) me somehow
10:01:25<mauke>so it becomes a function transformer/lifter
10:01:35<luqui>i like to phrase my functions as transformations of functions whenever it makes sense
10:01:46<luqui>i.e. i prefer the latter interpretation, though I flip back and forth when i'm working
10:02:05<mauke>flip id is special because id looks like it only takes one argument
10:02:13<pltonik>it suuuuuuure does
10:02:22<mauke>but every function does that
10:02:39<mauke>a two-arg function is really just a function (of 1 arg) that returns another function
10:02:47<mauke>and that's all 'flip' requires
10:03:06<mauke>so... if the input to 'id' is a function, then so is its output
10:03:18<mauke>and in that case, 'id' becomes a two-arg function
10:03:21<EvilTerran>the same function!
10:03:21<pltonik>((c -> d) -> c -> d) -> c -> (c -> d) -> d makes sense now, forgot that the final -> d is the output of the function lol. yea... its that bad at the moment.
10:03:45<Gracenotes>as I said, it's the same as "flip ($)". $ is specific in that it applies to function application, but it's also function identity. (c -> d) -> c -> d
10:03:46<Twey>IOW, when the last argument to a function is polymorphic, you should imagine a trail of potential arguments stretching off into the distance :-P
10:04:03<mauke>Twey: no, the result
10:04:10<Twey>Er, last argument to a function... you know what I mean :-P
10:04:12<Gracenotes>so flip id, or flip ($), is flipped function application
10:04:15<Gracenotes>sorta
10:04:19<Twey>Last type in amongst the arrows.
10:04:38<mauke>yes, that's the result type :-)
10:04:53<pltonik>see flip ($) poses absolutely no problems for me
10:05:05<mauke>($) :: (a -> b) -> (a -> b)
10:05:07<mauke>($) = id
10:05:07<Twey>mauke: Except it may not be a ‘result’ per se, since it can take more arguments
10:05:19<mauke>Twey: yes, that's what functions do :-)
10:05:27<mauke>there's a horrible application of this: see printf
10:05:37<Twey>That's why dividing the arrows up into ‘arg1 -> arg2 -> arg3 -> result’ is confusing
10:05:56<mauke>... where result = x -> y -> z
10:06:05<pltonik>Twey: so whats the better way? i might've missed it if you already said it
10:06:16<mauke>> ""++ printf "foo"
10:06:17<lambdabot> "foo"
10:06:20<mauke>> ""++ printf "foo %s" "bar"
10:06:20<lambdabot> "foo bar"
10:06:24<mauke>> ""++ printf "foo %s %d" "bar" 42
10:06:25<lambdabot> "foo bar 42"
10:07:14<Twey>pltonik: Like I said, it's better to imagine a final polymorphic type as being a long chain of potential arguments
10:07:37<dmwit>Hey guys, check out this bug in GHC's floating point:
10:07:42<dmwit>> exp pi - pi -- 20
10:07:43<lambdabot> 19.999099979189474
10:07:45<Twey>As in, recognising that in ‘a -> b’, b may not necessarily be a single value
10:07:45<dmwit>haha!
10:07:48<dmwit>ACTION loves xkcd
10:08:01<Gracenotes>dmwit: an odd value for sure :3
10:08:06<Twey>Hehe, dmwit
10:08:51<Gracenotes>> drop 750 $ showCReal 1000 pi
10:08:52<lambdabot> "60518707211349999998372978049951059731732816096318595024459455346908302642...
10:09:07<Axman6>> exp pi - pi :: CReal
10:09:09<lambdabot> 19.9990999791894757672664429846690444960689
10:09:30<Twey>> exp pi - pi :: Float
10:09:31<lambdabot> 19.999104
10:09:33<Twey>Huh.
10:09:37<dmwit>gah
10:09:39<Gracenotes>aka the http://en.wikipedia.org/wiki/Feynman_point in pi
10:09:47<Twey>Is CReal the longest we've got?
10:09:48<Gracenotes>as seem above, at the 762nd position
10:10:01<Gracenotes>*seen
10:10:05<dmwit>Gracenotes: hehe, another favorite math joke of mine
10:11:46<pltonik>Twey: i get what you're saying there. don't quite get how to apply it in real life though or to the current filp id example. maybe i should sleep on it lol.
10:11:48<dmwit>> drop 763 $ showCReal 1000 pi
10:11:50<lambdabot> "99999983729780499510597317328160963185950244594553469083026425223082533446...
10:12:17<Twey>@oeis [5, 44, 762, 762, 762, 762, 1722776, 36356642, 564665206]
10:12:18<lambdabot> Sequence not found.
10:14:12<Axman6>@oeis 5 44 662 762
10:14:13<lambdabot> Sequence not found.
10:14:21<Axman6>@oeis 5 44 762
10:14:22<lambdabot> a(n) is the starting position of the first occurrence of a string of n 9's i...
10:14:22<lambdabot> [5,44,762,762,762,762,1722776,36356642,564665206]
10:15:35<Gracenotes>huh. :/
10:15:48<Gracenotes>and all because we have 10 fingers
10:15:56<Twey>Hehe, truly
10:16:12<dmwit>So, according to Wikipedia, it's quite surprising that 6 copies of any digit appears that early.
10:16:12<Twey>I wonder how that comes out if pi is written in base e...
10:16:32<dmwit>Twey: What are the digits in base e?
10:16:45<Twey>I haven't the foggiest
10:16:50<ray>0, 1, 2, and e :)
10:16:58<mauke>preflex: calc '3 pi
10:16:59<preflex> 10.010211012222010211002111110221
10:16:59<dmwit>Nonsense, 10 isn't a digit.
10:17:06<Twey>Quite
10:17:23<ray>non-integer bases are already nonsense
10:17:28<ray>what are you complaining about
10:17:30<Twey>Hehe
10:17:30<dmwit>heh
10:17:46<dmwit>The digits are 0 and e/2. =)
10:17:59<mauke>preflex: calc '9 pi
10:17:59<preflex> 3.124188124074428
10:18:01<Gracenotes>I suppose it's d_1 * e^1 + d_0 * e^0 + d_-1 * e^-1 + d_-2 * e^-2 + ...
10:18:11<ray>presumably
10:18:12<Gracenotes>and we would notate it like d_1 d_0 . d_-1 d_-2
10:18:18<Gracenotes>like any other number system :/
10:18:31<dmwit>Gracenotes: Sure, but what are the values we can use for d_1?
10:18:35<mauke>preflex: calc '11 pi
10:18:35<preflex> 3.16150702865a48
10:18:43<mauke>doesn't look familiar
10:19:00<Gracenotes>well, there is a base phi number system: http://en.wikipedia.org/wiki/Base_phi
10:19:15<Gracenotes>except I think it depends on certain properties of phi that transcendentals may or may not have. don't recall.
10:19:52<dmwit>Ah, I see.
10:20:06<dmwit>You use the integer digits up to the base, then exclude certain sequences of them.
10:20:13<dmwit>That seems... a little arbitrary.
10:20:13<Axman6>preflex: calc '16 pi
10:20:14<preflex> 3.243f6a8885a3
10:20:29<Gracenotes>a number's representation in base e might be computable, but I'm not sure if said computation will terminate...
10:20:33<Axman6>preflex: calc '2 pi
10:20:34<preflex> 11.001001000011111101101010100010001000010110100011
10:20:39<Axman6>preflex: calc '1 pi
10:20:39<preflex> Invalid number base
10:20:41<Axman6>>_>
10:20:47<Axman6>preflex: calc '1.5 pi
10:20:48<preflex> Too many operands
10:21:11<dmwit>preflex: calc 3.6a2
10:21:11<preflex> Lexical error
10:21:16<dmwit>booo
10:21:19<mauke>preflex: calc '2.5
10:21:19<preflex> 0.1
10:21:22<Axman6>preflex: calc '64 pi
10:21:23<preflex> Invalid number base
10:21:26<Axman6>:\
10:21:29<Axman6>preflex: calc '20 pi
10:21:30<preflex> 3.2gceg9gbhj9
10:21:33<Axman6>preflex: calc '30 pi
10:21:34<preflex> 3.47d01ee07r
10:21:35<dmwit>preflex: calc '16 3.6a2
10:21:36<preflex> Lexical error
10:21:37<Axman6>preflex: calc '40 pi
10:21:37<preflex> Invalid number base
10:21:42<Axman6>preflex: calc '32 pi
10:21:42<preflex> 3.4gvml245k
10:21:44<dmwit>Axman6: up to 36, most likely
10:21:45<Axman6>preflex: calc '33 pi
10:21:45<preflex> 3.4m6dn4ow9
10:21:51<Axman6>preflex: calc '37 pi
10:21:51<preflex> Invalid number base
10:21:54<dmwit>Axman6: (i.e. 0-9a-z)
10:21:55<Axman6>preflex: calc '36 pi
10:21:55<preflex> 3.53i5ab8p5
10:22:02<Axman6>ah, right, makes sense
10:22:14<mauke>preflex: calc 16'3.6a2
10:22:14<preflex> 3.41455078125
10:22:16<Axman6>sorry for the spam btw
10:22:31<voker57_>(+4) works fine, but with (-4) it thinks that i meant negative number, how to work around?
10:22:41<mauke>voker57_: (subtract 4)
10:22:52<ivanm>is there a function I can use to see if the beginning of a String is a specified String?
10:22:58<mauke>ivanm: isPrefixOf
10:23:03<dmwit>Oh!
10:23:26<dmwit>3.6a2 isn't something comparable to 3.6e2 from Haskell (i.e. exponential notation), it's just plain old hex digits.
10:23:29<dmwit>ACTION feels silly
10:23:29<ivanm>mauke: I knew there was something like that, couldn't think of it
10:23:31<ivanm>thanks!
10:23:46<ivanm>@hoogle let me down :(
10:23:46<lambdabot>Parse error:
10:23:47<lambdabot> --count=20 "let me down :("
10:23:47<lambdabot> ^
10:23:51<ivanm>@slap lambdabot
10:23:51<lambdabot>ACTION secretly deletes lambdabot's source code
10:24:16<Axman6>oh no@!
10:24:19<Axman6>don't do it!
10:24:22<Gracenotes>D:
10:24:32<Axman6>D`:
10:26:17<Twey>ACTION pulls lambdabot back from the brink
10:29:54<ray>dmwit: the fun part is that e is a hex digit
10:30:41<ray>welcome to fun city
10:43:32<Sarajevo>Join to #webcam . It's a sex channel where you can meet nice ladies. Help me to make it bigger. White pussy, black pussy, yellow pussy - we are not racists. Every pussy is welcome.
10:44:44<Twey>ACTION frowns.
10:44:50<Twey>I know that chap
10:45:27<Twey>I've seen them around somewhere *wracks brains*
10:46:44<ivanm>didn't he get bombed a few years back?
10:46:57<Twey>Ha, ha :-P
10:47:02<Twey>On IRC, you silly bear.
10:47:09<ivanm>though I'm interested in how such a channel became created on Freenode...
10:47:11<ivanm>Twey: :D
10:47:36<Twey>ACTION laughs.
10:47:41<Twey>11:47:23 [FreeNode] *** #webcam 3 18+ only, webcam shows, no kids, no pervs.
10:47:45<Gracenotes>there are 4 people in it
10:47:52<Gracenotes>... now 5
10:47:58<Twey>Hey, it's growing.
10:48:05<Gracenotes>now 4
10:48:08<ivanm>people believe him? :o
10:48:21<Gracenotes>the topic is "18+ only, webcam shows, no kids, no pervs." ..
10:48:29<Twey>I know :-D
10:48:36<Gracenotes>oh well. Way to kickstart a channel
10:49:00<ivanm>Gracenotes: which IIRC is against the Freenode requirements
10:49:17<Gracenotes>hm. well, there are "legal" 18+ channels on freenode
10:49:18<ivanm>isn't freenode meant to be about software, organisations, etc.?
10:49:23<ivanm>not porn?
10:49:34<ivanm>Gracenotes: and how do you know such things? :p
10:49:54<Gracenotes>except the one I know of is a double-hash channel
10:50:34<Twey>ivanm: Maybe it's open-source porn!
10:50:40<ivanm>heh
10:50:53<pltonik>guys thanks for all your help i think it all finally sank in. learned a lot from something so small - haskell is a beast. cheers!
10:50:55<ivanm>you can tweak the images freely, as long as you share your tweaks?
10:51:02<Twey>pltonik: Hehe, you're welcome :)
10:51:06<Twey>ivanm: Hahaha
10:51:31<Twey>I think in a porn context that means the models are available to all :-P
10:53:05<dmwit>porn is made in inkscape... with the SVG available
10:53:08<dmwit>maybe that is open source
10:53:42<Twey>Hehe
10:53:58<ivanm>or the gimp?
10:54:04<dmwit>DGS actually has an interesting manifesto somewhere about what the GPL means for images used in an open-source web server.
10:54:12<dmwit>I can't seem to find it now, though.
10:54:23<Zao>ivanm: Watch you, you'll start an open source porn holy war.
10:54:30<dmwit>err... also, DGS=dragongoserver.net (that abbrevation is probably not known here =)
10:54:46<ivanm>heh
10:57:23<pltonik>me thinks 'open-sauce' is a more accurate term
10:57:46<pltonik>i shall leave you with that.
10:57:57<pltonik>thanks again guys/gals. laterz.
10:58:14<Axman6>hmm, anyone know much about nuclear... well stuff... wondering how safe http://www.dealextreme.com/details.dx/sku.8922 would be
10:58:32<Axman6>ACTION is asking here because it's full of intelligent people
11:00:40<ivanm>probably pretty safe
11:01:00<ivanm>tritium is what they use to make glow-in-the-dark bits on watches, etc.
11:01:06<Axman6>yeah
11:01:15<Axman6>reading up on it on wikipedia
11:01:19<Axman6>seems safe enough
11:18:38<inbuninbu_>question... i'm having trouble understanding something about transformers
11:19:02<inbuninbu_>who is cooler, optimus prime or megatron :-)
11:19:15<inbuninbu_>seriously though... MaybeT
11:19:51<inbuninbu_>i've got type MaybeGet = MaybeT Get a
11:20:33<inbuninbu_>and a function of that type. my problem is that i want to return a Nothing
11:20:59<inbuninbu_>but if i try to return a Maybe value, it thinks i'm in the Get monad
11:21:28<inbuninbu_>any suggestions as to what i'm not understanding?
11:22:23<Saizan_>you should use mzero
11:22:33<RayNbow>@unmtl MaybeT m a
11:22:33<lambdabot>m (Maybe a)
11:22:34<Saizan_>or MaybeT (return Nothing)
11:22:59<Saizan_>assuming i've inferred correctly what you meant by return a Nothing :)
11:25:40<inbuninbu_>Saizan_: thanks!
11:37:26<bakesz>hi guys!is there a function which gives True if the argument is False and gives False if the argument is True?thank you.(sorry for my english)
11:38:12<ski>> not False
11:38:14<lambdabot> True
11:38:14<ski>> not True
11:38:16<lambdabot> False
11:38:38<ski>@type not
11:38:39<lambdabot>Bool -> Bool
11:38:53<Axman6>bakesz: nothing wrong with your english that i could see (except for the lack of spaces after punctuation)
11:39:37<bakesz>thank you guys
11:41:22<sm>ACTION tries adding links to the bot
11:41:58<sm>dcoutts__: it would be cool if the hackage feed set the author field
11:43:15<ivanm>which version of base came with 6.6.1?
11:44:36<ivanm>because I'm trying to help someone using 6.8.2 where a library with both base<3 and base>=3 deps is complaining that base<3 can't be found :s
11:47:11<the_edge>ivanm: if you are the one that has 6.6.1, you could use "ghc-pkg list" to see what version of base you have
11:47:27<ivanm>the_edge: I don't ;-)
11:47:53<ivanm>I'm trying to fix some deps up for an installer
11:48:03<the_edge>ivanm: oh :(
11:48:41<ivanm>this user has 6.8.2, but cabal-the-library is complaining that base<3 not being found; I wanted to know about 6.6.1 in case I could force usage of base-3
11:52:16<ivanm>different topic: is there a monadic form of concatMap?
11:52:38<mauke>type signature?
11:53:06<ivanm>(a -> m [b]) -> m [a] -> m [b]
11:53:11<ivanm>hoogle doesn't recognise it :s
11:53:28<mauke>:t mapM
11:53:29<lambdabot>forall a (m :: * -> *) b. (Monad m) => (a -> m b) -> [a] -> m [b]
11:53:40<ivanm>or even (a -> m [b]) -> [a] -> m [b]
11:53:57<the_edge>ivanm: I downloaded ghc-6.6.1 and looking through the sources I saw that base was version 2.1.1 in the file ghc-6.6.1/libraries/base/base.cabal
11:54:07<ivanm>*nod*
11:54:09<ivanm>thanks the_edge
11:54:10<mauke>:t (liftM concat .) . mapM
11:54:11<lambdabot>forall a (m :: * -> *) a1. (Monad m) => (a1 -> m [a]) -> [a1] -> m [a]
11:54:29<ivanm>but it turns out the deps he needed for hedgewars were different than what we'd though, so I can just delete all that \o/
11:55:34<ivanm>thanks mauke
12:02:14<dcoutts>sm: we can do that in the new code easily :-)
12:03:57<sm>quite right :)
12:05:05<sm>to switch over, I think you said it needs user management and something else ?
12:05:50<dcoutts>sm: yes, two things, user authentication management, ie which people are allowed to update which things, and the ability to add accounts
12:06:02<dcoutts>sm: and upload and serving doc tarballs
12:06:19<dcoutts>sm: I had a design for a component that could serve the content of .tar files
12:07:09<dcoutts>sm: the idea then is that we can browse the content of uploaded packages, but also use that to serve haddock docs, while keeping it easier to manage on the server by keeping the docs in one .tar file
12:08:20<sm>I see.. but I guess strictly speaking you could cut over now ? since the old one doesn't have user management either
12:08:21<dcoutts>sm: so the main part of that is a memory-efficient data structure to map string file paths to (offset,length) pairs
12:08:43<dcoutts>sm: well, it's using apache htpasswd and you can add users to that
12:08:58<dcoutts>sm: currently there's no live way to adjust the set of users :-) only import
12:09:56<sm>just trying to understand if there's a showstopper that prevents deploying this right away.. once it's live it will get more hacking
12:10:15<dcoutts>sm: well not serving docs would be a regression
12:10:25<sm>oh I see
12:10:26<dcoutts>sm: and not being able to add new users wouldn't be great :-)
12:10:34<sm>gotcha
12:10:50<dcoutts>and for a real deployment we'd also need to think about backups
12:11:14<sm>and check out happstack's memory use
12:11:37<dcoutts>yep, though from previous testing that seemed ok
12:11:41<sm>great
12:12:04<dcoutts>slightly too much to run it on code.h.o, but that box has hardly any memory, so it's not surprising
12:19:38<ivanm>dcoutts: how old is said box?
12:22:26<sm>while using a regexpr function in ghci: "ghc: unable to load package `syb'"
12:22:31<sm>weird
12:23:04<ivanm>:/
12:23:19<ivanm>sm: maybe you tried upgrading syb, but your version of ghc has it internally and it thus interferes?
12:23:35<ivanm>or else run "ghc-pkg check" to see if anything needs to be rebuilt
12:24:00<sm>I've never heard of syb.. I know that regexpr installed fine and has been working in other ways
12:25:57<ivanm>syb == scrap your boilerplate
12:25:59<sm>oh there's more.. previous to that it says Loading package syb ... linking ... <interactive>: /usr/local/lib/download-0.3/ghc-6.10.2/HSdownload-0.3.o: unknown symbol `stat64'
12:26:01<sm>aha
12:26:19<ivanm>6.10 seems to come with 0.1.0.1
12:26:21<sm>but I'm using 6.10.3, hmm
12:26:34<ivanm>sm: what does "ghc-pkg list syb" say?
12:26:51<sm>one sec
12:26:58<sm>0.1.0.1
12:27:26<ivanm>OK, that's what ghc comes with
12:27:32<sm>I reintalled regexpr.. all well now
12:27:50<sm>thanks
12:28:21<ivanm>no worries
12:34:24<_JFT_>Is there a way, when installing a cabal package, that its documentation is added to the index of GHC package documentation so that a single html page display the full package hierarchy of what is locally installed?
12:35:25<ivanm>_JFT_: I don't think so...
12:35:35<ivanm>which is a pity, because I would really like something like that
12:35:36<Axman6>not that i know of, but it;s something i've wanted
12:35:44<ivanm>though first of all, user/global stuff would clash
12:36:05<_JFT_>ivanm: thanks that's what I was afraid of :(
12:36:23<ivanm>though having a central index would be better than editing the ghc index
12:37:24<_JFT_>ivanm: true
12:37:58<Saizan_>http://hackage.haskell.org/trac/hackage/ticket/516 <- there's a ticket for anyone that'd like to work on it
12:39:23<ivanm>AFAICT, the biggest problem is telling which non-base modules are provided with ghc
12:39:54<ivanm>I know that recently, I've had to remember to look at my ghc docs for Cabal's haddock docs, since I don't have an external one installed
12:41:25<_JFT_>I have never installed lambdabot locally but couldn't it do it?
12:41:38<_JFT_>isn't there some functionality option for that?
12:41:52<ivanm>_JFT_: for what?
12:42:11<_JFT_>providing a centralize search index for the locally installed package
12:42:16<hackagebot>released: LambdaHack 0.1.20090606 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/LambdaHack-0.1.20090606
12:42:29<ivanm>nah, IIRC lambdabot uses ghc's only
12:43:19<_JFT_>ivanm: ah, I thought there might have been directive to add extraneous documentation paths
12:43:34<ivanm>*shrug* could be
12:43:57<ivanm>but in general, IIRC most of lambdabot's info is manually inputted :s
12:45:15<sm>yay.. regexpr is good
12:45:35<shapr>ivanm: I think debian's ghc docs do show the full hierarchy of what's installed.
12:45:39<sm>regexps in haskell, made simple
12:45:58<_JFT_>ivanm: I don't get why it is a problem to tell which non-base modules are provided with GHC. Why not fuse everything? (I am sure this is a dumb question but eh :P)
12:46:09<sm>it just needs some more mnemonic function names
12:46:15<ivanm>shapr: :o
12:46:50<ivanm>_JFT_: well, if you have a central index, you need to know which libs are provided by ghc so you can find them
12:47:29<Saizan_>ivanm: you can always ask ghc-pkg for that
12:47:35<Saizan_>the problems are others
12:47:50<Saizan_>like described in the ticket i've given above
12:48:10<ivanm>yeah
12:48:33<dcoutts>ivanm: code.h.o is a cheap virtual machine, it's not old
12:49:13<ivanm>ahhh
12:49:32<Saizan_>dcoutts: btw, what do you think about "cabal haddock --hoogle" generating both the html and hoogle formats, instead of only the latter?
12:50:02<ivanm>Saizan_: since otherwise, why use "haddock" there?
12:50:06<_JFT_>Saizan_: I am not sure I fully understand the problem there (could be language related as English is not my main language :P )
12:50:13<dcoutts>Saizan_: do you think it's not important to be able to make just the hoogle index?
12:50:24<Saizan_>ivanm: it's still haddock that generates the hoogle index
12:50:49<_JFT_>actually I mentionned index but it is the hiearchy of package that I am really after...
12:50:50<dcoutts>Saizan_: I mean, do we need a way to only make the hoogle index
12:51:19<ivanm>Saizan_: oh
12:51:29<dcoutts>_JFT_: http://hackage.haskell.org/trac/hackage/ticket/516
12:51:56<_JFT_>dcoutts: Thanks, yes that's the one that Saizan_ linked earlier
12:51:59<Saizan_>dcoutts: i don't know how/where that command is used in practice, a end-user would probably need both if it asks for hoogle
12:52:42<Saizan_>dcoutts: also, we should add the location of the html docs in the hoogle index, so that --info can link to them
12:53:01<dcoutts>Saizan_: sounds reasonable
12:53:19<dcoutts>Saizan_: make sure that's recorded somewhere. Are you thinking of working on this issue?
12:54:04<Saizan_>dcoutts: yup, though it's a bit sad that we've to run haddock twice from scratch to get both output formats
12:54:11<dcoutts>Saizan_: also, it's not clear to me what the bigger picture is, how do I go about installing hoogle and maintaining an overall db that I can use from say the hoogle command line client?
12:54:22<dcoutts>Saizan_: I mean, how does cabal fit into the overall process/workflow
12:56:17<Saizan_>dcoutts: yeah, that's not obvious, i think cabal should maintain its own hoogle index and update it on every successful install
12:56:29<Saizan_>s/install/install with docs/
12:56:44<_JFT_>I guess I am going to suggest something dumb (I am not versed in dynamic html page generation) but instead of generating and index couldn't we just have a "smart" index page which search local documentation directory and merge them into a unified hierarchy when loadin the page?
12:57:00<dcoutts>Saizan_: does the existing hoogle command line have a central per-user db?
12:57:32<Saizan_>dcoutts: per-installation, not per user
12:57:52<dcoutts>Saizan_: and the installation can be per-user I suppose
12:58:09<Saizan_>dcoutts: yes
12:58:18<Saizan_>dcoutts: the db is installed as one of the data-files
12:58:38<dcoutts>Saizan_: ok, and is that the one we should be updating?
12:58:57<Saizan_>dcoutts: it's shipped in the tarball though, so it doesn't necessarily reflect your own installation
12:59:43<Saizan_>dcoutts: which is another problem, ghc doesn't ship the hoogle index for its libs, and you don't have the source to generate it either
12:59:51<dcoutts>Saizan_: or perhaps we should just install the .hoogle text file along side the .haddock file and let the command line client re-generate its central binary index
13:00:23<Saizan_>dcoutts: so let hoogle deal with ghc-pkg to find them?
13:00:38<dcoutts>Saizan_: though it does ship the .haddock files. I wonder if we can't get haddock/hoogle to generate what it needs from the .haddock files
13:00:47<dcoutts>Saizan_: exactly
13:02:00<Saizan_>dcoutts: currently we can't, maybe we can hack haddock to that point :)
13:02:07<dcoutts>Saizan_: right
13:02:10<sm>darn, I'm getting unknown symbol stat64 when it loads syb again
13:03:22<Saizan_>dcoutts: i wonder if we've to worry about portability over the haskell compiler or not? since haddock works only with ghc
13:03:47<dcoutts>Saizan_: well hoogle depends on haddock already
13:04:48<_JFT_>if I understand your conversation you intend to use a locally install hoogle?
13:05:19<Saizan_>dcoutts: in future Cabal could export an api to find the installed package config for any compiler
13:05:38<Saizan_>_JFT_: yes, we were mainly talking about the hoogle index
13:05:42<dcoutts>Saizan_: it does already
13:05:51<ivanm>I suppose since he's no longer a student, ndm isn't working on the next version of hoogle for GSoC?
13:06:39<dcoutts>Saizan_: though admittedly it's not as convenient as it could be
13:06:41<Saizan_>_JFT_: using a dynamic page for the haddock index might work locally, though it'd be a problem if you want to serve the page online
13:06:44<_JFT_>Doh I didn't know it could be ran that way... So much thing to learn. I more I learn the more I realize I know nothing!
13:07:26<_JFT_>Saizan_: yes but if people want to have their local installation hierarchy that should be ok
13:07:28<Saizan_>though i'm not sure if js can look at your filesystem locally?
13:07:45<_JFT_>Saizan_: depending on the engine yes
13:08:15<_JFT_>Saizan_: I am by no mean a JS expert but I know for exemple that OS X widgets can
13:08:28<Saizan_>_JFT_: then we'd have the problem of how fast it'd be
13:08:39<dcoutts>_JFT_: seems to me it'd be pretty straightforward to get cabal-install to maintain a haddock contents html page
13:09:00<_JFT_>Saizan_: hence why I just just meant the hierarchical content and not the fully flattend index
13:09:15<dcoutts>we just call haddock after installing a bunch of packages, passing it all the .haddock files for all installed packages
13:09:25<_JFT_>dcoutts: that would do most of the trick with a merge of the GHC doc content
13:09:37<Peaker>Hey, are there any symbolic math solver libraries?
13:09:43<Saizan_>_JFT_: you can include the GHC doc content too
13:09:46<dcoutts>_JFT_: no need to merge anything
13:10:01<Saizan_>we do have the .haddock of those libs
13:10:23<Saizan_>what should we do for multiple versions of the same library though?
13:10:27<_JFT_>Saizan_, dcoutts : ah... I need to learn more about haddock, cabal and hoogle....
13:10:42<dcoutts>Saizan_: probably just pick latest of each
13:10:44<_JFT_>Saizan_: with a dynamic page I would say a pull down?
13:10:55<_JFT_>Saizan_: defaulting on the latest
13:11:15<_JFT_>Saizan_: (and yes I am a bit idealistic here :) )
13:11:25<dcoutts>who wants to implement this now? I can give guidance, I reckon it'd take an hour or so
13:12:15<_JFT_>dcoutts: I would be willing but given my state of knowledge it would be many many hours not just one :P
13:12:39<Saizan_>i think i could afford it :)
13:13:11<dcoutts>Saizan_: you mean you want to do it now? lemme point out the appropriate place to put it
13:13:12<Saizan_>but, why do we maintain the index for haddock and instead we plan on hoogle maintaining its own ?
13:13:23<Saizan_>dcoutts: ok
13:13:44<Saizan_>i guess haddock doesn't have its own index
13:13:47<dcoutts>Saizan_: -> #haskell-in-depth ?
13:15:02<Taejo>in the non-empty list thread on haskell-cafe, Conor says `data NE x = x :> Maybe (NE x)` is Applicative in four different ways. What are they? I can only think of two (one analogous to [], the other to ZipList)
13:17:32<Peaker>any Haskell library that can do polynomial equation multiplication and solving?
13:18:56<ivanm>Peaker: the one you're about to write? :p
13:19:03<Peaker>ivanm, :-(
13:19:09<ivanm>Peaker: IIRC, the Haskell Road has something on this...
13:19:20<ivanm>but only for binary polynomials :s
13:20:05<Peaker>you mean, up to x^2?
13:20:45<ivanm>no, as in x \in {0,1}
13:21:02<bremner_>Peaker: There is a project to write a symbolic algebra package in haskell
13:21:51<bremner_>I forget the name
13:24:00<bremner_>Technically that answers your question:-)
13:24:15<ivanm>docon or something?
13:26:29<sm>oh man, this is bad.. I've installed fresh 6.10.3 binaries and still getting unknown symbol 'stat64'
13:26:42<sm>I broke it somehow.. what could it be
13:26:46<ivanm>sure it's not your regex library that has the problem?
13:27:08<sm>pretty sure.. I get it now when loading the download package
13:27:26<sm>when ghci loads/links it
13:27:58<_JFT_>sm: which OS?
13:28:34<sm>ubuntu intrepid, x86 64
13:30:19<Peaker>bremner_, heh
13:30:32<_JFT_>sm: did you upgraded from a 32 bit installation? Or did you installed fresh a 64?
13:30:33<uzytkownik>Hello. How to link to module without cabal? I have a short test 'script' I'd like to compile but ld complains about references to network.
13:30:50<sm>not sure
13:31:00<inbuninbu_>question: what is generally considered the best way to use monad transfomers? i've seen at least two ways. one using newtype with newtype deriving, and the other using a simple type alias
13:31:09<_JFT_>uzytkownik: the package need to be registered using ghc-pkg
13:31:18<_JFT_>uzytkownik: cabal does this for you
13:32:01<_JFT_>uzytkownik: (if I understdood you questions correctly that is!)
13:32:01<uzytkownik>_JFT_: Without cabal. A 10-lines script to test something is not worth writing cabal IMHO
13:32:28<_JFT_>uzytkownik: no no I meant that the module you are referring too should have registered if it was instaled with cabal
13:32:29<dcoutts>uzytkownik: ghc --make
13:32:43<_JFT_>uzytkownik: if you are compiling or running you don't need cabal
13:33:03<_JFT_>uzytkownik: unless you are missing that dependency...
13:33:12<uzytkownik>dcoutts: Thanks
13:33:29<ski>@type \f -> join . liftM (liftM join . sequence . map f)
13:33:29<_JFT_>uzytkownik: sorry I misunderstood your question :(
13:33:30<lambdabot>forall a (m :: * -> *) a1. (Monad m) => (a1 -> m [a]) -> m [a1] -> m [a]
13:33:32<ski>@type \f -> liftM join . sequence . map f
13:33:34<lambdabot>forall a (m :: * -> *) a1. (Monad m) => (a1 -> m [a]) -> [a1] -> m [a]
13:35:47<malosh>Hi. Does someone know if it is possible to create an MArray instance with a specialized Ix type (i.e. I want (Int,Int) to make points in an image) ?
13:36:12<_JFT_>sm: might be that you have a 32 bit solib leftover in your system...
13:36:26<MyCatVerbs>malosh: huh? There's already an Ix instance for (Int,Int).
13:36:30<malosh>The idea is to use an MArray instance to manipulate a C Array over which I have no control
13:37:12<MyCatVerbs>malosh: sounds doable. You'll need to use Foreign.Storable.
13:37:24<malosh>Yes but the compiler won't let me declare an instance MArray MyArray Int IO... in which I impose the index type
13:37:59<malosh>I still will have to use newArray (a,b) :: IO (Image (Int,Int) Color)
13:39:00<MyCatVerbs>Yes, that's because of how the variables in the MArray declaration work out.
13:39:24<MyCatVerbs>You don't need to create a specialised version for (Int,Int) specifically anyway.
13:39:49<MyCatVerbs>You can use anything with an Ix instance using the (index) method.
13:40:05<malosh>In fact I think I do : I need to match against (x,y) when I want to manipulate my C pointers
13:40:30<malosh>(I did not choose how the C array is layed out)
13:40:50<MyCatVerbs>Oh, you mean your data is laid out as an array of pointers to row data, rather than one giant contiguous array?
13:41:11<malosh>(or at least it could be :-)
13:41:36<MyCatVerbs>In that case, you can't make a MArray instance, no.
13:41:48<MyCatVerbs>(Not by any method I can think of, anyway.)
13:41:54<malosh>ok, thanks
13:42:20<MyCatVerbs>But even in C, for *image* data you'll almost certainly be using a contiguous array, won't you?
13:43:00<MyCatVerbs>Oh, no, libpng does the array-of-pointers-to-row-data thing. *grumbles*
13:43:03<malosh>yes, in fact I'll have a big contiguous array, but then I need to control precisely how the Ix class agences the indexes
13:43:42<malosh>because I'd like to write things like colors like writeArray a ix (r,g,b)
13:43:51<uzytkownik>What's wrong with such program http://haskell.pastebin.com/m28036ed4? It seems to hang instead of printing first line of response (I try to learn socket API so please don't redirect me to HTTP libraries unless for example code). It should work judging on the output of telnet 80 google.com.
13:43:55<Athas>The following program crashes with a stack overflow for some inputs, supposedly due to evaluation of a large thunk: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5603#a5603 - the only data I am able to extract with the profiling tools that it apparently allocates a lot of Word32s right before it crashes.
13:43:58<malosh>and the three color planes are separated in the lib I'm using
13:44:12<Athas>But I store essentially everything in IOUArray, aren't those strict?
13:44:30<MyCatVerbs>ACTION flips a coin to pick whose problem to look at first.
13:45:18<MyCatVerbs>uzytkownik: put (hFlush h) in between lines 9 and 10, please, and tell me if that fixes it.
13:45:34<MyCatVerbs>(Of course my coins are all biased to go for the easy problem first.)
13:46:24<uzytkownik>MyCatVerbs: Thanks. Too much with unbuffered streams ;)
13:46:35<MyCatVerbs>uzytkownik: telnet sends (at least one) packet every time you hit the enter key. Handle IO is buffered up to some arbitrary block size unless you use hSetBuffering to set it to something else.
13:47:00<uzytkownik>MyCatVerbs: I know. I forgot :(
13:47:01<MyCatVerbs>(hSetBuffering LineBuffering) is most commonly the right one to use for telnet-friendly protocols. :)
13:47:06<MyCatVerbs>No worries.
13:47:51<_JFT_>uzytkownik: Not sure what you are trying to do but if you are connecting to http port this might interested you: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/curl
13:47:51<MyCatVerbs>Athas: oh dear. Where is the (force) function defined, please?
13:48:07<MyCatVerbs>Athas: also, your (seqforce) function is a no-op.
13:48:16<Athas>Yeah, those were acts of desperation.
13:48:22<Athas>force is from Control.Parallel.Strategies.
13:48:32<Athas>It's a deprecated shortcut function.
13:48:43<MyCatVerbs>IOUArrays are indeed strict in their elements.
13:49:03<uzytkownik>_JFT_: As I wrote. I'm learning Socket and I'm not interesting in HTTP libraries as I'm not intending to implement those RFCs ;). Connecting to google is me hello world for networking
13:49:28<Athas>MyCatVerbs: since reading/writing them is an IO action, shouldn't they effectively be strict in their indexes too?
13:49:35<_JFT_>uzytkownik: sorry I had missed that part :P (trying to follow too many chanels :P )
13:50:48<MyCatVerbs>Athas: yyyy, should be, yeah.
13:54:50<uzytkownik>Is it working by accident or is it ok? http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5604#a5604 . Judging on hGetContents docs (http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html#v%3AhGetContents) it should throw error as handle is in semi-closed state. But it seems to work for sockets. Is it an accident or is it intended (and useful for me) behavior? In what portions data is read (set by hSetBuffering?)?
13:55:20<Athas>The program consists of a main loop modifying a state of the MachineState type. The storage and register fields are only accessed via IO actions, idBucket and counter are only modified in functions that are called very rarely (I determined that much from profiling) and so can't be big thunks, and the finger field is inspected on every iteration of the loop to determine whether to continue.
13:55:30<Athas>I simply can't see where long-lived thunks could be created.
13:55:53<Athas>Unless the State monad does something behind the scenes (but I presumably use the strict version).
13:56:18<MyCatVerbs>Athas: er, the State monad is not strict. (AFAIK making it so breaks the monad laws, I think.)
13:56:35<hackagebot>released: tar 0.3.1.0 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/tar-0.3.1.0
13:56:35<hackagebot>released: htar 0.3.1 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/htar-0.3.1
13:56:47<Athas>Well, it's a state monad transformer wrapping the IO monad I use in my program.
13:56:49<MyCatVerbs>Oh, that's not right. Making State strict in its state is fine, making any monad strict in its return value isn't.
13:57:03<MyCatVerbs>My bad.
13:57:11<Saizan_>Athas: do you use strict fields in your state type?
13:57:13<Jedai>MyCatVerbs: There's a strict and a lazy version of the State monad in mtl
13:57:24<Saizan_>Athas: also, maybe you want Control.Monad.Strict
13:57:35<Saizan_>which is not strict in the state, mind.
13:57:48<Saizan_>it's strict in the tuple holding the state and the returned value
13:58:10<MyCatVerbs>Athas: the easiest way to track down a stack overflow in a big pile of unknown code is to load the thing in GHCi, set -fbreak-on-exception and then :trace main.
13:58:26<Athas>Oooh, that sounds promising.
13:58:33<Athas>I didn't know about that arg.
13:59:04<MyCatVerbs>It's quite handy, even if it is kind of... spiky.
13:59:17<Athas>Saizan_: what do you mean by Control.Monad.Strict? Do you mean Control.Monad.State.Strict?
13:59:24<MyCatVerbs>I would recommend keeping this http://www.haskell.org/~simonmar/papers/ghci-debug.pdf at hand if you're ever using GHCi's debugger.
14:00:22<Athas>Does ghci interpret the code or compile it first?
14:00:39<MyCatVerbs>Yes.
14:00:43<Axman6>heh
14:01:21<_JFT_>Athas: compile to bytecode first I think
14:01:22<MyCatVerbs>It will load the object code for compiled modules, or if there's no .hi and .o then it'll compile your sources to byte-code and interpret it.
14:02:22<MyCatVerbs>The byte-code interpreter isn't *ridiculously* slow, but it's still something like a ten to one disadvantage against compiling to machine code even with the optimizer turned off.
14:03:02<Saizan_>Athas: yes, sorry
14:03:05<MyCatVerbs>Usually, of course, you don't care, since most of the time when you want to use GHCi in the first place you are limited by your ability to write useful code rather than your machine's capacity to run it. :)
14:06:36<ivanm>MyCatVerbs: by that, do you mean "you're writing your code and only using ghci to test it", or "people who use ghci can't write good code anyway"?
14:06:37<ivanm>;-)
14:08:15<MyCatVerbs>ivanm: for values of "you" that consist entirely of "me", when you are *writing* code in GHCi, it's to test out random (probably bad) ideas. =)
14:08:32<MyCatVerbs>ivanm: otherwise, I'd be writing it in vim instead. :)
14:08:38<ivanm>heh
14:08:50<ivanm>so you don't load code in ghci? you just write code directly to it?
14:10:45<MyCatVerbs>ivanm: often as not, aye. Normally when I'm writing code in GHCi, I'm flipping between it and vim, writing things in GHCi and then putting them into vim.
14:10:57<MyCatVerbs>ivanm: probably not really a very good workflow, but oh well.
14:11:20<ivanm>see, whereas I write it in emacs and keep hitting C-c C-l to load the file into ghci to check I got types right, it works as expected, etc.
14:11:52<FunctorSalad>Protip for your wrists: bind it to a simpler shortcut ;)
14:12:00<sm>darnit.. what is a good way to do something in between iterate and fold.. I want to apply a list of string replacements, one after another
14:12:03<MyCatVerbs>Or I'll spend a half an hour or so writing something, then turf through the GHCi history to find all my definitions. :)
14:12:11<ivanm>FunctorSalad: doesn't hurt my wrists at all...
14:12:18<ivanm>my fingers, however, are a different story ;-)
14:12:33<FunctorSalad>;)
14:12:34<MyCatVerbs>FunctorSalad: not if you put capslock and control in the correct places, and your hands are on home row anyway.
14:12:44<ivanm>MyCatVerbs: lol, that's the worst... not wanting to re-load the file because I'd lose everything I've defined in ghci :s
14:12:53<ivanm>(usually when I'm debugging)
14:13:03<ivanm>MyCatVerbs: yeah, I have that but keep forgetting to use caps for ctrl :s
14:13:04<FunctorSalad>MyCatVerbs: that particular one is ok then, I was thinking emacs-style shortcuts in general though...
14:13:14<ivanm>then again, I typically move my hands a fair amount when I type
14:13:21<FunctorSalad>(I just use viper mode)
14:13:39<ivanm>I have bigger problems with my xmonad keybindings (trying to hit mod4, etc.)
14:13:41<MyCatVerbs>FunctorSalad: yeah, I think I really ought to.
14:14:00<MyCatVerbs>Switch from vim to emacs+viper mode, I mean.
14:14:19<Athas>Which parameters should I pass to GHC when compiling my program so that ghci can trace it properly?
14:14:22<Athas>I get an empty history.
14:14:38<sm>interesting.. ivanm: whereas I have sp auto-recompiling in an emacs window, and watch for errors there as I save
14:14:48<MyCatVerbs>I did wonder about trying switching to Yi at one point, just because I could hack on it relatively easy, but it turns out I'm just too damn lazy.
14:15:02<ivanm>sm: using flymake?
14:15:10<sm>using sp (searchpath.org0
14:15:14<sm>)
14:15:24<sm>Athas: I think none, but you must first tell ghci to start tracking, then later look at the history
14:15:27<sm>it's in the docs
14:15:39<ivanm>no cabal?
14:15:40<ivanm>fail
14:16:16<sm>cabal doesn't do this particular very useful thing
14:16:24<ivanm>sm: I meant cabal to build it
14:16:36<roderyk>gkt2hs question - I have a model of Layers which are tuples of (Bitmap, [Vectors]). Would it be appropriate to use PixBuf as the Bitmap (for later pixel fideling), while still doing all the rendering via Cairo? For example, I need to select a rectangle of the pixbuf and copy into a new pixbuf - I don't see the relevant api calls for this kind of operation (assume I already know the rectangle positions).
14:16:41<sm>sp calls ghc
14:16:44<ivanm>you really shouldn't use --make to build apps you download
14:16:51<MyCatVerbs>s/easy/easily/, noticed that waaaaay too make.
14:17:09<Gracenotes>hm. I forget, is there a list function to set a certain element?
14:17:10<MyCatVerbs>s/make/late/, what the Hell is wrong with me? Aaaaaagh!
14:17:11<ivanm>MyCatVerbs: s/make/late/ ?
14:17:12<ivanm>heh
14:17:14<Gracenotes>at a given position
14:17:19<ivanm>Gracenotes: I doubt it
14:17:24<mauke>Gracenotes: no, closest match is splitAt
14:17:35<ivanm>yeah, I was about to suggest that
14:17:46<ivanm>Gracenotes: if you do that a lot, then you're using the wrong data structure
14:17:46<Gracenotes>oh, that's not a bad idea. Oh well. I suppose this is a limitation of using Haskell as a shell-script-like-thing :)
14:17:53<Gracenotes>I may as well use arrays
14:17:58<ivanm>or else use a zipper
14:18:04<mauke>Gracenotes: Data.Sequence
14:18:25<Gracenotes>eek. I just need to take a list of links and sort them according to suffixes, and then do some additional shuffling based on position
14:18:31<ivanm>mauke: dammit, stop beating me! I was typing in to suggest Sequence, when I saw your message! :@
14:18:33<Gracenotes>I'll use an array
14:18:47<ivanm>ACTION thinks mauke is getting Gracenotes' messages faster than he is... >_>
14:18:52<sm>anyway.. so anyone know how I can apply a sequence of mutator functions to a value ? this must be easy
14:19:10<mauke>Data.Sequence is the greatest data structure known the man
14:19:10<ivanm>sm: "mutator functions"?
14:19:18<sm>like a string replacement
14:19:20<ivanm>mauke: generalise it: finger trees!
14:19:26<sm>I want to fold, but with a unary operator
14:19:28<ivanm>sm: you mean a whole bunch of a -> a ?
14:19:32<sm>right
14:19:39<mauke>:t foldr (.) id
14:19:40<lambdabot>forall a. [a -> a] -> a -> a
14:19:47<sm>thank you
14:19:48<ivanm>mauke: _again_ you beat me!
14:19:53<mauke>doh ho ho
14:19:53<ivanm>@slap mauke
14:19:54<lambdabot>ACTION beats up mauke
14:20:04<ivanm>ACTION goes off to sulk
14:20:07<Athas>sm: it really looks like ghci can't trace compiled code. The documentation seems to assume that everything is running interpreted.
14:20:11<iago>[a -> a] ?
14:20:28<ivanm>well, actually, I'm going off to undergo a brief period of unconsciousness with occasional halucinations
14:20:38<ivanm>iago: a list of functions
14:20:41<sm>Athas: hmm. perhaps you're right
14:20:41<bremner>ivanm: drinking?
14:20:45<ivanm>bremner: sleep
14:20:50<ivanm>@time
14:20:51<lambdabot>Local time for ivanm is Sun Jun 7 00:20:51
14:20:59<mauke>stop living in the future
14:21:11<iago>ouch, sure :P
14:21:11<FunctorSalad>@time
14:21:11<lambdabot>Local time for FunctorSalad is ∞
14:21:15<ivanm>heh
14:21:18<bremner>ivanm: that sounds asian
14:21:18<ivanm>FunctorSalad: :o
14:21:23<mauke>@time preflex
14:21:24<lambdabot>Local time for preflex is 2009-06-06 14:23WHERE IS SARAH CONNOR?
14:21:28<Twey>15:19:10 < mauke> Data.Sequence is the greatest data structure known the man
14:21:29<ivanm>bremner: or not...
14:21:37<ivanm>ACTION comes from a Land Down Under
14:21:40<Twey>mauke: Blasphemy! DList is the One True Data-Structure!
14:21:48<Twey>Heh, ivanm
14:21:58<bremner>ivanm: dontcha know, its all australasia now... :-)
14:22:01<FunctorSalad>it's a bit lonely here at the end of time though
14:22:08<ivanm>@slap bremner
14:22:08<lambdabot>ACTION beats up bremner
14:22:28<mauke>FunctorSalad: oh yeah, I've been there
14:22:33<mauke>Spekkio is nice, though
14:22:33<bremner>fine, I won't visit you next time I'm in Tokyo
14:22:48<FunctorSalad>mauke: really, what does he do all day? ;)
14:22:52<ivanm>FunctorSalad: were you a victim of the Forever War or something?
14:23:02<ivanm>bremner: well, it'd be a bit hard for you to do so...
14:23:11<ivanm>you'd need another 10 hour flight or so...
14:24:54<_JFT_>how do you do those "emote" again?
14:25:11<mauke>it's called an ACTION
14:25:20<_JFT_>mauke: Thanks :)
14:25:22<p_l>_JFT_: /me <text>
14:25:32<_JFT_>ACTION DOH!
14:25:45<Twey>Or: /ctcp <channel> ACTION foos
14:25:46<Twey>:-P
14:25:47<MyCatVerbs>/ctcp target ACTION commits murder.
14:25:58<Twey>ACTION chuckles.
14:26:16<MyCatVerbs>Or privmsg target :^Aaction flails wildly.^A
14:26:39<FunctorSalad>mp3bot dances \o/
14:26:43<MyCatVerbs>But I don't think that very many people other than me use netcat for an IRC client very often. :)
14:26:52<Twey>I use telnet sometimes
14:27:04<Twey>We weren't allowed to install clients back in college
14:27:15<MyCatVerbs>Twey: use netcat instead. Telnet isn't really all that well designed for it. ;)
14:27:19<Twey>And Mibbit hadn't been invented yet :-P
14:27:20<joga>responding to ping is a pita
14:27:31<Twey>MyCatVerbs: We wouldn't have been allowed to install that, either, I'm afraid :)
14:28:03<MyCatVerbs>joga: I actually have a short Haskell program sitting around that acts pretty much identically to netcat, except that it sends PONG on my behalf. :)
14:28:11<joga>:)
14:28:17<Twey>MyCatVerbs: Psht
14:28:22<Twey>Don't do that
14:28:36<Twey>Write an auto-PONG-responder and run it through netcat -e
14:28:50<Twey>Modularity FTW
14:28:55<MyCatVerbs>When I'm actually using netcat though, I just send PINGs myself so that the server doesn't bother to PING me. Less typing.
14:29:17<Twey>Smart
14:29:45<mathijs>I have a question about the typesystem. As an example let's look at the XHTML library. it defines HtmlElement and all for all xhtml elements there are functions to create them. All elements are the same type and can become nested in any way. So it's possible to create invalid XHTML documents. what would be the way to mandate valid documents? can this be done using types? or would it be better suited inside the (<<) function (add child)?
14:30:31<Botje>phantom types could solve that
14:30:45<mathijs>phantom types?
14:31:03<Botje>check the "phantom types and subtyping" paper on haskell.org
14:31:12<Botje>you can adapt that scheme for HTML elements
14:32:00<mathijs>I was thinking along the lines of having a type for all different elements (and making them instances of some overall xhtml-tag typeclass) but that doesn't really solve anything :)
14:32:12<mathijs>Botje: ok thanks, I'll have a look
14:32:30<Berengal>Phantom types sort of do that
14:33:34<Botje>mathijs: with phantom types you get HtmlElement Html, for example
14:34:07<Botje>and addChildren is something like ValidChild b a => HtmlElement a -> HtmlElement b -> HtmlElement a
14:34:28<Botje>and then you make instances like ValidChild Body Html, etc
14:35:35<mathijs>hmm that sounds about right indeed. so in that way you can really mandate hierarchical stuff in the typesystem itself instead of hiding the constructors & stuff and mandating the use of functions to alter the document?
14:50:31<nikki93>can u pls rite a programme for me
14:51:41<Axman6>...
14:51:47<Twey>...
14:51:51<skorpan>???
14:52:27<earthy>nikki93: right a computerprogram? possibly, depending on language
14:52:28<Twey>ACTION tries to write a shrugging emoticon in three characters, but fails
14:52:42<Axman6>> fix (const ())
14:52:44<lambdabot> ()
14:52:46<skorpan>^0^
14:52:53<Axman6>> fix (flip const ())
14:52:59<lambdabot> mueval-core: Prelude.read: no parse
14:52:59<lambdabot> mueval: ExitFailure 1
14:53:02<Twey>skorpan: Happyface. And/or hunchback.
14:54:10<skorpan>Twey: good try though
14:54:42<Gracenotes>big mouth
14:55:43<Twey>True
15:09:05<roconnor>the haskell haskell interpreter is pretty nice
15:09:11<roconnor>at least in theory
15:09:15<roconnor>ACTION hasn't run it
15:20:20<SamB>ACTION wonders if specifying a HostName in an ssh_config(5) section will cause the section(s) corresponding to *that* name to be considered
15:20:51<david48>Hi dear channel. Anyone happens to know which package should I install on (K)ubuntu in order to have the haskell platform configure not stop on "checking for library containing glEnd... no"
15:21:36<Botje>SamB: a quick experiment says no
15:21:58<SamB>david48: the OpenGL development package?
15:22:15<SamB>might be mesa.*-dev
15:23:13<SamB>... wierd ... is apt written in Java now ???
15:23:21<david48>samB: I've installed opengl-dev, glut3-dev, mesa-common-dev
15:24:23<david48>samB: also x11proto-dl-dev, libgl1-mesa-dev ( I have no idea if any of them is needed, I just installed them hoping that configure would pass )
15:24:28<SamB>david48: hold on, I'll tell you what I've got that has that ...
15:25:51<david48>Checking the log, it says cannot find -lopengl32. Probably I need more than just the dev package.
15:26:44<SamB>huh ...
15:27:08<SamB>I have a symlink called libopengl32.so, but it points at a non-existant filename ...
15:28:23<david48>trying to find which package provides libopengl32...
15:28:53<roconnor>> let a --> b = a + b in 5 --> 6
15:28:55<lambdabot> 11
15:29:16<roconnor>> let a |-> b = a + b in 5 |-> 6
15:29:17<lambdabot> 11
15:29:53<SamB>david48: well, I'll tell you what package the symlink came from here ...
15:30:02<SamB>oh, it didn't come from a package ?
15:30:06<SamB>... ???
15:31:01<SamB>david48: well, I would have a /usr/lib/libGL.so from package "libgl1-mesa-dev"
15:31:26<SamB>except my nvidia-glx-legacy-96xx package has diverted it to a different location
15:32:03<david48>samB: installed that one. I've got libGL and libGLU in /usr/lib
15:32:16<david48>samB: libGLcore too
15:32:19<Twey>> let f a | a == 1 = 2 in f 1
15:32:20<lambdabot> 2
15:32:28<SamB>well, just create libopengl32.so as a symlink to libGL.so, I guess
15:32:31<Twey>> let f a | -a == 1 = 2 in f (-1)
15:32:32<lambdabot> 2
15:32:33<SamB>that's what it is here
15:32:35<Twey>> let f a |-a == 1 = 2 in f (-1)
15:32:36<lambdabot> <no location info>: Parse error in pattern
15:32:55<SamB>assuming you're running a 32-bit userspace
15:33:06<Twey>Significant whitespace already exists for operators
15:33:39<david48>samB: I do.
15:34:06<roconnor>@fixity ++
15:34:07<lambdabot>Unknown command, try @list
15:34:33<mauke>preflex: seen deeflex
15:34:33<preflex> Sorry, I haven't seen deeflex
15:35:07<deeflex>hmm.
15:35:09<deeflex>=)
15:35:14<bremner>Peaker: DoCon was indeed the package I was thinking of
15:35:31<bremner>http://haskell.org/docon/
15:41:27<david48>Well there's no package in the jaunty repositories that give a libopengl32.* so I guess I'll have to try with a symlink.
15:43:15<david48>... and that was all there is to it. Still, it's kind of dirty that I have to make a symlink for the haskell platform to configure on (K)ubuntu.
15:47:21<defun>hi. can anyone point to a link that would allow to load a .hs file or haskell binary or haskell bytecode from a hypothetical haskell program, extract some arbitrary values, and save them to a tree or a list or some other misc. data structure/container, for the time that the program is running. I would prefer if I could use GHC directly, instead of parsec. Thanks.
15:48:04<Zao>The GHC API might be decent enough.
15:48:14<Zao>ghci and lambdabot uses it, don't they?
15:48:57<defun>zao: any tutorials/documentation I can look at?
15:49:15<defun>i can't find ghc api on hackage...
15:49:59<pumpkin>it comes with ghc :P
15:50:10<Zao>defun: The GHC wiki probably has a fair bit on it, as well as the GHC docs.
15:50:23<Zao>As it's built-in and not generic, I doubt it'd be on Hackage.
15:50:30<defun>ah. thanks.
15:50:47<Zao>I can't offer any links, as I'm currently on a less-than-VT100 terminal :)
15:50:57<Zao>#ghc may have insights.
16:06:23<nikki93>C++ classes suck.
16:06:43<sm>blinding insight! printf adapts to the IO monad
16:07:09<sm>no more putStrLn $ printf
16:08:14<deeflex>I have a data type defined in one file..and wish to create an instance of that type in another file but I keep getting Syntax error in input (unexpected `='). Yes I have imported the file/module.
16:08:57<deeflex>new haskell coder <- :D
16:09:01<Botje>can you show the two files?
16:10:26<deeflex>yes sure
16:11:04<MyCatVerbs>@where hpaste
16:11:05<lambdabot>http://hpaste.org/
16:12:21<deeflex>in module A : data Distance = DistElement { from :: String, to :: String, dist :: Float } deriving (Show,Eq) . In module B: module B where import A {code ....element = DistElement "a" "b" 1.0..more code.}
16:13:32<MyCatVerbs>Please just hpaste the whole files. Much easier to work that way.
16:14:05<deeflex>OK
16:14:54<deeflex>But I don't see why the rest of the code is relevant
16:15:15<mauke>so we can reproduce the problem
16:15:31<mauke>if you can remove the rest of the code while preserving the error, even better
16:25:14<roconnor>@seen luqui
16:25:14<lambdabot>I saw luqui leaving #haskell-blah and #haskell 6h 22m 2s ago, and .
16:26:12<roconnor>@tell luqui I am not a number, I am a free variable: http://www.e-pig.org/downloads/notanum.pdf
16:26:13<lambdabot>Consider it noted.
16:26:56<shazam>what type system extension would allow (\(x:;forall y. y -> y) -> (y 1, y True)) (\z -> z) ?
16:27:09<deeflex>MyCatVerbs, mauke : here it goes. There's a lot of other probs too, but first is line 51 http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5605#a5605
16:27:20<opqdonut>shazam: rank-2 (or rank-n) polymorphism
16:27:25<mauke>and pattern signatures
16:27:28<opqdonut>that too
16:28:14<mauke>deeflex: that code doesn't make any sense
16:28:29<mauke>deeflex: is selectionlist supposed to be a function parameter?
16:28:32<Botje>deeflex: uh. what's that loop fi di vi ei i doing there?
16:29:06<mauke>deeflex: line 47, 48: vi and ei look unused
16:29:26<deeflex>please..there's a lot of things wrong..I know. But right now it's that highlighted line, I doubt the other things affect the way I create a new instance of Distance.
16:29:36<mauke>deeflex: no, stop
16:29:47<mauke>you need to fix the first problem first
16:30:03<mauke>you can't just start in the middle with no understanding what's going on
16:30:53<MyCatVerbs>First things first, fix your indentation.
16:31:06<mauke>deeflex: why do you think there's anything wrong with the way you use DistElement?
16:31:10<MyCatVerbs>Things that are supposed to line up need to actually line up.
16:32:54<shazam>does rank 2 also allow (\ (x:: forall y. y -> (forall z. z -> z)) -> (x 1 True, x True 1)) ?
16:33:00<deeflex>mauke, well that's where hugs tells me there's an error, but yes I agree it might have something to do with something missing in the above lines too.
16:33:13<mauke>deeflex: I thought the error was about the =
16:33:26<Botje>deeflex: lines 49 and 50 should be on the same line
16:34:06<deeflex>omg
16:34:14<Botje>deeflex: that or the body of your function is screwed up
16:34:27<deeflex>omg...nevermind I got it lol
16:34:30<deeflex>=)
16:45:34<SuperDuper>hello, can anyone give me an example of a tree with such data Tree a = Node ( Tree(a,a) ) | Leaf a definition? i can't bite the pair inside
16:46:03<roconnor>SuperDuper: Leaf 0
16:46:17<roconnor>SuperDuper: Node (Leaf (0,1))
16:46:35<Zao>Tree Chainsaw
16:46:44<roconnor>SuperDuper: Node (Node (Leaf ((0,1),(2,3))))
16:47:03<McManiaC>foo.hs:10:4: `print' is not a (visible) method of class `Fraction'
16:47:05<roconnor>SuperDuper: Leaf (6,"Hello World", id)
16:47:06<McManiaC>what does that mean?
16:47:23<McManiaC>this code: http://sprunge.us/VVXe
16:47:54<roconnor>McManiaC: you are tying to make a instance of Fraction with a method named print
16:47:54<mauke>McManiaC: instance Frac Fraction
16:48:13<MyCatVerbs>McManiaC: it is complaining that you put the definition of (print) inside the Fraction instance for Frac, but (print) isn't a part of the Fraction class.
16:48:56<MyCatVerbs>McManiaC: if you just move the print line out of that instance definition then that error will go away. Yay!
16:49:05<McManiaC>ah i got it
16:49:06<McManiaC>okay
16:49:07<McManiaC>:)
17:15:10<deeflex>ok I have a list of [(someObject,Float)...] . I need to select the element from the list with the smallest Float-value. How can I do this?
17:15:31<iago>minimumBy?
17:16:11<iago>> [('a',1.0), ('b',0.5)]
17:16:12<lambdabot> [('a',1.0),('b',0.5)]
17:16:20<iago>:t minimumBy
17:16:22<lambdabot>forall a. (a -> a -> Ordering) -> [a] -> a
17:16:25<iago>:t on
17:16:26<lambdabot>forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
17:16:37<iago>> minimumBy (compare `on` snd) [('a',1.0), ('b',0.5)]
17:16:39<lambdabot> ('b',0.5)
17:16:39<MyCatVerbs>:t comparing
17:16:40<lambdabot>forall b a. (Ord a) => (b -> a) -> b -> b -> Ordering
17:17:07<MyCatVerbs>> minimumBy (comparing snd) [('a',1.0),('b',0.5)]
17:17:08<lambdabot> ('b',0.5)
17:18:02<deeflex>iago, perhaps so..not familiar with the libs yet. I'll check it out :)
17:18:27<deeflex>MyCatVerbs, ok thanks
17:18:51<MyCatVerbs>Thank iago, not me. I forgot that minimumBy even existed. :3
17:19:19<Axman6>heh
17:25:31<deeflex>iago, when I try that in Hugs I get "ERROR - Improperly terminated character constant"
17:26:08<deeflex>minimumBy (compare 'on' snd) [('a',1.0),('b',0.5)] that is
17:26:20<mauke>`on`
17:26:46<iago>I'm not sure if currently hugs provide Data.Function
17:26:47<iago>anyway
17:27:00<iago>(to get on function)
17:27:08<deeflex>mauke, That returns "ERROR Undefined variable "on" "
17:27:11<deeflex>iago, ok
17:27:22<MyCatVerbs>import Data.Function
17:27:40<Axman6>@src on
17:27:40<MyCatVerbs>Or :m Data.Function at the prompt.
17:27:41<lambdabot>(*) `on` f = \x y -> f x * f y
17:28:06<mauke>he said hugs
17:28:09<mauke>isn't it :also there?
17:28:29<deeflex>MyCatVerbs, can't find such a module
17:28:39<mauke>> minimumBy (comparing snd) [('a',1.0),('b',0.5)]
17:28:40<lambdabot> ('b',0.5)
17:29:22<ski>@src comparing
17:29:23<lambdabot>Source not found. Maybe you made a typo?
17:29:31<iago>provides hugs Data.Ord?
17:32:39<deeflex>iago, nope nothing works
17:33:36<iago>deech, or you define them yourself
17:33:40<iago>or you use ghc
17:33:41<iago>:P
17:34:53<iago>> minimumBy (\x y -> compare (snd x) (snd y)) [('a',1.0),('b',0.5)]
17:34:55<lambdabot> ('b',0.5)
17:38:43<voker57__>does anyone know a function that takes list of Maybes?
17:38:52<voker57__>can't seem to find anything in hoogle
17:39:17<deeflex>iago, hehe well that's for two elements..but I got more than that =)
17:39:17<gwern>voker57__: and what would it do with this list?
17:39:17<mauke>id
17:39:22<gwern>head
17:39:37<voker57__>hehe
17:39:57<iago>> minimumBy (\x y -> compare (snd x) (snd y)) [('a',1.0),('b',0.5),('c',0.7),('d',0.2)]
17:39:58<lambdabot> ('d',0.2)
17:40:04<EvilTerran>voker57__, there's catMaybes, sequence, msum...
17:40:21<gwern>@hoogle [Maybe a]
17:40:21<lambdabot>Prelude Nothing :: Maybe a
17:40:21<lambdabot>Data.Maybe Nothing :: Maybe a
17:40:21<lambdabot>Control.Applicative optional :: Alternative f => f a -> f (Maybe a)
17:40:34<voker57__>ok
17:40:42<iago>>let l = [('a',1.0),('b',0.5),('c',0.7),('d',0.2)]
17:40:50<EvilTerran>> (sequence [Just 1, Just 2, Just 3], sequence $ [Just undefined, Nothing] ++ undefined)
17:40:51<lambdabot> (Just [1,2,3],Nothing)
17:41:09<EvilTerran>> catMaybes [Just 1, Nothing, Just 2]
17:41:10<lambdabot> [1,2]
17:41:22<EvilTerran>> msum [Nothing, Just 1, Nothing, Just 2]
17:41:23<lambdabot> Just 1
17:41:56<deeflex>iago, fantastic! :)
17:42:33<iago>deeflex, don't you know that it will works for any list?
17:43:28<deeflex>iago, nope ..gotta learn them lambda expressions ;)
17:43:44<ski> comparing f = compare `on` f
17:43:46<ski>@src on
17:43:46<lambdabot>(*) `on` f = \x y -> f x * f y
17:44:09<ski>deeflex : if you put those two into a module, you can use `comparing' from above directly
17:44:58<iago>for sure is better than write (\x y -> compare (snd x) (snd y))
17:44:58<ski>(i.e. `minimumBy (comparing snd) theList' or whatever)
17:45:08<deeflex>ski, ok cool
17:45:14<deeflex>lot of helpful ppl here tonight :)
17:45:19<iago>but at least
17:45:25<iago>now you know how you could write it
17:45:27<iago>without libs
17:45:28<iago>:P
17:45:32<deeflex>hehe
17:45:51<ski>(i.e. invent (parts of) the libs :)
17:50:00<gwern>@seen dcoutts
17:50:01<lambdabot>dcoutts is in #haskell-soc, #haskell-in-depth, #gentoo-haskell, #darcs, #ghc, #haskell-overflow and #haskell. I last heard dcoutts speak 15m 1s ago.
17:50:25<gwern>dcoutts: any thoughts on my gitit issue?
17:53:19<dcoutts>gwern: that was something with registering right?
17:53:24<gwern>yes
17:53:39<dcoutts>gwern: lemme try and reproduce it, gitit repo?
17:54:06<gwern>dcoutts: although it's not just registering; no gitit-0.6.1.1 directory shows up in my ~/bin/lib either
17:54:23<gwern>http://github.com/jgm/gitit/tree/master
17:54:36<dcoutts>gwern: oh, is there a tarball?
17:54:42<dcoutts>ACTION doesn't have git
17:54:48<gwern>dcoutts: hackage; I've only tested with gitit head tho
17:54:53<dcoutts>gwern: ok
17:55:18<dcoutts>gwern: and this is using Cabal head, using runghc Setup configure; build; install right?
17:55:25<gwern>and also cabal-install head
17:55:47<dcoutts>gwern: ok, so both via runghc and via cabal-install fail?
17:55:50<gwern>yes
17:55:53<dcoutts>'k
17:59:42<dcoutts>gwern: ok, running now, I'll let you know when it finishes (has to build happs etc)
18:00:04<gwern>yeah. I'm cabal-installing the hackage version, but still am in happs
18:02:12<conal>Beelsebob: ping
18:03:14<Saizan>is there a portable way to get a fresh new temp directory?
18:03:52<Saizan>one that you can use to generate some files, move them somewhere else and delete
18:03:57<roconnor>@hoogle tempName
18:03:57<lambdabot>No results found
18:04:03<roconnor>@hoogle temp
18:04:04<lambdabot>package template
18:04:04<lambdabot>package template-haskell
18:04:04<lambdabot>Distribution.Extension TemplateHaskell :: Extension
18:04:27<mathijs>Hi all, I just learned a bit about phantom types. I did a first practice at http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2574#a2574 - representing valid html documents where validation is handled in the type system. Can anyone please have a look and see if I understood the concept correctly?
18:05:10<FunctorSalad>Saizan: there's some function to generate fresh filenames, but I don't know about getting the equivalent to /tmp
18:05:14<sm>does the download package not cabal install on a mac ? it's complaining about missing libio.h
18:06:22<sm>portability: posix. hmm
18:06:26<mathijs>and furthermore: doesn't this become very verbose if more types are needed? And how about other validation stuff like a Html document not allowing 2 head sections? Is it possible to handle that in the typesystem as well or would it be a lot clearer just to use runtime validation?
18:07:25<dcoutts>sm: email the author
18:07:26<Saizan>FunctorSalad: do you know where is that?
18:07:30<sm>will do
18:07:56<EvilTerran>makeGUID?
18:07:59<EvilTerran>:P
18:08:09<FunctorSalad>Saizan: http://haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html#v:openTempFile
18:08:12<cads>hey, what's a book that lifts up through functional programming techniques, through advanced topics like monads, and up into straight category theory?
18:08:37<EvilTerran>i don't think you'll find that in one book
18:09:17<Saizan>FunctorSalad: an, it also creates the file, thanks anyway
18:09:21<cads>that would be nice though
18:09:35<gwern>dcoutts: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5606#a5606
18:09:44<gwern>dcoutts: installed just fine, but ghc-pkg doesn't find it
18:09:54<gwern>dcoutts: so I think the commonality here is cabal
18:10:13<dcoutts>gwern: the files got installed ok?
18:10:21<cads>maybe not pure category theory, but perhaps categorical programming theory
18:10:30<gwern>dcoutts: the command was cabal install gitit-0.5.3 if it matters
18:10:37<gwern>dcoutts: well, I don't see any error in the output...
18:11:46<cads>I know lots of papers on functional programming for will start out with examples in haskell, create an algebraic model from there, and finally show us what that means with category theory
18:12:13<Cale>mathijs: That seems reasonable, except that you'll end up with O(n^2) instances :)
18:13:04<dcoutts>gwern: so gitit-0.5.3 doesn't have any library, so it's not registered.
18:13:12<dcoutts>gwern: does the darcs version have a lib?
18:13:19<gwern>dcoutts: alright, but what about head? it has library/executable syntax
18:13:30<dcoutts>gwern: got a tarball of that?
18:13:31<gwern>and head installed as a library before
18:13:36<gwern>dcoutts: no not really
18:13:46<dcoutts>ACTION doesn't have git
18:13:46<Cale>cads: Did I already give you Awodey's book? It's really just a book on category theory, but it touches on areas relevant to programming anyway.
18:13:46<gwern>(what sort of distro doesn't have git packaged?)
18:14:37<cads>Cale: lol, got an extra copy lying around?
18:14:59<dcoutts>gwern: ok, do you have a log at -v3 for register ?
18:15:13<Cale>Infinitely many, actually.
18:16:24<FunctorSalad>unfold: BookStash -> (AwodeysBook,BookStash)
18:17:22<idnar>copy :: AwodeysBook -> (AwodeysBook,AwodeysBook)
18:17:23<dcoutts>gwern: turns out github makes tarballs
18:17:46<gwern>oh wait. I think I just figured it out
18:17:56<Cale>Yeah, the category for digital information has that nice diagonal map :)
18:18:27<cads>:)
18:18:29<idnar>I guess that's id &&& id or some nonsense
18:18:38<Cale>:t id &&& id
18:18:39<lambdabot>forall b. b -> (b, b)
18:18:41<Cale>mhm
18:19:04<idnar>I always get confused reading those arrow types in prefix form
18:19:55<idnar>also, I feel a bit silly using arrow operators on absolutely nothing but (->)
18:21:22<pumpkin>join (&&&) id ;)
18:21:45<pumpkin>just to be even more gratuitous
18:21:47<idnar>that's longer though
18:21:53<idnar>otherwise I would have used it ;)
18:21:54<pumpkin>it's not about length, it's about repetition!
18:21:55<pumpkin>:P
18:21:58<mauke>join (,)
18:21:58<pumpkin>hrrmpf
18:22:07<idnar>@type join (,)
18:22:08<pumpkin>zomg, but it haz no arroz
18:22:09<lambdabot>forall a. a -> (a, a)
18:22:11<idnar>oh duh
18:22:12<bavardage>dcoutts: it makes tarballs?
18:22:15<idnar>now I just feel stupid
18:22:24<Gracenotes>pumpkin: omg is this normal????
18:22:28<bavardage>dcoutts: you can specify what to tar up etc?
18:22:37<idnar>I accidentally your arrow, is this bad??
18:22:38<dcoutts>bavardage: yep, just hit the download button
18:22:44<bavardage>oh nice
18:24:41<gwern>dcoutts: I feel sheepish now; turns out that the plugins flag enables gitit-as-a-library, and I had switched it in cabal to true so I couldn't forget, but somehow it got flipped back to false, and I didn't realize that a consequence of plugins=false was not just that the executable wouldn't run with my plugins, but also that no library would be built at all
18:25:02<dcoutts>gwern: phew! :-)
18:25:21<gwern>ACTION feels a little irate. I spent at least 2 hours yesterday on this
18:25:57<dcoutts>gwern: mm, disabling the lib does seem a bit odd, I wonder if we should warn or fail
18:26:24<dcoutts>gwern: optionally installing a lib is quite odd, it means other things cannot properly depend on it
18:26:33<gwern>well, if the flag sets the library's buildable to false, then presumably the developer has a reason for it
18:26:53<gwern>but maybe if buildable is being set by a flag, a message?
18:26:57<dcoutts>gwern: right, but it's at least as bad as optionally exposing a module
18:29:50<cads>ACTION is searching for neural net packages that use physically based neuronal models
18:29:58<dever>hey all, i have a predefined list bugs, containing type Bug, which has a field called fixed
18:30:37<dever>this is a silly question, but I forget :D how do I change the value of fixed in a Bug at a certain index
18:30:59<mauke>too complicated
18:31:32<opqdonut>there's no nice way to change a list at an index
18:31:42<opqdonut>mainly because it's an expensive operation
18:32:39<pumpkin>ACTION eats opqdonut
18:32:48<mauke>\i f xs -> let (p, x : q) = splitAt i xs in p ++ f x : q
18:32:52<sbahra>ACTION shows off to pumpkin
18:32:53<BMeph>dever: Thank you! 'Cause I get to tell you: "UR DOIN IT RONG!" ;p
18:33:54<Gracenotes>or, for arrays, \i f xs -> xs // [(i, f (xs ! i))]
18:34:09<dever>you've lost me BMeph :D
18:34:19<dever>ah nevermind, I'll figure a way around it :D
18:34:51<Gracenotes>except the entire array is copied >_> the tail end is left alone in the list version
18:35:01<pumpkin>unless you have a DiffArray
18:35:24<opqdonut>pumpkin: ?
18:35:27<Gracenotes>well. DiffArrays have their own p0rblems.
18:35:35<Gracenotes>porklems, if you will
18:35:37<pumpkin>opqdonut: sry, wuz hungry
18:35:41<opqdonut>ok, np
18:35:48<BMeph>dever: Just check out mauke's and Gracenotes' stuff. Basically, if you're looking for random-access, a list is not the proper structure.
18:36:46<Gracenotes>if changes are infrequent but accessed very much so, a plain ol' Array or UArray could do
18:37:00<pumpkin>if it's sparse, use an IntMap
18:37:02<Gracenotes>I mean, lots of accesses
18:37:10<BMeph> I blame Haskell for making lists too freaking easy to use; it makes it too uncomfortable to think to use other data structures, and encourages data structure/algorithm "impedance mismatcch". :\
18:37:32<dever>ah, but it's for a listStore, which store lists, and its for a demo app for beginners :D, that might be too complex :D
18:38:07<joeally>arghh typeclasses make me wanna kill my self
18:38:20<Gracenotes>BMeph: and whatnot with deforestation. *gazes at GHC dreamily*
18:38:24<joeally>I have a function
18:38:31<joeally>sflush s you tab pls
18:38:31<joeally> |length tab == 3 = if scount s (you++tab) < 3 then 0 else 2*(2/(52-total))*(1/(51-total))
18:38:31<joeally> |length tab == 4 = if scount s (you++tab) < 4 then 0 else 1/(52-total)
18:38:31<joeally> |otherwise = 0
18:38:31<joeally> where total = length tab + 2*pls
18:38:34<BMeph>joeally: And a cheery good afternoon to you, too! ;)
18:38:38<joeally>lol
18:38:48<joeally>hello anyway
18:39:02<Gracenotes>hm. Pretty printing library time? :)
18:39:24<joeally>Possible fix: add an instance declaration for (Fractional Int)
18:39:28<joeally>what does this mean
18:40:26<Gracenotes>the error is due to the fact that '/' is meant for non-integer division. with Floats and Doubles and the like
18:41:06<BMeph>joeally: That's an easy one - length <list> returns an Int, but '/' needs two Fractional arguments. It's complaining that Int is not a Fractional type. :)
18:41:43<Cale>joeally: The numeric typeclass hierarchy takes some getting used to.
18:42:23<joeally>oh
18:42:37<joeally>BMeph
18:42:54<joeally>how can i convert the values to fractional
18:42:59<BMeph>Are there any PLs out there where dependent typing isn't a big PITA? :(
18:43:03<hatds>fromIntegral, usually
18:43:09<joeally>when i did that
18:43:15<BMeph>joeally: hatds got it. :)
18:43:18<joeally>it complained that i inffered int
18:43:44<BMeph>joeally: Try "total = fromIntegral (... )" :)
18:43:54<joeally>ok
18:43:56<joeally>thanks
18:44:32<BMeph>ACTION gives joeally a cyber-"Thumbs Up" :)
18:44:40<joeally>thanks
18:44:45<joeally>thumbs up
18:44:49<joeally>it compiled
18:45:01<BMeph>Usually a good sign. ;)
18:45:12<joeally>types and typeclasses really confuse me
18:45:47<joeally>thankyou
18:46:06<BMeph>joeally: It helps if you pretend that Haskell grew up in an Alternate Universe where OOP was never invented. ;)
18:46:07<joeally>the function worked
18:46:14<gio123>is here anybody from germany?
18:46:18<ray>bmeph: it did
18:46:38<joeally>I'm just used to working in dynamically typed languages
18:48:01<ray>probably used to speaking them too
18:48:49<BMeph>joeally: Yeah, "dynamically-typed" systems are reasonably good in cases where what you're doing isn't too different from what's been done already. When you want to do things that need careful thought about the types, all that dynamicity tends to bite you on the butt. It's an nteresting CS dilemma. :)
18:50:06<gio123>is here anybody from germany?
18:50:12<joeally>BMeph: I like haskell but i get a type error every time i compile
18:50:40<joeally>occasionally i feel like giving up on it
18:50:40<mauke>gio123: yes
18:50:47<BMeph>ray: Actually, I think of this universe as one where OOP was strangled in the crib and replaced with a cuckoo paradigm. -- Whoa, that's a heady mix of metaphors. :)
18:51:24<gio123>mauke: may i pm?
18:53:27<hatds>when learning haskell, typeclasses are less confusing if you don't try to puzzle out typeclass design patterns right away. The more important part is usually "what built types have what useful instances?"
18:53:38<hatds>*built in types
18:55:50<erikc>does anyone know of a language which is statically typed with type inference, but uses a lisp/smalltalk-style image paradigm (it'd have to treat run-time code changes as a transaction that is rejected if the program no longer type checks)
18:57:00<hatds>haskell in N years maybe? :)
18:57:27<p_l>erikc: very very early haskell systems? (heard one of the first implementations was running inside CL)
18:57:50<BMeph>I wonder if augustss knows... :)
18:58:03<augustss>huh? what?
18:58:17<dever>ahh, I can just work off the listContained with in the listStore, and I can dynamically change that
18:58:20<dever>huzzah
18:58:30<dever>-1 for me, for looking at old documentation
18:59:15<augustss>erikc, p_l, BMeph: the Yale Haskell system was written in List (T to be exact), and had many of the typical List system features.
18:59:38<augustss>It's probably the the best interactive Haskell there has been.
18:59:50<augustss>s/List/Lisp/
18:59:57<joeally>can you have 2 where clauses in one function?
19:00:20<erikc>interesting, will check it out
19:00:30<augustss>joeally: no, but you can define more than one thing in a where clause
19:00:37<joeally>okay
19:00:52<joeally>augustss: how would you do that?
19:01:04<hatds>wait, where only scopes over one function equation right?
19:01:12<augustss>f x = y where y = x+z; z = x+2
19:01:21<joeally>thanks
19:01:35<augustss>hatds: yes
19:01:50<augustss>so you can have one where per clause
19:01:54<hatds>ok but that's not what he was asking yea
19:01:55<hatds>:)
19:02:08<augustss>i'm not totally sure what he was asking :)
19:03:03<ski>joeally : you can have nested `where'-clauses, though ..
19:03:07<BMeph>joeally: Could you (h)paste something, just so we can ge sure what you're looking for? :)
19:03:10<skorpan>he asked whether you can have two where clauses in one function :P
19:03:24<joeally>No its fine
19:03:30<Hunner>Your monad can have two where clauses in one function.
19:03:31<joeally>Augussts helped
19:03:41<joeally>BMeph: but thanks anyway
19:03:44<skorpan>Hunner?
19:03:50<augustss>I answered the question I thought he should be asking ;)
19:03:52<Hunner>Nothing.
19:04:03<BMeph>I think I use two where clauses to define my prime factorization function.
19:04:16<joeally>oh
19:05:13<BMeph>Hmm, looks like I refactored the thing to use just one, now. Silly fussy me. ;p
19:06:36<ski>> let rember_up_to_last a0 = set where set as0 = loop as0 where loop [] = as0; loop (a:as) | a0 == a = set as | otherwise = loop as in rember_up_to_last 'c' "abcegcbda" -- nested `where'-clauses
19:06:37<lambdabot> "bda"
19:07:13<Cale>joeally: Just to be clear, the ; in augustss' example can also be replaced by a newline and appropriate indentation :)
19:07:35<joeally>Cale:yes i figured but thanks anyway
19:07:54<joeally>anyone know a good algorithm for finding the mode
19:08:07<joeally>of a list
19:08:29<gwern>augustss: so... haskell is not good for implementing interactive haskell?
19:08:45<augustss>gwern: Who said that?
19:08:50<augustss>Not me.
19:09:04<gwern>augustss: you just said that the best interactive haskell system was not written in haskell
19:09:06<Cale>joeally: group . sort is a good start, perhaps.
19:09:18<joeally>okay
19:09:19<joeally>thanks
19:09:26<augustss>gwern: yeah, but that doesn't imply that Haskell isn't good for it
19:09:30<BMeph>joeally: ...never mind, I forget, Cale's here. ;)
19:09:50<augustss>gwern: Yale Haskell was written in the days when there were no Haskell compilers at all, really
19:09:50<gwern>augustss: dunno, sounds like that was a long time ago, and there've been many haskell implementations since then
19:09:58<Cale>joeally: Then map a function like (\xs -> (length xs, xs)) over that, and use maximumBy
19:10:24<augustss>gwern: A sucky user interface cannot be blamed on the implementation language.
19:10:29<ski>ACTION . o O ( graph length )
19:10:36<Cale>> maximumBy (comparing fst) . map (length &&& id) . group . sort $ "abracadabra"
19:10:37<lambdabot> (5,"aaaaa")
19:10:38<gwern>that certainly seems to me to suggest that the 2 commonalities of the later implementations - not being so hot interactively and being written in haskell - are linked
19:10:50<Cale>> head . snd . maximumBy (comparing fst) . map (length &&& id) . group . sort $ "abracadabra"
19:10:51<lambdabot> 'a'
19:11:12<gwern>and having looked at ghci's source quite a bit, it strikes me as rather ugly, and I wonder how much of the contortions are due to haskell
19:13:02<augustss>gwern: I don't see why the ghc machinery couldn't be used for a nice interactive system. All the hooks are there, AFAIK.
19:13:14<gwern>beware the turing tarpit...
19:14:19<Cale>joeally: Note that while you could use maximumBy (comparing length), it would recompute the lengths of the lists on each comparison, which would be inefficient
19:14:41<augustss>gwern: I've not tried Leksah much, but it seems like a pretty cool IDE.
19:15:01<Gracenotes>Cale: but -- CSE! WooOOooOOooOOooooOO *creepy ghost sounds*
19:15:38<Gracenotes>(okay, not quite CSE)
19:15:41<augustss>Gracenotes: that would be some kind of dynamic CSE, ghc doesn't even do much of static cse
19:15:59<Gracenotes>yeah
19:19:58<skorpan>FITT
19:20:02<skorpan>oops wrong channel
19:22:54<roconnor>Forum for International Trade Training?
19:24:50<skorpan>no, a swedish cuss word
19:24:56<skorpan>at least part of it
19:38:28<voker57__>how to get current UNIX time?
19:38:57<voker57__>or any other format of date/time
19:39:38<Cale>:t Data.Time.Clock.getCurrentTime
19:39:39<lambdabot>IO time-1.1.3:Data.Time.Clock.UTC.UTCTime
19:45:02<voker57__>and any way to get it in nanoseconds? or measure intervals in them?
19:45:17<voker57__>or msecs either
19:45:46<Cale>voker57__: That time is potentially as precise as picoseconds.
19:46:05<idnar>"time-1.1.3:Data.Time.Clock.UTC.UTCTime" is valid syntax?
19:46:32<voker57__>Cale: picoseconds are ok too
20:03:02<shapr>ACTION boings very quietly
20:03:13<shapr>it's oh so quiet...
20:04:02<sm>*hello shapr*
20:04:03<shapr>it's oh so still...
20:04:05<shapr>hiya sm!
20:04:06<shapr>How's code?
20:04:10<sm>*shh!*
20:04:12<shapr>oh, sorry
20:04:13<sm>good thanks!
20:04:16<sm>*good*
20:04:33<shapr>ACTION whispers unintelligibly
20:04:37<sm>*fixed up rss2irc this morning. how's yourself ?*
20:04:52<shapr>Writin C# for work, not so thrilling.
20:05:08<sm>urgh.. php work here
20:05:09<shapr>I think Yaquishael is having connection problems.
20:05:24<sm>I'm grateful for it, but it's a mental battle
20:05:39<shapr>I've been playing with the gtk2hs cairo bindings a bit, but not done anything useful.
20:13:26<lysgaard>I want to: "map ( - 0.02) [0.01, 0.04]" how?
20:13:42<mauke>subtract 0.02
20:14:02<lysgaard>Kidding, is that the problem?
20:14:11<skorpan>it is
20:14:16<skorpan>:t (-)
20:14:17<lambdabot>forall a. (Num a) => a -> a -> a
20:14:26<skorpan>as you can see, it is a binary operator
20:15:02<lysgaard>Yup, and what's the problem with that, shouldn't currying make it happen?
20:15:13<mauke>- is evil magic
20:15:20<mauke>that is, it's also a unary operator
20:15:32<lysgaard>Ah, like negate?
20:15:37<mauke>exactly
20:15:40<mauke>> map (subtract 0.02) [0.01, 0.04]
20:15:41<lambdabot> [-1.0e-2,2.0e-2]
20:15:42<lysgaard>Evil!
20:16:17<lysgaard>>:t subtract
20:16:37<johnbs>does anyone have a copy of Johnsson's "Analysing heap contents in a graph reduction intermediate language" paper? google hasn't been able to find it for me :/
20:16:40<lysgaard>How do i use lambdabot?
20:16:52<mauke>:t subtract
20:16:53<lambdabot>forall a. (Num a) => a -> a -> a
20:17:04<lysgaard>:t subtract
20:17:05<lambdabot>forall a. (Num a) => a -> a -> a
20:17:13<EvilTerran>lysgaard, well, you can talk to her in private message or in any channel she's in
20:17:18<EvilTerran>@help
20:17:18<lambdabot>help <command>. Ask for help for <command>. Try 'list' for all commands
20:17:21<lysgaard>just enter an parsable expresion
20:17:22<EvilTerran>is a good place to start
20:17:42<lysgaard>list
20:17:48<lysgaard>help list
20:17:51<byorgey>@list
20:17:51<lambdabot>http://code.haskell.org/lambdabot/COMMANDS
20:18:00<lysgaard>@help
20:18:00<lambdabot>help <command>. Ask for help for <command>. Try 'list' for all commands
20:18:03<lysgaard>ah
20:18:10<lysgaard>@list
20:18:10<lambdabot>http://code.haskell.org/lambdabot/COMMANDS
20:18:38<EvilTerran> ? and @ work interchangably - i guess if one may be more convenient than the other, depending on your keyboard layour
20:30:16<Boxo>@pl \a b -> a+b
20:30:17<lambdabot>(+)
20:30:24<Boxo>@pl map
20:30:24<lambdabot>map
20:38:01<augustss>@pl pl
20:38:01<lambdabot>pl
20:47:12<Athas>What's the Main.CAF cost centre?
20:50:33<hatds>top level things in module Main that only need to be evaluated once
20:53:07<Athas>Yes, I see. Apparently my stack overflow comes from there. Ah well, I'll compile with -caf-all and see if I get some more descriptive information...
20:54:01<Athas>Oh my.
20:54:12<hackagebot>Added by UweHollerbach, Sat Jun 6 20:52:03 UTC 2009.: A small scheme interpreter http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskeem-0.7.0
20:55:15<Athas>Yes! I have narrowed it down!
20:55:39<byorgey>woah, hackagebot gives summaries now!
20:56:05<byorgey>I wonder who added that, I should like to give them some karma points
20:56:08<sm>sure does, I've been fixing it up this morning
20:56:14<byorgey>sm++
20:56:21<sm>why thank you :)
20:56:32<ehird>Does the prelude have rationals?
20:56:59<byorgey>ehird: depends what you mean by 'the prelude', but Data.Ratio comes in the base package
20:57:19<ehird>thanks
20:57:22<byorgey>> 1 / 3 :: Rational
20:57:23<lambdabot> 1 % 3
20:57:39<Athas>It appears that Data.Array.MArray.getElems is a very dangerous function.
20:58:06<hatds>?
20:58:15<Athas>Uses large amounts of stack space.
20:58:27<Athas>Or maybe my use of it was naive.
20:58:32<Jedai>:t Data.Array.MArray.getElems
20:58:34<lambdabot>forall (a :: * -> * -> *) i e (m :: * -> *). (Data.Array.Base.MArray a e m, Ix i) => a i e -> m [e]
20:58:40<hatds>it will construct the list all at once
20:58:46<hatds>I think
20:58:53<Athas>Perhaps it is newListArray that is dangerous.
20:58:55<hatds>(well otherwise it'd be unsafe ;P)
20:59:18<Jedai>Athas: Well, you're right, getElems is not very nice
20:59:43<Athas>My program died when trying to juggle multi-megabyte arrays.
21:00:02<Jedai>Athas: since it has to construct the whole list in memory, in contrasts of elems for the persistent arrays
21:00:23<ehird>byorgey: how can I convert a Rational to another numeric type?
21:00:24<Jedai>Athas: you can easily inverse the logic though, probably
21:00:36<Jedai>Athas: what were you trying to do ?
21:00:37<Athas>Jedai: I could live with that, but my program crashed with a stack overflow, not heap space exhaustion.
21:00:41<Athas>Copy an array.
21:00:49<byorgey>@type fromRational
21:00:50<lambdabot>forall a. (Fractional a) => Rational -> a
21:00:53<ehird>ah, thanks
21:00:56<hatds>freeze/thaw will copy
21:01:03<uzytkownik>Is there any flip3 or something like that [(a -> b -> c -> d) -> c -> a -> b -> d]?
21:01:40<Jedai>uzytkownik: no, you can write it yourself if you really need it
21:01:52<Athas>I do a mapArray with the identity function now.
21:01:55<Athas>Seems to work nicely.
21:01:59<uzytkownik>Jedai: Thanks
21:02:02<Jedai>uzytkownik: but beware the fact that sometimes pointfree becomes pointless
21:02:35<ehird>byorgey: so what would I use to detect if a rational is an integer or not?
21:02:38<ehird>(??? . fromRational)?
21:02:49<Jedai>Athas: it should, anyway "getElems >>= newListArray bounds" isn't a good solution at all !
21:03:14<uzytkownik>Jedai: Do you refere to (.) :: (b -> c) -> (a -> b) -> a -> c?
21:03:19<Jedai>ehird: (==1) . denominator
21:03:24<ehird>ah, thanks
21:03:39<hatds>better check the convention on the sign
21:03:43<hatds>?
21:04:22<augustss>@pl \ f x1 x2 -> x1 >>= \ y1 -> x2 >>= \ y2 -> f y1 y2
21:04:23<lambdabot>flip ((.) . (>>=)) . flip ((.) . (>>=))
21:04:28<augustss>Yuck
21:04:32<Jedai>uzytkownik: pointfree programming is a style that try to avoid points (arguments) in its expression, it prefer to use combination of function with operator (such as (.), function composition)
21:04:51<byorgey>> denominator (-1 / 3)
21:04:53<lambdabot> 3
21:04:53<augustss>Is there two argument bind hidden away in a library somewhere?
21:04:58<byorgey>> denominator (1 / -3)
21:04:59<lambdabot> Precedence parsing error
21:04:59<lambdabot> cannot mix `GHC.Real./' [infixl 7] and prefix...
21:05:05<byorgey>> denominator (1 / (-3))
21:05:06<lambdabot> 3
21:05:17<byorgey>as I thought, the denominator is always positive.
21:05:28<Jedai>uzytkownik: flip is one the tools that allows to do pointfree programming by replacing "(\x y -> f y x)" by "flip f"
21:06:04<uzytkownik>Jedai: Thanks. So basically pointfree programs uses points ;)
21:06:35<Jedai>uzytkownik: but while pointfree programming is considered elegant by a large part of the Haskell programmers, it can easily be pushed beyond its usefulness and in pointless territory
21:06:52<Jedai>uzytkownik: yes, pointfree programming use a lot of points !!
21:07:37<ClaudiusMaximus>@djinn (a -> b -> c -> d) -> c -> a -> b -> d
21:07:38<lambdabot>f a b c d = a c d b
21:07:45<Jedai>uzytkownik: lambdabot has a command @pl to transform a lambda expression into a pointfree expression, the result is sometimes comic
21:08:06<BMeph>uzy: Try flip . (flip .)
21:08:20<BMeph>@ty flip . (flip .)
21:08:21<lambdabot>forall a a1 b c. (a -> a1 -> b -> c) -> b -> a -> a1 -> c
21:08:36<BMeph>Good, got that right. :)
21:09:37<ehird>@hoogle Double -> Integer
21:09:37<lambdabot>Prelude floatRadix :: RealFloat a => a -> Integer
21:09:37<lambdabot>Prelude ceiling :: (RealFrac a, Integral b) => a -> b
21:09:37<lambdabot>Prelude floor :: (RealFrac a, Integral b) => a -> b
21:09:59<malouin>is there an curry ((a, b, c) -> d) -> a -> b -> c -> d?
21:10:39<aavogt>@type curry . curry
21:10:40<lambdabot>forall a b b1 c. (((a, b), b1) -> c) -> a -> b -> b1 -> c
21:10:48<pumpkin>@hoogle curry3
21:10:49<lambdabot>No results found
21:10:51<pumpkin>:(
21:11:09<aavogt>@type curry . curry . curry
21:11:10<lambdabot>forall a b b1 b2 c. ((((a, b), b1), b2) -> c) -> a -> b -> b1 -> b2 -> c
21:11:29<aavogt>what's bad about nested tuples?
21:12:22<ehird>byorgey: ehm, is there an easy way to get an Integer out of a known-denominator-1 Rational?
21:12:27<ehird>as opposed to going through Fractional
21:12:47<Jedai>ehird: numerator obviouly
21:13:03<ehird>oh, god
21:13:05<ehird>I'm stupid
21:13:05<ehird>>_<
21:13:13<Jedai>ehird: tired I suspect ;)
21:13:13<aavogt>or pattern match the Ratio constructor
21:13:19<ehird>Jedai: headache :<
21:13:25<ehird>aavogt: is that OK?
21:13:48<Jedai>aavogt: not a very good idea, I'm not sure its possible
21:14:13<aavogt>hmm, the constructor is GHC.Real.:%
21:14:35<aavogt>which appears hidden
21:14:41<Jedai>aavogt: Yep, Ratio is abstract (ok, you can find it in the entrail of GHC...)
21:14:43<aavogt>ehird: it won't work either
21:15:45<malouin>Ok, here's a better question...
21:15:47<malouin>http://hpaste.org/view?id=5611#a5611
21:15:51<malouin>how do I get rid of mkHandler
21:17:02<Jedai>ehird: You can also use properFraction and check the reminder is 0
21:17:10<ehird>:t properFraction
21:17:11<lambdabot>forall a b. (RealFrac a, Integral b) => a -> (b, a)
21:17:16<ehird>Could work.
21:17:30<ehird>malouin: write it like this:
21:17:42<ehird>handlers = [Handler [GET] [""]] handleDefault, Handler [GET] ["foo"] handlePost]]
21:18:21<malouin>ehird: ok, that's one way, but Handler is dupicated
21:18:34<johnbs>unzip3 . zipWith3
21:18:45<ehird>malouin: erm
21:18:48<ehird>nothing you can do then
21:19:09<aavogt>malouin: or define uncurry3 elsewhere, I'm sure anybody reading it can guess what it does
21:19:20<malouin>ok.
21:19:39<aavogt>erm, curry3
21:20:28<BMeph>Just curious, but why do you want to get rid of it? It looks like it's where it ought to be. ;)
21:23:26<malouin>BMeph: good point
21:23:41<aavogt>ACTION made an incorrect correction there :(
21:24:17<malouin>aavogt: well, I asked about curry earlier when I really needed uncurry
21:24:35<malouin>ACTION confused matters
21:24:56<ehird>xs@(x:xs') -- any better names for these?
21:25:23<aavogt>ehird: what's so bad about head and tail?
21:25:28<ehird>True.
21:26:26<aavogt>> (\xs@(x:xs') -> "and you might need lazy pattern matching too") []
21:26:27<byorgey>ehird: I often use xxs@(x:xs)
21:26:27<lambdabot> "* Exception: <interactive>:1:134-194: Non-exhaustive patterns in lambda
21:26:56<aavogt>> (\xs@ ~(x:xs') -> "") []
21:26:56<lambdabot> ""
21:27:56<Nereid_>@pl \x y -> map (x:) y
21:27:56<lambdabot>map . (:)
21:28:01<Nereid_>heh
21:28:46<aavogt>@type map . flip (:)
21:28:46<lambdabot>forall a. [a] -> [a] -> [[a]]
21:30:39<Nereid_>@pl \a b -> zipWith (\x y -> map (x:) y) a b
21:30:39<lambdabot>zipWith (map . (:))
21:30:53<Nereid_>so nothing better I guess
21:41:05<mmorrow>@type let f <!> a = join (f <*> a); infixr 1 <!> in \f a b c d -> f <$> a <*> b <*> c <!> d
21:41:07<lambdabot>forall a a1 a2 a3 (m :: * -> *) a4. (Applicative m, Monad m) => (a -> a1 -> a2 -> a3 -> m a4) -> m a -> m a1 -> m a2 -> m a3 -> m a4
21:41:19<mmorrow>@type let f <!> a = join (f <*> a); infixr 1 <!> in \f a b -> f <$> a <!> b
21:41:21<lambdabot>forall a a1 (m :: * -> *) a2. (Applicative m, Monad m) => (a -> a1 -> m a2) -> m a -> m a1 -> m a2
21:42:11<mmorrow>augustss: that (<!>) seems nice for bindN
21:42:45<pumpkin>:o
21:42:59<augustss>mmorrow: that would do :)
21:43:27<augustss>I've wanted bindN several times now, I'm surprised nobody else has complained
21:43:58<mmorrow>i always just accept defeat and use do .. :/
21:44:01<mmorrow>but no more!
21:44:19<augustss>I define bind2 :)
21:44:22<mmorrow>heh
21:44:25<aavogt>@type \f y -> join (f `ap` y)
21:44:26<lambdabot>forall (m :: * -> *) a a1. (Monad m) => m (a -> m a1) -> m a -> m a1
21:44:42<ehird>@hoogle (Eq a) => a -> a -> b -> b -> b
21:44:42<lambdabot>Data.Generics.Basics gfoldl :: Data a => c (a -> b) -> a -> c b -> g -> c g -> a -> c a
21:44:43<lambdabot>Control.Exception catchJust :: Exception -> Maybe b -> IO a -> b -> IO a -> IO a
21:44:43<lambdabot>Control.Exception bracket :: IO a -> a -> IO b -> a -> IO c -> IO c
21:45:55<BMeph>I keep getting stuck with describing the relationship between 'ap' and 'flip bind'. :)
21:49:25<hackagebot>Added by BjornBuckwalter, Sat Jun 6 21:48:34 UTC 2009.: Type-level (low cardinality) integers. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/numtype-1.0
21:49:25<hackagebot>Added by BjornBuckwalter, Sat Jun 6 21:49:09 UTC 2009.: Statically checked physical dimensions. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dimensional-0.8
21:49:26<augustss>:t ap
21:49:27<lambdabot>forall (m :: * -> *) a b. (Monad m) => m (a -> b) -> m a -> m b
21:49:33<augustss>:t flip bind
21:49:34<lambdabot>Not in scope: `bind'
21:49:47<augustss>:t flip (>>=)
21:49:48<lambdabot>forall (m :: * -> *) a b. (Monad m) => (a -> m b) -> m a -> m b
21:50:02<augustss>random permutations of letters
21:50:53<BMeph>augustss: :)
21:51:26<BMeph>For some reason, it reminds me of the strength property, but not quite. :)
21:59:54<dever>hey all I'm having a problem with an event handler in gtk2hs... can anyone take a look at it, and maybe point me in the right direction???
21:59:57<dever>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5613#a5613
22:00:41<dever>this is the error im getting: Couldn't match expected type `Control.Monad.Reader.ReaderT
22:00:44<dever> (GHC.Ptr.Ptr Graphics.UI.Gtk.Gdk.EventM.EExpose) IO a'
22:00:47<dever> against inferred type `IO Bool'
22:00:50<dever>oops
22:05:03<dever>no? :(
22:07:47<dmwit>dever: Still around?
22:08:41<timmaxw>what's the best way to annotate tree structures or other data types with arbitrary data?
22:08:45<timmaxw>i basically know of two approaches:
22:08:57<timmaxw>one is to annotate using a map from paths into the data structure -> annotation data
22:09:09<timmaxw>the other is to make the data structure type parametric on the annotations
22:09:12<timmaxw>thoughts?
22:09:36<timmaxw>for example, with data Expr = Add Expr Expr | Mul Expr Expr | Constant Int
22:09:56<timmaxw>the first approach would be data Annotation a = Annotation (Map [Int] a)
22:10:07<dever>dmwit, yep still here mate
22:10:15<timmaxw>and the second would be data Expr a = Add a (Expr a) (Expr a) | Mul a (Expr a) (Expr a) | Constant a Int
22:10:19<timmaxw>has anybody here done either one before?
22:10:25<dmwit>dever: You have to lift all your IO actions into the ReaderT IO monad.
22:10:47<dmwit>dever: e.g. liftIO $ widgetGetStyle drawingArea
22:10:59<dmwit>dever: Or, just
22:11:12<dmwit>on drawingArea exposeEvent . liftIO $ drawingAreaExpose drawingArea window
22:11:20<dmwit>(if you don't plan on using the Event at all)
22:12:04<dever>ah, ok, I shall go have a look at that, thanks dmwit!
22:12:37<mmorrow>timmaxw: if you have a way to bind vars in your Expr type, you can have a (Map Id info) (but that only lets you annotate expressions bound to vars..)
22:13:17<mmorrow>Let Id Exp Exp
22:13:31<mmorrow>Let [(Id,Exp)] Exp
22:13:45<dmwit>Having separate annotations seems awfully delicate.
22:13:56<dmwit>I would prefer having annotations right in the data type, I think.
22:14:10<timmaxw>i prefer that solution too
22:14:19<timmaxw>i suppose you might even make them recursive:
22:14:37<timmaxw>type ExprWithSourcePos a = Expr (SourcePos, a)
22:14:55<timmaxw>(is it legal to construct parametric types with 'type'?)
22:15:04<dmwit>you bet
22:15:41<mmorrow>newtype MuExp a = MuExp (Exp (Either a (MuExp a)))
22:16:30<timmaxw>'an expression either annotated with a value or another expression'?
22:16:37<ClaudiusMaximus>is it allowed to mix "> haskell" with "\\begin{code}\nhaskell\n\\end{code}" in .lhs files?
22:17:00<mmorrow>(also, if you have your data separate in a Map, and store the /keys/ in the datatype and not the data itself, then you don't have to traverse the Exp to map over the data)
22:17:19<aavogt>ClaudiusMaximus: it could work, the haskell 98 report doesn't recomend it
22:17:20<timmaxw>true. but then you need a key generator
22:17:25<timmaxw>also, you could do both
22:17:29<mmorrow>State Int a
22:17:33<timmaxw>(Expr Int) with Map Int a
22:17:39<mmorrow>totally
22:17:59<timmaxw>what's the purpose of your MuExp?
22:18:02<mmorrow>data Env a = Env {uniq :: Int, infoEnv :: IntMap a}
22:18:19<mmorrow>type M info a = State (Env info) a
22:18:19<timmaxw>a bit of a pain to pass around
22:18:49<timmaxw>(!) :: Env a -> Int -> a
22:18:51<mmorrow>yeah it is, but considering the alternatives it's bearable (imo)
22:19:05<timmaxw>(<<) :: Env a -> a -> (Int, Env a)
22:19:08<timmaxw>for insertion
22:19:38<timmaxw>i think i like annotated trees better... anyway, i'm going to find out how well they work first-hand
22:19:39<dmwit>Yeah, I use (<<) for insertion all the time.
22:19:46<dmwit>Oh, god, I'm so immature.
22:20:11<dever>hey dmwit, I tried that, but its now yielding another error im not sure about? could you take a look please?? http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5613#a5614
22:20:49<ClaudiusMaximus>here's the really weird error i get sometimes when mixing > with \begin{code} : http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5615#a5615
22:21:09<mmorrow>timmaxw: oh, the MuExp was just messing around :)
22:21:45<mmorrow>timmaxw: (but i'm sure there's a few cool things you could do with it)
22:22:00<mmorrow>((i haven't a clue off the top of my head though ;))
22:22:17<dmwit>dever: You don't draw on drawing areas.
22:22:33<dmwit>dever: You draw on DrawWindow's, which you can get from a drawing area.
22:22:38<dmwit>It's confusing, I know.
22:22:41<mmorrow>, let ntimes n = foldr (.) id . replicate n in ntimes 8 (braces . parens . brackets) (int 42)
22:22:43<lunabot> {([{([{([{([{([{([{([{([42])}])}])}])}])}])}])}])}
22:22:48<dever>:0
22:22:58<timmaxw>well, here's a problem with annotated trees:
22:23:01<timmaxw>it's hard to derive Show
22:23:08<timmaxw>unless you require the annotations to be Show-able
22:23:13<dever>thanks dmwit, it is fairly confusing lol, my first attempt a graphicy stuff with gtk2hs
22:23:21<dever>well drawing stuff
22:23:31<dmwit>dever: See drawingAreaGetDrawWindow in Graphics.UI.Gtk,Misc.DrawingArea
22:23:36<dmwit>s/,/./
22:23:37<mmorrow>you should be able to derive Show though, and it'll only work for when the annotation type is an inst of Show
22:23:54<mmorrow>(or do you mean something else?)
22:24:07<timmaxw>i was assuming the compiler would complain because it couldn't prove the annotation was showable
22:24:26<timmaxw>do you mean it will produce the equivalent of instance (Show a) => Show (Expr a)?
22:24:28<dino->dmwit: Would you then get a gc using that DrawWindow?
22:24:31<mmorrow>timmaxw: ah, it'll just stick a (Show a) constraint o
22:24:35<mmorrow>timmaxw: exactly
22:24:37<timmaxw>awesome :D
22:25:01<dmwit>dino-: Dunno, I've only ever done Cairo drawing, never Gtk drawing.
22:25:24<dmwit>dino-: But presumably yes.
22:25:45<mmorrow>timmaxw: (also, you could make your (Exp a) and instance of Functor and be able to fmap over all the `a's nicely)
22:26:00<timmaxw>i wonder if that's derivable
22:26:06<timmaxw>i bet not yet
22:26:31<dever>ah dmwit, I see call the exposeEvent on the DrawWindow?
22:27:20<dmwit>I suppose that's possible.e
22:27:40<dmwit>There should be nothing wrong with handling expose events on its ancestors, either, though.
22:28:53<dever>well then I am absolutely lost with this :D
22:29:07<dever>someone should write a book on graphics with gtk2hs :D
22:29:19<timmaxw>oh sweet, somebody gave GHC the ability to derive Functor back in February
22:29:29<dmwit>The tutorials for Gtk2 are good, and easily translated into gtk2hs.
22:29:51<dever>yeah, Im trying to translate gtk-demo to gtk2hs atm
22:30:37<dmwit>You've got to be a little bit careful with gtk2hs' own tutorials, though; it's undergone some fairly major changes recently.
22:33:43<dever>yeah I know that too, I was planning on updating the tutorials too. It all changed midway through doing the file manager! Perfect timing for changes... two/three weeks before I had to demo it!
22:40:29<ClaudiusMaximus>> let primitive = 0 in primitive
22:40:30<lambdabot> 0
22:40:41<ClaudiusMaximus>hmm, hugs spits out an error at that
22:40:48<ClaudiusMaximus>ERROR - Syntax error in expression (unexpected keyword "primitive")
22:40:55<timmaxw>> let {a=1:b; b=1:a} in a
22:40:57<lambdabot> [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,...
22:41:03<timmaxw>wow, it's sort of smart
22:41:31<mauke>> let a = 1 : a in a
22:41:33<lambdabot> [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,...
22:41:45<mauke>> repeat 1
22:41:46<lambdabot> [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,...
22:41:58<timmaxw>> let {a=1:b; b=2:c; c=3:a} in a
22:41:59<lambdabot> [1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,...
22:42:10<mauke>> cycle [1,2,3]
22:42:12<lambdabot> [1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,...
22:42:14<timmaxw>oh snap
22:42:15<ClaudiusMaximus>can't seem to find where keyword "primitive" is defined in the report, doesn't help that with my browser settings the majority of the text is white on white
22:42:23<pjdell>anyone that could help me figure out a good way to do port forwarding on a netowrk with a qwest modem and a linksys router?
22:42:30<mauke>ClaudiusMaximus: it's probably a hugs extension
22:42:41<mauke>pjdell: how is that a haskell question?
22:42:57<twanvl>ClaudiusMaximus: are you running "hugs -98"?
22:43:08<ClaudiusMaximus>twanvl: no
22:43:16<timmaxw>>[1..]
22:43:26<timmaxw>> [1..]
22:43:28<lambdabot> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28...
22:43:40<timmaxw>> [100..]
22:43:42<lambdabot> [100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,11...
22:43:50<ClaudiusMaximus>twanvl: same effect with hugs, hugs +98, hugs -98
22:44:20<timmaxw>maybe it's a layout issue
22:44:41<timmaxw>try 'let {primitive = 1} in primitive'
22:44:56<ClaudiusMaximus>i just noticed it because my syntax highlighter turned 'primitive' bold dark blue
22:45:10<mmorrow>, fix ((h::Expr->Expr) . (g::Expr->Expr) . f)
22:45:13<lunabot> h (g (f (h (g (f (h (g (f (h (g (f (h (g (f (h (g (f (h (g (f (h (g (f (h...
22:45:33<uzytkownik>How to search and replace a longer string in Haskell? For example replace te with hy in test?
22:46:18<timmaxw>'primitive' does not appear as a keyword in the Haskell 98 report
22:47:12<Botje>uzytkownik: what do you have so far?
22:47:24<uzytkownik>Botje: Ie?
22:47:57<uzytkownik>Botje: I need basicly a replace function
22:48:03<Botje>so write it ?
22:48:08<Botje>you could use Text.Regex
22:48:19<Botje>or Data.List.Split
22:48:38<ClaudiusMaximus>:t isPrefixOf
22:48:39<lambdabot>forall a. (Eq a) => [a] -> [a] -> Bool
22:48:51<ClaudiusMaximus>might be useful for rolling your own
22:49:10<mmorrow>@let f <!> a = join (f <*> a)
22:49:11<lambdabot> Defined.
22:49:22<mmorrow>oh crap
22:49:55<mmorrow>@undefine
22:50:03<mmorrow>> (<!>)
22:50:05<lambdabot> Not in scope: `<!>'
22:50:17<mmorrow>@let f <!> a = join (f <*> a); infixr 1 <!>
22:50:18<lambdabot> Defined.
22:50:24<Botje>:t (<!>)
22:50:25<lambdabot>forall (m :: * -> *) a a1. (Applicative m, Monad m) => m (a -> m a1) -> m a -> m a1
22:50:34<uzytkownik>Botje: It's rather basic function so is in standard. I'll look on Data.List.Split
22:50:43<mmorrow>@type \f a b c d -> f <$> a <*> b <*> c <!> d
22:50:45<lambdabot>forall a a1 a2 a3 (m :: * -> *) a11. (Applicative m, Monad m) => (a -> a1 -> a2 -> a3 -> m a11) -> m a -> m a1 -> m a2 -> m a3 -> m a11
22:50:53<mmorrow>@type \f a b -> f <$> a <!> b
22:50:54<lambdabot>forall a a1 (m :: * -> *) a11. (Applicative m, Monad m) => (a -> a1 -> m a11) -> m a -> m a1 -> m a11
22:54:28<mmorrow>@type let f <@> a = join (f <*> a) =<< a in (<@>)
22:54:29<lambdabot>forall a b. (a -> a -> a -> a -> b) -> (a -> a) -> a -> b
22:54:42<mmorrow>@type let f <@> a = join (f <*> a) `ap` a in (<@>)
22:54:43<lambdabot>forall (m :: * -> *) a b. (Monad m, Applicative m) => m (a -> m (a -> b)) -> m a -> m b
22:54:56<mmorrow>@type let f <@> a = join (f <*> a) <*> a in (<@>)
22:54:57<lambdabot>forall (f :: * -> *) a b. (Monad f, Applicative f) => f (a -> f (a -> b)) -> f a -> f b
22:56:04<mmorrow>@type let f <@> a = join (f =<< a) <*> a in (<@>)
22:56:05<lambdabot>forall a (f :: * -> *) b. (Applicative f, Monad f) => (a -> f (f (a -> b))) -> f a -> f b
22:58:11<mike-burns>Are there any known bugs with gtk2hs's IconView? The docs on it are slim (in any language), but I keep getting "Gtk-CRITICAL **: gtk_icon_view_set_model: assertion `column_type == GDK_TYPE_PIXBUF' failed"
23:03:37<CSWookie>Could someone tell me what the following type signature means? I understand part of it, but not all.
23:03:40<CSWookie>merge :: (Ord t) => [t] -> [t] -> [t]
23:04:10<mauke>merge takes two lists (of some type t) and returns a list of t
23:04:11<pumpkin>it takes two lists of values with an odering defined on them, and returns another list of the same type of element
23:04:14<mauke>t also must be comparable
23:04:50<CSWookie>Could you break that down for me?
23:05:31<CSWookie>=> is yields, so I get that, but I don't know what -> means.
23:05:39<pumpkin>not yields, it's a constraint on the type
23:05:41<Tsion>(Ord t) => means that in the type signature, t represents a type that can be compared or ordered
23:05:52<pumpkin>[t] -> [t] -> [t] is more general than Ord t => before that
23:06:07<pumpkin>that means for any type t, the function works like that
23:06:26<pumpkin>whereas the Ord t restricts that only to types that have an Ord instance
23:06:28<dino->It helps sometimes to read -> as 'to'. Function from list of t to list of t to list of t
23:06:42<CSWookie>so [t] -> [t] -> [t] means list of type t?
23:06:49<pumpkin>[t] is list of type t
23:06:50<dmwit>No, [t] means list of type t.
23:07:04<dmwit>(->) is the function type constructor.
23:07:29<dmwit>[t] -> [t] is a function from a list of ts to a list of ts.
23:07:41<mozzyb>Hi - I am trying to learn haskell and I have now got myself into some monad troubles. I am doing the yaht and I am trying to make the askForNumbers thing. The problem seems to be that after getting user input and storing it in a list, the list becomes of the type IO [Integer]. What I want to do is use a pure function on this, but I can't as it is tagged IO. Can someone show me how to use f.eks. map (*) over a IO [Integer] ? I just don't real
23:07:55<dmwit>[t] -> [t] -> [t] = [t] -> ([t] -> [t]) is a function from a list of ts to another function, which itself takes a list of ts and yields a list of ts.
23:07:58<CSWookie>Hmm. I think I didn't write what I meant to write.
23:08:04<pumpkin>mozzyb: use liftM or fmap
23:08:18<pumpkin>mozzyb: to lift your map f into the IO
23:08:36<mozzyb>pumpkin: ah.. I'll try that.
23:09:07<dmwit>mozzyb: Has "do" notation been introduced yet?
23:09:18<dmwit>mozzyb: If so, one common way to do this is to write
23:09:20<mmorrow>BMeph: yeah, ap and (=<<) are can't-quite-put-your-finger-on-it similar
23:09:29<pumpkin>:t ap
23:09:31<lambdabot>forall (m :: * -> *) a b. (Monad m) => m (a -> b) -> m a -> m b
23:09:32<pumpkin>:t (=<<)
23:09:33<lambdabot>forall a (m :: * -> *) b. (Monad m) => (a -> m b) -> m a -> m b
23:09:40<dmwit>do { xs <- askForNumbers; someMonadicActionOnAListOfNumbers xs }
23:09:43<dmwit>or
23:09:53<mauke>:t [ap, (=<<)]
23:09:54<lambdabot>forall a b. [(a -> a -> b) -> (a -> a) -> a -> b]
23:09:57<dmwit>do { xs <- askForNumbers; someMonadicBlah (map (*3) xs) }
23:09:58<dmwit>or whatever
23:10:17<mmorrow>@let f =<*< a = join (liftM (=<< a) f)
23:10:18<lambdabot> Defined.
23:10:28<mmorrow>@type (=<*<)
23:10:30<lambdabot>forall (m :: * -> *) a a1. (Monad m) => m (a -> m a1) -> m a -> m a1
23:10:41<jmillikin>Can a Hackage package be renamed? I uploaded a parser for IEEE 754 values some time ago, and now I've added serialization to it, so I'd like to change the name to be a bit more appropriate.
23:10:55<mozzyb>dmwit: I am using do. But Havn't really understood it yet. what I am trying to do is map (*) l where the l is of type IO [Integer]
23:10:57<jmillikin>that is, from ieee754-parser to data-binary-ieee754
23:11:12<mmorrow>mauke: ah nice, they coincide with reader
23:11:27<dmwit>mozzyb: You can do so by retrieving the list using (<-), as I showed above.
23:11:38<mmorrow>mauke: that's interesting
23:12:29<mauke>> ap (-) sqrt 3
23:12:30<lambdabot> 1.2679491924311228
23:12:35<mauke>> (=<<) (-) sqrt 3
23:12:36<lambdabot> -1.2679491924311228
23:12:38<dmwit>mozzyb: The short story is that you can never escape IO once you're in it. You can only drag more and more things into IO.
23:12:48<mmorrow>ah
23:12:53<mmorrow>tricksy
23:12:59<dmwit>mozzyb: When you want to do pure calculations, you convert them from pure calculations to IO calculations, then use them inside of IO.
23:13:06<skorpan>is that application of (=<<) in the (->) monad?
23:14:10<mozzyb>dmwit: ah. ok. I'll try some more and shout out if I still don't get it. Thanks
23:14:11<mmorrow>@type ap (=<<)
23:14:13<lambdabot>forall a (m :: * -> *) b. (Monad m) => ((a -> m b) -> m a) -> (a -> m b) -> m b
23:14:15<mmorrow>@type (=<<) ap
23:14:16<lambdabot>forall (m :: * -> *) a b. (Monad m) => (m a -> m (a -> b)) -> m a -> m b
23:16:37<mozzyb>dmwit: I'm stupid :P I thought I had already tried something, and I hadn't... or I had a misspelling or something last time. No problem no more :D
23:17:51<dmwit>Great!
23:18:29<inetic>arrr, google is quite useless when one wants to search for something like this: "haskell the @ operator". could you guys please point me somewhere where the @ operator is explained?
23:19:00<mauke>@ is not an operator
23:19:17<opqdonut>var@pattern does a pattern match but binds the whole pattern to var also
23:19:39<opqdonut>> let y@(x:xs) = [1,2,3] in (y,x,xs)
23:19:40<lambdabot> ([1,2,3],1,[2,3])
23:19:43<opqdonut>get it?
23:19:50<CSWookie>http://pastebin.com/d5346821a <-- I put this together based on some help from some guys in this channel, but I think my changes might have broken something. I don't understand why it has the type signature it does.
23:19:53<mike-burns>inetic: For the future you may want http://haskell.org/hoogle/
23:20:17<inetic>aha, I think I get it, many thanks
23:20:37<Botje>CSWookie: you have to stick the y and x back on
23:20:46<Botje>(lines 3 and 4, resp.)
23:20:57<mauke>Botje: huh?
23:21:03<Botje>oh
23:21:05<Botje>OH
23:21:09<Botje>didn't see the @
23:21:11<Botje>nevermind :)
23:21:11<opqdonut>can't find anything wrong with that
23:21:24<Botje>but it /is/ confusing :)
23:21:28<mauke>well, merge [] [] will fail
23:21:36<CSWookie>Well, I don't know haskell idiom.
23:21:37<inetic>mike-burns, that page seems to be a great source of info, thanks
23:21:50<dmwit>CSWookie: Looks good to me; what were you expecting and what did you get instead?
23:21:59<CSWookie>mauke: Should there be a merge _ _ clause?
23:22:15<yav>hi. has anyone had any luck building the network package on windows?
23:22:15<lambdabot>yav: You have 1 new message. '/msg lambdabot @messages' to read it.
23:22:20<mauke>CSWookie: no, the last two cases should be merge [] ys = ys; merge xs _ = xs
23:22:20<Tsion>CSWookie: It has that type signature because it takes two lists and returns a list. It has (Ord t) because the (>) function takes two Ord types
23:22:21<dmwit>CSWookie: I would replace the last two clauses with just merge xs ys = xs ++ ys.
23:22:40<CSWookie>dmwit: I don't expect anything so far, I'm just trying to understand the resulting type signature.
23:22:44<mauke>or that, but that may copy xs unnecessarily
23:25:58<CSWookie>So, what does [t] -> [t] -> [t] mean, again?
23:26:11<pumpkin>a function that takes two lists of t and returns one list of t
23:26:21<CSWookie>Oh.
23:26:33<pumpkin>or more strictly a function that takes a list of t, returns a function that takes a list of t and returns a list of t
23:26:39<CSWookie>That's what I expect... But it seems bizarre tpo use that notiation.
23:26:43<pumpkin>[t] -> ([t] -> [t])
23:27:28<Tsion>CSWookie: It's bizarre because of currying. You can partially apply the function by calling it with one argument instead of two.
23:27:31<CSWookie>pumpkin: Why does my function return a function?
23:27:42<pumpkin>Tsion just said why :)
23:28:01<mauke>f x y is ((f x) y)
23:28:10<CSWookie>Does that apply to all functions, or did I inadvertently do something to kick in currying?
23:28:22<Tsion>CSWookie: This applies to all functions.
23:28:24<mauke>you defined your function as 'f x y = ...'
23:28:40<mauke>that's equivalent to 'f = \x -> y -> ...'
23:28:43<mauke>er, \y
23:28:48<dmwit>You could define it as
23:28:53<pumpkin>you could easily make a function f :: ([t], [t]) -> [t]
23:28:53<dmwit>f(x, y) = ...
23:29:00<pumpkin>but that' be unnecesarily limiting
23:29:01<dmwit>as in other functions that will remain nameless.
23:29:02<pumpkin>damn :)
23:29:12<mauke>why no space after f?
23:29:16<dmwit>err... s/functions/languages/
23:29:22<dmwit>mauke: Why not?
23:29:45<mauke>for consistency
23:29:48<dmwit>mauke: Also, it's to make the confusion between Haskell and other languages all the more complete, I guess. =)
23:32:29<malouin>for n lists of m elements, concat runs in n, right?
23:32:48<CSWookie>Hmm. When I try to pass the result to takeWhile, I get an error about how it can't match expected [a] to inferred [t].
23:33:06<CSWookie>Do I need to explicitly declare my type signature to involved [a]?
23:33:14<pumpkin>malouin: nope
23:33:20<mauke>CSWookie: what's the real error?
23:33:30<dmwit>malouin: concat runs in O(n), where n is the number of elements of the resulting list you demand.
23:34:05<malouin>interesting.
23:35:06<malouin>if ShowS allows constant time joining of strings, couldn't concat run in O(n) where n is the number of elements in the argument list?
23:35:35<depill>Hi, can anyone help me with some very basic haskell? I need to take a list and turn it into tuple. Example listToTuple [1,2,3,4,5] = (1,(2,(3,4))) I've done this: let listToTuple [] = () ; let listToTuple (x:xs) = (x: listToTuple xs) But when I try to run listToTuple [1,2,3,4,5] I get an exception stating "Non-exhaustive patterns in function listTotuple"
23:35:46<pumpkin>depill: can't be done
23:36:10<Botje>malouin: it's not constant time, but each string is only traversed once instead of n times (for n calls to ++)
23:36:31<depill>pumpkin: why is that?
23:36:46<pumpkin>depill: the number of elements in the input list determine the type of the return value
23:36:50<malouin>Botje: ok.
23:36:58<depill>k thanks
23:37:09<pumpkin>depill: also, if you wanted something like that maybe you'd wnat to make it more homogeneous, with (1,(2,(3,(4,(5, ()))))
23:37:18<pumpkin>depill: you can do that in template haskell
23:37:24<CSWookie>mauke: It's an 8-line trace. Is that short enough to paste here, or do you want me to pastebin?
23:37:35<depill>pumpkin: Thanks alot
23:37:36<mauke>CSWookie: pastebin
23:38:08<pumpkin>depill: you could sort of fool it :P
23:38:19<pumpkin>depill: but it wouldn't buy you anything over a list
23:38:56<CSWookie>mauke: http://pastebin.com/d363432e1
23:39:34<mike-burns>CSWookie: Try this: takeWhile (<1000) (merge [0, 3 ..] [0, 5 ..])
23:39:34<mauke>CSWookie: the inferred type is [t] -> [t] -> [t], not just [t]
23:39:34<Botje>CSWookie: that code gives four arguments to takeWhile
23:39:35<ulfdoz>Sie ist nicht mehr die Jüngste.
23:39:41<ulfdoz>ewin, sorry.
23:40:52<CSWookie>Botje: Oh, I thought order of operations would handle it.
23:41:22<Botje>CSWookie: "order of operations" ?
23:41:42<Botje>haskell can't know for sure you don't mean "pass merge as an argument to takeWhile"
23:42:42<CSWookie>Botje: Fair enough.
23:52:51<CSWookie>Is there a function in the stdlib to uniqify a list?
23:52:57<mike-burns>nub
23:53:00<Tsion>CSWookie: nub
23:53:03<CSWookie>nub?
23:53:11<CSWookie>What does that mean?
23:53:14<Tsion>It's an odd name. :P
23:53:19<aavogt>@type nub
23:53:20<lambdabot>forall a. (Eq a) => [a] -> [a]
23:53:28<mike-burns>It's Old English.
23:53:39<Tsion>> nub [1,1,2,5,4,5,5,7,8]
23:53:41<lambdabot> [1,2,5,4,7,8]
23:54:00<CSWookie>I know what the nub of something is, I don't see how it applies here. Oh well.
23:54:15<mike-burns>nib, n: The essence; the core, e.g. "the nub of a story"
23:54:21<mike-burns>I guess they ran out of words.
23:54:31<mauke>niiiiiiiiiiiiiiib
23:54:32<CSWookie>uniq wasn't good enough?
23:54:32<ac>So I've been thinking about making a web based IM style program using Haskell. Is this a bad idea? Any obvious libraries I should use?
23:54:41<Tsion>I think uniq would have worked well.
23:54:53<mike-burns>uniq would have been the perfect name.
23:55:09<ac>(IM meaning instant messaging)
23:55:09<mauke>uniq only removes adjacent duplicates
23:55:42<inimino>posix:uniq, but the word could have been repurposed slightly
23:57:24<CSWookie>Hmm.
23:57:33<CSWookie>nub isn't abailable to me.
23:57:41<Tsion>CSWookie: import Data.List

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