# Experimental IRC log haskell-2007-08-28

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

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

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

 00:00:17 @pl all3 f = all f [0..2] 00:00:17 all3 = flip all [0..2] 00:02:05 chessguy: haskell contains most frequent forms of recursion as a predefined function in some way 00:02:20 oerjan, oh i know 00:02:28 oerjan, i'm re-writing someone else's code :) 00:02:52 heh 00:03:18 aiming for that one-liner to replace their whole program? 00:03:22 lol 00:03:43 not likely, but they didn't give haskell a very nice review, so it would be nice to give a little 'in your face' 00:03:55 http://www.prairienet.org/~dsb/t3/t3.htm 00:03:56 Title: Dan Bensen: Tic-Tac-Toe 00:05:09 @type intersperse 00:05:12 forall a. a -> [a] -> [a] 00:05:30 > intersperse 3 $repeat 1 00:05:31 [1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3... 00:06:24 wow, i've never seen a haskell line of code end with this: 00:06:26 )]))))) 00:06:35 anyone here has any experience of tabular in lhs2tex? 00:07:22 someone doesn't know about . and$ ... 00:07:40 chessguy: Liskell? :) 00:08:06 bwahaha 00:08:45 chessguy: heh 00:09:47 hmm, test ? (ifTrue,ifFalse) = if test then ifTrue else ifFalse' 00:10:10 hmm , mapVal x = map (\i -> x) 00:10:42 I detect lambdabot at work! cellIsFull = (not .) . cellIsBlank 00:12:17 @unpl (not .) . cellIsBlank 00:12:17 (\ d g -> not (cellIsBlank d g)) 00:15:54 dons, surely lambdabot would have found that mapVal = map . const 00:16:00 come on... someone here HAS to have experience with lhs2tex 00:17:13 pastorn_, you're usually better off just asking your question 00:17:18 lhs2TeX is a preprocessor to generate LaTeX code from literate Haskell sources. It is released under the GPL. 00:18:46 i want to make a page that is a big table with two equally wide columns 00:20:06 so i want the width of the whole table to be \linewidth wide and and the columns to be (\linewidth -x) / 2 where x is a small separating space in the middle 00:20:28 chessguy: CPS is used in Haskell? 00:20:56 phobes, apparently. i haven't looked at the code in detail yet 00:25:32 chessguy: yeah, a bit weird 00:34:41 @hoogle intersperseM 00:34:41 No matches found 00:37:30 chessguy: would intersperse x . mapM f do? 00:37:45 @type intersperse x . mapM ?f 00:37:48 Not in scope: x' 00:37:49 @type intersperse ?x . mapM ?f 00:37:51 forall a b. (?x::[b], ?f::a -> [b]) => [a] -> [[b]] 00:38:25 hmm 00:38:34 @undo do { header; putRow 0; divider; putRow 1; divider; putRow 2} 00:38:34 (header >> putRow 0 >> divider >> putRow 1 >> divider >> putRow 2) 00:38:44 :t liftM (intersperse ?x) . mapM ?f 00:38:46 forall a (m :: * -> *) b. (?x::b, ?f::a -> m b, Monad m) => [a] -> m [b] 00:39:13 putRow :: Int -> IO (); divider :: IO (); 00:40:07 oh... 00:40:57 @src intersperse 00:40:57 intersperse _ [] = [] 00:40:57 intersperse _ [x] = [x] 00:40:57 intersperse sep (x:xs) = x : sep : intersperse sep xs 00:41:14 :t sequence . intersperse ?divider . map ?putRow [0..2] 00:41:17 Couldn't match expected type a -> [a1]' 00:41:17 against inferred type [b]' 00:41:47 :t sequence_ . intersperse ?divider . map ?putRow $[0..2] 00:41:50 forall (m :: * -> *) a a1. (Monad m, ?divider::m a, ?putRow::a1 -> m a, Num a1, Enum a1) => m () 00:42:00 whee 00:43:11 @index intersperse 00:43:11 Data.List 00:43:30 hm, it typechecks 00:43:33 oerjan++ 00:43:43 @type sequence_ 00:43:45 forall (m :: * -> *) a. (Monad m) => [m a] -> m () 00:44:19 oh, that's easy 00:45:03 now i get to simplify this mess: putRow row = putLine$ show (row+1) ++ (' ' : (g!(row,0) : ( " | " ++ (g!(row,1) : ( " | " ++ [g!(row,2)]))))) 00:45:54 @src putLine 00:45:54 Source not found. Wrong! You cheating scum! 00:46:11 putLine = putStrLn 00:46:25 apparently he didn't like the name putStrLn 00:46:47 looks like another intersperse 00:47:08 @pl \n -> g!(row,n) 00:47:09 (g !) . (,) row 00:48:01 well, intersperse " | " . map ((:[]).(g!).(,)) $[0..2] ? 00:48:19 mmm 00:48:33 might be worth a lambda there 00:49:20 intersperse " | " . map (\c -> [g!(row,c)])$ [0..2] ? 00:49:36 or wait... 00:49:49 does anybody know of a neural network or SVM module for haskell? 00:50:23 intersperse " | " . [[g!(row,c)] | c <- [0..2]] 00:51:59 also, : and ++ have the same precedence so that parentheses are unnecessary 00:52:14 yeah 00:53:16 thus, putRow row = putLine $show (row+1) ++ ' ' : intersperse " | " . [[g!(row,c)] | c <- [0..2]] 00:53:48 er, putRow row = putLine$ show (row+1) ++ ' ' : concat . intersperse " | " . [[g!(row,c)] | c <- [0..2]] 00:54:49 i'm not crazy about the comprehension here 00:54:54 (anonymous) pasted "(no title)" at http://hpaste.org/2474 00:56:50 (anonymous) pasted "(no title)" at http://hpaste.org/2475 00:56:54 more errors 00:57:26 putRow row = putLine $show (row+1) ++ ' ' : (concat . intersperse " | ") [[g!(row,c)] | c <- [0..2]] 00:57:58 this . style makes me forget to distinguish the final argument 00:59:02 the comprehension is the cleanest way of expressing that expression, i think 01:00:44 hm, i prefer the map, personally 01:00:53 i wound up with this: 01:00:53 putRow row = putLine$ show (row+1) ++ ' ' : (concat . intersperse " | " . map (\c -> [g!(row,c)])) [0..2] 01:01:52 i don't know, maybe you're right 01:01:56 Hello, does anyone know where I can find documentation for Haskell/GHC in DocBook or texinfo format? 01:02:50 either way, we've cut his nasty code into half the size it was, and still made it more elegant :) 01:03:03 @quote melted 01:03:03 glguy says: in true Haskell form, after I realized what I was actually doing... all my functions melted down to about 2 lines each 01:03:52 I'm finding that's generally true 01:04:05 the melting at least, if not the actually number of lines 01:04:14 s/actually/actual/ 01:04:21 i think the haskell way would be to convert the whole board to a string and print it, rather than printing each line impurely 01:04:33 oerjan, true 01:04:44 oerjan, i'm just translating his code fairly directly for now 01:04:50 perhaps even making a Show instance 01:05:23 yeah 01:06:44 @pl c g c' = i $g!c' 01:06:44 c = (i .) . (!) 01:07:32 @unpl (not .) . c 01:07:32 (\ e h -> not (c e h)) 01:10:07 hi haskell people 01:10:28 'evening mudge 01:10:29 hi mudge, say the haskell people 01:10:30 hmm, is there any way to install goa in my home directory without modifying the system-wide package.conf? 01:10:44 anyone here from around the bay area? 01:11:01 Um, would anyone be able to tell me where to find DocBook/texinfo version of the GHC docs or how to convert the html tarball to said format(s)? 01:11:15 If I want a really small executable, should I avoid Haskell? 01:11:32 oh nm, I see 01:11:36 copy / register --user 01:11:37 You should avoid GHC. 01:12:02 @pl \x -> [ y | y <- x] 01:12:02 return . ((y | y) <-) 01:12:06 At least considering whatever you mean by really small. 01:12:14 anyway, I'm asking if anyone from here is from the bay area because there is going to be a functional programming meeting in San Franscisco 01:14:25 hiya mudge 01:14:38 cosmic-a1shole: That's not a polite nickname... 01:15:28 wow, my first 130-line error code 01:15:38 jamesnvc: i didn't know @pl mistreated lists that badly 01:15:47 shapr, his name makes is sound like he's not a polite person... 01:16:07 *it 01:16:27 that is just id, anyway 01:17:04 @pl \x -> [x] 01:17:04 return 01:17:42 so it could be worse 01:17:48 oerjan: yeah, pl mangles list comps 01:18:21 @pl \x -> [x,x,x,x,x,x] 01:18:22 ap (:) (ap (:) (ap (:) (ap (:) (ap (:) return)))) 01:18:42 That was a trival test, just wanted to figure out how to refactor it for a more complicated comprehension 01:18:46 replicate 6 01:18:54 And indeed, "really small" could be anything. 01:19:47 How big do different compilers do 'main = putStrLn "Hello, world!"'? 01:21:11 chessguy: 130 lines? O_O 01:21:20 oerjan, yup 01:21:21 well, GHC is pretty big, 316k on my system 01:21:56 JHC is... thrashing 01:22:05 hi shapr 01:22:11 shapr: where you from? 01:22:58 shapr: oh duh, you've already told me 01:23:00 alabama 01:23:00 507MB ... 01:23:30 plus its on your website 01:23:49 ihope: JHC output is 6kb 01:24:35 Is JHC pretty much the thing to use for smallness? 01:24:46 GHC output is 218KB 01:25:04 ihope: no, it was thrashing for three minutes and using twice my memory just for hello world 01:25:18 Oh. 01:25:40 ihope: I'm not actually convinced usably small memory is a priority, john has way more than us... 01:26:04 yhc output is 127 bytes 01:26:06 So it's good for "smaller" but not for "sooner". 01:26:24 The binary is just 127 bytes? 01:26:29 yup. 01:26:38 So THAT's the thing to use for smallness? 01:26:43 yes 01:26:55 smallness is an explicit goal of (n)yhc 01:28:20 how big is the vm? 01:29:00 ihope: 127 bytes of bytecode, it isn't a full executable 01:29:35 shapr, you're from alabama? whereabouts? 01:29:53 i may have already known this, really 01:30:33 @where shapr 01:30:35 http://www.ScannedInAvian.com/hope 01:31:11 Looks like @where is broken. That's not a place at all. 01:32:50 @help where 01:32:50 where . Return element associated with key 01:33:04 @pl \n -> f n == c 01:33:04 (c ==) . f 01:33:42 @pl a c f = a3 (\n -> f n == c) 01:33:42 a = (a3 .) . flip (flip . ((==) .)) 01:33:46 eww 01:35:19 heh 01:35:23 @pl a3c c f = flip all [0..2] (\n -> f n == c) 01:35:23 a3c = (flip all [0..2] .) . flip (flip . ((==) .)) 01:36:47 i guess i'll settle for a3c c f = all ((c ==) . f) [0..2] 01:38:28 @pl rowHas3 c grid row = all3c c (\col -> grid!(row, col )) 01:38:28 rowHas3 = (. ((. (,)) . (.) . (!))) . (.) . all3c 01:38:34 nice 01:39:05 lol 01:39:23 @quote bf 01:39:23 says: @bf ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. Hello World! 01:42:10 Hmm, anybody fixed alex's setup.lhs for Cabal-1.1.7? 01:42:42 The current darcs version is still broke 01:52:01 aha, squeeked by without needing the cabal-1.1.7 docs (which I can't build yet)... the fix was already in the source, just not used in one spot 01:55:30 oerjan, still around? 01:55:37 just barely 01:56:01 hmm, lots of Haskell stuff in Debian seems to be out of date :/ 01:56:04 chessguy pasted "can anyone make heads or tails of this?" at http://hpaste.org/2476 01:56:29 fGetChar seems to be a function which gets a piece off the board 01:57:54 there's clearly a bug there, cPlayr is rebound in the case 01:58:23 overlapping, yes 01:58:24 probably wanted to check equality with it 01:59:47 looks like maybe a fold, which accumulates the number of blanks and pieces? 02:01:04 lambdabot understands bf? 02:01:18 @bf ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. 02:01:21 @bf ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. 02:01:21 fd:24: hClose: resource vanished (Broken pipe) 02:01:28 =[ 02:01:31 busted at the moment 02:01:41 still, neat 02:03:09 @type foldr 02:03:11 forall a b. (a -> b -> b) -> b -> [a] -> b 02:04:29 length . filter is my suggestion 02:04:45 probably true 02:04:48 on map fGetChar [0..2] 02:05:20 Hmm. Programming Haskell is a very good book, and is available at Barnes and Nobles for around$36. 02:06:04 @type length . filter 02:06:06 Couldn't match expected type [a]' 02:06:06 against inferred type [a1] -> [a1]' 02:06:16 [length (filter (== c)) l | c <- [cPlayr, ' ']] == [2,1] 02:06:56 where l = map fGetChar [0..2] 02:07:55 chessguy annotated "can anyone make heads or tails of this?" with "something like this maybe?" at http://hpaste.org/2476#a1 02:08:53 is that for a chess program? :) 02:09:06 tic-tac-toe 02:09:38 lament, i'm re-writing the haskell version of http://www.prairienet.org/~dsb/t3/t3.htm in some sensible fashion 02:09:38 Title: Dan Bensen: Tic-Tac-Toe 02:11:46 oh god, "compactification" 02:11:59 never use a big word where a compactified one will do? 02:12:09 lol 02:12:30 yeah, this guy's a real gem 02:13:31 " 02:13:41 "Haskell is hard to debug. It's annoying having to pass the grid to every function." -- i can see why you would want to rewrite it :) 02:13:52 yeah 02:14:21 mostly i'm just translating his code directly to idiomatic haskell 02:14:29 except the bits that i can't stand 02:14:53 @pl \c p -> map (lfe c (map p l)) cl 02:14:54 flip flip cl . (map .) . (. flip map l) . lfe 02:14:55 pass the grid to every function? Sounds like Reader to me. 02:14:55 then i'll do a real re-factor when i'm done 02:14:59 ACTION kneejerks 02:15:20 @pl \c -> map (lfe c (map p l)) cl 02:15:21 flip map cl . flip lfe (map p l) 02:15:30 his haskell is Odd 02:16:16 somehow i doubt i'm actually going to find any actual CPS in his code :) 02:17:26 oerjan annotated "can anyone make heads or tails of this?" with "like this?" at http://hpaste.org/2476#a2 02:18:39 that type sure do look suspicious 02:18:49 what's with b? 02:19:36 chessguy: the toplevel loop, i suppose 02:19:37 cd les 02:19:38 LoganCapaldo, what are you looking at? 02:19:42 oh yeah, there's a bug 02:19:52 oh 02:19:52 chessguy: he's passing the next move function to doMove 02:20:00 cPlayr is matched against when he obviously wants to test equality 02:20:05 lament, ah ok, i haven't gotten there yet 02:21:10 lament, it takes a while to undiselegantize his code first 02:21:19 how's that for a big made up word? :) 02:21:32 so the real cPlayr is never used. b should have been Char, i assume 02:21:47 chessguy: um, cPlayr -> ... doesn't match what you think it does, in the case 02:21:48 @remember chessguy lament, it takes a while to undiselegantize his code first 02:21:48 [22:21] how's that for a big made up word? :) 02:21:49 Done. 02:21:58 (or whoever wrote that code) 02:22:06 Cale: it's not his code 02:22:10 cPlayr will always match, because it's first 02:22:11 Cale, right, thus the attempts to fix it 02:22:37 we are assuming he wants to match against its value 02:23:10 @quote undisel 02:23:10 chessguy says: lament, it takes a while to undiselegantize his code first 02:25:04 the best part is who you are addressing it too 02:25:07 *to 02:25:14 O! lament! 02:25:22 this code is so diselegant 02:26:13 I've got a silly question - I'm trying to use the logBase function, but the argument is an integer, and I'm getting "No instance for (Floating Int)" messages. 02:26:14 lol 02:26:27 unaracer, you want fromIntegral 02:26:34 unaracer: convert to a floating with fromIntegral 02:27:42 I've tried something like " f p = p*(logBase 2.0 fromIntegral(p)) 02:27:47 hmm 02:27:53 someone who programs in haskell 02:27:59 is a haskeller, or a haskellite? 02:28:05 p*(logBase 2.0 (fromIntegral p)) ? 02:28:06 but f 2 gives me a "No instance for (Floating (t -> t))" 02:28:10 unaracer: fromIntegral(p) doesn't mean what you think it means 02:28:52 unaracer: what you pasted is the same as p*((logBase 2.0 fromIntegral) p) 02:29:04 Ack. 02:29:33 also, you need a fromIntegral around the first p too 02:29:34 Thank you. 02:29:36 :) 02:29:39 FMota, it can't just be haskell programmer? 02:30:00 hmm... doesn't really fit too well. But ok. 02:30:18 oh good grief, his AB code is awful 02:30:26 is it safe to replace "Neither the name of the nor the names of its contributors" by "Neither the name of the author nor the names of any contributors" in the BSD license? 02:30:45 because i'm not an organization 02:31:07 mm_freak, really you should be able to customize the license to your liking anyway 02:31:15 regarding the fromIntegral issue, i must say the whole hierarchy of numeric classes is an Utterly Unnecessary Huge Pain That Only A Bunch Of Academics Could Devise. 02:31:19 just don't call it the BSD license if you destroy it 02:31:24 ;) 02:31:40 lament: you won't get anywhere with flattery. 02:31:44 geezusfreeek: i'm replacing "its contributors" by "any contributors"… i'm afraid, this might destroy the sense of the clause 02:32:12 I kinda like the scheme style 02:32:17 UUHPTOABOACD 02:32:23 ACTION finally finishes collecting lamdbabot dependencies 02:32:49 if haskell just got rid of the the need for things like fromIntegral, so you could in general ignore exactly which numeric type you were using... 02:32:55 i'm no expert, but that seems significant enough to not technically be the BSD licence anymore, IMO 02:33:15 (I almost said "I kinda like the scheme scheme" but it seemed excessive) 02:33:36 excessive, but correct 02:34:07 I kinda like kinds 02:34:09 anyway, implicit conversions come with their own problems 02:34:24 that they do 02:34:35 geezusfreeek, i have a "cast x = fromInteger $toInteger$ x" imported in all my sources 02:34:36 :) 02:34:55 @src fromIntegral 02:34:56 fromIntegral = fromInteger . toInteger 02:35:15 cast :: forsome a b. a -> b 02:35:24 ah :) 02:36:44 haskell, the programming language where it is hard to invent new functions 02:40:21 mm_freak: the last time I struggled with this I settled for 'his'. 02:41:25 not sure if that's any better. 02:42:24 int-e: well, the contributors are not _my_ contributors, but contributors of/for the package 02:47:37 @pl (\x y -> (+) x y) 02:47:37 (+) 02:48:59 @type not 02:49:01 Bool -> Bool 02:49:22 mm_freak: a third variant I've found now is 'other'. 02:51:33 int-e: that's about the same as "any" 02:51:49 mm_freak: but as I see it, I claim the copyright of the software and in that sense the other contributors are mine; they've contributed to my work. 02:52:33 well, logically "any" includes "mine", so that's ok for now =) 02:52:47 does it count as work for hire? 02:55:08 ASSERT(2+2 == 5); 02:55:11 heh, cute 02:56:05 well, his code works now 02:57:20 though it's almost as much my code as his, and i'm nowhere near done refactoring 03:00:26 is it weird to enjoy gutting someone else's code at least as much as writing your own? 03:01:07 I enjoy gutting any code, regardless of whether it was written by myself or someone else ;) 03:01:41 good point 03:02:13 chessguy: So his code for tic-tac-toe in haskell didn't even work? 03:02:37 phobes, i couldn't get it to compile. thought it may have been a whitespace issue 03:02:51 s/thought/though/ 03:02:57 hmm ok 03:07:09 ACTION wonders if lazy is the right way to go. 03:07:35 actually 03:07:38 I think lazy is fine 03:07:57 laaaaaazy is the best 03:08:02 but trying to make a type system strong and support laziness is kinda hard. 03:08:43 I think a mixture out to do -- expressions are lazy by default, but they only compile if they could be strict. 03:08:56 Meaning no infinite lists. 03:09:55 Is there a name for that/? 03:09:57 *? 03:10:26 http://lambda-the-ultimate.org/node/243 03:10:27 Title: Combining lazy and eager evaluation of terms | Lambda the Ultimate 03:11:08 that's exactly what I was thinking about :) 03:11:12 ty 03:11:19 yeah 03:11:26 your dialogue reminded me of something :) 03:12:37 ;) 03:13:22 ;) 03:13:54 #haskell has all the answers. You just need the right question. ;) 03:14:04 ;) 03:14:28 42 03:14:29 Lisp should have ;) instead of parenthese 03:15:10 it would be disturbing programming with all those faces winking at you 03:15:21 (defun infinite-loop (;) (infinite-loop;);) ? 03:15:24 yea, but it would be cute 03:15:47 and hasn't it been said that some programmers care about how their code looks? 03:15:52 I like looking at cute things 03:15:56 :o 03:16:15 I think all programmers /should/ care about how thie code looks. 03:16:18 *their 03:16:47 i wish there was a keyboard key for pretty girl 03:17:10 I doubt my sentiment is shared with all of #haskell, unfortunately (for me, and other syntax 'lovers') 03:17:35 mudge, i'm sure you love lolcode 03:17:39 Haskell isn't pretty? 03:17:57 ddarius: Not nearly enough 03:18:01 i've checked out lolcode, some of it is pretty hilarious 03:18:01 IMHo 03:18:15 haskell is pretty in its algorithms 03:18:40 and that beaty seeps out of the code 03:18:45 bueaty 03:19:24 Modern Haskell is pretty enough, but 1.4 was a bloody work of art. 03:19:25 beauty 03:19:50 :) 03:20:09 wli: you don't have any 1.4 code lying around? Is it really that purty? 03:20:12 I'm glad you like haskell (why else would you code in it?) 03:20:13 lambdabot should have spellchecking, and correct our spelling, wouldn't that be anoying in a fun way 03:20:30 lambdabot does have spellchecking 03:20:30 *annoying 03:20:34 @lte a = 3 03:20:34 Maybe you meant: elite ft let vote 03:20:40 @lett a = 3 03:20:52 Defined. 03:20:55 > a 03:20:58 3 03:21:06 @info spell checking 03:21:06 (spell checking) 03:21:08 :o 03:21:21 @spell trth 03:21:25 LoganCapaldo: Someone dredged up a 1.4 Prelude and it was godlike. Monad comprehensions, map instead of fmap being the method for functor, (++) the method for MonadPlus, MonadZero and MonadPlus separate, no fail horsecrap in Monad, etc. 03:21:40 wli, my. god. 03:21:51 LoganCapaldo: Plus an adjoint functor typeclass. 03:21:51 What happened???? 03:22:08 LoganCapaldo: Damage. Severe damage. Severe degradation. 03:22:12 Haskell 98 happened? 03:22:29 :/ 03:22:32 olsner: Yes, Haskell 98 is the name of that damage. 03:22:41 how so? 03:22:59 @quote polymorphic.scare 03:22:59 glguy says: map became not overloaded in the great polymorphic scare of haskell 98 03:23:38 mudge: Keep using things a while and you'll see what's going on. 03:23:53 well, why isn't a parallel dialect of haskell being developed? Surely someone could come up with another sane standard 03:24:23 wli: thanks 03:24:27 @nazi-on 03:24:27 Spelling nazi engaged. 03:24:40 sfultong: Those who care are either unwilling or unable to hack the compiler intrinsics needing to be redone to develop it. 03:24:53 @help nazi-on 03:24:54 spell . Show spelling of word 03:25:07 what's wrong with haskell 98? 03:25:11 i thought it was a good thing 03:25:16 @list nazi-on 03:25:16 spell provides: spell spell-all 03:25:32 @spell-all 03:25:32 No phrase to spell. 03:25:40 No, list only shows commands that do not require special privileges. 03:25:47 mudge: As far as I'm seeing it was largely a castration of 1.4 03:26:14 wli: you mean like it made it a smaller language, less features and such? 03:26:37 mudge: Worse. It dumbed it down and made it less useful. 03:26:48 mudge: don't misunderstand, H98 is a great language. There's just a handful of little quirks that could have easily been avoid, but weren't. 03:27:35 ok, thanks 03:27:42 jcreigh: Well, ripping out monad comprehensions was a major major loss. 03:27:50 mudge: you'll know them when you see them. :) 03:28:11 wli: you seem rather capable, perhaps you could start 1.4 back up 03:28:22 Was length generic in 1.4? 03:28:29 jcreigh: oh good, but ghc and others have extensions past 98, are these kinds of features in the extensions? 03:28:31 Nazi-mode seems to have broken - deliberately misspeelled word 03:28:44 sfultong: I'm less capable than I appear. I've attempted to hack on ghci and failed. 03:29:19 wli: sometimes its easier to start from scratch 03:29:27 Ah, no it wasn't. 03:29:43 sfultong: I wouldn't "start 1.4 back up" anyway; I'd just alter the compiler intrinsics in/around comprehensions and do notation unsugaring. 03:30:18 The simons have pre-approved monad comprehensions and MonadZero, so if anyone implements them, the patch will (barring obscenely bad code) be accepted. 03:30:34 sfultong: And numeric literal desugaring (which breaks alternate numeric hierarchies as it now stands unless it's been recently fixed). 03:30:59 sorear: I'm vastly less capable than many others. It would be a Herculean effort for me where it'd be trivial for others. 03:31:19 ACTION wishes he was more capable 03:31:25 sorear the "simons" what's that? 03:31:35 Simon Peyton-Jones and Simon Marlow 03:31:37 I'm never certain how good a programmer I am... 03:31:39 ACTION is almost certainly capable, but utterly unmotivated 03:31:46 ah, them simons 03:32:04 I should start hacking on haskell stuff and join the simons 03:32:05 sorear: unmotivated by disinterest, or something else? 03:32:09 Simon Peyton-Jones was a reddit celebrity. :o 03:32:12 * is just to ignorant 03:32:13 sorear: Working knowledge of ghc (or other) internals or just confidence? 03:32:37 hey, how do you do that star thing, where it makes a start by your name when you write? 03:32:38 A lot of the second, a little of the first... 03:32:48 /me waves 03:32:56 (since that'd make us more simons) 03:33:05 or if your client doesn't do that, \001ACTION waves\001 03:33:24 \001ACTION waves\001 03:33:25 you'll need to use a real ascii STX, not backslash zero zero one 03:34:04 STX? 03:34:05 @. where+ read "prod \001ACTION waves\001" 03:34:05 Done. 03:34:08 @where prod 03:34:09 ACTION waves 03:34:18 Start of TeXt 03:34:25 I need to visit a motivation farm, and pick a couple bushels 03:34:44 IRC protocol internals, eh? 03:34:51 Haha, raw octet IRCing. 03:34:55 Hi. I am looking for a Haskell implementation of a DFA -> regular expression conversion algorithm. Any pointers? Google wasn't really helpful. 03:35:08 "My IRC client is telnet"... "or even nc". 03:35:09 More like mIRC hacks that are still technically nonstandard but everyone has clonbed thedm 03:35:56 bjoern_: If you can find a constructive proof of Kleene's Theorem, the curry-howard isomorphism will give you your algorithm 03:36:06 haha 03:36:42 just waiting for the splat... 03:36:45 sorear: have you been drinking tonight? 03:36:56 no. 03:37:11 hes perfectly crrect 03:37:23 i'd like to see that proof though 03:37:47 Well I am specifically looking for an existing implementation. In my C implementation I am using state elemination to do the conversion, I am essentially wondering how you would do the same in Haskell (or Lisp for that matter). 03:38:22 ?users 03:38:22 Maximum users seen in #haskell: 392, currently: 353 (90.1%), active: 17 (4.8%) 03:38:43 looks like -> http://www.cs.nuim.ie/~jpower/Courses/parsing/node6.html <- is a usable proof 03:38:46 Title: Kleene's Theorem 03:39:03 first hit on google, too 03:39:11 I defined this haskell function: map1 f = foldr (\x xs -> (f x) : xs) [] 03:39:24 and it gave me this type: map :: (a -> a1) -> [a] -> [a1] 03:39:42 why doesn't it give me this type with the bs : map :: (a -> b) -> [a] -> [b] 03:39:43 ? 03:40:01 it's the same thing 03:40:26 map :: (a -> b) -> [a] -> [b] and map :: (a -> a1) -> [a] -> [a1] are the exact same type? 03:40:35 yes 03:40:48 yeah...they're just placeholders for types. 03:40:57 is there any reason for the interpreter to sometimes give the b version and sometimes the a version? 03:41:07 a1 version i mean 03:41:09 like "f a b = a + b" and "f x y = x + y" are the same function. 03:41:24 mudge: it tries to derive the variable names from the signatures in the code. 03:42:34 mudge: but in the end it's pretty much unpredictable because it depends on which type signature the type came from. 03:42:37 oh 03:43:25 has anyone done any or all the exercises in the book Programming Haskell? 03:43:29 that's what I'm doing 03:43:50 mudge: Graham Hutton's book? 03:43:52 yea 03:43:56 Some grad student under Hutton must have, I bet. :) 03:43:58 @type \f g -> tail (map f g) 03:44:00 forall a a1. (a -> a1) -> [a] -> [a1] 03:44:01 I wonder if there's a bookstore in Portland, OR carrying it. 03:44:13 here the 'a1' seems to be derived from the type of tail, 03:44:15 @type tail 03:44:17 forall a. [a] -> [a] 03:44:31 wli: there's an amazon.com in porland 03:44:41 mudge: ??? 03:44:44 lol. 03:44:59 ACTION ponders diff(1). 03:45:37 its a pretty good book, I like how it makes you understand the basic functions, like foldr, filter, and lots of others 03:45:51 Oh dear. That's not where I need help at all. 03:45:58 Moving on, diff(1). 03:46:07 wli: I just mean that you can get the book at amazon.com, but you probably want to look through it and check it out before you buy 03:46:20 mudge: I'll buy it anyway. 03:46:44 Hmm, that proof of Kleene's theorem looks like a perfect match for Data.Graph.Inductive. 03:46:46 it has a chapter on functional parsers 03:46:56 mudge: how does it compare with other books (if you know)? I'm working through Thomson's Haskell now, for example 03:47:01 mudge: It's just that my shopping list on amazon.com is up to $2500+ and I'm feeling skittish about it. 03:47:11 haha 03:47:15 wishlist man ;) 03:47:23 haha 03:47:41 Programming Haskell is probably pretty slow for somebody who is not a total noob 03:47:47 dhpeterson: I haven't tried reading Thomson's Haskell book, but I have that book and plan on reading that one too, how is that book? 03:47:53 It's just right for me though 03:48:01 zmike: as a noob (to FP anyway) it suits me :) 03:48:03 zmike: I'm hoping for something targeted for those who aren't total n00b's or whatever. 03:48:16 I learned haskell several years ago from YAHT, and consulting the report when my code broke 03:48:20 i find Thomson ok 03:48:27 wli: have you tried YAHT? 03:48:32 YAHT is also useful 03:48:33 dhpeterson: In that case, I highly recommend it 03:48:36 Possibly even someone who has recently had their monad breakthrough. 03:48:38 great 03:48:55 I'm trying to set myself up for a monad breakthrough 03:48:56 mwc: I worked through all the exercises in YAHT. I had my monad breakthrough with it. 03:49:11 Everybody always remembers their monad breakthrough 03:49:13 i'm still waiting for the moment monads make complete sense for me :) 03:49:17 Mostly using "All about Monads" 03:49:18 though i am getting used to them 03:49:41 I found that I wasn't really able to understand monads until I used them in monad transformers. 03:49:56 Where "use" meant actually programming monad transformer code. 03:50:00 wli: heh .. that's one of the things i'm reading up on now ;) 03:50:18 I want to read and understand Wadler's paper but I think it's still a bit out of my reach 03:50:24 ACTION rubs hands in anticipation of monad breakthrough 03:50:25 I tried starting there.... 03:50:27 ACTION realizes he doesn't remember his monad breakthrough. 03:50:30 didn't work out 03:50:48 My monad breakthrough came from Wadler's. 03:51:32 wow, is the monad breakthrough like losing your functional virginity? 03:51:39 Actually not entirely. Half from that, the other half from that monadic parser paper. 03:51:54 mudge: sort of 03:51:56 hah 03:51:59 wli: do you use monad transformers frequently in your code? 03:52:08 It's losing your imperative virginity. 03:52:17 wli: are monad transformers the things like ReaderT etc? 03:52:24 the monad breakthrough, for me, was being able to recognize monadic structure in my code, and write monads 03:52:29 dhpeterson: indeed 03:52:40 a monad transformer is basically just a way of embedding a monad inside another 03:52:53 i gathered that (from looking at dons irc bot tute code) 03:52:55 dhpeterson: Yes. 03:53:12 have been playing with that ... nothing like the deep end, eh :) 03:53:38 monochrom: The presentation didn't matter so much as doing exercises. 03:53:52 sfultong: I do now! ;) 03:54:03 Of course. I did my own tinkering while reading. 03:54:36 monochrom: I wasn't able to come up with adequate exercises on my own. 03:55:20 ACTION lunch ... brb 03:55:22 for some reason it doesn't seem to me that monads will abbreviate/simplify the code I write... I dunno if this is due to my lack of understanding, or... 03:55:56 sfultong: You use them when appropriate. 03:56:19 well, I hardly ever use them 03:56:39 I mostly just consider them the libs and/or API's for obtaining various sorts of effects. 03:57:01 sfultong: ever find yourself writing a family of functions where you thread values through a function call? That's a Reader/State pattern 03:57:33 To use Oleg's generic zipper requires knowing how to use a monad. 03:57:33 sfultong: find yourself creating data at each step of a bunch of computations? Perhaps Writer is what you want 03:57:49 and I'd argue that Cont is vastly easier to read than "true" CPS 03:58:06 hmm... 03:58:41 To know how Oleg's generic zipper works requires knowing the delimited continuation monad. 03:58:43 There isn't really a formula per se. I just rigidly adhere to existing API's instead of rolling my own. 03:58:58 sfultong: for instance, if you ever use System.Random, you'll almost certainly have types like: RandomGen g => ... -> State g a 03:59:01 This generic zipper stuff is very powerful. 03:59:02 @hoogle RandomGen 03:59:03 System.Random.RandomGen :: class RandomGen g 03:59:44 MonadState + record update syntax is very handy. 04:00:01 wli: truly 04:00:34 do { x <- gets field ; ... ; modify (\st -> st { field = f x }) ; ... } 04:00:48 Monad theory is abstract common sense. 04:01:21 I don't like how getters are first class, but setters aren't. 04:01:58 Forgive me. How are setters not first-class? 04:02:22 well, a getter is a function with a type, and I can pass it around. But I have to use that syntax to update a record. 04:04:03 Oh! Now I see. 04:04:30 jcreigh: that has also annoyed me on a number of occasions 04:06:09 in saying that, its very easy to roll your own setters 04:07:49 Well, it's easy to roll your own accessors, too, but we have syntax for making them automatically. :) 04:17:43 Last time I was thrilled to get emacs haskell-mode to offer me 7 indentation choices. Today it turns out that was nothing - I get 10 now. :) 04:19:49 that does sound rather thrilling 04:20:44 The context is merely 8 lines, the longest line just 42 characters long. :) 04:21:27 ACTION goes prove a theorem about Haskell layout indentations choices growing super-exponentially wrt context size. 04:22:00 Afterall, if it's undecidable, it ought to grow faster than any primitive recursive functions... 04:24:49 *coughcough* A rather large question for #haskell : http://odi-sei-a.blogspot.com/2007/08/values-that-are-simply-begging-question.html 04:24:52 Title: odiseia: Values that are simply begging the question., http://tinyurl.com/2xkgog 04:25:29 ACTION ponders the operational semantics of Concurrent Befunge 04:25:45 ... sorear, you scare me sometimes. 04:29:24 Why anyone would prefer to investigate that vs. comprehension intrinsics in ghc, yhc, et al is beyond me. 04:29:34 :p 04:29:42 some people juggle geese. :) 04:30:42 How do I put it, without spending too much time explaining something well-known? How about this: if you know "induction vs co-induction", "inductively defined data vs co-inductively defined data", "least fixed point vs greatest fixed point", etc., you know the answer to odiseia's question, and you see there is no begging the question anywhere. 04:31:53 right 04:32:08 unless you happen to be using inf. 04:32:37 I saw that once, and I should probably check it again. 04:32:46 Here is how that relates to the question. Finite lists are inductively defined data. Infinite lists are co-inductively defined data. Mathematically you're supposed to treat them separately. Pragmatically many lazy programming languages (e.g. Haskell) use the same type for both, so there is a bit of confusion. Already someone is suggesting to add the keyword "codata" to Haskell for declaration your intention more clearly. 04:33:16 seen in #ubuntu: 21:21 < imbecile> hey all, I was wondering if there were any apps or anything that checks pucntuation.. I'm emailing this girl & I dont want alot of errors 04:33:19 inf is also coinductively defined data, exactly isomorphic to infinite "List ()". 04:33:28 :) thank you. 04:33:36 aieee! 04:36:20 So, I have to treat inductive and co-inductive types differently 04:36:34 Yes, in fact with quite opposite attitudes. 04:36:45 now... how do I find something good on induction and coinduction? :/ I wish I could find the exact same thing as I read one. 04:37:33 What sort of type attribute would you use for this? 04:37:43 Girls care about punctuation these days? 04:37:51 inductive data = least fixed point of a certain equation. you ask for the smallest set of values satisfying some set equation. therefore, when in doubt, you reject. 04:38:05 Two different type recursion operators, \mu and \mu'? 04:38:18 ah, I see. 04:38:23 co-inductive data = greatest fixed point of a certain equation. you ask for the largest set possible. therefore, when in doubt, you actually accept! 04:38:25 mu and nu. 04:38:36 \nu works, too. 04:38:38 Sounds like cat noises 04:38:42 lol. 04:38:56 sounds like Sir Bedeviere (sp) 04:39:22 monochrom, ty so much. 04:39:33 About reading material. I only know those that are mathematically dense, i.e., highly academic. Not sure if you mind reading them. But I'll cite on in a moment. 04:40:11 dolio: totally unrelated, but chances are that if you see an exclamation point, a woman wrote it 04:40:28 http://www.cs.ru.nl/B.Jacobs/PAPERS/JR.pdf Bart Jacobs and Jan Rutten "A Tutorial on (Co)Algebras and (Co)Induction" 04:40:31 what, like statiscally speaking? 04:40:34 Is SamB a woman? 04:40:56 mwc: actually, i think you mean a confused haskell programmer trying to eliminate stack overflows 04:40:59 ty 04:41:20 ACTION does the drum thing for bos 04:41:52 thank you, i'll be here all week, don't forget to tip lambdabot on your way off the channel 04:42:15 bos: that too, but there's real research showing men don't use ! 04:42:16 http://jcmc.indiana.edu/vol11/issue4/waseleski.html) 04:42:21 minus the \ 04:43:00 Oh in computer-mediated communication 04:43:10 more specific than I ws expecting 04:46:10 Theres not nearly enough notation in that paper 04:46:39 I kept expecting to see funny symbols and code snippets that used arrows instead of equal signs for assignment 04:47:03 but there were no code snippets at all 04:47:18 And I don't think I saw the word proof once 04:48:19 I like it when they say "by induction on the structure of proofs." 04:49:05 bart jacobs is my homie, by induction on the structure of his bibliography 04:49:25 LOL 04:49:47 oh man 04:50:00 thats definitely a new tool to add to my arsenal 04:50:14 night crazy cats 04:50:17 ACTION tips lb 04:50:19 @botsnack 04:50:19 :) 04:55:35 Ah, here's what I read before -- http://sigfpe.blogspot.com/2007/07/data-and-codata.html 04:55:37 Title: A Neighborhood of Infinity: Data and Codata 04:56:02 idk if that's the same concept, but does fit the problem domain. 04:56:05 Well, I'm just thinking about diff for the moment. 04:57:40 I think you can make it polymorphic, basically Eq t => [t] -> [t] -> [([t],([t],[t]),[t])] or some such. 04:57:46 it's structural recursion and guarded recursion to the rescue. 04:57:56 does anyone have a favorite live CD distro that specializes in bleeding edge versions of packages? I'd like to see how the latest X11 and intel video drives work on this laptop 04:58:30 data Hunk t = Hunk { leftContext, rightContext, beforeText, afterText :: [t] } 04:59:47 FMota: yes that one is relevant. 04:59:57 mmhmm 05:00:03 From there it's some kind of combinatorial minimization problem. 05:01:07 Eq t => [t] -> [t] -> [Hunk t] 05:02:10 hunkNorm h = length (beforeText h) + length (afterText h) ; patchNorm = maximum . map hunkNorm 05:03:43 I'm totally evil. I write "return$ do ..." followed by 8 lines of monadic code. 05:03:55 (There are position markers to track here but I'm ignoring that for the moment. 05:04:02 (I'm returning a monadic action, yes.) 05:04:22 monochrom: thats evil :S? 05:04:25 :o 05:04:41 liftIO $do + umpteen lines of monadic action is common I think. 05:05:28 nesting monads with return is less common, though 05:05:36 yeah 05:05:49 hmm 05:05:52 I've done that too. Inside IO I use the list monad, for example. 05:05:59 you can't mix data with codata, can you? 05:06:19 Some functions are friendly to both data and codata, e.g., map. 05:06:21 I think it's possible to subdivide hunks whenever beforeText and afterText have elements in common. 05:06:46 map works on codata, though... 05:07:05 Yeah, it works on both. 05:07:17 oh, nvm. I get it :0 05:07:32 sigfpe's sumSoFar also works for both. 05:07:32 :) ty 05:07:39 yep 05:08:20 It seems that if a function works on codata and it also has a good clause for [], it will work for data too. 05:08:38 while sum only works on data, because it's structural recursion 05:08:43 Yeah. 05:08:46 yeah. that makes sense :) 05:09:05 So how would one go about separating data from codata... hmm 05:09:20 separate types would work, but map can work well on both. 05:10:33 Here is one way. Separate types. But have a type class for both. map becomes generic to that type class. 05:10:45 is there an easy way to get a stacktrace from my program, which aborts with an exception? 05:10:53 Ah, makes sense. 05:11:06 :) Gosh, you're good at this. 05:11:23 I'm only a bit more experienced. :) 05:11:39 and humble. :o 05:13:07 so, there's two types of "add", really. One that only works on data, and one that works on both. 05:15:06 ah, -xc 05:17:37 Lessons in perfectly cromulent syntax: Nat. for data, Nat.. for codata, Nat for both. 05:18:39 hahaha 05:18:50 ;) 05:18:57 Only a computer will find it perfectly clear. :) 05:19:17 yeah :/ 05:19:45 Could someone please help me with a type definition? I have a function that takes a bool and returns some instance of a Class. I can't figure out what the type should be. I currently have "transform :: (Class a) => Bool -> a". The error is "could not match expected a' against inferred ThingA'". 05:21:20 code is here -> http://hpaste.org/2477 05:23:33 Actually, I'm not so sure that only a computer would find it perfectly clear. 05:23:47 On second though, List. Nat, looks weird. 05:23:55 ?src take 05:23:55 take n _ | n <= 0 = [] 05:23:55 take _ [] = [] 05:23:55 take n (x:xs) = x : take (n-1) xs 05:26:05 ?src drop 05:26:06 drop n xs | n <= 0 = xs 05:26:06 drop _ [] = [] 05:26:06 drop n (_:xs) = drop (n-1) xs 05:26:40 how bout Nat is for both, coNat is for Nat codata, and _Nat is for Nat data? :o 05:26:47 whooo hoooo 05:26:50 !!!!! 05:26:55 I got infinite lists in CL!! 05:26:56 :) 05:27:09 that might not be too big of a deal for a Haskell channel though 05:27:13 :o Happy for you :) 05:27:20 considering infinite lists come out of the box :) 05:27:34 (take 3 (integers)) => #A[0 1 2] 05:27:37 :-D 05:28:29 steven_ashley: did you find your answer? 05:28:38 not yet 05:29:11 in the type: Class a => Bool -> a 05:29:14 you have to pick one a 05:29:47 if you want to return many, you need an existential qualifier 05:29:52 which probably isn't what you wanted 05:29:55 (but it might be) 05:30:36 I want to return different members of the same class from a function depending on whats input 05:30:58 I need an existential qualifier then :) 05:31:21 coffeemug: how did you implement it? lots of manual thunking? 05:32:16 I implemented a system that lets you define algebraic types 05:32:24 the only way to define a type is to call a constructor on it 05:32:30 and the only way to get values is to pattern match 05:32:45 so the constructors automatically wrap arguments in closures 05:33:05 and successful matches funcall the closures to unwrap 05:33:10 which pretty much gives you lazyness 05:33:23 once you get that, it becomes trivial 05:33:29 Yes. Nice. 05:33:31 code looks very similar to Haskell, actually 05:35:52 monochrom, do you think a compiler could be able to infer data vs codata? 05:36:23 I'm thinking yes. 05:36:56 ?src zipWith 05:36:56 zipWith f (a:as) (b:bs) = f a b : zipWith f as bs 05:36:56 zipWith _ _ _ = [] 05:37:16 I'm divided. On one hand, sigfpe's criterion seems to be perfectly algorithmic, so yes. On the other hand, it looks like strictness analysis, which is undecidable, so no. 05:37:40 But perhaps it's a special case of strictness analysis, special enough to be do-able. 05:37:58 hmm 05:38:24 But it doesn't hurt to be optimistic. :) 05:38:43 :) 05:40:56 inferring data vs. codata would 'eliminate' the problem of data being sent to singularly corecursive functions, and codata being sent to singularly recursive functions. (Sorry for the abuse of language). 05:43:02 On other news, I have finished doing "generators" (a la Python for example) using delimited continuations and ref cells. 05:43:30 wd 05:43:39 hmm. its getting late 05:43:42 nighty night 05:43:49 good night 05:44:08 and thanks for all the fish :) 05:44:10 monochrom: Cooking up your own language or implementation thereof? 05:44:15 you're welcome 05:45:29 I use the well-packaged CC-delcont. On top of that, I write my own code. 05:45:50 monochrom: Not sure what you mean. 05:46:18 CC-delcont is a library providing delimited continuations (in a monad) for Haskell. 05:46:42 Okay, so not related to a specific app (e.g. interpreter/compiler). 05:46:49 No. 05:55:50 Looks like it's heavily related to longest-common subsequence. 05:56:34 pgavin: new patch sounds good! :-) 06:01:12 when people use Happy to generator parsers what lexer generator do they typically use? 06:01:26 Probably either handwritten or alex. 06:01:42 danke 06:02:12 Sometimes I use Text.ParserCombinators.Parsec.Token 06:02:31 *nod* 06:02:38 Oh, nevermind, I misread. 06:02:45 trying to write one using parsec and one using a generator 06:03:09 I have never used Happy. Don't trust me. :) 06:03:35 the blind leading the dumb? :) 06:04:04 http://programming.reddit.com/goto?id=2jcvz 06:04:06 Title: teideal glic deisbhÃ©alach » Blog Archive » Weighted Slope One in Haskell: colla ... 06:08:59 are there any GLR scannerless parser generators for haskell? 06:09:29 (ie. one where there are no tokens and the whole language is specified in a single spec?) 06:11:29 It would be pretty nasty for most cases. 06:12:24 More often one would use Text.ParserCombinators.Parsec.Token, which sits somewhere between scannerless and scannerful. 06:12:42 why nasty for most cases? 06:13:23 It's very annoying to remember to manually code "now eat some whitespace" all over the place. 06:13:34 yum 06:13:48 ?all-dicts hypozeuxis 06:13:49 *** "hypozeuxis" wn "WordNet (r) 2.0" 06:13:49 hypozeuxis 06:13:49 n : use of a series of parallel clauses (as in I came, I saw, I 06:13:49 conquered') 06:13:49 scannerless generators usually have some notation for that 06:14:13 The annoyance gets worse as you also say "1+2" is the same as "1 + 2". 06:14:39 But then again, you probably mean exactly something like Text.ParserCombinators.Parsec.Token. 06:14:41 nah, pretty easy to deal with. 06:15:32 hi ... anyone here know about "newtype" ? 06:15:39 except parsec is hand-written and uses recursive descent and backtracking 06:15:42 is there any real advantage of using this rather than "data" ? 06:16:00 dhpeterson: newtype is handy because it has no runtime overhead 06:16:15 is it optimised out or something? 06:16:34 yes, it has slightly different semantics, so it doesn't exist at runtime 06:16:39 ok 06:16:57 do i understand correctly that it can only be used with a single 1-arg constructor? 06:17:07 correct 06:17:10 ok 06:17:29 i am playing with a Haskell wikibook example now ... data Anniversary = Birthday Name Date | Wedding Name Name Date 06:17:37 so i can't use newtype here for example 06:17:51 right, you have to use data 06:17:55 but if I had: data SpecialDay = SpecialDay Date 06:17:58 Right. newtype isn't intended for that. 06:18:06 then i could write: newtype SpecialDay = SpecialDay Date 06:18:14 dhpeterson: correct again 06:18:15 k 06:18:17 thnx 06:18:20 newtype is when you want a new name for a type so you can make functions that behave differently for that type 06:18:20 (from the newb!) 06:18:36 newsham: aha 06:18:37 like when you want some String with a different Show instance 06:18:49 ok 06:19:00 so used to discriminate, as well as for efficiency 06:19:11 newtype Euro = Euro Int ? 06:19:16 right. It gives you extra type safety with no overhead 06:19:20 k 06:19:22 It also solves or works around the infinite-type problem. (Warning: Information overload.) 06:19:32 monochrom: heh - yep! 06:19:38 i won't ask :) 06:19:54 in xmonad, we have a structure indexed by both workspace and screen ids -- which were both Ints 06:20:11 ACTION bows down before the haskell old-ies (opp. of newbies) 06:20:17 aha 06:20:20 we had a bug where we used a screen id instead of a workspace id 06:20:24 OK, "data" also solves that, conceptually almost the same actually, but with overhead. 06:20:35 the solution: newtype Workspace = Workspace Int; newtype Screen = Screen Int 06:20:36 right 06:20:47 yep 06:21:01 now we *can't* mix up two types of ids, and the compiler still generates the same code 06:21:02 and because you were working with functions that took [Int] you weren't able to discriminate it 06:21:07 until you introduce the types 06:21:12 i see 06:21:19 yep 06:21:28 ACTION hugs newtype 06:21:41 sjanssen: thank you for the clear example - it always makes it easier to understand when you have an example 06:22:00 hey, anyone in here from around the bay area? 06:22:01 i guess if you have a strong typed language you should use it, eh :) 06:22:12 Yah! 06:22:23 mudge: only the Melbourne bay :( 06:22:36 monochrom: you are? 06:22:46 mudge: you're not peiter are you? 06:22:48 No. I was Yah-ing to the strong typing comment. 06:23:02 ha 06:23:12 ah 06:23:31 i've lived in the bay area but i'm not from there or currently there 06:24:18 okay, well if you have any bay area functional programming friends tell them about the bay area functional programming meeting in September 06:24:29 mudge: already done :) 06:24:35 http://groups.google.com/group/bayfp/ 06:24:37 Title: Bay Area Functional Programmers | Google Groups 06:24:47 heh - i want to organise something similar in Melbourne, AU 06:24:48 newsham: you going? 06:24:57 no. but I told some ba'ers 06:25:00 yeah, we need one in Hervanta, Finland too :) 06:25:59 newsham, okay, thanks 06:26:52 ?users 06:26:52 Maximum users seen in #haskell: 392, currently: 347 (88.5%), active: 13 (3.7%) 06:28:27 Interpreter.hs:60:8: 06:28:27 My brain just exploded. :( 06:28:33 nice error :D 06:28:46 @quote exploded 06:28:46 tessier says: After the last newbies head exploded trying to read everything on that monad link there was a lot of paperwork. We'd like to avoid doing that again. 06:28:48 @quote exploded 06:28:48 tessier says: After the last newbies head exploded trying to read everything on that monad link there was a lot of paperwork. We'd like to avoid doing that again. 06:28:52 @quote ghc exploded 06:28:52 ghc says: My brain just exploded. 06:33:41 ?seen pseudonym 06:33:41 I saw pseudonym leaving #haskell-blah and #haskell 17m 9s ago, and . 06:34:09 Anyone know what module respIO hides in? 06:34:21 Came across it in a HAppS tutorial. 06:34:55 sounds like some happs-ish thing 06:34:57 try grep :) 06:35:28 already have :( 06:35:45 Not in base or GHC extralibs 06:36:44 find . -name '*.hs' -exec grep -hl respIO {} \; --- ? 06:38:11 grep -Ri respio * --> nada 06:39:27 hi 06:40:22 Looks like naive lcs is too slow to produce results in a useful amount of time. 06:41:18 hello adu 06:48:46 wow, you guys know about the book "Real World Haskell" that is being written? 06:53:57 mudge: yeah, i've heard about it 06:55:09 bos: cool 06:55:24 sounds cool! 06:56:01 :-) 06:57:34 hey dons! 06:57:44 :) 06:57:56 dons: I didn't know you were writing a book on haskell 06:58:20 dons: are you going to come to the functional programming meeting in san francisco? 06:59:20 well, bos is writing some of it, I think ;) 06:59:25 hmm, is it the 13th or so? 06:59:30 yea 06:59:53 hmm, interesting. i'm moving to the US on saturday, so hmm, i'llbe on the right coast at least. 07:00:05 yea 07:00:33 dons, are you doing post-doc in the U.S. or something? 07:00:49 so its possible. I don't think i can confirm till I'm over there and know what's happening 07:00:53 dons: I'm moving on Saturday too, though only from one side of Oxford to the other :-) 07:00:59 Adamant: got a job hacking haskell in Portland. 07:01:04 dcoutts: :) 07:01:04 dons: good luck with your move 07:01:05 awesome! 07:01:17 have fun! 07:01:21 thanks dcoutts . cleared out my uni desk today. 07:01:28 you can accumulate a lot of CS papers in 5 years 07:01:31 dons: okay, it would be great if could come 07:01:36 dons: getting tearful ? :-) 07:01:40 you could come 07:01:43 mudge: yeah, i'm on the mailing list. so it might well be possible. 07:02:02 dcoutts: a little. sydney is nice :) 07:02:03 ?temp 07:02:03 now 26.2°, min 12.3°, max 27.8°, rain 0.0mm, wind 26km/h NW 07:02:05 dons: don't you find moving such a pain, it makes one realise how much useless junk one accumulates 07:02:18 oh so much junk! 07:02:18 I find I just want to throw it all out 07:02:39 i really didn't need to keep that little bag of screws and nuts for 5 years. whta was I thinking? 07:02:48 aye :-) 07:03:03 and oh, maybe i need that null modem cable from the mac68k? yeah, better hang on to that. 07:03:13 hehehe 07:03:13 this is what it is like :) 07:03:21 I've got a box of computer bits my gf calls "The Box of Doom" 07:03:43 luckily, we have a firm limit on how much stuff we can take. 07:03:44 hehe. 07:03:54 bos: oh you're Bryan O'Sullivan! I was just reading your blog tonight! it's great! 07:03:55 i have such a box! 07:03:56 it is known by suzie as the "evil cable box" 07:04:02 right! :-) 07:04:31 Who doesn't have boxes like that? :) 07:04:38 you never know when a debian 1.0 install disk will come in handy, that's my motto! 07:04:47 :-) 07:04:56 I've got a 21" monitor I need to get rid of 07:04:56 though i've decided i don't need floppies anymore. 07:05:04 oh, wow. 07:05:06 it weighs about half a ton 07:05:08 bos: you there? 07:05:10 i'm sure someone will want that. 07:05:17 yup 07:05:18 ah, a big one eh. 07:05:24 mudge: thanks :-) 07:05:32 It is also likely curved. 07:05:36 dons: I've been trying to give it away, nobody want's heavy crts anymore 07:05:40 yeah 07:05:52 nobody has a desk big enough to hold it 07:06:22 I was one of the early adopters of those flat CRTs. I have thus almost forgotten that screens used to be curved. 07:06:32 in fact I'm planning on replacing my desk with a smaller one when we move, since I don't need it to be so deep anymore now I have a flat screen 07:07:01 monochrom: yeah, it's also slightly curved, but given the depth of the thing, it's not very curved 07:07:12 it's probably half a meter deep 07:07:21 dons: good luck. i had a sony 21" that i couldn't give away, and that was over a year ago 07:07:40 Is there any sort of repository of Haskell sample code? I was hoping to find some examples using Data.Map 07:08:06 dons: maybe drop it off at the uni for some ugrad to use :) 07:09:59 dfranke: there's >100 packages on hackage 07:10:12 dfeuer: and google code search should find stuff 07:12:20 morning therp 07:12:35 good morning 07:13:40 dcoutts: how would you suggest that I install libdir as in libDirTemplate, not with libSubDirTemplate concatinated? should I add another libsubdir element to InstallDirs and change all references to this? 07:14:33 therp: the final libdir is made up of substitute libdirtemplate substitute libsubdirtemplate 07:14:48 therp: so if you don't want any libSubDirTemplate then set it to be empty 07:16:15 therp: or perhaps I don't understand what you're trying to do 07:16:39 dcoutts: I'm trying to hand something like /usr/lib to installLib from Install.hs/install to GHC.installLib 07:17:13 therp: why not passing the full libdir ? 07:18:36 the expansion takes place at the start of install in Install.hs, so are you suggesting I should call absoluteInstallDirs twice, once with a modified lbi { installDirTemplates = installDirTemplates lbi { libSubDirTemplate = PathTemplate [] } } 07:18:55 dcoutts: because I'm installing shared libraries, that should go into the default system's libdir 07:19:19 and passing the full libdir is "too deep" /usr/lib/ghc-6.6/.../ 07:19:29 therp: ah, then perhaps we do need a different libdir completely 07:19:53 dcoutts: that's what my first idea was.. change the semantic of libdir and switch all instances over to a new libsubdir 07:20:40 therp: yes 07:20:52 therp: so, hmm the best thing to do... 07:22:09 therp: so yeah, we probably want a new component in InstallDirs for static libs 07:22:42 is libsubdir a good name? 07:23:11 therp: no, I think all the InstallDirs should be full paths, not relative to other ones 07:23:42 therp: so I'd say we change the existing libdir to come from just libDirTemplate 07:24:02 I am probably missing something simple here, but is it possible to propagate an error from an Either function through an ErrorT function? 07:24:11 therp: and add a new one staticlibdir or something that is from libDirTemplate libSubdirTemplate 07:24:13 dcoutts: I meant libsubdir to be a full path 07:24:40 therp: subdir isn't a good name, it's confusing since we use subdir to mean relative elsewhere 07:25:43 hello people 07:26:43 what are other interesting applications of fuzzy logic aside from that control? 07:26:48 therp: in fact we might want dynlibdir and staticlibdir and not have a libdir at all in InstallDirs 07:27:14 therp: that'd make it easier to find the places that need to change rather than reusing the libdir name with a different meaning 07:29:30 dcoutts: so the plan is, I will change libdir into staticlibdir and add dynlibdir 07:29:42 therp: yes 07:29:56 what's the "meaning" of libexec, btw? 07:30:15 therp: it's not really used much, it's supposed to be for private binaries rather than user binaries 07:39:59 dcoutts: staticlibdir also includes interfaces definition files and package.conf. Is this really a good name? 07:40:07 hmm 07:40:21 therp: yeah, maybe not 07:40:31 therp: ok well just add dynlibdir 07:40:53 and keep libdir? 07:40:56 aye 07:41:09 ok, reverting.. 08:26:23 dcoutts_: Thanks, a pull from the Cabal darcs seems to have fixed that problem. 08:26:44 the problem with HSQL/PostgreSQL 08:27:32 RogerTaylor: great 08:30:04 Anyone else feel that the weighted slope one code can be simplified? 08:38:34 hi all 08:39:58 did anyone read the paper "compiling Embedded Languages", Conal Elliot with others ? 08:54:29 @bot 08:54:29 :) 08:54:45 :) 08:55:16 > in stereo 08:55:16 Parse error 08:55:21 Parse error 08:55:23 > "in stereo" 08:55:24 Bad interface file: L.hi 08:55:25 "in stereo" 08:55:25 mismatched interface file versions: exp... 08:56:05 > putStrLn "> \"bar\"" 08:56:07 Bad interface file: L.hi 08:56:07 mismatched interface file versions: exp... 08:56:08 08:56:11 :-( 08:59:34 oups, it shouldn't have come in here, sorry 09:02:50 ? 09:03:59 (lambdabot42) 09:04:20 I didn't mean to have it join this channel, just had a badly merged online.rc file :-) 09:06:17 > o 09:06:18 Not in scope: o' 09:06:25 > let o=0 09:06:25 Parse error 09:06:30 eh uh :P 09:06:57 oklopol: let in is an expression 09:07:16 but... let = works in my haskell! 09:07:42 it works in ghci, but that's a feature of the interpreter, not of Haskell 09:07:49 i see 09:07:53 It works in your interpreter, because it basically simulates a 'do' block, where 'let ' is an acceptable statement. 09:08:05 ah 09:08:18 do let bindings; ... gets translated to let in do ... 09:08:41 do x <- amb; ... in amb >>= \x -> do ... 09:08:50 do amb; ... in amb >> do ... 09:09:00 ...and finally do amb = amb. 09:09:52 lambdabot also does that, via ?let 09:10:19 ?let fibs = 0 : 1 : zipWith (+) fibs (tail fibs) 09:10:22 Defined. 09:10:26 ? fibs 09:10:29 > fibs 09:10:31 [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,... 09:15:38 so what does this mean in an export list: (:!:)((:!:)), 09:15:39 1 peanut for the first correct answer. 09:16:35 hmm, or to get one more level of brackets, import Foo ((:!:)((:!:))) 09:17:12 (:!:) is the type constructor with value constructor (:!:), which goes in extra parens to be associated with the type? 09:17:24 yep 09:17:27 dcoutts: it tycon together with datacon 09:17:34 dolio wins one peanut 09:17:36 it exports 09:17:40 Woo! 09:17:42 aw. 09:17:42 @yow 09:17:43 I'm dressing up in an ill-fitting IVY-LEAGUE SUIT!! Too late... 09:18:30 it's the infix equivalent of data Foo = Bar | Baz and exporting Foo(Bar, Baz) 09:18:53 but where both the type name and constructor are infix operators/names 09:25:53 > fibs !! 10 09:25:54 55 09:25:59 heh 09:26:08 lambdabot memory better than mine ;) 09:55:11 ACTION whines about random numbers on http://osfameron.vox.com/ 09:55:58 ping 10:02:59 osfameron: you can probably pick a random element in one pass. 10:03:41 with circular programming. 10:04:34 roconnor: the second version does only do one pass 10:04:40 what's circular programming? 10:05:05 http://haskell.org/haskellwiki/Circular_programming 10:05:07 Title: Circular programming - HaskellWiki 10:05:15 Actually I'm very curious if this will work. 10:05:21 I give it 50/50 chance 10:05:27 ACTION tries it out 10:07:53 oh, I think I get the idea - but I'm not sure that indexing into a list works for that? 10:08:09 it looks like it applies the aggregate function to every element in the list 10:08:46 osfameron: the idea would be to merge the picking and the computation of the list length into one recursive function. 10:09:10 yes, well my second algorithm sort of does that 10:09:16 though not in the same way 10:09:46 heh this paper has an awesome title 'Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire" 10:10:16 From the department of crap analogies? 10:10:30 osfameron: Use mapM, not map. 10:11:02 Is there a listof _all*_ the optimisations GHC 6 performs? 10:11:11 * let all = nearly all 10:11:37 dolio: ah! 10:13:52 dolio: wooo! shiny 10:14:52 mux: Yeah, that's a classic :) 10:15:37 osfameron: Actually, since you're not using the list anyway, you could do: 'replicateM 5 (pick [1..5])' 10:17:01 osfameron: I tried my solution but GHCi just hangs :( 10:17:09 not even a loop exeception 10:17:41 dolio: ah ok, I couldn't remember the syntax to make a function call X times 10:18:04 > let pickH (_,[]) = (undefined,0); pickH (0,(x:xs)) = (x,(length xs)); pickH (n,_:xs) = let (a,b)=pickH (n-1,xs) in (a,b+1) in let pickR l = let (a,b)=pickH (bdiv2,l) in a in pickR [1,2,3,4,5] 10:18:04 I wouldn't have thought of replicateM as it appears to be in Control.Monad 10:18:05 Exception: <> 10:18:32 osfameron: What would be the point of calling a function X times with the same inputs? 10:19:06 ricky_clarkson: well, maybe that's why I didn't remember it... 10:19:15 but for random numbers it makes a bit of sense 10:19:48 You mean for the side effects? 10:20:25 osfameron: are you sure your algorithm picks numbers uniformly? 10:20:32 ricky_clarkson: yes 10:20:41 roconnor: if I implemented it correctly :-) 10:20:55 I read the algorithm described, I think it does indeed work 10:20:57 osfameron: what happens when you pass it [1..] ? 10:21:00 try it for the first few numbers 10:21:09 osfameron: Random numbers either have to be in IO (or another smaller monad) or else require you to thread along the generator state explicitly 10:21:50 roconnor: then it will pick one of the infinite list. But might take a bit of time 10:22:37 osfameron: If you're looking at functions with side effects, in Haskell you should look at monads instead. 10:22:39 osfameron: It should never terminate if the choice is uniform. 10:23:01 osfameron: ah, okay 10:23:02 Cale: ok, I've sort of understood that much but I don't know how to work with them very well (hence the whining on blog :-) 10:23:08 osfameron: now I belive it works. 10:23:25 roconnor: yeah, I was being facetious, it won't terminate for [1..] 10:23:55 osfameron: okay. I thought for a moment it did terminate. 10:24:11 osfameron: but I now see that it doesn't. 10:24:12 ricky_clarkson: what do you mean? I'm callng the library supplied getRandom function, which is indeed using Monads. 10:24:15 which is good :) 10:24:19 ;-) 10:25:11 osfameron: ah, i think my circular programming solution won't work. 10:25:13 osfameron: which library? 10:25:17 ;( 10:25:23 :'( 10:25:48 http://www.haskell.org/haskellwiki/New_monads/MonadRandom ? 10:25:50 Title: New monads/MonadRandom - HaskellWiki 10:25:50 Cale: "Random" 10:26:00 Cale: http://osfameron.vox.com/library/post/random-pain-in-haskell.html 10:26:02 oh, does that have getRandom? 10:26:12 er... no sorry, it doesn't 10:26:17 it has getStdRandom and randomR 10:26:23 ah, right 10:26:28 which are what I'm using, sorry, said wrong name 10:26:44 The monad that I linked there (which I wrote), has getRandom 10:26:52 It implements a monad Rand 10:27:06 such that you could write your function pick :: [a] -> Rand a 10:27:47 and then to 'run' a Rand, you just need to create a random gen to pass to evalRand 10:27:47 ah cool 10:27:56 (there's also evalRandIO) 10:28:03 what is the advantage to using that instead of Random? 10:28:15 ooo, lunchtime 10:28:17 Well, it uses Random itself :) 10:28:37 cool, I've saved to look at later 10:28:43 The advantage is that you have the generator threaded along for you without possibility of arbitrary IO 10:29:40 Given a base ghci with nothing extra installed, can I use getRandom? 10:30:58 Cale: doesn't it come out as (MonadRandom m) => [a] -> m a 10:31:14 Cale: or did you decide to eschew the class-style generalisation? 10:32:33 <[TWiSTED]> is there a function that tests if a value is an Int ? 10:33:00 @google haskell degrees radians 10:33:02 http://www.vbforums.com/showthread.php?t=51559 10:33:48 because someone of the vb forum had some haskell in their signature 10:33:58 [TWiSTED]: That sort of thing doesn't come up much in Haskell, unless you're mucking with Typeable and Dynamic. 10:34:05 quicksil1er: That's decided at compile time ordinarily. 10:34:07 [TWiSTED]: what type of value do you have which 'might be' an Int? :) 10:34:31 <[TWiSTED]> well ive got an IO function that inputs 2 arguments 10:34:45 <[TWiSTED]> i need error checking so that the first argument is an Int datatype 10:34:58 depends what you mean by 'input' 10:35:09 if you mean you have a function with 2 arguments, then you don't need to check 10:35:21 if the function has type Int, then that argument is guaranteed to be an Int 10:35:30 that's what typing gives you 10:35:40 <[TWiSTED]> yeh 10:35:44 <[TWiSTED]> it errors already if it isnt an int 10:35:54 <[TWiSTED]> but i think to override that error to write my own error 10:36:01 <[TWiSTED]> but i think i need to override* 10:37:06 well, it's a compile-time error 10:37:23 you don't normally change those 10:37:29 <[TWiSTED]> oh ok 10:37:32 but your users won't see them since it's compiled before they see it 10:37:41 [TWiSTED]: that seems odd. The only way that anything could even try to pass it anything else is if you explicitly provided for it with something like Either Int String 10:37:57 Cale: or if you had typeclasses? 10:38:24 <[TWiSTED]> hmm 10:38:27 Cale: originally i thought he had a function Num a => a -> b, which he wanted to behave differently if you gave it an Int or something else 10:38:33 drigz: Well, yeah, I suppose that could happen. 10:38:35 but apparently not 10:38:54 <[TWiSTED]> nah its not meant to behave differently if given an Int 10:39:00 But that's not allowed to really behave differently -- it just has to do what the typeclass instances say to do. 10:39:09 <[TWiSTED]> just argument checking i suppose 10:39:55 drigz: typeclass things are really supposed to behave 'the same' not 'different' :) 10:39:58 Right, the only argument checking you'd have to do in Haskell is with regard to the specific values of the type in question (say, if your function only works on positive Integers) 10:40:05 drigz: but certainly you can pervert typeclasses to do that 10:40:24 Right, if you were to make it a typeclass method, and write lots of instances :) 10:41:02 quicksil1er: yeah, but i'm the kind of person who thinks of crazy ways to do what people say they want, instead of telling them they shouldn't want it 10:41:11 Oh hey, osfameron, you were looking for mapM in your blog. 10:41:34 I find most blog articles are either looking for sequence or mapM 10:41:42 even if they don't think they're articles about haskell 10:42:50 <[TWiSTED]> well perhaps i should check that its not a Char or String rather than checking that its an Int 10:43:27 quicksil1er: :D 10:43:55 [TWiSTED]: no working haskell implementation should give a function that has type Int -> a anything but an Int 10:44:07 <[TWiSTED]> yeah true 10:44:32 it's not like python where if you want a robust function you have to put assert isinstance(argument, type) 10:45:00 [TWiSTED]: This is why we all love static typing so much, because it frees us from writing zillions of pointless tests. :) 10:45:30 <[TWiSTED]> haha yeh 10:45:35 If you give a function some type signature, the compiler will actually prove that it's never called in any other way. 10:45:36 spagillions! 10:45:37 Instead we can write more meaningful ones, I suppose. 10:45:46 right. 10:46:04 Now I need to figure out the dynamic programming bit for lcs. 10:46:17 (Longest Common Subsequence) 10:47:02 You know I implemented a couple of lcs algorithms in Haskell, right? 10:47:19 No, actually. 10:47:30 :t replicateM 10:47:32 forall (m :: * -> *) a. (Monad m) => Int -> m a -> m [a] 10:47:44 Igloo: Point away. 10:47:52 > replicateM 3 [1,2,3] 10:47:53 [[1,1,1],[1,1,2],[1,1,3],[1,2,1],[1,2,2],[1,2,3],[1,3,1],[1,3,2],[1,3,3],[2,... 10:47:59 No need to reinvent the wheel. 10:48:02 wli: darcs has some code for lcs 10:48:06 wli: http://urchin.earth.li/darcs/ian/lcs/ 10:48:07 Title: Index of /darcs/ian/lcs 10:48:39 I can has programming reddit? 10:49:05 Cale: is it dead again? 10:49:14 Appears to be. 10:49:32 I can not has programming reddit :( 10:49:37 Not yours 10:49:38 i think the people going OMG ALBERTO GONZALES has broken it 10:49:55 OMG ALBERTO GONZALES!!1 10:50:07 sorry 10:50:09 > reverse "SELAZNOG OTREBLA GMO" 10:50:11 "OMG ALBERTO GONZALES" 10:50:12 Gonzo party? 10:50:17 even lambdabot is at it 10:51:43 > replicateM 2 [1,2] 10:51:44 [[1,1],[1,2],[2,1],[2,2]] 10:51:49 Cale, quick! this is our chance to put up notreddit.com! 10:51:58 i can has only haskell stories! 10:52:13 lolcats and lambdas! 10:53:35 osfameron: did you work out how to use System.Random? 10:53:41 :t randomRs 10:53:43 forall a g. (Random a, RandomGen g) => (a, a) -> g -> [a] 10:54:14 dons: haddit.com! 10:54:45 dunnit.com 10:54:53 gotthetshirt.com 10:55:39 Oh dear, now I remember. I wanted the prefix and suffix. 10:56:13 osfameron: no IO required for randoms :) 10:56:27 > randomRs (1,6) (mkStdGen 42) 10:56:29 [6,4,2,5,3,2,1,6,1,4,4,4,1,3,3,2,6,2,4,1,3,1,1,5,5,5,1,3,6,1,5,6,1,3,5,4,1,3... 10:56:58 lolcatsandlambdas.com sounds cute. 10:58:46 Is there like a rule somewhere that says that blog software generally has to suck with regard to parsing of comments? 10:59:11 Everything after any < has to be ignored. 10:59:20 That way you can place all insults there. 10:59:50 Cale: i think that's a special instance of the more general rule 11:00:32 Cale: people believe that it's trivial to write new blog software, thus they keep writing new blog software 11:00:48 Cale: and each time they do predictably poorly on the parts of the job which are hard 11:01:30 java.net blogs has been saying "comments shown oldest first" incorrectly for at least 3 years. 11:01:40 wordpress insists on mucking with your entire box. It's like a SPEC benchmark where you have to replace numerous standard utilities and so on to get it to run at all. 11:02:03 quicksilver: The irritating part is that the 'professional' ones are actually just as rubbish as the amateur ones. 11:02:24 which is why people keep writing new ones 11:02:31 tis a bugger of a vicious circle :) 11:02:56 It's really not *that* hard. 11:03:10 People just don't seem to know which bugs to check for. 11:03:33 learning from other people's mistakes is so web 1.0 11:03:44 in web 2.0 we like to make our own mistakes without consulting prior work 11:03:51 The recent reddit beta had just about every possible comment parsing bug. 11:04:04 Which is funny, because the existing reddit has it mostly right. 11:04:34 @remember quicksilver learning from other people's mistakes is so web 1.0 11:04:34 Done. 11:04:51 Heh, you could totally kill the comments page just by posting a single unicode character. 11:05:32 ahh - maybe that's why reddit is down atm - someone posted a unicode character! 11:06:34 I like the blog software that shows a live preview of how the comment will look. 11:07:07 ..but I think you can keep it simple - all you need is something that recognises URLs, the rest is faff. 11:14:45 <[TWiSTED]> can i do a conditional expression (like if) inside a do expression? 11:14:54 [TWiSTED]: yep 11:15:03 [TWiSTED]: do if foo 11:15:13 [TWiSTED]: then bar 11:15:15 <[TWiSTED]> hm saying syntax error in expression 11:15:18 [TWiSTED]: else quux 11:15:30 How are you indenting it? 11:15:45 and are you being sure to include both branches of the if-expression? 11:15:49 <[TWiSTED]> i have the then statement directly after the if condition 11:15:56 <[TWiSTED]> o 11:15:59 <[TWiSTED]> i havent used else 11:16:01 right 11:16:02 Do you need the else branch in a do expression? 11:16:04 that would be the problem 11:16:08 return () 11:16:17 (which is a noop 11:16:18 ) 11:17:02 [TWiSTED]: use when foo bar'', in cases where you'd use if foo then bar. 11:17:20 or foo when bar 11:17:28 <[TWiSTED]> o ok 11:17:30 erm 11:17:38 but that's silly 11:17:39 :( 11:17:47 <[TWiSTED]> ok i added the else 11:17:51 when needs its parameters in the other order! 11:17:52 :) 11:18:00 <[TWiSTED]> it says "last generator in do {...} must be an expression 11:18:17 What's the last thing in your do expression? 11:18:27 > (\x -> do {when (odd x) mzero}) =<< [1,2,3,4,5] 11:18:29 [(),()] 11:18:32 <[TWiSTED]> calls a function 11:18:41 hmm, not the most clear example in the world 11:18:55 > (\x -> do {when (odd x) mzero; return (show x)}) =<< [1,2,3,4,5] 11:18:57 ["2","4"] 11:19:45 ... of course insead of when (odd x) mzero'', one would really do guard (not (odd x))'' 11:20:57 <[TWiSTED]> hm 11:21:30 or guard (even x) 11:21:59 [TWiSTED]: if you're still stuck, paste some of your source code and it will be easier to help you 11:22:20 <[TWiSTED]> ok 11:22:36 > let if = when in do { x <- [1,2,3,4] ; mzero if (odd x) ; show x } 11:22:36 Parse error 11:22:56 <[TWiSTED]> main = do args <- getArgs 11:22:57 <[TWiSTED]> if (length (args)) /= 2 11:22:57 <[TWiSTED]> then "Incorrect number of arguments" 11:22:57 <[TWiSTED]> else cs <- readFile (args !! 1) 11:22:57 <[TWiSTED]> displayTail (read (args !! 0)) (lines cs) 11:23:00 @src even 11:23:01 even n = n rem 2 == 0 11:23:06 :( 11:23:09 [TWiSTED]: not in the channel :) 11:23:14 <[TWiSTED]> lol 11:23:14 [TWiSTED]: please don't paste more than three or four lines here :) 11:23:15 <[TWiSTED]> sorry 11:23:16 @paste 11:23:16 Haskell pastebin: http://hpaste.org/new 11:23:19 i always thought that i was being efficient by using even 11:23:26 [TWiSTED]: anyhow, the problem is that "incorrect number of arguments" isn't an action 11:23:29 (only lambdabot is allowed to spam) 11:23:32 [TWiSTED]: it's a string 11:23:40 <[TWiSTED]> should i use putStr ? 11:23:41 <[TWiSTED]> o 11:23:42 <[TWiSTED]> ok 11:23:45 [TWiSTED]: possibly you want putStrLn or error 11:24:03 > let if' = flip when in do { x <- [1,2,3,4] ; mzero if' (odd x) ; show x } 11:24:04 "24" 11:24:10 [TWiSTED]: secondly, you need another 'do' inside the else clause 11:24:18 [TWiSTED]: else do cs <- ..... 11:24:20 <[TWiSTED]> ohh ok 11:24:43 > let and = when in do { x <- [1,2,3,4] ; odd x and mzero ; show x } 11:24:44 "24" 11:24:51 <[TWiSTED]> awesome 11:24:54 <[TWiSTED]> thanks quicksilver 11:24:57 np 11:25:04 nornagon: and is a terrible name :) 11:25:05  11:25:25 @hoogle and 11:25:26 Prelude.and :: [Bool] -> Bool 11:25:26 Prelude.significand :: RealFloat a => a -> a 11:25:26 System.Process.runCommand :: String -> IO ProcessHandle 11:25:39 > and [True,False,True,True,True] 11:25:40 False 11:25:56 > and [] 11:25:57 True 11:25:59 > and [False..] 11:25:59 Parse error 11:26:48 > and [False ..] 11:26:50 False 11:26:55 ACTION yawns 11:27:02 mornin' :) 11:27:10 > and [minBound ..] 11:27:12 False 11:27:28 thoughtpolice: 6.30, wow 11:27:35 quite an hour for #haskell 11:27:47 whatever time it is, it's always #haskell time 11:27:55 Do haskellers get up earlier than lispers? 11:27:59 @quote time 11:27:59 lispy says: one thing that's funny about programming in haskell is, it's the only language i know where i sometimes rewrite code so it will work on 'inifinite' datastructures 11:28:21 roconnor: i agree ) 11:28:30 s/\)/:)/ 11:28:34 drigz: what quicksilver said. 11:29:09 also, school requires early mornings, so i don't go insane in my first class. 11:29:43 because normally I wake up about 15 minutes before class starts. 11:30:34 I've done that when I'm teaching before. 11:36:54 i joined #haskell to see if there was a function to convert radians to degrees, because i didn't want to type it myself 11:36:58 that was an hour ago :( 11:37:15 drigz: nope 11:38:56 > let degrees = (*(pi/180)) in (90 degrees) 11:38:58 1.5707963267948966 11:39:04 > let degrees = (*(pi/180)) in (360 degrees) 11:39:05 6.283185307179586 11:39:17 > let degrees = (*(pi/180)) in (180 degrees) 11:39:19 3.141592653589793 11:39:46 I guess that isn't Haskell 98 11:40:02 nope 11:40:07 hi 11:41:46 roconnor: Why (180 degrees) instead of degrees 180? 11:42:03 ricky_clarkson: it reads better. 11:42:09 arguably. 11:43:41 a = omega ^ 2 * r, right? 11:44:07 drigz: a = pi * r^2 ? 11:44:18 a = angular acceleration 11:44:27 oh 11:44:33 no, sorry, centripetal acceleration 11:45:01 drigz: I always remember v^2/r = a 11:45:08 drigz: thats right 11:45:36 drigz: given that omega = v/r, what you have looks right. 11:48:54 ACTION usually just re-derives those things from vector forms on the fly. 11:49:59 i just work it out from units, but for some reason my results were'nt working 11:50:06 *weren't 11:50:14 turns out i forgot the m in F = ma :( 11:50:48 x(t) = (x_0 + r*cos(f(t)), y_0 + r*sin(f(t))) or some such. 11:52:32 x' = r*f'(t)*(-sin(f(t)), cos(f(t))) etc. 11:52:55 > 5 11:52:57 5 11:53:05 :D 11:53:19 i know, i own @ haxell 11:53:45 > 5+-2 11:53:46 Not in scope: +-' 11:53:49 > 5+ -2 11:53:50 precedence parsing error 11:53:50 cannot mix (+)' [infixl 6] and prefix ... 11:53:54 > 5 + -2 11:53:55 precedence parsing error 11:53:55 cannot mix (+)' [infixl 6] and prefix ... 11:53:55 x'' = r*f''(t)*(-sin(f(t)), cos(f(t))) - r*(f'(t))^2*(cos(f(t), sin(f(t))) 11:53:56 :P 11:53:59 hax! 11:54:01 > 5 + (-2) 11:54:02 3 11:54:04 i know 11:54:06 > 5+$-2 11:54:06 in theory 11:54:07 Not in scope: +$-' 11:54:12 > 5+$ -2 11:54:12 Parse error 11:54:17 ehh 11:54:21 > (5+) 3 11:54:23 8 11:54:28 > (5+) $(-2) 11:54:28 > (+) 5 (-2) 11:54:28 > (+5) 3 11:54:30 3 11:54:30 3 11:54:31 8 11:54:40 > 5 +$ - 2 11:54:40 Parse error 11:54:46 i think mine is the best. :) 11:54:47 > (+5) (-2) 11:54:49 3 11:55:09 > [1,2,3,4] 11:55:10 [1,2,3,4] 11:55:14 > reverse[1,2,3,4] 11:55:15 [4,3,2,1] 11:55:37 > nubBy(((>1) .) . gcd) [2..] 11:55:39 [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,... 11:56:25 > last [1..] 11:56:26 :D 11:56:30 Terminated 11:56:53 > fix ((1:) . scanl (+)) 11:56:54 Couldn't match expected type [t]' 11:57:01 In the direction of the normal it's r*f''(t), in the direction of the tangent it's r*(f'(t))^2, things like |x'' - (/|x'|^2)*x'| end up being "a 11:57:01 woops 11:57:08 "a" rater. 11:57:11 > fix ((1:) . scanl (+) 1) 11:57:12 [1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17... 11:57:30 anybody seen this? http://cufp.galois.com/ 11:57:31 Title: Commercial Users of Functional Programming 11:57:54 looks fun (found it via erlang's mailing list) 11:58:11 That's the sort of thing I recapitulate as-needed. 11:58:26 Frenet frames are not so involved really. 12:04:16 <[twiisted]]> anyone able to help explain what the function sequence_ does? 12:04:47 it executes a list of actions and discards the result 12:04:50 @type sequence_ 12:04:52 forall (m :: * -> *) a. (Monad m) => [m a] -> m () 12:05:05 <[twiisted]]> ah ok 12:05:09 i.e. sequence [putStr "hello ",putStrLn "world"] 12:05:38 <[twiisted]]> and doesnt give a result? 12:05:48 nope 12:05:51 sequence gives a result 12:05:54 sequence_ doesn't 12:05:58 @type sequence 12:05:58 <[twiisted]]> ohh ok 12:06:00 forall (m :: * -> *) a. (Monad m) => [m a] -> m [a] 12:06:13 <[twiisted]]> so sequence [putStr "hello ",putStrLn "world"] will result in "hello world" yeh? 12:06:18 yeah. 12:06:20 <[twiisted]]> ok 12:06:22 <[twiisted]]> thanks 12:06:31 you can also repeat one action lots of times 12:06:33 via repeat 12:06:48 i.e. sequence_ . repeat 10 $putStrLn "hello world!" 12:07:10 <[twiisted]]> say i wanna apply a function to x number of arguments 12:07:35 <[TWiSTED]> hm 12:07:49 use mapM_ 12:08:16 like mapM_ print [1..10] 12:08:46 <[TWiSTED]> o ok 12:08:48 if you want the results, you can just use mapM 12:08:50 <|Jedai|> thoughtpolice: Not repeat, replicate (repeat produce an infinite list) 12:08:58 <[TWiSTED]> o yeh mapM 12:09:00 |Jedai|: oh thanks. :) 12:09:03 <[TWiSTED]> need the results 12:09:17 <|Jedai|> thoughtpolice: You have replicateM to repeat action too ^^ 12:09:28 [TWiSTED]: if it's not monadic though you don't need mapM and can just use vanilla map 12:09:36 > [o] 12:09:37 Not in scope: o' 12:09:46 > [-] 12:09:47 Parse error 12:09:50 > [(-)] 12:09:52 [ Integer -> Integer>] 12:10:23 jedai: i.e. (replicateM_ x) == (sequence_ . repeat x) 12:10:29 ? 12:10:46 thoughtpolice: almost : (replicateM_ x) == (sequence_ . replicate x) 12:10:54 damnit. :( 12:11:09 |x''- (/|x'|^2)*x'|^2 = |x''|^2 - ^2/|x'|^2 = a^2 12:11:12 i always forget repeat just makes an infinate list out of the argument. 12:11:14 What, no counter? 12:11:27 thoughtpolice: I made this error all the time at first ;) 12:11:37 <[TWiSTED]> what does monadic mean 12:11:38 @type replicateM_ 12:11:40 forall (m :: * -> *) a. (Monad m) => Int -> m a -> m () 12:12:06 replicateM_ n x == sequence_ . replicate n x 12:12:18 > (\t a n->case a of 1 -> (a a); x -> (a (t t a (n - 1)))) 12:12:19 Occurs check: cannot construct the infinite type: t = t -> t1 12:12:19 Probab... 12:12:23 oh :< 12:12:24 [TWiSTED]: monadic means "in a monad", IO is a monad, but you have other monads (like State eg) 12:12:26 replicateM_ n x == sequence_$ replicate n x 12:12:27 what's wrong? 12:12:31 [TWiSTED]: things like putStrLn (IO Monad) 12:12:44 that oughtta be a lambda for self application 12:12:49 <[TWiSTED]> oh ok 12:12:51 there're others, though. but if your function you're applying these arguments to is not 'inside' a monad, 12:12:54 but i guess i fail some type stuff? 12:12:57 oklopol: Haskell doesn't support infinite types. 12:13:05 you don't need mapM etc, you only need map 12:13:07 :t let replicateM_' n x = sequence_ $replicate n x in (replicateM_, replicateM_') 12:13:11 forall (m :: * -> *) a (m1 :: * -> *) a1. (Monad m, Monad m1) => (Int -> m a -> m (), Int -> m1 a1 -> m1 ()) 12:13:16 umm okay... can you try and explain what makes that infinite? 12:13:23 <[TWiSTED]> the function outputs type IO () 12:13:24 oklopol: What type does f have? 12:13:33 umm... the lambda? 12:13:36 [TWiSTED]: then it's in the IO monad, which means you want mapM. 12:13:37 Er, wait. 12:13:44 <[TWiSTED]> ok thanks 12:13:54 oklopol: \f f x -> f x -- is a simpler version to talk about. 12:14:01 okay 12:14:06 > \f f x -> fx 12:14:07 > \f f x -> f vx 12:14:08 > \f f x -> f x 12:14:10 Conflicting definitions for f' 12:14:10 In a lambda abstraction 12:14:10 Not in scope: vx' 12:14:11 Not in scope: fx' 12:14:14 :D 12:14:20 > (\f f x -> f x) 12:14:23 Conflicting definitions for f' 12:14:23 In a lambda abstraction 12:14:35 so... hmm... 12:14:36 > \f x -> f f x 12:14:37 Occurs check: cannot construct the infinite type: t = t -> t2 -> t1 12:14:37 ... 12:14:48 <[twiisted]]> ffs stupid network 12:14:56 In that, what type would f be? 12:15:21 ricky_clarkson: under what type system? 12:15:23 f :: x -> (((....) -> x) -> x) 12:15:24 err 12:15:28 It would be a function that takes a function that takes a function that... ... and x and x and x and x 12:15:37 oklopol: indice, f f x == (f f) x 12:15:45 oh 12:15:50 yeah indeed 12:16:55 can you do my self application thing at all? 12:17:27 with recursive types 12:18:23 oklopol: Yes, with fix. 12:18:36 i see... 12:18:38 > fix 12:18:40 Add a type signature 12:18:44 > fix f 12:18:45 Not in scope: f' 12:18:46 fix is evil 12:18:56 what's fix's definition? 12:18:57 ?type fix 12:18:59 forall a. (a -> a) -> a 12:18:59 oh 12:19:02 ?src fix 12:19:02 fix f = let x = f x in x 12:19:10 > fix (\f n -> if n == 0 then 1 else n * f (n - 1))$ 4 12:19:11 24 12:19:24 > fix ((1:) . scanl (+) 1) 12:19:25 [1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17... 12:20:02 > fix $\x -> x+1 12:20:04 Exception: <> 12:20:19 > let { fix f = f (fix f) } in fix ((1:) . scanl (+) 1) -- "nicer" definition, imo 12:20:21 [1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17... 12:20:21 > fix ((2:) . scanl (*) 1) 12:20:22 [2,1,2,2,4,8,32,256,8192,2097152,17179869184,36028797018963968,6189700196426... 12:20:42 > fix ((1:) . scanl (*) 2) 12:20:44 [1,2,2,4,8,32,256,8192,2097152,17179869184,36028797018963968,618970019642690... 12:21:01 oklopol: An example of where a mandatory static typing system forces you to think differently (but in this case fix is actually better). 12:21:05 Oh well. 12:21:05 > fix (scanl (*) 2 . (1:)) 12:21:06 [2,2,4,8,32,256,8192,2097152,17179869184,36028797018963968,61897001964269013... 12:21:28 > fix ("you're wrong! No, " ++) 12:21:29 "you're wrong! No, you're wrong! No, you're wrong! No, you're wrong! No, you... 12:21:35 heh 12:21:38 nice one 12:21:42 what does fix have to do with (f f) x? 12:21:51 (DRMacIver's) 12:22:00 is this to do with making the Y combinator? 12:22:09 @index scanl 12:22:09 Data.List, Prelude 12:22:14 @type scanl 12:22:15 the Y combinator is one definition of fix 12:22:16 forall a b. (a -> b -> a) -> a -> [b] -> [a] 12:22:18 which isn't necessary in a language in which explicit recursion is allowed? 12:22:21 :D 12:22:26 well f f is a part of how you write Y 12:23:02 > f = 5 12:23:02 Parse error 12:23:04 fix ((1:) . (>>= \x -> [1+x, 1/(1+x)])) :: [Rational] 12:23:08 > fix ((1:) . (>>= \x -> [1+x, 1/(1+x)])) :: [Rational] 12:23:08 can you store any values? 12:23:09 [1%1,2%1,1%2,3%1,1%3,3%2,2%3,4%1,1%4,4%3,3%4,5%2,2%5,5%3,3%5,5%1,1%5,5%4,4%5... 12:23:42 Saizan, that's what i was saying, but i then qualified that with "but you don't need to write Y in haskell 'cos you're allowed recursive definitions" 12:23:51 oklopol, do you mean serialization? 12:23:59 no, i mean the bot 12:24:07 @let x = 3 12:24:12 > x 12:24:13 Not in scope: x' 12:24:14 Defined. 12:24:16 > x 12:24:17 3 12:24:19 ;] 12:24:22 > L.x 12:24:23 ACTION boggles 12:24:24 3 12:24:37 you're too quick, er, quicksilver 12:24:37 @let f = f . f 12:24:39 Defined. 12:24:43 > f 5 12:24:45 (wikiwikisilver?) 12:24:46 umm... 12:24:47 L is in scope now? 12:24:47 Terminated 12:25:10 "f = f . f" is legal? 12:25:25 yes, but it's the bottom of a -> a. 12:25:35 umm yeah 12:25:42 legal but not very interesting 12:25:46 but... why does it take arguments? 12:25:53 i don't ask it to 12:25:53 ?type (.) 12:25:54 because it has a function type 12:25:56 forall b c a. (b -> c) -> (a -> b) -> a -> c 12:26:03 ?type undefined . undefined 12:26:04 forall c a. a -> c 12:26:10 same reason let f = (+1) . (+2) takes an argument 12:26:17 ?type let x = undefined in x . x 12:26:19 forall c a. a -> c 12:26:22 > let f = (+1) . (+2) in f 6 12:26:24 9 12:26:40 oh, (f . f) takes an argument and applies f to it twice 12:26:54 and by the recursive property, f also takes an argument then 12:27:27 or "by type inference" 12:27:30 but, yes 12:27:57 yeah, sorry if i'm raping terms, i do that a lot 12:28:31 i'm pretty sure i'll learn haskell eventually by asking random questions here a few times a month 12:28:36 now pizza -> 12:29:40 Lambdas are fun. 12:29:43 > let cons=(\x y m -> m x y) in let car=(\c -> c (\x y -> x)) in (car (cons 4 5)) 12:29:44 4 12:33:52 @pl \c -> c (\x y -> x) 12:33:52 ($ const) 12:34:08 @pl \c -> c (\x y -> y) 12:34:08 ($const id) 12:34:38 if you want nice symmetry, those could be ($ uncurry fst) and ($uncurry snd) 12:35:18 Do you think sicp could be rewritten to use monads, so that set! is never needed? 12:35:39 sicp? 12:36:00 You owe it to yourself to google that term. 12:36:51 @go sicp 12:36:53 http://mitpress.mit.edu/sicp/ 12:36:53 Title: Welcome to the SICP Web Site 12:37:12 @pl (\c -> c (\x y -> x)$ (\x y m -> m x y) 4 5 12:37:12 (line 1, column 45): 12:37:12 unexpected end of input 12:37:12 expecting variable, "(", operator, "$", "$!", "seq" or ")" 12:37:19 @pl (\c -> c (\x y -> x)) $(\x y m -> m x y) 4 5 12:37:19 4 12:37:22 ahh. i've seen that in my college library 12:37:29 Steal it. 12:37:34 ... "$", "$!", "seq" aren't operators?! 12:37:38 so @pl contains an implementation of scheme! 12:37:45 @src ($) 12:37:45 f $x = f x 12:37:54 @src ($!) 12:37:54 Source not found. Wrong! You cheating scum! 12:38:01 @src seq 12:38:02 Source not found. Maybe if you used more than just two fingers... 12:38:13 i think the latter two hide in GHC? 12:38:19 ?type (\c -> c (\x y -> x)) $(\x y m -> m x y) 4 5 12:38:20 forall b. (Num b) => b 12:38:23 f$! x = x seq f x 12:38:45 x seq y = (const $! x) y 12:38:46 =P 12:39:50 ricky_clarkson, the library has fairly high security. i could just borrow it while i'm there... 12:40:05 or just read it online, seeing as that seems to be possible 12:40:41 I work at a university - they gave up asking for books back a few years ago. 12:40:59 let they=library in above 12:41:17 this one's got RFIDs in the spine of all the books, and those security gate things at the door 12:41:40 so an alarm goes off if you try to get out with an un-checked-out book. 12:42:00 and if you don't return a book on time, the college starts putting fines on my termly bill 12:42:06 s/you/I/ 12:42:06 Hah. 12:42:32 We tell students they won't be allowed to graduate until they've paid library fines, but we don't really enforce that. 12:43:01 it's really rather clever. the only option i can think of that *might* work is to steal someone else's uni card, and check out the book with that 12:43:11 ..because in the UK often education is usually mainly or totally paid by the state, it's a bit harder to whack extras onto the bill. 12:43:31 but then they could look at the security camera footage on the door and see who was carrying the book as it went thru the gates 12:43:57 oh, this isn't the university fees, this is the college fees. room & board, tuition, etc. 12:44:00 Is there a really-recommended book for Haskell, or do you just cobble an understanding together from SPJ's papers? 12:44:16 (yay oxford) 12:45:00 EvilTerran: What languages do Oxford CS people do? 12:45:09 ricky_clarkson, under instruction from my FP lecturer, i am required to recommend "Introduction to Functional Programming" by Bird 12:45:26 U 12:45:29 oops 12:45:37 ricky_clarkson: the newish book by Hutton is well recommended 12:45:41 ricky_clarkson: I haven't read it myself 12:45:44 EvilTerran: line your jacket with foil, and put the book under it? 12:45:49 we did Haskell in first term of first year, then oberon (an even uglier version of Pascal) in second term for imperative programming 12:45:56 maybe we should take this to #pettytheft 12:45:57 next year we're using Java for OOP 12:46:06 drigz, security cameras whee! 12:46:26 sleight of hand? 12:46:28 You should use scheme for OOP - where you get to invent your own OOP. 12:46:57 i think there might be a couple of others we have to use, depending on which units we take, but after that i think we're basically allowed to use whatever takes our fancy 12:46:59 EvilTerran: At least the top ones aren't doing Java for everything. 12:47:04 ones=unis 12:47:17 i heard that oxford cs used about 7 languages 12:47:27 the first term's course was "functional programming". i don't think java would be appropriate 12:47:36 When my boss studied he did one language a week in one semester. 12:48:14 drigz, well, if you count CSP, different flavours of \calc, the three different query languages i'm betting'll be taught in the databases unit... 12:48:39 I'm beginning to think my portfolio optimizer is needlessly complicated. 12:49:04 I think CS courses should be based around http://norvig.com/21-days.html 12:49:05 Title: Teach Yourself Programming in Ten Years 12:49:06 they try to give a set of skills that aren't bound to one language, so they keep switching to stop us getting stuck in a rut 12:49:17 In Haskell, 70 lines of code is considered too complicated :D 12:49:49 roconnor: actually that is my average code size for complete projects (-: 12:50:07 I like it when the code is smaller than the requirements doc. 12:50:16 xerox: sounds like you could do a bit more refining ;) 12:50:51 if three of those lines aren't import Control.Monad; import Control.Arrow; import Control.Applicative;, you can make it shorter ;] 12:51:10 roconnor: actually I'm quite pleased with those results ! 12:51:42 I'm starting to think my two case statements in my portfolio optimizer cancel each other out, leaving me with a nice simple linear equation to solve. 12:52:26 xerox: Oh, I'm sure, but that doesn't mean you cannot go further ;) 12:52:41 xerox: of course, just because you can go further doesn't mean you should go further. 12:53:16 by the by, i was thinking about guard desugaring... would desugaring "case foo of bar | baz -> ...; eek | ack -> ..." to "case (foo, baz, eek) of (bar,True,_) -> ...; (baz,_,True) -> ..." etc make sense? 12:53:29 xerox: (actually I think 70 lines is a pretty reasonable module size) 12:53:30 @remember EvilTerran if three of those lines aren't import Control.Monad; import Control.Arrow; import Control.Applicative;, you can make it shorter ;] 12:53:30 Done. 12:53:49 roconnor: I agree. Especially because it does non-obvious work with pleasing-to-read code most of the time. 12:53:55 Why must every 3rd party Haskell library web site contain at least one broken link??? 12:53:58 i know this is a solved problem, but i like to think about these things 12:54:04 pjd, :D 12:55:15 actually, i got to thinking about this when thinking about Core-esque languages and suchlike. seems guards are eliminatable to me. 12:56:01 why do people hate guards so much? 12:56:27 ACTION <3 guards 12:56:29 i don't hate them in the language, just think they don't need to be in a Core-like language 12:56:34 does GHC have pattern guards? 12:56:43 ACTION ? pattern guards 12:56:47 Tac-Tics: Actually I was thinking the same thing. I like guards but nobody seems to be using it. 12:56:54 isn't ghc the onle one with pattern guards? 12:56:54 Aw. That was meant to be an unicode HEART. 12:56:54 and the point of Core is to have a minimalist syntax... 12:57:02 roconnor, yes 12:57:16 i think -fglasgow-exts is enough to enable them 12:57:19 Guards don't seem that bad. Especially since Haskell has a kinda clunky if statement syntax 12:58:00 @where pattern-guards 12:58:01 http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#pattern-guards 12:58:05 at least, in comparison with the terseness of everything else 12:58:22 From everything I've seen, using an "if" statement in Haskell is a sign of defeat =-P 12:58:28 Does anyone use vim with Haskell? If so, did anyone come up with clever folding settings? 12:59:10 Radek, isn't folding by indentation pretty good? 12:59:39 EvilTerran: cool, I should start using them. 12:59:43 Radek: I haven't done anything with that yet, bu tyou might check with python users since they also have the layout thing to contend with 13:00:08 roconnor, i agree; they're really useful for adding terseness 13:00:09 EvilTerran: Well. I was hoping for a little better. For example case and if statements gets too much folded. 13:00:16 msouth: Nice tip. Thanks 13:01:17 Even in verbose languages I hate folding. I tried to like it, honest. 13:03:35 What would the Haskell type system need exactly to enable [[]] :: * -> * ? 13:03:48 msouth: That was very good tip. I looked briefly at the python settings and I found some clever yet obvious settings. Thanks! 13:04:33 ricky_clarkson, i agree, actually. if you need folding, you either need to restructure your program or your language. 13:04:45 what is folding? 13:04:47 type LoL a = [[a]]? 13:05:02 xerox: Partial application. 13:05:06 EvilTerran: I am aware of that possibility. 13:05:09 xerox, a (.) for types would work 13:05:25 EvilTerran: right, I can also do that, but it is not [[]] 13:05:38 Actually it's rejected. 13:05:48 Partially applied type synonym errors. 13:05:50 newtype ((t1 :: * -> *) :. (t2 :: * -> *)) a = t1 (t2 a) 13:05:57 With a datacon 13:06:30 wli: the problem is that [] :: * -> *. That is, it wants a *type* as first argument, not a type constructor of kind (* -> *) such as []. 13:06:38 roconnor, making the lines of code inside blocks disappear in your IDE so you don't have to scroll so much 13:06:40 <[TWiSTED]> how do i read in a file and apply something to each line in that file? 13:06:45 I guess the answer is type lambdas. 13:06:49 xerox: Yes. 13:06:57 <[TWiSTED]> cs <- readFile filename 13:07:14 needing it is an indication that your code is too long. if this is too difficult to do, your langauge is too verbose ;] 13:07:18 <[TWiSTED]> but im unsure how to separately access 1 line in the file 13:07:22 s/do/fix/ 13:07:32 map f (lines cs) 13:07:47 ?type hGetLine 13:07:47 :t lines 13:07:49 Not in scope: hGetLine' 13:07:50 String -> [String] 13:08:04 EvilTerran: ah, ... why would you have more code than fits on a screen? :P 13:08:12 System.IO.hGetLine :: Handle -> IO String 13:08:39 roconnor, my cond^H^H^H^Hsentiments exactly. 13:09:38 <[TWiSTED]> would any "word" (lines cs) search each line to see if "word" appears in a line? 13:09:39 > lines "Hello\nWorld\n" 13:09:40 ["Hello","World"] 13:09:51 > map length$ lines "Hello\nWorld\n" 13:09:53 [5,5] 13:10:12 [TWiSTED], a combination of hGetLine and hIsEOF (to prevent exceptions) might be nicer in terms of memory usage 13:10:24 no 13:10:31 lazy IO should take care of that 13:10:34 > map (any (=="Hello") . words) \$ lines "Hello\nWorld\n" 13:10:35 i'm not sure how lazy readFile really is... 13:10:36 [True,False] 13:10:51 it's quite lazy, which caused some problems for me the other week 13:11:01 mrd, okay. i'm still not entirely comfortable with the lazy file access, is all 13:11:13 I don't blame you. try readFile then writeFile immediately after =) 13:11:34 readFile should only be used for "pure" files ;) 13:11:34 ACTION is ambivalent about lazy files 13:11:44 mrd: unlink first 13:11:56 will that force it? but I need Posix for that 13:12:14 lazy I/O is nice for throwaway stuff 13:12:38 mrd: No, it won't force it; however, writeFile opens with O_TRUNC IIRC so you will avoid the write-after-read hazards. 13:13:03 the first problem I ran into was that the file wasn't closed 13:13:06 scook0, yeah, that's kinda what i was trying to say. i don't feel safe enough using it to use it for big projects 13:13:12 and haskell simple IO implements a simple locking system 13:13:30 mrd: When readFile's handle is closed the on-disk inode will be discarded. writeFile will obtain a fresh inode. etc. 13:13:54 lazy IO is nice for code which you intend to throw away and never use 13:14:31 mrd: writeFile should probably really do this internally to avoid surprises. 13:14:45 but when is readFile's handle closed? 13:15:02 mrd: In the handle's finalizer IIRC. 13:15:09 yea that's what I was running into. 13:15:18 I just switched to strict bytestring 13:15:30 mrd: It doesn't matter if you unlink because writeFile will not have a handle to the same inode. 13:15:36 sure 13:15:39 mrd: It will obtain a fresh inode. 13:16:02 <[TWiSTED]> well im tryin to build a function similar to the grep command in linux 13:16:32 <[TWiSTED]> searches a file for a given word line by line and outputs the lines that contain that word 13:17:35 do { s <- System.IO.readFile filePath ; System.Directory.removeFile filePath ; System.IO.writeFile filePath s' } 13:19:03 Perhaps readAndReplace :: FilePath -> String -> IO String ; readAndReplace filePath s = do { s' <- System.IO.readFile filePath ; System.Directory.removeFile filePath ; System.IO.writeFile filePath s ; return s' } 13:19:04 [TWiSTED]: sounds like a nice oneliner :) 13:19:17 <[TWiSTED]> haha 13:19:18 [TWiSTED]: I sugges using Data.ByteString.Lazy 13:19:27 <[TWiSTED]> im not that good with haskell to do it all in one line 13:19:38 [TWiSTED]: use long lines ;) 13:19:43 ?type filterM 13:19:45 forall a (m :: * -> *). (Monad m) => (a -> m Bool) -> [a] -> m [a] 13:19:46 mrd: The anonymous on-disk inode is kept alive with the file contents intact so long as the file handle remains open. 13:19:48 [TWiSTED]: pretend you are! 13:19:55 <[TWiSTED]> hehe 13:20:07 wli: looks good 13:20:17 [TWiSTED]: lines and unlines are good 13:20:33 <[TWiSTED]> yea ive used lines 13:20:46 ?type System.IO.getLine 13:20:48 IO String 13:21:18 [TWiSTED]: and interact is good if you want stdin&stdout 13:21:28 <[TWiSTED]> ah ok 13:21:53 augustss: I think he wants mapM_ on the readDirectory paths 13:22:45 mrd: Seems to work here. 13:23:04 wli: can you count on the 'inode' behavior portably? 13:23:13 xerox: I just heard the part where he wanted something like grep 13:23:19 mrd: On UNIX and UNIX-like systems, yes. 13:23:34 mrd: I've no idea about Windows or VMS vfs semantics. 13:23:37 @where ffi 13:23:37 http://www.cse.unsw.edu.au/~chak/haskell/ffi/ 13:24:10 mrd: I think it should really be folded into writeFile; people shoot themselves in the foot with this sort of thing all the time. 13:24:29 feature request? 13:24:39 mrd: Yeah, sounds like the right category. 13:25:41 Shurique pasted "(no title)" at http://hpaste.org/2478 13:25:47 this is always returning "", and I can't seem to figure out why 13:27:14 Shurique: hGetContents, like readFile, uses lazy I/O

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