00:00:00 --- log: started haskell/02.02.03 03:40:20 --- join: shapr (~user@p-c2fbab34.easy.inet.fi) joined #haskell 03:53:34 hi 03:56:31 morning 03:56:36 what's up? 03:58:10 --- quit: dennisb (Read error: 110 (Connection timed out)) 04:04:04 not much, was up rather late last night playing Risk 04:14:46 I was up late playing tribes2 04:33:13 --- join: Yurik (~yrashk@gw.telcos.net.ua) joined #haskell 04:33:21 re 05:09:28 --- quit: Yurik ("BitchX has bite! (Just ask Mike Tyson!)") 05:40:23 --- quit: xbill (Read error: 113 (No route to host)) 06:20:30 --- join: Prozac (root@62.83.202.76) joined #haskell 06:49:20 --- quit: Prozac ("return 0;") 07:38:24 --- join: xbill (wli@DOMINIA.MIT.EDU) joined #haskell 07:47:45 --- join: tmoertel (~chatzilla@pa-mtlebanon2a-268.pit.adelphia.net) joined #haskell 08:07:49 --- quit: tmoertel () 09:26:59 --- join: Vutral (~ss@212.169.153.29) joined #haskell 14:59:32 --- join: juhp (~plum-user@firebox-ext.jp.redhat.com) joined #haskell 16:08:05 --- join: lodewijk (~lodewijk@voge.xs4all.nl) joined #haskell 16:27:32 --- quit: lodewijk ("BitchX: its wax ecstatic") 17:03:30 hi all 17:48:43 Anyone help w/ a question? 17:48:49 Sure. 17:48:57 one sec- lemme organize it ;) 17:50:03 ok- I figured most of it out- 17:50:08 and perhaps this is a bit general 17:50:15 but can you explain type classes? 17:50:27 Im asumming Eq is one 17:50:29 and Show is another 17:51:08 I'm drawing a blank when it comes to the 'Eq a => a -> Bool' type 17:51:23 Guess I don;t understand => (and what's to the left of it) ;) 17:51:31 Sorry- sure that's a bit much ;) 18:00:07 The left of the => is the "context". 18:00:30 It means that the function can only be used if the type that gets plugged into "a" is an instance of the Eq type class. 18:00:49 ah 18:01:20 So, for instance, you could make: putObj :: Show a => a -> IO () 18:01:55 hmmm 18:02:00 And do putObj x = putStr $ show x without working whether or not the show function works with x (because show is :: Show a => a -> String). 18:02:28 hmmm 18:02:29 ok- 18:02:49 how about if I want to make a function that would readFile a file, then 'read' that 18:02:59 something like: 18:03:10 readIn file = read $ readFile file 18:03:24 I believe there is a Read class, that requires a read :: Read a => String -> a to be defined for any type a in that class. 18:03:48 right- how to define the type for that function, due to that? 18:03:52 Prelude> :t read 18:03:52 forall a. (Read a) => String -> a 18:03:56 My prob is reconciling the two ;) 18:04:01 --- quit: juhp (Remote closed the connection) 18:04:02 Ok, let's say you have some type you created named X. 18:04:06 ok 18:04:15 You do: 18:04:20 instance Read X where 18:04:31 read x :: String -> X 18:04:34 Er 18:04:38 read :: String -> X 18:04:41 read x = ... 18:05:02 That says X is an instance of class Read, and then implements the functions required for types in class Read. 18:05:13 hmmm 18:05:43 what if the obejct I'm attempting to 'read' from the file is of an unknown type? 18:05:52 Is there a general way of defining? 18:08:48 Hmm, I'm not sure. 18:09:16 Usually read is expected to return a particular type in the context of your code. 18:10:22 hmm- ok. I'm trying to implement some type of primitive marshalling functions 18:10:35 for data persistence 18:11:45 my 'dump' function 'ice' is simply: ice file dta = writeFile file ( show dta ) 18:11:48 which works ok 18:11:57 the 'load' function seems to be the problem 18:19:36 Hmm, I don't know haskell well enough to comment regarding data inheritence. 18:19:44 I'm only familiar with type inheritence. :P 18:20:27 hehe- i just wish i knew some way to make data persistent 18:20:57 The whole "can't reassign variables" is very, very foriegn to me 18:21:31 What are you trying to do? 18:21:33 If I have a datastucture acting as a 'database' of sorts, and functions I can w/ params 'modify' that datastucture- how do i change it 18:21:36 ? 18:21:37 sheesh. 18:21:45 can=>call 18:22:16 I'm still trying to understand how to do that sort of stuff myself. You may want to read up on monads. 18:22:37 That's about 300 pages down the road in Thompson 18:22:40 ;) 18:22:53 I need a 'monads for idiots' guide 18:23:04 haskell.org has links to tons of monad papers. 18:24:00 Right- maybe I can find one that defines 'monad' using less than 300 words 18:24:16 Yeah, there are those. 18:24:25 There's more to understanding a monad than knowing the definition. 18:24:31 Hold on, let me find one in particular I found interesting... 18:24:54 http://haskell.org/bookshelf/ has a whole "Using Monads" section... 18:25:09 http://www.research.avayalabs.com/user/wadler/topics/monads.html 18:25:15 A bunch of papers on monads from the same guy. 18:25:25 Try "Comprehending Monads" on that page. 18:25:32 I haven't read them all, so there may be better ones. 18:25:50 But that one unifies list comprehensions and monads and provides a good theoretical background. 18:25:55 And then shows some examples. 18:26:23 great 18:26:28 thanks much 19:04:53 I need a good introduction to what "Hindley-Milner type system" means. :P 19:15:05 --- join: zorb (a@ppp-64-216-14-146.dialup.eulstx.swbell.net) joined #haskell 19:25:06 Logan, if you truely want some kind of modifyable data structure in haskell I could show you something i wrote a while back, But i must warn you, its kinda ugly and truely only half implemented. I've been meaning to take another look at it and see if I could clean it up and make something out of it. 19:25:55 zorb: I wouldn't mind taking a look. 19:26:25 are you familar with IORefs and STRefs? 19:26:41 because that's bascally what it uses.. 19:26:52 I'm familiar with IO and I suppose ST stands for state transformation? 19:27:01 I'm a relative newbie when it comes to the application of monads. 19:27:07 yeah. 19:28:06 ST is great if you want to create a pure function but thread imperative bits together to create it. 19:29:05 but, if you arent familiar with IORefs and STRefs and their usage, my code isnt going to make all that much sense to you. 19:29:15 * Logan nods. 19:29:22 I'm trying to find stuff on STRef. 19:29:31 alright. 19:29:40 I found some ugly powerpoint slideshow that google can convert to html for me. :P 19:30:08 heh 19:31:08 also doc/user-guide/sec-st.html in your ghc user guide of course... 19:34:10 State in Haskell by (John Launchbury and Simon P Jones) isnt to bad if you translate 'thenST' into '>>=' and notice they are talking about Lazy State Threads (but ST is actually strict! ghc apparently includes a lazyST module which i havent messed with) 19:36:07 Cool, I'll print out and mull over that paper. 19:36:16 I'd like to write myself a good graph representation. 19:36:20 --- join: Vutra_ (~ss@port-212.169.145.181.flat4all.de) joined #haskell 19:36:59 hee. that paper has a depth first search function written using ST :) 19:37:08 Cool. 20:01:26 --- quit: Vutral (Read error: 110 (Connection timed out)) 20:58:00 --- part: zorb left #haskell 22:47:38 Awesome. 22:47:44 I just implemented my own functional graph library. 22:47:56 It may be inefficient in areas, and is missing some functionality, but it can do topological sorts! :P 22:48:09 topologicalSort :: Ord a => Graph a b c -> [Vertex a b c] 22:48:09 topologicalSort g = reverse $ postOrder' $ dfs g $ zeroIn g 22:48:15 * Logan grins. 23:01:30 --- quit: shapr ("gotta go to work") 23:59:59 --- log: ended haskell/02.02.03