Experimental IRC log haskell-2009-05-23

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

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

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

00:00:54<danra>FunctorSalad, you're right, but why not *allow* to access the Functor instance?
00:02:06<FunctorSalad>you could use the Functor instance in the Monad instance decl if Functor was a superclass of Monad...
00:02:23<FunctorSalad>maybe you mean something else by 'access'?
00:02:40<roconnor>gnuvince_ it was supposed to be execWriter
00:02:51<danra>FunctorSalad, I do mean something else. I mean access from within the type class declaration
00:03:25<gnuvince_>roconnor: yeah, I found it. However, I cannot get the code to compile :(
00:03:38<roconnor>gnuvince_: {- TODO imports -}
00:03:43<roconnor>let's see
00:03:49<roconnor>import Control.Applicative
00:03:50<danra>That way an instance of Monad would use either Functor's default function implementations, *or* Functor's function implementations which are provided by the Monad type class
00:03:56<schoenfinkel>danra: you want to override something in the definition of a Functor?
00:03:57<roconnor>import Control.Monad.Writer
00:04:03<danra>yes
00:04:09<roconnor>import Data.Monoid ?
00:04:17<roconnor>@index getSum
00:04:17<lambdabot>bzzt
00:04:18<danra>or maybe even just override non-implemented functions
00:04:19<gnuvince_>roconnor: I mean, after that
00:04:22<roconnor>@hoogle getSum
00:04:22<lambdabot>Data.Monoid getSum :: Sum a -> a
00:04:23<schoenfinkel>it would be madness in that case, of course.
00:04:26<danra>which could be simpler
00:04:35<roconnor>gnuvince_: oh what's the error?
00:04:59<gnuvince_>roconnor: node expects a BTree, it's passed an m BTree
00:05:02<MonadBaastad>ACTION prefers "fmap f x = ap (return f) x" instead... ;p
00:05:55<schoenfinkel>class Functor f where fmap :: (a -> b) -> f a -> fb
00:06:22<roconnor>gnuvince_: hmm
00:06:56<roconnor>ah
00:06:56<schoenfinkel>danra: what am I going to over-ride?
00:07:21<roconnor>gnuvince_: well, I found an error
00:07:28<roconnor>gnuvince_: I think
00:07:46<roconnor>> getSum (7 `mappend` 7)
00:07:47<lambdabot> No instance for (Num (Sum a))
00:07:47<lambdabot> arising from the literal `7' at <i...
00:08:07<roconnor>gnuvince_: replace "tell 1" with incCounter, and ...
00:08:23<roconnor>gnuvince_: "incCounter = tell (Sum 1)"
00:08:34<roconnor>... "tell (Sum 1)" has a nice ring to it.
00:08:44<hatds>:)
00:08:44<danra>shoenfinkel, Instead of List doing the instantiation for fmap, you could have a ListClass class type doing the instantiation
00:08:53<danra>type class
00:08:55<danra>sorry :()
00:09:06<pumpkin>huh?
00:09:17<Badger>goat
00:09:42<gnuvince_>roconnor: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5139#a5142
00:10:01<danra>Instead of List doing the instantiation for fmap, you could have a ListClass type class doing the instantiation, which would give a base for all sorts of list data types
00:10:17<solrize_>my version uses State and is almost instant for n=10 and blows the stack for n=20
00:10:54<solrize_>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5139#a5143
00:11:07<danra>ListFunctor will just be a specialized case of Functor
00:11:12<roconnor>gnuvince_: ah I see. oops
00:11:14<solrize_>any idea how to fix it?
00:11:55<MonadBaastad>ACTION would, of course, write it as "fmap = ap . return"
00:12:13<pumpkin>of course ;)
00:12:20<roconnor>gnuvince_: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5139#a5144
00:12:25<roconnor>sorry for the error
00:12:31<schoenfinkel>instead of instance Functor [] where fmap = map we make a new class Functor a => ListClass a where listmap :: (a -> b) -> (fa -> fb)
00:12:36<roconnor>good thing we have a type checker.
00:12:58<pumpkin>o.O
00:13:03<pumpkin>why?
00:13:11<schoenfinkel>danra: then say instance ListClass [] where listmap = map
00:13:23<pumpkin>that's the exact same type as the original fmap
00:13:29<schoenfinkel>of course, in this case
00:13:51<pumpkin>ACTION is getting more and more confused by this talk
00:13:57<roconnor>gnuvince_: oh the fact that my writer isn't strict will make my code slow for large input
00:13:58<schoenfinkel>danra mentioned ListClass, I'm trying to figure out the idea
00:14:13<danra>schoenfinkel, that would work, but *why* do you want to define another name?
00:14:30<MonadBaastad>ACTION prefers to wonder why we have a "Foldable" class, instead of "Data.Algebra"...
00:14:50<gnuvince_>roconnor: starting the program with an argument of 0 causes a stack overflow
00:14:57<danra>I want to be able to use the original fmap function from the Functor type class, but use the implementation which is defined in the ListFunctor type class
00:15:01<roconnor>:(
00:15:02<FunctorSalad>MonadBaastad: "Foldable" is specific for algebras of the list signature I think
00:15:05<danra>ListClass = ListFunctor, my mistake
00:15:46<schoenfinkel>what you want is something like, class Functor a => ListClass a ... instance ListClass [] where I take it back about fmap
00:15:50<FunctorSalad>MonadBaastad: there's support for general F-algebras in the multirec package
00:16:00<danra>schoenfunkel: yes
00:16:08<roconnor>gnuvince_: I guess you should use this code, http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5139#a5143 , whoever wrote it.
00:16:11<schoenfinkel>and say that in this case fmap is going to be something else
00:16:20<schoenfinkel>but why say it's a functor is it isn't one?
00:16:22<_JFT_>gnuvince, roconnor : http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5139#a5145
00:16:28<danra>it's just going to have a different default *implementation*
00:16:54<Berengal>fmap doesn't have a default implementation...
00:17:09<danra>it's just going to have *a* default *implementation*
00:17:09<roconnor>_JFT_: I don't think that is a fair translation of the python.
00:17:14<schoenfinkel>no, but we instanced listmaking as a functor
00:17:35<_JFT_>roconnor: well it does create a Tree ;)
00:17:35<schoenfinkel>so thats 'implementing' fmap in the case of [a]
00:17:36<pumpkin>danra: = error "sorry no can haz fmap"
00:17:56<_JFT_>roconnor: and it stays pure a little bit longer which is more idomatic of Haskell :D
00:17:56<gnuvince_>roconnor: it overflows as well.
00:18:13<schoenfinkel>yes, this is a bad example, Functor is far too exalted to mess with anyway
00:18:16<gnuvince_>I think I'll just abandon the idea of trying to make a Haskell version
00:18:22<danra>schoenfinkel, yes, but i don't want to have the final data type of list
00:18:23<roconnor>gnuvince_: really?
00:18:24<roconnor>wow
00:18:38<pumpkin>ACTION is utterly confused by all this
00:18:38<danra>i want to be able to reuse the listfunctor type class
00:18:41<schoenfinkel>yes, I know it was something about cars
00:18:47<danra>:)
00:19:03<danra>just means I'm not good at explaining what's going on in my head :)
00:19:26<gnuvince_>roconnor: Yeah, I had originally figured it would take 5-10 minutes to write a version and that it would totally kill the Python and Clojure versions
00:19:49<_JFT_>roconnor: add strictness annoation to Node (!)
00:19:50<gnuvince_>Over an hour later, and still no working program, I guess I'd better get back to preparing for my math exam tomorrow.
00:20:17<roconnor>gnuvince_: doesn't stack overflow for me
00:20:18<schoenfinkel>hmmm
00:20:23<roconnor>gnuvince_: my code
00:20:57<gnuvince_>roconnor: that's weird. I'm on Arch Linux, 32 bit, GHC 6.10.3
00:21:27<roconnor>The Glorious Glasgow Haskell Compilation System, version 6.8.2
00:21:35<FunctorSalad>danra: I lost the thread too...
00:21:36<roconnor>ghc --make -O2 -no-recomp Foo.hs
00:21:42<_JFT_>roconnor, gnuvince : http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5139#a5146
00:21:51<pumpkin>-fforce-recomp ! :)
00:21:54<roconnor>$ ./Foo 0
00:21:55<roconnor>1
00:22:12<roconnor>gnuvince_: but I think my code needs to be optimized to work with larger inputs
00:23:04<_JFT_>roconnor: just add strictness annotation to force the evaluation of the branches
00:23:51<roconnor>_JFT_: the strictness annotation needs to go into the bind operation
00:24:03<roconnor>@src Sum
00:24:03<lambdabot>Source not found. Are you on drugs?
00:24:09<roconnor>@src Data.Monoid.Sum
00:24:09<lambdabot>Source not found. It can only be attributed to human error.
00:24:14<roconnor>@hoogle runContT
00:24:14<lambdabot>Control.Monad.Cont runContT :: ContT r m a -> (a -> m r) -> m r
00:24:18<_JFT_>roconnor: which version are you working on? (on hpaste)
00:24:33<roconnor>_JFT_: the writer monad one on hpaste
00:24:47<EvilRanter>@slap EvilTerran
00:24:48<lambdabot>ACTION decomposes EvilTerran into several parts using the Banach-Tarski theorem and reassembles them to get two copies of EvilTerran!
00:25:10<_JFT_>roconnor: then change "data BTree = Leaf | Node BTree BTree" to "data BTree = Leaf | Node !BTree !BTree"
00:25:25<_JFT_>roconnor: your sub-trees are lazy right now
00:25:39<roconnor>I don't care about the trees, they are not important.
00:25:50<roconnor>the writer counter is what is important.
00:25:52<_JFT_>maybe not but they are causing a space0-leak
00:26:02<_JFT_>while the counter use them
00:26:27<roconnor>The tree spaceleak is the same order as the size of the tree.
00:26:48<roconnor>unless you cheat by sharing the binary tree to make it log-sized
00:26:49<_JFT_>roconnor: true...
00:26:54<roconnor>... maybe that isn't cheating
00:30:48<roconnor>gnuvince_: importing Control.Monad.Writer.Strict makes my code 1000x faster
00:31:05<roconnor>no change in the code.
00:31:20<roconnor>@karma+ modules
00:31:20<lambdabot>modules's karma raised to 1.
00:31:35<_JFT_>roconnor: you were right the "strictness annotation didn't change a thing. My bad for insisting :(
00:31:49<roconnor>now we know
00:32:47<roconnor>$ time ./Foo 23
00:32:48<roconnor>16777215
00:32:49<roconnor>real 0m0.005s
00:33:01<roconnor>I think that blows python away?
00:33:22<roconnor>and my laptop is 4 or 5 years old
00:33:23<Taggnostr>what's that?
00:34:52<roconnor>Taggnostr: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5139#a5147
00:35:17<pumpkin>nice :)
00:35:18<roconnor>Taggnostr: vs http://www.smallshire.org.uk/sufficientlysmall/2009/05/22/ironpython-2-0-and-jython-2-5-performance-compared-to-python-2-5/
00:35:47<roconnor>@hoogle (a -> b -> m c) -> m a -> m b -> m c
00:35:48<lambdabot>Control.Monad zipWithM :: Monad m => (a -> b -> m c) -> [a] -> [b] -> m [c]
00:35:48<lambdabot>Control.Monad zipWithM_ :: Monad m => (a -> b -> m c) -> [a] -> [b] -> m ()
00:35:48<lambdabot>Control.Monad foldM :: Monad m => (a -> b -> m a) -> a -> [b] -> m a
00:36:08<mmorrow_>@let mkT = fix (\k !n i f -> if i==(1::Int) then f(n::Int)(Node()[]) else k(n+1)(i-1)(\n t -> k(n+1)(i-1)(\n s -> f(n)(Node()[t,s])))) 0
00:36:09<lambdabot> Parse error
00:36:30<Ycros>roconnor: it'll be interesting to re-do those once Google's unladen-swallow project is completed
00:36:35<mmorrow_>@let mkT = fix (\k n i f -> n `seq` if i==(1::Int) then f(n::Int)(Node()[]) else k(n+1)(i-1)(\n t -> k(n+1)(i-1)(\n s -> f(n)(Node()[t,s])))) 0
00:36:37<lambdabot> Defined.
00:36:45<mmorrow_>> mkT 15 const
00:36:47<lambdabot> Ambiguous occurrence `mkT'
00:36:47<lambdabot> It could refer to either `L.mkT', defin...
00:36:48<pumpkin>that's pretty dense code
00:36:56<mmorrow_>@let mkTree = fix (\k n i f -> n `seq` if i==(1::Int) then f(n::Int)(Node()[]) else k(n+1)(i-1)(\n t -> k(n+1)(i-1)(\n s -> f(n)(Node()[t,s])))) 0
00:36:56<roconnor>I am tempted by the idea of defining data Tree = Tree [Tree]. It's hard to tell what data type the Python really wants to be working with.
00:36:58<lambdabot> Defined.
00:37:02<mmorrow_>> mkTree 15 const
00:37:04<lambdabot> 32766
00:37:14<erikc>"I suppose if nothing else we have demonstrated in passing that Java can be faster than C for some non-trivial programs (like a Python interpreter) running a trivial program, like this benchmark." ? jython doesnt generate + jit bytecode?
00:37:17<roconnor>Ycros: what Google project?
00:37:18<mmorrow_>that one counts i think
00:37:28<pumpkin>> mkTree 23 const
00:37:46<nathanic>does anyone know of a super simple function like (parseInt :: String -> Maybe Int)? Hoogle finds Distribution.Text.simpleParse, but that seems like lot of dependency for not a lot of functionality
00:38:07<pumpkin>:t reads
00:38:17<lambdabot>forall a. (Read a) => String -> [(a, String)]
00:38:32<pumpkin>:t listToMaybe . reads :: String -> Maybe Int
00:38:39<lambdabot> Couldn't match expected type `Int'
00:38:45<lambdabot> against inferred type `(a, String)'
00:38:59<pumpkin>:t fmap fst . listToMaybe . reads :: String -> Maybe Int
00:39:06<lambdabot>String -> Maybe Int
00:39:17<nathanic>pumpkin: thanks!
00:39:24<pumpkin>:)
00:39:35<solrize_>is the State version reasonable and is there a way to get rid of the stack overflow?
00:41:19<MonadBaastad>:t (join .) . liftM2
00:41:20<lambdabot> Occurs check: cannot construct the infinite type: m = (->) (m a2)
00:41:21<lambdabot> Probable cause: `liftM2' is applied to too many arguments
00:41:21<lambdabot> In the second argument of `(.)', namely `liftM2'
00:41:34<MonadBaastad>Meh.
00:42:33<pumpkin>aw
00:43:02<Ycros>roconnor: http://code.google.com/p/unladen-swallow/wiki/ProjectPlan
00:44:49<ray>oh my, the type checker has probable cause
00:45:15<mmorrow_>pumpkin:
00:45:19<mmorrow_>[m@monire t]$ time ./T 23
00:45:19<mmorrow_>8388606
00:45:19<mmorrow_>real 0m3.490s
00:45:34<pumpkin>different answer from roconnor's one :o
00:45:49<pumpkin>> 2 * 8388606
00:45:52<lambdabot> 16777212
00:46:06<pumpkin>almost!
00:46:36<roconnor>pumpkin: see, when you don't follow the python code, you get the wrong answer.
00:46:49<roconnor>ACTION hopes his answer is the same as python's.
00:47:26<pumpkin>ACTION pokes thoughtpolice
00:47:31<pumpkin>ping me when you come back :)
00:47:39<mmorrow_>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5148#a5148
00:47:59<davidL> is there a fast way to check if a float is even? taking its floor is expensive
00:48:53<MonadBaastad>davidL: Maybe you shouldn't be using Floats. :)
00:49:28<MonadBaastad>ACTION only uses Floats if there's a "Root Beer" in front of it.
00:49:46<kynky>dont floats wobble?
00:50:18<mmorrow_>i followed that javascript code in the comment, which bails at 1, not 0
00:50:20<bnijk>MonadBaastad: i'm confused
00:50:30<pumpkin>the lack of associativity is painful
00:50:40<mmorrow_>(i bailed at 0 first too, giving me (2*) like yours)
00:50:49<pumpkin>2 * x + 3?
00:51:07<mmorrow_>the python code bails at 1 too
00:51:21<ray>data Beer; data Root a b
00:52:06<ray>{-# LANGUAGE EmptyDataDecls #-} too
00:52:22<roconnor>{-# LANGUAGE EmptyBeerDecls #-}
00:52:39<ray>that's an extension i could do without
00:52:47<pumpkin>ACTION isn't a big fan of beer
00:53:12<pastorn>roconnor: what cool features does that give you?
00:53:19<ray>once you define a full pint of beer, it's immutable
00:53:22<centrinia>Well, if u, v :: Float; then (((u+v)-v)+v)-v == (u+v)-v
00:53:33<roconnor>pastorn: it drinks all the beer in your fridge.
00:53:56<pastorn>ray: that sounds totally awesome
00:54:08<pastorn>roconnor: i hope it drinks it into your belly
00:54:12<roconnor>nope
00:54:54<roconnor>your program drinks it, then segfaults.
00:55:40<ray>pumpkin: i'm too much of a drunkard for something as wimpy as beer, usually
00:55:42<pastorn>doesn't sound very useful, wouldn't it be better with... hmm... say
00:55:56<pumpkin>ray: yeah, I only drink 151, no water for me
00:56:02<pastorn>instance Monad BallmersPeakM where ...
00:56:33<codolio>You need to upgrade your beer.
00:57:01<pumpkin>I threw a beer event this afternoon
00:57:05<pumpkin>didn't drink any of it :/
00:57:31<centrinia>Why wasn't I invited?
00:57:38<MonadBaastad>ACTION is just glad pumpkin didn't "throw *UP* a beer..." ;p
00:57:50<pumpkin>centrinia: I think it'd take you a while to get here :)
00:57:51<mmorrow_>dolio: when you're codolio it's even more co because you're alway green as dolio, yet your alter ego is blue
00:58:20<dolio>Is blue the opposite of green?
00:58:20<centrinia>If there is free beer, then distance is no object.
00:58:24<MonadBaastad>Codolio? Who's that - the Coolio of Code? ;p
00:58:33<dolio>I thought orange was the opposite of blue, and red was the opposite of green.
00:58:37<pumpkin>it's dolio's dual
00:58:40<pumpkin>dualio
00:58:54<mle>yellow
00:59:00<centrinia>Red is the opposite of cyan.
00:59:07<pumpkin>depends whether you're in additive color
00:59:11<mle>purple is the opposite of green
00:59:12<ray>what's the identity color
00:59:15<mle>we're in additive color.
00:59:21<mmorrow_>dolio: not that they're opposites per se, just that i just realized i associate names with the color xchat happens to give them, and you looked weird wearing blue
00:59:41<pumpkin>http://en.wikipedia.org/wiki/Subtractive_color vs. http://en.wikipedia.org/wiki/Additive_color
00:59:46<mmorrow_>ACTION wonders how xchat decides
00:59:46<pumpkin>(for anyone not aware)
00:59:52<mmorrow_>pumpkin is blue
00:59:59<pumpkin>I'm orange on my client
01:00:00<ray>shouldn't it be additive color and multiplicative color?
01:00:02<pumpkin>seems appropriate
01:00:08<pumpkin>ray: guess not
01:00:18<mmorrow>ACTION wonder what color he is now
01:00:25<pumpkin>still blue over here
01:00:27<roconnor>subtractive colour should be multipicative colour.
01:00:35<dolio>Konversation retains colors when people change nicknames. So sometimes I have to wait until I restart for people to have the right color.
01:00:44<pumpkin>ugh, KDE
01:00:49<pumpkin>:)
01:01:05<kynky>lol
01:01:09<mmorrow>i'm making a note to look how xchat assigns colors
01:01:27<Gracenotes>YOU ARE ALL WHITE
01:01:32<Gracenotes>to me
01:01:36<pumpkin>Gracenotes: :o
01:01:38<pumpkin>racist!
01:01:41<Berengal>Gracenotes: Rather racist, isn't it?
01:01:45<kynky>be good if it was open source :P
01:01:52<Gracenotes>it's okay, the background is black
01:01:56<ray>so is white the identiy color under addition?
01:02:04<ray>i don't understand that color stuff at all
01:02:12<ray>wait, i think it's black
01:02:19<Berengal>Has to be black
01:02:20<kynky>colour!!
01:02:33<pumpkin>u is the identity infix
01:02:52<Berengal>I don't understand that python tree code...
01:02:56<Berengal>It makes no sense
01:02:59<Gracenotes>actually it's "color". moran
01:03:23<kynky>thats not what my mum says
01:03:31<defun>Assuming that I had a text file with arbitrary data, and then I had a segment of haskell code (distinguished from the arbitrary data), how would I execute RunGHC on that code?
01:03:33<ray>so i guess white is the identity under "subtraction", which i have renamed to multiplication
01:03:37<Gracenotes>:o
01:03:40<centrinia>You people are too limited by your perception of the electromagnetic spectrum. I can see any form of radiation from light-year-long radio waves to Planck energy photons.
01:03:46<pumpkin>lol
01:04:08<pumpkin>centrinia: so why didn't you sense my beer event? I made sure to send out a huge EM pulse just before it
01:04:26<mmorrow>what color is AM radion 590 ?
01:04:29<roconnor>ACTION can't tell the difference between Planck energy photons and pairs of tiny blackholes.
01:04:32<mmorrow>*radio
01:04:54<centrinia>Well, it is a little noisy. :(
01:05:13<Gracenotes>color, the topic of so much philosophical talk
01:05:16<centrinia>All I see is white. :O
01:05:22<ray>radio is red
01:05:30<pumpkin>really dark red
01:05:31<AMradion590>mmorrow:
01:05:43<centrinia>Radio is more infrared than infrared.
01:05:52<kynky>sureoly white is just seeing all the colours
01:06:20<mmorrow>i picture it as the same color as a tv with just static on it
01:07:22<Gracenotes>what's the phrase for the philosophical concept that considers why certain colors tend to incite certain emotional responses?
01:07:39<kynky>l
01:07:42<ray>berkelian idealism
01:07:43<Gracenotes>"red" the commonly used example
01:07:46<kynky>lsd
01:07:57<Gracenotes>no... it's rather generic.
01:08:27<mmorrow>red frequency is more visible to the human eye, than green or blue
01:08:32<defun>anybody?
01:08:43<mmorrow>it's both why it is, and why poisonous stuff is red
01:09:40<FunctorSalad>ACTION likes colors
01:09:40<pumpkin>nah, green is most visible
01:09:45<FunctorSalad>pumpkin: yep
01:10:04<kynky>bt in uk did a study years ago in what would be most identifiable colour for theor fellt of cars and vans, they used to be yellow, but the study found that grey was, so they changed the fleet to grey
01:10:05<mmorrow>no way jose
01:10:07<FunctorSalad>http://en.wikipedia.org/wiki/File:Luminosity.png
01:10:19<pumpkin>our sun is green
01:10:28<Gracenotes>I FOUND IT! http://en.wikipedia.org/wiki/Qualia
01:10:54<dolio>Qualia isn't about colors inciting emotional responses.
01:11:03<Gracenotes>fine. close enough.
01:11:20<dolio>It's about philosphers sitting around considering the 'essence of redness' and stuff like that.
01:11:23<Cale>http://www.youtube.com/watch?v=yL_-1d9OSdk -- this is old, but it's still funny :)
01:11:25<FunctorSalad>if it has any effect, it isn't qualia ;)
01:11:25<pumpkin>lol
01:11:44<centrinia>What is the 'essence of Qualia"?
01:12:02<Gracenotes>dolio: it is very related
01:12:24<Gracenotes>and by "emotional response" I don't mean getting all flustered or something; I mean essentially connotations
01:12:37<roconnor>Does qualia presuppose dualism?
01:13:05<roconnor>IIRC qualia isn't even connotations. It is sensations.
01:13:15<MonadBaastad>I thought yellow was the most visible color?
01:13:32<kynky>blood = red = danger, then are the stop signs on vulcan green?
01:13:45<FunctorSalad>roconnor: sensations as far as they don't have any physical consequences...
01:13:56<FunctorSalad>including neuron activity and stuff
01:14:00<FunctorSalad>but IANAP
01:14:13<MonadBaastad>kynky: Thanks to the 'Trek reboot, there *are* no stop signs on Vulcan... ;p
01:14:37<roconnor>FunctorSalad: well, I guess you might argue that the sentions give rise to free will then choosing some action which has a physical consequence.
01:14:42<dolio>Were there before the reboot?
01:14:51<roconnor>but I don't even believe in Qualia.
01:14:53<kynky>MonadBaastad, only in that specific parallel universe
01:15:03<roconnor>as such
01:15:57<Gracenotes>qualia constitute a theory which relate to inexplicable associations of color. I don't see many of theories trying to deal with associations of color >_>
01:16:00<Gracenotes>*other
01:16:38<roconnor>... maybe there is some definition of qualia that I'm not familiar with
01:17:41<mmorrow>you're right, it is green
01:18:01<Gracenotes>well, I recall understanding them when I learned about them. But it is a not-so-coherent concept.. perhaps I'm trying to fit what I'm thinking about onto them
01:18:01<mmorrow>i coulda sworn i knew it was read for some reason
01:18:09<dolio>I'm not sure why you'd ask a philosopher why we have certain automatic associations between emotions and colors.
01:18:10<FunctorSalad>red destructinates night vision least, I think
01:18:13<roconnor>Gracenotes: I think qualia isn't the word you are looking for.
01:18:32<Gracenotes>how would you describe qualia?
01:19:26<roconnor>Gracenotes: quale is a conscious sensation of something.
01:19:47<roconnor>a quale is a conscious sensation of something.
01:20:04<kynky>the concous snsaion of the mf bs ?
01:20:19<aavogt>quails are another matter
01:20:24<Gracenotes>r f lckng vwls?
01:20:31<FunctorSalad>are you using the more moderate definition where it's left open whether "conscious" can be a functional thing?
01:20:46<Cale>Chicken chicken chicken, chicken chicken chicken, chicken chicken. Chicken: chicken chicken.
01:20:49<kynky>like the conscius sensation of the smell of bs ?
01:20:57<Gracenotes>roconnor: and color used an example refers to..?
01:21:02<roconnor>FunctorSalad: possibly.
01:21:06<FunctorSalad>the more "extreme" definition would be that it is the aspect of conscious sensation seperate from any functional aspects
01:21:39<roconnor>Gracenotes: a "red quale" is the sensation you experience when seeing red.
01:22:00<roconnor>Gracenotes: a "bass quale" is the sensation you experience when hearing to a low pitch.
01:22:08<roconnor>or eating a tasty fish.
01:22:11<Gracenotes>I think this is what I'm referring to.
01:22:16<MonadBaastad>defun: Is the means of distinguishing the Haskell equally arbitrary, or is there a pre-determined form. If you can choose it, you could just pretend it's Literate Haskell. :)
01:22:18<Gracenotes>I'm just explaining it badly.
01:22:24<roconnor>Gracenotes: ok
01:23:02<Gracenotes>and I'm sure the concept is useless as a theory :) But the idea of associations with color, inverse spectrums, are still interesting
01:23:08<roconnor>it is possible to experience colour quale of "imaginary colours" by direct stimulation of the brain.
01:23:39<roconnor>or probably just the optic nerve.
01:23:48<Berengal>roconnor: That's a very reductionist comment. Sure you're not just experiencing the "people prodding your brain" quale?
01:24:13<Berengal>I also doubt the brain can see colours it can't...
01:24:36<roconnor>Berengal: I'm not sure. It is hard for me to describe quale since I don't really believe in it.
01:24:39<MonadBaastad>Could we shuffle off the "SesquipeQualia" over to -blah, already? :)
01:24:42<Berengal>Especially not by stimulating the optical nerves
01:25:07<Berengal>roconnor: I'm sure there's some definition of it you'll believe
01:25:14<roconnor>Berengal: you doubt that the brain can see colours that it can't see?
01:25:31<roconnor>Berengal: I'm using "imaginary colours" as a technical term here.
01:25:38<roconnor>... I guess the quotes were unclear.
01:25:54<roconnor>http://en.wikipedia.org/wiki/Imaginary_color
01:25:56<Berengal>roconnor: colour is just a function of eletrical impulses interpreted by the brain
01:26:03<Berengal>Ah
01:26:09<MonadBaastad>defun: Are you familiar with Literate Haskell?
01:26:09<roconnor>``Non-physical, unrealizable, or imaginary colors are combinations of cone cell responses that cannot be produced by any physical light source.
01:27:04<Gracenotes>hm. And suppose you manually prodded the cones..?
01:27:45<Berengal>roconnor: Yeah, I get what you mean now. However, I don't think the adult brain will be able to see colours it hasn't seen yet
01:29:06<roconnor>Berengal: I think it will have little problem with imaginary colours. You will be like, whoa, that is really saturated green.
01:29:13<roconnor>It's like being on LSD.
01:29:57<Saizan>that's why LSD is so fun
01:30:05<Berengal>roconnor: Not that I've ever been on LSD, but I can imagine that being true.
01:30:21<kynky>well its just a wavelength at the end of the day, the term green just a qualatative term
01:31:08<PetRat>I have a simple parser and would like to check if it is idiomatic and efficient. (I already checked that it works.) Description here: http://www.mibbit.com/pb/1Wy7Kw
01:31:31<kynky>unit test ?
01:32:11<PetRat>LSD didn't do a lot for me except give me "insights" which I wrote down, then read the next morning and threw away.
01:32:15<PetRat>:)
01:32:27<roconnor>Berengal: anyhow, ya there is might be some definition of qualia that I like.
01:32:55<Berengal>roconnor: Let me know if you find one, since it'd probably solve the mind-body problem...
01:33:28<FunctorSalad>PetRat: imho there are some actual insights with it...
01:33:33<kynky>they used lsd in the fringe to see into parallel universes
01:33:50<roconnor>Berengal: I wouldn't be too surprised if it actually something like a collection of connotations. :)
01:34:15<Berengal>roconnor: Sort of like a category? :P
01:34:15<roconnor>kynky: does that really work?
01:34:35<PetRat>roconnor: as far as defining qualia, it would make sense to investigate it... that is, to investigate one's personal experience with a kind of detail and objectivity. Turns out that's what mindfulness meditation is.
01:36:05<PetRat>Buddhists have been doing mindfulness meditation for a while, but there are a number of modern teachers and scientists who teach it as a skill separate from religion. imho a lot of the confusion over philosophy gets cleared up by an actual, detailed investigation of experience.
01:36:49<roconnor>PetRat: I wish I learned more about that from Dr. Barendregt before I left the Netherlands.
01:36:56<PetRat>FunctorSalad: I agree with you. I just meant to say it didn't do much for me.
01:37:10<PetRat>I don't know Dr. Barendregt... what does he teach?
01:37:27<roconnor>PetRat: he wrote the bible on the lambda calculus
01:37:53<roconnor>He teaches Comp Sci. in theory. Although I don't know if he teaches anymore.
01:38:09<FunctorSalad>PetRat: I'm thinking of more "pre-lingual" things, not "facts" as such (like meditation in that regard)
01:38:10<gwern>@src sum
01:38:10<lambdabot>sum = foldl (+) 0
01:38:19<roconnor>http://en.wikipedia.org/wiki/Hendrik_Pieter_Barendregt
01:38:31<gwern>huh. isn't that grotestquely inefficient a definition for sum?
01:38:49<roconnor>hm, that page isn't very detailed.
01:38:56<gwern>but it's general. that's good
01:39:07<Berengal>gwern: The thing is, (+) is a class function...
01:39:08<PetRat>roconnor: it sounds like you are saying he talked about meditation as well?
01:39:45<gwern>ACTION is just pondering how you can sum [n..m] by doing (n+m)*(length [n..m])
01:39:48<roconnor>PetRat: nowadays he studies consciousness.
01:40:05<roconnor>http://www.fnds.cs.ru.nl/fndswiki/Mind-Brain-Mindfulness
01:40:11<idnar>uh
01:40:15<roconnor>``The objective of the Mind-Brain and Mindfulness Meditation Research Team at the Faculty of Science and the University Medical Center, Radboud University (Nijmegen, The Netherlands), is to contribute to the development of models of the mind that originate from the bridging of the scientific knowledge and research with the phenomenological and psychological knowledge derived from the contemplative traditions.
01:40:18<Berengal>gwern: Isn't length [n..m] = m - n?
01:40:32<gwern>Berengal: yeah, probably
01:40:35<PetRat>roconnor: interesting stuff.
01:40:46<idnar>> (sum [5..42], (5 + 42) * (length [5..42]))
01:40:48<lambdabot> (893,1786)
01:41:21<MonadBaastad>Berengal, gwern: Plus one. :)
01:41:42<gwern>oh sorry, length/2
01:41:59<Berengal>Uh, yeah...
01:42:03<dino->I was reading this recently http://www.ninebynine.org/Software/Learning-Haskell-Notes.html#type-class-misuse ..
01:42:04<PetRat>I know that several philosophers have said it more elegantly than me, but I've always considered that how the brain works should be studied by combining science (outside, objective) and personal experience (inside, subjective).
01:42:19<idnar>> (sum [5..42], (5 + 42) * (length [5..42] / 2))
01:42:20<lambdabot> No instance for (Fractional Int)
01:42:21<lambdabot> arising from a use of `/' at <i...
01:42:25<gwern>ACTION is suffering from badly from some sort of cold or allergies and so is not thinking all that straight
01:42:25<dino->And something is said in there about using existentials to support more than one Show behavior for something.
01:42:26<idnar>> (sum [5..42], (5 + 42) * (length [5..42] `div` 2))
01:42:27<lambdabot> (893,893)
01:42:38<dino->"I do my best to avoid type classes, but I'm in the minority. In the long run, I think it's better to use existentials, as they let you define multiple instances for the same type. This usually makes more sense. For example, Show: why support only one, global way of printing things? I often need multiple ones."
01:42:51<PetRat>As an example of what can go wrong when you don't consider both: many meditation studies give the following instructions to their subjects: "wait for me to attach the probes, then start meditating.".. but...
01:42:53<dino->I'm having a tough time trying to figure out what that would look like.
01:43:42<gwern>#check \x y -> (sum [x..y], (x + y) * (length [x..y] `div` 2))
01:43:45<gwern>@check \x y -> (sum [x..y], (x + y) * (length [x..y] `div` 2))
01:43:45<lambdabot> No instance for (QuickCheck-1.1.0.0:Test.QuickCheck.Testable
01:43:46<lambdabot> ...
01:43:46<dino->I wrote some code but it's clearly barking up the wrong tree.
01:43:56<dino->Does anyone here have an idea what that means above?
01:43:57<gwern>hm
01:43:58<PetRat>..but.. for many meditation teachers, meditation is considered such a natural part of consciousness that after some practice you are meditating all the time. There really isn't such as thing as "the meditating brain" and the "non-meditating brain" And yet so many studies take that as a point of assumption.
01:44:03<idnar>gwern: I think you want an ==
01:44:19<gwern>@check \x y -> sum [x..y] == ((x + y) * (length [x..y] `div` 2))
01:44:19<idnar>@check \x y -> sum [x..y] == (x + y) * (length [x..y] `div` 2)
01:44:20<lambdabot> "Falsifiable, after 4 tests:\n1\n1\n"
01:44:21<lambdabot> "Falsifiable, after 1 tests:\n-1\n-1\n"
01:44:28<roconnor>PetRat: sounds like something he'd say
01:44:29<idnar>heh
01:44:49<idnar>> [1..1]
01:44:50<lambdabot> [1]
01:44:55<aavogt>> [ 10..0]
01:44:57<lambdabot> []
01:45:01<PetRat>roconnor: sounds interesting.
01:45:02<gwern>> length [1..1] `div` 2
01:45:02<idnar>oh
01:45:03<lambdabot> 0
01:45:11<gwern>there we go. it's div that is the issue
01:45:17<idnar>@check \x y -> sum [x..y] == (x + y) * length [x..y]) `div` 2
01:45:17<lambdabot> Unbalanced parentheses
01:45:22<idnar>@check \x y -> sum [x..y] == ((x + y) * length [x..y]) `div` 2
01:45:23<lambdabot> "OK, passed 500 tests."
01:45:51<sclv>dino-: not sure if i'd agree wit what you pasted
01:45:55<FunctorSalad>gwern: ghc -O2 produces this core in the int case: Data.List.$wsum' (eftInt 0 y_aTz) 0
01:45:56<aavogt>> sum []
01:45:58<lambdabot> 0
01:46:12<FunctorSalad>not that I knew what "$wsum" and "eftInt" are
01:46:18<dino->sclv: The "I do my best.." is actually the page I was puzzling over, not understanding.
01:46:19<centrinia>> product []
01:46:20<lambdabot> 1
01:46:20<FunctorSalad>(the y_aTz is the upper bound)
01:46:43<Berengal>I assume $wsum' is strict sum?
01:47:06<Berengal>eftInt = enumFromToInt
01:47:13<FunctorSalad>right
01:47:22<gwern>> (\x y -> ((x + y) * (x-y)) `div` 2) 1 10
01:47:24<lambdabot> -50
01:47:25<sclv>I'd guess they meant that you pack the show function with the thing to be shown in an adt.
01:47:27<Berengal>Again, assumption
01:47:32<gwern>> (\x y -> ((x + y) * (y-x)) `div` 2) 1 10
01:47:33<aavogt>@check \x y -> sum [x..y] == ((x + y) * length [x..y :: Double]) `div` 2
01:47:34<lambdabot> 49
01:47:34<lambdabot> Couldn't match expected type `Double' against inferred type `Int'
01:47:37<dino->@paste
01:47:37<lambdabot>Haskell pastebin: http://hpaste.org/new
01:47:42<gwern>> sum [1..10]
01:47:43<lambdabot> 55
01:47:49<FunctorSalad>(the input was: main = do { x::Int <- getArgs; print $! sum [0..x] } )
01:47:53<FunctorSalad>using System.SimpleArgs
01:47:59<gwern>> (\x y -> (((x + y) * (y-x))) `div` 2) 1 10
01:48:00<lambdabot> 49
01:48:12<gwern>> (\x y -> ((x + y) * (y-x))) 1 10
01:48:13<lambdabot> 99
01:48:16<Berengal>showList :: [forall a. ((a -> String), a)] ?
01:48:31<centrinia>> (\x y -> y^2-x^2) 1 10
01:48:32<lambdabot> 99
01:48:39<sclv>but... that doesn't actually use existentials. hmm.
01:48:51<dino->http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5152#a5152
01:49:21<Berengal>sclv: It does. You can't write that type without existentials
01:49:22<dino->But that code will not compile.
01:49:29<dino->That I pasted.
01:49:40<Berengal>sclv: But you need to wrap it in a newtype as well for ghc to accept it
01:49:41<bnijk>> 99
01:49:43<lambdabot> 99
01:49:44<bnijk>much faster ;)
01:50:15<sclv>Berengal: you can just do this though: DataType a = Constr a (a-> String)
01:50:17<kniu>So I came upon the paper "Types are Calling Conventions" on reddit.
01:50:19<Berengal>newtype ShowPair = forall a. ShowPair (a -> String) a
01:50:20<sclv>no existentials needed!
01:50:28<sclv>you only need them if you want to hide the a.
01:50:39<sclv>at which point you might as well just store the string itself...
01:51:08<sclv>existentials are rarely really useful, but when they are, they really are.
01:51:11<Berengal>sclv: Yeah, true. I don't really get this myself, I'm just trying to figure out how it works :)
01:51:14<kniu>The writers, early on, hinted at a possible language feature where the calling convention is denoted in the type system.
01:51:25<gwern>@check \x y -> length [x..y] == ((max x y) - (min x y))
01:51:25<kniu>What's up with that?
01:51:26<lambdabot> "Falsifiable, after 0 tests:\n0\n0\n"
01:52:07<Berengal>@check \x y -> length [x..y] == ((max x y) - (min x y)) + 1
01:52:09<lambdabot> "Falsifiable, after 5 tests:\n-4\n-5\n"
01:52:09<kniu>If that were implemented, would it be possible to infer the correct or most efficient calling convention from the type?
01:52:26<gwern>> sum [0..0]
01:52:28<lambdabot> 0
01:52:42<dolio>Doesn't jhc do that?
01:52:46<thoughtpolice>@seen pumpkin
01:52:47<lambdabot>I saw pumpkin leaving #haskell-blah, #haskell-in-depth, #darcs, #ghc and #haskell 37m 52s ago, and .
01:52:48<centrinia>@check \x -> sum [-x..x] == 0
01:52:49<lambdabot> "OK, passed 500 tests."
01:52:50<copumpkin>ohai :)
01:52:50<thoughtpolice>@seen copumpkin
01:52:50<lambdabot>copumpkin is in #haskell-blah, #haskell-in-depth, #concatenative, #darcs, #ghc and #haskell. I last heard copumpkin speak just now.
01:52:54<dolio>It tracks whether things are evaluated or not in its intermediate type system.
01:53:03<thoughtpolice>copumpkin: struggling with what?
01:53:05<dolio>And such.
01:53:16<gwern>@check \x y -> sum [x..y] == (x + y) * (((max x y) - (min x y)) `div` 2)
01:53:17<lambdabot> "Falsifiable, after 0 tests:\n1\n-2\n"
01:53:27<bnijk>:t zip
01:53:29<lambdabot>forall a b. [a] -> [b] -> [(a, b)]
01:53:38<copumpkin>thoughtpolice: an apparent bug in GHC that has been left undisturbed for 3 years! due to it being preprocessor'ed out until x86_64 and darwin occurred together :P
01:53:51<gwern>@check \x y -> sum [x..y] == (x + y) * (((max x y) - (min x y)) `div` 2)
01:53:52<lambdabot> "Falsifiable, after 2 tests:\n1\n-2\n"
01:53:59<thoughtpolice>dolio: yeah, apparently john played with the idea of having jhc be an SML compiler too, so a rich intermediate language was designed
01:54:01<dolio>Maybe I'm a bit fuzzy on what exactly the "calling convention" part is, though.
01:54:03<dolio>ACTION hasn't read the paper.
01:54:07<bnijk>> map (\x y -> x^y^x^y) zip [1..20] [21..40]
01:54:09<lambdabot> Couldn't match expected type `[a]'
01:54:11<gwern>> (\ x y -> (x + y) * (((max x y) - (min x y)) `div` 2)) 1 10
01:54:12<lambdabot> 44
01:54:12<thoughtpolice>copumpkin: ah :)
01:54:15<bnijk>^ how do i jam a list of tuples into a lambda x y
01:54:19<gwern>44? rats
01:54:20<thoughtpolice>copumpkin: attempting to get a registered port?
01:54:25<copumpkin>thoughtpolice: damn right!
01:54:32<kniu>dolio, jhc compiles haskell, right?
01:54:37<dolio>Yes.
01:54:38<copumpkin>thoughtpolice: from igloo's tarball
01:54:44<bnijk>2-tuples
01:54:49<kniu>I kind of meant annotations in the source language.
01:54:54<bnijk>whatever they're called in haskell
01:55:00<Berengal>> map (\(x, y) -> x^y^x^y) zip [1..20] [21..40]
01:55:00<dolio>Oh.
01:55:01<lambdabot> Couldn't match expected type `[(t, t1)]'
01:55:14<Berengal>> map (\(x, y) -> x^y^x^y) $ zip [1..20] [21..40]
01:55:21<copumpkin>that looks intense
01:55:22<bnijk>O.O
01:55:29<lambdabot> thread killed
01:55:43<dolio>Well, it seems obvious to me that anything that's done in the intermediate language could be extended to let you give hints to the compiler in the source language.
01:55:46<thoughtpolice>copumpkin: ah
01:55:55<thoughtpolice>copumpkin: yeah, the RTS needs to be fixed in order to support a registered build
01:55:59<copumpkin>thoughtpolice: but I'll need to rebuild that bit without this buggy thing
01:56:00<Berengal>> map (uncurry (\x y -> x^y^x^y)) $ zip [1..20] [21..40]
01:56:14<copumpkin>thoughtpolice: I don't think much (if anything) will need changing in the RTS, but I could be wrong :)
01:56:15<lambdabot> thread killed
01:56:15<thoughtpolice>copumpkin: i've finally beaten killzone, so I'm darcs pulling my GHC updates now :)
01:56:19<copumpkin>lol
01:56:24<gwern>> (\y -> (1 + y) * (y `div` 2)) 10
01:56:25<lambdabot> 55
01:56:36<thoughtpolice>copumpkin: from what I've heard of ChilliX, there are some things that need to be taken care of
01:56:47<copumpkin>thoughtpolice: hmm
01:56:53<dolio>Having the compiler figure it out sufficiently itself would be the nice part.
01:57:40<thoughtpolice>copumpkin: but I don't think it's anything major
01:58:01<thoughtpolice>copumpkin: in particular, Adjustor.c will probably need to be modified, but you can use libffi as a stop-gap measure for that IIRC
01:58:12<dolio>Of course, having a richer set of strictness controls in the source language would probably be nice, too, since you might never get a sufficiently smart compiler.
01:58:16<thoughtpolice>(it's only slightly slower)
01:58:28<copumpkin>thoughtpolice: why would it need to be changed though? can't we just steal the x86_64 from linux?
01:58:33<copumpkin>(adjustor code)
01:59:27<gwern>huh. I guess the equivalent of div in scheme is /. this seems to work: '(define quick-sum (lambda (n) (* (+ 1 n) (/ n 2))))'
01:59:32<thoughtpolice>copumpkin: that would be the best case scenario, but throughout the RTS there is a bit of OS X strangeness that needs to be dealt with sometimes
01:59:40<thoughtpolice>copumpkin: but it'll probably mostly be stolen, yes :)
01:59:41<copumpkin>hmm, ok
02:00:02<Berengal>gwern: scheme has rational numbers
02:00:15<gwern>?
02:00:22<thoughtpolice>copumpkin: k, downloading the unregistered x86_64 bindist; hacking shall commence :)
02:00:25<Berengal>Try (/ 3 2)
02:00:27<thoughtpolice>copumpkin: what's your bug, btw?
02:00:28<dino->Thanks for poking at that existential thing.
02:00:49<copumpkin>thoughtpolice: pprDynamicLinkerAsmLabel
02:00:52<copumpkin>it's a GHC panic :)
02:00:59<dino->I still don't really get it, or what is desireable to achieve with it.
02:01:29<thoughtpolice>copumpkin: building HEAD with the unregistered bindist fails with that?
02:01:31<gwern>Berengal: 1.5
02:01:34<mmorrow>copumpkin: is it assuming elf or something?
02:01:42<Berengal>gwern: Right, so it's not div
02:02:03<copumpkin>thoughtpolice: no, but the preprocessor stuff in that part of ghc (igloo's binary build) is messed up
02:02:04<gwern>but my code seems to pass all the test cases. maybe div wasn't necessary
02:02:24<Berengal>gwern: How does it handle (/ 1 3) by the way?
02:02:25<copumpkin>thoughtpolice: I'll dig up the actual source file soon
02:02:30<Jedai>dino-: ?
02:02:38<gwern>Berengal: 0.3
02:02:54<Berengal>gwern: No 0.3... or 1/3?
02:03:01<Berengal>Just 0.3?
02:03:27<gwern>just that
02:03:29<dino->Jedai: This: http://www.ninebynine.org/Software/Learning-Haskell-Notes.html#type-class-misuse In particular the blue box.
02:03:44<thoughtpolice>copumpkin: seems to be in ./compiler/cmm/CLabel.hs
02:03:50<copumpkin>yeah, that's the one
02:03:56<copumpkin>it doesn't have enough cases in that function
02:04:01<thoughtpolice>copumpkin: ah
02:04:02<copumpkin>and it fails on the catch-all with a panic
02:04:04<roconnor>emacs's undo buffer drives me bonkers!
02:04:09<thoughtpolice>copumpkin: so we'll need to fix that and make another bindist
02:04:23<copumpkin>thoughtpolice: yeah, I'm doing that now on my mac pro
02:04:39<dolio>Yeah. Worst undo system ever.
02:05:01<thoughtpolice>copumpkin: k, tell me when the build is done and put it somewhere if you can
02:05:07<copumpkin>sure
02:05:21<thoughtpolice>copumpkin: you might also want to send a message to g-h-u in reply to Igloo about the bug and a fix
02:05:27<thoughtpolice>(with the patch, of course)
02:05:29<copumpkin>I've been chatting to him in #ghc :)
02:05:34<copumpkin>but yeah, I'll submit a patch if it works
02:06:10<Jedai>dino-: It's not really clear, also I disagree on the general usefulness of typeclass
02:06:23<mwc>anybody built ghc6 on linux-ppc without encountering an R_PPC_REL24 relocation-truncated-to-fix error?
02:06:38<mwc>building unregisterized
02:06:52<dino->roconnor, dolio: What does emacs do with undo? In Vim u rolls back through the undo stack and ^r goes the other way. How is this mess-upable?
02:07:10<Jedai>dino-: Besides his complaint on the list of type of the same typeclass isn't really true, it's pretty easy to use an existential datatype to do that
02:07:26<Jedai>dino-: Look at Layout in XMonad for instance
02:07:35<roconnor>dino-: after typing stuff after undoing, then further undos will undo the undos that you have done.
02:07:49<dolio>dino-: If you accidentally type something in the middle of a series of undos, you have to undo all of your undos, and then undo all of the un-undos before you can undo stuff from before you started.
02:07:56<dino->roconnor: oh boy, the undocursion
02:08:29<dolio>Plus, C-x u is the shortcut, which is easy to screw up.
02:09:12<Jedai>dolio: I use C-x _
02:09:28<dolio>I'm not sure I see how that's better.
02:09:58<dolio>The problem I have is having to change what modifier key I'm pressing, which results in mistakes.
02:10:31<jeffz`>I think it's C-_ not C-x _
02:10:38<jeffz`>C-_ is easier than C-x u
02:10:43<Jedai>jeffz`: Right, sorry
02:10:46<jeffz`>:)
02:10:49<dolio>Oh, that would be better.
02:11:06<copumpkin>bos: zomg lazy text!
02:11:21<bos>yeppo!
02:11:22<copumpkin>nice :)
02:12:04<copumpkin>thoughtpolice: want to try building the unregistered one yourself?
02:13:28<mmorrow>copumpkin: looking more at Adjustor.c/Asm.S, yeah it's essentially the same idea as that other code
02:13:34<copumpkin>cool :)
02:13:35<dino->Jedai: I'm getting that that part of that page is 'eh, move along folks', which is fine. I wasn't sure what it was saying.
02:13:45<copumpkin>mmorradjustor
02:13:55<mmorrow>:)
02:15:57<mmorrow>oh sweet, you can do a jmp foo(%rip) directly instead of mov'ing the address to an intermediate reg first (for some reason i just assumed you couldn't)
02:16:45<copumpkin>:)
02:16:47<Jedai>dino-: I think he says that typeclass are use too easily by beginners in Haskell, even for tasks for which they aren't really suited which is true, though he seems to push to far in the opposite direction
02:16:54<dino->I see, in vim, once you undo, then do something not undo-ish, the redo gets blown away. And it all seems to make sense. At least this many years down the road it does.
02:17:50<idnar>dino-: you can move backwards and forwards between branches of history, though
02:17:59<idnar>(in vim)
02:18:03<dino->Jedai: Absolutely, I've had that happen. Expecting them to be like OO interfaces or abstracts.
02:18:10<dmead>hello channel
02:18:17<dmead>@seen dmwit
02:18:17<lambdabot>dmwit is in #haskell-in-depth, #xmonad and #haskell. I don't know when dmwit last spoke.
02:18:36<dino->idnar: You know, I don't think I have that much vimfu.. yet
02:19:07<idnar>:undolist shows the leaves, g- goes backwards, g+ goes forwards
02:20:53<copumpkin>ChanSevr: trying to harvest passwords?
02:20:54<dino->idnar: Oh there's a lot of stuff in :help undo
02:20:57<dino->I had no idea
02:21:15<idnar>dino-: yeah, it's fun
02:21:22<ChanSevr>no copumpkin trying to get freenode to block this account
02:21:38<dino->Ok, thanks again for the typeclass and existential talk.
02:22:05<ChanSevr>figured if I joined the 15 largest channels on freenode it might create enough noise in #freenode that someone would fixed the banned nicks mask
02:22:23<dolio>Wow, this is in the top 15?
02:22:38<ChanSevr>according to searchirc.com
02:22:48<copumpkin>we're often top 10 I think
02:22:52<ChanSevr>http://searchirc.com/search.php?SCHANS=1&SSORT=SIZE&N=freenode
02:22:54<copumpkin>depending on time of day
02:23:49<ChanSevr>feel free to complain in #freenode ;)
02:24:43<idnar>Chan Sever
02:33:23<FunctorSalad>what about all the other misspelings?
02:38:26<Jedai>FunctorSalad: I guess the idea is to alert about misspellings in general, not just this one
02:38:51<FunctorSalad>ok
02:44:24<hydo>Apparently, I have some sort of weird assumption of how takeWhile works. If map fn list returns a list of [True,False,False,... ] then, logic has suggested to me, takeWhile fn list should return the elements for which fn evaluates to True... But I'm getting an empty list every time. Might someone enlighten me?
02:44:48<SamB_XP>hydo: you're thinking filter
02:45:01<hydo>ah, ok... that makes sense.
02:45:04<SamB_XP>hydo: takeWhile stops at the first False
02:45:09<dolio>takeWhile (<5) [1,2,3,10,4,5,6]
02:45:13<Jedai>hydo: takeWhile take only until the first False
02:45:13<dolio>> takeWhile (<5) [1,2,3,10,4,5,6]
02:45:14<hydo>ah ha ha
02:45:14<lambdabot> [1,2,3]
02:45:26<hydo>Important distinction!
02:45:31<hydo>Thanks a lot!
02:47:52<roconnor>> 2^23
02:47:53<lambdabot> 8388608
02:47:56<roconnor>> 2^24
02:47:57<lambdabot> 16777216
02:49:08<solrize_>hydo you want filter, not takewhile
02:49:17<solrize_>> filter odd [1..10]
02:49:18<lambdabot> [1,3,5,7,9]
02:49:48<solrize_>anyone here use sqlite?
02:54:58<Gracenotes>hm. Haskell doesn't have much dynamic loading, does it?
02:55:09<copumpkin>depends
02:55:11<copumpkin>hs-plugins
02:55:21<Gracenotes>@hackage hs-plugins
02:55:21<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hs-plugins
02:55:25<copumpkin>you could probably ffi to dlopen/dlsym quite easily :P
02:55:32<Gracenotes>if you're just expecting an instance of the typeclass
02:55:34<Gracenotes>for instance
02:55:57<Gracenotes>ah, no hackage
02:56:31<gwern>hs-plugins is deprecated
02:56:39<Gracenotes>awz.
02:56:59<dmwit>GHC API is the new hs-plugins.
02:57:15<SamB_XP>I thought hs-plugins was, in fact, dead?
02:57:16<copumpkin>ooh
03:00:38<aavogt>@hackage plugins
03:00:39<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/plugins
03:01:17<Jedai>Gracenotes: The next GHC will have shared library, it may become more interesting to do dynamic loading (currently, this is pretty heavy)
03:01:47<Jedai>The RTS will be shared
03:01:59<Gracenotes>ah.
03:02:40<MonadBaastad>ACTION was hoping to here that "The RTS will be televised." Ah, wel...
03:03:18<gwern>MonadBaastad: I can tell you, however, that the revolution will not be telegraphed.
03:12:59<Alpounet>@hackage stats
03:13:00<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/stats
03:13:33<Alpounet>@hackage statistics
03:13:34<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/statistics
03:13:49<Alpounet>@hoogle statistics
03:13:50<lambdabot>No results found
03:15:54<copumpkin>hstats
03:43:06<roconnor>> logBase 2 1000000
03:43:07<lambdabot> 19.931568569324174
03:43:16<roconnor>> logBase 2 1000000000
03:43:17<lambdabot> 29.897352853986263
03:48:01<djd74>> logBase 2 1000
03:48:03<lambdabot> 9.965784284662087
03:48:14<djd74>> logBase 2 512
03:48:15<lambdabot> 9.0
03:50:55<roconnor>gnuvince_: heh, my Writer.Strict code takes 1 minute for depth 20000.
03:51:36<roconnor>that's about 2^20000 nodes, which is a number so big that it would fill the entire size of the python chart.
03:51:46<roconnor>> 2^20001
03:51:48<lambdabot> 796055368067593318470861441238240490740954556098485187742685373130477271949...
03:51:59<copumpkin>> length . show $ 2 ^ 20001
03:52:01<lambdabot> 6021
03:52:38<roconnor>> (length . show $ 2 ^ 20001) `div` 80
03:52:39<lambdabot> 75
03:53:00<Berengal>roconnor: Was this using the weird python definition of a binary tree?
03:53:19<roconnor>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5139#a5156
03:53:24<dmwit>ACTION is so lost right now
03:53:34<roconnor>that is my current version I'm using.
03:55:16<copumpkin>dmwit: ?
03:55:32<roconnor>dmwit: gnuvince_ wanted a Haskell version of this python code: http://www.smallshire.org.uk/sufficientlysmall/2009/05/22/ironpython-2-0-and-jython-2-5-performance-compared-to-python-2-5/
03:55:46<dmwit>roconnor: Thanks, that was the context I was hoping for. =)
03:56:01<Berengal>roconnor: Unless there's something I'm not getting, you're saying your machine counted that high in a minute?
03:56:05<roconnor>even though that code uses a global variable.
03:56:28<roconnor>Berengal: hmm
03:56:47<roconnor>It does seem like that, and also that seems impossible.
03:57:01<roconnor>I wonder if there is too much sharing going on.
03:57:07<Berengal>Yes, it seems very impossible
03:57:19<Berengal>At least in this day and age
03:57:33<Berengal>There has to be something else going on here
03:57:36<roconnor>damn, I might have accidentally made my program run in logarithmic time
03:57:50<Berengal>Hehehe
03:58:57<roconnor>okay, I removed the replicateM
03:58:59<roconnor>and used
03:59:12<roconnor>make depth = do
03:59:13<roconnor> t1 <-(make (depth -1))
03:59:15<roconnor> t2 <-(make (depth -1))
03:59:16<roconnor> node [t1,t2]
03:59:20<roconnor>But now it runs twice as fast ...
03:59:24<roconnor>:^)
03:59:37<roconnor>damn it
03:59:46<roconnor>I don't know how to make this as slow as python.
03:59:48<copumpkin>roconnor has discovered sub-constant time
04:00:03<copumpkin>everything he adds to his code makes it faster!
04:00:49<Berengal>I'd really like to know what's going on here...
04:00:52<roconnor>Is GHC really constant lifting thingy my code?
04:01:06<roconnor>I thought GHC almost never does that.
04:01:18<Berengal>Perhaps it's time to dump core?
04:02:18<roconnor>without -O2, it the parameter 17 takes 1 second.
04:02:33<roconnor>WTF is -O2 doing?
04:02:58<dolio>-O is that much slower than -O2?
04:03:17<roconnor>oh I turned off O completely
04:03:20<roconnor>:)
04:03:37<roconnor>does any one use -O ?
04:03:57<roconnor>okay -O is still exponentially faster.
04:04:06<copumpkin>o.O
04:04:07<Axman6>@remember roconnor Damn it, I don't know how to make this as slow as python.
04:04:07<lambdabot>It is forever etched in my memory.
04:04:16<dolio>I don't. But I almost never use -O0, either.
04:04:48<roconnor>-O0 is not exponentially faster.
04:04:50<dmwit>Is there a different number in each leaf node?
04:04:52<hatds>is -O = -O1?
04:04:58<dmwit>That seems like a really easy thing to check for small trees.
04:05:12<hatds>and is -O0 = default?
04:05:16<thoughtpolice>hatds: yeah
04:05:21<roconnor>-O1 is exponentially faster, an I assume it is the same as -O
04:05:34<Berengal>I don't notice any difference between -O0, -O and -O2...
04:05:40<thoughtpolice>-O just implies -O1; -O should turn on most of your optimizations
04:05:44<thoughtpolice>-O2 turns on some other ones
04:05:48<roconnor>dmwit: there is actually nothing stored in the tree
04:05:52<Berengal>Well, a slight difference, but it's within uncertainty
04:06:03<roconnor>dmwit: we just do tell (Sum 1) and spit out the counter at the end.
04:11:31<Berengal>How does one dump core again?
04:11:36<Berengal>I forgot :/
04:12:23<dolio>-ddump-simpl?
04:12:33<dolio>Just install ghc-core.
04:15:06<twb>Can I say something like #if GHC_VERSION > 6.6 ?
04:15:40<roconnor>http://www.reddit.com/r/programming/comments/8mmam/i_tried_to_translated_the_ironpython_code_to/
04:15:51<roconnor>fuck
04:15:55<twb>I used Data.Function.on, but apparently this is not available for GHC 6.6 users. Thus, I want to say "#if foo import Data.Function (on) #else on f g = ... #endif"
04:15:56<roconnor>ACTION fixes the title
04:16:26<copumpkin>roconnor: is the answer correct?
04:16:37<copumpkin>for counter
04:16:39<Berengal>I like the title...
04:16:40<roconnor>yes I beleive so.
04:16:44<copumpkin>wow :)
04:17:33<copumpkin>so Writer relies on Monoid, right?
04:17:39<roconnor>http://www.reddit.com/r/programming/comments/8mmc7/i_tried_to_translate_the_ironpython_code_to/
04:17:40<roconnor>better
04:17:42<copumpkin>I've never actually used Writer explicitly
04:17:59<copumpkin>speed?
04:17:59<roconnor>copumpkin: sure
04:18:11<copumpkin>sped maybe?
04:18:12<thoughtpolice>twb: use __GLASGOW_HASKELL
04:18:16<thoughtpolice>twb: er
04:18:18<BMeph>twb: So, where do you want to say this funny-looking C macro of yours? ;)
04:18:18<thoughtpolice>twb: use __GLASGOW_HASKELL__
04:18:21<roconnor>copumpkin: speed?
04:18:27<thoughtpolice>e.g. #if __GLASGOW_HASKELL__ >= 606
04:18:32<copumpkin>roconnor: "I tried to translate the IronPython code to Haskell, but GHC exponentially speed up my code."
04:18:38<twb>Thanks.
04:18:43<roconnor>damn
04:18:45<roconnor>I suck
04:18:56<copumpkin>:)
04:19:16<copumpkin>how long till the haskell haters come along for the party?
04:19:19<roconnor>why do I do all my interesting haskell past midnight
04:19:36<dolio>roconnor: It's possible make is subject to CSE.
04:19:58<BMeph>roconnor: "I baked a slow-down brick in Haskell, but it eated it"? ;)
04:20:11<roconnor>copumpkin: sped right?
04:20:13<Asztal>does your Haskell code keep the binary tree in memory, or dispose of it as it's created (since it uses execWriter)?
04:20:14<copumpkin>yup
04:20:17<dolio>That's about all I've got.
04:20:36<roconnor>http://www.reddit.com/r/programming/comments/8mmcu/i_tried_to_translate_the_ironpython_code_to/
04:20:59<roconnor>Asztal: who knows. Presumably it is tossed out as it is made.
04:21:43<roconnor>dolio: I thought nothing was subject to CSE, but it is the only explaination that I can think of.
04:22:07<roconnor>dolio: if CSE is happening my respect for GHC has actually gone up for once.
04:22:21<roconnor>usually GHC is full of disappointment
04:22:25<Berengal>Ugh, reading core is hard :(
04:22:25<roconnor>but not this time.
04:22:57<copumpkin>Berengal: using ghc-core?
04:23:03<Berengal>copumpkin: Yes
04:23:14<copumpkin>Berengal: what we need is ghc-plugins and bsp's awesome core visualizer plugin!
04:24:03<copumpkin>Berengal: http://www.omega-prime.co.uk/files/GHC-Core-HTML.html is what I'm talking about :)
04:24:09<Berengal>copumpkin: Would still feel like reading disassembly I believe, but with pretty colours, perhaps some jazz music?
04:24:19<dolio>roconnor: If you munge the code for that down enough, it might turn into something like "let x = make (depth - 1) ; y = make (depth - 1) in ..." which might follow the very strict rules for when it does do CSE.
04:24:31<roconnor>ooh
04:24:33<copumpkin>Berengal: it's not that bad :) and I don't mind reading assembly anway
04:24:51<roconnor>Lo-Lo-LoopBreaker
04:25:20<Berengal>copumpkin: I do. I'm addicted to proper code, with nice variable names and cute abstractions
04:25:40<copumpkin>Berengal: you can hire me to read your disassemblies if you want ;)
04:26:04<Berengal>copumpkin: do you take cheetos? ;)
04:26:15<copumpkin>lol, only the giant balls
04:26:26<dolio>roconnor: 'let x = e in ... e ...' is the specific case for which it does do CSE. Might apply to 'case e of x -> ... e ...' as well.
04:26:53<Berengal>copumpkin: I'm afraid we can't do business then. I'm not giving my balls away
04:27:04<copumpkin>lol, I meant cheetos balls
04:27:09<roconnor>BMeph: mmm, slow-down brick.
04:27:12<Berengal>;P
04:27:19<copumpkin>http://www.taquitos.net/cheese_puffs/Giant_Cheetos
04:28:10<roconnor>dolio: I'm still feeling kinda stunned right now.
04:28:52<roconnor>I think dons will get a kick out of this.
04:29:27<dolio>roconnor: You could try adding a parameter that it never uses, just to make the recursive calls look different, although I can't guarantee ghc won't get rid of those.
04:29:33<copumpkin>it'd be nice to be able to tell GHC when to do CSE
04:29:39<copumpkin>sometimes we can see it, if it's obvious
04:29:45<copumpkin>but after a dozen transformations, GHC may see things we don't
04:30:27<roconnor>dolio: this probably wouldn't work with the state monad would it?
04:30:49<dmwit>copumpkin: Isn't that what let and where bindings are for?
04:31:10<copumpkin>yes, but that's what I was saying... sometimes it may be obvious enough for us to make a let and factor common things out
04:31:22<dolio>roconnor: That seems like it'd be less likely to do CSE, yes.
04:31:31<roconnor>hmm
04:31:34<copumpkin>and others it may not, depending on how much the code gets transformed by the simplifier
04:31:54<dmwit>so... you want the compilation process to do IO?
04:32:02<dolio>Or, that is, the kind of CSE that gives you exponentially better behavior here.
04:32:03<dmwit>ACTION does not wish for the same things copumpkin wishes for
04:32:26<roconnor>dolio: damn, I was just being a bit too clever. I thought I'd try out this niffty Writer thingy, and GHC exponentially implodes on me.
04:32:34<copumpkin>dmwit: maybe through a pragma for each function or expression that we think may work
04:32:52<copumpkin>dmwit: not necessarily an interactive compiler, although people don't seem to have that much of a problem with similar approaches in darcs
04:33:38<copumpkin>I dunno, just categorically not doing it (except for very restricted cases) as happens now doesn't seem ideal
04:33:47<roconnor>@type execState
04:33:49<lambdabot>forall s a. State s a -> s -> s
04:34:45<roconnor>Strict state is closer to the desired behaviour.
04:34:54<roconnor>$ time ./Foo 20
04:34:55<roconnor>Stack space overflow: current size 8388608 bytes.
04:37:59<roconnor>@quote exponential
04:37:59<lambdabot>ddarius says: Alternatively, it could be arrived at from the continuity properties of exponentials.
04:43:51<Cale>Why is that a quote?
04:44:06<roconnor>okay, I put in a seq
04:44:21<roconnor>no more stack overflow with state
04:44:30<roconnor>and no more exponential implosion.
04:45:49<dolio>One can only wonder how GHC manages to do that CSE since Haskell isn't a pure language. :)
04:46:44<roconnor>dolio: what is that a reference to?
04:47:11<dolio>Reddit people.
04:47:34<roconnor>reddit thinks that Haskell isn't a pure language?
04:47:42<dolio>Certain people there do.
04:48:00<roconnor>./Foo 19 runs in less than 1 second.
04:48:08<roconnor>that has 1048575 calls to node
04:48:19<roconnor>still faster than the python numbers
04:48:36<roconnor>gnuvince_ would be happy
04:48:58<roconnor>although I still prefer the code with the unreasonable exponential implosion.
04:49:45<dolio>That is a nice find, although it's not really something you could rely on.
04:49:59<roconnor>no, I guess not
04:50:14<Berengal>Yeah, once you wanted to do something else with the tree the implosion would probably explode back out again...
04:50:29<roconnor>I was thinking, "I'll make it asymetric by writing "t1 <- inc >> (make (depth -1))"
04:50:37<roconnor>but then I realized that that wouldn't work.
04:50:45<roconnor>:(
04:50:56<roconnor>ACTION tries it anyways
04:51:32<roconnor>yep
04:51:35<roconnor>still too fast.
04:52:10<roconnor>I guess there is a lesson in here about microbenchmarks.
04:52:52<roconnor>hmm
04:53:04<roconnor>I made a modification that causes a stack overflow
04:53:06<roconnor>...
04:53:20<roconnor>No wonder gnuvince_ was getting a stack overflow
04:53:26<roconnor>GHC 6.10 isn't doing this CSE!
04:53:47<roconnor>Yes! I *can* continue to be disappointed in GHC.
04:53:55<dolio>:)
04:54:44<roconnor>phew
04:54:57<Berengal>I made a O(2^n) algorithm as well, but it doesn't produce the same answer as the python one: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5149
04:54:58<roconnor>my lack of faith in GHC was shaken.
04:55:08<roconnor>but now has thankfully returned.
04:55:33<Berengal>roconnor: What do you mean 6.10 doesn't do the CSE?
04:55:43<voker57_>what is CSE?
04:55:47<roconnor>gnuvince_ said that when he tried my code he got a stack overflow
04:56:13<Berengal>roconnor: Which version are you compiling with?
04:56:24<roconnor>6.8.2
04:56:48<Berengal>I'm on 6.10.3, and it works just fine
04:56:54<Berengal>Exponential implosion and all
04:57:11<roconnor>oh
04:57:20<roconnor>lemme check what gnuvince_ was using
04:57:32<Berengal>time @ 20000 -> real 0m0.285s
04:58:07<roconnor>voker57_: Common Subexpression Elimination
04:58:17<Berengal>roconnor: That's without optimizations by the way
04:58:36<dolio>Without any optimizations?
04:58:44<roconnor>17:20:57 <gnuvince_> roconnor: that's weird. I'm on Arch Linux, 32 bit, GHC 6.10.3
04:59:00<roconnor>noo
04:59:06<roconnor>my lack of faith is being shaken again.
04:59:11<Berengal>[berengal@superabacus ~/dev/haskell]$ ghc --make -O0 -fforce-recomp tree2.hs
04:59:11<Berengal>[1 of 1] Compiling Main ( tree2.hs, tree2.o )
04:59:11<Berengal>Linking tree2 ...
04:59:11<Berengal>[berengal@superabacus ~/dev/haskell]$ time ./tree2 20000 >/dev/null
04:59:11<Berengal>real 0m0.315s
04:59:27<roconnor>oh
04:59:38<roconnor>but gnuvince_ never tried out my Writer.Strict version.
04:59:47<roconnor>that would probably explain it.
05:00:04<Jedai>Berengal: And with optimization ?
05:00:10<roconnor>Berengal: that is ... kinda disturbing
05:00:18<Berengal>Jedai: About the same, few microseconds faster
05:00:38<Berengal>Berengal: time @ 20000 -> real 0m0.285s
05:00:48<voker57_>what's wrong about it?
05:01:48<roconnor>voker57_: GHC almost never does CSE because it can often lead to space leaks.
05:02:50<roconnor>So when it actually does CSE in code write ... and causes an exponential implosion in runtime ... it is quite surprising.
05:02:58<roconnor>in code I write ...
05:03:28<Berengal>roconnor: It's sort of like writing a prolog program that finishes this side of the big bang...
05:03:39<Berengal>*the next big bang
05:03:59<roconnor>Berengal: heh, I don't write much prolog, but I believe that.
05:04:11<roconnor>It is probably really easy to write exponential time code in Prolog.
05:04:26<Berengal>roconnor: About as easy as writing it in the list monad :)
05:04:30<roconnor>right
05:05:07<roconnor>for the ICFP 2006 adventure game I solved all the puzzles but one.
05:05:29<roconnor>I needed to add a sort function to my list monad code to get the last one.
05:05:52<roconnor>... I wonder if that can easily be done in prolog.
05:08:10<Berengal>sort(List, List) :- isSorted(List).
05:08:10<Berengal>sort(List, Out) :- select(List, Elem, Remaining), insert(Elem, Remaining, HopefullySortedList), sort(HopefullySortedList, Out).
05:08:34<roconnor>Berengal: sounds easy enough.
05:08:44<Berengal>roconnor: Yeah, that's basically bogosort
05:09:12<Berengal>I probably got it wrong somewhere, but the gist of it should be right
05:09:14<roconnor>The sort command is just to make it try what I considered more fruitful search paths first.
05:09:38<grncdr>Hey so I'm still just getting started with haskell, mostly going through stuff on learnyouahaskell, and I'm wondering if anybody has any recommendations on small but "real" programs to look at for an idea of design patterns etc.
05:09:40<Berengal>Doesn't that require you to drop out of the list monad for a spell though
05:10:06<Berengal>grncdr: Take a look at Real World Haskell as well
05:10:09<roconnor>grncdr: lost of people work on the Euler problems.
05:10:24<roconnor>grncdr: oops, you want to look at code.
05:10:47<Berengal>@where RWH
05:10:47<lambdabot>is http://www.realworldhaskell.org/blog/
05:10:55<roconnor>Berengal: nope instead of x <- blah, I write x <- sortBy foo blah
05:11:09<roconnor>Berengal: the change was disturbingly trivial.
05:11:22<Berengal>roconnor: Ah, like that
05:11:24<grncdr>thx Berengal & roconnor
05:11:31<roconnor>I like how just little tweeks of Haskell code can have mind blowing performance gains.
05:11:41<roconnor>actually maybe I don't like that, but still.
05:11:45<roconnor>it is neat.
05:11:45<Berengal>For some reason I always consider things to the right of <- to be "outside" the monad...
05:12:12<roconnor>Berengal: that's fair, but not what I think
05:12:35<Berengal>roconnor: Also, if you have blah <- earlier, the sort wouldn't go past that point...
05:13:08<roconnor>Berengal: that is a type error.
05:13:29<Berengal>roconnor: Doesn't have to be
05:13:37<Berengal>blah <- map return foo
05:13:45<roconnor>oh
05:13:59<roconnor>in that case I'm simply confused by what you mean.
05:14:32<paulrd>ApplicativeParsec.hs from RWH Chapter 16 appears to work usibg Parsec 2.1, but not using Parsec 3.0.
05:14:34<paulrd><snip>
05:14:36<paulrd>GHCi, version 6.10.2: http://www.haskell.org/ghc/ :? for help
05:14:38<paulrd>Loading package ghc-prim ... linking ... done.
05:14:40<paulrd>Loading package integer ... linking ... done.
05:14:42<paulrd>Loading package base ... linking ... done.
05:14:44<paulrd>[1 of 1] Compiling ApplicativeParsec ( Y:\examples\ch16\Applic
05:14:46<paulrd>ativeParsec.hs, interpreted )
05:14:48<roconnor>@paste
05:14:48<lambdabot>Haskell pastebin: http://hpaste.org/new
05:14:48<paulrd>Y\examples\ch16\ApplicativeParsec.hs:15:0:
05:14:50<paulrd>Illegal instance declaration for `Applicative (GenParser s a)'
05:14:52<paulrd>(All instance types must be of the form (T t1 ... tn)
05:14:54<paulrd>where T is not a synonym.
05:14:56<paulrd>Use -XTypeSynonymInstances if you want to disable this.)
05:14:58<paulrd>In the instance declaration for `Applicative (GenParser s a)'
05:15:00<paulrd>Y'\examples\ch16\ApplicativeParsec.hs:20:0:
05:15:02<paulrd>Illegal instance declaration for `Alternative (GenParser s a)'
05:15:04<paulrd>(All instance types must be of the form (T t1 ... tn)
05:15:06<paulrd>where T is not a synonym.
05:15:08<paulrd>Use -XTypeSynonymInstances if you want to disable this.)
05:15:10<paulrd>In the instance declaration for `Alternative (GenParser s a)'
05:15:12<paulrd>Failed, modules loaded: none.
05:15:15<paulrd>Prelude>
05:15:16<paulrd></snip>
05:15:18<paulrd>Is it possible to modify the ApplicativeParsec.hs so that it works for both versions of Parsec? (For example,using some form of conditional import.) Thanks for any help.
05:15:21<roconnor>@paste
05:15:21<lambdabot>Haskell pastebin: http://hpaste.org/new
05:15:52<Berengal>roconnor: If you did something like do {blah <- iterate tail foo; x <- sortBy cmp blah} the sortBy wouldn't sort the iterate tail foo part
05:16:06<roconnor>ah no
05:16:09<Berengal>Which wouldn't work anyway, but might be what you ultimately wanted
05:16:32<roconnor>but blah <- sort foo $ iterate tail foo -- this would
05:16:35<roconnor>basically
05:16:49<roconnor>x <- blah -- this does nondeterministic choice
05:17:04<roconnor>but the order of the elements in blah determines the backtracking search order
05:17:17<roconnor>since semantically we don't care about the search order (for finite lists)
05:17:32<roconnor>we can safely rearrange the list anyway we chose
05:17:38<Berengal>Yeah
05:17:40<roconnor>x <- sort foo blah
05:17:51<roconnor>which is niffty
05:18:04<Berengal>I like the list monad...
05:18:08<Berengal>And the reader monad
05:18:15<Berengal>Okay, I like monads
05:18:18<roconnor>I can make a clearly safe minor change, and tweek my performance.
05:18:29<Berengal>They're a wonderful piece of abstract nonsense
05:19:04<Berengal>roconnor: As long as it typechecks you're 50% golden. It's what I love about haskell
05:21:14<roconnor>What I like about haskell is what augustss said:
05:21:40<roconnor>“For me, a large part of the fantastic expressiveness of
05:21:42<roconnor>Haskell comes from the fact that you can combine
05:21:43<roconnor>different [abstractions] and they actually work
05:21:45<roconnor>together with very few surprises.”
05:22:30<Berengal>Yeah, that's what purity gets you
05:22:47<Gracenotes>a white wedding dress?
05:22:49<Berengal>It's essentially the same as the type checking
05:23:11<Berengal>Without purity the type checking wouldn't work nice either
05:24:07<Berengal>But because of purity, as long as the types are right (you combined the abstractions in a way that makes sense), it works, with very few surprises
05:29:45<Axman6>gahh, if only java had a nice sortBy (comparing snd) >_<
05:31:53<Apocalisp>Axman6: Noted. I'll add fj.pre.Ord.comparing.
05:32:54<Axman6>ACTION is trying to write a wordcount routine, and is needing to use about 4 different datatypes to get the most and least common words
05:33:10<Apocalisp>Why come?
05:35:43<roconnor>Apocalisp: (head &&& last) (sortBy frequency words)
05:36:03<roconnor>with laziness, the sort probably won't even finish.
05:36:12<roconnor>well, might not finish
05:36:53<roconnor>better be safe
05:37:12<roconnor>(minimumBy frequency words, maximumBy frequency words)
05:37:51<Apocalisp>nice
05:38:47<roconnor>it only looks nice because I haven't implemented frequency or words.
05:38:51<roconnor>the devil is in the details.
05:41:13<Axman6>frigging hell java is a pain in the arse
05:41:23<Apocalisp>It is that.
05:45:53<Apocalisp>Axman6: Are you using the standard libraries?
05:46:07<Axman6>yeah
05:46:12<Apocalisp>there's your problem right there
05:46:48<Apocalisp>It's not so much java (OK, yes it is) as it is the libraries.
05:46:48<Axman6>i've got the words and their counts in a hasktable, and not i need to get them out, and sort them based on the frequency. i found how to do it recently, but can't find the article again
05:46:59<Axman6>yeah
05:47:17<Gracenotes>Axman6: the idea is to not use a hashtable, perhaps
05:47:29<Axman6>how a batter idea?
05:47:31<Axman6>better too
05:47:35<Axman6>though batter's sweet
05:47:46<Apocalisp>A batter idea: cake!
05:47:57<Apocalisp>Programming is hard. Let's go baking.
05:50:12<Apocalisp>I don't think I would use a hashtable for counting words.
05:50:22<dobblego>according to Neal Gafter, you've just improved its usefulness, by using it
05:50:24<Gracenotes>Axman6: well, the way to do it with the standard libraries anyway is by getting the entry set and sorting it
05:50:45<Axman6>well, that's what i've got, but i can't remember how to sort it
05:50:58<dobblego>java.util.Collections.sort
05:51:08<Axman6>i've made the comparator and everything, but collections.sort is whinging
05:51:24<roconnor>This exponential implosion still has me in a little shock. If the python code had not used mutable variables for their counter, they could have stumbled upon the same sharing themselves. If their code was suitably restructured to be immutable, there would even be a tiny tiny possibility that their compiler could have found the sharing too.
05:51:53<Gracenotes>well. Since this is notoriously known as a Java support channel.
05:51:59<Gracenotes>ArrayList<Map.Entry<Blah, Integer>> blahs = new ArrayList<Map.Entry<Blah, Integer>>(blahmap.entrySet());
05:52:01<Gracenotes>Collections.sort(blahs, new Comparator<Map.Entry<Blah, Integer>>() { public int compare(Map.Entry<Blah, Integer> o1, Map.Entry<Blah, Integer> o2) { return o2.getValue().compareTo(o1.getValue()); } });
05:52:10<Gracenotes>(shield your eyes!)
05:52:15<Axman6>ah ha
05:52:23<Axman6>arraylist, sounds good
05:52:37<Apocalisp>The pointy brackets... they pierce our chi
05:52:55<Boney>why not use a binary tree when collecting the items? then they're already sorted.
05:53:08<Gracenotes>Boney: by the key, yes
05:53:12<Boney>ah,
05:53:21<Boney>sorry, you want to sort by the frequency.
05:53:22<Gracenotes>I was about to suggest that, but reality dawned ;_;
05:53:55<Gracenotes>now, for your enjoyment: sort (comparing snd) . Map.toList
05:53:57<Boney>ACTION goes back to something he can give his full attention to.
05:54:26<Boney>Gracenotes: awesome.
05:55:29<Gracenotes>sort has its own sloow limitations, but, regardless.
05:56:39<Gracenotes>holds up surprisingly well
05:58:01<inbuninbu>any experts on Data.Binary around?
05:58:05<Berengal>I've found sort to be reasonably quick
05:58:21<Berengal>Bearing in mind it's sorting a singly linked list
06:05:23<Axman6>thanks heaps Gracenotes
06:05:33<Gracenotes>np
06:05:46<Axman6>ACTION gives Gracenotes a brand new shiny heaps to store his objects in
06:05:48<Axman6>-s
06:06:13<Gracenotes>MONADIC STACK OVERFLOW
06:06:36<Apocalisp>http://code.google.com/p/functionaljava/issues/detail?id=6
06:57:55<zachk>why does something i consider difficult only take 45 lines of haskell :-D
06:58:50<Axman6>because you have high expectations
06:58:52<jbjohns>Haskell does the easy things for your, makes the hard things easy and the impossible possible
07:02:28<Gracenotes>ACTION compresses random data in Haskell
07:04:53<Cale>zachk: 45 lines of Haskell can take quite a lot of thought
07:05:04<zachk>yea took me on and off all day
07:05:21<zachk>problem 11 of project euler, but now euler is down :-/
07:06:03<zachk>i feel like such a newb
07:17:00<mxc>to paraphrase xkcd, i can make a random number generator in one like:
07:17:36<mxc>randomNumberGen = 4 {- chosen by a roll of the dice, garaunteed to be random -}
07:19:23<Gilly>what book/tutorial would you recommend for a friend of mine who has a long background in imperative programming but who could be converted (or at least introduced) to functional programming?
07:19:36<Gilly>real world haskell?
07:19:47<zachk>"Programming in Haskell" by Graham Hutton if he wants to learn haskell
07:20:08<Gilly>it should be something available online I think
07:20:25<zachk>shell out some $$$ for pih its worth it
07:21:00<Gilly>well - i think since he doesn't know anything at all about the subject it would be hard for me to convince him to buy it
07:21:17<SubStack>learn you a haskell is fun times
07:21:38<SubStack>there's also real world haskell which you can read online
07:21:50<Gilly>okies, thanks :)
07:21:52<SubStack>and also buy
07:21:56<Gilly>yea
07:56:59<mxc>gilly - second that.. RWH is great. can check it out online too
08:22:24<ManateeLazyCat>Have a function's type signature is "[a] -> (a -> c) -> (a -> b) -> [c, b]" ?
08:22:30<ManateeLazyCat>Thanks
08:23:05<thoughtpolice>what does [c,b] mean?
08:23:21<ManateeLazyCat>is [(c, b)]
08:23:47<ManateeLazyCat>[a] -> (a -> b) -> (a -> c) -> [(b, c)]
08:23:54<ManateeLazyCat>typo
08:26:06<ManateeLazyCat>Have a exist function wit type "[a] -> (a -> b) -> (a -> c) -> [(b, c)]"?
08:26:25<kniu>Does oatmeal cause gas?
08:27:16<Gilly>ManateeLazyCat: f as b c = zip (map b as) (map c as)
08:27:23<opqdonut>:t \xs f g -> map (f &&& g) xs
08:27:25<lambdabot>forall a c c'. [a] -> (a -> c) -> (a -> c') -> [(c, c')]
08:27:32<ManateeLazyCat>Gilly: Thanks! :)
08:27:34<opqdonut>that for a more combinatorial version
08:27:59<ManateeLazyCat>opqdonut: Thanks
08:28:07<opqdonut>np
08:28:12<Gilly>what does &&& mean?
08:28:17<opqdonut>:t (&&&)
08:28:18<lambdabot>forall (a :: * -> * -> *) b c c'. (Arrow a) => a b c -> a b c' -> a b (c, c')
08:28:24<opqdonut>it's an arrow combinator
08:28:29<opqdonut>(->) is one example of an arrow
08:28:43<opqdonut>> ((+1) &&& id) 1
08:28:45<lambdabot> (2,1)
08:29:12<tetha>hm, so on a function levle, &&& is like factors bi?
08:29:33<Axman6>eh?
08:29:34<Gilly>ah... so (f &&& g) = \xs -> (f xs, g xs) ? constructs pairs of
08:29:43<Gilly>forget the rest of the line, was going to say something else :D
08:29:44<Axman6>ACTION parse fail on that sentense
08:30:17<opqdonut>Gilly: yeah, in the function arrow, yes
08:30:20<opqdonut>otoh
08:30:26<dobblego>@type (&&&) :: (b -> c) -> (b -> c') -> b -> (c, c')
08:30:28<lambdabot>forall b c c'. (b -> c) -> (b -> c') -> b -> (c, c')
08:30:32<opqdonut>> ((1,2) &&& (3,4))
08:30:34<lambdabot> No instance for (Arrow (,))
08:30:34<lambdabot> arising from a use of `&&&' at <inte...
08:30:41<opqdonut>huh?, thought they were
08:30:45<tetha>Axman6: bi is a combinator in factor, a stack-based language. it applies the topmost element on the stack and the second topmost element on the stack to the third element on the stack and pushes both results in order
08:30:53<dobblego>(,) is not an Arrow
08:30:59<opqdonut>yeah, no arr
08:31:02<opqdonut>misremembered
08:31:09<dobblego>Bifunctor perhaps
08:31:23<Gilly>these arrows look scary :)
08:31:45<opqdonut>(,) was a category tho, (a,b) . (b,c) = (a,c)
08:34:38<Cale>opqdonut: What's id though?
08:37:16<opqdonut>Cale: (a,a) ?-)
08:38:58<opqdonut>Control.Category.Discrete is basically (,)
08:41:19<Cale>opqdonut: er, that would be the type.
08:41:53<ManateeLazyCat>opqdonut: How to write function with "[a] -> (a -> IO b) -> (a -> IO c) -> [(b, c)]"?
08:42:04<Cale>If one exists. But the trouble is that you need id . (x,y) = (x,y)
08:42:39<opqdonut>ah, yeah
08:42:44<Cale>ManateeLazyCat: Not possible unless you fit another IO into that type
08:42:46<DrSyzygy>ManateeLazyCat: You won't do that without getting somehtingn like IO d -> d, which isn't supposed to happen.
08:43:34<opqdonut>ManateeLazyCat: but a function [a] -> (a -> IO b) -> (a -> IO c) -> IO [(b, c)] is very possible
08:44:07<ManateeLazyCat>opqdonut: "[a] -> (a -> IO b) -> (a -> IO c) -> IO [(b, c)]" is okay, how to implement it?
08:44:42<dobblego>(a -> IO b) is also an arrow (Kleisli)
08:44:50<Haplo>http://netia.mybrute.com
08:45:24<Cale>:t \f g -> mapM (liftM2 (liftM2 (,)) f g)
08:45:26<lambdabot>forall a1 a2 (m :: * -> *) a. (Monad m) => (a -> m a1) -> (a -> m a2) -> [a] -> m [(a1, a2)]
08:53:05<Cale>ManateeLazyCat: Or perhaps more straightforwardly:
08:53:13<Cale>:t \xs f g -> forM xs $ \x -> do u <- f x; v <- g x; return (u,v)
08:53:15<lambdabot>forall a (m :: * -> *) t t1. (Monad m) => [a] -> (a -> m t) -> (a -> m t1) -> m [(t, t1)]
08:53:43<Cale>This is assuming that you want the effects to happen in that particular order.
08:53:55<Cale>You could also do something like...
08:54:30<Cale>:t \xs f g -> do us <- forM xs f; vs <- forM xs g; return (zip us vs)
08:54:32<lambdabot>forall a (t :: * -> *) b b1. (Monad t) => [a] -> (a -> t b) -> (a -> t b1) -> t [(b, b1)]
08:54:39<Cale>Which is quite different.
08:56:05<ManateeLazyCat>Cale: That's cool, thanks!
09:07:08<ManateeLazyCat>Cale: "\xs f g -> forM xs $ \x -> do u <- f x; v <- g x; return (u,v)" is more efficient, "\xs f g -> do us <- forM xs f; vs <- forM xs g; return (zip us vs)" loop *twice*.
09:20:20<RayNbow>sigfpe's trace diagrams blog post is mind blowing (if you try to evaluate the expressions in one's head)
09:22:45<zachk>RayNbow: could you post the url
09:23:17<RayNbow>zachk: http://blog.sigfpe.com/2009/05/trace-diagrams-with-monads.html :)
09:23:24<zachk>danke
09:24:19<RayNbow>I've read the article up to cupcap last night (after which I was too tired to continue :p)
09:24:23<opqdonut>heh, almost like penrose notation
09:25:28<RayNbow>@go penrose notation
09:25:29<lambdabot>http://en.wikipedia.org/wiki/Penrose_graphical_notation
09:25:48<zachk>he makes it look easy
09:26:01<opqdonut>oh, that is penrose notation i guess
09:26:26<opqdonut>i first thought the post was about monads generally and not vector spaces
09:27:42<RayNbow>ACTION doesn't get the Penrose wiki page... (but then again, I'm not familiar with tensors :p)
09:49:45<mxc>nice error message GHC: "error: My brain just exploded. I can't handle pattern bindings for existentially-quantified constructors."
09:50:41<opqdonut>wow
09:52:19<tetha>heh
09:54:56<Heffalump>sounds like it blew up JaffaCake too
10:06:52<mxc>hm
10:07:20<mxc>i have a record with an existentially scoped list, can't seem to get to that list
10:07:26<mxc>wondering if i'm doing something i shouldn't be
10:07:49<mxc>data MessageClient = forall mq. MessageQueue mq => MC_
10:07:49<mxc> { associatedQueues :: IORef [mq] ,...}
10:24:28<mib_dv5tdpto>hey ppl
10:39:30<Nereid>@pl \x -> m x y
10:39:30<lambdabot>flip m y
10:39:41<Nereid>of course
10:41:45<jbjohns>@pl
10:41:45<lambdabot>(line 1, column 1):
10:41:46<lambdabot>unexpected end of input
10:41:46<lambdabot>expecting white space, "()", natural, identifier, lambda abstraction or expression
10:42:01<jbjohns>@pl \x -> m x
10:42:02<lambdabot>m
10:42:10<jbjohns>@help
10:42:10<lambdabot>help <command>. Ask for help for <command>. Try 'list' for all commands
10:42:22<jbjohns>@help pl
10:42:22<lambdabot>pointless <expr>. Play with pointfree code.
10:42:28<Nereid>http://www.haskell.org/haskellwiki/Pointfree
10:42:49<jbjohns>I see now
10:43:00<Nereid>:)
10:43:06<jbjohns>:)
10:43:54<Nereid>@help unpl
10:43:54<lambdabot>pointful <expr>. Make code pointier.
10:44:05<Nereid>@unpl flip m y
10:44:05<lambdabot>(\ c -> m c y)
10:44:34<Nereid>@unpl ((.)$(.))
10:44:34<lambdabot>(\ b c e f -> b c (e f))
10:44:37<Taejo>I thought the point of unpl was to make code uglier
10:44:42<Nereid>@unpl ((.).(.))
10:44:43<lambdabot>(\ i b c f -> i (b c f))
10:44:44<Nereid>hooray
10:44:47<Nereid>anyway
10:44:50<Nereid>bedtime
10:46:50<Taejo>Can anybody think of a better/shorter program to generate all binary trees with leaves from a given list, than http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5161#a5161
10:49:10<SubStack>just explicit recursion?
10:53:02<SubStack>Taejo: propagate a found status up to the parents instead of generating a list of all the nodes perhaps?
11:01:41<Taejo>SubStack: I'm not sure what you mean
11:07:05<EvilTerran>allTrees [] = mzero; allTrees [x] = return (Tip x); allTrees xs = Branch (allTrees ls) (allTrees rs) where (ls, rs) = partitionM (const [False, True]) xs; partitionM = {- compare filterM, partition -}
11:08:48<EvilTerran>> filterM (const [False,True]) [1,2,3]
11:08:50<lambdabot> [[],[3],[2],[2,3],[1],[1,3],[1,2],[1,2,3]]
11:11:03<Axman6>@src filterM
11:11:04<lambdabot>Source not found. There are some things that I just don't know.
11:11:19<EvilTerran>(i guess partitionM :: Monad m => (a -> m Bool) -> [a] -> m ([a], [a]))
11:12:35<EvilTerran>filterM _ [] = return []
11:12:35<EvilTerran>; filterM p (x:xs) = do flg <- p x; ys <- filterM p xs; return (if flg then x:ys else ys)
11:15:01<EvilTerran>?src partition
11:15:01<lambdabot>partition p xs = foldr (select p) ([],[]) xs
11:15:02<lambdabot> where select p x ~(ts,fs) | p x = (x:ts,fs)
11:15:02<lambdabot> | otherwise = (ts, x:fs)
11:15:56<EvilTerran>anyway, the idea being that partitionM (const [True, False]) xs will give you, by virtue of the list monad, a list of all partitionings of xs
11:16:22<dmwit>s/partitionM/filterM/
11:16:50<EvilTerran>dmwit, ?
11:17:26<dmwit>> filterM (const [True, False]) [3..5]
11:17:27<lambdabot> [[3,4,5],[3,4],[3,5],[3],[4,5],[4],[5],[]]
11:17:39<EvilTerran>dmwit, gives you a list of all sublists, not all partitionings
11:17:45<dmwit>errm
11:17:47<dmwit>quite
11:17:48<EvilTerran>you want the complement lists as well
11:18:06<EvilTerran>hence, you want something you could call partitionM
11:22:47<zachk>@type any
11:22:48<lambdabot>forall a. (a -> Bool) -> [a] -> Bool
11:22:59<zachk>@src any
11:22:59<lambdabot>any p = or . map p
11:23:58<Bacta>@faq can Haskell solve world hunger?
11:23:58<lambdabot>The answer is: Yes! Haskell can do that.
11:24:33<skorpan>@faq can haskell do a giraffe?
11:24:33<lambdabot>The answer is: Yes! Haskell can do that.
11:25:36<mm_freak_>hashUnique just returns numbers from [1..] in order for each newUnique invocation, which is good, but can i rely on that? not on the ordering, but that collisions are very unlikely in practice
11:27:08<mm_freak_>i'm asking because IntMap Something is probably faster than Map Unique Something
11:28:18<sayyestolife>Is there a haskell-for-beginners IRC channel?
11:28:56<mauke>no, but there's #haskell-in-depth
11:28:56<dmwit>sayyestolife: You're in it.
11:29:00<mauke>which is sort of the opposite
11:29:07<sayyestolife>dmwit, awesome!
11:29:38<dmwit>mm_freak_: You haven't given enough information about when collisions happen, but let me point you at Wikipedia's page on the Birthday Paradox just in case you didn't know about it.
11:29:44<sayyestolife>So.. I'm trying to get a grip on monads and their use. I
11:29:57<sayyestolife>I'm trying to do a little text-based version of hangman
11:30:19<sayyestolife>and I'm wondering if the "current status" so to speak, should be represented as a monad?
11:30:21<mm_freak_>dmwit: the birthday paradox doesn't apply to hashUnique, because its output is not random at all
11:30:30<mm_freak_>dmwit: i think it's not supposed to be random anyway
11:30:45<dmwit>mm_freak_: So what do you mean by collisions?
11:30:53<mauke>sayyestolife: I don't know if it should be, but it's definitely possible
11:31:05<dmwit>sayyestolife: The current status should almost certainly be represented simply as a value.
11:31:06<wh1t3>hmmm, im getting an error i dont understand
11:31:22<dmwit>sayyestolife: However, you can use a monad to thread that value through your computations, if you like.
11:31:39<sayyestolife>mkay
11:31:45<wh1t3>No instance for (Floating Int) arising from a use of `sqrt
11:32:06<dmwit>Specifically, the State monad seems like one possibility.
11:32:13<mm_freak_>dmwit: the documentation states that two Unique values may hash to the same Int, but this is "unlikely" to happen in practice… if the birthday paradox would apply, that would be extremely bad, but it doesn't apply, since hashUnique really returns numbers 1, 2, 3, 4, … for the corresponding invocations of newUnique
11:32:20<mm_freak_>dmwit: my question is: can i rely on that?
11:32:22<wh1t3>in: sqrt (fromIntegral (dx^2 + dy^2)) where dx and dy are Int
11:33:03<mauke>wh1t3: what are you doing with the result of sqrt?
11:33:06<dmwit>mm_freak_: You can rely on newUnique returning unique numbers, and maybe even on it returning unique, increasing numbers.
11:33:22<dmwit>mm_freak_: But you cannot rely on the birthday paradox not applying, because hashing rarely uses the identity function.
11:33:35<wh1t3>multiplying it with an Int mauke
11:33:49<mauke>wh1t3: yeah, that won't work
11:34:02<wh1t3>how to make it work then?
11:34:12<wh1t3>all these different numerical types are making me kind of crazy
11:34:15<mm_freak_>currently i'm always using one of two approaches: either Map Unique Something or an own id generator like this: forkIO $ mapM_ (putMVar nextID) [0..]
11:34:20<mauke>wh1t3: (*) takes two arguments of the same type. if one of them is an Int, the result of sqrt has to be too
11:34:28<mauke>wh1t3: and you can't sqrt an Int
11:34:47<Nereid>let's say n is an Int and you're trying to find sqrt x * n
11:34:56<Nereid>that would fail, but you could do sqrt x * fromIntegral n
11:35:09<mauke>wh1t3: you have to turn the result of sqrt in an Int; do you want to round it up or down or to nearest?
11:35:18<dmwit>mm_freak_: You do know that Map doesn't do any hashing, right?
11:35:28<wh1t3>mauke, nearest
11:35:30<Nereid>mauke: I think he's taking the sqrt of a Floating and then multiplying the result by an Int
11:35:47<mauke>wh1t3: hmm, or do you want the result to be a fractional number?
11:35:49<wh1t3>i am indeed Nereid, but mauke already figured that out
11:36:03<wh1t3>mauke. no an Int, since i need to pass it into a function that takes ints
11:36:04<dmwit>mm_freak_: Oh, I see, there's no other way to use a Unique than via hashUnique, huh?
11:36:08<mauke>wh1t3: round (sqrt (...))
11:36:13<Nereid>ah, ok then.
11:36:15<wh1t3>cheers, let me give that a go :)
11:37:19<Nereid>if you wanted the nearest integer to sqrt x * n then I'm guessing you'd have to do something like round (sqrt x * fromIntegral n)
11:37:22<wh1t3>ah yes, that works :)
11:37:28<wh1t3>thanks mauke
11:37:57<mm_freak_>dmwit: no, you can use Unique with Map, but i'd like to use IntMap, which is faster
11:38:12<mm_freak_>so in that case i need to use hashUnique or implement my own generator
11:38:44<mm_freak_>hashUnique should be less abstract IMO, because 'hashing' to Int is almost useless in practice
12:13:09<man>@lambdabot
12:13:10<lambdabot>Unknown command, try @list
12:13:39<dmwit>@bot
12:13:39<lambdabot>:)
12:13:39<lunabot> :)
12:25:55<pe>Hi. I'm trying to use the FFI : I have a C struct representing a rational (two ints). How comes when I try to define instance Storable (Ratio a), trying to peek loops infinitely ?
12:26:32<mauke>apparently you did it wrong
12:26:56<dmwit>Oh, boy, I never did get a straight answer about accessing C structs from Haskell.
12:27:04<mauke>really?
12:27:11<dmwit>I think there's tools to help you, like c2hs or so.
12:27:19<mauke>I found it relatively straightforward
12:27:35<dmwit>Well, there's nothing in the FFI spec about it.
12:28:06<pe>in fact, I'm using hsc2hs that converts #{peek c_struct, c_field} into peekByteOff
12:28:13<mauke>well, you have to know the offsets of struct members, which requires help from the C compiler
12:28:21<dmwit>right
12:28:24<pe>yeah. That's what I did
12:28:43<dmwit>pe: It might help to paste some code.
12:28:45<dmwit>?hpaste
12:28:45<lambdabot>Haskell pastebin: http://hpaste.org/new
12:28:48<pe>I don't understand why peekByteOff does a recursive call to the peek I'm defining
12:29:53<dmwit>yoink!
12:30:51<pe>Here : http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5162#a5162
12:31:16<mauke>that doesn't look valid
12:31:23<mauke>what is AVRational?
12:31:31<pe>I paste it now
12:32:03<mauke>and it's recursive because avnum :: Ratio a
12:32:16<pe>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5162#a5163
12:32:55<pe>ah ok
12:33:07<mauke>I wouldn't use that to represent Ratio a
12:33:22<pe>you mean in the C side ?
12:33:24<mauke>I'd make a new type data AVRational = AVR { num, den :: CInt }
12:34:16<pe>that's what I did, in fact. I was just surprised that this could loop
12:34:31<mauke>and your alignment is wrong
12:34:39<pe>does it matter ?
12:34:42<mauke>yes
12:34:45<mauke>well, (/) :: a -> a -> a
12:34:50<mauke>so that's why it loops
12:35:04<mauke>bogus alignment means it can crash on some platforms
12:35:12<mauke>on x86 it just might be slow
12:35:40<pe>so my alignment should be the size in bytes of the smallest field in the struct, right ?
12:35:51<mauke>no
12:36:23<pe>ok, the gcd of all fields ?
12:36:30<mauke>um, no?
12:36:40<mauke>consider {int; char}
12:38:29<RayNbow>@. pl undo \v w -> do { i <- v ; j <- w ; cup i j }
12:38:30<lambdabot>(. ((. cup) . (>>=))) . (>>=)
12:38:36<RayNbow>@. pl undo \v w -> do { i <- v ; j <- w ; cup (i, j) }
12:38:36<lambdabot>(. ((. ((cup .) . (,))) . (>>=))) . (>>=)
12:38:41<RayNbow>hmm...
12:40:40<mauke>pe: http://rafb.net/p/LPOjRY85.html (untested)
12:41:02<mauke>untested indeed; it's also broken :-)
12:41:18<mauke>line 13 should be return AVR{ num = n, den = d }
12:42:06<pe>ok, thanks, but what use is the alignment ?
12:42:27<pe>how do you find your #let alignment ... ?
12:42:45<pe>and what does it mean ?
12:43:46<mauke>certain types of objects have to be placed at addresses that are divisible by some number (the "alignment")
12:43:59<mauke>e.g. it's not uncommon for ints to have an alignment of 4
12:45:01<mauke>so if you define a type like struct { short a; int b; }, it's very likely that the compiler will insert padding after 'a' to make the position of 'b' divisible by 4
12:46:09<mauke>my alignment trick uses the standard C macro to get the offset of a struct member in a type of the form struct { char dummy; T x; }
12:46:18<mauke>er, "the standard C macro offsetof"
12:46:32<pe>ok, thanks !
12:46:45<mauke>if T has no special alignment constraints, it's placed immediately after 'dummy', giving an alignment of 1
12:47:40<mauke>but if the compiler inserts three bytes of padding (likely for int), the offset will be 4
12:51:08<Peaker>@src liftM2
12:51:09<lambdabot>liftM2 f m1 m2 = do { x1 <- m1; x2 <- m2; return (f x1 x2) }
12:52:32<Peaker>when were monad comprehensions first introduced? They're not that much shorter than do notation - what was their rationale?
12:53:41<Botje>somebody forgot to restrict list comprehensions to the list monad? :)
12:54:36<Peaker>I heard that list comprehensions started out as general monad comprehensions
12:56:49<dolio>They were still list comprehensions in 1.3.
12:57:08<dolio>Gofer probably had them first, and then they got added to 1.4.
12:57:10<dolio>And removed in 98.
12:57:47<Taejo>dolio: so they were list, then monad, then list comprehensions?
12:58:17<dolio>Yeah.
12:58:56<dolio>Miranda (at least) had list comprehension, I think, so they predate Haskell altogether.
12:59:16<Peaker>do { x <- [1..3] ; y <- "abc" ; return (x,y) } -- not that much longer than [(x,y) | x <- [1..3], y <- "abc"]
12:59:17<mauke>everyone knows python invented list comprehensions
12:59:35<Peaker>mauke: Python mentioned Haskell when they first added it, iirc
13:00:23<dolio>Wikipedia says SETL had something like them in the 1960s.
13:01:08<Ferdirand>but return is waaay too long a symbol
13:01:43<Taejo>Ferdirand: I agree. η is much shorter
13:02:03<mauke>> let η = return in η 42 :: Maybe Int
13:02:04<lambdabot> Just 42
13:02:27<Taejo>then of course we'd want:
13:02:44<maltem>ACTION would also like a prettier symbol for (>>=)
13:03:16<Taejo>> let µ = join in µ (η (η 42))
13:03:18<lambdabot> <no location info>: parse error on input `µ'
13:03:38<Taejo>> let μ = join in μ (η (η 42))
13:03:39<lambdabot> Not in scope: `η'Not in scope: `η'
13:03:47<mauke>> let μ = join in μ ["hello", "world"]
13:03:49<lambdabot> "helloworld"
13:04:07<Taejo>mauke: right
13:04:29<RayNbow>are there any memnonics or something to remember mu=join and eta=unit?
13:05:13<dolio>mu and multiplication begin with the same letter.
13:05:18<Taejo>RayNbow: well, eta is used more generally for natural transformations; return and join are both natural, but I think return is the more natural of the two
13:05:20<dolio>Same two, actually.
13:05:55<Taejo>> let ∅ = Data.Set.empty in ∅
13:05:56<lambdabot> <no location info>: parse error on input `∅'
13:06:18<maltem>The Danish empty set? :)
13:06:28<Taejo>> let (∅) = Data.Set.empty in (∅)
13:06:30<lambdabot> /tmp/7702976657628257688:70:42: Not in scope: `Data.Set.empty'
13:06:48<Taejo>maltem: it's an empty set symbol... unfortunately, it's a symbol, so Haskell wants it to be infix
13:07:23<mauke>> let ø = [] in ø
13:07:24<lambdabot> []
13:08:16<trofi>> [].to_set
13:08:17<lambdabot> Not in scope: `to_set'
13:09:03<paper_cc>> let ∅ = [] in ∅
13:09:04<lambdabot> <no location info>: parse error on input `∅'
13:09:15<paper_cc>two different symbols?
13:10:15<mauke>U+00F8 (c3 b8): LATIN SMALL LETTER O WITH STROKE [ø]; U+2298 (e2 8a 98): CIRCLED DIVISION SLASH [⊘]
13:10:19<tetha>did you tell the compulter you want to use utf8?
13:10:23<mauke>U+2205 (e2 88 85): EMPTY SET [∅]
13:10:25<tetha>eh, compiler
13:10:42<maltem>Taejo, oh, it looked too small in my font. Whatever...
13:10:51<int-e>> map generalCategory "ø∅"
13:10:53<lambdabot> [LowercaseLetter,MathSymbol]
13:11:10<maltem>right
13:11:14<paper_cc>why is MathSymbol considered a symbol and not a letter?
13:11:28<paper_cc>*considered by GHC
13:11:32<int-e>> let a ∅ b = [] in 1 ∅ 2
13:11:33<lambdabot> []
13:12:07<int-e>many of them are used as infix operators.
13:12:21<int-e>> generalCategory '⊕'
13:12:22<lambdabot> MathSymbol
13:13:01<mauke>> let ø = []; _ ⊘ ø = ø in ø ⊘ ø
13:13:02<lambdabot> []
13:13:19<paper_cc>oh
13:13:36<paper_cc>ACTION wants a good built-in category map in GHC
13:14:53<dolio>> generalCategory '+'
13:14:54<lambdabot> MathSymbol
13:17:42<ray>> let ∅ = Data.Set.empty in ∅
13:17:43<lambdabot> <no location info>: parse error on input `∅'
13:18:12<mauke>you are now failing manually
13:18:24<ray>:(
13:18:48<ray>
13:18:57<mauke>
13:19:25<ray>
13:21:24<Peaker>@src permutations
13:21:24<lambdabot>Source not found. And you call yourself a Rocket Scientist!
13:21:26<Peaker>@src perms
13:21:26<lambdabot>Source not found. Where did you learn to type?
13:23:13<EvilTerran>> let (∅) = Set.empty in (∅)
13:23:14<lambdabot> fromList []
13:24:43<ray>> generalCategory '☹'
13:24:45<lambdabot> OtherSymbol
13:25:17<dolio>> let a ☹ b = a + b in 1 ☹ 2
13:25:19<lambdabot> 3
13:25:25<EvilTerran>ACTION doesn't actually have most of these symbols in the font he's using, so they're mostly coming up as boxes
13:25:44<dolio>That was an unhappy face.
13:49:40<Peaker>> cycle "ppyHa"
13:49:41<lambdabot> "ppyHappyHappyHappyHappyHappyHappyHappyHappyHappyHappyHappyHappyHappyHappyH...
14:20:36<Peaker>so, why is roconnor's example (rewritten here: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5164#a5164 )
14:20:40<Peaker>so fast on writer and so slow on state?
14:21:08<Peaker>I went a step further to show its not a simple CSE on GHC's side (both are CSE's manually)
15:38:16<gio123>http://rapidshare.com/files/236364849/ssssss.pdf.html
15:38:24<hatds>?
15:38:58<gio123>can you tell me please what font it is?
15:39:07<EvilTerran>gio123, what's that about?
15:39:09<gio123>it is georgian letter
15:39:23<gio123>but I can not recognize font to type
15:39:27<Botje>gio123: you're best off asking whatthefont or somesuch.
15:39:33<Botje>this is not the channel for that.
15:39:35<gio123>the letters are georgian,
15:39:38<gio123>ok
15:39:40<gio123>sorry
15:39:50<EvilTerran>... and what does that have to do with Haskell?
15:39:57<Botje>haskell uses letters too! see!
15:41:35<hatds>...I get it
15:42:12<gio123>EvilTerran: haskel has relation with everything
15:46:19<Absolute0>Is it bad style to define the following function: x % y = x `mod` y ?
15:46:56<Twey>Absolute0: Well, ‘(%) = mod’ is easier
15:47:00<Twey>But no, not really
15:47:06<Twey>I don't think % is used for anything else
15:47:08<Absolute0>hmm cool :)
15:47:14<kpreid>@hoogle %
15:47:14<lambdabot>Data.Ratio (%) :: Integral a => a -> a -> Ratio a
15:47:15<Absolute0>Twey its not defined
15:47:19<Twey>Ah, there we are
15:47:36<Twey>The Haskell folks just didn't think it was useful enough to merit its own operator
15:47:38<Absolute0>maybe it's in some library
15:47:39<Twey>I agree
15:47:55<Twey>Absolute0: It's the ratio-making symbol
15:48:03<kpreid>I would recommend against using % for `mod` since Data.Ratio uses it for something entirely different
15:48:03<Twey>> 3 % 1
15:48:04<lambdabot> 3%1
15:48:13<kpreid>> 5%10
15:48:14<lambdabot> 1%2
15:48:21<Absolute0><interactive>:1:2: Not in scope: `%'
15:48:30<kpreid>It's in the Data.Ratio module
15:49:06<Absolute0>5 % 6 returns 5 % 6
15:49:10<Absolute0>is it a constructor?
15:50:09<EvilTerran>no
15:50:19<EvilTerran>infix constructors always start with a :
15:50:38<EvilTerran>however, the Ratio datatype has a non-derived Show instance
15:50:45<Absolute0>ah
15:51:21<Twey>@let (⅟) = (1%)
15:51:22<lambdabot> Illegal character ''\8543''
15:51:22<Absolute0>anyways what is wrong with this definition: data Position = (X Char, Y Num)
15:51:24<Twey>:(
15:51:32<Twey>Absolute0: Lacks a constructor
15:51:58<Absolute0>data Position = Position (X Char, Y Num) ?
15:52:07<Twey>(and X and Y are undefined, obviously)
15:52:18<Twey>Sure
15:52:26<Absolute0>I was hoping x and Y would be the constructors
15:52:28<Absolute0>weird
15:52:30<Absolute0>:)
15:52:35<Twey>That makes Position :: (X Char, Y Num) -> Position
15:52:40<Twey>No
15:52:55<Twey>That would be data Position = X Char | Y Num
15:53:01<Twey>Although Num is a class and not a type
15:53:12<Twey>So that probably won't work anyway, unless you've defined some type Num
15:53:17<Absolute0>Twey I want a tuple data type with a char and a Num
15:53:33<walter__>In "type State st a = st -> (st, a) " , is type defined a parameterized synonym?
15:53:34<Absolute0>A value would be ('a', 5)
15:53:58<EvilTerran>?type ('a', 5)
15:54:00<lambdabot>forall t. (Num t) => (Char, t)
15:54:05<EvilTerran>?type ('a', 5 :: Int)
15:54:06<lambdabot>(Char, Int)
15:54:21<Twey>Absolute0: Sounds like you want a synonym, then, not a datatype at all
15:54:33<Absolute0>oh type
15:54:34<Twey>Absolute0: type Position = Num n => (Char, n)
15:54:35<Absolute0>i guess
15:54:58<Absolute0>why do you do Num n but not Char c ?
15:55:00<Absolute0>or both
15:55:29<Twey>Because Num is a typeclass and Char is a type.
15:55:31<EvilTerran>Absolute0, Char is a type; as is Int, Double, etc
15:55:31<int-e>Char is a type. Num is a type class (instances are Integer, Rational, Double, Rational, and many more)
15:55:43<Absolute0>oh gotcha
15:55:48<Absolute0>i'll use int instead
15:55:50<walter__>what is the "->" m means in "type State st a = st -> (st, a) "
15:55:53<int-e>(don't ask me why I had Rational twice :-) )
15:56:04<Twey>Absolute0: Unless you have a good reason, it's often wise to default to Integer
15:56:06<Saizan>walter__: it's the type constructors for functions
15:56:08<Twey>Integers don't overflow
15:56:19<Saizan>walter__: A -> B is the type of functions from A to B
15:58:54<walter__>Saizan: I still confused, is "st" a construction or a general function?
15:59:13<EvilTerran>walter__, no.
15:59:26<EvilTerran>walter__, "st" is a type variable, introduced by "type State st a = ..."
15:59:59<EvilTerran>walter__, "type State st a = ..." would introduce a type synonym "State", that takes two types as parameters
16:00:23<Absolute0>type signatures can only use classes?
16:00:36<Absolute0>executeMove :: (Position p, Move m) => p -> m -> m throws an error
16:01:18<Twey>Absolute0: Because Position isn't a class
16:01:25<Twey>And presumably Move isn't, either.
16:01:36<Absolute0>one is a type the other a data
16:01:45<Twey>They're both types.
16:01:48<Absolute0>right
16:01:52<walter__>EvilTerran, thanks, then what is "st -> (st, a)" means, it looks like a funtion defination
16:01:59<Absolute0>ehh
16:02:23<Absolute0>How do I specify that a function can only accept a certain type, do I have to uses classes?
16:02:35<thoughtpolice>Absolute0: no, just give it a type signature
16:02:47<Absolute0>isn't that what i did?
16:02:49<EvilTerran>Absolute0, have a look at http://book.realworldhaskell.org/read/types-and-functions.html
16:02:56<EvilTerran>walter__, no, it's a type
16:03:29<thoughtpolice>Absolute0: yes, but Position and Move aren't type classes.
16:03:30<EvilTerran>walter__, specifically, it's the type of functions taking a value of type "st" as a parameter, and returning a pair of an "st" and an "a"
16:03:57<int-e>walter__: functions are first class. A function of type st -> (st, a) is a value of that type. You could pass it as an argument to a function of type (st -> (st, a)) -> st -> a.
16:04:03<EvilTerran>walter__, the actual types referred to by "st" and "a" being set by what parameters you provided to State
16:04:54<EvilTerran>for instance, (\s -> (s,s)) :: t -> (t, t), so you could substitute in that type synonym, and write (\s -> (s,s)) :: State t t
16:05:07<Jedai>Absolute0: You probably want something like "executeMove :: Position -> Move -> Move"
16:05:11<int-e>walter__: and in that regard, (->) works just like other type constructors, except that you can write it as an infix "operator".
16:05:21<Absolute0>Jedai: probably
16:05:31<walter__>EvilTerran, understand, thank you
16:05:35<int-e>> (id :: (->) Int Int) 3
16:05:36<lambdabot> 3
16:05:49<int-e>> (id :: Int -> Int) 3
16:05:50<lambdabot> 3
16:06:19<Twey>-> is magic in that it's an infix constructor that doesn't require a :
16:07:05<Jedai>Absolute0: Also, when you're not sure of a type, you can write the function without a type signature and use :type in GHCi to determine the most general type of your function, then you eventually restrict it and you use it for your signature
16:07:16<RayNbow>@quote knuth literate programming
16:07:16<lambdabot>No quotes for this person. BOB says: You seem to have forgotten your passwd, enter another!
16:07:19<RayNbow>hmm...
16:07:33<Absolute0>Jedai: Well i know the type just don't know how to phrase it yet. :)
16:09:35<walter__>int-e, can u explain in more detail?
16:09:58<int-e>Twey: infix type constructors are a language extension, btw.
16:10:01<Absolute0>does haskell allow indexing on a tuple?
16:10:10<hatds>no
16:10:24<Absolute0>so how do I read the elements of a tuple?
16:10:26<Absolute0>or process them
16:10:31<hatds>pattern matching
16:10:40<Berengal>Absolute0: Only on pairs, and only if you consider fst and snd to be indexing...
16:10:48<Absolute0>ah
16:11:10<byorgey>> let f (x,y) = x + 2 * y in f (2,3)
16:11:11<lambdabot> 8
16:11:30<byorgey>f is defined on tuples by pattern-matching.
16:12:57<int-e>walter__: I'm not sure. I meant to demonstrate that (->) A B and A -> B mean exactly the same thing in type signatures (namely the type of functions from A to B).
16:13:22<walter__>int-e, I see, thanks
16:13:43<Jedai>It wouldn't be very hard to write index function for the small tuples, it's just not the way tuples are used in Haskell
16:30:04<sm>morning all
16:31:03<sm>what's the best monad to use if I want to a "done" flag to bubble up out of some deep function calls, along with the data ?
16:31:25<Berengal>Cont?
16:31:29<sm>or should I just make an exception ?
16:32:24<sm>Cont looks a little more than I need
16:32:57<twanvl>Does the computation proceed as normal when the flag is set?
16:33:50<sm>yes it does, I'd like to process the last data read from stdin and then terminate (because it was terminated with ctl-d)
16:34:51<twanvl>You could try a Writer monad, that just adds an extra bit of output
16:37:15<sm>hmm isn't there a tour of the monads somewhere ? I'm not seeing it
16:37:20<BMeph>Is GHC "smart" enough to deal with a list that "builds" itself using inits? :)
16:37:45<sm>the haddock gives me no clue what Writer does
16:38:27<Berengal>Writer is like a limited State monad. You can't read the state, only write it
16:38:42<sm>that sounds just right.. and aha, http://www.haskell.org/all_about_monads/html/index.html
16:38:58<sm>but wait, I need to read it at the top surely
16:38:58<gwern>Reader + Writer = State, as I understand
16:40:30<sm>ACTION reads this rather good reference doc
16:43:27<dons>BMeph: if you have to ask that question, the answer is probably 'no'.
16:43:42<dons>assuming you mean 'does it have any special rules?'
16:45:06<pejo>dons, (returning to the catch discussion); did you have any examples of characterizations of what failures some analysis handled?
16:45:34<BMeph>dons: I don't need any special rules, I'm just trying to make a function that takes a list, and builds a new list from it that depends on convoluting the inout with the prior elements of the "output", if that makes any sense. :)
16:47:43<Jedai>@src inits
16:47:43<lambdabot>inits [] = [[]]
16:47:43<lambdabot>inits (x:xs) = [[]] ++ map (x:) (inits xs)
16:50:20<jeff_s_> testing :)
16:50:22<jeff_s_>ah, good
16:58:04<burp_>> [0.400,0.401..1]
16:58:05<lambdabot> [0.4,0.401,0.402,0.403,0.404,0.405,0.406,0.40700000000000003,0.408000000000...
16:58:12<burp_>ugly :|
16:58:48<byorgey>burp_: use Rational.
16:58:49<burp_>>map (/1000) [400..1000]
16:58:52<burp_>> map (/1000) [400..1000]
16:58:54<lambdabot> [0.4,0.401,0.402,0.403,0.404,0.405,0.406,0.407,0.408,0.409,0.41,0.411,0.412...
16:59:04<burp_>I need them in double anyway
16:59:24<paper_cc>has anyone here tried to build Leksah?
16:59:32<paper_cc>it fails for me
16:59:33<Beelsebob>paper_cc: yep
16:59:35<Beelsebob>tried many times
16:59:40<Beelsebob>failed in a different way every time
16:59:46<Berengal>paper_cc: Tried and succeeded
16:59:54<Renderwahn>managed to install it with the haskell gentoo overlay
17:00:07<monadic_kid>cabal install leksah in fedora 10
17:00:30<Berengal>I had to darcs get it and munge the cabal file some
17:00:47<paper_cc>monadic_kid: src/IDE/Completion.hs: (...)Not in scope: sourceLanguageManagerGuessLanguage
17:00:51<Jedai>paper_cc: Tried and succeded
17:01:23<paper_cc>ACTION couldn't find definitions for "sourceLanguageManager<Whatever>" in the sources
17:01:47<monadic_kid>paper_cc: what are you doing? are using cabal install? is this under fedora 10?
17:02:08<Jedai>paper_cc: Version 0.4.4.1, compiled on Ubuntu 9.04 with GHC 6.10.2
17:02:33<Jedai>Using Cabal install, worked perfectly
17:02:50<paper_cc>monadic_kid, Jedai: this is under Ubuntu Hardy 8.04, ghc 6.10.1, gtk2hs from darcs - both hackage and darcs version fail the same way
17:02:56<Jedai>(of course the "hard" bit is beforehand when you have to install Gtk2Hs
17:03:00<paper_cc>*versions
17:03:22<Jedai>I used a release for Gtk2Hs, 10.1
17:04:13<Jedai>Ooops, no it's 0.10.0
17:04:30<monadic_kid>paper_cc: i'm using .10.1 trying using cabal install
17:04:43<Jedai>May explain the difference of results with you (also I managed to install almost all Gtk2Hs)
17:04:54<monadic_kid>paper_cc: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall
17:06:20<paper_cc>ah, the sourceLanguageManagerStuff is from GtkSourceView...
17:07:11<paper_cc>(while release notes recommend to use the development version of Gtk2Hs)
17:07:59<thoughtpolice>ACTION is tired of fucking around with gtk2hs on OS X
17:09:04<thoughtpolice>having gtk2hs use x11 sucks, but building it on the gtk framework at www.gtk-osx.org basically gives you, like, gtk, glib, and maybe 2 other libs and that's it
17:09:07<thoughtpolice>which kinda sucks
17:09:30<dcoutts>thoughtpolice: latest gtk includes gtkbuilder, the replacement for glade
17:09:41<thoughtpolice>dcoutts: 0.10.1 ?
17:09:51<dcoutts>thoughtpolice: shouldn't be more than an hours work for you to bind gtkbuilder and send in the patches
17:10:03<dcoutts>it's a simple port of the libglade api binding
17:10:28<thoughtpolice>dcoutts: currently trying to get a registered GHC HEAD build for osx-x86_64, but I might try it sometime...
17:10:31<dcoutts>and the latest glade program can generate both, gtkbuilder is the way to go
17:10:36<thoughtpolice>(debugging compilers is fun!)
17:10:43<dcoutts>gnome 2.28 deprecates libglade even
17:10:55<dcoutts>thoughtpolice: :-)
17:11:21<paper_cc>where has sourceLanguageManagerGuessLanguage gone in the darcs version??
17:11:25<thoughtpolice>it's when you don't have stack traces that things get a little hairy :)
17:11:27<paper_cc>*of gtk2Hs
17:12:13<Le-Chuck_ITA>Hi there. I am wondering a basic question about alpha-conversion. If there are better channels to talk about that just tell me, I thought that the "lambda" in the haskell logo speaks for itself :)
17:12:43<Le-Chuck_ITA>The question is: the standard definition of alpha conversion is not expressed in equational logic, because of the side conditions on freshness
17:13:05<thoughtpolice>dcoutts: but that's good to hear. it would be uber awesome to have a mac installer for gtk2hs that installed all the necessary stuff along with the libraries... maybe something to work on after I fix this build and whatnot (however long that may take)
17:13:29<Le-Chuck_ITA>but if I just take the syntax of the lambda calculus and use as axioms all the pairs <t1,t2> whre t1 and t2 are alpha convertible... I just gave an equational definition of alpha conversion!
17:14:01<Le-Chuck_ITA>not definition, but axiomatisation at least
17:14:02<dcoutts>thoughtpolice: yes, the main thing holding back osx support is someone with access to osx to do the work there.
17:14:46<pejo>dcoutts, doesn't Well-typed have a mac for other purposes? (Not suggesting that you should do all the work though).
17:15:26<dcoutts>pejo: nope, I've got XP in a VM, but no OSX. They don't sell it without the hardware, and with the hardware it's pretty expensive, ~£500 for a mac mini.
17:15:55<dcoutts>pejo: MSR loan Igloo a mac laptop for ghc development
17:17:04<EvilTerran>Le-Chuck_ITA, an infinite axiomatisation, though
17:17:27<dcoutts>pejo: course if someone wants to pay for better gtk2hs support on osx, windows, whatever then we'd be happy to discuss it with them :-)
17:17:45<Le-Chuck_ITA>EvilTerran: I see, but: is this the only problem? If so, there are many languages (e.g. the pi-calculus) whose set of axioms is infinite
17:18:14<Le-Chuck_ITA>EvilTerran: I wonder this because I want to understand the true motivation in seeking more advanced models for the syntax, e.g. presheaves
17:18:22<EvilTerran>Le-Chuck_ITA, i think you'll find expressing "all the pairs <t1,t2> whre t1 and t2 are alpha convertible" rigorously is going to be pretty fiddly
17:18:41<Le-Chuck_ITA>EvilTerran: no I would use the "external" non-equational definition for that
17:18:42<pejo>dcoutts, well, I think you have to go to someone else than students to find the funding. :-)
17:19:03<dcoutts>pejo: yes, of course
17:22:40<pe>Hi. In the FFI, if I use a record to marshal to/from a C struct, how do I tell it to free the C struct whenever the record is GCed ?
17:23:55<Lemmih>malosh: Attach a finalizer. ForeignPtr have good support for doing exactly that.
17:24:21<pejo>dcoutts, regarding my question the other day about compiler support for cabal: do you happen to know offhand if it would be much more work to make it work for a different language? (Not using hackage, but the infrastructure in general).
17:24:30<malosh>Lemmih : yes, but I want to be able to use my record like a haskell record, not like a ForeignPtr
17:25:10<dcoutts>pejo: I expect you could copy a lot of code, concepts and organisation but I fear there's a lot that's specific to Haskell and the individual compilers
17:25:39<dcoutts>pejo: it wasn't exactly designed as an ideal abstraction I'm afraid, more to get working quick
17:26:00<Lemmih>malosh: If you don't have any pointers to the struct then why do you care when it is freed?
17:27:22<pejo>dcoutts, would you be interested in abstraction patches, assuming those would somehow magically appear?
17:27:23<malosh>Actually I have a pointer : I call a C function that mallocs a struct and give me a pointer, then I marshal it to a record, and when the record is not referenced anymore, I'd like the pointer to be freed
17:27:41<dcoutts>pejo: absolutely, if I had more time I'd be working on it myself :-)
17:28:06<dcoutts>pejo: if you have spare time then I'd be happy to share my ideas about structural improvements
17:28:31<Lemmih>malosh: Why not free it after you've marshalled the structure?
17:29:58<malosh>cause it is a heavy structure and I don't want to marshal in both directions again and again all the time
17:30:25<malosh>each time it costs a malloc + xx bytes of copy + a free
17:31:42<Lemmih>I'm not following. You want to move from C to Haskell and then back to C?
17:31:57<malosh>yes
17:32:10<malosh>I'm calling a C function on the structure
17:32:33<malosh>my current solution is to include a ForeignPtr in the record
17:32:33<Lemmih>Right, I'm with you so far.
17:33:00<malosh>but it results in double frees
17:33:26<Lemmih>That should be correctable.
18:01:55<roconnor>@seen ski
18:01:55<lambdabot>Last time I saw ski was when I left ##freebsd, ##hrg, ##logic, #arch-haskell, #darcs, #dreamlinux-es, #friendly-coders, #gentoo-haskell, #gentoo-uy, #ghc, #haskell, #haskell-blah, #haskell-books, #
18:01:55<lambdabot>haskell-hac07, #haskell-overflow, #haskell-soc, #haskell.cz, #haskell.de, #haskell.dut, #haskell.es, #haskell.fi, #haskell.fr, #haskell.hr, #haskell.it, #haskell.jp, #haskell.no, #haskell.ru, #
18:01:55<lambdabot>haskell.se, #haskell_ru, #jhc, #jtiger, #perl6, #rosettacode, #scala, #scannedinavian, #unicycling and #xmonad 7m 21d 3h 33m 28s ago, and .
18:02:20<roconnor>@seen ski_
18:02:20<lambdabot>ski_ is in #haskell.se, #haskell.hr, #haskell-in-depth, ##logic and #haskell. I don't know when ski_ last spoke.
18:04:27<jberryman>I think after running 'cabal upgrade' I now have different, newer versions of a lot of the standard libraries installed as user, and GHC is getting confused. not even sure where they are stored. easiest way to fix that?
18:05:12<dcoutts>jberryman: first, upgrade your cabal-install version, the newer version disables 'cabal upgrade' so you can't shoot yourself in the foot again
18:05:41<dcoutts>jberryman: basically you want to unregister the user versions of the core libs and then rebuild as appropriate to fix things
18:06:18<dcoutts>jberryman: use ghc-pkg list to see the versions you've got, ghc-pkg unregister --user $name and ghc-pkg check
18:09:04<jberryman>dcoutts: thanks a lot. I just discovered the user libs installed with cabal are found in ~/.cabal of course
18:28:42<eli>Does anybody know template haskell?
18:31:27<copumpkin>our resident template haskell fan is out right now :/
18:32:06<eli>Who is he?
18:32:42<copumpkin>mmorrow enjoys TH a lot
18:32:57<copumpkin>ChilliX is also gone, and he wrote a lot of the TH code in GHC
18:33:35<eli>OK, hopefully I'll remember the names...
18:34:12<eli>Although I suspect that just a shallow knowledge of the thing is enough for answering my question.
18:34:37<copumpkin>try asking, maybe someone else will know :)
18:35:12<eli>The question is whether TH is hygienic or not.
18:35:50<eli>If it is -- then to what degree (for example, does it work with modules, is there any concept of phases etc),
18:36:20<eli>and if it isn't, then are there common workarounds (eg, some gensym-like tool).
18:36:24<copumpkin>as defined on http://community.schemewiki.org/?scheme-faq-macros ?
18:36:31<copumpkin>(hygiene)
18:37:01<Heffalump>it does have a gensym
18:37:34<eli>copumpkin: Yes, sort of -- having modules makes it one level deeper.
18:37:46<eli>Heffalump: So that means that it is not hygienic?
18:38:03<eli>(it = TH)
18:38:13<Heffalump>well, sort of
18:38:27<Heffalump>it works directly on the underlying AST, with the fresh names
18:38:57<eli>...and the gensym-like tool is a way to get a fresh identifier?
18:39:13<Heffalump>yes (it's one of the things the Q monad gives you)
18:39:43<eli>OK, thanks. -- IIUC, this sounds much like camlp4.
18:39:56<Heffalump>yes, it's much closer to that than to scheme macros
18:40:30<sm>isn't (m a, m b) -> m (a, b) a reasonable hoogle search expression ? I find nothing
18:40:41<Heffalump>I think you'd find it hard to accidentally introduce name capture, btw
18:40:54<Heffalump>though I haven't used it enough recently to have a confident opinion on that
18:41:14<copumpkin>sm: I don't know of any such function... is it like a sequence for tuples? and what'
18:41:15<Heffalump>but most stuff you can do constructs new expressions within Q
18:41:16<ray>@hoggle m a -> m b -> m (a, b)
18:41:17<lambdabot>Prelude zip :: [a] -> [b] -> [(a, b)]
18:41:17<lambdabot>Data.List zip :: [a] -> [b] -> [(a, b)]
18:41:17<lambdabot>Language.Haskell.TH strictType :: Q Strict -> TypeQ -> StrictTypeQ
18:41:23<Heffalump>s/expressions/ASTs/
18:41:40<Heffalump>but it certainly lets you *deliberately* capture names if you want to
18:41:55<Heffalump>@type liftM2 (,)
18:41:57<lambdabot>forall a1 a2 (m :: * -> *). (Monad m) => m a1 -> m a2 -> m (a1, a2)
18:42:10<eli>Heffalump: Thanks again.
18:42:17<Heffalump>eli: also, there's no explicit concept of phases
18:42:18<Cale>Wow, gapminder.org has gotten a lot more interesting to play with since I last looked at it.
18:42:21<ray>:t uncurry $ liftM2 (,)
18:42:22<lambdabot>forall a1 a2 (m :: * -> *). (Monad m) => (m a1, m a2) -> m (a1, a2)
18:42:22<Heffalump>but you could structure your code to use one
18:42:28<ray>tada!
18:42:46<Heffalump>and finally, it doesn't let you generate entirely new modules or even import statements for existing ones (IIRC)
18:43:02<copumpkin>yeah :/
18:43:07<eli>Heffalump: Thanks^3. That's defintely enough information for what I need.
18:43:16<sm>ACTION bookmarks that
18:44:05<Heffalump>another interesting point is that it interacts badly with the dependency analysis done before HM type inference
18:46:02<Heffalump>actually, on the subject of phases, if you want Meta-OCaml style phasing where you can generate code that then generates more code, I don't think you can do that (though since it's not type-safe in the sense of checking that your TH code can't generate bad code before it actually runs it, I don't know why anyone would care about that feature)
18:46:55<copumpkin>eli *poof*ed, but I'll highlight him so he can see the past couple of messages you sent :P
19:05:40<dons>?yow
19:05:40<lambdabot>Now I'm having INSIPID THOUGHTS about the beatiful, round wives of
19:05:40<lambdabot>HOLLYWOOD MOVIE MOGULS encased in PLEXIGLASS CARS and being approached
19:05:40<lambdabot>by SMALL BOYS selling FRUIT ...
19:05:45<dons>yikes
19:05:59<inimino>lol
19:06:43<inimino>what goes on in the mind of the lambdabot, nobody knows
19:06:57<dons>it's a dark mystery
19:07:47<Vq^>thats one of my favourite zippy quotes :)
19:10:44<Peaker>I analyzed roconnor's writer monad implosion of complexity and now I know why it happens -- simply ghc's lack of memoizing of function results (hidden behind the state binds)
19:11:28<Heffalump>actually GHC is memoizing function results in the Writer case
19:11:34<Heffalump>(locally, by doing CSE)
19:11:47<Heffalump>in the State case memoization wouldn't apply, because the inc will have a new input each time
19:14:29<BMeph>This is "kind-of" what I'm trying to do, but I don't see quite how to express it in a "tie-the-knot" fashion: http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=5168#a5169
19:14:47<BMeph>Anyone care to take a crack at it? :)
19:15:34<Heffalump>I don't understand the spec
19:15:59<dons>it's just CSE, isn't it?
19:16:10<Heffalump>dons: which, the implosion of complexity?
19:16:25<dons>the optimization ghc's applying in the writer case
19:16:28<Heffalump>yes
19:16:33<dons>good for GHC.
19:16:35<Heffalump>the reddit thread confirms it
19:16:38<Heffalump>someone looked at the core
19:16:44<dons>yay!
19:17:00<roconnor>> (13983815/13983816)^36000000
19:17:01<lambdabot> 7.619917265611743e-2
19:17:16<roconnor>hmm 7.6%
19:17:24<dons>pure functional programming: don't do the same thing twice and expect different answers.
19:17:53<dons>i guess it is a surprising complexity-changing accident
19:17:56<dons>those are always fun
19:17:56<roconnor>programming insanity is calling the same function twice with the same parameters and expecting different results.
19:18:04<dons>:)
19:18:20<dons>we should have that on stickers to hand out at ICFP
19:18:34<roconnor>it's a nice one
19:19:20<Igloo>Surely you need to hand that out at OOPSLA, not ICFP
19:19:27<dons>i'm thinking of bringing a box of haskell logo badges to give away at ICFP/HW. fun little bit of community branding
19:19:32<dons>Igloo: true
19:20:03<roconnor>> 100-7.6
19:20:04<lambdabot> 92.4
19:20:48<roconnor>where is ICFP this year?
19:20:49<Heffalump>Igloo: well, at the ML/Scheme/Erlang workshops too..
19:20:51<Heffalump>roconnor: Edinburgh
19:20:55<roconnor>ah
19:21:03<Igloo>True
19:21:47<roconnor>ACTION doesn't like it when conferences are held in the US, UK, or North Korea.
19:21:57<BMeph>I think the best way to express it is that Writer is memoizable inherently, whereas the State version is so only due to the way it's being used. Does that make sense?
19:22:29<Heffalump>roconnor: you could try to persuade the Scots to declare independence beforehand
19:23:15<roconnor>What I find interesting is that edwardk's CPS monad stack transformation normally speeds up monadic code, but would destroy the CSE in this case.
19:23:43<roconnor>Heffalump: Do you think they would have more reasonable visa entry requirements?
19:24:21<roconnor>Heffalump: I will pen a letter to my Queen ... who also happens to be your Queen.
19:24:47<dons>roconnor: good plan.
19:24:50<dons>i wish that worked :/
19:24:51<Heffalump>roconnor: errm, what nationality are you?
19:24:56<roconnor>Canadian
19:24:57<Igloo>roconnor: Am I right in thinking you're Canadian?
19:24:59<p_l>roconnor: heh, at least EU laws relieve me of VISA requirements for UK... (but they still managed to get "interesting" work laws)
19:25:03<dons>ACTION is frustrated at the zero-benefits of being a commonwealth citizen
19:25:06<Heffalump>can't you just show up and say "I'm one of the good guys, let me in"?
19:25:06<dons>stupid empire
19:25:10<Heffalump>I'm sure dons did that..
19:25:15<dons>:D
19:25:18<Heffalump>(and the immigration officers actually fell for it, too)
19:25:25<dons>ssssh!
19:25:26<roconnor>Heffalump: ya, but my Iranian born friend cannot.
19:25:31<Igloo>Ah, OK
19:25:33<Heffalump>roconnor: ah, right
19:25:42<dons>yes, it's probably a rubber stamp for .ca , .au . maybe .nz too ;)
19:25:44<p_l>Heffalump: No, the only option in US is to say that you are a terrorist (there's a checkbox on VISA application, afaik) :P
19:25:58<Heffalump>p_l: or that you took part in WWII Nazi atrocities
19:26:05<Heffalump>p_l: what nationality are you, then?
19:26:16<p_l>Heffalump: Polish, studying in UK
19:26:24<Heffalump>I thought Poles had full work rights?
19:26:25<copumpkin>isn't there a checkbox saying you intend to assassinate the president?
19:26:25<roconnor>dons: are you still Austrailian?
19:26:31<dons>I am.
19:26:31<Heffalump>It was Romanians and Bulgarians that didn't get them
19:26:41<copumpkin>in the US
19:26:45<dons>roconnor: dual-citizenship takes a /long/ time.
19:26:51<dons>i've only been away 2 years.
19:27:14<roconnor>dons: in 2001 I got into Zimbabwe without a visa because I was from a commonwealth country.
19:27:17<p_l>Heffalump: That's what they want you to think
19:27:23<roconnor>dons: ... then they were booted out of the commonwealth.
19:27:27<Igloo>dons: Right, you need to stay there long enough that you start refering to it as "here" rather than "away" :-)
19:27:42<Heffalump>p_l: so what did they do?
19:27:43<dons>roconnor: interesting. maybe the real empire nations have some commonwealth anacronisms
19:28:07<roconnor>dons: I think you may find that to be the case.
19:28:18<BMeph>dons: I thought you had to be born a dual citizen, and that naturalization means giving up citizenship with any other states.
19:28:21<dons>Igloo: yeah :) i'm in a mixed state atm. half my words have changed, some of my accent. give it another 3 years and the conversion will be complete.
19:28:59<roconnor>BMeph: you have to tell the US that you gave up your citizenship; however often your country of origin won't recoginize that rejection.
19:29:16<dons>and you /don't/ have to surrender your passport
19:29:27<p_l>Heffalump: "Worker Registration Scheme" - to work over 30 days you have to send your ID/passport to Home Office together with £90 (together with a letter from your employer, *after* you signed contract)
19:29:34<Heffalump>roconnor: the US doesn't actually view that statement as giving up your citizenship either, they just include it in the oath
19:29:50<roconnor>Heffalump: oh.
19:30:03<BMeph>roconnor: Ah, so, a typical US arrangement - if you pretend to obey, they pretend to accept it. ;p
19:30:28<Heffalump>p_l: oh, I see. Does it actually matter in practice, apart from them fleecing you for the 90 quid?
19:30:54<p_l>Heffalump: After 12 months of *constant* (i.e., you can't be without work for more than 30 days), you can apply to get residency. You have also to notify them everytime you change jobs
19:31:10<p_l>Heffalump: Yes, because without WRS, you're illegal worker
19:31:20<wli>Last I checked there are no known cases of anyone successfully repudiating US citizenship.
19:31:35<Heffalump>p_l: sure, but it's just paperwork, they can't stop you working if you jump through their hoops
19:31:51<copumpkin>wli: it isn't hard, but it certainly helps to have another citizenship to back you up
19:32:12<BMeph>dons: So, why not become a Canadian citizen? BC's a day-trip away from PDX, and that "half my words have changed" bit sounds about right for Canadian English... ;)
19:32:33<Heffalump>BMeph: because that's not where he's living..?
19:32:33<p_l>Heffalump: The great idea is that officially it's the employer's obligation, but it's the worker who has to send it. and it's very easy to be not employed for >30days...
19:33:18<Heffalump>p_l: I don't follow. Get job, fill in form, send in your money, and you're done, surely?
19:33:20<p_l>Heffalump: Also, it prohibits you from getting any kind of benefits if you end up without a job in shitty situation
19:33:25<Heffalump>(and send in new form if you change jobs)
19:33:45<Heffalump>p_l: sure, but that's nothing to do with employment rights
19:34:14<Heffalump>The "pay us £90 because we want to keep track of you" is pretty annoying though
19:34:14<p_l>Heffalump: Let's say that it's not so nice in practice...
19:34:28<Heffalump>because of an employer, or because of the Home Office?
19:34:33<p_l>Heffalump: Especially when you're penniless student
19:35:06<p_l>Heffalump: Because of Home Office. The funny thing, they even got UN questioning them... and decided to extend it for another 2~3 years (it was supposed to end this year)
19:37:33<p_l>in practice it's not so nice
19:38:04<Heffalump>it's not even like they can screw up your right to work by not sending the card/certificate, if you applied with in the 30 days
19:38:47<p_l>Heffalump: If they don't send, you can't work
19:39:36<p_l>what is really annoying is that they managed to extend it quite nicely outside of work...
19:39:57<Heffalump>that's not what the Home Office guidanance says: the employer just has to keep a copy of the application form to not get in trouble
19:40:35<p_l>Heffalump: You get a confirmance letter, at least that was it when I was still battling with it
19:40:53<Heffalump>yes, but until that turns up they just have to keep the copy of the application and they're fine
19:40:57<Heffalump>and you are allowed to start working immediately
19:41:27<Heffalump>page 65 of http://www.ukba.homeoffice.gov.uk/sitecontent/documents/employersandsponsors/preventingillegalworking/currentguidanceandcodes/comprehensiveguidancefeb08.pdf?view=Binary
19:41:33<BMeph>So, anyone in the mood to help me with my Haskell-related issue? :)
19:41:37<p_l>ACTION managed to fuckup his job thanks to WRS
19:41:41<Heffalump>BMeph: I still don't understand it :-p
19:41:56<byorgey>BMeph: what's your Haskell-related issue?
19:42:28<RayNbow>@faq Can Haskell distract you from boring work?
19:42:28<lambdabot>The answer is: Yes! Haskell can do that.
19:42:34<RayNbow>damn you, Haskell! :p
19:42:43<Heffalump>ACTION spent all of Friday refactoring a really grungy bit of Haskell
19:42:54<BMeph>This is "kind-of" what I'm trying to do, but I don't see quite how to express it in a "tie-the-knot" fashion: http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=5168#a5170
19:42:55<RayNbow>ACTION looks at the unfinished work that's been piling up :p
19:43:11<roconnor>Heffalump: is it beautiful now?
19:43:16<Heffalump>BMeph: I don't understand the problem though
19:43:22<Heffalump>roconnor: it's better. Still needs some work.
19:43:26<Heffalump>But I did delete quite a lot of stuff.
19:43:48<p_l>Heffalump: What is really annoying is that feeling that they will keep it indefinitely (as well as whatever they passed for Romanians and Bulgarians). Just a feeling of disgruntled student ;-)
19:44:05<Heffalump>p_l: yeah, sounds like a nice little earner for them
19:44:40<p_l>Heffalump: Another thing that annoys me is the hypocrisy behind the law concerning it
19:45:15<roconnor>ACTION looks at his unfinished thesis laying there.
19:45:18<Heffalump>I'm not saying I agree with the situation, just that it doesn't really seem that bad if you're not from Romania or Bulgaria
19:45:27<BMeph>Heffalump: The function is a sort of self-consuming convolution. I'm trying to express it that way, but in a way that GHC will 1) compile; and 2) give an answer. :)
19:45:56<p_l>Heffalump: I'd be much less angry about it if they simply named it "work permit" like it is and admitted that its goal is to make UK job market less interesting...
19:46:08<Heffalump>so you want to flip-flop between invert and invertI?
19:46:16<Heffalump>p_l: but it's a work permit they have to give you
19:46:25<p_l>Heffalump: They can refuse
19:46:28<Heffalump>on what grounds?
19:46:36<p_l>Heffalump: On whatever they fancy
19:46:44<Heffalump>I don't believe that
19:47:03<BMeph>Heffalump: No, I want to find a less "kludgy" way of expressing the functions, that works. (That is, it gives the right answer.)
19:47:52<p_l>Heffalump: In my case my employer terminated my contract waiting for Home Office decision, so the decision ended being "you're not employed so you don't get registered, we'll send you a refund in snail mail with a snail cheque" ;-/
19:48:14<Heffalump>p_l: terminated your contract because you didn't get the card, or for other reasons?
19:48:47<p_l>Heffalump: Because the whole thing was taking ages (I had to first return to Poland for additional documents, cause I couldn't part with my national id)
19:49:19<Heffalump>p_l: but your employer could have just kept the application and kept employing you, if it was sent in time (and yes, having to give them your documents sucks)
19:49:38<Heffalump>BMeph: I still don't understand what the functions are actually doing
19:49:40<BMeph>RayNbow: I'd be cautious around Haskell - it seems especially distracting to Dutch programmers. ;)
19:49:43<gwern>'The original Copycat was written in Common Lisp and relies on now-outdated graphics libraries; however, a modern Java port exists.' <-- ouch
19:49:59<p_l>Heffalump: The funny thing is, that getting a work permit in Norway would take me... <1day
19:50:01<b_jonas>BMeph: wtf?
19:50:29<BMeph>gwern: ROFL!
19:50:50<p_l>gwern: I'd take the Common Lisp version :D
19:52:55<BMeph>Heffalump: Let's see... let's say bs = invert as. Then bs!!0 = as!!0, and bs!!i = as!!i + sum (zipWith (*) as (reverse (take i bs))).
19:53:09<BMeph>(If that's any clearer than mud... ;p
19:53:12<BMeph>)
19:54:10<Heffalump>ok, I sort of see
19:54:12<RayNbow>BMeph: if only the project I have to work on was written in Haskell... I would probably be less distracted :p
19:54:33<BMeph>Heffalump: Where the sum (zipWith...) part is the convolution.
19:55:07<BMeph>RayNbow: Yes, that's how it starts... ;)
19:55:16<Heffalump>so does the code you pasted work?
19:57:36<BMeph>Heffalump: I doubt it. I tried a version where I didn't have the as-pattern and such, but that one wouldn't give an answer. I'm trying to get this version to compile now. :)
19:59:18<dons>shapr: coming to Hac Phi?
20:00:35<byorgey>he better be =)
20:00:49<byorgey>but he doesn't seem to be on IRC atm
20:01:09<Philippa>p_l: public sector admin's appallingly slow in the UK generally :-( And they do lots of things they "shouldn't" because it takes a lot of know-how and energy to fight it and the individuals involved aren't trained well enough to not do it
20:01:33<dons>byorgey: thinking i might cash in some frequent flyer miles if you hold it in july
20:01:45<byorgey>dons: that would be awesome!
20:01:52<byorgey>dons: it's definitly going to be in July
20:01:58<Heffalump>it depends on whether you actually need them to do something or not; since in this case you just need to have put the application in, it shouldn't really matter if they screw up or not
20:02:02<dons>sweet. ok. i'll be there.
20:02:04<byorgey>not a single person has expressed a preference for June =)
20:02:10<BMeph>Does anyone know zipWith's strictness characteristics?
20:02:20<dons>byorgey: i can prob. help with organization support too, passing on ideas from the euro hacs
20:02:38<Heffalump>BMeph: they shouldn't be relevant since your lists are infinite, right?
20:02:39<sbahra>yo whats up dawg
20:02:49<Heffalump>oh, but it might not see that immediately, hmm
20:02:54<byorgey>dons: that would be great, actually, we were planning on asking for some ideas/advice from people who have organized one before
20:02:59<dons>great.
20:03:03<copumpkin>sbahra: go to hac phi!
20:03:14<sbahra>I need to work on Haskell for that.
20:03:23<dons>you can ping the 'steering comittee' of euro hac. dcoutts, Heffalump, kosmikus, me (bringert and igloo also have a lot of experience)
20:03:31<sbahra>I'm finally going to get back to my web server, now that I have dedicated server that supports GHC.
20:03:38<Cale>ACTION writes a long reply to http://www.reddit.com/r/compsci/comments/8mpma/ask_compsci_where_are_the_special_numbers/c09rs2a
20:03:54<yaxu1>hoo, i'm top on haskell reddit, thanks dons :)
20:03:54<byorgey>dons: cool, thanks, will do so soon!
20:03:59<b_jonas>we could have a separate type for definitely infinite lists that only has one constructor
20:04:12<dons>byorgey: and feel free to grab the "branding" on the other hac sites on the wiki
20:04:15<BMeph>Heffalump: Not necessarily. They can be infinite, and I tried to write the functions in a way that could acomodate it, but they don't have to be.
20:04:24<dons>the logo, links to previous hacs, structure for registration et al
20:04:35<b_jonas>@src zipWith
20:04:35<lambdabot>zipWith f (a:as) (b:bs) = f a b : zipWith f as bs
20:04:35<lambdabot>zipWith _ _ _ = []
20:04:36<byorgey>right, ok
20:04:38<jberryman>b_jonas: that is defined in the 'streams' lib I believe
20:04:44<dons>its a grassroots thing, so anyone can use the resources
20:04:50<Heffalump>ok, so it's strict in both arguments
20:04:56<b_jonas>streams... /me looks
20:04:57<chrisdone>does anyone have a link about how an infix-left ($) could be useful?
20:05:00<byorgey>yep
20:05:04<BMeph>*accommodate
20:05:18<b_jonas>"hinze-streams library: Streams and Unique Fixed Points" -- is this it?
20:05:24<copumpkin>> map fst $ zip [0..] (repeat undefined)
20:05:26<lambdabot> [0,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,...
20:05:36<Cale>chrisdone: It would be much more useful than the current one... it doesn't take a page to explain :)
20:05:51<aconbere>anyone spent any time in hopengl?
20:06:07<Cale>chrisdone: Consider trying to remove the parens from f (g x y) (h y z) (k x z)
20:06:09<BMeph>ACTION is going with Cale on that.
20:06:14<sbahra>copumpkin, I also need to get on the FreeBSD haskell project, as soon as possible.
20:06:24<jberryman>b_jonas: sorry, http://hackage.haskell.org/packages/archive/Stream/0.3.1/doc/html/Data-Stream.html#v%3A%3C%3A%3E
20:06:28<sbahra>Creating ports becomes boring, quickly.
20:06:48<b_jonas>jberryman: thanks
20:06:50<BMeph>ACTION almost asked Cale if that should've been (k z x)
20:06:55<Cale>heh
20:07:10<Cale>chrisdone: If $ were left associative, we could write f $ g x y $ h y z $ k x z
20:07:25<Berengal>Man, I'm having the dumb today. I can't even get a simple fixed point function right...
20:07:46<Cale>Whereas currently, that means the same thing as f . g x y . h y z $ k x z
20:08:07<Heffalump>I think Cale just wants to help the next IOHCC along.
20:08:10<Cale>which is f (g x y (h y z (k x z)))
20:08:50<Cale>Heffalump: Sorry about the one-letter variable names, I just can't be bothered to come up with real examples :)
20:09:07<Heffalump>I meant with the lack of brackets too
20:09:21<Cale>brb
20:09:41<lament>so i have a program, it like, does some actual work
20:09:49<Cale>Heffalump: I can imagine it would often help with clarity.
20:09:57<Heffalump>lament: it can't be written in Haskell then </jdh30>
20:10:14<chrisdone>cale: is `f (g x y) (h y z) (k x z)' the same as `f (g x y (h y z (k x z)))'?
20:10:14<b_jonas>oh, I just wrote a program that's really ugly because almost all of its variables are one letter long
20:10:15<lament>but on profiling, this function is 7% of the time spent:
20:10:16<lament>boardInProgress (MIP board _ _ _) = board
20:10:22<lament>??? come on Haskell
20:10:44<lament>this is after i inlined it, before it was 10%
20:10:53<Heffalump>lament: the profiler might be confused
20:11:06<Heffalump>is MIP strict in board?
20:11:11<Heffalump>and if not can it be?
20:11:18<b_jonas>this one: http://erxz.com/pb/17772
20:11:28<lament>i haven't tried that
20:11:32<lament>ACTION does
20:12:27<b_jonas>I mean, I always use lots of short variable names in my code but this is crazy even compared to my usual style
20:12:36<aconbere>oooo
20:12:40<lament>Heffalump: you're right, it's 4% now
20:12:43<aconbere>reshape s@(Size w h) = do
20:12:47<aconbere>does that @ syntax
20:12:53<aconbere>mean bind the input to s
20:12:54<lament>Heffalump: this means that the program isn't any faster, the time is just reported elsewhere?
20:13:00<EvilTerran>> let x@(y,z) = (1,2) in (x,y,z) -- aconbere
20:13:01<lambdabot> ((1,2),1,2)
20:13:01<aconbere>and pattern match the data structure?
20:13:07<Twey>Yes.
20:13:10<aconbere>awesome
20:13:10<Heffalump>lament: well, you've just removed some closures that aren't necessary, so it might be a bit faster
20:13:13<EvilTerran>(i think that's a yes)
20:13:16<aconbere>I was wonering how to do that the other day
20:13:17<aconbere>:)
20:13:24<Heffalump>4% is still quite a lot, how many times is the function entered?
20:13:30<Heffalump>and how much absolute time does it take
20:13:40<EvilTerran>aconbere, intuitively enough, they're called "at-patterns"
20:13:43<b_jonas>I wish mathematicians used multi-letter variables because when I wrote my thesis I had to do lots of shuffling around to not have conflicting variable names
20:13:48<aconbere>hahaha
20:14:10<Twey>b_jonas: The general Haskell style is ‘if you need more than one letter to make it clear, your function is too complicated’ ;)
20:14:20<lament>Heffalump: about 7 million, about tenth of a second
20:14:22<aconbere>b_jonas: we use not's a lot, (x0, y0, z0 etc)
20:14:30<chrisdone>Cale: I've got, for example: lift $ forkIO $ (evalStateT . irc_Monad) handler undefined. the problem with ($) occurs when one needs to provide more than one argument, you have to revert back to parentheses
20:14:35<aconbere>there's a pretty strong precident for variable suffixes
20:14:57<b_jonas>Twey: sure, the gnu coding style recommends that a function should usually be at most two pages long (which means 50 lines) and have at most 7 local variables, and I fully support that
20:15:01<b_jonas>lots of small functions
20:15:08<EvilTerran>aconbere, it sounds like you might be at the right level haskell-wise to find reading the Report insightful
20:15:16<EvilTerran>aconbere, in a "oh hey, i didn't know i could do that!" sort of way
20:15:26<aconbere>"the Report"?
20:15:28<aconbere>:)
20:15:28<Heffalump>lament: so it's spending about 14ns on each one?
20:15:33<b_jonas>that doesn't really work in a mathematical paper though, because of the language it uses
20:15:34<Twey>b_jonas: 50LoC is wayyyy too big for a function.
20:15:36<EvilTerran>@where report
20:15:36<lambdabot>http://www.haskell.org/onlinereport/
20:15:42<b_jonas>Twey: it's a maximum
20:15:55<b_jonas>Twey: and it's for C, haskell is more vertically concise
20:15:57<Twey>It's an over-large maximum
20:16:02<EvilTerran>aconbere, ^ it's the Haskell standard. it's remarkably short.
20:16:04<Twey>For any decent language
20:16:09<b_jonas>no, not for C
20:16:18<chrisdone>b_jonas: 50 lines and how many columns?
20:16:18<aconbere>awesom :)
20:16:34<b_jonas>chrisdone: doesn't matter, I code the same no matter how many columns
20:16:41<b_jonas>(I use 100 columns on screen)
20:16:49<chrisdone>reading horizontally is a pain ..
20:16:59<lament>Heffalump: I made all the other elements of the MIP constructor strict and now it's 2% :)
20:17:02<EvilTerran>ACTION sticks to 80 columns
20:17:10<chrisdone>80 is good
20:17:21<Heffalump>lament: ok, but if your numbers and my calculations are correct, I don't think you actually have anything to complain about.
20:17:33<idnar>I usually wrap at 80 columns, but my screen is a lot wider than that :P
20:17:34<Heffalump>Even something simple needs a few CPU cycles!
20:17:35<Cale>chrisdone: no, it's not the same
20:17:39<lament>Heffalump: yeah, i guess not. It does seem like it gets called too often, too.
20:17:40<Cale>(I had to get up for a moment)
20:17:48<idnar>it lets me put code side by side easily, though, and longer lines are a lot harder to read
20:18:19<BMeph>I use 80 cols, but only because printing it out on paper looks better. :)
20:18:28<EvilTerran>idnar, if my screen was wide enough for 160+ columns, i'd do the same
20:18:33<tetha>I am not sure if I want to understand a 200-column-wide line
20:18:40<EvilTerran>1024x768 D:
20:18:42<aconbere>EvilTerran: I really don't know where I am in the haskell sense. It's been a fun experience though. I wrote some very straight forward code that parsed and manipulated some large simple files. And recently went to use it to play with openGL and that's caused some leaps in understanding.
20:19:05<aconbere>but I'm down to read the standard
20:19:05<Cale>chrisdone: I normally recommend against using multiple $'s in a chain with the current associativity, since all but the last can always be replaced with (.)
20:19:11<aconbere>I suspect there might be some gems in there
20:19:15<idnar>EvilTerran: I've got 1680x1050 currently, but my next monitor will probably be 1920x1080
20:19:18<b_jonas>chrisdone, EvilTerran: it doesn't really matter, how I wrap code isn't really changed by how many columns I view the code with
20:19:21<aconbere>:)
20:19:30<idnar>EvilTerran: I need more monitors and a bigger desk :P
20:19:39<Cale>chrisdone: (.) has nicer properties as an operator (it is associative, for one), and so it makes things easier to manipulate when you use it.
20:20:01<lament>looks like there's no choice, i will have to optimize my algorithm :( :( :(
20:20:33<Cale>Heffalump: I envision an idiom for cases where you have a function with several arguments that are fairly complex, where you vertically align the $'s for each parameter.
20:20:40<hamishmack>paper_cc: You need to make sure gtksourceview2 development packages are installed before you run gtk2hs ./configure
20:21:21<b_jonas>Cale: if you put each parameter in a separate line, then wouldn't you use parenthesis anyway?
20:21:40<Cale>b_jonas: You wouldn't have to if $ had the opposite associativity.
20:21:40<Heffalump>ACTION doesn't care about the $ argument any more since it's clearly never going to happen
20:21:40<ray>only if you're unduly attached to lisp
20:22:18<b_jonas>Cale: I mean, I'm not a big fan of dollar signs, but maybe they can help if you're on one line and it's difficult to match parens by just looking, but if they're on separate lines then $ can't be cleaner
20:22:20<Cale>I think we should just change it and break everything, and then fix those cases when things fail to compile. It would probably only take a couple weeks of adjustment.
20:22:30<b_jonas>I usually just use parenthesis anyway
20:22:34<ray>infixl $ makes more sense anyway since regular function application is already left-associative
20:22:51<Cale>b_jonas: I think separate lines are exactly the case where removing parens is better.
20:23:05<b_jonas>Cale: why?
20:23:12<Cale>b_jonas: matching becomes more difficult if you have to look a few lines down to find the closing paren
20:23:19<ray>cale's idiom is just a useful side-effect of making things more consistent
20:23:26<paper_cc>harmishmack: I know. The problem was that gtksourceview-2.2 (from Hardy repositories) is too old. Leksah does build with the latest gtksourceview-2.6 (with Gtk2Hs rebuilt to use it)
20:23:38<b_jonas>Cale: but if every line is a separate argument, then the matching paren is not a few lines down but at the end of that line
20:23:42<b_jonas>so it's basically invisible to you
20:23:55<Cale>b_jonas: What if some of the arguments are multiple lines in themselves?
20:23:58<Heffalump>(one reason I don't like left-associative $ is that it breaks refactorings that currently work on the right-hand side of a $)
20:24:01<Cale>Here, I'll construct an example...
20:24:18<hamishmack>paper_cc: cool
20:24:22<b_jonas>Cale: they're indented
20:24:33<Cale>Heffalump: Using multiple $'s in the first place breaks more refactorings.
20:24:43<Heffalump>I don't care about that though.
20:24:52<b_jonas>well I must admit I'm not always consistent in my punctuation style either
20:24:55<Heffalump>I can change $ into . as a separate pass.
20:25:10<b_jonas>I try but sometimes I'm not sure what the best is
20:25:24<Heffalump>But when I have foo $ bar, it's more useful to me to be able to change bar into baz $ blat than it is to be able to change foo.
20:25:27<Cale>I just always use composition where it's appropriate to use it in the first place.
20:25:40<hamishmack>thoughtpolice: Have you tried using macports to install gtk and gtk2hs?
20:26:01<shapr>dons: I think it's likely I will be at Hac phi, yes.
20:26:03<Heffalump>no doubt if $ had been left-associative from the start I'd be used to it and would think differently, but it's not
20:26:08<Cale>I would change it to foo . baz $ blat
20:26:22<mbr>hi! Can anyone help with gtk2hs textView? Can I get a String out of textViewBuffer?
20:26:25<Heffalump>I don't want to touch anything outside bar.
20:26:33<Heffalump>the refactoring is bar = baz $ blat
20:30:31<roconnor>@remember sheep1e The fourth character presumably represents both "runtime" and "Writer monad", a kind of Haskell pun in Japanese.
20:30:31<lambdabot>Okay.
20:30:59<Cale>If we define an effective subexpression of a string of Haskell code as a well-typed contiguous substring, then the number of effective subexpressions of f_1 . f_2 . ... . f_n $ x grows quadratically with n, while the number of effective subexpressions of f_1 $ f_2 $ ... $ f_n $ x grows only linearly with n.
20:31:42<Cale>This is, I think, why I really prefer the former. Not just for the convenience in editing, but in the change in thinking that it also brings about.
20:32:05<Heffalump>ACTION has been trying that style since his last argument with Cale on the subject and agrees it's nicer
20:32:21<EvilTerran>Cale, i'd require more than "well typed", but i see where you're coming from
20:32:36<Heffalump>EvilTerran: well typed and meaningful
20:33:11<EvilTerran>"meaningful", eh. ooh, you're on shakey philosophical ground there :P
20:33:13<byorgey>well typed, and 'able to be anti-substituted for'?
20:33:28<Cale>yeah
20:33:32<Heffalump>EvilTerran: :-p
20:33:37<byorgey>i.e. you can rip it out, define a new variable to be the subexpression and replace the subexpression with the variable
20:33:52<Cale>That's a good refinement of it :)
20:34:07<EvilTerran>i guess the intuitive definition would be that you can wrap it in parens without changing the meaning
20:34:07<Heffalump>I find it mostly useful when I change some types and can just put a map or something around such a sub-expression.
20:34:30<Cale>The thing is, even if you don't make such substitutions in the code, you can think about the code as being broken down in all those different ways.
20:34:57<chrisdone>anyone see a way to remove the parens? lift . forkIO $ (evalStateT . irc_Monad) handler undefined
20:35:59<EvilTerran>ACTION would probably write lift . forkIO $ evalStateT (irc_Monad handler) undefined
20:36:16<chrisdone>ACTION cries
20:36:20<copumpkin>@src IO
20:36:20<lambdabot>newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))
20:36:42<b_jonas>chrisdone: just remove it
20:36:47<roconnor>let x = irc_Monad handler in lift . forkIO $ evalStateT x undefined
20:36:52<b_jonas>chrisdone: (.) has a higher precedence than ($)
20:37:17<hamishmack>mbr: textBufferGetBounds and textBufferGetText
20:37:26<roconnor>b_jonas: but not higher than whitespace.
20:37:39<chrisdone>b_jonas: but then function application creeps in
20:38:15<b_jonas>chrisdone: oh, sorryu
20:38:19<roconnor>irc_Monad handler in lift . forkIO $ flip evalStateT undefined $ irc_Monad handler
20:38:22<roconnor>er
20:38:26<b_jonas>chrisdone: didn't notice it continused on the next screen line
20:38:26<roconnor>lift . forkIO $ flip evalStateT undefined $ irc_Monad handler
20:38:35<b_jonas>sorry
20:38:57<roconnor>actually all the parameters for eval, exec stuff in the mtl are the wrong way around.
20:39:05<roconnor>yet another reason to stop using the mtl.
20:39:06<chrisdone>yeah I agree
20:39:20<chrisdone>the number of times I've used flip run*
20:39:23<Heffalump><aol>
20:39:27<Heffalump>but just make some wrappers!
20:39:48<b_jonas>well I now know how to write those monads myself so in theory I can write my monads instead of using mtls
20:39:57<roconnor>or use monadLib
20:40:04<b_jonas>but then I won't make less mistakes than mtl did
20:40:19<roconnor>which fixes like 80% of the problems with the mtl, 99% as measured by seriousness.
20:40:36<b_jonas>monadLib? let me look at that
20:40:52<chrisdone>lambdabot: tell me information about monadlib using hackage and clever haskell magic
20:41:00<roconnor>@hackage monadLib
20:41:00<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/monadLib
20:41:10<chrisdone>ACTION beams
20:41:34<shapr>Ok so, what existing Haskell applications would be good to tune for 4 and 8 cores?
20:41:52<EvilTerran>... darcs?
20:41:56<mbr>@hamishmack thanks, I have found them, but how do I use them? its type is (TextBufferClass self) => self -> TextIter -> TextIter -> Bool -> IO String and I know nothing about TextIters
20:41:56<lambdabot>Unknown command, try @list
20:42:00<Heffalump>the darcs test suite
20:42:20<copumpkin>shapr: GHC ;)
20:42:43<mbr>hamishmack: thanks, I have found them, but how do I use them? its type is (TextBufferClass self) => self -> TextIter -> TextIter -> Bool -> IO String and I know nothing about TextIters
20:42:48<shapr>copumpkin: GHC sounds like a longer term goal, I want to start small :-)
20:42:52<copumpkin>:)
20:43:04<shapr>Heffalump: That's a good idea, I'll look into that. Any other suggestions?
20:46:15<timmaxw>hello, i'm getting an error installing the "mtl" package - can anybody help me?
20:46:35<b_jonas>timmaxw: how are you trying to install it and what error?
20:46:41<EvilTerran>... that should come with ghc
20:46:48<b_jonas>in the extralibs
20:46:53<timmaxw>i downloaded "mtl" from http://hackage.haskell.org/packages/archive/mtl/1.1.0.2/mtl-1.1.0.2.tar.gz
20:46:56<timmaxw>built Setup.hs
20:47:03<timmaxw>but when I run "sudo ./Setup install"
20:47:04<timmaxw>i get:
20:47:08<timmaxw>Installing library in /usr/local/lib/mtl-1.1.0.2/ghc-6.10.3
20:47:08<timmaxw>Setup: Error: Could not find module: Control.Monad.Cont with any suffix:
20:47:08<timmaxw>["hi"]
20:47:25<b_jonas>timmaxw: did you built it first?
20:47:48<timmaxw>yes, i did run ./Setup build
20:48:08<BMeph>Did you configure it before you built it? ;p
20:48:13<timmaxw>of course
20:48:37<timmaxw>EvilTerran: how would i figure out if it's already installed and Haskell just isn't finding it?
20:48:40<litb>does haskell have much to do with type theory?
20:48:57<BMeph>timmaxw: Dir you try "sudo make me a sandwich" when you got hungry? ;)
20:49:04<BMeph>*Did
20:49:11<timmaxw>no, i got up and ate lunch :D
20:49:27<Heffalump>shapr: someone is already working on something to do with that, btw, but someone else complained it actually went slower, which was why I mentioned it - check the darcs-users list
20:49:28<EvilTerran>litb, well, it's got a hindly-milner based type system, so in that way type theory is relevant
20:49:31<BMeph>timmaxw: A-HA! There's the bug! ;p
20:49:39<litb>EvilTerran: oh
20:49:59<EvilTerran>litb, and writing typecheckers/inferrers is rather nicer, IMO, in haskell than in imperative languages
20:50:02<litb>will understanding type theory help doing CS?
20:50:30<EvilTerran>(having tried and failed at both, i got a lot further in haskell than in C :P)
20:50:48<litb>oh ok
20:51:55<EvilTerran>well, i find knowing a bit of type theory makes me think more rigorously whenever i'm tinkering with a programming language and/or algebra
20:52:38<EvilTerran>even if that language lacks a static type system, i often find it helps to think about what type something would be "if only this had a type system"
20:53:56<mreh>what's the scalar equiv of velocity?
20:54:00<b_jonas>mreh: speed
20:54:03<zakwilson>The documentation for WxHaskell suggests that Wx apps on Mac OS link readline. Does that mean that all WxHaskell apps on Mac OS must be GPL?
20:54:10<mreh>is there another word
20:54:16<mreh>non momentum
20:54:19<mreh>not*
20:54:22<EvilTerran>mreh, er, speed?
20:54:44<mreh>is rotational speed logical?
20:55:10<mreh>in radians per second
20:56:17<dec142>angular velocity
20:57:23<mreh>bingo
20:57:25<dec142>http://en.wikipedia.org/wiki/Angular_velocity
20:57:26<dec142>np
20:57:39<ray>that's not a scalar
20:57:40<roconnor>mmm, Lie algebras
20:58:07<dec142>http://en.wikipedia.org/wiki/Angular_speed
20:58:21<mreh>ray: nuh uh
20:58:23<roconnor>ray, in 2D it is.
20:58:38<ray>we're not in 2D, are we?
20:58:47<mreh>i am
20:58:50<dec142>ooo
20:58:52<ray>you're lucky
20:59:02<ray>for one, you can't have a digestive system
20:59:07<mreh>everyone can see though my clothes
20:59:13<ray>those things are so ridiculous
20:59:22<mreh>and my penis is infinetly thin
20:59:25<roconnor>ray, maybe you are right. It is proabably a pseduoscalar.
20:59:51<roconnor>ya it is.
21:00:02<roconnor>mreh: be sure to use a different type for pseduoscalars. :)
21:00:12<mreh>ray: I remember someone arguing life could exist in two dimentions
21:00:16<mreh>dimension
21:00:21<ray>was it stephen wolfram?
21:00:58<mreh>roconnor: infinitely thing asteroids in space dont need to bother with that malarkey
21:01:05<mreh>ray: no, someone on a forum
21:01:22<mreh>does wolfram think otherwise too
21:01:34<ray>well, wolfram's obsessed with cellular automata, many of which are 2D
21:01:36<roconnor>mreh: fine. Don't come crying to #haskell when a parity inversion comes along and breaks all your code.
21:01:52<ray>and i mean both 1D+time and 2D+time
21:01:54<lament>the first question is whether reasonable chemistry could exist in 2D
21:03:16<mreh>cellular automata...
21:03:24<b_jonas>lament: I think chemistry would be no problem, physics would be though
21:03:28<tetha>now you made me think about cellular automatas in spacetime 6
21:03:28<b_jonas>in the macro size
21:03:49<lament>b_jonas: why? same laws
21:03:54<jberryman>what library should I use to generate a random stream from elements chosen from a list?
21:04:00<lament>b_jonas: er, same laws for gravity
21:04:15<lament>b_jonas: electromagnetism is tricky
21:04:21<mreh>eletric force
21:04:21<mreh>yeah
21:04:27<mreh>that's all 3 dimensional
21:04:38<mreh>maxwell would be rotating in his grave
21:04:47<lament>but he can't, because it's 2D!
21:04:50<mreh>at a stead frequency of 40Hz
21:04:54<mreh>steady
21:04:57<b_jonas>yup, he couldn't be rotating
21:05:00<b_jonas>that's the main problem
21:05:06<b_jonas>people couldn't eat
21:05:15<b_jonas>you couldn't embed most graphs to 3d
21:05:17<lament>amoebas eat
21:05:25<ray>amoebas are 3D
21:05:28<b_jonas>whereas you can embed any graph to 3d
21:05:31<b_jonas>you can't have crossings
21:05:34<mreh>but they would fall apart at the boundary of their digestive system
21:05:37<b_jonas>that limits circuits a lot
21:05:40<lament>i don't see the problem with eating
21:05:45<b_jonas>of course, there might be a way to have crossings in 2d
21:05:52<lament>you surround an object and then digest it, there's no crossing
21:05:55<b_jonas>some cellular automata get away with it
21:06:02<timmaxw>you could use other forces to hold an amoeba together... make one half positively charged, other half negatively charged
21:06:22<mreh>this is goooood haskell
21:06:28<b_jonas>there's this proof of sokoban being computationally complete in some sense
21:06:34<b_jonas>it involves soko circuits
21:06:42<b_jonas>it requires a bridge (crossing)
21:06:47<b_jonas>it is possible but quite complicated
21:06:51<ray>just be careful not to push anything into a corner while you're computing
21:06:53<b_jonas>I can't imagine it working in reality
21:07:02<b_jonas>but then earth's life is a wonder too so who knows
21:07:40<tetha>all those turing complete puzzles turn into a horrible nightmare if they are supposed to compute 1+1. way worse than any movie I ever saw
21:08:14<aconbere>ahhh the age old IO Monad problem
21:08:15<aconbere>ACTION sighs
21:08:24<b_jonas>tetha: maybe you get good advice about which movies to watch
21:08:25<aconbere>so I've got some Random number generation I want to do
21:08:31<aconbere>as far as I can tell
21:08:36<aconbere>the right way to do this is RandomIO
21:08:39<ray>haskell complete
21:08:58<aconbere>this screws with a bunch of otherwise non-IO functions
21:10:04<roconnor>use MonadRandom
21:10:42<roconnor>b_jonas: I read an article detailing an imagined species living in a 2-D world.
21:10:51<roconnor>It was probably over 10 years ago, and I can't find it now.
21:10:54<roconnor>it was really cool.
21:10:56<tetha>b_jonas: I am not too sure about that :)
21:11:00<b_jonas>roconnor: there is even some fiction about it
21:11:05<b_jonas>I mean serious science fiction
21:11:36<aconbere>flatland?
21:11:40<aconbere>what?
21:11:41<aconbere>:)
21:11:52<ray>flatland doesn't do biology
21:11:56<aconbere>ahh
21:11:58<b_jonas>aconbere: something like that and more
21:12:04<b_jonas>there are multiple of them
21:12:13<b_jonas>I haven't read any so I can't really know which one is good
21:12:29<lament>flatland has some seriously different physics (no gravity)
21:12:41<lament>flatland is like view "from above"
21:12:55<lament>a more reasonable 2d environment would have gravity so it would be like a view "from the side"
21:13:20<b_jonas>yep, there's one like that too
21:13:36<b_jonas>why's the one with gravity more reasonable though?
21:13:41<roconnor>apparently orbits in 2d are stable, just not elipical.
21:13:45<jberryman>are there any packages that provide useful functions for random data, beyond the bare essentials? for example, do any libraries provide a function to pick a random element from a list?
21:14:03<dons>Lemmih: read the 'types are calling conventions' paper?
21:14:07<jberryman>I know quickcheck has some nice functions like that internally
21:14:09<dons>would be cool to do a comparison with LHC
21:14:32<lament>b_jonas: hard to imagine enough organization for life to come about in a world with no gravity
21:14:38<lament>b_jonas: what's holding all these things together?
21:14:48<b_jonas>lament: some atomic forces stuff?
21:15:00<b_jonas>lament: like, matter is dense enough in the whole world
21:15:04<roconnor>jberryman: http://hackage.haskell.org/packages/archive/MonadRandom/0.1.3/doc/html/Control-Monad-Random.html#v%3AfromList
21:15:08<b_jonas>so no need to hold things together in large scale
21:15:09<lament>i suppose they have friction of the ether
21:15:21<lament>to allow movement
21:15:31<b_jonas>of the ether? no, there's air or something
21:15:41<b_jonas>why couldn't they just swim in it?
21:15:44<lament>why is the air not flying away?
21:15:50<lament>the entire universe contains air?
21:15:55<b_jonas>lament: yup
21:16:06<tetha>the problem about gravity or no gravity is that you can raise implications at most
21:16:38<b_jonas>lament: either the universe is of finite volume or just equally full of air everywhere and the boundary conditions in infinite is such that air doesn't escape to infinity
21:16:41<tetha>if there is some force that forces everything apart, then there must be something to hold everything together, or all thinking things (if they exist) must be atomic
21:17:14<b_jonas>tetha: but isn't it enough to have that on small scale, like in atomic sizes?
21:17:18<RayNbow>@hoogle regexp
21:17:19<lambdabot>package regexpr
21:17:26<b_jonas>tetha: like the electromagnetics that hold us together
21:18:00<tetha>b_jonas: I am not entirely sure, but I think, the electromagnetism could work as some sort of gravity
21:18:15<b_jonas>maybe
21:18:16<b_jonas>dunno
21:18:19<lament>well
21:18:28<lament>the question is how do they manage without planets or stars
21:18:32<tetha>b_jonas: because basically, the em-force will work in a certain radius around an atom, and thus, it will pull different atoms (even of different moleculs together)
21:18:35<lament>they're just floating in "space"
21:18:46<b_jonas>lament: why would they need stars or planets?
21:18:57<lament>i suppose planets are not essential. Where do they get energy from?
21:18:58<b_jonas>they're floating in, say, water with planktons and minerals, not just space
21:19:33<b_jonas>but they might even have stars even if not planets
21:19:45<lament>stars are certainly held together by gravity
21:19:49<b_jonas>yeah, here
21:20:08<b_jonas>but why couldn't they be neutron stars held together by nuclear or electromagnetic forces?
21:20:16<b_jonas>though there's the question how those are created, yeah
21:20:19<b_jonas>that doesn't work
21:20:28<b_jonas>sorry
21:20:41<b_jonas>dunno then
21:20:53<wli>AIUI there are no credible theories unifying gravity with any other major forces.
21:20:54<lament>maybe they have atomic stars, or just energy spontaneously appearing in the ether.
21:20:58<b_jonas>yeah, good point about the stars
21:21:05<b_jonas>lament: that doesn't work
21:21:11<lament>you don't need stars when you have hydrothermal vents.
21:21:27<b_jonas>lament: gravity is what makes that energy concentrate in one point so you can have cooler and warmer places
21:21:37<b_jonas>you can't have thermodynamics as we know it without that
21:21:52<lament>no...
21:21:53<tetha>I like the idea of very large, lazy entities just sitting around, waiting for energy to appear in them
21:22:02<lament>thermodynamics doesn't deal with gravity much
21:22:13<b_jonas>lament: but gravity made us the stars
21:22:27<b_jonas>lament: that's what caused there to be stars and cool empty space with planets here
21:22:36<lament>right, so they must have a mechanism other than stars that produces energy
21:22:37<b_jonas>we couldn't live without those
21:22:47<b_jonas>lament: right, but what concentrates that to one place?
21:22:50<lament>since the air in which they swim is homogenous across the universe, perhaps so is the energy
21:23:06<lament>and uhh
21:23:07<b_jonas>lament: just having the energy or heat everywhere is not enough I think
21:23:26<b_jonas>so what if they have gravity and stars but no planets?
21:23:38<lament>they fall onto a star and burn?
21:23:53<lament>if they have gravity, they will certainly have planets
21:23:56<b_jonas>maybe there's some wind away from the star which the star itself generates so they don't fall in it? and they're orbitting it anyway so there's a turbulence?
21:23:58<lament>all this "air" will accumulate around stars
21:24:02<Apocalisp>What evidence is there that gravity produced the stars?
21:24:06<Apocalisp>It's conjecture.
21:24:14<b_jonas>lament: right, but not planets they live on
21:24:29<lament>Apocalisp: it's not really disputed by anybody.
21:24:36<Apocalisp>It's a popular conjecture.
21:24:40<lament>Apocalisp: there's a lot of evidence of stars in various stages of formation.
21:24:43<b_jonas>Apocalisp: well that's what holds them together at least
21:24:43<Absolute0>How do I create an instance of Eq using my own type definition, copying the code from the Prelude doesn't seem to do the trick: http://rafb.net/p/I88pwp22.html
21:24:46<tetha>just wondering, how do you define gravity, if the universe is an infinite twodimensional tape of random bits with nonterminating turing heads moving around on it?
21:24:53<b_jonas>Apocalisp: it doesn't really matter if that's what formed them in first place
21:24:56<lament>Apocalisp: and we have pretty good theories that explain all that evidence.
21:25:08<b_jonas>Apocalisp: they'd fall apart without gravity
21:25:11<lament>Apocalisp: this is not something that's disputed at all.
21:25:38<lament>you'd be disputing gravity to dispute that.
21:25:57<Absolute0>tetha: by using vectors of speed or pull with the given gravity velocity.
21:26:02<Apocalisp>Well, it's a bit vacuous since we don't know what gravity is.
21:26:26<b_jonas>Apocalisp: is Move an Enum?
21:26:35<b_jonas>sorry that's for Absolute0
21:26:37<Absolute0>Apocalisp: its defined in the paste
21:26:38<Apocalisp>heh
21:26:50<b_jonas>Absolute0: but you're using Enum methods
21:26:54<Absolute0>b_jonas: is that an enum?
21:27:07<b_jonas>Absolute0: fromEnum is an Enum method
21:27:10<lament>Apocalisp: i'm not sure "we don't know what it is" is at all meaningful. We know quite well how gravity behaves.
21:27:11<Absolute0>how do i equate Left | Right | Up ...
21:27:12<Absolute0>?
21:27:23<b_jonas>Absolute0: derive the Eq instance?
21:27:28<Jedai>Absolute0: You don't need to write them yourselves
21:27:33<Absolute0>oh
21:27:34<Absolute0>:)
21:27:50<Absolute0>Jedai: ghc told me that I should :)
21:27:57<Jedai>Absolute0: just add " deriving (Eq)" at the end of your type declaration
21:28:05<Jedai>Ok, good :)
21:28:06<Apocalisp>lament: We know that it does and how, but not why. "Gravity holds the stars together" isn't much more meaningful than saying "the stars are held together"
21:28:30<Jedai>If you had to write it by hand for any reason, you would use pattern matching
21:28:32<lament>Apocalisp: then why did you ask <Apocalisp> What evidence is there that gravity produced the stars?
21:28:43<Jedai>Left == Left = True
21:28:57<Jedai>Right == Right = True yadayada
21:29:07<b_jonas>Absolute0: what Jedai says
21:29:08<Jedai>then _ == _ = False
21:29:14<Absolute0>yeah that helped
21:29:22<lament>Apocalisp: there's certainly plenty of evidence that gravity produced the stars, regardless of "why" it produced them.
21:29:28<Apocalisp>lament: Because it's just an assumption. It's assumed that stars are produced by gravitational collapse because nothing else could.
21:29:41<b_jonas>Apocalisp: well, as I've said, that's not relevant for my argument
21:29:41<Absolute0>um if i define a function x + y is y+x implied?
21:29:54<b_jonas>Absolute0: you can but the syntax is tricky
21:30:02<lament>Apocalisp: you're wrong.
21:30:04<b_jonas>Absolute0: I think you have to write the definition as (+) x y =
21:30:05<Absolute0>i mean the order matters
21:30:10<lament>Apocalisp: i'm not sure how this argument can continue :)
21:30:14<b_jonas>the order does matter
21:30:22<Apocalisp>lament: Yes, I know. Orthodoxy cannot be argued with.
21:30:23<Jedai>b_jonas: Nope7
21:30:23<Nereid>b_jonas: x + y = ... should work too
21:30:25<Absolute0>so if given y + x I want to actually call x + y
21:30:39<Nereid>Absolute0: I don't think that would work. what would x + y be?
21:30:44<Nereid>x + y would call y + x, etc
21:30:49<b_jonas>really? let me try
21:30:56<lament>Apocalisp: you have nothing other than the standard philosophical "we can't know anything for certain".
21:30:58<Jedai>b_jonas: If you define an infix operator, you can use the infix syntax on the left side of the = too
21:31:10<b_jonas>I thoguht it would conflict with n+k patterns notation
21:31:12<lament>Apocalisp: to the extent we can be certain about anything, we're certain gravity produced the stars.
21:31:14<Absolute0>http://pastebin.com/f742890b6
21:31:24<Jedai>Absolute0: What you ask for doesn't really make sense
21:31:29<Absolute0>as you can see + accepts position move
21:31:37<Apocalisp>lament: I'm not offering that at all. I maintain that certainty is possible.
21:31:39<Absolute0>what if I did + move position ?
21:31:54<lament>Apocalisp: then we know that for certain.
21:32:00<b_jonas>hmm, you're right, you don't need it indeed
21:32:09<b_jonas>sorry then
21:32:30<Jedai>Absolute0: First you shouldn't use (+), it's a Num operator
21:32:40<Absolute0>yeah i am getting conflicts everywhere :)
21:32:45<opqdonut>Absolute0: just add "| otherwise = (+) move position"
21:32:50<b_jonas>Absolute0: use a different name maybe?
21:33:00<Jedai>Absolute0: Use something like (^+) or whatever
21:33:02<opqdonut>Absolute0: that is, if none of the cases match, try it with different argument order
21:33:03<Nereid>Absolute0: I wouldn't use (+), but you'd basically end up with both (+) :: Position -> Move -> Position and (+) :: Move -> Position -> Position
21:33:23<opqdonut>Absolute0: of course, the types of the two arguments should match...
21:33:32<Nereid>but simply doing something like
21:33:38<Nereid>move + position = position + move
21:33:43<Nereid>would be ambiguous
21:33:45<Nereid>and probably fail
21:33:47<Jedai>Absolute0: And as Nereid just pointed, a same function/operator (they're the same really) can't have two types at once
21:33:53<Absolute0>I at first named the function executeMove but + seemed a lot nicer.
21:33:54<opqdonut>you could do this all by doing a new typeclass that defines + for the relevant types
21:33:59<b_jonas>so what's the advantage of this MonadLib over mtl?
21:34:37<Jedai>Absolute0: Using typeclass could work but would be pretty ugly and frankly do you really care enough about allowing both orders ?
21:34:48<Nereid>Absolute0: do you really need to allow positions and moves to be combined in either order?
21:35:06<Nereid>yeah
21:36:22<Absolute0>Nereid: following the fact that addition is commutative i thought it would be logical to do so.
21:36:32<Jedai>Besides, you moves from a position (Position + Move -> Move) you don't position from a move
21:36:35<Nereid>but what you're doing isn't really addition
21:36:56<Jedai>Absolute0: Addition is, but this isn't addition... You don't even have the same types on both sides
21:37:07<Absolute0>:)
21:37:20<Absolute0>they are somewhat the same
21:37:27<Absolute0>like 1.5 + 2
21:37:40<Absolute0>the Int part plus the Move
21:37:49<Absolute0>oh well
21:37:50<Nereid>I think what you're doing is closer to what (:) does with lists
21:37:54<tetha>you are adding two rational numbers there
21:37:55<Nereid>for example
21:38:38<fracture>I want a function like map that returns the whole list N times with single elements changed... (guessing this might be quick for someone here)
21:39:07<Nereid>what do you mean, single elements changed?
21:39:12<fracture>so like ... mapish (2*) [1,2,3] would give [[2,2,3], [1,4,3], [1,2,6]]
21:39:18<Twey>That doesn't make sense, fracture
21:39:19<Nereid>ah
21:39:22<Twey>Think of the types
21:39:30<fracture>(sorry, was typing example)
21:39:36<Jedai>Twey: Why ?
21:39:38<Nereid>Twey: well the function would have to be a -> a
21:39:44<Nereid>but otherwise it's fine
21:40:02<fracture>I can think of a way to do this using length and split and shit, but it seems way too imperative style
21:40:17<gwern>so I've been looking at GADTs, and it doesn't seem to be goign well: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5172#a5173 I'm sure I'm misunderstanding something, but what?
21:40:25<Twey>Hmm
21:40:55<BMeph>fracture: I think "the Haskell way" would use inits and tails for that. :)
21:41:11<Apocalisp>lament: I've yet to see a simple and concise explanation of how we've come to know that stars are formed by gravitational collapse. As in "here's how this was discovered and this is why it can't be wrong". Know of anything like that?
21:41:11<b_jonas>let me try to write that
21:41:12<Twey>Well, but then you've got to add them onto the original list
21:41:16<Twey>I would go with splitAt
21:41:35<hatds>I think there is a way to use the list monad perhaps/
21:41:36<hatds>?
21:41:49<lament>Apocalisp: observational evidence. It's no different from seeing objects fall.
21:41:58<b_jonas>> let { m f [] = []; m f (p : r) = (f p : r) : map (p :) (m f r); } in m (10*) [1, 2, 3]
21:41:59<lambdabot> [[10,2,3],[1,20,3],[1,2,30]]
21:42:03<b_jonas>-> fracture
21:42:08<fracture>also... it would be even cooler if it worked with infinite guys (thinking maybe a splitAt way can't do that, since I'd need length)
21:42:08<Jedai>> let halves xs = zip (inits xs) (tails xs) in halves [1..4]
21:42:09<Heffalump>Apocalisp: science doesn't do "it can't be wrong"
21:42:09<lambdabot> [([],[1,2,3,4]),([1],[2,3,4]),([1,2],[3,4]),([1,2,3],[4]),([1,2,3,4],[])]
21:42:13<fracture>ah
21:42:25<lament>Apocalisp: we have a pretty good theory explaining why objects fall, and the same theory happens to correctly describe star formation, and we can look at the sky and check that it's correct.
21:42:27<Jedai>> let halves xs = init . zip (inits xs) (tails xs) in halves [1..4]
21:42:28<lambdabot> Couldn't match expected type `a -> [a1]'
21:42:30<Absolute0>Is haskell a good language to implement a chess engine with? Or should I stick with Java?
21:42:34<Heffalump>gwern: how could that type signature for eval be right?
21:42:34<Jedai>> let halves xs = init $ zip (inits xs) (tails xs) in halves [1..4]
21:42:35<lambdabot> [([],[1,2,3,4]),([1],[2,3,4]),([1,2],[3,4]),([1,2,3],[4])]
21:42:41<hatds>haskell is good for everything :)
21:42:42<Twey>Jedai: Nice
21:42:45<lament>Apocalisp: s/why/how
21:42:49<Apocalisp>lament: The events in question are long ago and far away. We don't actually see them form.
21:42:50<gwern>Heffalump: I know it isn't right, but I don't know what right would look like
21:42:56<b_jonas>@faq Is haskell a good language to implement a chess engine with? Or should I stick with Java?
21:42:56<lambdabot>The answer is: Yes! Haskell can do that.
21:43:10<Absolute0>:)
21:43:11<Nereid>gwern: you have N :: Term' (Int) but you say eval (N x) = x
21:43:18<lament>Apocalisp: well, there's the assumption that the laws of physics don't change much over time.
21:43:21<Heffalump>I don't think your types do what you intend
21:43:26<b_jonas>> let { m f [] = []; m f (p : r) = (f p : r) : map (p :) (m f r); } in map (take 6) (m (10*) [1..])
21:43:27<lambdabot> [[10,2,3,4,5,6],[1,20,3,4,5,6],[1,2,30,4,5,6],[1,2,3,40,5,6],[1,2,3,4,50,6]...
21:43:29<Heffalump>you have three nullary constructors, E N and Q
21:43:29<Nereid>eval should return a Bool but if you have N x then x is an Int
21:43:33<b_jonas>works for infinites too
21:43:37<lament>Apocalisp: but star formation happens not *that* far away
21:43:37<opqdonut>gwern: you need an explicit type sig for eval
21:43:40<Heffalump>so your syntax is wrong too
21:43:46<opqdonut>gwern: something like eval :: Term' x -> x i guess
21:43:55<fracture>thanks b_jonas, digesting it now
21:44:08<opqdonut>gwern: and what Heffalump said
21:44:09<Jedai>> let halves xs = init $ zip (inits xs) (tails xs); mapish = map (\(pre, p:post) -> pre ++ f p : post) . halves in mapish (*2) [1..4]
21:44:10<lambdabot> The section `(* 2)' takes one argument,
21:44:10<lambdabot> but its type `[a]' has none
21:44:20<lament>Apocalisp: the milky way is only 100,000 light years in diameter.
21:44:22<Cale>Absolute0: I doubt that Haskell would have any disadvantages over Java for a chess engine. Some chess engines are designed at a really low level to get the most out of every instruction, and that's something which I think Haskell and Java would struggle equally with, except that Haskell is particularly good at metaprogramming for low-level things.
21:44:25<Jedai>> let halves xs = init $ zip (inits xs) (tails xs); mapish f = map (\(pre, p:post) -> pre ++ f p : post) . halves in mapish (*2) [1..4]
21:44:26<lambdabot> [[2,2,3,4],[1,4,3,4],[1,2,6,4],[1,2,3,8]]
21:45:14<Jedai>bjonas solution is better though
21:45:16<Cale>... where'd he go?
21:45:19<Cale>Oh well.
21:45:22<gwern>but the problem is how do I have N take an argument? 'N :: forall a. Term' (a)' doesn't seem to work and doesn't specify ints either
21:45:32<Heffalump>N :: a -> Term' a
21:45:43<b_jonas>Cale: dunno
21:45:45<Heffalump>you give the signature you want the constructor to have
21:46:05<Heffalump>so if it should take k arguments then give a function signature with k arguments and a result of type Term' something
21:46:40<b_jonas>let me try to ask this again
21:46:44<b_jonas>so what's the advantage of this MonadLib over mtl?
21:46:52<fracture>cool, I think I understand it now jonas; nice and elegant :)
21:47:16<b_jonas>MonadLib::lift :: Monad m => m a -> t m a
21:47:17<b_jonas>funny
21:47:21<Jedai>b_jonas: You should use transformers and monad-tf anyway !!
21:47:29<Heffalump>Jedai: that's basically mtl though
21:47:35<Heffalump>monadLib is a significant change
21:47:40<lament>Apocalisp: for an example, http://en.wikipedia.org/wiki/Orion_Nebula
21:48:02<b_jonas>lament: sorry, I took part in starting the flame
21:48:04<Twey>Jedai: mapish f = map (second $ map f) . halves
21:48:07<b_jonas>lament: I shouldn't have answered
21:48:09<Jedai>Heffalump: I must admit that the differences between the approach and why some are better than others are a nebulous for me
21:48:59<Heffalump>for me the biggest downside of monadLib is that the author isn't interested in aligning with mtl where possible, just in terms of having the same types
21:49:03<roconnor>Jedai: monad-tf has most of the same problems that the mtl has.
21:49:18<Jedai>Heffalump: I once read something that I half understood but I forgot everything since :)
21:49:30<roconnor>for me the biggest upside of monadLib is that the author isn't interested in aligning with mtl where possible
21:49:56<Twey>Hahaha
21:50:00<ray>if only less haskell people cared about compatibility
21:50:02<b_jonas>okay, at least it has a proper EitherT (not called that but still), not this riddiculous ErrorT
21:50:03<Twey>MonadLib is good?
21:50:08<ray>we'd have left-associative $ by now
21:50:13<ray>and better typeclasses
21:50:16<ray>and if'
21:50:20<b_jonas>eek
21:50:24<Twey>ray: We generally do it in extensions
21:50:26<idnar>how does if' break compatibility?
21:50:27<Twey>Nobody wants if'
21:50:32<b_jonas>I do
21:50:32<Twey>(??) all the way
21:50:34<b_jonas>but call it bool
21:50:40<roconnor>ACTION kinda wants if'
21:50:41<idnar>anyhow, if haskell people cared about compatibility, we wouldn't have had the whole exceptions-revamp debacle
21:50:42<Heffalump>ray: and fewer users
21:50:44<idnar>:P
21:50:51<hydo>Hrm... I think I just invented Monads... or something like them... or something completely different that is a bastardization of the term 'monad'. http://gist.github.com/116787
21:51:02<b_jonas>I also want standard names for the Void type, and standard names for (flip const) and for (flip id)
21:51:04<Cale>I think if' or something like it ought to be in the Prelude or at least Data.Bool
21:51:05<roconnor>@google "you could have invented monads"
21:51:06<lambdabot>http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html
21:51:06<lambdabot>Title: A Neighborhood of Infinity: You Could Have Invented Monads! (And Maybe You Alrea ...
21:51:19<b_jonas>and one more, which one was it...
21:51:30<MyCatVerbs>hydo: hrmn? How so?
21:51:35<b_jonas>bool, flipconst, flipid, what was the fourth?
21:51:37<ray>the Void type being the type that contains only _|_?
21:51:42<b_jonas>ray: yes
21:51:43<Cale>hydo: Where's the monad?
21:51:51<ray>yeah, we could use that
21:52:06<b_jonas>defined as data Void where {}; or as newtype Void = Void Void;
21:52:09<idnar>@type flip const
21:52:11<lambdabot>forall a b. b -> a -> a
21:52:26<b_jonas>but then sometimes it's better to use an unbound type variable instead of void
21:52:30<Berengal>if' and fi ftw
21:52:30<idnar>@type const id
21:52:30<b_jonas>like in forever and stuff
21:52:31<lambdabot>forall a b. b -> a -> a
21:52:39<roconnor>b_jonas: oh nice definition of Void.
21:52:39<hydo>MyCatVerbs: well, using the getE method in that gist to pull out successive layers of data. It suddenly seemed monadish. That's probably because I still have only a rudimentary knowledge of them.
21:52:41<b_jonas>in some way that's better because it can be used in more places
21:52:45<b_jonas>roconnor: not my invention
21:52:51<roconnor>void_rec x = void_rec x
21:52:52<b_jonas>roconnor: and I prefer the former
21:52:53<idnar>> \x -> (flip const) x == (const id) x
21:52:55<lambdabot> Overlapping instances for Show (b -> Bool)
21:52:55<lambdabot> arising from a use of...
21:52:56<idnar>er
21:52:57<roconnor>er
21:53:00<idnar>@quickcheck \x -> (flip const) x == (const id) x
21:53:00<lambdabot>Unknown command, try @list
21:53:03<idnar>@check \x -> (flip const) x == (const id) x
21:53:04<roconnor>void_rec (Void x) = void_rec x
21:53:04<lambdabot> No instance for (Eq (a -> a))
21:53:05<lambdabot> arising from a use of `==' at <int...
21:53:18<idnar>@check \x y -> (flip const) x y == (const id) x y
21:53:20<lambdabot> "OK, passed 500 tests."
21:53:28<idnar>actually, I guess that probably didn't check anything useful
21:53:55<Jedai>@check \x y -> (flip const) x y == (const id) (x :: Int) (y :: Int)
21:53:56<lambdabot> "OK, passed 500 tests."
21:54:05<Jedai>There
21:54:05<roconnor>@check \x y -> x == y
21:54:06<lambdabot> "OK, passed 500 tests."
21:54:20<MyCatVerbs>hydo: it looks like you've reinvented Maybe. data Value = Nothing | Object (M.Map String somethingorother) -- ?
21:54:38<ray>@check (x :: Int) == (y :: Int)
21:54:39<lambdabot> Couldn't match expected type `Int' against inferred type `Expr'
21:54:44<roconnor>\x y
21:54:50<MyCatVerbs>hydo: or, more to the point, you're doing something by hand that you could probably translate into the Maybe monad fairly straightforwardly.
21:54:54<hydo>I just need to find a smart student in the seattle area that knows haskell really well and pay him for tutoring. Or maybe I was spoiled when I was learning Perl by having schwern just down the street and knowing Randal Schwartz and thus having them critique my code ad nauseam.
21:54:57<ray>\x y indeed
21:55:00<Jedai>idnar: That is trivially true but it's good to see that quickcheck agree with me
21:55:38<fracture>is there a Data.List (or elsewhere) function like C++ std::unique (or unix uniq... removes adjacent duplicates)?
21:55:51<hydo>talk about ramming a language into your brain all "Matrix" style...
21:55:56<Jedai>fracture: map head . group
21:56:13<ray>haskell is easy
21:56:32<Berengal>ray: Which part of it?
21:56:42<Jedai>Berengal: The small
21:56:45<hydo>parts of haskell are easy.
21:56:47<bogner>what does "constraint is no smaller than the instance head" mean?
21:56:47<fracture>ah cool, thanks jedai
21:57:06<ray>haskell is easy, let's stop shopping
21:57:09<thirsteh>it should be renamed cakewalk, really
21:57:17<hatds>bogner: it means it isn't obvious that typechecking will terminate
21:57:21<mauke_>bogner: it means it can't prove that your type relation terminates
21:57:23<MyCatVerbs>hydo: yeah, that does sound a bit spoiling, heh. :)
21:57:29<Jedai>bogner: That means you have an instance that doesn't respect some of the constraint Haskell98 impose so that typechecking terminate
21:57:36<tetha>well, cakewalk with a gigantic trench in the middle of it, called monads. but yes, cakewalk
21:57:40<MyCatVerbs>hydo: just hang around on IRC with Cale long enough, you'll pick it all up by osmosis. ;)
21:57:44<lament>monads are easy
21:57:47<ray>monads are one of the easier parts of haskell
21:57:54<Berengal>Monads are like cars. Cars are easy.
21:57:57<lament>actually writing stuff is hard
21:58:12<b_jonas>no, cars are not easy
21:58:15<Jedai>bogner: If you can prove it by yourself, you're ok (you'll have to enable some extensions though)
21:58:34<Cale>You could pay me to tutor you if you want, though I'm likely to help out randomly anyway.
21:58:38<thirsteh>monads the strawberries that weren't quite ready
21:58:42<inimino>cars never say no?
21:59:05<Berengal>inimino: Have you ever heard a car say no?
21:59:07<b_jonas>inimino: not true for these mondern cars
21:59:12<b_jonas>Berengal: I have
21:59:16<thirsteh>tetha, an excillerating, almost euphoric -- yet lethal cakewalk, although I guess, at the end of the day, you're still going to land in cake if you fall
21:59:29<MyCatVerbs>Where did cake come into this, anyway?
21:59:36<ray>haskell is like a cake
21:59:39<bogner>Jedai: well, i don't think i should need to, I must be doing it wrong. I want to declare an instance like `instance Integral a => Foo a where`...
21:59:40<Berengal>b_jonas: Psh, you must be driving one of the newfangled electromatic wagons
21:59:43<thirsteh>It's certainly not a lie
21:59:45<inimino>Berengal: no I never have
21:59:46<riddochc>Cars are a little easier than they should be, imo. Too many people don't respect the fact that they're flinging themselves at high velocities taking a lot of mass with them. ;)
21:59:47<b_jonas>MyCatVerbs: well everyone likes a cake
21:59:56<bogner>Jedai: ie, if it's an integral, it's also my class
22:00:02<inimino>riddochc: it's driving that's hard
22:00:06<mauke_>bogner: that doesn't necessarily terminate because someone else could define instance Foo a => Integral a
22:00:11<MyCatVerbs>b_jonas: I can one up that. I have cake, too.
22:00:21<b_jonas>oh, happy birthday!
22:00:29<bogner>mauke_: I suppose that's fair, but what if someone... doesn't do that?
22:00:38<hatds>then everything will be a-ok
22:00:43<Jedai>bogner: Of course you're probably pretty sure that nobody would do that, so enable some extensions
22:00:46<inimino>@faq can Haskell have your cake and eat it too?
22:00:46<lambdabot>The answer is: Yes! Haskell can do that.
22:01:11<Jedai>You have a list and explanation somewhere in the GHC manual
22:01:25<Apocalisp>lament: http://www.electric-cosmos.org/indexOLD.htm Old but made me curious.
22:01:38<thirsteh>Cakes, cars and Haskell -- what more do you need.
22:01:57<inimino>there's your new Monad tutorial title
22:02:04<riddochc>I wasn't aware of the 'group' function. Potentially quite useful.
22:02:05<bogner>oh, okay, I get it, that's why it's saying it's no smaller than the instance head
22:02:12<thirsteh>inimino, hah, indeed
22:02:15<lament>Apocalisp: ok
22:02:38<ray>you can have your cake and eat it too with functional programming in general
22:03:12<lament>functional programming ate my babysitter
22:03:13<ray>but with haskell, you can eat each of an infinite number of cakes an infinite number of times and not get a stomachache
22:03:19<Jedai>bogner: You could try FlexibleInstances but I think it's not enough
22:03:24<mauke_>it's a bit like functions at the type level, only the syntax is 'instance BODY => FUNCTION PATTERN' instead of 'FUNCTION PATTERN = BODY'
22:03:48<bogner>Jedai: it's not, that's already enabled. i think i need UndecidableInstances
22:03:51<thirsteh>ray, I'd read your tutorial
22:04:01<hatds>that's a good explanation, mauke
22:04:06<Jedai>bogner: Yeah, I believe so too
22:04:08<hatds>I like it )
22:04:08<ray>unfortunately, i think haskell is too easy to need tutorials
22:04:12<hatds>:)
22:04:13<tetha>ray: now define bind in terms of cake :)
22:04:37<Berengal>cake >>= eat = eat cake
22:04:49<ray>that's when you take a cake and a function from some frosting to a cake, and put the frosting on the cake
22:05:07<thirsteh>ray: Obviously, I would merely be reading it for the cake metaphores
22:05:36<Berengal>Is there anything that isn't a monad analogy?
22:05:53<ray>monads are like monad tutorials
22:05:56<Cale>There are a lot of things which are really bad monad analogies.
22:05:56<tetha>mh. arrows?
22:06:03<Apocalisp>lament: ... because electricity I get but gravity I don't. The engineer in me does not want to believe in black holes. :)
22:06:14<mauke_>@quote chocolate
22:06:14<lambdabot>SimonBrenner says: 2kg of chocolate 'thunks' to 'force' really might 'blow your stack' later on.
22:06:17<Berengal>Cale: "Really bad" is not "not"
22:06:19<mauke_>hmm, not that one
22:06:37<Cale>But I suppose anything is an analogy for anything else. It's just a matter of quality.
22:06:57<ray>monad transformers are like monad tutorial transformers
22:07:10<Berengal>Quality is in the eye of the beholder. I, for example, think the unicorn analogy is of good quality
22:07:16<lament>Apocalisp: hehe
22:07:29<b_jonas>Berengal: what color of unicorn?
22:07:52<Berengal>b_jonas: All colours. IO is invisible pink
22:07:52<Cale>"Monads are like the Japanese word 物"
22:08:06<riddochc>All words are idioms.
22:08:06<tetha>Berengal: now I had to think of unicorns poking other unicorns as the binding operator.
22:08:38<b_jonas>tetha: eek
22:08:41<mauke_>CJK UNIFIED IDEOGRAPH-7269 [物]. how helpful.
22:08:45<inimino>haha
22:08:46<Berengal>tetha: That is the basic part
22:08:50<inimino>ACTION vows to say no more about the unicorn thing
22:08:54<Cale>物 [もの] /(n) (1) thing/object/
22:08:55<hatds>monads are like C++'s empty base class optimization
22:09:02<b_jonas>tetha: why not extend one of the lambda calculus analogies, like crocodiles or singing birds?
22:09:03<ray>mauke_: wiktionary helps
22:09:16<b_jonas>hatds: what?
22:09:23<hatds>b_jonas: exactly.
22:09:49<Cale>It's often used as a nominaliser, to take some verb and turn it into the thing of that.
22:10:02<tetha>b_jonas: I am trying hard to get that image of poking unicorns out of my head, stop stopping me
22:10:13<ray>nouning verbs is even cooler than verbing nouns
22:10:18<mle>e.g. tabe (eat) mono (thing) -> tabemono (foodstuffs)
22:11:06<BMeph>This place seems more like "Functional Programming stole my Adderall", today. ;p
22:11:27<mauke>@quote chocolate.robot
22:11:27<lambdabot>Duqicnk says: a monad is like a train that runs backwards in time, which is made of tiny chocolate robots
22:11:37<b_jonas>monads are like ooh, chocolate
22:11:49<Berengal>Mmm, reverse state monad
22:12:31<b_jonas>monads are like
22:12:36<b_jonas>monads are like
22:12:54<b_jonas>I guess
22:12:57<bremner>monads are like monads
22:12:59<Cale>"Monads are like expressing what monads are like." <-- not a very good analogy.
22:13:00<Berengal>> fix ("monads are "++)
22:13:01<bo0ts__>Hi, I'm jsut learning haskell and got a little confused. What's the difference between putStr show 3 and putStr (show 3)? The later works.
22:13:01<lambdabot> "monads are monads are monads are monads are monads are monads are monads a...
22:13:10<b_jonas>monads are like twice "monads are like twice "
22:13:11<tetha>monads are like things that are not like monads
22:13:23<Cale>bo0ts__: The first is the same as (putStr show) 3
22:13:39<Cale>bo0ts__: and is like giving both parameters to putStr
22:13:58<mle>logical quine for the lose.
22:14:00<b_jonas>monads are like that distance giant in Ende's book who seems larger if you view him from farther unlike normal objects that seem smaller when viewed from farther
22:14:16<bo0ts__>Cale: I see. Just didn't expect it to act that way. Is there any reason for this?
22:14:25<Cale>bo0ts__: Plenty of good reasons.
22:14:29<tetha>mm, jim knopf (at least in german). that was a good book
22:14:35<ray>yeah, and whenever someone figures out monads they think "oh, this is boring, let's install category-extras"
22:14:53<Cale>bo0ts__: Firstly, all functions in Haskell really take exactly one parameter.
22:15:05<Cale>bo0ts__: Those which appear to take more just return other functions.
22:15:16<cads>b_jonas: cool reference
22:15:24<b_jonas>so putStr show 3 means (putStr show) 3
22:15:24<bo0ts__>Cale: Is this by convention?
22:15:41<Cale>bo0ts__: More than just convention, it's supported by the syntax of the language.
22:16:01<Cale>This is convenient because it makes it easy to get hold of functions which are specialisations of other functions where some of the first parameters are filled in already.
22:16:05<Cale>For example...
22:16:16<Cale>> map (map (+1)) [[1,2,3],[4,5]]
22:16:18<lambdabot> [[2,3,4],[5,6]]
22:16:50<Cale>When you write an expression like f x y z it really means ((f x) y) z
22:17:14<Cale>That is, f is applied to x, then the result is applied to y, and the result of that is finally applied to z
22:17:32<Cale>But you can also regard it as just passing three parameters to f. It's the same thing.
22:17:40<Cale>Similarly, when you write a function like:
22:17:58<Cale>f x y z = x^2 + x*z + y^2*z
22:18:06<bo0ts__>Cale: I thought it would be more like f(g(x)). Those are evaluated from the inside.
22:18:14<Cale>bo0ts__: It's the opposite.
22:18:29<cads>does the haskell standard have a super concise syntax notation for haskell?
22:18:45<b_jonas>bo0ts__: that's because syntax works like that in some programming langauges (smalltalk, apl, perl, ruby)
22:18:45<Cale>If you want to apply multiple functions to a parameter, you can use the composition function:
22:18:52<Cale>(f . g) x
22:18:55<Cale>Or:
22:18:59<Cale>f . g $ x
22:19:02<b_jonas>or just f (g c)
22:19:06<Cale>Right.
22:19:09<b_jonas>f (g x) I mean
22:19:12<cads>I remember there were some haskell railroad diagrams somewhere showing haskell syntax in a graphical way
22:19:13<b_jonas>and it's f $ g x
22:19:20<b_jonas>though sure, f . g $ x works too
22:19:24<bo0ts__>Cale: Thanks, feels better now.
22:19:33<Cale>@src (.)
22:19:34<bo0ts__>Just haven't got to these yet.
22:19:34<lambdabot>(f . g) x = f (g x)
22:19:39<cads>even if they were not in english, they were useful
22:19:49<b_jonas>bo0ts__: sure, just understand the f (g x) one first
22:19:54<b_jonas>bo0ts__: and what f x y means
22:20:02<b_jonas>bo0ts__: try this for example
22:20:08<b_jonas>> (+) 3 8
22:20:09<lambdabot> 11
22:20:16<b_jonas>(+) is the addittion function and it takes two arguments
22:20:24<b_jonas>> ((+) 3) 8
22:20:25<lambdabot> 11
22:20:27<Cale>> let addThree = (+) 3 in addThree 8
22:20:29<lambdabot> 11
22:20:58<b_jonas>that does not work in most langauges because unlike haskell they don't have curried functions (standard ml is about the only other one)
22:21:24<b_jonas>there are arguments for non-curried too of course, like easier catching of errors (especially with a weak type system) or vararg functions
22:21:38<b_jonas>(or the apl syntax)
22:23:00<b_jonas>heh, MonadLib uses completely different names from mtl
22:23:02<Cale>But in general, this one works out really nicely for functional programming, because it cuts down on the number of lambdas needed, and can also allow for some optimisations which would otherwise require a variation in syntax.
22:23:05<b_jonas>say is called put, and put is called set
22:23:13<Cale>For example, suppose you have a function:
22:23:24<Cale>regexMatch :: Regex -> String -> Bool
22:23:47<Cale>Which takes a regular expression and then a String, and decides if the regular expression matches.
22:27:13<Cale>Sorry, distractions.
22:27:31<fracture>ugh, haskell-mode for emacs seems to do indentation badly :(
22:27:43<Cale>Anyway, you could optimise such a function so that after receiving its first parameter, it compiles the regular expression into an efficient String -> Bool function.
22:28:10<Cale>So that the cost of compiling that regular expression will be paid only once if you map it over a list, say.
22:28:55<Cale>Regex -> String -> Bool is the same as Regex -> (String -> Bool)
22:29:31<roconnor>> 100-7.6
22:29:32<lambdabot> 92.4
22:29:39<Cale>and so that's an optimisation which is available to a library developer without changing the exposed API, even if an unoptimised version has been in use by other programs.
22:29:43<bo0ts__>fracture: There are two modes (or three?). Try another one.
22:29:45<jmcarthur>fracture: a lot of people complain about that, but i've not had any problems with it besides ifelse
22:30:04<b_jonas>I don't use magical indenters
22:30:19<Cale>fracture: The annoying thing is that to get it to indent properly, you sometimes have to start typing the beginning of a line, and then hit tab
22:30:30<fracture>most of that stuff seems ok so far
22:30:32<Cale>Which I personally find really super-unnatural, so I don't use it
22:30:33<b_jonas>I only use autoindent in as much that it has to start the next line where the previous line was indented, and tab and backspace should indent or dedent one step
22:30:40<fracture>but module declarations and data declarations seem totally messed up
22:30:44<b_jonas>I don't like these smart editor features
22:30:59<fracture>module Foo (
22:30:59<fracture> Bar(..)
22:30:59<fracture> , Baz(..)
22:30:59<fracture> ) where
22:31:04<fracture>is what it produces
22:31:04<jeff_s_>I thought I should let you guys know, haskell is pretty cool.
22:31:09<fracture>for a module export lit
22:31:11<fracture>list
22:31:19<Cale>What I really want more than auto-indentation is something which understands the block-structure of Haskell code properly, and keeps things aligned consistently with layout keywords.
22:31:46<Cale>(so if you make an edit which pushes do/let/of/where onto a new line, say, the rest of the block goes with it)
22:32:01<Berengal>Cale: I saw something like that demoed for yi
22:32:13<Cale>I tried it, but it really seems fragile.
22:32:14<b_jonas>I don't get this, if you're using layout so the compiler can't know where a block ends without seeing your indentation, then how do you suppose the editor should figure out the indents for you?
22:32:21<b_jonas>it too can't know where a block ends
22:32:34<b_jonas>if you use braces, that's different
22:32:35<Cale>It's okay if you change the indentation of the keyword on one line, but it breaks the moment you press enter.
22:32:37<roderyk>what's the best way to check if code is running on a Windows or Unix OS? (so I can run some specific setting for each)
22:33:09<Cale>b_jonas: It can know where the block currently ends.
22:33:20<Cale>b_jonas: When you're editing above it.
22:33:24<pumpkin>ACTION stars at thoughtpolice
22:33:27<pumpkin>*stares
22:33:28<Cale>roderyk: hmm
22:33:47<ray>ACTION costars at pumpkin
22:33:50<b_jonas>Cale: so basically you have to tell it where a block ends when you first write it?
22:33:54<Cale>System.Info.os
22:34:01<Cale>^^ roderyk
22:34:11<Cale>b_jonas: What?
22:34:12<roderyk>Cale: thanks, will check the api! :)
22:34:18<b_jonas>Cale: in which case all the magic indenter does is add a level of indent after of/where/let automatically?
22:34:24<Cale>b_jonas: I mean that if you write a block, and then move the cursor before the 'do'
22:34:34<Cale>and start editing, it will push the rest of the block around
22:34:36<b_jonas>"do" too, sorry
22:34:43<b_jonas>Cale: I see
22:34:55<b_jonas>Cale: but it can understand that without knowing haskell, can't it?
22:35:05<Cale>It needs to be Haskell-specific, yes.
22:35:13<hydo>Any of you using leksah day to day?
22:35:17<b_jonas>I mean it doesn't need to know haskell
22:35:20<ray>it doesn't need to know haskell, just the haskell layout rule
22:35:21<Cale>It just has to know the Haskell layout keywords, mostly.
22:35:28<b_jonas>because it can just take the indented lines after a line
22:35:35<b_jonas>it can be completely unspecific
22:35:37<b_jonas>can't it?
22:35:39<Cale>mm...
22:35:45<Berengal>It needs to know keywords
22:35:47<ray>i think it's a good idea if it works across lines
22:36:00<b_jonas>the block ends before the next line that's not indented more than the line after which it starts
22:36:04<b_jonas>um yeah
22:36:06<roderyk>before I reboot, is there someone on a Windows box who can tell me what string "System.Info.os" returns?
22:36:10<ray>as in, you move the magic first non-whitespace thing after the keyword from line to line, and it still works
22:36:16<b_jonas>maybe it has to know a bit about haskell
22:36:17<Cale>I'm pretty sure that it needs to know what the four layout keywords are, so that it knows where the block actually begins and can keep things aligned with that.
22:36:18<roderyk>on linux, its a nice, simple "linux" :)
22:36:18<b_jonas>like
22:36:34<b_jonas>in C the next one line (where the closing brace is) might be part of the block
22:36:35<pumpkin>we all need to go to http://www.haskell.edu/
22:36:37<b_jonas>maybe
22:36:40<b_jonas>I'm not sure really
22:36:47<b_jonas>anyway, I don't like this kind of magic in the editor
22:36:52<b_jonas>I prefer to do all that by hand
22:37:10<ray>roderyk: mine says, er, mingw32
22:37:17<fracture>I'd normally agree with you jonas (at least, in a language like C or C++)
22:37:26<fracture>in lisp though, not having auto-indent is a nightmare
22:37:26<Cale>I wonder if that university uses Haskell for their computer science courses. :)
22:37:27<roderyk>ray: WinXP ?
22:37:31<fracture>seems like it'd be similar for haskell
22:37:35<ray>yeah
22:37:40<roderyk>ray: thanks
22:38:03<Berengal>Indenting yourself isn't that bad in haskell
22:38:08<pumpkin>Cale: they'd better!
22:38:15<b_jonas>fracture: what? wouldn't autoindent in lisp mean that if you forget a paren, your whole code indentation is messed up and then you can't figure out what it's supposed to do?
22:38:32<ray>lisp editors remember the parens for you
22:38:33<b_jonas>fracture: isn't it better to do the indents by hand so you at least know what you wanted to say and fix the parens from it?
22:38:40<ray>sorta
22:38:53<tetha>b_jonas: there is the danger of indenting how it should be instead of indenting how it is
22:38:53<hydo>wow, that college has been around for 125 years... nice.
22:38:58<hatds>if you want the editor to preserve the current block structures would it cause problems when you want to tear apart a block or move some lines out of it?
22:38:59<Berengal>b_jonas: It's really easy to notice the missing parens exactly because the indentation would break
22:39:12<fracture>I haven't experienced it that way... I think usually it gets the same indentation with or without the parens on the end
22:39:13<pumpkin>Cale: doesn't look like they have CS courses :(
22:39:16<Cale>Berengal: The only mildly annoying thing about indenting on your own is if you want to add stuff before the beginning of a block, you have to indent the following lines (there are ways to avoid that, but it makes the code not quite as pretty)
22:39:20<thirsteh>roderyk, mingw32 (Windows 7)
22:39:30<fracture>but if you go to the last paren in the block it'll highlight the matching one in emacs
22:39:33<ray>well, we can offer to start a CS department
22:39:34<b_jonas>dunno
22:39:43<fracture>the next function will be fucked up if you forgot a ) also
22:39:49<fracture>(fucked up == indented wrong)
22:40:00<b_jonas>oh, I know what the fourth was
22:40:21<fracture>is there a haskell code style guide somewhere online?
22:40:23<b_jonas>I'd like a one-tuple that's not only a monad like Identity is, but also inherits eq, ord, show, read, etc
22:40:29<Berengal>Cale: Yeah, I would like a proper auto-indenter. As it is, I prettify my code after I'm done writing it, if I bother at all
22:40:30<roderyk>thirsteh: much appreciated. (and here I was afraid of having to parse 30 different versions of `uname`, much like browser tags)
22:40:38<fracture>if I switch to manually indenting, it'd be nice to not to invent all my indentation rules
22:40:51<bo0ts__>hydo: Mine is around for 600 years and I can tell you: It means nothing ;>
22:40:58<b_jonas>roderyk: you just have to check for win32, don't you?
22:40:59<Cale>fracture: yes
22:41:02<jmcarthur>fracture: there is one somewhere, but i'd say it's mostly subjective
22:41:04<b_jonas>roderyk: or maybe it's Win32?
22:41:07<b_jonas>something like that
22:41:13<Cale>http://urchin.earth.li/~ian/style/haskell.html
22:41:20<fracture>thanks cale
22:41:20<hydo>bo0ts__: yea, it's a novelty though here in 'murka...
22:41:21<b_jonas>check for windows, never for unix
22:41:22<roderyk>b_jonas: seems to be "mingw32"
22:41:24<b_jonas>unix is the default
22:41:27<b_jonas>and there are many unices
22:41:29<b_jonas>roderyk: eek
22:41:35<jmcarthur>typically there are a lot of exceptional cases as far as style is concerned in most of the haskell code i've seen
22:41:37<b_jonas>I dunno then
22:41:56<roderyk>b_jonas: but yes, I need to make exceptions for Win32, so I should be fine
22:42:04<Cale>The most important rules are: 1) Don't use tabs. 2) Make stuff line up.
22:42:23<thirsteh>roderyk, indeed. 'XP', 'Vista', 'post2008Server', ugh.
22:42:29<roderyk>Cale: I read... The most important rules are; ... 2) Make stuff up.
22:42:33<Cale>hehe
22:42:54<thirsteh>make it look pretty
22:42:56<hatds>I like tabs for this reason: I only have to press backspace once to unindent
22:43:06<hatds>but I don't always use tabs for indents
22:43:07<Cale>Another, somewhat less important rule is that almost everyone uses camelCase, so probably you should too :)
22:43:20<fracture>hatds: you can configure an editor to do the same with spaces (I do in emacs, for C and C++)
22:43:22<hydo>I've been using emacs + haskell-mode and the tabs are starting to get annoying... is that what the majority of you use?
22:43:25<thirsteh>hatds, get an editor that understands that? :-)
22:43:25<Cale>hatds: You can configure your editor to eat multiple spaces like they were a tab.
22:43:30<b_jonas>hatds: an editor can help you make the tab key indent one level and backspace dedent one level
22:43:31<fracture>tabs in source files is annoying in any language
22:43:32<jmcarthur>hatds: in one of the emacs modes you only have to press tab to unindent ;)
22:43:35<b_jonas>mine does
22:43:36<thirsteh>consider hatds advised
22:43:38<b_jonas>but I use tabs
22:43:42<jmcarthur>to some level
22:43:44<b_jonas>I like tabs
22:43:51<b_jonas>but I'm not really against spaces either
22:43:53<b_jonas>I like both
22:43:57<Nereid>I never use tabs
22:43:59<hatds>my editor doesn't :P
22:44:07<Cale>hatds: The important thing is just that the tab characters don't end up in the actual file.
22:44:12<b_jonas>hatds: get a proper editor and a proper font?
22:44:12<fracture>you need a better editor :)
22:44:22<hatds>I'm writing one
22:44:24<hatds>:)
22:44:25<Asztal>my editor does, but it's often annoying when it does, because I don't always align to multiples of 4 :(
22:44:33<jmcarthur>ACTION leaves the editor war to get back to coding
22:44:53<hatds>ACTION leaves his tabs in his files...
22:45:03<Berengal>I've found the auto-indenting in emacs to be okay, but it makes for ugly code...
22:45:10<Cale>I usually smash tab a few times to get enough spaces to make it close and then use backspace/space to put it exactly where I want it.
22:45:32<Cale>and then my editor will align following lines to that amount, so I don't have to keep doing it.
22:45:36<hatds>using tabs forces you to learn how to write tab insensitive layout (because displaying your tabs with 8 space width is ridiculous)
22:45:42<b_jonas>Cale: and what do you use to dedent?
22:45:49<b_jonas>Cale: I mean, if backspace deletes just one char?
22:46:04<Cale>It's not so common that I want to do a lot of that.
22:46:05<Asztal>shift-tab, maybe?
22:46:30<Berengal>b_jonas: ctrl-shift-home, delete, tab :)
22:46:30<Cale>though actually, backspace deletes I think 4... I'd have to try it.
22:46:32<b_jonas>(also, that's ugly. I prefer indents of the same size, whatever their size is, except in assembler where you can be using columns of different size)
22:46:52<bo0ts__>b_jonas: Hm, ctrl-shit-home right delete xD
22:46:55<b_jonas>I use backspace to delete one indent
22:46:55<Cale>ah, just 2
22:46:59<hatds>I like 1 space indents for if -> then/else
22:47:07<Cale>tab indents by 2, backspace goes back 2
22:47:18<hatds>and tab spaced indents for function pat1 pat2 = -> function body
22:47:35<Cale>for if/then/else, I make the 'then' and 'else' line up with the condition
22:47:38<Cale>if foo
22:47:42<Cale> then bar
22:47:45<Cale> else quux
22:48:06<Gracenotes>if/then/else is sort of annoying for parts in monads where you might not want computation to continue
22:48:13<Cale>hm?
22:48:24<nominolo>anyone know what's going wrong here?: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5174#a5174
22:48:25<pumpkin>:t when
22:48:27<lambdabot>forall (m :: * -> *). (Monad m) => Bool -> m () -> m ()
22:48:27<Cale>You can enclose the rest of the block in when/unless
22:48:31<pumpkin>:t guard
22:48:33<lambdabot>forall (m :: * -> *). (MonadPlus m) => Bool -> m ()
22:48:35<nominolo>I did a normal ghc --make
22:48:42<Berengal>if-then-else is the hardest to indent... I can never decide to do 'if p then\n...\nelse...' or 'if p\nthen...'
22:48:55<Gracenotes>no, not really
22:48:55<Cale>Berengal: always always the second
22:49:01<Gracenotes>none of those work very well.
22:49:08<Gracenotes>best, I've found, is:
22:49:12<hatds>I always do 3 lines for if/then/else unless they nicely fit in one line
22:49:20<Berengal>Cale: That doesn't work so good in do
22:49:22<Gracenotes>do foo
22:49:25<Gracenotes> if cond then bar else do
22:49:27<Gracenotes> baz
22:49:31<Gracenotes>and so on
22:49:32<Cale>Berengal: Oh, you didn't have extra space there.
22:49:38<Cale>Berengal: Do it like I showed.
22:49:46<Cale>Gracenotes: ew...
22:49:59<Berengal>Cale: The emacs autoindenter doesn't like that...
22:50:06<Cale>really?
22:50:12<Cale>Noo...
22:50:17<Gracenotes>Cale: the only pther alternative is to add yet another level of indentation
22:50:19<Gracenotes>o
22:50:36<b_jonas>Berengal: so you let a default editor setting force something on you?
22:50:39<Cale>Gracenotes: That indentation is good!
22:50:55<Cale>Gracenotes: It helps understand the control flow of the block.
22:51:18<Gracenotes>Cale: meh. It is annoying when the cond is only a small case, and there are plenty of more important indentations going on in the whole block
22:51:22<Berengal>To be honest, I don't use if-then-else very often...
22:51:23<Cale>Gracenotes: The nice thing about do-blocks is that unless an exception occurs in the monad, when a do-block executes, each line in it executes.
22:51:29<Cale>There's no jumping out of the middle.
22:52:03<Berengal>Cale: Cont :P
22:52:11<Gracenotes>indeed. But sometimes code ends up off-the-page otherwise -- there are many preconditions to check
22:52:23<Cale>Well, yes, I suppose that falls under what I consider an exception :)
22:52:30<Berengal>Fair enough
22:52:34<Cale>Gracenotes: refactor! :)
22:52:34<Gracenotes>I don't mind it personally
22:52:52<Gracenotes>Cale: implementing a mathematical algorithm, there's not much you can do manytimes
22:52:56<Cale>If there are so many nested conditions, there's something strange about the way the code is structured, I think :)
22:53:04<fracture>where do you guys usually put the "deriving" in a data declaration?
22:53:11<fracture>in a multiline one I mean
22:53:15<Cale>fracture: On the following line, indented a bit.
22:53:20<Cale>Oh, indented 2 spaces
22:53:34<Cale>data Foo = Bar
22:53:37<Gracenotes>Cale: if there are many places an algorithm can fail, for instance (a probabilistic algorithm in IO, may or may not yield a result depending on the seed)
22:53:40<Cale> | Baz
22:53:44<Cale> deriving (Show)
22:53:55<fracture>what about for a record-ish one
22:53:58<fracture>like
22:54:01<fracture>data Foo = Asd {
22:54:01<fracture> name :: String
22:54:01<fracture> } deriving (Show)
22:54:04<Berengal>I usually put the deriving dedented two spaces
22:54:06<fracture>same line as the } ?
22:54:07<Gracenotes>perhaps using an Exception is best there, but even so, you do have to explicitly catch it in IO
22:54:15<fracture>and... } in column 0 or indented?
22:54:20<Cale>fracture: I usually close the brace on the line above.
22:54:24<fracture>ah
22:54:33<Cale>data Foo = Asd { name :: String,
22:54:50<Cale> age :: Integer }
22:54:58<Cale> deriving (Eq, Ord, Show)
22:55:05<Gracenotes>which seems a bit of a 'smell' to me, especially when most of the algorithm doesn't even involve IO
22:55:12<hatds>mm.. I don't know. If you are building an IO () action sometimes you want to just bail out without throwing an error
22:55:15<fracture>thanks Cale
22:55:24<Cale>Gracenotes: Hmm, or a different monad.
22:55:54<Cale>Gracenotes: Or you need to write a function which captures the particular kind of escaping which you're doing.
22:55:56<DrSyzygy>data Foo = ASL { age :: Integer, sexIsFemale :: Bool, location :: (Float, Float) } deriving (Show)
22:56:10<DrSyzygy>We are, after all, on IRC.
22:56:19<Cale>I suppose I'd need to see an example to show how to do it.
22:56:35<Cale>I think if a function starts getting nested really deeply, it's time to break it up though.
22:56:37<Gracenotes>Cale: the kind of escaping is just, if this number is odd or if three numbers are not pairwise coprime, abort
22:56:50<Cale>Functions which are long and complicated are hard to comprehend and debug.
22:57:03<Cale>Gracenotes: Then why not put them into one condition?
22:57:17<Berengal>Gracenotes: Maybe and guard?
22:57:21<Gracenotes>it happens at different stages of computation
22:57:35<Gracenotes>I'm talking about my implementation of Shor's algorithm, incidentally
22:57:43<Cale>Do you have the code for that?
22:58:28<Cale>nominolo: Oh, btw, that looks like you have an incompatible version of SDL to me. At least, that's my first guess.
22:58:55<Cale>nominolo: That is, an incompatible version of the C library compared to what the binding is expecting.
22:59:08<Gracenotes>the type was incidentally, shor :: Int -> IO (Either String (Int, Int))
22:59:27<nominolo>Cale: hm, I have several installed
22:59:37<Cale>Gracenotes: Hmm, is there a good reason for IO?
22:59:51<Gracenotes>Cale: randomness
22:59:57<Gracenotes>required at several points
23:00:00<Cale>Oh, I wouldn't have chosen IO for that...
23:00:02<pumpkin>MonadRandom?
23:00:18<Gracenotes>perhaps, but same problem with block structure
23:00:41<ray>pass in a StdGen? (note: i don't know how haskell randomness works)
23:00:53<Cale>ray: Exactly my second suggestion.
23:00:54<Gracenotes>and perhaps the more "logical" approach would be IO (Int, Int), and just throwing an exception when something happens, and using try
23:01:01<Cale>(after using a Rand monad)
23:01:15<Cale>That would be something you can do since you're in IO
23:01:22<nominolo>Cale: also, haskell's SDL lib isn't very specific about which version it expects
23:01:26<Gracenotes>again, I consider that a bit smell-ish
23:01:28<Cale>nominolo: yeah...
23:01:31<Gracenotes>well, the stdgen would need to be used twice
23:01:41<Gracenotes>and again, the block structure problem still exists :)
23:02:10<Gracenotes>anyway. Where did this start? >_>
23:02:13<Cale>It's possible to split a StdGen if you have something doubly/multiply recursive.
23:02:27<hatds>basically you want the C equivalent of break;/return; ?
23:02:32<Cale>I'd be curious to see this code.
23:02:42<Cale>Chances are, I would just do it the way I described.
23:05:05<Berengal>RandT Maybe?
23:08:45<BMeph>Cale: Think you could suggest a way to get my functions working? My latest attempt is at: http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=5168#a5171
23:09:58<DrSyzygy>*snerk* >>> I use emacs, which might be thought of as a thermonuclear word processor. . .
23:10:45<ray>emphasis on the thermo
23:11:55<BMeph>ray: I'd put the emphasis on "nuclear," myself. ;p
23:12:10<pumpkin>*nukular
23:12:17<ray>if it were just nuclear, it'd be clean and efficient
23:12:35<ray>thermonuclear implies boooooooooooooooooooooooooooooooooooooooooooooooooooooooooom
23:12:38<BMeph>ray: ... uh, sure it would. ;)
23:14:35<BMeph>Emacs: The thermonuclear word processor. For when you *Never Want to See your Documents Ever Again!*
23:15:33<tetha>hehe. "Emacs: horribly mutates your documents, and you dont even have to mash weird key combinations to make it do so, because its nuclear!"
23:15:35<BMeph>Cale: When I get this thing up and running, I'll likely spend an hour on trying to write a good explanation on how it works... ;p
23:23:18<FunctorSalad><3 emacs viper-mode
23:23:30<LeoD><3 vim normal mode
23:24:16<tetha><3 any editor I can forget while using it
23:24:23<FunctorSalad>but emacs has more stuff ;o
23:24:28<Raynes><3 emacs in general.
23:24:55<tetha>but in fact, I am kind of switching back and forth.. going to vim if the urge for vim's easier interface is there, and switching back to emacs if the stronger auto-indent calls
23:25:02<BMeph><3 Everything not Komodo... ;p
23:25:25<hydo>BMeph: agreed.
23:27:48<Raynes>ACTION is a lightweight. Anticipating EclipseFP's renovations.
23:28:58<Gracenotes>well, that was some delicious dinner
23:33:28<Raynes>I smell of Axe Vice and Monads.
23:34:45<Badger>heh
23:35:47<BMeph>Raynes: Axe Vice? Is that what hoplds the head in place while you sharpen it? ;p
23:35:53<BMeph>*holds
23:36:16<Raynes>BMeph: The body spray. But close enough.
23:36:18<Raynes>._.
23:36:23<hatds>hmm.. should 'up' in a text editor move you up a logical line or a word wrapped line?
23:37:44<FunctorSal>hatds: you remind me I need to set this to "wrapped line"
23:38:08<hydo>Ack... I've been trying to use textmate and it's nice, but emacs + haskell-mode + flymake keeps me coming back every time.
23:38:22<hatds>FunctorSal: are you saying you prefer the later?
23:39:00<FunctorSal>hatds: yes, I always get lost in wrapped lines with my emacs's current setting, which is the former :-(
23:41:20<Axman6>i don't have any issues with textmate and haskell
23:41:22<FunctorSal>global-visual-line-mode, it seems
23:42:55<hydo>I don't have issues per se, it's just that flymake is really nice. Though it was a pain in the sack-region to configure.

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