00:00:00 --- log: started haskell/02.01.10 00:03:14 --- join: bsh (~MasterBot@dsp-202-72-158-119.manjimup.westnet.com.au) joined #haskell 00:03:20 hi 00:03:24 what's up? 00:03:38 hey, nothing much 00:06:27 written any cool code lately? 00:07:02 i 00:07:13 i've just been working on an interpreter 00:07:27 nifty, what kind of interpreter? 00:07:58 ah its a self made language.. just an educational thing 00:08:11 got any code online? 00:08:35 nah .. not yet 00:10:06 --- join: teek (teemu@k72.viikki.hoasnet.fi) joined #haskell 00:10:16 hei teek 00:10:25 terve shapr 00:10:47 haluatko code shaelta? ;) 00:10:51 * shapr practices his terrible finnish 00:11:49 hmm, what do you mean ? haluatko is in Finnish, code is in universal language, but shaelta is unknown to me ? 00:12:00 ;) 00:12:15 my name is shae 00:12:25 so I think that means, "want code from shae?" 00:12:28 oh, then it's almost correct .... 00:12:49 "haluatko koodia shaelta" 00:12:54 finnish is extremely cool 00:12:57 ah, thanks 00:13:09 extremely elegant language. Like Haskell 00:13:13 yah, I agree 00:14:05 --- quit: bsh ("back soon") 00:14:14 When I started IRCing, I noticed that my knowledge of english grammar is in terrible shape. Now I'm practicing it again. 00:15:10 I have a chance to practice my .fi grammar on #debian-fi, but I usually end up coding instead 00:16:43 heh. I'm fixing some code at the moment, so maybe we shall look your haskell code in (near) future. ok? 00:16:53 no worries :) 00:16:59 are you fixing haskell code? 00:21:33 no. C code not written by me. Segmentation faults pop once in a while... And as it's client/server app (freeciv), debugging is a hard work. 00:21:42 oh 00:21:55 why not write an analyser in Haskell? ;) 00:22:22 That would be more enjoyable... 00:22:32 yah, and more automatic 00:22:41 It 00:23:03 if you could generalise a mistake you found into a new rule or function for your analyser, it'd actually be less work 00:23:26 i feel a little bit stupid, when I waste my free time in something like hunting down seg faults from someone else's code... 00:23:59 byt as i'm recovering (is that right word ?, toipua) from a leg surgery, i have a lot of free time. 00:24:01 I understand that feeling. 00:24:17 yah, I think recovering fits there 01:09:29 --- join: julien (~julien@uu212-190-122-70.unknown.uunet.be) joined #haskell 01:09:38 hi julien! 01:09:50 hi shapr 01:09:56 how are you ? 01:10:04 doing well 01:10:21 working right along 01:10:22 how are you? 01:13:28 fine, a lot of work 01:13:32 but funny :-) 01:13:56 nifty work? 01:14:03 found a way to use haskell at work? 01:15:41 not yet, I've no time to learn 01:16:24 :-( 01:17:40 but I will move to brussels in march, and then I will have time and ADSL connection 01:20:22 nice 01:42:22 I won't get my yellow belt before some time ... 02:01:11 --- quit: teek ("Coffee break") 02:04:57 what is a yellow belt? 02:06:44 second level in judo, karate and other fighting sports 02:15:38 tsk 02:15:52 in haskell! 02:17:11 that's shapr idea, see the topic of the channel :-) 02:22:29 I'm working on my yellow belt :) 02:25:26 I'm working for my green belt, but in taekwondo :-) 02:26:12 there's a good dojo across town, I'm tempted to start classes again 02:29:03 taekwondo ? 02:29:03 --- quit: dmiles (Read error: 104 (Connection reset by peer)) 02:29:13 karate I think 02:29:34 nice 02:30:04 imho, any art is fine as long as the dojo is good 02:30:19 I just want to get back in shape and improve my coordination and focus 02:30:37 I had muscles less than a year ago :-/ 02:30:57 :) 02:39:22 --- nick: clauZzzen -> clausen 02:39:47 --- quit: kepler (carter.openprojects.net irc.openprojects.net) 02:39:47 --- quit: pHa (carter.openprojects.net irc.openprojects.net) 02:39:47 --- quit: jlb (carter.openprojects.net irc.openprojects.net) 02:44:22 --- join: kepler (~kepler@adsl-81-163-152.asm.bellsouth.net) joined #haskell 02:44:22 --- join: pHa (sjh@Riverview6.tbaytel.net) joined #haskell 02:44:22 --- join: jlb (~ktk@jeremeydsl-3.mylinuxisp.com) joined #haskell 02:56:40 shapr: so what is a yellow belt? 02:57:17 hrm, I better start documenting this somewhere :) 03:07:04 --- join: dmiles (~alife@sense-sea-MegaSub-2-56.oz.net) joined #haskell 03:07:09 re dmiles 03:07:22 jewel: I dunno, what would a yellow belt involve? 03:07:24 * shapr thinks 03:07:40 hi 03:07:57 how big is a haskell memory model.. can i handle a gig of data with some implimentations? 03:08:05 I think so 03:08:09 should work 03:08:23 i have a machine with 3 gigs of ram for trying it out on 03:08:44 i have about 60,000 logical axioms :0 03:09:13 i just need a simple contraint logic solver 03:09:23 is there an example of that in haskell? 03:09:53 i have the liogic converted to if/thens right now 03:11:42 why not allocate 3 gb of ram as a quick test in haskell? 03:11:42 then you'd know 03:11:42 i have but need software 03:11:42 weerr i mean need a *(good* haskell implementation to try 03:11:42 huh? 03:11:42 you mean, not hugs? 03:11:42 n/m one sec/.. downloading :) 03:11:42 I'd recommend ghc 03:11:49 ok ussing that 03:12:08 2 November 01 GHC 5.02.1 released 03:13:47 I'm using the debian package, which is ghc-5.02.00 03:14:27 cool.. i have 6 hrs to learn the langauge and release a buio.,d of my app 03:14:56 oh and hook it to the java interface :) 03:15:23 ! 03:15:41 so if i have a bunch of if thens that are cirucular... 03:15:43 dmiles: yikes :) 03:15:44 meaning i neeed what is called memoizatuion.. 03:16:21 yah I understand 03:16:30 use the memo function ;) 03:16:43 it has one sppecific for this? 03:16:55 if a then b 03:16:59 if b then a 03:17:02 a is ture 03:17:04 is b true? 03:17:17 for a problem like that? 03:17:57 not that I'm aware of 03:17:59 http://216.39.172.56/_/engine/testit <- jhere is a small part of my datatbase 03:18:14 but the memo function compares function + parameter calls 03:18:19 towards the bottem are the if/then 03:18:23 and under the hood it does pointer equality 03:18:41 so if you've already passed parameter x to function myFun 03:18:50 then it just returns the cached result rather than recalculating 03:19:41 --- join: nefph (~alife@sense-sea-MegaSub-2-56.oz.net) joined #haskell 03:19:45 --- quit: dmiles (Read error: 104 (Connection reset by peer)) 03:20:01 what's nefph? 03:20:11 meaning i bneed to do unifification with occurs checking 03:20:11 * shapr thinks "never-ending-project-from-hell" 03:20:20 but that would be nepfh 03:20:23 --- nick: nefph -> dmiles 03:20:29 my efnet nick is nephrael 03:20:31 hehe 03:20:31 oh! 03:20:41 very quick 03:21:01 ? 03:21:15 oh your metal acronym resolver 03:21:20 err mental 03:21:26 :) 03:22:04 did you see my page of prtolog if/thens? 03:22:17 heh 03:22:25 i can export to any formayt in a mater of minutes 03:22:47 * shapr looks 03:22:50 so it looks like i am going to have it generate data for haskel; 03:23:43 A:-B means if B then A 03:24:03 interesting 03:24:06 why do you need to do this for haskell? 03:24:18 prolog is beeing too slow 03:24:37 and cycle loop cjheckiong is being a pain 03:25:01 oh 03:25:01 expecially where single varibles are involved 03:25:19 like a(B) :- c(D,E) 03:25:21 err 03:25:23 like a(B) :- c(B,E) 03:25:31 E is single.. 03:25:49 you know enough prolog my examples make sense? 03:26:33 you could get a(B) for as many times as you could get c(B,E) 03:26:52 no, I know zero prolog 03:26:54 if there are c(foo,bar) c(foo,baz) 03:27:14 that means you can get a(foo) and a(foo) twice] 03:27:27 this is combitoric for other predicates that use a(B) 03:27:55 so there is this thing called memoization that helps solve this kind of prtobelm 03:28:13 but one problem here.. 03:28:22 if haskell can solve then i am set.. 03:28:26 if a then b 03:28:29 if b then a 03:28:32 a is true 03:28:37 is b true? 03:29:10 without it going into a->b->a->b->a etc 03:31:59 hmmm 03:31:59 have you looked at mercury? 03:31:59 yes.. too unstable 03:31:59 ?! 03:31:59 its version of 'mtabling' 03:31:59 anyway, haskell isn't a logical language... it isn't obvious to me how to implement easily 03:31:59 Table Space IOverflow 03:31:59 but, I'm ignorant 03:31:59 * xbill grinds out statistical stuff in Haskell to assist his kernel hacking endeavors. 03:31:59 xbill: ! 03:31:59 (i.e. chi^2 and Kuiper) 03:31:59 xbill: got code online we can peek at? 03:31:59 i may be trying to use Haskell wrong :).. 03:31:59 dmiles: there are constraint logic solvers written in haskell 03:31:59 xbill is familiar with my problem 03:31:59 http://holomorphy.com/~wli/special/ 03:31:59 also see special/stats/ 03:31:59 yes if they are mostly bullet proof rand quick that is what i need 03:31:59 i have a gig of if/thens 03:32:10 mercury breaks on that much memory 03:32:20 oh great 03:32:26 that surprises me 03:32:31 have you flamed them? hehe 03:32:31 Has Fergus Henderson started to do anything about it? 03:32:40 i will start to 03:32:58 i just spent 4 hrs auditing each CLP kernel i could find 03:33:14 (never giving a fair test) 03:33:15 xbill: your code is great fun to read 03:33:27 how's that? 03:33:38 soi your saying i could probkly get more from mercury if i spent time 03:34:01 no idea but they have bettered a lot of straight Prolog implementations 03:34:05 i shall do this on my ne4xt release.. try porting as much as i can 03:34:06 dmiles: well, mercury has a reputation for being able to handle ridicoulus loads 03:34:12 dmiles: I've never used it 03:34:12 OTOH they may not have the semantics needed. 03:34:36 I've used it several times and was disappointed only a few of those 03:34:59 well i can always use prolog for writting the database for mercurly 03:35:11 Did you just post to the mercury list? 03:35:14 xbill: mercury? 03:35:26 never mind it was someone else 03:35:34 " I've used it several times and was disappointed only a few of those " 03:35:51 dmiles: yes, Mercury 03:36:46 hrrm 03:37:06 xbill: your code is cool 03:37:08 well i think now thast i have the problem simplified .. i have my arguemtn domains.. my data.,. my rules.. 03:37:26 its genric enough to fit into anty CLP 03:37:48 except i have further rulers that gen4erate more contraits.. thats the only harsgh part 03:37:56 err harsh part 03:38:04 like if hairy then animal 03:38:14 ansd animal may be a contraint to something elsoe 03:38:35 but i can forward chain issues like that out 03:41:15 shapr: what's cool about it? 03:41:43 it goes off in different directions than I usually think 03:41:48 it's a different approach 03:41:50 and that's nifty 03:42:00 what's the approach? 03:42:46 I'm not sure how to quantify it 03:43:42 well how would you describe the style in general? 03:44:08 much more recursive than my style 03:44:47 well, that's difficult for me to draw conclusions from... 03:45:03 that's about as specific as I can get at the moment ;) 03:45:04 I'm sort of interested in "getting a look in the mirror" so to speak. 03:45:31 hm, I'll think about it 03:50:34 one example: sort $ take 20 (map (take 7) . map cf . map (/(2::Rational)^64) . map fromIntegral $ getCands) 03:51:12 seeing that many maps in one line makes my internal algorithmic complexity evaluator envision DNA strands with their recrursive twists 03:55:25 I should have done sort $ take 20 (map (take 7 . cf . (/(2::Rational)^64) . fromIntegral) getCands) 03:56:04 intermodule optimization doesn't go so well just read Main.hs 03:56:36 I put everything in Main.hs because of that. 03:57:31 Stats.hs is too slow 04:00:22 since I don't know much math, I'm not sure what it's doing 04:00:28 I took a statistics class once, long ago 04:00:34 well, ten years 04:04:38 it's trying to figure out whether things are evenly distributed across buckets of a hash table given the counts of things i the buckets. 04:04:49 oh 04:04:50 nifty 04:05:30 Fibhash.hs (and the Main.hs in the same dir) are trying to find prime numbers to multiply by for hash functions 04:05:44 cool 04:05:54 Stats.hs is trying to figure out whether they really work 04:05:55 * shapr gets the urge to read up on hashing functions 04:06:03 what's the conclusion? 04:06:21 * shapr grabs a handy copy of Applied Cryptography 04:06:37 cryptographic hashes are not useful for this 04:06:47 oh 04:07:35 I didn't know that the hash functions mentioned in crypto and the hash functions used for evenly distributing things were different 04:07:52 computational expense is the dominating factor here 04:08:08 ah 04:08:09 perfectly even distribution is worthless if it takes 10 minutes to find the hash value of one key 04:08:15 makes sense 04:08:26 python claims to have a fast and perfect hashing function 04:08:36 it's used for dictionaries in python 04:09:19 perfect hashing is a different subject entirely 04:09:24 oh 04:09:26 I have much to learn :) 04:09:53 a perfect hash is when you know the data in advance and are trying to create a hash function for that data with no collisions whatsoever. 04:11:36 what kind of hashing are you trying to do? 04:11:53 * shapr tries to figure out what hashing + NUMA = 04:11:59 hash functions for the Linux kernel's internal search algorithms 04:12:49 oh 04:13:02 I didn't know the kernel had an internal search 04:13:32 lots of it 04:13:43 most of it exhaustive search of linked lists 04:14:57 that makes sense 04:15:13 for instance 04:15:25 when linux looks for all processes sharing a single address space 04:15:47 it loops over every process in the system and checks to see if the address space matches 04:16:16 sounds sensible 04:16:24 hardly 04:16:45 there should already be a list hanging off of the address space 04:17:15 that would be faster 04:17:59 because then your search time would only depend on amount of address space rather than number of processes 04:18:14 shapr: you don't know the gypped feeling you get when you've got a gazillion-way SMP machine and the kernel will only let you use one of your CPU's at a time 04:18:17 shapr: no 04:18:26 shapr: you know the address space in advance 04:18:38 oh 04:18:42 so you would just traverse the list with in the address space structure 04:19:03 I can guess what that gypped feeling feels like.. it's almost like using windows :) 04:19:20 right 04:20:02 'amount of address space' should have been "number of separate chunks of address space you have to go through" 04:21:35 this increases my curiosity about the linux kernel 04:21:49 I'm occasionally tempted to finish learning C and do kernel hacking 04:21:57 it could be fun 04:22:42 xbill: address space == struct address_space == bsd's objects? 04:22:46 no 04:22:56 address space = struct mm_struct 04:23:11 aha, * A new hashed wait queue patch was posted by William Lee Irwin III. 04:23:17 * shapr reads the kernel page of lwn.net 04:23:36 riel told me about that... saves lots of memory 04:23:38 I always wait for other people to tell me. 04:23:39 (on big boxen) 04:23:44 hehe 04:23:51 It saves 3MB on my 768MB Athlon. 04:23:55 * clausen staying with riel ATM, so gets to hear a lot about VM stuff 04:24:01 (and he about file system / partition stuff, hehe) 04:24:03 spiffy 04:24:12 yah, cool 04:24:28 living with hackers is cool :) 04:24:34 * xbill shrugs. 04:24:51 I'd like to live even in the same city as hackers 04:24:55 but irc is pretty close 04:25:44 well, you're in Finland, land of Linus no? =) 04:25:47 heh 04:25:57 true, but I'm also 800km north of Helsinki 04:26:07 .fi is very long and narrow 04:26:16 ouch 04:26:19 that must be REALLY cold 04:26:22 yah, it is 04:26:26 * clausen enjoying .br summer :) 04:26:31 -34C a coupla weeks ago 04:26:44 the coldest I've had hear about 15°C 04:26:49 lucky you 04:26:54 :) 04:27:57 on the good side, oulu is just south of me, and that's where irc started :) 04:28:21 I haven't gotten to see the first irc server yet, but I've heard it's a flower pot in a professor's room 04:29:03 .au has lots of hackers :) 04:29:10 (where I live normally) 04:29:20 when I lived in southeast USA, we didn't have many 04:29:38 atlanta seems to have improved since I left 04:31:20 I don't want to know about how Indiana has been since I left... I'd like to just forget about it. 04:31:38 where are you now? 04:31:42 MA? 04:31:44 Oregon 04:31:46 ah 04:31:51 portland? 04:32:00 I've never set foot in MA, this is a friend's machine. 04:32:04 yep 04:32:32 portland has much nifty stuff, including leatherman.com and the original wiki 04:34:50 oh, and xbill of course ;) 04:46:30 * xbill =) 06:49:15 --- join: Heffalump (ganesh@munchkin.comlab.ox.ac.uk) joined #haskell 06:49:33 * Heffalump waves 06:49:37 hi! 06:59:01 ganesh the elephant 06:59:15 absolutely 07:03:51 --- quit: julien (Remote closed the connection) 07:16:36 Heffalump: sometimes there's lots of conversation here, and sometimes none 07:16:54 this channel is logged, and you can find those logs at the url in the channel topic. 07:19:43 right 07:22:39 --- join: julien (~julien@uu212-190-122-70.unknown.uunet.be) joined #haskell 07:25:18 who is logging the channel, btw? 07:25:22 (or what) 07:28:22 one of the guys from tunes.org 07:28:28 the bot is named clog 07:29:29 right, just wondering which client's disappearance would lead to logs stopping 08:20:17 --- quit: julien ("Client Exiting") 09:15:56 --- quit: shapr ("hometime") 09:16:04 --- join: teek (teemu@k72.viikki.hoasnet.fi) joined #haskell 09:37:21 --- quit: dmiles (Read error: 104 (Connection reset by peer)) 09:37:29 --- join: nefph (~alife@sense-sea-MegaSub-2-56.oz.net) joined #haskell 09:55:08 --- quit: kepler (Remote closed the connection) 09:58:49 --- nick: nefph -> dmiles 11:18:07 --- join: shapr (~user@p-c2fbab4f.easy.inet.fi) joined #haskell 11:19:20 ok, time to learn bunches of Haskell! 11:20:37 hello everyone 11:26:26 --- join: ski (~md9slj@fraggel83.mdstud.chalmers.se) joined #haskell 11:26:31 hi ski! 11:26:39 hi shapr ! 11:26:49 I'm just about to open the book for some serious haskell learning 11:26:58 I am therefore very happy to see you ;) 11:26:58 aha, ok. 11:27:17 thank you. 11:27:20 actually, I'm happy to see you anytime 11:27:27 but you know, now is particularly good 11:27:46 good, then ! 11:27:55 what are you working on? 11:28:28 well, i'm not working on anything particulary, right now. just reading a little newsgroups on usenet 11:30:12 i've read a little in comp.lang.functional, comp.lang.scheme, alt.dreams.lucid, alt.out-of-body 11:30:45 so i'm mostly all yours, if you wan't anything discussed, asked, etc ... 11:31:21 w00h00!! 11:31:26 what ? 11:31:37 that you have time to answer questions :) 11:31:40 I'm thrilled! 11:32:27 well, local time here is half past eight in the evening, but i think i'll wait a little with going home .. 11:32:52 half past nine here 11:32:56 you're at work? 11:32:58 i woke quite late today, about 1 hour after noon 11:33:03 oh, at school 11:33:06 no, i'm at school 11:34:20 so, i just reloaded http://tunes.org/~nef/logs/haskell/02.01.10 then and then to see if there was any discussion started or etc .. 11:34:37 interspersed with my usenet reading of course 11:34:52 (the reloading i mean) 11:34:56 heh 11:35:05 we had some amusing discussion about haskell belt colors 11:35:24 I decided that white belt means "wrote any haskell program that worked" 11:35:30 what's the next step up? 11:36:18 oh, do you know if constructed datatypes can be added to type classes just like other types? 11:36:22 able to use the I/O monad for more than getContents? 11:36:25 perhaps : wrote a little more advanced programs (perhaps pattern matching), but don't yet understand recursion 11:36:29 yes 11:36:37 xbill: fair enough 11:36:53 since I don't know what means, I'll keep myself at white belt for the moment ;) 11:37:12 whaddya mean about constructed datatypes, explain yourself man ! :-) 11:37:34 ok... 11:37:39 * shapr looks at his code 11:37:51 aha 11:38:10 you mean datatype constructors, taking parameters, like "list of" or "IO of" , etc ... ? 11:38:13 I can do something like data Season = Spring | Summer | ... 11:38:18 and then I have a new type 11:38:21 ok, yes 11:38:29 instance C (T a) 11:38:34 and if I put "deriving (Eq,Ord,Show)" 11:38:44 then it somewhat automatically picks up those methods 11:38:46 T is a type constructor here 11:38:56 right 11:39:27 hmm 11:39:35 * shapr tries to understand his question better 11:39:38 you mean if you can derive some classes (like Eq,Show) for parametriced datatype (constructors) like "list of" ? 11:39:51 like : 11:40:15 yah 11:40:29 data MyList a = Nil | Cons a (MyList) deriving (Eq,Show,Read,Ord) 11:40:51 riiight! 11:40:53 that's it 11:41:25 is that normal? 11:41:27 i think it's okay for at least some of the derivable classes (a closed set, unfortunately) 11:41:27 does it work? 11:41:59 well, Bounded and Enum don't work with that MyList i think. 11:42:07 but that's more or less natural 11:42:21 hrm, I had a demo in the Craft book 11:42:35 Enum only works for an all-zero-argument-constructor-datatype 11:42:58 i.e. can only be automatically derived 11:43:01 they show a Tree that's constructed with nodes that can be recursize 11:43:03 like that 11:43:05 recursive 11:43:09 ok 11:43:27 so I was wondering whether it would be possible to make a Node class 11:43:42 that had methods like parent, leftchild, rightchild, content 11:44:02 hmm, parent is perhaps problematic 11:44:24 * shapr tries to find the Tree demo 11:44:34 but the others are possible? 11:44:41 a parent link in a tree is more or less like a double-linked list 11:44:49 i guess so 11:45:12 aha 11:45:31 data Tree a = Nil | Node a (Tree a) (Tree a) deriving (Eq,Ord,Show,Read) 11:45:52 should the argument to the Node class be a type (kind = *) or a type constructor (perhaps kind = * -> *) ? 11:45:59 ok 11:46:02 * shapr blinks 11:46:11 I haven't gotten into kinds yet 11:46:15 just heard of them 11:46:21 so you want Tree as an instance of the Node class, not say Tree Int ? 11:46:34 er, I don't know :) 11:46:47 kinds are for types(-constructors) what types are for values 11:46:57 oh 11:47:00 kinds = metatypes 11:47:03 that's easy enough 11:47:42 an good example of the difference (with Tree / Tree Int), look at the predefined Functor class 11:47:52 * shapr looks 11:47:55 here comes (by heart) : 11:48:01 class Functor f 11:48:03 where 11:48:16 fmap :: (a -> b) -> f a -> f b 11:48:20 ok ? 11:48:36 some instances : 11:48:36 * shapr thinks through that definition 11:48:45 instance Functor [] 11:48:47 where 11:48:52 fmap = map 11:48:57 or 11:49:04 fmap f [] = [] 11:49:29 fmap f (x:xs) = f x : fmap f xs 11:49:36 makes sense 11:49:42 so that's how they implement map? 11:49:46 instance Functor Maybe 11:49:47 where 11:49:56 fmap f Nothing = Nothing 11:50:15 fmap f (Just x) = Just (f x) 11:50:23 yeah. 11:51:08 you understand the difference of saying that Maybe Int belongs to a class, as opposed to Maybe ? 11:51:16 err 11:51:27 I think that Maybe Int is a Monad a 11:51:31 like 11:51:43 it's a Maybe monad somehow 'applied' to an Int 11:51:46 or something like that 11:51:49 look as the class definition of Functor 11:52:02 f is a type constructor 11:52:15 oh 11:52:23 it wants a type (here a or b) to give a type (here f a or f b) 11:52:25 that almost clicks... 11:52:34 Maybe is a type constructor 11:52:38 ohh 11:52:48 err 11:52:48 you can't have a value of type Maybe 11:52:49 hmm 11:52:50 Either monads are good too 11:52:58 it must be Maybe something, you know 11:52:58 Maybe a 11:52:59 why can't you have a value of type Maybe? 11:53:06 why? 11:53:25 because type constructor can only take a set number of parameters? 11:53:40 and Maybe is defined as "Maybe a" ? 11:53:43 well all types (as opposed to the super-set type-constructors) can have values 11:53:52 Maybe /= Maybe a 11:54:00 yah, that makes sense 11:54:24 Maybe is like a functon taking a type and giving a type, on the type level 11:54:38 could perhaps be written : 11:54:44 Maybe :: * -> * 11:54:49 Int :: * 11:54:52 Bool :: * 11:54:57 Maybe Bool :: * 11:54:59 see ? 11:55:13 ummm 11:55:23 ok 11:55:25 I think I've got that 11:55:52 we have a set of values, and we categorise them for likeness (and usability with operators like plus) 11:56:13 each category corresponds to a type 11:56:36 so we say True :: Bool and 'a' :: Char 11:56:54 so types are sort of like a categorisation of values 11:57:17 now one can see things in two ways (at least) : 11:57:46 either a type is a sort of value (so its type is say Type (what's Type's type ? :-)) 11:58:07 or it's at a different level "above" values 11:58:17 you with me so far ? 11:58:36 yeeesss... somewhat 11:58:40 I have to go over that several times 11:58:47 but it makes sense kind of... 11:58:57 types are categories of values 11:58:59 right, that I understand 11:59:11 but types must be a sort of value also 11:59:15 the second way is usually easier and clearer (but some languages do it the first way instead) 11:59:19 which makes sense (like metaclasses make sense) 11:59:54 in haskell you can't pass types around as data at run-time, say in data-structures 12:00:07 so in haskell it's different levels, ok ? 12:00:10 ok 12:00:23 no constructing types at run-time 12:00:44 in some (stupid) prog.langs one can't define new types 12:01:26 in some other (like C or Java) you can define new types (like IntTree,ObjectTree,HashTable,Banana,Season, ...) 12:01:47 yah 12:02:32 these languages often have some sort of type constructors built-in (in C there is "array of" and "pointer to", in Java there's "array of", in Pascal there's "set of") 12:02:42 ok 12:03:01 uh... 12:03:14 hmm 12:03:16 hmmmm! 12:03:22 things are becoming cleare 12:03:23 clearer 12:03:44 but the real array- or pointer- or set- constructor is not yet a type. it's a means of generating types with some certain similarities in how they are built 12:03:57 right 12:04:29 but array-of-int,pointer-to-set-of-array-of-float, etc .. is real types which have values 12:04:50 (a type can be a real type without having any values, though) 12:05:13 empty types? 12:05:15 weird 12:05:18 oh wait! 12:05:28 the Season type was one of those, right? 12:05:30 or was it... 12:05:34 no 12:05:38 if it can be Enum'ed it might have a value 12:05:51 you know a little C ? 12:05:55 some.. 12:05:58 very little :) 12:06:06 I'm best with Python and Java at the moment 12:06:15 though I have done a bit of Scheme and elisp as well 12:06:29 if we write enum { true,false } boolvariable; 12:06:44 yah 12:06:54 then boolvariable is a variable of an enum type consisting of the values true and false, right ? 12:07:10 right 12:07:19 if we could write enum { } foo; 12:07:24 oh 12:07:31 I see 12:07:33 empty types 12:07:36 wow 12:07:46 then foo would be an (uninitialized) variable of a type for which no values exist ! 12:07:53 in haskell : 12:07:55 wow, cool 12:07:57 data Void 12:08:06 that's nifty 12:08:51 these can sometimes be useful (not often), but we (at least i) don't like arbitrary restrictions (of e.g. trivial "unusable" cases) 12:09:27 oh you mean, the implementors could have said "there's no use for this, so you can't use it" but that bugs you? 12:10:12 when it dawned upon me that we e.g. in sorting algorithms (most often) don't have to treat a single-element collection as a special trivial case, but instead the empty collection, a light lit up :-) 12:10:16 yes 12:10:36 ohhh 12:10:37 cool 12:10:55 it's better with symmetry so you don't have to remember so many catches and special exceptions/cases 12:11:05 riiight 12:11:31 well where was i, with types now, ahh now i recall : 12:11:39 and you can do fun stuff like instance Void Ord and tell it that everything is larger except itself 12:11:52 cute 12:11:58 so a type (at least potentially) can have values, ok ? 12:12:08 right! 12:12:47 but a type constructor (like "array of") can't because it's a means for constructing a "real" type, ok ? 12:12:51 ok 12:13:16 (though as a quick aside, in Smalltalk, the Metaclass object is an instance of an instance of itself) 12:13:25 (or something close to that) 12:13:38 so we can say that types have the (meta-)type "star" (written *), meaning that it can have values, ok ? 12:13:50 ok 12:14:18 yes, i know, one can create circles and cycles also,but thats the other different approach 12:14:39 so we can write 12:14:43 Int :: * 12:14:55 so * means "I'm neither a type constructor, nor am I data Void" 12:15:00 (perhaps :: is misleading, perhaps we should use ::: or something) 12:15:02 ohh, I get it! 12:15:08 no, it makes sense 12:15:10 except for : 12:15:13 Void :: * 12:15:15 you're treating Int as a function, and I get it 12:15:21 I wasn't thinking like that before 12:15:42 you mean List or Maybe or something instead of Int ? 12:15:59 or waht do you mean by function ? 12:16:01 huh? 12:16:26 Int :: * 12:16:58 looks like Foo :: Int 12:17:13 Int's meta-type (or kind /= ordinary type) is star ( * ),which means that it can have values (but Void "chooses" to not have anyway), ok ? 12:17:15 er, sorry "foo :: Int ; foo = 42" 12:17:19 ok 12:17:41 but then when you said "Int :: *" it suddenly clicked 12:18:02 it implies that Int is a function which constructs Ints 12:18:08 you mean it looks like a typing (a type assosiated with a value having that type) , except this is a meta-typing (kinding (?)) 12:18:43 Int is a general form for all Int's (like 5,-4,8) and for nothing else 12:18:44 er, yah, I think so 12:19:03 it's like there can be another one 'above' "foo :: Int" yah, meta-typing is the right word 12:19:24 when you say function, for me at least, it implies that it takes an argument (which Int doesn't, but Maybe do) 12:19:27 so I can now envision "Int :: * ; foo :: Int ; foo = 42" as being normal and understandable 12:19:36 yes 12:19:37 true 12:19:51 but it's typing Int that makes sense to me 12:20:08 there are some implementation drawbacks of course, with doing this fully through 12:20:15 ok, good 12:20:40 now we can easily say : 12:20:45 Maybe :: * -> * 12:20:52 aha! 12:21:15 (or perhaps Maybe :: * -*> * , because the -> is not the same as -> in ordinary types !) 12:21:33 Maybe's meta-type is something that takes a type and returns a type? 12:21:41 it's more or less a type-level function, loosely expressed. 12:21:49 ok 12:22:08 but we can imagine something like this : 12:22:21 Foo :: (* -> *) -> * -> * -> * 12:22:30 defined by : 12:22:47 data Foo f a b = Foo (f a) (f b) 12:23:26 this Foo takes an a type-constructor (like Maybe) and two types 12:23:41 ok 12:23:58 ok ? (this is of course more complex but can occosionally be useful) 12:24:09 yah, I got it 12:24:52 this is most often not ordinary day-to-day types of a programmer, but theoretically they're there (and sometimes practically too) 12:24:56 I'm not sure why you'd want to do it 12:25:04 at least, not yet 12:25:45 i can't think of any example right now (see it's not commonly used) but i know i have seen real useful examples 12:26:31 ok 12:26:36 side note : [Int] can also be written [] Int, with analogy to Maybe Int 12:26:55 and Int -> Bool == (->) Int Bool 12:26:56 so [] is a type constructor? 12:27:01 oh 12:27:05 on the type level, yes 12:27:26 [] as a type(-constructor) is diffenent as [] as a value 12:27:38 I understand that 12:27:39 same characters but different concepts 12:27:53 like () is both a type and a value 12:27:56 []:'a':'b' 12:28:01 is the value 12:28:12 (in ML () is the value and unit the type) 12:28:18 Foo :: [] 12:28:21 is the type constructor 12:28:30 yes (execpt it's reversed) 12:28:42 ? 12:28:58 well you have to do foo :: [a] or foo :: [] a 12:29:11 can you have a function that returns an empty list? 12:29:24 because [] (in the type world) is a type constructor (like Maybe) (of kind * -> *) 12:29:29 yes 12:29:42 bar :: a -> [b] 12:29:47 bar _ = [] 12:30:26 ok ? 12:30:38 ok 12:30:45 I got that 12:31:10 can you figure out the kind (meta-type) of the function arrow -> ? 12:31:31 hm 12:31:37 * shapr thinks 12:31:42 (it's infix syntactic sugar like a + b == (+) a b ) 12:31:57 so it gotta be something like : 12:32:03 (->) :: ??? 12:32:09 ok 12:32:42 (->) :: (* -> *) -> (* -> *) 12:32:45 ? 12:32:45 (i.e. if we use the same syntax for infix type-operators as for infix value-operators (like (+) and (*) ) ) 12:32:56 not quite 12:33:03 ok, lemme think about it again 12:33:47 example type to look upon : ([Int],Char) -> [Int -> Char] 12:33:55 perhaps it helps 12:34:21 hrm 12:34:37 --- join: kepler (~kepler@adsl-81-163-152.asm.bellsouth.net) joined #haskell 12:35:11 I get the feeling I'm close 12:35:21 what kind does the two subexpressions to the left and right of the "->" have (trying to help your thoughts) 12:35:43 kind means meta-type, right? 12:36:06 (you can also compare with (1 * 2 * 3) + (sum [4,5,6]), where you want the type of (+) ) 12:36:11 yeah 12:36:33 type of (+) in that case is just Int -> Int 12:36:39 at least, I think it is 12:36:51 at least, I think it 12:36:52 er 12:36:53 oh 12:36:57 I see something I missed at least 12:37:13 (except we can define a meta-meta-type for meta-types if we want (but it's probably not so interesting (a little like platonic bodies in dimensions greater than four))) 12:37:36 (->) :: (* -> *) -> (* -> *) -> f 12:37:38 ? 12:37:41 uhh 12:37:45 lemme check that 12:38:09 look a little at my example in the paranthesis with + 12:38:34 that looks like it would be Int -> Int -> Int 12:38:51 --- join: Diego (diego@OL55-23.fibertel.com.ar) joined #haskell 12:39:00 which would imply that (->) :: (* -> *) -> (* -> *) -> (* -> *) 12:39:10 the type of +'s first argument is the type of the expression to the left of +, with the second it's the right expression, otherwise similar 12:39:11 but I'm not convince that -> would return a type constructor 12:39:43 uh 12:40:02 the kinds of a typeconstructors arguments are the kinds of the sub-typexpressions passed as arguments, ok ? 12:40:20 ok 12:40:24 so look at ([Int],Char) -> [Int -> Char] 12:40:38 what kind does ([Int],Char) and [Int -> Char] have ? 12:40:53 that's the kind of the function arrows arguments 12:41:23 uh 12:41:30 the kind of the whole expression ([Int],Char) -> [Int -> Char] is the kind of the result generated by the function arrow, ok ? 12:41:52 uhh 12:42:06 I can almost get this, but not quite 12:42:16 Int has kind * , therfore [Int] has kind * and Char has kind * 12:42:19 what's the kind of *any* expression? 12:42:27 ok 12:42:29 now what kind does ([Int],Char) have ? 12:42:30 expressions don't have kinds, types do 12:42:34 Int has kind * because it can have a value 12:42:45 kind would be (*,*) ? 12:42:49 is it really that simple? 12:43:06 is there a tuple constructor I have to think about? 12:43:10 is a pair of int lists and char a value ? 12:43:13 is a tuple a type? 12:43:34 a pair of int lists and char is a type, yes. 12:43:51 ok, that's nice to know 12:44:10 (maybe, i'm just confusing the issue with my feeble attempt with these examples) 12:44:36 so anything of type ([Int],Char) -> [Int -> Char] is a function, right ? 12:44:38 as a general point, not having read this entire discussion, I'd note that I've been using Haskell for years without ever having to properly understand the kind system to do useful work with the language 12:44:42 I'm definitely learning stuff, so if you want to keep talking, I'll keep trying to understand :) 12:45:06 (->) :: * -> * -> * 12:45:13 yah, I know I could probably keep using it with knowing this kind of stuff, but this is *fun* ! 12:45:18 yeah :-) 12:45:36 that's a good enough reason, just don't get too bogged down with it if it stops being fun :-) 12:45:39 OH! 12:45:54 Heffalump : well, you might say that porperly understanding kinds and stuff is over-course, but i was interested, so i figured it out 12:45:54 smkl : your'e correct, hooray !! 12:46:01 so both * and (*,*) would both fit into the * type? 12:46:28 no (*,*) is not into * 12:46:34 oh 12:46:55 but (Int,Int) is into * because it's a type (which can have values) 12:46:55 hm 12:47:01 oh! 12:47:24 you can write (,) 1 2 instead of (1,2) as a value in haskell 12:47:32 cool 12:47:44 therfore (,) is a function (type is a -> b -> (a,b) ) 12:47:56 wow, spiffy 12:48:00 ski: do you have a reference for the "any type which can have values is kind *" thing, or did you just figure it out? 12:48:12 there isn't much difference between "kinds" and "types". "types" are types for terms, "kinds" are types for types 12:48:16 but now they write the type with the same syntax, confusing things up (at least syntactically) 12:49:53 Heffalump : no i don't have a reference but i'm pretty sure about it, because otherwise it don't think the paper's iv'e browed through and tried to understand, which used kind, would have made any sense to me at all 12:49:58 * shapr takes his new knowledge and applies it to the original question 12:50:00 should the argument to the Node class be a type (kind = *) or a type constructor (perhaps kind = * -> *) ? 12:50:34 ski: right. It certainly makes sense to me, but as I said I've never really understood the kind system. 12:51:27 smkl : yes, that one good was to put it (except, i'd like to (syntactically also) separate between type as type for value and type as this categorizing concept applying to both values, types,kinds (meta-types), etc ...) 12:52:31 I like to think of types as sets, sometimes 12:52:52 shapr : well, that your choice, but it certainly (to me seems easier) with the constructor way, i.e. one instance is defined (e.g. Maybe) , instead of many instances (Maybe Int, Maybe Bool, etc ...) 12:54:01 Heffalump : well, that's a quite good view. i see sets as a certain possible interpretation/implementation of types, but it's not the only one possible 12:54:54 * ski is trying to catch up with all the sudden explosion of responses ;-), and read them all thu 12:55:26 ski: yeah 12:55:31 hi Diego 12:55:47 I suspect proper type theoreticians would tell me exactly why the view of them as sets is wrong 12:56:35 Heffalump : about now only learn about theoretical things like kinds : yes, point taken, but right now, it's still fun ! (i'm also interested in more mundane things, perhaps not always so much :-) 12:56:58 :-) 12:57:06 what do you do? 12:57:23 * ski has a tendancy to let the thought race on and on and forget the original issue 12:57:34 (still reading thu) 12:57:46 thu? 12:58:30 probably should have been thru or tho 12:58:46 shapr : Diego ? i saw no Diego ? 12:59:15 ski: he and kepler joined while we were talking 13:00:30 I think of type classes as Interfaces in Java 13:00:36 obviously they are much much more 13:00:53 http://www.cis.upenn.edu/~bcpierce/types/archives/current/msg00807.html 13:00:55 that's a reasonable approximation to what they are 13:01:04 Heffalump : often in math they say that this or that is defined as a certain set in some way. for some reason it makes me angry. because often many more-or-less equivalent (in effect) definitions are possible. so i consider them only as possible implementations and the "real concept" is what all possible implementations have in common, i.e. the "spirit" of the concept 13:01:29 that also applies to life in general btw 13:01:37 occams razor does get overused 13:01:38 Heffalump : whaddy mean by "what do you do?", me not understand 13:01:40 but if many equivalent definitions are possible, what's the problem with choosing one? 13:01:56 ski: e.g. student etc 13:02:02 Heffalump : (s/thu/thru/ or s/thu/though/) 13:02:09 right :-) 13:02:26 shapr : ok, missed that (about kepler ..) 13:03:06 interfaces in java has much in common with type classes in haskell 13:03:43 --- quit: Diego () 13:03:50 the major conceptual difference is that interfaces and classes sit on the same "level" in Java 13:04:09 whereas Haskell type classes and Haskell types are completely separate 13:06:09 * shapr tries to write a Node class 13:06:13 Heffalump : no problems with choosing one implementation, only you're aware that it could be defined in diffenent ways and still yield same consequences. what makes me upset is when they say (or imply) that this is the One True definition. understand me now ? 13:06:28 with 'methods' parent, leftchild, rightchild, and content 13:06:34 ski: right 13:07:01 interfaces just yield, just that an interface, while a class yields both an interface and an implementation 13:07:08 shapr: why are you writing that as a class, btw? 13:07:33 Heffalump: couldn't think of a better way to drill the idea of type classes into my head 13:07:44 therefore, I may be going about this all wrong 13:07:53 is that a sensible thing to do? 13:08:07 Heffalump : i think he want's to see if he can make some sort of general interface for it, not dependant on particular type. and also to experiment with type constructor classes 13:08:15 okie dokie 13:08:22 right 13:08:39 ok, then i understood you correctly. 13:08:39 shapr: no, it's a reasonable thing to do, though I suspect you'll find that you could do the same thing just using a polymorphic type 13:08:44 several days ago, jewel asked me if you make 'methods' on a variable 13:08:54 i think it could be interesting to do it as a class. 13:08:57 and I thought type classes might be a good way to do that 13:09:26 methods on a variable ? 13:09:29 Heffalump: ok, I'll try to figure out how to do it as a polymorphic type after I get the class working 13:09:39 yah, like calling methods on an object 13:09:41 like a method on an object value in java ? 13:09:45 right 13:09:47 ok 13:10:17 well, the object/value's type must of course be made an instance to the class 13:10:20 type classes appear to be a reasonble facsimile 13:10:31 right 13:10:38 I've done that from the book 13:10:47 but I've never thought of using a kind 13:11:08 if one is trying to convert a java class to haskell, one have to make both a type and a class (because java classes is both interface (= methods) and an implementation (= haskell type)) 13:11:09 you can't really "use" a kind because they have no existence within the language itself 13:11:50 they're just important for typechecking a Haskell program. But there's no way (as far as I know...) of actually explicitly declaring something to be of a certain kind 13:11:51 yes, unfortunately, one can't write kinds explicitely in haskell 13:11:53 er, type constructor,sorry 13:11:55 not kind 13:12:05 ski: why do you think that's unfortunate? 13:12:11 but you can reason about them, and both hugs and ghc also do ! 13:12:16 * Heffalump has difficulty thinking how the ability to do it would be useful 13:12:24 and nhc and hbc, I hope :-) 13:13:19 well John Hughes come up with an example (real practical,i swere !) in some parser or something i thing 13:13:34 of wanting to use a kind directly? 13:13:43 ski: ah, ok. 13:13:56 Heffalump : yes , of course, it's needed for kind-inferencing. like a type-inferencer but in mini 13:13:57 oh, I might have seen that on the list. 13:14:16 John Hughes ended up defining something like this : 13:14:37 data Foo c a = Foo a | Unused (c Int) 13:14:53 to force c to be of kind * -> * ? 13:15:09 i guess he had also other types of kind (* -> *) -> * -> * 13:15:15 which he wanted to make instances of some class 13:15:24 to this Foo was the trivial case 13:16:01 if he hadn't put Unused (c Int) in there, c would defaulted to kind * and not (* -> *) as he wanted 13:16:35 but i guess these things don't come up practically so often (his code was of course advanced, that' 13:17:02 that's why it came in there at all i guess) 13:17:03 but even if most programmers wouldn't need it, they might want to use combinator libraries that did need it 13:17:15 yes 13:17:50 i think collection classes in haskell is best done using type constructors 13:17:52 especially if the example involved parsing 13:18:32 Heffalump : it this case i think it was an internal type in the implementation and not exposed to the outside 13:18:54 yep, but you still can't use a combinator library that doesn't work :-) 13:19:32 no, exactly. in Hughes case there was a workaround (or redesign the solution) 13:20:32 ok, now we've wandered far from shapr's initial example/problem/whatever (as always ?) 13:20:52 the wanderings are cool btw 13:21:10 this is like two months worth of the haskell mailing list =) 13:21:14 at high speed 13:21:15 (but, we've had fun on the way. at least i if i can speak for myself (which i think i can)) 13:21:24 * Heffalump too 13:21:38 the haskell list has John Hughes and other scarily clever people on it :-) 13:21:46 they do ? 13:21:47 --- quit: teek ("Coffee break") 13:21:48 I'm still trying to wrap my head around passing a type constructor to a class 13:22:08 ski: you're not on the haskell mailing list??? 13:22:09 I wish I had more time to understand the complicated examples of problems that get pasted there 13:22:15 s/pasted/posted/ 13:22:17 iv'e not read so much there. never subscribed there. only browsed sometimes from haskell.org 13:22:29 I wish I had enough clue to understand some of the stuff they post 13:22:39 shapr: you don't so much "pass" things to classes as "declare instances" 13:22:50 class Node (a -> b) where 13:22:50 ? 13:23:00 that's not legal 13:23:08 I suspected as much 13:23:09 shapr : no, iv'e never been on a mailinglist in my life. i'm scared of overfull mail-inbox 13:23:12 you have to do "class Node a where ..." 13:23:22 ski: you really need to filter email to do that 13:23:22 --- quit: kepler (Remote closed the connection) 13:24:24 Heffalump : i sometimes write something like Eq :: * -> instance , Functor :: (* -> *) -> instance , for mnemonics sake 13:24:58 ski: in a comment? 13:25:13 shapr : you want functions as an instance of Node 8-0 ! (good luck) 13:25:24 Node 8-0? 13:25:36 shapr: when you say "class Node a where ..." where "..." is some things involving a, you will determine what kind a has by how you use it in the "..." 13:25:49 oh 13:25:53 oh I see 13:26:03 ohhh 13:26:06 so if you say "class Node a where parent :: a e -> a e" then you are saying a must be of kind (* -> *) 13:26:08 Heffalump : well i think it's legal syntax (i.e. if has Node class takes a type (and not a type constructor)) 13:26:38 ski: sorry, I don't understand the bit in brackets. But is '*' ever legal syntax in a type? 13:26:43 Heffalump : well, i've been to lazy to learn how to filter mail, sadly 13:27:17 Heffalump : yes, in a comment 13:27:42 ski: oh, sorry, I thought what you said was a response to something else :-) 13:27:47 Heffalump : as i write the types for exported (and sometimes imported) values in a module 13:28:23 I still don't see how "class Node (a->b)" can ever be legal syntax 13:28:29 Heffalump : * is not a legal syntax in a type 13:28:41 ski: yeah, like I said I misunderstood what you were referring to with that comment 13:28:53 shapr : 8-0 was a smiley, ok ? 13:29:04 oh 13:29:14 duh :) 13:29:21 * Heffalump wonders when Haskell 2 might happen 13:29:23 I should have noticed that 13:30:18 if haskell had (optional of course) "kindings" of types then one could write the kind of argument types to a class directly (even if the class has no method members) 13:30:30 is => only used in a type declaration to limit to type classes? 13:30:42 shapr: I think so 13:31:01 I certainly can't think of anywhere else it is used, and I hope it's not legal to use it in your own operators 13:31:07 Heffalump : well, i'm also waiting for Haskell 2. there are some thing that should be fixed (more important than kindings that is) 13:31:15 ski: like what? 13:31:35 I want them to bring back guards in monad comprehensions, but that's not really very important :-) 13:31:51 shapr : => is used both in type,class and instance declarations to limit type classes. 13:32:03 ok 13:32:09 oh yes, I forgot that, sorry 13:32:30 so you get (==) :: Eq a => a -> a -> Bool 13:32:41 and class Monad a => MonadPlus a where ... 13:32:50 Heffalump : no it's not legal as a value operator, it's a non-alpahbetic reserved "keyword" , like \ and -> 13:33:05 good :-) 13:34:14 shapr : i'm not very happy with the current state of thing with the numeric classes (WHAT DOES SHOW HAS TO DO IN NUM ?), and a special issue regarding class contexts in datatype definitions 13:34:43 how can the show in num be fixed? 13:34:49 shapr : (that's right => is permitted in data declarations (and in newtype i presume) as well) 13:35:27 shapr : why should every type that i want to be an instance of Num be Showable ? 13:35:34 Prelude> :i Num 13:35:39 [...] 13:35:44 class (Eq a, Show a) => Num a where 13:36:07 shapr: he's complaining that Show is a prerequisite for Num 13:36:14 shapr : somotimes one can't (impossible) do that, in that case one has to declare a dummy Show instance which generates error when calling show 13:36:30 what's your example? 13:36:48 Heffalump : yes, Eq is also disputable if it should be there. 13:37:28 * ski whine whine whine (perhaps 'nuff whining now ?) 13:38:15 Heffalump : e.g. function of type Int -> Int 13:38:26 go on then, why is that a Num? 13:38:49 Heffalump : it's not in Num class, but : (coming) 13:38:56 I can see how you can put it in Num 13:39:06 but is it really useful to do so? 13:39:23 one might want foo + bar to be equal to \n -> foo n + bar n 13:39:44 yeah, I guess 13:40:20 Heffalump : well, i'm not sure if this particular example is practically useful (really that is) 13:41:10 Heffalump : but it still seems like an unnecessary prerequisite for membership of the Num club, so to speak :-) 13:41:24 yeah, fair enough 13:41:43 one might want to define Set a as implemented as a -> Bool 13:41:45 though in general I think when you design interfaces you sometimes have to sacrifice overall elegance for general convenience 13:42:16 you can't define (*) :: a -> a -> a on sets 13:42:18 that's a often taken view i math i think 13:42:41 oh, I guess you could make it intersection 13:42:52 but you still can't define abs :-) 13:43:44 Heffalump : no i can't but i perhaps (not sure if i really want) want to split the num class into AdditiveRing,MultplicativeGroup, etc. at least for it be possible to do so. not saying here that is is normally always preferred 13:44:15 Heffalump : Clean's type-classes are a little in that direction 13:44:26 right, I've not looked at that 13:44:37 they have in Clean a PlusMinus class (supporting +,-,negate) 13:45:12 and then built the (more or less) corresponding class for Num on such things 13:46:42 so Boolean and and or can also be fitted into some of the classes that numbers fit in, ok ? (isn't it beautiful (well, i don't know really for sure because i'm not worked very much with Clean)) 13:48:11 ok, perhaps 'nuff said about revamping haskell's numeric classes here ? or anyone wan't to say more (who am i really to dictate what people here should talk about ?? ;-) 13:49:11 hello you shapr : have you come any way with that Node class of yours ? or have you decided to try something else ? 13:50:03 * ski is trying to cool down a little 13:51:58 ski: er, I got distracted into reading about type classes more 13:52:26 how do I use a type constructor in a class? 13:52:51 use it to do what? 13:53:00 well, it's quite interesting. it's a little like prolog. i.e. type classes without any methods are (partly) similar to prolog's predicates 13:53:29 shapr : look at the definition of the Functor class 13:53:54 i can provide it once again below if you like, do you ? 13:54:35 Heffalump : i think shapr mean't how to write it, did you shapr ? 13:54:42 yup 13:54:55 so you want to write a type class that has type constructors as instances? 13:55:28 sure :) 13:55:37 I hadn't even thought about it before 13:55:49 shapr : yup, i want to see Functor class again or just yup, i want to know how to write and use it ? 13:55:53 but ski mentioned it as an option 13:56:01 I want to know how to write and use it 13:56:07 ok 13:56:15 I've pasted the definition you gave me earlier into a buffer 13:56:25 it more or less as a normal class and instance definition 13:56:26 ok, so "class Node c where ..." is how you get started 13:56:35 you can call c whatever you like 13:56:47 oh, and leave out the ... :-) 13:57:02 yes, just that c must get some arguments (cuz otherwize it's not a type constructor) 13:57:25 yep, so when you *use* c in the body of the type class, you give it argument(s) 13:57:36 Heffalump : you mean me :-) (sorry:) 13:58:03 Heffalump : i missunderstood. ignore my previous comment. 13:58:05 but you can still pass the type constructor in as just c 13:58:20 yes 13:58:42 something along these lines perhaps : 13:58:48 class Node n 13:58:50 where 13:59:02 leftChild :: n a -> n a 13:59:10 rightChild :: n a -> n a 13:59:21 nodeContent :: n a -> a 13:59:41 was it something along these lines you thought about ? 14:00:28 yup 14:00:54 and you probably want some constructing methods like : 14:01:04 nullNode :: n a 14:01:25 makeNode :: a -> n a -> n a -> n a 14:01:32 or something.. 14:01:47 as part of the class? 14:02:32 yeah, probably 14:02:51 you need to think what kind of trees you want to model 14:03:06 well, hmm. it depends on how the class is to be used. i thought about using it for abstract datatypes, but now i realise that you can of course have it only as an extra class atop for easier browsing thu nodes .. 14:03:18 i.e. will they have data at the tips, in the nodes (the non-tips) or both? 14:03:59 er 14:04:04 I'm not picky :) 14:04:46 ok, so if you do what ski said then they'll have data at the non-tips only 14:04:49 Heffalump : good questions to ask oneself. but it doesn't have to be used for providing abstrat datatypes , so in that case constructing methods are not totally nessecary (cuz you already know the type and constructors of the data you're manipulation) 14:05:00 ski: minor detail, what would you expect nodeContent nullNode to return? 14:05:24 ski: true, if you leave out the nullNode and makeNode functions above 14:05:57 different kind of trees for different needs. when i head an unqualified tree, i thinks : tree with data in nodes but not at tips (probably binary too) 14:06:07 s/head/hear/ 14:06:57 Heffalump : well error as head [] does ? (most probably anyway) 14:07:32 ski: ok. 14:07:53 Heffalump : another way is to make a "case-function" with type (a -> n a -> n a -> b) -> b -> (n a -> b) 14:08:02 I think if not all parts of the tree will have data, then nodeContent should be type n a -> Maybe a 14:08:15 yes thats possible 14:08:19 anyway. 14:09:11 right 14:09:13 anyway :) 14:09:20 ok 14:09:34 taking the simplest case of using a type constructor here... 14:09:47 mmm. 14:11:03 hm 14:11:33 shapr : you working or thinking on your program right now ? 14:11:38 thinking 14:11:53 I don't really know what to do about instances with type constructors involved 14:12:26 ok, so how would you define an instance without a type constructor involved? 14:12:47 e.q. show me how to write an instance of Eq for Bool 14:12:48 Heffalump : me ? 14:12:56 no, shapr 14:13:03 * Heffalump was kind of assuming you could do that :-) 14:13:07 instance Node NodeInst where 14:13:28 of course, I'd usually put a built in type there 14:13:35 like Char or Int or whatever 14:13:47 * ski thought about "define an instance without a type constructor", ok ? 14:13:58 oh 14:14:24 shapr : that's was a comment to Heffalump 14:14:36 oh 14:14:49 I thought suddenly that I need to do "data NodeInst" 14:14:54 and I think that's right 14:15:07 yes it is 14:15:12 data NodeInst is how you declare the type NodeInst 14:15:24 instance Node NodeInst is how you make it an instance of Node 14:15:39 data NodeInst left right content = 14:15:41 yes you need at least some type poulating your class, otherwise there wouldn't be much point in defining it in the first place, would it ? 14:15:41 something 14:15:49 ski: right 14:16:09 hmm 14:16:30 (left,right,content) ? 14:16:46 shapr : data NodeInst left right content = ... means that the type of the left and the right tree can be different (probably not what you want) 14:16:53 oh 14:17:01 I'm still thinking in values 14:17:45 hrm 14:18:05 data NodeInst branches content = 14:18:17 er 14:18:40 it takes some practice to be able to think in types. some functions are so nice that they can sort of be generated from their type. that's espessially good when it would be hard (or very hard) to directly come up with the implementation. 14:19:18 I'm definitely finding it challenging 14:19:57 shapr : perhaps you should start with trying to think out what constructors you want and what arguments (parts of a NodeInst .. value) they should have 14:20:20 good point 14:20:31 shapr : and wait with determining exactly what arguments the type constructor NodeInst should have 14:21:27 when one is writing code in an editor before one's eyes, it's easy to change that many times, and not always even remember that one has changed it 14:21:46 urf 14:21:56 becuz it's easy to edit, and should be 14:22:09 I'm having coders block :) 14:22:21 or something 14:22:23 my mind is blank 14:22:29 oh 14:23:18 if I say data foo = ... 14:23:24 well, try to choose if you want data in nodes or tips (or both). e.g. choose data in nodes for simplicitys sake (or whatever you like) 14:23:27 there is a way to make multiple constructors for that custom type? 14:23:32 in nodes, not tips 14:23:45 for simplicitys sake as you said 14:23:54 ok. 14:24:28 multiple constructors is easy. remember : data Either a b = Left a | Right b 14:24:49 only put a | between the different constructor forms 14:24:49 hm 14:25:05 (i know you know that :) 14:25:25 or more nicer in an editor : 14:25:32 data Either a b = Left a 14:25:43 | Right b 14:25:46 yah, but I hadn't explicitly thought of that as multiple constructors 14:26:00 well, that's what it is. 14:26:13 nifty 14:26:43 Left, and Right are constructors, they are plural (more than one), hence multiple. Q.E.D. ;-) 14:26:51 heh 14:26:54 good point 14:27:19 just a tautology. 14:27:20 but I'm not sure how to generalize that notion... 14:27:27 I think my brain may be full for the moment 14:27:28 :( 14:28:12 I think I need to wander off and do something mindless for awhile and let this all sink in 14:28:30 if i understand you correctly you want that one for of an NodeInst ... should contain data (say of type a) and 2 (or do you want more ?) subnodes. is this right ? 14:28:43 right 14:28:59 2 subnodes (of type NodeInst I assume) 14:29:01 and one content 14:29:31 shapr : could be, sometimes it helps to rest the brain, and come back to a problem from a new view-point, when one's not into the subject at the same way. 14:29:53 say the constructor look like : 14:30:04 NodeI a (NodeInst ...) (NodeInst ...) 14:30:19 is this good ? 14:31:15 * ski yawns a little 14:31:45 * ski a little tired, but can still stay more time if wanted 14:32:32 * Heffalump has got back to writing SML, which is his current job 14:32:42 sadly I keep trying to write Haskell syntax :-/ 14:32:51 btw : according to what time does clog time these channels, GMT ? 14:33:04 I dunno 14:33:09 * shapr looks 14:33:11 GMT I think 14:33:41 oh. no. 14:33:43 Heffalump : can be a little hard sometimes to switch syntax-mind-set 14:33:45 looks like PST 14:34:04 Heffalump : so you're writing SML, care to tell what ? 14:34:18 umm, stuff to manipulate .NET IL 14:34:25 IL? 14:34:30 intermediate language 14:34:33 like Java bytecode 14:34:38 oh 14:34:46 I wondered if .net was related to IP 14:34:51 not really 14:35:06 ski: much thanks for your patience and teaching today :) 14:35:08 Heffalump : current time according to clog is approx. 14:34:18 . but it's half past eleven in the evening here in Sweden 14:35:16 ski: yeah, that's why I said PST 14:35:31 half past midnight in .fi 14:35:34 cos it's GMT-8, and it's 22:35 GMT atm 14:36:57 19. A language that doesn't affect the way you think about programming, is not worth knowing. 14:37:06 part of alan perlis' sayings 14:37:15 shapr : it's always a pleasure for me. i only worry sometimes that i somtimes may reveal answer too quickly or talk over the head of talked-to-person, cuz i try to make it understandable. but i'm totally inside it and used, and has perhaps sometimes forgotten how it seems like from the outside 14:37:41 ski: I think you do quite well 14:37:42 Heffalump : i'm not sure what time PST exactly is. 14:37:51 GMT -8 :-) 14:37:52 Pacific Standard Time 14:37:55 oh 14:37:56 that part 14:37:57 ah, yes, that too. 14:38:07 shapr : who's alan perlis' ? 14:38:07 West Coast of the US, anyway 14:38:08 aka, west coast usa 14:38:24 I'm from Central Time originally 14:38:39 or EST sometimes 14:38:44 * Heffalump has lived in GMT/BST all his life 14:38:51 cool :) 14:38:59 I went from EST to EET 14:39:00 except for brief excursions to PST/PDT and various holidays 14:39:11 shapr : i've never "officially" lectured or teached anything, but i love to learn (at least most things, except perhaps Deusche grammatik, and some other things) 14:39:28 Heffalump : ok, west coast, then. 14:40:01 ski: sadly, official teachers and lecturers aren't nearly as much fun to listen to as enthusiastic learners 14:40:33 it's very easy to get bored of teaching the same thing over and over again 14:40:44 shapr : some of my lecturers even said wrong things (that i think was not simplifications) 14:40:49 http://www.cs.yale.edu/homes/perlis-alan/quotes.html 14:41:01 Heffalump: yah, I agree with that 14:41:03 ski: not John Hughes I hope :-) 14:41:09 believe it or not, I'm alpha geek where I work 14:41:26 teaching people how to read a file in Java is ok the first four or five times 14:41:32 after that it loses its thrill 14:41:51 Heffalump : i hadn't thought of that. probably because i havn't teached (officially). could well be so in some case. the lecturer is perhaps more engrossed in his own special research project :-) 14:43:08 * Heffalump has taught classes for a functional programming courses and for a procedural programming course. I found the functional programming course more interesting, but I still got bored with both. 14:43:09 shapr : i believe you. that doesn't sound much fun to me either. 14:43:24 I've only taught coworkers 14:43:39 I really wanted to start them with SICP 14:43:54 but they and my bosses really wanted them to learn Java, since that's how we get money 14:43:58 oh well 14:44:00 Heffalump : so moral is : try not to officially teach cuz it makes you less excited ? 14:44:19 ski: but if noone ever officially taught then most people would never learn 14:44:22 I think the moral is "don't do stuff if you're bored with it" 14:44:38 I was taught Haskell by a completely incompetent lecturer but I still got to like it a lot 14:44:52 I've never had any CS courses. 14:44:55 it's probably a difference if one is teaching all day long or only then and then to friends,coworkers and people you meet. 14:45:34 I don't do very much teaching, so I don't have that much opportunity to get bored with it. If I was a lecturer I suspect it might get quite bad :-) 14:46:06 shapr : no one should look down on one for that. some people learn better by themselves. 14:46:29 I think I learn best in a peer to peer environment like this 14:46:52 but I can also teach myself 14:47:03 though, i suppose some people have more or less a gift for teaching, but i think that even then it can get boring at times. 14:47:47 okeydokey. 14:49:13 shapr : you sitting at home,school or work ? 14:49:15 ski: do you think you'll be back online soon? 14:49:19 at home 14:49:32 working with Java makes enough money to pay for a dsl line :) 14:49:41 even just across the border from Haparanda 14:50:28 ski: do you live far from school? 14:50:32 shapr : well, i suppose i often have irregular habits (because i'm "tankspridd"(swedish) often) but i hope to be back here some time soon, yes . 14:50:56 what's tankspridd? 14:51:18 shapr : well, it's biking-distance. maybe 3 - 6 kilometres or something, i'm not sure. 14:53:14 shapr : "tankspridd" (i don't know the english translation), when you often have lots of diverse thoughts about different things and easily forgot things, like to eat breakfast, or pay the bill the correct day (though i'm getting better at that) , and returning loaned books to the library 14:53:50 y'know what i mean ? 14:54:05 forgetful? 14:54:12 distractable? 14:55:02 yah, I know what you mean 14:55:04 same for me 14:55:49 * ski trying to look up the word in an web-dictionary that used to be somewhere on these web-pages .. 14:55:54 well, I'm off to play tribes2 for a bit, and then time for sleep 14:56:31 once again, much thanks for your help ;) 14:56:33 * shapr waves 14:56:43 well, cant find it now :-( 14:56:51 goodby , shapr. 14:57:00 * ski waves back 14:57:04 --- quit: shapr ("tribes2!") 14:57:56 ok, you others there. perhaps you wan't to discuss things on your own without me interupting you, or are you still there ? 14:58:42 * ski stays at least a little while longer here and is still available 14:59:35 * ski will read a little more usenet now. shout if you want my attention, ok ? 14:59:48 BOO! (just joking) 15:00:28 Heffalump : i heard you ! 15:01:12 oops, my shell has broken a little, will log on fresh .. 15:01:14 --- quit: ski ("Leaving") 15:01:17 --- join: ski (~md9slj@fraggel83.mdstud.chalmers.se) joined #haskell 15:13:32 --- join: dennisb (~dennis@as2-4-3.an.g.bonet.se) joined #haskell 15:38:02 --- join: kepler (~kepler@adsl-81-163-152.asm.bellsouth.net) joined #haskell 15:38:14 hi, kepler. 16:33:14 --- join: Heffalum1 (ganesh@munchkin.comlab.ox.ac.uk) joined #haskell 16:33:43 --- quit: Heffalump (carter.openprojects.net irc.openprojects.net) 16:44:30 --- quit: dmiles (Read error: 104 (Connection reset by peer)) 17:16:18 --- quit: kepler (Remote closed the connection) 17:24:49 --- quit: juhp (Read error: 60 (Operation timed out)) 17:27:43 --- join: dmiles (~alife@sense-sea-MegaSub-2-56.oz.net) joined #haskell 17:46:06 bye 17:46:21 --- quit: ski ("tired,home") 18:23:55 --- nick: Heffalum1 -> Heffalump 19:34:30 --- nick: clausen -> clauZzzen 22:50:39 xbill: i am porting to mercury now 22:50:52 xbill: have you used it much? 22:52:58 any mercury experts here? 23:50:06 --- join: teek (teemu@k72.viikki.hoasnet.fi) joined #haskell 23:59:59 --- log: ended haskell/02.01.10