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