00:00:00 --- log: started haskell/07.09.14 00:01:03 --- quit: coffeemug (Remote closed the connection) 00:01:18 huh you can't make it tell you which parser it errord in can you? 00:01:31 I don't think that would be possible. 00:01:59 you mean if it's stuck in an infinite loop? 00:02:05 @type Text.ParserCombinators.Parsec.() 00:02:10 Couldn't find qualified module. 00:02:11 When it says, Parse error:(line 1, column 10): 00:02:18 yes, you can 00:02:25 parsec has powerful error handling stuff 00:02:30 a little complex, but powerful :) 00:02:56 --- quit: ToRA (Read error: 110 (Connection timed out)) 00:03:12 --- join: dc__ (n=dc_@62-31-55-56.cable.ubr01.camd.blueyonder.co.uk) joined #haskell 00:05:30 @type (Text.ParserCombinators.Parsec.) 00:05:32 forall tok st a. Text.ParserCombinators.Parsec.Prim.GenParser tok st a -> String -> Text.ParserCombinators.Parsec.Prim.GenParser tok st a 00:05:44 --- quit: drice (Read error: 110 (Connection timed out)) 00:06:48 --- join: doserj (n=doserj@dewey.inf.ethz.ch) joined #haskell 00:07:24 can now tokenize :D 00:07:34 next to parse intro prolog AST 00:07:55 --- join: amiddelk (n=arie@melinda.cs.uu.nl) joined #haskell 00:11:14 --- quit: cognominal_ (Client Quit) 00:13:20 --- join: Tac-Tics (n=tactics@71.239.99.94) joined #haskell 00:17:41 --- quit: scodil ("Lost terminal") 00:17:53 --- quit: Pseudonym ("using sirc version 2.211+ssfe") 00:19:17 --- quit: glguy ("leaving") 00:20:07 --- quit: ChilliX () 00:24:31 --- join: njbartlett (n=njbartle@cpc2-barn4-0-0-cust110.brnt.cable.ntl.com) joined #haskell 00:25:18 --- quit: dc__ () 00:28:10 --- join: boegel (n=boegel@konijn.elis.UGent.be) joined #haskell 00:31:03 --- join: etnt (n=tobbe@84-55-124-2.customers.ownit.se) joined #haskell 00:35:31 --- join: iblechbot (n=iblechbo@ppp-62-216-197-89.dynamic.mnet-online.de) joined #haskell 00:36:09 --- quit: sjanssen ("Konversation terminated!") 00:36:22 --- join: Ben` (n=Ben@cpc2-hem12-0-0-cust201.lutn.cable.ntl.com) joined #haskell 00:37:05 --- join: ADEpt (n=ADEpt@jabber.hst.ru) joined #haskell 00:37:23 --- quit: Weremanatee () 00:39:57 --- join: IvdSangen (n=ivdsange@s55914d08.adsl.wanadoo.nl) joined #haskell 00:45:24 --- quit: RogerTaylor () 00:47:29 --- quit: fluctus (Read error: 110 (Connection timed out)) 00:47:29 --- join: triplah_ (n=tripped@ppp59-167-101-56.lns3.bne1.internode.on.net) joined #haskell 00:47:38 --- quit: qwwqe (Read error: 110 (Connection timed out)) 00:50:11 --- quit: ivo (Read error: 110 (Connection timed out)) 00:50:18 great, i have a lazy semantics checker, which does not check those types which are not used in a code later on ... what means there can be illegal definitions and I do not catch them :-) 00:50:29 how can I force a parameter of a function to evaluate? 00:50:59 checktypes te ve e = ... -- i would like that te and ve would be strict 00:51:35 @go bang patterns 00:51:38 http://hackage.haskell.org/trac/haskell-prime/wiki/BangPatterns 00:51:38 Title: BangPatterns - Haskell Prime - Trac 00:52:10 I've never used them, I'm not sure if they're actually in ghc yet 00:52:39 If they aren't, there's always seq, though figuring out how to use it is another matter 00:53:14 --- quit: Plareplane (Read error: 104 (Connection reset by peer)) 00:55:08 Though that won't actually help you make your semantics checker report any more errors unless you use _|_ 00:57:34 Mitar: I would be very surprised if bang patterns are the correct way to solve this problem 00:57:58 hmm 00:58:17 so when i am adding new defined types to type environment i check them 00:58:18 --- join: RogerTaylor (n=rogertay@58.186.58.197) joined #haskell 00:58:20 normally the 'type' of the whole program 00:58:29 implies that all the sub parts are typed 00:58:32 in some sense 00:58:34 but the problem is that if i never read this type from the environment it is never checked 00:59:09 you could see this as a disadvantage of the way you use 'error' instead of a proper representatio of failure 00:59:19 if you used a proper representation of failure you could write: 00:59:23 welltyped :: Program -> Bool 00:59:46 Mitar pasted "types" at http://hpaste.org/2741 01:00:07 yes, i do this :-) 01:00:28 but it finds it too early it is OK 01:00:39 for example, in my language this is not possible 01:00:57 as types have recursive loop 01:01:02 well the point is, if you represent errors explicitly 01:01:06 such as with an Either type 01:01:14 then 'welltyped' automaticlaly forces evaluation 01:01:19 since it checks for 'Right' everywhere 01:01:28 yes 01:01:30 i know .. 01:01:30 --- join: Plareplane (n=Plarepla@216-197-152-148.sktn.hsdb.sasknet.sk.ca) joined #haskell 01:01:33 any other way? 01:01:33 and you don't need to mess around with strictness anotations and bang patterns 01:01:47 i will have to mess much more with this ... 01:01:54 (i use error now everywhere) 01:01:59 --- join: Itkovian (n=Itkovian@dragnipur.elis.UGent.be) joined #haskell 01:02:08 and to check now for Either all around ... 01:02:21 and to change to do ... 01:02:34 then you have to write an ugly 'welltyped' which sprinkles 'seq' everywhere 01:02:39 to check for errors 01:03:21 i have to force stricknes only on environment variables 01:03:28 and on just one place 01:03:34 well you could check length t > 0 01:03:40 hmm 01:03:42 since your types are strings 01:03:51 that will force them not to be _|_ 01:04:08 the length of environment? 01:04:23 are bang patterns defined in ghc? 01:04:38 no, the length of the individual type strings 01:04:46 but then you can map that over the whole environment 01:04:54 hmm 01:05:05 what type does your environment have? 01:05:07 Map String String ? 01:05:18 --- quit: njbartlett () 01:05:26 --- join: Saul__ (n=Saul@10-15-ftth.onsnetstudenten.nl) joined #haskell 01:06:36 --- join: QplQyer (n=jeroen@state.ugent.be) joined #haskell 01:06:41 no, [(String,Type)] 01:06:56 where the type is data Type = TyNil | TyUnknown | TyVoid | TyInt | TyString | TyFunc [TypedVar] Type | TyArray Type | TyRecord [TypedVar] | TyVar TypeId 01:06:56 --- join: drrho (n=rho@chello213047112079.11.11.vie.surfer.at) joined #haskell 01:07:02 :-) 01:07:27 maybe i could use a quard for this :-) 01:08:01 typecheck te ve e | forceStrict te && forceStrict ve = ... 01:08:02 :-) 01:09:11 forceStrict = id . ($!) 01:09:11 ? 01:09:21 hm, no 01:09:26 doesn't really work like that 01:09:30 because && is lazy 01:09:46 EVERYTHING is lazy, remember that 01:09:51 :-) 01:10:03 and just using 'seq' on your te and ve will acheive nothing 01:10:12 all that proves is that the list exists 01:10:16 (the list of pairs) 01:10:26 this is why I really don't recommend bang patterns, or seq 01:10:51 I recommend thinking of a function which by executing it obviously requires the types. 01:11:10 (well actually I recommend using a proper error signalling and not abusing error ;P) 01:11:17 even strict things are lazy! Calling them "eager" is a calumny, they're only evaluating because the runtime is breathing down their necks, and they decide it's less hassle to just play along... 01:11:39 lol 01:12:12 you can use deepSeq or rnf if you like 01:12:16 * quicksilver shrugs 01:12:19 I despise them 01:12:22 ;) 01:12:42 ok, what would be the proper error handling? using either? but then I have to either use a monad and rewrite the code into a do notation or use Either and manually pass the error message higher if it comes 01:13:22 you don't have to use do notation to use a monad 01:13:38 > Right 4 >> Right "foo" 01:13:39 Add a type signature 01:13:47 > Right 4 >> Right "foo" :: Either String String 01:13:48 Right "foo" 01:13:55 > Left "oops" >> Right "foo" :: Either String String 01:13:57 Left "oops" 01:14:01 no 'do' in sight :) 01:14:30 --- join: igel (n=igel@brsg-4db2c402.pool.einsundeins.de) joined #haskell 01:15:19 "Right" and "Left" are *terrible" names for "OK" and "Error"... 01:15:21 --- join: int-e (n=noone@td9091a30.pool.terralink.de) joined #haskell 01:15:41 I don't think they're that terrible 01:15:47 but it would be more idiomatic to write 01:15:59 > throwError "oops" >> return "foo" :: Either String String 01:16:00 Right is the right answer. :) 01:16:00 Left "oops" 01:16:17 and Left is the, er, not-right answer? 01:16:43 Mitar: to use 'rnf' from Control.Parallel.Strategies you would, I think, have to derive NFData for your type 01:16:53 Maybe Either should be changed to the Picard monad instead of Maybe. 01:17:03 Picard? 01:17:24 data Picard a b = MakeItSo a | BelayThat b 01:17:29 lol 01:18:02 hah 01:18:31 but at least that indicates some sort of Yesness and Noness, rather than 2 alternatives (which is what Either says to me) 01:18:56 Well, Either is also used to be the sum of two types, so it's got kind of a dual role. 01:19:28 It just happens that the monadic interpretation of Either is error handling. 01:20:19 Be glad they didn't use the category theory (I think) names like Coq. :) 01:20:27 you could use it for nonlocal returns of a fixed type. errors are just a special case of that. 01:20:31 data Either a b = Inl a | Inr b 01:20:40 ChilliX++ # "This is GHC after all, it tries to gently nudge you in the right direction, but if you insist, it happily let's you drill arbitrarily large holes in your foot." 01:21:03 actually I think osfameron is right 01:21:08 I think that Either is a bit generic 01:21:20 and it would make sense to have another (isomorphic) type with better constructor names 01:21:27 but I also don't think it's all that important :) 01:21:29 Yeah, it might be better if there were Error in addition to ErrorT. 01:21:51 It is of course easy enough to define your own 01:21:55 and make it an instance of MonadError 01:24:09 Mitar pasted "Either?" at http://hpaste.org/2742 01:24:25 quicksilver, but even Either is not a solution 01:24:47 Mitar: different problem, I think 01:24:53 --- quit: Itkovian () 01:24:55 Mitar: cyclicity you're going to have to check for explicitly 01:25:03 no no 01:25:03 Mitar: that's different from being too lazy about type errors 01:25:08 i check it in the newenv 01:25:26 and the problem is that because typecheck te ve (IntLit _) = Right TyInt never consultes the te and ve 01:25:32 te' and ve' are never evaluated 01:25:33 --- join: Itkovian (n=Itkovian@dragnipur.elis.UGent.be) joined #haskell 01:26:02 Mitar: the newenv needs to be in the either monad in a similar way 01:26:30 Mitar: then you do (te',ve') <- newenv (te,ve) 01:26:43 Mitar: and that forces it to be right and not left 01:28:28 Using recent ghc snapshot: Is there a easy fix for Network/Socket.hsc:1901:9: Not in scope: `openeFd'? 01:28:54 Change it to "openFd"? 01:31:39 dolio: Sorry. That has been my type. It is openFd 01:31:49 But that seems to be no longer present ? 01:31:56 Oh. I'm out of ideas, then. :) 01:32:17 MarcWeber: you may have better luck on the #ghc channel 01:32:28 MarcWeber: but maybe it's just a broken snapshot. Happens sometimes. 01:34:06 --- join: KatieHuber (n=katie@203-97-111-120.cable.telstraclear.net) joined #haskell 01:34:59 --- part: ADEpt left #haskell 01:35:31 --- join: ADEpt (n=ADEpt@jabber.hst.ru) joined #haskell 01:35:38 MarcWeber: does this help? http://www.google.com/search?hl=en&q=openfd+site%3Ahaskell.org 01:35:39 Title: openfd site:haskell.org - Google Search 01:36:21 I had a similar problem. There's a discontinuity between the POSIX lib and the Network lib. 01:37:23 Thanks! 01:38:22 --- join: qwwqe (n=fluctus@unaffiliated/fluctus) joined #haskell 01:38:22 --- join: fluctus (n=fluctus@dhcp-0-50-f2-7c-be-b7.cpe.mountaincable.net) joined #haskell 01:39:56 --- join: roman (n=shkoder@ll-226.216.82.212.sovam.net.ua) joined #haskell 01:41:49 --- quit: fax () 01:43:25 --- quit: igel ("Leaving") 01:43:46 --- quit: Saul__ (Remote closed the connection) 01:44:14 --- quit: Pupeno (Read error: 110 (Connection timed out)) 01:47:54 --- join: mauke_ (n=mauke@d83-189-123-154.cust.tele2.de) joined #haskell 01:48:09 --- join: chris2 (n=chris@p5B16C1E8.dip0.t-ipconnect.de) joined #haskell 01:50:10 --- join: Rebooted (n=opera@88-104-185-170.dynamic.dsl.as9105.com) joined #haskell 01:50:15 --- quit: QplQyer ("*poef* *roekwolk*") 01:51:14 --- join: dv^1 (i=dv@gateway/tor/x-5507f6bf451e3424) joined #haskell 01:51:26 --- part: Rebooted left #haskell 01:52:53 --- join: b_jonas (n=b_jonas@dsl51B619BC.pool.t-online.hu) joined #haskell 01:53:02 --- quit: gip ("Leaving") 01:53:41 --- join: Qerub (n=qerub@kr-lun-120-155-233-83.3.cust.bredband2.com) joined #haskell 01:53:48 --- join: patrick_ (n=patrick@88-96-27-150.dsl.zen.co.uk) joined #haskell 01:54:29 Does Haskell have any nice syntax for Map literals? Something like { "foo" => 2, "bar" => 3 }? 01:54:31 --- join: ToRA (n=tora@colorado.doc.ic.ac.uk) joined #haskell 01:55:17 I think just 01:55:20 yourmap x = case x of { "foo" -> 2; "bar" -> 3; } 01:55:28 fromList [("foo", 3), ("bar", 7)] 01:56:27 (To answer very literally, Data.Map gets no special syntactical status.) 01:57:54 Qerub: if you want some special syntax, introduce your own operators (functions + fixity decs) 01:58:14 --- part: scook0_ left #haskell 01:58:14 Examples abound, e.g. HaskellDB 01:58:36 Alright! Thanks for the answer. 01:58:39 "=>" is reserved IIRC, but you could use "==>" 01:58:42 or something 01:58:57 (k,v) ==> m = Map.insert k v m 01:59:22 k ==> v = Map.singleton k v 01:59:24 ("foo",2) ==> ("bar",3) ==> empty 01:59:41 I was thinking: fromList ["foo" ==> 3, "bar" ==> 7] 01:59:51 but taruti's idea is nice too 01:59:52 (&) = Map.union 02:00:03 x ==> y = (x,y) 02:00:04 "foo" ==> 2 & "bar" ==> 3 02:00:18 go to town :-) 02:01:33 qerub: ah sorry I totally misunderstand your question. 02:03:17 --- join: seafoodX (n=sseefrie@alphad261.lnk.telstra.net) joined #haskell 02:04:08 --- join: dibblego (n=nobody@220-245-107-64.static.tpgi.com.au) joined #haskell 02:04:46 --- quit: mauke (Read error: 110 (Connection timed out)) 02:05:02 --- quit: dv^^ (Remote closed the connection) 02:05:17 --- join: tuxplorer (i=tuxplore@nat/yahoo/x-264e8c262e363ad0) joined #haskell 02:05:24 --- quit: patrick__ (Read error: 113 (No route to host)) 02:06:04 is there a function in haskell to strip a string of all mysql non-compatible characters and to avoid SQL injection? 02:06:43 that's certainly not really a question for haskell 02:06:49 it's something you'd hope to find in the SQL libs 02:07:19 which db lib are you losing? 02:07:57 --- nick: mauke_ -> mauke 02:08:19 doestn' look like HSQL does 02:08:56 --- join: mr_tenor (n=nick@c220-239-43-146.rivrw7.nsw.optusnet.com.au) joined #haskell 02:08:59 HDBC has a sane design using parameters 02:09:04 so you don't need 'escape' 02:09:11 or that's what cosmicray claims in the docs 02:10:04 I think HDBC is a bit more shiny than HSQL, overall 02:10:07 although I've used neither 02:10:48 --- join: cognominal_ (n=cognomin@62.210.200.99) joined #haskell 02:12:52 HSQL doesn't have parameters? 02:14:20 --- join: slipstream-- (n=irssi@ppp85-140-74-51.pppoe.mtu-net.ru) joined #haskell 02:14:32 osfameron: maybe it does, I didn't look hard enough 02:14:38 osfameron: it seems to be mostly String based though 02:14:44 @paste 02:14:44 Haskell pastebin: http://hpaste.org/new 02:15:24 either way, I don't think I could use a DB system that didn't support placeholders. It's more or less insane. 02:15:45 certainly insane if you have untrusted data 02:15:49 have you looked at haskellDB? 02:15:53 that's a much more interesting approach 02:16:06 not SQL based at all; has its own ADT representation of queries 02:16:12 nope I haven't. is that the queries-as-haskell-data approach ? 02:16:17 that's right 02:16:35 like DBIx::Class in concept, but arguably it's quite a bit easier to get it looking nice in haskell 02:16:51 with a type-system and custom operators and stuff 02:17:21 true. I can vaguely imagine some goodness coming out of that :-) Will play with it at "some point" 02:17:58 --- join: roconnor (n=roconnor@vhe-540354.sshn.net) joined #haskell 02:18:14 --- quit: enolan ("Leaving") 02:18:27 hi, i've 750M tab-delimited database which has to be read in order to populate sqlite3 database. here is python script (not mine) used to grok 10M file, but it cannot handle 750M. what are the prospects of haskell handle it with hdbc-sqlite, ie. can haskell's laziness do the job? 02:18:31 gour pasted "python script" at http://hpaste.org/2744 02:18:50 --- join: njbartlett (n=njbartle@194.42.125.16) joined #haskell 02:19:23 --- join: hkBst (n=hkBst@gentoo/developer/hkbst) joined #haskell 02:20:19 gour: should be fine. it will work line by line 02:20:33 gour: the weak link will be sqlite 02:20:37 (if there is a problem) 02:20:41 not the file import 02:20:50 quicksilver: why sqlite? 02:20:50 I have successfully applied haskell to analyzing 2GB ascii files - the end result was both faster and more readable than the equivalent perl script 02:21:06 olsner: good to know. thanks 02:21:13 gour: well I don't know about sqlite's performance characteristics when you instert 750M of data 02:21:20 gour: so I can't vouch for that 02:21:24 but getting it there required a few tricks... for example, going with ByteString from the start is a good idea 02:21:37 but I *do* know that line by line processing in haskell doesn't require memory 02:21:56 I also know that lazy IO is extremely evil and you should just call hGetLine :) 02:22:00 quicksilver: well, i don't need all the 'fields' from CSV database, so the sqlite3 database will be probably much smaller 02:24:20 --- quit: prb () 02:24:37 lol 02:25:06 quicksilver: I use HSQL-MySQL lib of haskell 02:25:07 --- quit: mrsolo (Connection timed out) 02:25:30 these days I rather use ruby instead of perl for text processing unless I need some perl module (like for xml) -- ruby is not that much slower and it's easier to write programs in 02:26:41 --- quit: RogerTaylor () 02:26:50 --- join: swiert (n=wss@sneezy.cs.nott.ac.uk) joined #haskell 02:26:55 I would argue that haskell is faster then ruby and even easier to write programs in :) 02:27:08 --- quit: c9s_ ("leaving") 02:27:10 I think that ruby is mostly a clean perl5 with batteries included. More useful modules in the core 02:27:12 ruby seems to be a poor middle ground: slower AND less powerful :) 02:27:16 b_jonas: I must play with ruby some time... but Moose is quite cute and gives you some of that goodness (but with CPAN) 02:27:31 It's not relaly clean, it just has dirt in different places than perl5 02:27:43 --- quit: slipstream (Read error: 110 (Connection timed out)) 02:27:43 but yes, the core libraries are indeed more useful 02:27:50 i have to prepare that sqlite3 database for use with another gui program which will be in haskell, so ruby & co. are not alternatives ;) 02:27:58 it's not less powerfool I think 02:28:08 the syntax of reference in Perl 5 is awful 02:28:21 well speaking of power in programming languages is always a bit woolly 02:28:28 since in a technical sense, they are all the same power 02:28:31 obviously 02:28:35 as for haskell, I guess that it must be fine but the learning curve is difficult 02:28:44 when I say 'ruby is less powerful than haskell' what I'm really talking about is abstraction 02:28:48 and expressivity of abstractions 02:29:00 oh, you mean less powerful than haskell 02:29:02 I can agree that 02:29:03 yes 02:29:07 I thought you compared to perl 02:29:10 no 02:29:14 like cognominal_ 02:29:16 sorry 02:29:18 the perl comparison was the 'slower' part 02:29:29 I've done measuremens about their speed 02:29:30 I was saying ruby is slower than perl, but less powerful than haskell :) 02:29:43 which makes it a poor middle ground IMO 02:29:46 it is cute though 02:29:53 and I have no objections to it on cuteness grounds 02:30:03 --- join: tommyd (n=tkeller@85.232.10.50) joined #haskell 02:30:22 that sentence could mean that ruby is slower than perl but faster than haskell and less powerful than haskell but more powerful than perl 02:30:46 I mostly use ruby as a perl replacement with ruby threads really 02:30:52 it doesn't cover much new ground after perl 02:31:10 go python 02:31:20 arf 02:31:25 Sometimes I wish I could say 'list.sort_by { rand } 02:31:31 Whoops, hit enter. 02:31:37 anyway, the result I've got is that ruby wasn't that much slower than perl as I've expected it to be 02:31:43 In Haskell, that is. But it's a small price to pay. :) 02:31:54 * roconnor wonders what units power is measured in. 02:32:02 dolio: I have an obfuscation in Perl that does shuffle with sort thru rand 02:32:10 (why, you could just have a specific shuffle function or something instead of sort_by) 02:32:18 haskell is young.. soon enough it will be 2x as fast 02:32:19 i'm sure 02:32:29 young? 02:32:30 cognominal_: worse, I have a benchmark meditation in perl that compares shuffles 02:32:40 okay. ghc is relatively new 02:32:50 compared to other compilers 02:32:58 b_jonas: Yeah, but shuffling requires a monad for random numbers in Haskell, so it feels comparatively heavyweight. 02:33:07 --- join: Sizur (n=eugene@89.132.150.41) joined #haskell 02:34:10 sub shuffle { map { @_=sort { int (3*rand)-1 } @_ } 0..5 } 02:34:42 Yikes. :) 02:35:34 --- join: twanvl_ (n=twanvl@ip5451f037.direct-adsl.nl) joined #haskell 02:35:53 So, 'int (3*rand)' is something in {0, 1, 2} ? 02:35:57 --- join: zx]treads (n=root@83.212.84.69) joined #haskell 02:36:08 yup 02:36:16 Lovely. :) 02:36:16 b_jonas: url? 02:37:02 You can't do that with every kind of sort function. Some don't like very much rand as a sort criteria 02:37:44 we use a fisher-yates shuffle function in perl 02:38:49 --- join: b_jonas_ (n=b_jonas@dsl51B6190D.pool.t-online.hu) joined #haskell 02:40:40 --- join: LeCamarade (n=revence@217.113.73.39) joined #haskell 02:41:37 dolio: http://www.perlmonks.com/?node_id=533396 is my benchmark of shuffles in perl, it has sory_by rand variants as well 02:41:47 Title: Benchmarking perfect shuffles 02:42:01 cognomial: yeah, that one is a famously wrong shuffle in perl 02:42:20 another one is sort { rand <=> rand } 02:42:53 apart from not giving uniform probability of outputs, these can also segfault older perls that assume the compare function is transitive 02:43:07 at least so I've heared, I've never actually seen the segfault 02:43:26 dolio: could you show me your obfu with sort though? I think it could be interesting 02:43:38 Eh? 02:43:39 It could complement something like my perlmonks.com/?node=fast+japh 02:43:51 'dolio: I have an obfuscation in Perl that does shuffle with sort thru rand' 02:43:55 that one 02:44:05 b_jonas, I see that you like pentominos. Have you seen my obfu that won the tpj contest in its category : solving pentominoes with regexen? 02:44:07 That was cognominal_ 02:44:17 Presumably, the one he posted. 02:44:57 oh sorry 02:45:07 'sub shuffle { map { @_=sort { int (3*rand)-1 } @_ } 0..5 }' 02:45:20 heu it's wrong 02:45:54 --- join: obsethryl (n=lab@unaffiliated/obsethryl) joined #haskell 02:46:19 I am very proud of the tpj writeup http://www.foo.be/docs/tpj/issues/vol3_3/tpj0303-0015.html 02:46:21 Title: The 3rd Annual Obfuscated Perl Contest Victors - The Perl Journal, Fall 1999 02:46:39 First Place. Stephane Payrard's Polyominos - fitting problem solver is very beautiful - eclipsed only by the entertaining reading available in the SOLUTION file. Perhaps it's fitting that such a powerful obfuscatory statement comes from the land that bred semiotics, deconstructionism and Jean-Paul Sartre. Or maybe Stephane is just demented. 02:46:39 I was just pining for the simplicity of 'list.sort_by { rand }' from Ruby, which is commonly used to shuffle (since people probably don't care whether it's perfect or not). 02:46:48 Um ... how do I turn a, say, Char to Integer? 02:46:59 What func? 02:47:08 read maybe? 02:47:13 ord? 02:47:32 That'll give you an Int that you can turn into an Integer easily enough. 02:47:34 fromEnum ? 02:47:49 Oh. How could I forget ord????????? 02:47:58 > (fromIntegral . fromEnum) 'b' 02:47:59 98 02:48:00 fromEnum would be direct, yeah. 02:48:08 :t fromEnum 02:48:10 forall a. (Enum a) => a -> Int 02:48:16 Oh, no it wouldn't. 02:48:36 is that the polymyno puzzle quine one? 02:48:43 I think ord and chr were added to make BASIC programmers feel at home with Haskell. 02:48:54 aaim pasted "Here's another one" at http://hpaste.org/2745 02:49:07 --- quit: njbartlett () 02:49:10 dolio: that one is perfect 02:49:19 :o) 02:49:46 int-e: pascal programmers 02:49:53 basic has ASC and CHR$ not "ord" 02:50:06 b_jonas: I dont know the polyomino quine but I don't read perlmonks much anymore 02:50:15 it's not on perlmonks I think 02:50:25 --- join: SamB_XP (n=Sam@216-15-104-38.c3-0.upd-ubr7.trpr-upd.pa.cable.rcn.com) joined #haskell 02:50:26 b_jonas_: but it's funnier with basic ;) 02:50:27 I think it might not even be in perl 02:50:38 aaim annotated "Look, it does what I want, and it's easy... but isn't this built-in somewhere?" with "(no title)" at http://hpaste.org/2718#a1 02:50:47 --- quit: b_jonas (Read error: 110 (Connection timed out)) 02:51:00 10 REM DON'T LAUGH AT BASIC, OK? 02:51:00 int-e: well, perl has lots of ugly syntax originating from other languages (including sh, tchs, sed, awk) 02:51:03 b_jonas_: Is it? It's been a while since I've used Ruby. 02:51:36 LeCamarade: I'd never. I'm too young to die. 02:51:43 dolio: yes, because sort_by uses the block to calculate keys (weights) for each element and sorts "by" comparing those weights 02:51:55 the element with lower weight gets to be the first 02:52:00 :o) 02:52:24 --- join: ejt (n=ejt@85-211-14-250.dyn.gotadsl.co.uk) joined #haskell 02:52:26 the ruby method "sort" is the one that accepts a comparision function like perl's sort or c++'s sort or c's qsort 02:53:44 LeCamarade: I don't. I laugh at visual basic and esp openofficeorg basic all the stupid new oo basics, but I like the non-oo ones like old zx spectrum basic, commodore basic, gwbasic, qbasic, word2basic, corelbasic etc 02:54:07 after all, basic has one of the funniest quines in existence 02:54:09 10 LIST 02:54:14 eeek, spectrum basic with its lack of functions etc. 02:54:24 As I recall Oleg has an argument that attaching random tags to elements and sorting doesn't result in a perfect shuffle... 02:54:33 I liked bbc basic, that was a real eye opener about the relative power of programming languages... 02:54:36 functions 02:54:39 who needs functions 02:54:45 --- join: c9s (n=c9s@61-223-103-147.dynamic.hinet.net) joined #haskell 02:54:46 gosub is enough 02:55:02 dolio: it depends what kind of tags you attach 02:55:30 the Cormen book discusses that algorithm (also F-Y shuffle) 02:55:53 --- join: RogerTaylor (n=rogertay@123.20.194.118) joined #haskell 02:56:09 if there are no equal tags and they are independent with the same distrubution then it's perfect 02:56:20 (provided they are ordered completely) 02:59:22 --- join: MyCatSchemes (n=rb6822@sevkil.cs.bris.ac.uk) joined #haskell 02:59:25 I wrote buublesort in basic once 03:00:03 b_jonas_: we don't care about the O(n^2), but how *dare* you use such an evil algorithm? :) 03:01:20 --- quit: dibblego ("Leaving") 03:01:59 --- join: gip (n=gpi@SAGW-PRIMARY.ARC.COM) joined #haskell 03:02:09 MyCatSchemes: well, that was ages ago 03:02:15 I didn't know about heapsort at that time 03:02:30 and quicksort or the like is difficult to write in basic 03:02:38 --- join: JaffaCak1 (i=simonmar@nat/microsoft/x-3edf73c69ca2bf7f) joined #haskell 03:02:59 > let bubble (a:b:xs) | a > b = b:bubble (a:xs) | otherwise = a:bubble (b:xs); bubble xs = xs; sort xs = last . zipWith (flip const) xs . iterate bubble $ xs in sort [3,1,2,4,561,0,3,4] 03:03:01 [0,1,2,3,3,4,4,561] 03:03:07 otoh it takes very little code 03:03:35 looks perfectly reasonable to me, what's evil about that? ;) 03:03:39 and if I'd have memoized the result (I only used to to sort font names for a dialog box) then code size would definitely be the primary concern 03:04:10 Oh wait, I'm stupid 03:04:17 I wrote quicksort in basic another time as well 03:04:25 and in that case, speed was a concern 03:04:31 now it was bad in that case 03:04:33 but I was young 03:05:05 --- nick: b_jonas_ -> b_jonas 03:05:42 --- quit: MarcWeber (Remote closed the connection) 03:05:57 (anonymous) annotated "Look, it does what I want, and it's easy... but isn't this built-in somewhere?" with "(no title)" at http://hpaste.org/2718#a2 03:06:55 int-e: zipWith const to trim one list down to the size of another is an interesting indiom 03:09:02 :) 03:09:50 oh. but it means that the function doesn't work for empty lists. 03:10:07 that wouldn't have happened with the more obvious (!! length xs) 03:10:39 --- join: ivanm_ (n=Ivan@60-242-0-245.static.tpgi.com.au) joined #haskell 03:12:07 why wouldn't it work with an empty list? 03:12:20 > last [] 03:12:32 Exception: Prelude.last: empty list 03:13:20 but quicksilver said zipWith const 03:13:22 "the function" was the sort function above. The zipWith works just fine. 03:13:42 oh, I see 03:13:44 the bubble 03:14:58 bubblesort! 03:15:04 the king of sort routines! 03:15:09 --- join: Igloo_ (n=igloo@chaos.earth.li) joined #haskell 03:19:16 --- join: bvd (n=user@n027182.science.ru.nl) joined #haskell 03:19:39 bubblesort works locally, is therefore friendly to the cache and it is nicely parallisable. What else do you want? 03:20:27 --- quit: JaffaCake (Read error: 110 (Connection timed out)) 03:20:32 well, mergesort has those advantages as well 03:21:03 b_jonas: mergesort isn't truly local 03:21:06 oh, is a parallelised bubblesort efficient? 03:21:07 but I somehow like heapsort better, even though I know it's not good for external sort 03:21:14 b_jonas: it works back and forth between two copies 03:21:28 --- join: njbartlett (n=njbartle@cpc2-barn4-0-0-cust110.brnt.cable.ntl.com) joined #haskell 03:21:28 Mergesort requires twice as much RAM as there is data, you can't do it in-place. 03:21:34 b_jonas: and it maintains at all times two 'cursors' into the source list 03:21:44 b_jonas: so it's hitting three active memory locations (two read, one write) at a time 03:21:46 --- join: pedro_dgv (n=pedro@42.Red-217-125-2.staticIP.rima-tde.net) joined #haskell 03:21:50 which can be pretty widely distributed 03:21:56 quicksilver: it's not local if you have one tape, sure, but it's still cache-local or can be done externally with a few tapes 03:22:04 --- quit: boegel (Read error: 110 (Connection timed out)) 03:22:08 are you programming one-tape turing-machines or what? 03:22:21 no, we're programming on modern CPUs 03:22:30 but we're sorting lists so big they don't fit in the cache 03:22:34 at least, I assume that's the point :) 03:22:34 yep 03:22:46 but the cache can do two locations pretty fine 03:22:57 Modern CPUs have a megabyte of cache apiece. How often do you sort lists bigger than, say, 128x2^10 items? 03:22:57 (it's two not three but that's a minor point) 03:23:31 b_jonas: don't forget to count the stack for all those nifty recursive calls. 03:23:53 MyCatSchemes: recursive calls? you're thinking of qsort. mergesort doesn't have those. 03:24:22 non-inplace is true 03:24:25 you're right 03:24:46 I like heapsort which is inplace, but it's obviously really bad for localty 03:24:54 the traditional encoding of mergesort is recursive 03:25:17 of course it's possible to unwrap it with an extra variable for 'current sublist size' 03:25:46 MyCatSchemes: if you're not sorting something bigger than the cache, then you probably don't care about performance 03:25:50 MyCatSchemes: it will be fast anyway :) 03:27:00 --- quit: Igloo (Read error: 110 (Connection timed out)) 03:29:21 --- join: ptx (n=ptxmac@0x5550c853.adsl.cybercity.dk) joined #haskell 03:30:27 quicksilver: not with bubblesort :) 03:30:34 quicksilver: nor with bogosort. 03:31:35 I believe bubblesort is actually the sort of choice when sorting nearly-sorted data ? 03:33:22 osfameron: only if it's already almost-sorted to some ridiculous extent. And mergesort also tends towards O(n) in nearly-sorted data, too. Methinks insertion sort does as well, and that's always faster than bubble except under really contrived circumstances anyway. 03:35:24 yeah, I can imagine that 03:37:21 MyCatSchemes: merge sort generally has a really bad constant 03:37:45 MyCatSchemes: it's a very SLOW O(n log n), and it's also a SLOW O(n) on nearly-sorted data 03:37:49 but on the other hand it's stable 03:37:56 which is important for lots of applications 03:38:06 --- quit: dolio (Read error: 104 (Connection reset by peer)) 03:38:11 --- quit: njbartlett (Read error: 104 (Connection reset by peer)) 03:38:11 --- quit: petekaz (Connection timed out) 03:38:12 --- join: dolio (n=dolio@nr5-216-196-210-207.fuse.net) joined #haskell 03:38:23 insertion is fastest on nearly-sorted, isn't it? 03:38:49 and if you squint a little bit, you can see insertion on nearly-sorted data as a kind of "obvious" improvement to bubble-sort 03:39:00 "skip out of the bubble if this bit's already in the right place" 03:40:24 --- join: matt__r (n=matt__r@CPE-121-209-187-24.nsw.bigpond.net.au) joined #haskell 03:42:16 --- nick: ivanm_ -> ivan_m 03:43:04 --- nick: twanvl_ -> twanvl 03:45:57 --- quit: goalieca ("(sleepy time)") 03:48:08 --- nick: ivan_m -> ivanm 03:50:02 apart from being easy to code, quicksort has another area where it pwns all other sort kinds 03:50:59 namely when you want to partition a list of length n to the k lowest and (n-k) highest data for a given k, then a modified qsort (which is not recursive just tail recursive) wins 03:51:23 --- join: xtacy[] (n=xtacy[]@203.199.213.72) joined #haskell 03:51:37 "not recursive just tail recursive"? Do you mean the other way around? 03:51:38 similarly if you just want the k smallest elements of a list sorted for a given k that's much less than the size of list, then that qsort or a modified heapsort are the two things that win 03:51:58 I mean it's only tail recursive so doesn't need the stack 03:52:07 Ah 03:52:14 so you can very easily do it inplace 03:52:14 i.e. it doesn't need two recursions 03:52:16 yep 03:53:00 aka quickselect. 03:53:00 though there's another complicated algorithm that can do that partitioning and is deterministic 03:53:34 its the median of 5 method... very innovative :) 03:54:07 yep 03:54:11 probably called like that 03:54:30 c++ calls the task (not either algorithms just the specs) some wierder name 03:54:32 I can't remember 03:54:42 Ideally we would like to have the pivot to be the median, and order statistics (kth smallest/largest selection) can be done in O(n) . So, your recurrence relation looks neat! 03:54:44 uh huh, nth_element 03:55:17 --- join: boegel (n=boegel@konijn.elis.UGent.be) joined #haskell 03:55:17 yep, O(n) and can be done externally in that time as well 03:55:24 so it's well cache-wise 03:55:55 ? could you clarify your last statement? 03:55:55 --- quit: dolio (Read error: 104 (Connection reset by peer)) 03:56:55 --- nick: zygen_ -> Zygen 03:57:18 I mean, it's fast on modern cpus with cache, because it does ordered access to the memory not random access 03:57:32 --- nick: Zygen -> zygen 03:57:48 when I implemented the randomized one, I called the function "quantile" for that both starts with q and means what I acheive 03:57:51 --- nick: zygen -> Zygen 03:58:13 :) yeah, right. Thats why quicksort is in some sense better than heapsort! (2*i and 2*i+1 are far, compared to i) 03:58:25 quicksort is the most beautiful sort 03:58:50 bottom up merge sort is also pretty. 03:59:02 xtacy[]: for that problem yes 03:59:03 which is the sorting algorithm that is easiest to work with, for proving correctness? 03:59:16 but for partial_sort heapsort is better for it can do everything in one pass 03:59:30 --- join: Saul__ (n=Saul@10-15-ftth.onsnetstudenten.nl) joined #haskell 03:59:34 --- join: dolio (n=dolio@nr5-216-196-210-207.fuse.net) joined #haskell 03:59:39 so it's quite fast for external data if the result fits in memory 03:59:40 xtacy[]: hard to say. selection sort? 03:59:46 faster than that qselect thing 04:00:04 int-e: hmm, insertion sort too. 04:00:29 are we developing metasort here? 'my sort is bigger than your sort' 04:00:29 int-e: What could be the invariant in quicksort? hard to think of 04:00:39 Sizur++ metasort 04:01:17 xtacy: it's easy: the invariant is that qsort returns its input sorted and calls itself only for smaller arrays (so it's finite) 04:01:26 --- join: ChilliX (n=chak@c220-239-39-75.rivrw7.nsw.optusnet.com.au) joined #haskell 04:01:41 the second one is trivial and the first one you prove by induction over the size of input 04:02:59 b_jonas: in that case, this invariant holds good for merge sort too! 04:03:14 xtacy[]: yes, but it's more difficult to prove 04:03:28 here this invariant is really not an "invariant" but an "induction statement" 04:03:32 which you use in the proof 04:03:52 --- quit: gour ("Haribol-Chat") 04:04:46 --- join: gkr (n=notme@200-127-242-48.cab.prima.net.ar) joined #haskell 04:04:48 b_jonas: right, but even in insertion sort, we have "P(i): array[1..i] is sorted". So, after execution of the inner loop, "P(i) => P(i+1)". 04:04:54 --- join: radiohead (n=andreig@openbsd-box.org) joined #haskell 04:05:00 b_jonas: some form of induction :) 04:05:03 --- quit: cognominal_ (Client Quit) 04:05:07 sure 04:05:18 --- nick: pgavin-away -> pgavin 04:05:21 that sounds like a nice way to prove for mergesort 04:05:29 I didn't say qsort is the easiest to prove 04:05:31 --- nick: radiohead -> OpenBSD_ 04:05:40 --- nick: OpenBSD_ -> _OpenBSD_ 04:05:46 just answered your question about quicksort 04:05:58 b_jonas: :) 04:06:05 --- nick: _OpenBSD_ -> dnme 04:06:08 --- part: tuxplorer left #haskell 04:06:49 * xtacy[] leaves to have a cup of tea 04:08:47 --- join: njbartlett (n=njbartle@cpc2-barn4-0-0-cust110.brnt.cable.ntl.com) joined #haskell 04:08:50 --- join: EvilTerran (n=Irrel@cpc5-broo4-0-0-cust230.renf.cable.ntl.com) joined #haskell 04:11:30 @go oleg hlist 04:11:34 http://www.cwi.nl/~ralf/HList/ 04:11:34 Title: Strongly typed heterogeneous collections 04:15:12 --- quit: b_jonas ("Leaving") 04:15:24 --- quit: LeCamarade (Read error: 113 (No route to host)) 04:15:56 --- quit: KatieHuber () 04:16:54 --- join: Andris (n=Miranda@80.233.159.254) joined #haskell 04:17:35 --- quit: iblechbot (Read error: 104 (Connection reset by peer)) 04:17:42 --- quit: gkr (Read error: 104 (Connection reset by peer)) 04:18:19 hello, #haskell! looking for a little-dependencies (preferrably standard) way to load png/gif in haskell (want to play with some image processing). any pointers? 04:19:28 might be something under http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Graphics 04:19:31 http://tinyurl.com/yqov7f 04:19:55 GD? 04:20:41 --- join: mornfall_ (n=mornfall@rb4b151.net.upc.cz) joined #haskell 04:20:42 iirc, the GD binding's incomplete, but it might do what you want 04:21:04 --- join: Dybber (n=dybber@0x3e42d1c0.adsl.cybercity.dk) joined #haskell 04:21:11 EviltTerran, thanks, will check it out; I actually was working through this list already :) 04:21:37 but probably have chosen wrong evaluation strategy :) 04:22:06 --- quit: mornfall (Read error: 113 (No route to host)) 04:22:26 I believe there isn't a really good graphics loading lib yet 04:22:33 i've no experience with SDL, but that also might have something. i dunno. 04:22:34 certainly laast time I looked properly there wasn't 04:22:36 gtk2hs can do it 04:22:42 as part of a gtk application I believe 04:22:53 what's considered a good image loading lib in the C world? 04:23:00 imagemagick? 04:23:00 the trouble is, I want it clearly cut - no 3D, no windowing, just file ops and pixels 04:23:17 scook0, i think GD's fairly standard in that respect. i may be wrong, tho. 04:23:19 gd looks ok from the spec 04:23:40 * EvilTerran was thinking about writing bindings to allegro (alleg.sf.net), which he's used for image processing in C, but that's a general-purpose "game development" library 04:24:17 --- quit: ivanm (""had enough"") 04:24:36 btw, what's the modern way of installing packages under GHC? I wonder what this Cabal is about - how is it better than just grabbing the tarball? 04:25:25 it's been suggested several times that a binding to imagemagick 04:25:37 (or that fork of imagemagick) 04:25:40 woudl be a nice thing to have 04:25:46 but no one has stepped up to the plate 04:26:10 hm. what OS are you on, Andris? Cabal streamlines the build process, but it doesn't really work on windows. 04:27:38 --- join: gour (n=Gour@7-89.dsl.iskon.hr) joined #haskell 04:27:47 I am affraid it is Windows 04:28:12 well, is there any hope to manually build these Cabal distros on Windows? 04:28:50 or just untarring is enough? 04:29:16 The normal process with Cabal is untar, runhaskell Setup.hs configure, runhaskell Setup.hs build 04:29:22 (runhaskell Setup.hs install) 04:30:23 yes, it does not work... 04:30:29 i find there's usually an "autoreconf" step after "untar" -- being where windows falls down. 04:30:39 ok, will try some luck with Cygwin then 04:30:44 thanks 04:30:54 it's more likely to work on cygwin, yeah. 04:32:12 btw, what are the reasons not to have such package in pure Haskell? performance or the fact that creating a binding is faster then porting? 04:32:15 than 04:32:58 mostly the latter, I'd think 04:33:13 since it's possible to write C in Haskell if you really want to 04:33:45 Although it's rarely a good idea. :) 04:34:02 DRMacIver: well, it can beat writing C in C sometimes ;) 04:34:35 what about writing Fortran in Haskell... 04:35:01 stuff like Data Parallel Haskell maybe? 04:35:58 Andris: almost entirely the latter 04:36:05 --- join: BCoppens (n=bartcopp@kde/coppens) joined #haskell 04:36:13 Andris: it's just a lot of work has gone into (e.g.) imagemagick and it would take time to port it 04:36:41 also, a wrapper is probably easier to maintain than a library 04:36:48 assuming the underlying library is maintained 04:36:55 it's rather unusual to actually have a case where haskell performs badly and we can't fix it 04:37:00 scook0: But loses to both C and idiomatic Haskell in performance and doesn't beat writing Haskell in Haskell. :) 04:37:13 altho, once we forked all the functionality into a pure haskell version, we could then work on supplanting the original and getting the C programmers using the haskell one ;] 04:37:21 well, at the moment I just need some way to get pixels from png file into some form operable by Haskell (even [[Int]] will do) 04:38:13 * EvilTerran usually uses an existing program (IrfanView or something) to convert the image to PPM or suchlike, then manipulates the image from that 04:38:20 --- join: igel (n=igel@brsg-4db2c402.pool.einsundeins.de) joined #haskell 04:38:33 well, sounds like a plan 04:38:42 DRMacIver: true -- though one good use case for C-in-Haskell is when mucking about with FFI stuff 04:38:55 Also true. 04:39:01 in the sense that it's easier to write C-in-Haskell than Haskell-in-C (as some other FFI schemes force you to do) 04:39:09 Heh. Yes. :) 04:39:34 actually, I hear even Java has a decent (third-party) FFI these days 04:39:45 --- quit: byorgey ("Ex-Chat") 04:40:19 * EvilTerran is reminded of the pain involved in geting Tcl calling C functions 04:40:30 --- join: Saizan (i=saizan@host-84-223-133-182.cust-adsl.tiscali.it) joined #haskell 04:41:59 --- nick: pgavin -> pgavin-away 04:42:02 the haskell FFI is enviable in its simplicity 04:42:30 and Tcl boast about how easy it's meant to be to do that 04:42:40 scook0: There seem to be 3 semi-ok FFIs for Java at the moment (two open source and one not) 04:42:53 Tcl's a stupid language, anyway. i vastly prefer haskell. =] 04:42:58 I've not really used any of them though. 04:43:25 (and, for scripting, Lua, say, is eminently more sensible than Tcl) 04:43:27 quicksilver: the only problem is that it doesn't do structs (which is Hard) 04:44:09 * EvilTerran could envisage using tuples instead of structs; or record types... 04:44:27 it would be nice to have a lightweight FFI-helper library that can create struct-interfaces dynamically from a struct declaration ... 04:44:28 scook0: right 04:44:37 scook0: there are some like that I believe? 04:44:39 * EvilTerran had assumed there was some way of dealing with structs, actually 04:44:41 greencard? 04:44:42 scook0: have you seen c2hs? 04:44:45 c2hs? 04:44:50 ah, beaten to the punch 04:44:50 --- quit: zx]treads (Read error: 110 (Connection timed out)) 04:44:54 @where c2hs 04:44:54 http://www.cse.unsw.edu.au/~chak/haskell/c2hs/ 04:45:17 can any of them work at runtime? or is there always a precompilation step involved? 04:45:29 precompilation 04:46:06 it should be possible to do stuff at runtime, if you don't mind invoking GCC on the fly 04:46:25 just a matter of actually implementing it ;) 04:46:29 well i suppose you can using hs-plugins after 04:46:53 not sure what you mean by that at all? 04:47:06 presumably the C library you want to interface with you choose at compile-time 04:47:30 --- quit: mr_tenor (Remote closed the connection) 04:47:37 preprocessing adds extra complexity at build time 04:47:53 which is fine in most cases, but sucks if you're trying to do something quick-&-dirty 04:48:24 invoking gcc at runtime adds a LOT more complexity than that :) 04:48:27 IMHO 04:48:30 (my imagined use case is quick one-off bindings, when the library you want doesn't have a proper binding) 04:48:40 right, but haskell has a compilation step anyway 04:48:50 all we're saying is, shove this into the compilation step :) 04:49:00 --- join: mr_tenor (n=nick@c220-239-43-146.rivrw7.nsw.optusnet.com.au) joined #haskell 04:49:01 ok, at some level it's an extra step, because it's an external tool 04:49:11 but step back a bit and 'pretend' c2hs is just part of ghc 04:49:17 now it's just one compilation step :) 04:49:20 in my mind it makes perfect sense, but it's hard to explain adequately 04:49:30 scook0: you know, I have that experience *all* the time 04:49:36 I may have to quote you on that one, though 04:49:48 @remember scook0 in my mind it makes perfect sense, but it's hard to explain adequately 04:49:48 Done. 04:49:54 --- join: ivanm (n=ivan@60-242-0-245.static.tpgi.com.au) joined #haskell 04:50:13 --- join: xtacy[ (n=xtacy[]@203.199.213.72) joined #haskell 04:50:21 --- join: gkr (n=notme@200-127-242-48.cab.prima.net.ar) joined #haskell 04:50:34 * EvilTerran hand-writes the "foreign import" statements if he only needs a couple of functions 04:50:54 EvilTerran: yeah, that's the sort of thing I'm getting at 04:51:07 but it falls over if you want to call functions that deal in structs 04:52:09 e.g. if I want to call nice(2), that's two lines of pure Haskell FFI 04:52:16 in fact, while I'm remembering stuff 04:52:35 @remember ChilliX This is GHC after all, it tries to gently nudge you in the right direction, but if you insist, it happily lets you drill arbitrarily large holes in your foot. 04:52:35 Done. 04:53:02 but trying to call a native function that takes (say) a very simple struct argument requires much more effort 04:53:23 --- nick: JaffaCak1 -> JaffaCake 04:53:52 stuff like c2hs is too heavyweight (imo) for one-off, throwaway FFI 04:53:58 --- quit: Saizan_ (Read error: 110 (Connection timed out)) 04:54:03 --- quit: xtacy[] (Read error: 110 (Connection timed out)) 04:54:12 well it's true that it's annoying 04:54:23 so I imagine a library 04:54:23 --- join: mlesniak (n=mic@elrond.dcaiti.TU-Berlin.DE) joined #haskell 04:54:33 that takes a struct declaration 04:54:36 but a library is the wrong approach 04:54:44 you can't expect to have a header file around at runtime 04:54:53 feeds it to GCC, with some cunningly-inserted offsetof 04:54:55 you've got to fetch the struct defn at compile-time surely 04:55:03 takes the results, and dynamically does peeks/pokes 04:55:14 --- nick: slipstream-- -> slipstream 04:55:35 well, you could precompile the declaration, and just load the offsets at runtime 04:55:43 (or even bake generated offsets into your program) 04:56:13 I understand your "that's the wrong way to do it" stance 04:56:20 reimplement c2hs in TH so it's not a preprocessor?:) 04:56:29 but in my view, any "right" approach is too heavy for the use case I have in mind 04:56:58 --- part: lzfn1 left #haskell 04:58:57 there's also the issue with the runtime approach that a malicious header file could actually segfault your program :) 04:59:03 or worse, allow code injection 04:59:04 --- join: der_eq (n=eq@dslb-088-070-026-048.pools.arcor-ip.net) joined #haskell 04:59:47 you're quite right, of course 05:00:18 --- quit: mlesniak ("Verlassend") 05:00:24 --- quit: RogerTaylor (Read error: 110 (Connection timed out)) 05:01:35 --- nick: tizoc_ -> tizoc 05:03:13 --- join: alags (i=ubuntu@nat/yahoo/x-1e06d666371a7e58) joined #haskell 05:03:51 --- join: tuomov_ (n=nn@a144.adsl.tnnet.fi) joined #haskell 05:04:00 @hpaste 05:04:00 Haskell pastebin: http://hpaste.org/new 05:04:25 tuomov pasted "Bug in 6.6?" at http://hpaste.org/2746 05:04:54 that seems to work in ghc 6.4.2, but 6.6 complains of illegal instance declarations and fundep coverage conditions 05:05:10 @src Error 05:05:10 class Error a where 05:05:10 noMsg :: a 05:05:10 strMsg :: String -> a 05:05:13 known? 05:06:19 tuomov_: 6.4.2 was too liberal 05:06:38 it's insane if that's not allowed 05:06:48 fundeps are beginning to seem worthless. You can't really do anything with them 05:07:08 Little to do with insanity. More a better of when type checking become sundicidable. 05:07:17 just an academic hack that you can't use for real programming... 05:07:30 that's a strange thing 05:07:35 Or more precisely when deciding whether specific declarations guarantee decidable type checking. 05:07:47 so all these real programs out there written in haskell are actually academic hacks then? :) 05:07:53 tuomov_: you can always use -fallow-undecidable-instances 05:08:04 how's that undecidable 05:08:35 tuomov_: The compiler cannot decide whether your declarations lead to potentially non-terminating type checking. 05:08:48 that statement is a tautology 05:08:59 the instance you show for Foo is, incidentally, not relevant to the example 05:09:02 This does *not* mean that they make type checking undecidable. It *just* means the compiler cannot tell, and needs to stay on teh safe side. 05:09:13 tuomov_: which statement? 05:09:18 --- join: tizoc_ (n=user@r201-217-167-234.dialup.adsl.anteldata.net.uy) joined #haskell 05:09:31 that definition of undecidability... doesn't answer my question 05:09:31 --- quit: tizoc_ (Read error: 104 (Connection reset by peer)) 05:09:39 tuomov_: it's not a tautology; there are some programs for which the compiler *can* prove termination 05:09:47 --- join: tizoc_ (n=user@r201-217-167-234.dialup.adsl.anteldata.net.uy) joined #haskell 05:10:02 tuomov_: and the various conditions identify a conservative class of programs for which the compiler can prove it 05:10:07 the compiler fails to prove to itself that your program is decidable 05:10:10 you can turn the conditions off 05:10:17 tuomov_: quicksilver is right 05:10:25 bah, I think I'll just use C 05:10:28 this haskell is worth nothing 05:10:34 tuomov_: good idea!! 05:10:55 it supposedly has a great type system, but in the end it can't do anything 05:11:02 The compiler can't even solve the halting problem, must be worthless! 05:11:02 yeah, I love the multi-parameter type class inference algorithm in C 05:11:06 and you end up writing things as poorly typed as in C 05:11:09 --- join: jfredett (n=jfredett@EULER.WIFI.WPI.EDU) joined #haskell 05:11:13 you do? 05:11:20 i'm doing it wrong then :( 05:11:24 quicksilver: multiparameter typeclasses and fundeps are _worthless_ 05:11:31 they're of no use, because the compiler is too stupid 05:11:36 I've used them in many programs 05:11:40 so they have worth to me 05:11:43 --- quit: dbueno ("Leaving") 05:11:48 everywhere I try to use them, I run into the compiler being too stupid 05:11:49 tuomov_: we clearly must develop more intelligent compilers! 05:11:53 --- quit: gour (Read error: 110 (Connection timed out)) 05:11:55 * ChilliX 's research agenda is set! 05:12:21 it's easier to just stay away, and write poorly-typed code, like C... i.e. just write C 05:12:35 tuomov_: nah, C is for wussies, write assembly! 05:12:46 --- join: gour (n=Gour@17-100.dsl.iskon.hr) joined #haskell 05:13:01 ChilliX: but make sure you use a typed assembly language! 05:13:06 --- join: agoode (n=agoode@2001:4830:1633:0:212:3fff:fe70:6222) joined #haskell 05:13:14 scook0: hehehe 05:13:21 scook0: http://lambda-the-ultimate.org/node/2450 ? ;) 05:13:23 Title: Compositional type systems for stack-based low-level languages | Lambda the Ulti ... 05:13:35 as I understand it, you're hoping that the compiler will take context into account when resolving instances 05:13:36 * Lemmih imagines tuomov_ writing proprietary C code on Windows ME. 05:13:54 I'm not very good at expressing this, but basically contexts work in the other direction 05:14:02 they aren't used to reduce the resolution search space 05:14:20 tuomov_: incidentally, what's your issue with -fallow-undecidable-instances ? 05:14:23 --- quit: tizoc_ (Read error: 104 (Connection reset by peer)) 05:14:24 mr_tenor: more like http://www.cs.cornell.edu/talc/ perhaps 05:14:27 Title: Typed Assembly Language 05:14:33 that thing I pasted is so _trivial_ 05:14:37 --- join: tizoc_ (n=user@r201-217-167-234.dialup.adsl.anteldata.net.uy) joined #haskell 05:14:47 and yet the compiler starts complaining 05:14:48 (I remember there being a chapter on it in ATTaPL, but I don't remember any details) 05:14:59 scook0: ooo 05:15:06 tuomov_: Do you know what the first thing is that I tell my first-year students? 05:15:41 stay away from computers, they suck? 05:15:54 ChilliX: 'When someone says "I want a programming language in which I need only say what I wish done," give him a lollipop.' -- Alan Perlis ? 05:16:05 ChilliX, "Hi, I will be the teacher of this class"? 05:16:12 pejo: lol 05:16:43 Well, actually the first thing is just nonsense like "Welcome to COMPXYZV..." 05:16:47 After that!! 05:16:52 it seems basic Hindley-Milner is the best that can be had; nothing beyond it works well enough to be useful for practical programming 05:17:01 and even Hindley-Milner is a bit too limited for that 05:17:14 tuomov_: ok, I'll tell you anyway ;) 05:17:44 I tell my first-years students that they have to get over the illusion, the propaganda fed to them, that computers are smart. 05:18:14 ah, but computers indeed are as stupid as the people who created them, and people are very stupid, it seems 05:18:17 As really, computers are the most stupid, the most absolutely and incredibly dump things they'll ever come across. 05:18:32 dumb 05:18:40 Imagine a golem with a pen in its hand and a lot of paper... 05:18:51 tuomov_: you are missing the point, computers are inherently dumb (thanks mr_tenor) 05:18:52 I'd go back even further than that, if I were you. 05:19:22 Who said that computer can be not stupid? 05:19:25 ah, but the beauty of computers is that they can be stupid *millions of times a second* 05:19:34 Start from, "Computers are not magic." *Then* progress to, "Computers are not alive, smart, intelligent or sentient." 05:19:41 scook0: indeed, that's their strength 05:19:44 the sort of stupidity that causes consistent logical behavior is something i aspire to 05:20:01 --- quit: kombinator_ ("Leaving") 05:20:16 balodja: tuomov_ complained that ghc is stupid, and I tried to explain that that's less ghc's problem as that of the machine executing ghc 05:20:23 C's type system is actually more expressive, than Haskell's! 05:20:33 for my purposes anyway 05:20:48 it's also unsound 05:20:55 can't even encode the size of a low-level structure in it; C has 'sizeof' 05:21:22 Computers are overgrown calculators, for the most part. 05:21:43 you certainly can encode the size of a low-level structure in haskell 05:21:52 tuomov_: unbelievable! 05:21:59 but the details are more subtle because you're working on a more powerful system 05:22:02 tumov_:sizeof doesn't give you guarantees about anything though 05:22:18 --- join: kaol_ (n=kaol@sammakko.yok.utu.fi) joined #haskell 05:22:19 you don't normally choose to control how structures are stored in memory 05:22:24 because that's not normally useful 05:22:28 if you want to, you can, though 05:22:32 that's very useful for disk access 05:22:43 what you normally want to do, is control how they are stored in disk, or over the network 05:22:53 and that you can do very powerfully in haskell 05:22:53 haskell programs live in their small world that doesn't access the outside world, except through inefficient text streams... 05:22:58 --- part: Andris left #haskell 05:22:59 --- join: smkl_ (n=sami@glubimox.yok.utu.fi) joined #haskell 05:23:05 and that's also not true 05:23:06 (and the support for those is crappy too) 05:23:07 --- quit: alags (Connection timed out) 05:23:13 see, now you're just trolling 05:23:14 tuomov_: may be you not haskell? 05:23:18 you don't appear to know very much about haskell, I'm afraid 05:23:19 at least before you sounded credible 05:23:26 it's a common technique to have the last member in a struct as a sort of placeholder name for memory going off the end of a struct which has been cast... so the 'size" of a "structure" isn't really meaningful as part of a type system 05:23:56 a "struct" is sort of a temporary naming scheme for a random bit of memory 05:24:53 It's overused, but "You can't prove anything about a program written in C or FORTRAN. It's really just Peek and Poke with some syntactic sugar." (Bill Joy) 05:25:06 and how do you calculate the size of a structure from the sizes of the components, automatically? 05:25:10 C does that.. 05:25:24 tuomov_: because C programs care. 05:25:25 mr_tenor: lol @ peek and poke 05:25:39 tuomov_: make it an instance of Binary or Storeable 05:25:43 --- join: CosmicRay (n=jgoerzen@gatekeeper.excelhustler.com) joined #haskell 05:25:50 quicksilver: calculating sizes manually.. 05:25:51 mr_tenor: what, typedef struct { size_t size; foo* data[1]; } foolection; then later { foolection* bleargh = malloc(sizeof(foolection) + (sizeof(foo*)*(n_items_required-1)); ? 05:26:02 :t Foreign.Storable.peek 05:26:06 forall a. (Foreign.Storable.Storable a) => GHC.Ptr.Ptr a -> IO a 05:26:16 mr_tenor: and other (evil, heehee) tricks with arrays on the ends of structs? 05:26:16 :t Foreign.Storable.poke 05:26:18 forall a. (Foreign.Storable.Storable a) => GHC.Ptr.Ptr a -> a -> IO () 05:26:22 tuomov_: not if you use a deriving scheme, no 05:26:35 Clearly, Haskell is a superset of C..got peek and poke! 05:26:37 MyCatSchemes: things like that..also when people build classes andvtablesand inheritance in C :) 05:26:51 ChilliX: it 05:26:51 --- quit: tizoc (Connection timed out) 05:26:56 's true though 05:27:10 --- quit: freddyp (Connection timed out) 05:27:16 mr_tenor: building classes, vtables and inheritance in C probably usually beats the Hell out of using the ones that C++ provides at least half the time, though. ;) 05:27:22 mr_tenor: oh, I don't doubt it 05:27:35 yeah, at least there's only as much magic there as you put yourself 05:27:41 and that's dynamic calculation; so no better than C 05:27:56 --- join: fasta (n=fasta@zonnebloem.demon.nl) joined #haskell 05:28:02 tuomov_: you want to use C. nobody is stopping you. 05:28:09 tuomov_: now you're kind of talking out of you're arse here. 05:28:09 tuomov_: ok, was funny for a while, but don't you want to join #perl now? 05:28:17 I wanted to use Haskell.. but I think it was a mistake now 05:28:29 in the end, you can't express anything any better than in C 05:28:49 the C type system does not tell you anything useful, that's the problem 05:28:53 tuomov_: because if you actually care about exactly what the structures look like on disk, you have to jump through hoops to make sure you're writing the correct endianness and, Hell, integer sizes. 05:29:00 the haskell type system tells little useful 05:29:04 if you know useful things, it's due to YOU andnot the typesystem 05:29:14 --- join: cmarcelo (n=cmarcelo@200.184.118.132) joined #haskell 05:29:15 mr_tenor: it tells you "your program is written in C; it will probably segfault" ;) 05:29:21 MyCatSchemes: and I've tried to encode that in the type system... with little luck 05:29:21 --- join: ubuntu (i=ubuntu@nat/yahoo/x-ccabe33bd6685ee1) joined #haskell 05:29:40 always run into some limitation 05:29:40 tuomov_: why would you need to, realistically? 05:29:50 Is there any problem with calling runInteractive process with a combination of waitForProcess in a loop? It seems that doing it once is OK, but doing it like hundreds of times blows up. 05:29:52 to have something better than C would provide? 05:30:06 but apparently that's not possible 05:30:14 impossibility proofs are nontriial 05:30:21 --- quit: Saul__ (Remote closed the connection) 05:30:33 --- quit: Nucleo_ (Success) 05:30:44 and that's dynamic calculation; so no better than C 05:30:50 dynamic? O_O 05:31:06 tuomov_: use -fundecidable-instances. this option exists precisely because the coverage condition is known to be too strong. but there is no known simple condition on class instances that guarantees termination of type checking and type inference in the presence of functional dependencies that also allows all interesting uses of them. 05:31:17 "No dynamics? We're playing as loud as we can" 05:31:19 It seems, that you know nothing about haskell's types 05:31:43 balodja: It seems, that your comma is erronous and should be taken out and shot. :) 05:31:45 tuomov_: if you can come up with a better one I'm sure people like spj will be happy to hear about it. 05:31:55 int-e: I dont' want to use such options that could make the compiler run into trouble in other places 05:32:09 next time I'm trying to hack something, the compiler just hangs 05:32:57 --- quit: ramza3 (Read error: 104 (Connection reset by peer)) 05:33:03 --- quit: kaol (Read error: 110 (Connection timed out)) 05:33:23 --- part: ubuntu left #haskell 05:33:32 tuomov_: nah, you misunderstand 05:33:50 --- quit: JohnMeacham (Read error: 104 (Connection reset by peer)) 05:33:52 -fallow-undecidable-instances does not mean the compiler is going to loop 05:33:54 tuomov_: it doesn't run into trouble in other places 05:34:09 it just means the obligation of checking that it will not loop is on you (not the compiler) 05:34:10 MyCatSchemes: may be 05:34:17 what's it for then? 05:34:20 tuomov_: if type checking terminates the result will be correct. 05:34:35 tuomov_: for having an a priori guarantee of termination. 05:34:42 --- quit: smkl (Read error: 110 (Connection timed out)) 05:34:49 just what I said 05:34:56 the compiler may not terminate 05:35:09 * wli wonders where the video game people are. 05:35:22 wli: what video game people? 05:35:53 There's a crew of people on #haskell who at least say they want to write video games. 05:35:56 --- quit: njbartlett () 05:36:09 Maybe 2-3 people. 05:36:38 hm? 05:36:40 years ago i wanted to. somehow i ended up pricing financial instruments instead. whoops. 05:36:49 I'm certainly writing a game, for fun. 05:37:01 I probably wouldn't use the phrase 'video game' though 05:37:21 * MyCatSchemes is interested in the idea, but has no fast hardware to play with currently. 05:37:25 quicksilver: i've heard that programming the GBA can be a hoot 05:37:55 wli: I got another honours thesis student hacking Frag 05:37:57 --- join: Nucleo_ (n=Connecti@cpe-68-174-7-169.nyc.res.rr.com) joined #haskell 05:38:03 --- quit: tuomov_ ("Maybe worse (C) really is better") 05:38:04 wli: it;'s going to have an AI! 05:38:42 lambdabot? 05:38:49 mr_tenor: Frag.. 05:39:01 @where Frag 05:39:01 http://www.haskell.org/haskellwiki/Frag 05:39:24 --- join: cognominal_ (n=cognomin@138.208.64-86.rev.gaoland.net) joined #haskell 05:39:24 fasta: i know. i was suggesting that... nm. joke's ruined :( 05:39:34 sigh. in other programming languages, nonterminating compilers are the default. 05:39:43 (I mean C++) 05:39:52 int-e: yeah... 05:40:10 int-e: standard compliant compilers are not 05:40:15 int-e: (C++) 05:40:31 --- join: nomeata (i=nobody@nomeata.de) joined #haskell 05:40:51 fasta: well, anybody can put in a dynamic termination condition 05:41:04 ChilliX: ? 05:41:30 --- quit: ADEpt (Remote closed the connection) 05:41:38 fasta: AFAIK standard C++ gets around the non-termination by statically limiting the unfoldings (or similar) 05:41:49 ChilliX: Yes, I just said that. 05:41:56 I thought a standards-compliant C++ compiler has to be nonterminating (if templates is what you're refering to), whereas most compilers just make sure they run out of stack rather than looping 05:42:21 fasta: well, that's what we call a dynamic termination condition, sorry for being cryptivc 05:42:55 I call some Python program a few hundred times in a loop in Haskell. This fails when I feed ever increasing values to the Python program upto lets's say size X. But when I run the Python program from the command line I can call it with size Y >> X. 05:43:00 What's going on? 05:43:03 but that's not a solution, it's a ludge 05:43:07 kludge, even 05:43:19 ChilliX: who is "we"? 05:43:37 @index catch 05:43:37 Control.Exception, System.IO.Error, Prelude 05:43:45 @t catch 05:43:46 Maybe you meant: tell temp thank you thanks thx time tiny-url todo todo-add todo-delete topic-cons topic-init topic-null topic-snoc topic-tail topic-tell type . ft v 05:43:46 fasta: people like SPJ, Martin Sulzmann and me when we discuss this stuff 05:43:52 @type catch 05:43:54 I think Martin starte dusing this term 05:43:54 forall a. IO a -> (IOError -> IO a) -> IO a 05:43:54 ChilliX: there are 5 hits on Google for that phrase. 05:44:04 ChilliX: so, I don't accept that "definition". 05:44:12 ChilliX: and even less in that context 05:44:13 Okay, I see Frag. 05:44:17 fasta: something like a blocking IO / buffering issue maybe? 05:44:43 --- join: iblechbot (n=iblechbo@ppp-62-216-200-133.dynamic.mnet-online.de) joined #haskell 05:44:45 ChilliX: In fact, I think you misunderstood the concept 05:44:54 fasta: what's the nature of the "failure"? 05:45:01 --- quit: ptx (Read error: 110 (Connection timed out)) 05:45:02 * quicksilver thinks it unlikely that ChilliX misunderstood :P 05:45:02 ChilliX: I see the article where they use it, and it's not the same as you claim it to be 05:45:09 --- join: Pupeno (n=Pupeno@193.120.148.177) joined #haskell 05:45:15 ChilliX: Interesting. 05:45:18 fasta: hahaha - but then "we" write the papers about this stuff at the moment, so don't we get to define the terminology?? ;) (I am not entirely serious, in case that's not apparent) 05:45:25 --- quit: der_eq (Read error: 110 (Connection timed out)) 05:45:48 ChilliX: I was having thoughts on AI because commercial games' AI is so... retarded. 05:45:58 ChilliX: you wrote the article [PS] 05:45:59 Sound and Decidable Type Inference for Functional Dependencies? 05:46:06 wli: I agree "retraded" petty much characterises it 05:46:13 --- join: chessguy (n=chessguy@208.78.145.1) joined #haskell 05:46:14 --- join: der_eq (n=eq@dslb-088-070-025-189.pools.arcor-ip.net) joined #haskell 05:46:29 @type uncurry 05:46:31 forall a b c. (a -> b -> c) -> (a, b) -> c 05:46:34 ChilliX: I don't know your real name, so there's no way for me to know whether you know. 05:46:43 --- quit: cognominal_ (Client Quit) 05:47:00 aha, sorry, http://www.cse.unsw.edu.au/~chak/ 05:47:01 Title: Manuel M T Chakravarty 05:47:09 ChilliX: I vaguely wonder if any of those people have heard of fire and maneuver tactics or similar. 05:47:22 @src uncurry 05:47:23 uncurry f p = f (fst p) (snd p) 05:47:28 wli: which people? 05:47:38 wli: I suspect that commercial game AI isn't crap because they don't work hard on the problem 05:47:45 wli: I suspect it's crap because they have a different goal 05:47:45 ChilliX: The ones who did the AI's for commercial games. 05:47:54 quicksilver: the nature of the failure is unknown to me. I read stdout and stderr of the Python process. I write stderr to stdout to see whether the Python process halts. This does not happen. 05:48:02 wli: their goal is to make the game 'fun' and balance the difficult curve 05:48:04 @pl \f p -> f (f' p) (s p) 05:48:05 (`ap` s) . (. f') 05:48:13 wli: so they cheat without any particular ill-feeling :) 05:48:18 wli: just to get the curve feeling right 05:48:27 wli: hmm, not sure, but I think it is a hard problem (esp given the soft realtime constraints imposed by the framerate) 05:48:32 that's an intelligence of sorts :-) 05:48:46 real soldiers should also optimize for fun! 05:49:00 fasta: do you write to it and also read from it? 05:49:08 quicksilver: no 05:49:22 * quicksilver nods 05:49:26 just read from it 05:49:39 quicksilver: I just call the program and read stdout (and later also stderror) 05:49:40 quicksilver: Well, an obvious thought is to inject errors into the AI "thought process" or find tunables to create sliding scales of combat effectiveness while having tactics that don't bore the living daylights due to trivial exploitability. 05:50:00 the real problem is that a good AI is _VERY_ demanding computationally 05:50:05 wli: true. but it's easier to just cheat until the difficulty curve feels right :) 05:50:30 Sizur: have you ever seen an aimbot? 05:50:32 wli: the most important thing is that the game is easy enough for new players to play the 'first few' levels and challenging enough.. 05:50:37 quicksilver: well, but this only works in games where the human player doesn't get to reap and train much 05:50:43 --- quit: alvarezp ("Superkb 0.10 released: http://superkb.sf.net/") 05:50:45 fasta: you mean it's implementation? 05:50:52 ChilliX: reap and train? 05:50:55 --- quit: sharkk () 05:51:03 quicksilver: it depends on the game 05:51:05 --- join: JohnMeacham (n=JohnMeac@h-69-3-182-212.lsanca54.dynamic.covad.net) joined #haskell 05:51:05 --- join: mkhl (i=mkhl@200-153-181-246.dsl.telesp.net.br) joined #haskell 05:51:06 Sizur: It doesn't need to be a good AI. The tactics just need to be something less idiotic than the things walking right into your blowing them away. 05:51:07 reap = repeat 05:51:10 Creating a "fun" AI is the problem in games. 05:51:13 ChilliX: *nod* 05:51:18 Not something that can crush the human 05:51:34 quicksilver: See the above. The problem is that the AI is so phenomenally stupid it makes the game boring. 05:51:36 ChilliX: I suspect (although it depends what kind of game that we're talking about) they write the AI to make "one play-through" fun 05:51:53 quicksilver: AI that is challanging the first time around just gets rediculous once you practice a bit 05:52:01 --- join: alexeevg (n=gleb@ll-226.216.82.212.sovam.net.ua) joined #haskell 05:52:02 ChilliX: a game which people play over and over again (e.g. a network multiplayer game) ... right... what you just said 05:52:14 quicksilver: exactly 05:52:18 There are games where it's difficult to create an AI for (e.g. Go), but in most games the AI beats the best humans already. 05:52:25 well, my beef is with MMORPGs having no AI at all. that's because they design the game universe to reside on one machine 05:53:06 This isn't really an issue with the AI being super-intelligent. It's more like the AI existing in any nontrivial sense at all. 05:53:35 i.e. the enemies not being so stupid it makes the game boring. 05:53:37 --- join: timlarson_ (n=timlarso@65.116.199.19) joined #haskell 05:53:41 Hi all! I've just built lambdabot and now I'm getting 'Plugin `eval' failed with: IRCRaised Data.ByteString.last: empty ByteString'. Googling has brought only some IRC logs. How to fix it? 05:53:57 wli: you are right, but then there are time issues and pressure to push the product out of the doors 05:53:57 wli: I completely agree; hence, you hav to play humans 05:54:12 Also, when you have AI allies their stupidity really burns you up. 05:54:17 wli: true 05:54:22 wli: true, too 05:54:30 wli: commercial games have tended to focus on domains where that's not very important 05:54:31 wli: clearly you've never played online with *real* humans ;) 05:54:43 scook0: hehehe 05:54:46 scook0: I have. I get slaughtered every time. 05:54:51 wli: because the payoff for getting the AI good is not great compared to the cost 05:55:01 scook0: but the humans improve, well, at l;east some of them 05:55:13 quicksilver: 100% deathmatch with no AI involved whatsoever? 05:55:44 wli: deatchmatch is not even that demanding on an ai, try css 05:55:45 wli: I was thinking more of "adventure" games where you progress from level to level 05:55:47 Actually since I got LASIK my hand-eye coordination and reflexes have been improving wildly. 05:55:57 wli: the "AI" is normally a fixed script 05:56:00 quicksilver: Okay, wat about them? 05:56:08 wli: it's tweaked to catch you out the first time you play that level 05:56:17 wli: but once you work out what the AI is going to do, you're informed 05:56:21 --- quit: Khisanth (Read error: 104 (Connection reset by peer)) 05:56:25 wli: so it is (at worst) 'hard the first time' 05:56:38 and then it's like "well he's going to come around the left of that pillar, so I..." 05:56:42 --- join: Khisanth (n=Khisanth@pool-141-157-247-27.ny325.east.verizon.net) joined #haskell 05:56:44 quicksilver: And a sort of built-in planned obsolescence? 05:56:52 in a way, yes :) 05:57:03 the point is, they don't expect most of their customers to replay 05:57:13 quicksilver: that's current commercial definition of AI, but that's not AI really 05:57:13 so it doesn't really matter, to saleability 05:57:25 Sizur: absolutely, hence the quotes 05:57:30 Sizur: wli: the "AI" is normally a fixed script 05:57:54 wli: since they're not expecting people to replay, they don't spend (waste!) developer time on realistic AI 05:58:03 a simple scripted behaviour with perhaps a little random variation 05:58:05 well, there are AI scripts and there are scripts 05:58:10 is good enough for their customers 05:58:14 that falls under second 05:58:22 --- join: purplepenguins (n=purplepe@penguins.STUDENT.CWRU.Edu) joined #haskell 05:58:26 Sizur, there is no standard definition of AI 05:58:38 Oh, great, let's have a millionth discussion of what AI is. 05:58:42 of course, if they tried to sell a game whose success was entirely predicated on good AI 05:58:47 decision algorithm? 05:58:52 then they'd have more incentive to work on it 05:59:00 but games in that category are quite rare 05:59:06 (perhaps because they're not very good at it :) 05:59:16 AI is very hard 05:59:27 --- quit: Dybber () 05:59:27 There's a reason I don't buy many video games. 05:59:29 good AI, anyway 05:59:32 chessguy: you mean in the game-AI sense, or the AI-AI sense? 05:59:40 --- quit: rickynils ("Lämnar") 05:59:43 Or otherwise that I don't like video games. 05:59:44 wli: why play against computer anyway 06:00:07 Sizur: "why fly a kite, on your own" ? 06:00:08 scook0, uh, choose your poison, i guess 06:00:17 fair enough 06:00:20 Sizur: some activities are just fun. but it's subjective. 06:00:41 Sizur: I have a PSP I play with on the train some times. I just enjoy the games fairly shallowly at their own level :) 06:00:57 e.g., to do truly good AI even at tic-tac-toe is hard 06:01:10 Sizur: Mostly I go in for co-op multiplayer; myself and co-players goofing off playing against the computer as a team. 06:01:31 --- quit: jfredett (Connection timed out) 06:01:48 for some definition of AI which allows for the possibility of making sub-optimal moves for the purpose of tricking the opponent 06:02:05 quicksilver: i play single player only for story, like PlaneScape. the rest i play multiplayer 06:02:18 --- quit: ChilliX () 06:03:36 quicksilver: but you are right, it's alway ssubjective. i just dont see sense in playing against computer 06:04:12 --- join: anne (n=anne@194.204.127.85) joined #haskell 06:04:39 Sizur: yes. you don't play single-player to match your skill against the computer 06:04:49 Sizur: because that's not an interesting contest, in most games 06:04:49 --- quit: agoode (Read error: 60 (Operation timed out)) 06:04:58 Sizur: computer vs player is asymettric, so you play an asymmetric game 06:05:05 Sizur: or, as you said "for the story" :) 06:05:20 --- quit: mr_tenor (Remote closed the connection) 06:05:23 quicksilver: right to the point 06:05:36 which, incidentally, is why it's hard to make a game with good single- and multi-play 06:05:42 because of the asymmetry 06:06:15 yes 06:06:24 and, good games which are both, tend to actualy be different games 06:06:33 they might use the same engine, but still different games really 06:06:38 exactly 06:08:11 computer vs player works in Go (for humans who are poor go players) and chess (for humans who are good chess players) 06:08:19 but most other games are too hard 06:08:30 I'm not sure how the computer fares in poker. Probably poorly. 06:08:36 --- quit: nomeata ("Client exiting") 06:08:47 but go/chess are really more like "deathmatch with bots" than traditional single-player computer games 06:09:01 quicksilver: actually poker AI is at advantage due to lack of emotions 06:09:20 in the sense that the computer is merely substituting for another human 06:09:25 just calculate chances and approach win 06:09:59 Sizur: though you might not be able to exploit humans as well as other humans could 06:10:15 there was an article recently somewhere, talking about a competition of computer against 3 best poker players 06:10:41 --- part: anne left #haskell 06:10:42 --- join: cognominal_ (n=cognomin@138.208.64-86.rev.gaoland.net) joined #haskell 06:10:53 Sizur: but the skill in poker is in judging the other players 06:10:56 their conclusion was that poker algorithm is applicable to business negotiations 06:11:01 Sizur: and I'd think that a computer would be poor at that 06:11:15 (well obviously you do also need to calculate the chances) 06:11:49 poker isn't really a card game 06:12:50 the skill in poker is in being as accurate as you can about your odds (which the computer does really well) and in predicting accurately the times when the opponents fail to play optimally :) 06:13:28 in a sense that computer was not reading human faces for tale-tales, but human always impersonates computer so computer is again at advantage because human's emotions will be as high as against another human (especially when money is involved) 06:13:50 --- quit: seafoodX () 06:13:54 --- part: alexeevg left #haskell 06:14:30 Sizur: but my speculation would be that, in a tournament with players of a wide ability range 06:14:40 Sizur: the good humans would beat the poor humans by a larger margin 06:14:46 than the computer beats the poor humans 06:14:57 because the good humans would read when to bluff and when to call, against the poor humans 06:14:58 --- join: seafoodX (n=sseefrie@alphad261.lnk.telstra.net) joined #haskell 06:15:08 --- nick: Igloo_ -> Igloo 06:15:09 without data, i agree with you. it makes sense 06:15:14 althouhg I could believe that the computer would beat the good human head to head 06:15:23 yeah, that's what I was hinting at before 06:15:25 this is all speculation from my limited experience of poker though :) 06:15:46 (good humans can exploit bad humans better than a computer can) 06:15:54 in poker 06:15:57 What libraries are the games-in-Haskell nutters writing against, anyway? 06:16:01 i think there are two kinds of poor humans to consider: those that don't know the odds and those who are bad at reading others or masking themselves 06:16:05 and in business negotiations 06:16:17 MyCatSchemes: I'm using openGL 06:16:59 nothing stopping you from using putStrLn if you're more interested in the game than the interface 06:17:14 --- join: lasts (n=lastssel@85-218-28-130.dclient.lsne.ch) joined #haskell 06:17:19 itnerestingly, chess engine authors frequently build into their engines the ability to change their play depending on whether they're playing against a computer or a human 06:17:21 quicksilver: GLUT sounds sensible enough for graphics and for mouse and keyboard interface, but that doesn't give you any access to sound or joysticks. :/ 06:17:33 from Verbing to Scheming... that cat's upgrading 06:17:38 MyCatSchemes: I imagine if I get to that point I'll investigate SDL 06:17:39 --- join: oerjan (n=oerjan@hagbart.nvg.ntnu.no) joined #haskell 06:17:50 MyCatSchemes: but I don't care much about sound or joysticks :) 06:18:01 --- quit: Hirvinen (Read error: 110 (Connection timed out)) 06:18:30 olsner: :) 06:19:13 quicksilver: ahhh. That is slightly problematic to me, because I do. 06:19:43 gtk-GLext works 06:19:44 I have a function readu s = fst . head . readFloat $ s. It may crash on empty list, so I'd like to modify it to return Maybe.. What is the best to write this plz? 06:19:59 SDL provides sound and joystick support 06:20:15 @hoogle [a] -> Maybe a 06:20:16 Maybe.listToMaybe :: [a] -> Maybe a 06:20:16 List.find :: (a -> Bool) -> [a] -> Maybe a 06:20:21 gip: write a version of head which returns a maybe 06:20:26 gip: or, use listToMaybe 06:20:29 gip: which that is :) 06:20:34 i'm much more concerned with haskell lacking i18n and a good IDE to integrate literate, annotated, testable, interactive code 06:20:36 then change your fst to a 'fmap fst' 06:20:42 Are there Haskell bindings for SDL, I wonder? Though presumably it wouldn't be intractable to write them, I do not actually have a clue how. 06:20:42 @type listToMaybe 06:20:44 forall a. [a] -> Maybe a 06:20:46 @src listToMaybe 06:20:46 listToMaybe [] = Nothing 06:20:47 listToMaybe (a:_) = Just a 06:20:54 > let hack ~(x:y)=(x:y) in fix (show.map ord.hack) 06:20:57 "[91,57,49,44,53,55,44,52,57,44,52,52,44,53,51,44,53,53,44,52,52,44,53,50,44... 06:20:57 ugh, that's a bad name 06:20:58 gip: so it becomes fst `fmap` head . readFloat $ s 06:20:58 --- quit: chris2 ("Leaving") 06:21:02 MyCatSchemes: pretty sure there are 06:21:10 quicksilver : thanks, exactly what I need 06:21:15 @t fst `fmap` listToMaybe . readFloat $ s 06:21:15 Maybe you meant: tell temp thank you thanks thx time tiny-url todo todo-add todo-delete topic-cons topic-init topic-null topic-snoc topic-tail topic-tell type . ft v 06:21:19 :t fst `fmap` listToMaybe . readFloat $ s 06:21:21 precedence parsing error 06:21:21 cannot mix `fmap' [infixl 9] and `(.)' [infixr 9] in the same infix expression 06:21:24 Oh hey, hsdl.sf.net 06:21:29 Awesome. 06:21:29 :t (fmap fst) listToMaybe . readFloat $ s 06:21:31 Not in scope: `s' 06:21:32 @type fmap 06:21:34 forall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b 06:21:38 :t \s-> (fmap fst) listToMaybe . readFloat $ s 06:21:40 Couldn't match expected type `(a, b)' 06:21:40 against inferred type `Maybe a1' 06:21:43 grr 06:21:44 I suck 06:21:49 :t \s-> (fmap fst) . listToMaybe . readFloat $ s 06:21:50 at last ? 06:21:51 forall a. (RealFrac a) => String -> Maybe a 06:21:54 yay :) 06:22:01 :) Great 06:22:01 Hmmmm. "Very incomplete", as of 2006-05-22. :/ 06:22:16 MyCatSchemes: yes, it is hsdl I was speaking of, but I wasn't sure if it was usable 06:22:28 --- quit: vincenz (Read error: 104 (Connection reset by peer)) 06:22:46 mrd: gtk-GLext is less interesting to me until gtk has native OSX support 06:22:51 mrd: although it would be an option 06:22:52 Well, my thoughts on game AI are not actually particularly advanced. Just bonehead squad tactics, simple things like peeking around corners, ec. 06:23:09 --- quit: chessguy ("Leaving") 06:23:18 First and foremost taking up positions. 06:23:41 wli: it would certainly be fun to have a system in which you could experiment 06:23:57 wli: at the moment, it's about 5 man-years of work to make a state-of-the art team FPS 06:24:07 wli: which is a long time to wait before you can try out AI experiments :) 06:24:28 quicksilver: you mean a game without graphics? 06:24:35 quicksilver: Which is why I was sort of hoping there was already a game out there. 06:24:44 fasta: I'm not sure really. Maybe simplistic graphics to represent the state of the world 06:24:55 5 man-years sounds way low 06:25:06 fasta: but with more of a focus on providing a test-bed for AI experimenation 06:25:07 wli: quake supports scription, doesnt it? 06:25:14 scripting* 06:25:16 mrd: that's what one of the unreal engine 3 devs told me 06:25:27 quicksilver: usable? In a word, "no." 06:25:28 is he counting making the engine and the art etc 06:25:33 mrd: of course man-years are a bit mythical :) 06:25:36 quicksilver: oh, building just an engine is not the most work. 06:25:45 mrd: not really sure. I think he just meant the engine and the tool suport 06:25:47 quicksilver: the short version (as opposed to the one-word version) is, "Nope, not nearly." 06:25:49 most good games have been going for years of development by many people 06:25:51 quicksilver: e.g. the Q3 engine can be used today. 06:25:54 mrd: the tools are massively important 06:26:04 --- join: jfredett (n=jfredett@wsc-209-239-198-247.worcester.edu) joined #haskell 06:26:07 fasta: that's true. But I wonder if it is a good basis for the kind of thing wli wants 06:26:09 there are excellent 3d engines already available, why build from scratch 06:26:11 fasta: (I don't know the answer) 06:26:32 like BioShock, which uses the Unreal 3 engine, but was in devel for over 2 years anyhow 06:26:45 I don't know if, for example, Q3's physics engine makes assumptions which are unhelpful 06:26:51 or uses annoying data structures 06:26:52 quicksilver: longer versions include, for example, "This HSDL thing? Not even nearly *resembling* a state of readiness. I mean, crikey on a stick, ladies and gentlemen, this thing's makefiles assume that you're on Mac OS X and using ghc 6.0.1 *exactly*." 06:27:12 MyCatSchemes: there is also HsSDL 06:27:22 MyCatSchemes: I don't know if that's any closer, or if it's further away 06:27:27 Lemmih: does HsSDL work? 06:27:38 The problem of AI is that it's not economical to build one on the short term. 06:28:01 Google doesn't have AI, they just solve one problem very good. 06:28:09 the unual solution is to create AI language for your game 06:28:11 --- join: RogerTaylor (n=rogertay@58.186.83.139) joined #haskell 06:28:12 usual* 06:28:37 The amount of hardware Google has, though (assuming low-interconnect speed) will probably be enough to build one, though. 06:29:06 MyCatSchemes: HsSDL looks much more promising to me 06:29:12 the description of the oblivion AI struck me as something pulled out of AIMA. unfortunately, it ended up kinda sucking. 06:29:31 quicksilver: thanks. :) 06:29:34 mrd why was it sucking? 06:29:39 hyped-up game AI tends to disappoint 06:29:52 mrd: i found it quite advanced 06:30:07 --- join: vincenz (n=cpoucet@134.58.253.57) joined #haskell 06:30:12 ever notice how all the NPCs walk down the same path =) 06:30:22 because the user generally never sees half the cool stuff the dev is aware of 06:30:26 it results in logjams and collisions in the imperial city 06:30:26 hyped-up anything tends to disappoint? :) 06:30:39 heh, true 06:30:43 and what's happened to oblivion for PSP? 06:30:46 * quicksilver looks impatient 06:30:50 --- join: jtoy (n=jtoy@c-65-96-150-204.hsd1.ma.comcast.net) joined #haskell 06:30:56 and all the NPCs say the same stuff 06:31:02 mind you if I'm playing PSP on the train, I'm not hacking haskell 06:31:07 oblivion on gameboy? :P 06:31:10 maybe I don't *want* oblivion for PSP 06:31:13 they go to bed at 11 am and wake up and then go right back to sleep 06:32:32 @where hssdl 06:32:33 http://darcs.haskell.org/~lemmih/hsSDL 06:32:50 mrd: you will always find things like this in any kind of AI. you simply dont have enough time to think of everything 06:33:52 Sizur: I would prefer approaches where thinking of everything is not neccessary. 06:34:04 mrd: many times i was designing "the best"(tm) framework for something, and was ending up hacking stuff just to make it work in time 06:34:21 of course, and that's what it appears happened here 06:34:34 Sizur: statistical methods - machine learning, generally. The wonderful thing about machine learning is that you don't have to teach the machine every damn little thing, just how to learn in general. ;) 06:34:52 Sizur: what you just said to mrd reminds me of http://xkcd.com/224/ 06:34:53 Title: xkcd - A webcomic of romance, sarcasm, math, and language - By Randall Munroe 06:35:02 quicksilver: thanks, man. 06:35:04 MyCatSchemes: that's impossible. you can make it learn a specific thing, but never learn in general 06:35:15 --- quit: vincenz (Remote closed the connection) 06:35:51 OCR will never talk to you for example 06:36:21 Sizur: uhhh... well, for example, let it build out state machines by generating them from a genetic algorithm, for example. In theory I bet you'd end up with ant-colony-like behavoir every time. 06:36:41 quicksilver: yeah i saw that one earlier and loved it :) 06:36:55 Sizur: oh, I'm not thinking of strong AI here, Christ no, waaaaay too much work. Just enough weak-AI-fakery that you'd be able to let it run the opposition in a video game. 06:37:36 --- quit: Shimei (Connection timed out) 06:38:26 MyCatSchemes: point is you cannot make AI that will comeup with something outside of it's domain 06:38:47 --- nick: tizoc_ -> tizo 06:38:50 --- nick: tizo -> tizoc 06:39:30 MyCatSchemes: that you you must design it to solve a specific problem you have in mind. 06:39:44 Sizur: a) that's strong-AI talk, which is to say, too damn difficult to be worth attacking directly right now and b) videogames are pretty strictly bounded. 06:40:24 oblivion is way out there 06:40:43 it's a reality simulation attempt 06:41:08 Yes, and? I'm just saying that, if your problem is, "come up with viable strategies for wiping out human opponents in videogames," something like a messy-GA to generate state machines would probably work really well. 06:41:59 It's bounded, it's feasible. It's also really really cool and it tends not to get tripped up by excessively clever players. 06:42:10 ok, but variate your path for local optimums, have a sleeping "urge", these things must be defined in the first place 06:42:15 * olsner envisions a shoot-em-up/procreation game with AI players 06:42:16 --- quit: boegel ("This computer has gone to sleep") 06:42:42 --- join: boegel (n=boegel@konijn.elis.UGent.be) joined #haskell 06:42:58 --- quit: boegel (Client Quit) 06:43:45 --- quit: RogerTaylor () 06:44:03 Sizur: I understand your point about needing to define the "urge" in the first place - in videogames you can just use the usual scoring mechanism for that, luckily enough. 06:44:06 olsner: we already have "shoot-up/procreation" AIs, but we call them pop stars 06:44:44 the reverse turing test - is it an AI or a dumb human? 06:44:46 I'm not sure I buy the "intelligence" part 06:44:47 Sizur: but what do you mean by, "variate your path for local optima"? If you're saying what I think you're saying, then that's already an intrinsic property of most heuristic searching methods anyway. 06:45:07 MyCatSchemes: my argument was aimed to explain why mrd thought oblivion's AI fell short 06:46:06 i meant in in a specific scenario as to why NPCs in Oblivion all walk seemingly similar paths leading to congestion in a populated area and why most NPCs go to sleep at specific times 06:46:13 Sizur: ah, I see. What did you mean by path variation, though? I just wanna check I wasn't misunderstanding you there. 06:46:36 not in Graph Theoretic sense 06:47:23 Ohhhhh, right. 06:47:51 simply there's no way to make any AI comeup with stuff like that on it's own 06:49:33 Well, if you attacked that specific problem - congestion - by giving each actor its own little heuristic engine for finding efficient paths simply by trying different paths sort-of-randomly to see which is most efficient, they'll tend to solve it over time, eventually. 06:50:03 yes if you have enough time to tackle that, sure 06:50:44 in a reality simulation there will always be things that are far from approximating reality. 06:50:50 Sizur: mmmhmmm. Bring thirty or fourty xboxen into your development studio and run these algorithms for a few straight days to generate the learned-data sets. 06:50:57 ai ... 06:50:58 http://www.imagination-engines.com/ 06:51:00 Title: Imagination Engines Inc. 06:51:19 Then, when you give the game to real players, it'll already have well-tuned AI pathfinding. As if by magic! ;) 06:51:53 MyCatSchemes: yes :) you will solve that problem, but there are infinite others to go 06:52:17 and the scary part: "August 19, 1997, The Creativity Machine Patent Issues the Same Day SkyNet Becomes Conscious." 06:52:35 --- quit: kpreid () 06:52:49 --- quit: Zygen () 06:52:49 puusorsa: what's that other than marketing blurb? 06:53:10 Sizur: sure there are lots, but, Hell, it's not as if you're trying to make the NPCs play Nethack or anything. The game's bounded. So is the set of actions you can perform in it, or would want to. 06:53:34 For neural networks I can read a book and see the algorithm, for this imagination engine, no. 06:53:35 --- join: kpreid (n=kpreid@cpe-24-59-154-165.twcny.res.rr.com) joined #haskell 06:53:37 I thought neural networks were a bit of an AI dead end? Have they actually had interesting results? 06:53:41 but your time and your resources are bounded more strongly ;) 06:53:42 Sizur: plus heuristics like GAs and simulated annealing and the like aren't particularly difficult to write anyway. >> 06:54:32 If this imagination engine was really so smart, why haven't they started a search companay? 06:54:36 company* 06:54:44 fasta, no idea 06:54:49 You can crush Google easily with such a device. 06:55:04 but he seems to be doing stuff for us army 06:55:09 that imagination-engine stuff seems to be very much like a scam or simply wishful thinking 06:55:16 --- join: falseep (n=boo@218.242.117.249) joined #haskell 06:55:28 puusorsa: show me the official books and I made buy it 06:55:36 osfameron: I remember once using a Half-Life bot (closed source, bleh) that apparently used neural networks to train ways of getting around the maps, obviating the need to spend bloody ages manually putting together waypoints (see: botman's bots, for example). 06:55:40 fasta, i'm not selling 06:56:06 (but you can pay me anyway) 06:56:11 puusorsa: I know, I meant "buy this crap from the website) 06:56:15 " 06:56:34 ai, they sell something too? 06:56:40 --- nick: mornfall_ -> mornfall 06:57:00 osfameron: part of the trick there was that, instead of just having the bots work on their *own* attempts and observations, they'd be building their paths by observing human players running around the map. Which means that all the sneaky places humans can get into but aren't neccessarily supposed to (and thus would never have thought to add to waypoint sets) suddenly become useful to the bots, too. :) 06:57:26 @hoogle evaluate 06:57:27 Control.Exception.evaluate :: a -> IO a 06:57:27 Test.QuickCheck.evaluate :: Testable a => a -> Gen Result 06:57:28 MyCatSchemes: cute :-) 06:57:44 --- quit: ivanm (Remote closed the connection) 06:57:58 osfameron: for very specific tasks, yes 06:58:06 osfameron: funnily anough, not really what I'd call "AI" 06:58:15 osfameron: mostly glorified fuzzy pattern recognition 06:58:16 handwriting recognition istr was one of those specific tasks wasn't it? 06:58:22 osfameron: things like OCR 06:58:43 --- join: mattrepl (n=mattrepl@pool-71-246-224-160.washdc.fios.verizon.net) joined #haskell 06:58:46 2.0 Non-Algorithmic Neural Networks (STANNOs) 06:58:49 Mitar pasted "translate to Either?" at http://hpaste.org/2748 06:58:57 Oh, cool, it's "non-algorithmic" 06:58:57 how can I translate this to Either monad? 06:59:08 how can I translate quards to monad? 06:59:30 I know that this could mean something, I just don't think it does in this context 06:59:37 --- quit: Itkovian () 06:59:58 fasta, i don't know how much that makes any sense still they seem to be doing stuff for the military 07:00:21 which doesn't prove anything of course, except maybe that their marketing works 07:00:33 Oh, quick question. How do I get ghc to search specific places inside my own home directory rather than system-wide for libraries? Is there something similar to CPATH, LD_LIBRARY_PATH, etc? 07:00:46 (Please?) 07:01:17 Mitar: change error to fail and add return to the success one 07:01:45 what about guards? 07:01:50 --- quit: dblhelix ("...") 07:02:01 --- join: njbartlett (n=njbartle@cpc2-barn4-0-0-cust110.brnt.cable.ntl.com) joined #haskell 07:02:32 Computer programming, with at least 5 years working experience with 5th generation computer languages such as C 07:02:33 Mitar: perhaps when (condition) (throwError "message") 07:02:35 Hahahaha 07:02:38 there's guard, but it doesn't include an error message 07:02:40 in a do block 07:03:18 fasta: ...5th!!!!? 07:03:30 I think throwError is what's needed 07:03:39 :i ($!) 07:03:43 you could use it to implement a generalised guard if you wanted 07:03:50 how? 07:03:52 Wow, that's nuts. 07:03:56 @src ($!) 07:03:57 Source not found. My pet ferret can type better than you! 07:04:01 MyCatSchemes: there's a flag for it, see the ghc user manual 07:04:09 guardE cond err = when cond (throwError err) 07:04:27 --- quit: gkr (Read error: 113 (No route to host)) 07:04:27 could we please get a non-offensive lambdabot in here? :) 07:04:28 (throwError is in Control.Monad.Error.Class) 07:04:30 quicksilver annotated "translate to Either?" with "(no title)" at http://hpaste.org/2748#a1 07:04:37 They do have at least one guy that published something. 07:04:39 Mitar: annotation made 07:04:56 MyCatSchemes: did you need this? http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#options-linker 07:04:56 -> http://uptr.pl/mV 07:04:58 Title: 4.10. Options related to a particular phase, http://tinyurl.com/smq5n 07:04:58 Title: 4.10. Options related to a particular phase 07:05:02 :t ($!) 07:05:07 forall a b. (a -> b) -> a -> b 07:05:19 why not use fail instead of throwError 07:05:20 ? 07:05:29 :t fail 07:05:30 forall (m :: * -> *) a. (Monad m) => String -> m a 07:05:33 :t throwError 07:05:35 forall e (m :: * -> *) a. (MonadError e m) => e -> m a 07:05:44 throwError supports custom error types 07:05:49 fail only string 07:05:51 scook0 annotated "translate to Either?" with "with guardE" at http://hpaste.org/2748#a2 07:05:52 @src ($!) 07:05:53 Source not found. Maybe if you used more than just two fingers... 07:06:02 nasty bot 07:06:38 ($!) is ($), strict in its argument, I believe 07:06:56 quicksilver annotated "translate to Either?" with "save two lines of valuable screen space!" at http://hpaste.org/2748#a3 07:06:58 \f x -> x `seq` f x 07:07:39 Sizur: I think so, but I'm unclear on whether this'll do what I'm after... 07:07:48 Mitar: slightly shorter version :) 07:08:16 --- join: gnomnain (n=gnomnain@bur91-2-82-231-159-152.fbx.proxad.net) joined #haskell 07:08:31 so if I use fail, i have to have Either String Type as a return type, where Type is my type 07:08:36 quicksilver: it's less safe! 07:08:46 I'm slightly astonished that nobody changed TyInt to TyBool :) 07:09:22 doserj: I don't think anybody bothered to read the actual code ;) 07:09:27 oerjan: changing the value of -B used? It'd work, but it doesn't really seem sane. Mind you, it'd *work*, it's just that it'd be totally evil. :/ 07:09:36 scook0: how so? 07:09:53 @src Either fail 07:09:54 fail msg = Left (strMsg msg) 07:09:58 (the mapM trick) 07:09:59 :t strMsg 07:10:01 forall a. (Error a) => String -> a 07:10:07 scook0: yes, but what about it is less safe? 07:10:15 * MyCatSchemes abuses ln -s, mwahahahaha. 07:10:31 if you screw up the number of list elements, you get a runtime error 07:10:35 MyCatSchemes: -i 07:10:38 instead of a compile-time error 07:10:53 --- quit: dnme ("[BX] Time wasted: 29 days 14 hours 29 minutes 2 seconds 22 milliseconds") 07:11:00 scook0: you mean it's "less safe to a typo" ? :P 07:11:02 ideally you'd be mapping over a 3-tuple, or a dependently-typed vector 07:11:28 scook0: it's fairly easy to inspect one line of code and verify that both lists have the same length 07:11:34 scook0: but I take your point :) 07:12:19 MyCatSchemes: oh, you mean the packages? sorry i misunderstood 07:12:21 yeah, it's more of a "don't play with knives" thing 07:12:55 scook0: maybe there should be a type class HomoTuple with instances for (a,a) and (a,a,a) etc 07:12:56 oerjan: yeah. I need to install things into ~ rather than /usr/local, but I don't have the disk space to make a complete copy of $libdir 07:13:25 quicksilver: would plain Functor work? 07:13:33 no 07:13:46 you can't 'upgrade' fmap to fmapM automatically 07:13:54 at least I don't thin so 07:13:54 yeah, I just realised that 07:13:58 you need FunctorM 07:14:13 (forgot the function was monadic, which was the whole point) 07:14:19 what's fmapM? 07:14:21 (my intention was that HomoTuple => Functor, though) 07:14:41 olsner: do you know what fmap is? 07:15:03 MyCatSchemes: GHC_PACKAGE_PATH maybe? 07:15:11 Functor f => (a -> b) -> f a -> f b? 07:15:13 how can I tell lambdabot to load some module to get more sources when I type @src ? 07:15:27 :t fmapM 07:15:28 oerjan: oooh 07:15:29 Not in scope: `fmapM' 07:15:31 @hoogle fmapM 07:15:31 Data.FunctorM.fmapM :: (FunctorM f, Monad m) => (a -> m b) -> f a -> m (f b) 07:15:31 Data.FunctorM.fmapM_ :: (FunctorM f, Monad m) => (a -> m b) -> f a -> m () 07:15:43 @hoogle length 07:15:44 Prelude.length :: [a] -> Int 07:15:44 Data.PackedString.lengthPS :: PackedString -> Int 07:15:44 Foreign.Marshal.Array.lengthArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO Int 07:15:46 --- join: cjeris (n=Jeris@140.247.124.140) joined #haskell 07:16:04 :i length 07:16:18 is there something like (liftM not) ? 07:16:57 cognominal_: i don't think you can, @src is no automatically generated 07:17:01 *not 07:17:10 --- part: Sizur left #haskell 07:17:11 --- join: mvitale (n=mvitale@pool-71-240-105-119.pitt.east.verizon.net) joined #haskell 07:17:14 --- join: conal (n=user@misc-148-78-62-234.pool.starband.net) joined #haskell 07:17:31 Mitar: I don't think there's a shorter name for it, if that's what you mean 07:17:38 but nothing's stopping you from making one 07:17:42 --- join: zx]treads (n=root@83.212.84.210) joined #haskell 07:17:43 yes ... 07:17:53 but thought that there is already notM :-) 07:17:54 or not' 07:18:14 oerjan: ah, thank you, that is exactly what I needed. 07:18:16 Mitar: not <$> is slightly shorter :) 07:18:18 --- quit: matthew_- ("bye") 07:19:13 oerjan: though technically (<$>) is defined over Functor, not Monad 07:19:44 Oh weird, ghc-pkg doesn't seem to be installed here. :( 07:19:48 which would be a pain if you were trying to write code polymorphic in Monad 07:19:50 Mitar: I like to swap it around, as (not `liftM` ) 07:20:07 Mitar: or just (not `fmap`) 07:20:27 quicksilver: are you one of those crazy people who use `id` instead of ($)? ;) 07:20:49 nope 07:20:49 --- join: antisvin (n=antisvin@83.218.193.55) joined #haskell 07:20:58 but, consider the following code: 07:21:09 foo = StringType bar 07:21:18 (building a type with a constructor) 07:21:29 now suppose you refactor a bit, and bar ends up monadic 07:21:32 I prefer to then write 07:21:38 foo = StringType `fmap` bar 07:21:43 which 'looks like' what I had before 07:21:47 oh, I thought you were talking about sections 07:21:47 instead of 07:21:54 foo = fmap StringType bar 07:22:00 infix `liftM`/`fmap` is fine, imo 07:22:10 MyCatSchemes: if i read it correctly the user package database is searched first 07:22:26 but (not `fmap`) on its own is just gross 07:22:38 so you may not actually need to set it if you use the default location? 07:23:01 though if you want to write `fmap`, you might as well just use <$> 07:23:33 oerjan: dunno. ghc-pkg doesn't seem to be installed here, though, weirdly. 07:23:51 oerjan: since the usual method of creaping the user package database is to run ghc-pkg... 07:24:16 what is the point of base/GHC libraries? why are not they shoved elsewhere? 07:24:17 oh 07:24:43 there is a GHC/List and Data/List... 07:24:57 what is the point of making two librairies? 07:25:09 oerjan: wait, yes it is. It's just not in my account's PATH by default. *swings ln -s around and smites this issue* 07:25:14 scook0: yes, point 07:25:25 scook0: I think my habit dated from before Control.Applicative was in base 07:25:32 :t (<$>) 07:25:34 --- join: boegel (n=boegel@konijn.elis.UGent.be) joined #haskell 07:25:34 forall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b 07:25:43 @index <$> 07:25:44 bzzt 07:25:47 @index (<$>) 07:25:48 bzzt 07:25:51 * quicksilver shrugs 07:25:56 @index fmap 07:25:56 I think it's defined in applicative, anyway :) 07:25:56 Control.Monad, Prelude, Control.Monad.Reader, Control.Monad.Writer, Control.Monad.State, Control.Monad.RWS, Control.Monad.Identity, Control.Monad.Cont, Control.Monad.Error, Control.Monad.List 07:25:58 by the time I heard about `fmap`, I'd already read about <$> 07:26:14 I'd heard about <$> 07:26:16 but historically, I've always preferred fmap over liftM 07:26:17 but not with that symbol 07:26:25 however Conor draws it on paper 07:26:29 I don't remember what he uses now 07:26:40 and it wasn't in ghc 6.4, I don't think 07:27:04 --- join: Nshag (i=user@Mix-Orleans-106-2-226.w193-248.abo.wanadoo.fr) joined #haskell 07:27:16 --- join: drigz (i=drigz@bb-87-80-32-99.ukonline.co.uk) joined #haskell 07:27:53 apparently there is dual life libraries like in Perl, that live both in the core and in hackagedb 07:28:11 can someone shed the light on this ventilation of librairies? 07:28:37 --- join: malcolmw (n=malcolm@venice.cs.york.ac.uk) joined #haskell 07:28:51 cognominal_: I don't properly grok hackagedb and cabal, to my chagrin 07:29:02 cognominal_: so these issues confuse me too :) 07:29:26 --- quit: shapr (Read error: 110 (Connection timed out)) 07:29:31 --- join: Jedai (n=cfouche@slsu0-15.ens-lyon.fr) joined #haskell 07:30:50 --- join: sebell (i=sebell@nat/ibm/x-053e7759be0659a1) joined #haskell 07:32:06 --- join: aaco (n=aaco@201-13-192-220.dial-up.telesp.net.br) joined #haskell 07:33:26 --- quit: doserj ("Leaving") 07:34:39 hmm, with HPDF progressing well 07:34:51 maybe haskell might be the right language to write my iPhoto-killer in 07:35:24 I find it easy not to use iphoto by virtue of not using Mac :-) (But, seriously, cool, sounds like a fun project) 07:36:06 did this year's icfp contest come out with a top 3 as usual? 07:36:25 osfameron: the objective is to ensure that I can still access my iPhoto library if I decide not to buy a mac, next time around 07:36:32 osfameron: defeat vendor lock-in! :) 07:36:48 ah cool! is the format documented? Or just easy/possible to reverse engineer ? 07:36:51 drigz: I think the results aren't published until the conference itself 07:37:03 osfameron: it uses apple's proplist, which is documented 07:37:12 osfameron: then you just have to guess the meanings of the keys/values 07:37:15 osfameron: which is simple enough 07:37:17 Is there a plot library for Haskell? 07:37:20 (the conference is October 1-3, apparently) 07:37:21 --- join: xynn (n=james@cpe-69-205-127-65.rochester.res.rr.com) joined #haskell 07:37:34 quicksilver: oh, i see. thanks 07:37:58 fasta: plotting graphs, or vector graphics in general? 07:38:23 * oerjan suddenly imagines a library for writing fictional plots 07:38:38 * CosmicRay hands oerjan Inform 07:38:40 oerjan: I recall a macintosh application which did that, quite a few years back 07:39:02 hmm, what if === and =/= are also monadic with Either? 07:39:03 nothing new under the sun :) 07:39:12 scook0: plotting graphs 07:39:22 :t (===) 07:39:30 Not in scope: `===' 07:39:38 olsner: he invented them 07:39:47 Mitar: define your own version of when 07:39:50 :t whenM 07:39:52 Not in scope: `whenM' 07:39:58 oerjan: you could use Vladimir Propp's classifications of story types. Or something like Calvino's Tarot work. 07:40:08 ok, i am just making sure there is nothing already written 07:40:11 "standard" 07:40:38 :t when 07:40:40 forall (m :: * -> *). (Monad m) => Bool -> m () -> m () 07:40:44 :t \c -> c >>= flip when 07:40:46 forall (m :: * -> *). (Monad m) => (Bool -> m ()) -> Bool -> m () 07:40:50 fasta: for my current research stuff, I've just been generating data to pipe into gnuplot (fwiw) 07:40:51 :t \c -> c >>= when 07:40:53 forall (m :: * -> *). (Monad m) => (m () -> Bool) -> m () -> m () 07:40:53 A library for writing fictional plots sounds like Orwell's story-writing machines. 07:40:59 I don't have any better advice than that, I'm afraid 07:41:01 hmph 07:41:09 I'm being stupid I'm sure :) 07:41:39 ought to be a one-liner with 'when' and >>= 07:41:58 :t let whenM c t = do b <- c; when b t 07:42:00 --- join: drice (n=drice@adsl-76-199-103-143.dsl.pltn13.sbcglobal.net) joined #haskell 07:42:00 : 07:42:00 Could not find module `L': 07:42:01 scook0: yes, that was my plan A 07:42:04 :t let whenM c t = do b <- c; when b t in whenM 07:42:06 forall (t :: * -> *). (Monad t) => t Bool -> t () -> t () 07:42:20 quicksilver: if you're prepared to use verrrrry long lines, and { and } and ;, *any* program can be written as a one-liner. 07:42:26 :t \t r -> t >>= flip when r 07:42:29 forall (m :: * -> *). (Monad m) => m Bool -> m () -> m () 07:42:40 scook0: I just asked to see whether anything might have changed (not that likely, since I don't miss a lot that's happening here) 07:42:40 fasta: I wonder what darcs-graph (on hackage) uses? 07:42:46 :t \t -> t >>= flip when 07:42:48 forall (m :: * -> *). (Monad m) => (Bool -> m ()) -> Bool -> m () 07:42:55 Ohhhh, fuck. My university's installation of ghc is totally FUBAR. :( 07:43:01 hmph 07:43:03 MyCatSchemes: what else is new? 07:43:30 @pl \t r -> t >== flip when r 07:43:30 (. flip when) . (>==) 07:43:34 @pl \t r -> t >>= flip when r 07:43:34 (. flip when) . (>>=) 07:43:42 btw, xmonad compiled with the latest solaris sparc release segfaults 07:43:57 olsner: --> #xmonad 07:44:07 fasta: only because they couldn't be arsed to make *one* feckin' symlink. Gah. 07:44:15 @pl \r t -> t >>= flip when r 07:44:15 (=<<) . flip when 07:44:56 MyCatSchemes: what version do they have installed? 07:45:03 whenM t a = do 07:45:03 t' <- t 07:45:03 when t' a 07:45:05 fasta: 6.6 07:45:39 MyCatSchemes: my university still has 6.4 07:45:46 MyCatSchemes: (and 6.2) 07:45:48 Mitar: aww, that takes all the fun out of it! ;) 07:45:59 out of what? 07:46:02 Mitar: right. 07:46:19 Mitar: quicksilver et al. were trying to make a pointfree version 07:46:21 Mitar: I was just trying to write it stupidly shortly :) 07:46:21 fasta: when I try to "runghc Setup.hs configure" for (the stable release of) Yi, it breaks because it can't find ghc-pkg in /usr/local/bin. Which is as annoying as Hell, because ghc-pkg is right in my fuggin' $PATH, just tucked away elsewhere. 07:46:26 he he 07:46:27 :-) 07:46:50 ...how much hackery, I wonder, would it take to get around that? 07:46:55 yes ... i am not so good in this so then i do it quick like this :-) 07:47:16 MyCatSchemes: that sounds like you doing something wrong 07:47:24 writing pointfree code off the top of your head is not so good for productivity 07:47:37 better to write it out longhand first, and maybe refactor later 07:47:54 scook0: Depends whether you get fast at doing it. 07:48:22 sure, once you've messed around enough, you'll pick up real skills 07:48:34 fasta: any suggestions as to what it could be? /usr/local/bin/ghc exists, /usr/local/bin/hp2hs exists, as do a few of the other misc. binaries, but they never bothered to make ghc-pkg, runghc or runhaskell available. 07:48:38 but until then, there's no shame in writing it the long way 07:48:49 hmm that pimp recruiting for haskell quant developers works just a few hundred yards from me 07:49:00 fasta: in the face of the evidence, I'm lead to strongly doubt that *I* am in error here. 07:49:11 --- join: Cheery (n=cheery@a81-197-9-42.elisa-laajakaista.fi) joined #haskell 07:49:54 --- quit: etnt ("bye") 07:50:21 MyCatSchemes: if it's a big deal, you might try a -cafe post 07:50:34 better chance of an authoritative answer 07:51:45 If I knew numerical methods for the Malliavin calculus and stochastic diffeq's better I'd take it more seriously. 07:52:02 --- join: bluestorm_ (n=bluestor@mna75-1-81-57-39-150.fbx.proxad.net) joined #haskell 07:52:48 --- quit: amiddelk ("Cya later") 07:54:01 scook0: well, it's certainly not a bug in ghc-6.6 itself or anything, it's just this university's totally broken-ass installation of it. 07:54:30 --- join: b_jonas (n=b_jonas@dsl51B6190D.pool.t-online.hu) joined #haskell 07:54:45 sure, but you might find out whether there's a feasible workaround 07:55:18 --- join: thou (n=tsmith@67-132-99-226.dia.static.qwest.net) joined #haskell 07:56:11 --- quit: jtoy () 07:56:16 scook0: I'm scared to ask the sysadmins at uni here because I'm afraid that they might've done this on purpose. ;) 07:56:30 on balance, I suspect you have 07:56:36 you are clearly a subversive 07:56:45 your very presence in this channel makes that clear ;) 07:56:49 Interesting. I see video game physics for fixed-wing aircraft but not helicopters. 07:58:19 --- quit: hordf ("Bye") 07:58:50 --- join: sjanssen (n=sjanssen@pcp082686pcs.unl.edu) joined #haskell 07:58:51 --- join: byorgey (n=byorgey@cscwlan.csc.com) joined #haskell 07:59:37 --- quit: swiert ("leaving.") 08:00:27 --- quit: cognominal_ (Client Quit) 08:00:47 I suspect that autorotation would be pretty hard to model accurately 08:02:09 --- join: Blwood (n=Blwood@105.238-243-81.adsl-dyn.isp.belgacom.be) joined #haskell 08:02:16 --- join: Shimei (i=asumu@sr-35.srtw01.resnet.ubc.ca) joined #haskell 08:02:25 --- quit: xynn ("Leaving") 08:02:26 I would imagine it's very non-linear 08:02:47 don't know anything about fluid/aero dynamics though :) 08:02:51 MyCatSchemes: Why are you using /usr/local anyway? 08:03:06 MyCatSchemes: that's not the default installation location 08:03:14 fasta: Lord knows. 08:03:36 MyCatSchemes: Anyway, just annoy your system admins. 08:03:38 fasta: everything's installed in /usr/local/ghc66 anyway. 08:03:47 MyCatSchemes: it's their job. 08:04:00 fasta: and then a handful of things are copied out to /usr/local/bin to make them actually available, since that's in everybodies' $PATH. 08:04:36 MyCatSchemes: why not add /usr/local/ghc66 to your $PATH? 08:04:47 --- join: prb (n=prb@c-24-22-188-196.hsd1.mn.comcast.net) joined #haskell 08:04:50 MyCatSchemes: i.e. any directory with a binary 08:05:14 fasta: I *believe* it is because this version of DeadRat doesn't package anything even resembling an up-to-date version of GHC, so they've built and installed 6.6 from scratch themselves, but done it in an odd location to stop it from interacting with DeadRat's package management. 08:05:37 DeadRat? Is that RedHat? 08:05:40 Yes. :) 08:05:53 Oh, I don't have such a negative feeling about it. 08:06:06 Spiffy name, though. 08:06:14 Neither did I until, oh... today. 08:06:48 Getting things into $PATH isn't a problem. I merely swing "ln -s" about in ~/bin and that problem goes away. 08:07:17 However, Setup.hs for Yi is barfing because it's only looking in /usr/local/bin for ghc-pkg, rather than actually checking my $PATH. 08:08:23 did you check the .cabal file to see if there was something broken in it? 08:08:35 lots of times you can just manually plug in what you w