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:13 | <Randroid> | I'm definitely a _|_ man. |
| 00:00:14 | <Randroid> | Don't know about pp, though. |
| 00:00:16 | <fasta> | Why is it that everytime I try to build something, GHC breaks? |
| 00:00:27 | <Randroid> | fasta: I've never had that problem. |
| 00:00:43 | <Randroid> | Type errors of all kinds, yes, but I've never broken GHC. |
| 00:00:46 | <fasta> | Randroid: that's probably because you don't use extensions. |
| 00:01:03 | <fasta> | Randroid: I lost count, I think I am at about 50. |
| 00:01:09 | <Randroid> | Wow. |
| 00:01:46 | <Randroid> | Most of my errors can be fixed by -fallow-overlapping-instances and such. |
| 00:01:59 | <Randroid> | Simple stuff. |
| 00:02:11 | <fasta> | Randroid: I am talking about panics. |
| 00:02:13 | <dmwit> | fasta: 50 extensions? |
| 00:02:31 | <fasta> | dmwit: 50 different GHC panics/crashes. |
| 00:02:34 | <Randroid> | fasta: I know. I'm saying I don't get them, and the worst I get are simple compilation errors. |
| 00:02:36 | <dmwit> | aha |
| 00:03:28 | <dibblego> | is there a function : (Monad m) => m [a] -> [m a] ? |
| 00:03:39 | <fasta> | @src read |
| 00:03:40 | <lambdabot> | read s = either error id (readEither s) |
| 00:03:45 | <fasta> | @src readEither |
| 00:03:46 | <lambdabot> | Source not found. Sorry about this, I know it's a bit silly. |
| 00:03:53 | <fasta> | Yes, it is. |
| 00:04:32 | <dmwit> | dibblego: Sounds like that would be a way to escape the monad...? |
| 00:04:49 | <dibblego> | dmwit, yeah I got it wrong anyway (I don't want that function) |
| 00:04:56 | <dmwit> | ok =) |
| 00:05:40 | <dibblego> | I just wanted fmap :) |
| 00:06:56 | <dibblego> | ?hoogle (Functor f) => (a -> IO ()) -> f a -> IO () |
| 00:06:56 | <lambdabot> | No matches, try a more general search |
| 00:07:13 | <mrd> | ?type flip bind |
| 00:07:18 | <mrd> | ?type flip (>>=) |
| 00:07:19 | <lambdabot> | Not in scope: `bind' |
| 00:07:20 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => (a -> m b) -> m a -> m b |
| 00:07:24 | <dibblego> | of course, cheers |
| 00:07:32 | <dmwit> | ?hoogle (MonadIO m) => (a -> m ()) -> m a -> IO () |
| 00:07:33 | <lambdabot> | No matches, try a more general search |
| 00:07:35 | <sorear> | dibblego: That function is in general impossible, you may be looking for Data.Foldable.mapM_ |
| 00:07:46 | <sorear> | dibblego: e.g. consider f = (Double ->) |
| 00:07:54 | <sorear> | @ty Data.Foldable.mapM_ |
| 00:07:56 | <lambdabot> | forall a (m :: * -> *) b (t :: * -> *). (Monad m, Data.Foldable.Foldable t) => (a -> m b) -> t a -> m () |
| 00:08:01 | <dibblego> | sorear, agreed |
| 00:08:20 | <shachaf> | sorear: < dibblego> dmwit, yeah I got it wrong anyway (I don't want that function) |
| 00:08:38 | <dibblego> | shachaf, I keep screwing up! |
| 00:09:11 | <fasta> | > read ""::Int |
| 00:09:13 | <lambdabot> | Exception: Prelude.read: no parse |
| 00:09:28 | <fasta> | Ok, good I found the bug now. |
| 00:09:37 | <shachaf> | > read "" :: () |
| 00:09:39 | <lambdabot> | Exception: Prelude.read: no parse |
| 00:09:41 | <dmwit> | > read "" |
| 00:09:43 | <lambdabot> | Exception: Prelude.read: no parse |
| 00:09:51 | <fasta> | GHC panics when you define a command that should take an argument, but don't give it. |
| 00:10:06 | <shachaf> | read defaults to Integer on lambdabot, right? |
| 00:10:13 | <fasta> | So, it's a minor issue, but still should never happen. |
| 00:10:26 | <fasta> | At least, that's what I think it is. |
| 00:10:29 | <fasta> | Verifying it now |
| 00:10:57 | <dmwit> | > let argumentless :: Int; argumentless x = 3 in argumentless 5 |
| 00:10:58 | <lambdabot> | Couldn't match expected type `t1 -> t' against inferred type `Int' |
| 00:11:05 | <dmwit> | > let argumentless :: Int; argumentless x = 3 in argumentless |
| 00:11:06 | <lambdabot> | The equation(s) for `argumentless' have one argument, |
| 00:11:06 | <lambdabot> | but its type `... |
| 00:11:30 | <dmwit> | > let argumentless :: Int -> Int; argumentless = 3 in argumentless |
| 00:11:31 | <lambdabot> | add an instance declaration for (Num (Int -> Int)) |
| 00:11:31 | <lambdabot> | In the expression: 3... |
| 00:12:06 | <fasta> | Hmm, it is somewhat more complicated.. |
| 00:12:55 | <fasta> | Does lambdabot also do the :def command? |
| 00:13:02 | <sorear> | no. |
| 00:13:13 | <fasta> | Too bad, I could crash it easily. |
| 00:13:21 | <fasta> | :def foof (\a -> let z = read a::Int in return (show z)) |
| 00:13:24 | <fasta> | :foof |
| 00:13:33 | <fasta> | That will crash your favorite new GHC. |
| 00:14:00 | <dmwit> | I just get an exception. |
| 00:14:10 | <fasta> | dmwit: what version? |
| 00:14:20 | <dmwit> | 6.6.1 |
| 00:14:39 | <fasta> | dmwit: is :def even implemented in 6.6.1? |
| 00:14:42 | <shachaf> | ":def foof (return . show . read)" is simpler. :-) |
| 00:14:47 | <dmwit> | It seems to be. |
| 00:15:02 | <sorear> | fasta: of course GHC crashes |
| 00:15:11 | <Pseudonym> | > let argumentless :: Int -> Int; argumentless x = 3 in argumentless 5 |
| 00:15:12 | <lambdabot> | 3 |
| 00:15:16 | <sorear> | fasta: you just injected a bug! |
| 00:15:26 | <fasta> | sorear: I know I miss an argument |
| 00:15:33 | <fasta> | sorear: that's no reason for panic |
| 00:15:49 | <Olathe> | ACTION panics for no reason. |
| 00:15:51 | <sorear> | fasta: yes it is, 'panic' means there was an exception in code called by GHC |
| 00:16:00 | <Pseudonym> | Don't Panic. |
| 00:16:00 | <shachaf> | :def foof (return . undefined) |
| 00:16:02 | <sorear> | fasta: which fits your situation perfectly |
| 00:16:03 | <Pseudonym> | X <- You are here. |
| 00:16:24 | <dmwit> | :def foof undefined |
| 00:16:25 | <hpaste> | mycatverbs pasted "trivial uniq example" at http://hpaste.org/3188 |
| 00:16:35 | <fasta> | sorear: well, then maybe it should know when it is executing user code? |
| 00:17:04 | <fasta> | sorear: and then throw a "you suck"-exception? |
| 00:17:17 | <shachaf> | MyCatVerbs: How about: interact $ unlines . nub . lines |
| 00:17:17 | <fasta> | Or a more nice message, of course. |
| 00:17:20 | <hpaste> | Pseudonym annotated "trivial uniq example" with "(no title)" at http://hpaste.org/3188#a1 |
| 00:17:46 | <hpaste> | dmwit annotated "trivial uniq example" with "shorter?" at http://hpaste.org/3188#a2 |
| 00:17:49 | <MyCatVerbs> | shachaf: that's what I'd do in ghc -e, but I wanted to demonstrate IO. |
| 00:18:01 | <shachaf> | Or what Pseudonym said, if you don't want interact. |
| 00:18:41 | <fasta> | sorear: :def foof undefined does not make GHC manic. |
| 00:18:47 | <fasta> | panic* |
| 00:18:58 | <fasta> | sorear: so, those cases are not the same. |
| 00:19:05 | <hpaste> | Pseudonym annotated "trivial uniq example" with "(no title)" at http://hpaste.org/3188#a3 |
| 00:19:30 | <shachaf> | fasta: :def foof return . undefined does. |
| 00:19:33 | <Pseudonym> | And, of course, there's no reason for handle I/O in this trivial example. |
| 00:19:52 | <vincenz> | even better |
| 00:19:53 | <Pseudonym> | But I'm going with the flow. |
| 00:20:06 | <fasta> | shachaf: indeed, it does here too. |
| 00:20:11 | <hpaste> | vincenz annotated "trivial uniq example" with "even nicer" at http://hpaste.org/3188#a4 |
| 00:20:44 | <shachaf> | Hmm, this doesn't happen in 6.6.1. |
| 00:21:13 | <vincenz> | damn, forgot to remove hPutstr |
| 00:21:16 | <vincenz> | and replace by simple putStr |
| 00:21:39 | <dmwit> | We are now ready to thoroughly confuse whoever MyCatVerbs was trying to teach about IO. =D |
| 00:22:01 | <vincenz> | suffice to say |
| 00:22:02 | <vincenz> | nub is bad |
| 00:22:05 | <vincenz> | it's O(n^2) |
| 00:22:28 | <shachaf> | Pseudonym: Also, this doesn't behave like the UNIX uniq. |
| 00:22:36 | <shachaf> | s/Pseudonym/MyCatVerbs/ |
| 00:22:38 | <hpaste> | vincenz annotated "trivial uniq example" with "better" at http://hpaste.org/3188#a5 |
| 00:22:39 | <Pseudonym> | Yeah, for that you want noDups. |
| 00:23:21 | <shachaf> | noDups? |
| 00:23:25 | <Pseudonym> | Which, I note, isn't in Data.List. |
| 00:23:37 | <Pseudonym> | noDups (x1:x2:xs) | x1 == x2 = noDups x2:xs |
| 00:23:43 | <Pseudonym> | noDups (x:xs) = x : noDups xs |
| 00:23:46 | <Pseudonym> | noDups [] = [] |
| 00:23:51 | <vincenz> | Pseudonym: so it's only local |
| 00:24:13 | <shachaf> | > map head . group $ [1,2,3,3,2,4,1] |
| 00:24:14 | <lambdabot> | [1,2,3,2,4,1] |
| 00:24:17 | <shachaf> | Maybe? |
| 00:24:18 | <Pseudonym> | Left out some parens on that first rule. |
| 00:24:28 | <Pseudonym> | @let noDups (x1:x2:xs) | x1 == x2 = noDups (x2:xs) |
| 00:24:32 | <Pseudonym> | @let noDups (x:xs) = x : noDups xs |
| 00:24:34 | <lambdabot> | Defined. |
| 00:24:36 | <lambdabot> | Defined. |
| 00:24:36 | <Pseudonym> | @let noDups [] = [] |
| 00:24:39 | <lambdabot> | Defined. |
| 00:24:44 | <Pseudonym> | > noDups [1,2,3,3,2,4,1] |
| 00:24:45 | <lambdabot> | [1,2,3,2,4,1] |
| 00:24:45 | <vincenz> | > noDups [1,2,2,3,2,4,4,] |
| 00:24:46 | <lambdabot> | Parse error |
| 00:24:46 | <vincenz> | > noDups [1,2,2,3,2,4,4,1] |
| 00:24:48 | <lambdabot> | [1,2,3,2,4,1] |
| 00:25:07 | <vincenz> | ACTION wishes there were a 2 element foldr |
| 00:25:14 | <dmwit> | shachaf: I like your version better. =) |
| 00:25:23 | <dmwit> | vincenz: foldr + zip? |
| 00:25:37 | <Pseudonym> | Sachaf's version has the advantage that it gets deforested/stream fused/whatever. |
| 00:25:38 | <shachaf> | dmwit: No, two elements from the same list (I assume). |
| 00:25:40 | <vincenz> | dmwit: no, foldr down 1 list |
| 00:25:49 | <Pseudonym> | shachaf |
| 00:25:49 | <vincenz> | sur, I could foldr . zip l (tail l) |
| 00:25:50 | <stepcut> | vincenz: foldr . uncurry ? |
| 00:25:51 | <vincenz> | but that sounds nasty |
| 00:26:06 | <Pseudonym> | Oh, nice idea! |
| 00:26:12 | <dmwit> | vincenz: That's what I meant. |
| 00:26:15 | <vincenz> | especially since it fails on one element lists |
| 00:26:25 | <vincenz> | > let l = [1] in zip l (tail l) |
| 00:26:27 | <lambdabot> | [] |
| 00:26:30 | <stepcut> | oh. yeah a two element foldr would be nice |
| 00:26:32 | <shachaf> | use drop 1 instead of tail. |
| 00:26:39 | <vincenz> | that's exactly the same |
| 00:26:44 | <vincenz> | you don't get a last tuple is my point |
| 00:26:48 | <dmwit> | vincenz: But... what would you prefer as behavior for 1-element lists? |
| 00:26:50 | <stepcut> | foldr with lookahead |
| 00:26:59 | <vincenz> | dmwit: a finial case of course |
| 00:27:07 | <Pseudonym> | > map snd . filter (not . (==)) . ap zip id tail $ [1,2,2,3,2,4,4,1] |
| 00:27:08 | <lambdabot> | Couldn't match expected type `Bool' |
| 00:27:13 | <vincenz> | just like foldr expects something to be done on empty lists (z), you want something for 1 element lists (f) |
| 00:27:19 | <vincenz> | and then something for whenever you have 2 elements (g) |
| 00:27:21 | <Pseudonym> | > map snd . filter (not . uncurry (==)) . ap zip id tail $ [1,2,2,3,2,4,4,1] |
| 00:27:22 | <lambdabot> | Couldn't match expected type `a -> [(a1, a1)]' |
| 00:27:26 | <Randroid> | Recently I've been showing Haskell to a colleague of mine, who was intrigued but described it as too clever for its own good. According to him, it will never catch on because your average corporate programmer will never get it. However, I imagine the same was said about object-oriented languages when they first debuted. |
| 00:27:32 | <Randroid> | (I realize functional languages are even older.) |
| 00:27:40 | <shachaf> | > ap zip tail [1,2,3] |
| 00:27:41 | <lambdabot> | [(1,2),(2,3)] |
| 00:27:47 | <shachaf> | Maybe? |
| 00:27:53 | <Pseudonym> | ?pl \ (x,y) -> not (x == y) |
| 00:27:53 | <lambdabot> | uncurry (/=) |
| 00:27:59 | <ddarius> | Randroid: And the average corporate programmer still doesn't get OO |
| 00:27:59 | <vincenz> | > ap zip tail [1] |
| 00:28:01 | <lambdabot> | [] |
| 00:28:02 | <Pseudonym> | > map snd . filter (uncurry (/=)) . ap zip id tail $ [1,2,2,3,2,4,4,1] |
| 00:28:03 | <lambdabot> | Couldn't match expected type `a -> [(a1, a1)]' |
| 00:28:15 | <Pseudonym> | ?pl \x -> zip x (tail x) |
| 00:28:15 | <lambdabot> | ap zip tail |
| 00:28:20 | <vincenz> | @let foldr2 z f g [] = z |
| 00:28:20 | <Pseudonym> | > map snd . filter (uncurry (/=)) . ap zip tail $ [1,2,2,3,2,4,4,1] |
| 00:28:22 | <lambdabot> | [2,3,2,4,1] |
| 00:28:26 | <lambdabot> | Defined. |
| 00:28:32 | <vincenz> | @let foldr2 z f g [a] = f a z |
| 00:28:33 | <Pseudonym> | Yeah, almost works, apart from the first element. |
| 00:28:36 | <lambdabot> | Defined. |
| 00:28:42 | <Pseudonym> | > map snd . filter (uncurry (/=)) . ap zip tail $ [1,1,2,2,3,2,4,4,1] |
| 00:28:43 | <lambdabot> | [2,3,2,4,1] |
| 00:28:52 | <vincenz> | @let foldr2 z f g (a:b:xs) = foldr 2 (g a b z) f g xs |
| 00:28:53 | <lambdabot> | Couldn't match expected type `[a]' |
| 00:29:03 | <Randroid> | ddarius: That's so true. I can't tell you how many times I've seen developers simply fail to use inheritance and polymorphism in a dirt-simple language like C#. |
| 00:29:05 | <vincenz> | @let foldr2 z f g (a:b:xs) = foldr2 (g a b z) f g xs |
| 00:29:09 | <lambdabot> | Defined. |
| 00:29:11 | <vincenz> | : foldr2 |
| 00:29:13 | <vincenz> | :t foldr2 |
| 00:29:15 | <lambdabot> | Not in scope: `foldr2' |
| 00:29:18 | <vincenz> | :t L.foldr2 |
| 00:29:19 | <lambdabot> | Couldn't find qualified module. |
| 00:29:22 | <vincenz> | ACTION mutters |
| 00:29:26 | <dmwit> | foil'd |
| 00:29:56 | <dmwit> | > typeOf foldl2 |
| 00:29:56 | <EvilTerran> | foil'dr2? |
| 00:29:57 | <lambdabot> | Not in scope: `foldl2' |
| 00:30:02 | <dmwit> | > typeOf foldr2 |
| 00:30:03 | <lambdabot> | Add a type signature |
| 00:30:09 | <vincenz> | @unlet |
| 00:30:09 | <dmwit> | > show (typeOf foldr2) |
| 00:30:11 | <lambdabot> | Add a type signature |
| 00:30:13 | <lambdabot> | Defined. |
| 00:30:15 | <vincenz> | @unlet foldr2 |
| 00:30:15 | <lambdabot> | Parse error |
| 00:30:17 | <shachaf> | @ty typeOf |
| 00:30:19 | <lambdabot> | forall a. (Typeable a) => a -> TypeRep |
| 00:30:20 | <vincenz> | there was an error in it |
| 00:30:35 | <vincenz> | @let foldr2 z f g [] = [] |
| 00:30:35 | <lambdabot> | <local>:9:0: Warning: Pattern match(es) are overlapped In th... |
| 00:30:38 | <EvilTerran> | there is no @unlet, only @undefine, which takes everything |
| 00:30:41 | <vincenz> | @unlet foldr2 |
| 00:30:42 | <lambdabot> | Parse error |
| 00:30:44 | <vincenz> | @undefine foldr2 |
| 00:30:46 | <lambdabot> | Undefined. |
| 00:30:50 | <vincenz> | @let foldr2 z f g [a] = [] |
| 00:30:52 | <lambdabot> | Defined. |
| 00:30:52 | <vincenz> | @forget foldr2? |
| 00:30:53 | <lambdabot> | Incorrect arguments to quote |
| 00:30:54 | <vincenz> | @undefine foldr2 |
| 00:30:56 | <lambdabot> | Undefined. |
| 00:30:59 | <EvilTerran> | it takes everything! it doesn't take a parameter, just resets the whole @let state |
| 00:31:29 | <vincenz> | @let foldr2 z f g [] = z; foldr2 z f g [a] = f a z; foldr2 z f g (a:b:xs) = foldr2 (g a b z) f g (b:xs) |
| 00:31:30 | <lambdabot> | Defined. |
| 00:31:33 | <Randroid> | ddarius: I think learning Haskell makes one a better programmer overall, though. I've found my day-to-day corporate code, mostly written in Ruby or C#, has tightened up a bit. |
| 00:31:53 | <ddarius> | Randroid: I agree. |
| 00:31:53 | <vincenz> | > foldr2 [] (:) (\a b l -> if a == b then l else a:l) [1,2,2,3,4,2,1] |
| 00:31:55 | <lambdabot> | [1,2,4,3,2,1] |
| 00:31:58 | <vincenz> | there w go |
| 00:32:06 | <dmwit> | Except the answer is wrong. |
| 00:32:13 | <Tac-Tics> | @src foldl2 |
| 00:32:13 | <lambdabot> | Source not found. Take a stress pill and think things over. |
| 00:32:21 | <dmwit> | Oh, it's backwards. |
| 00:32:23 | <vincenz> | right, I oughta do this in vim instead of irc |
| 00:32:24 | <dmwit> | That's okay. |
| 00:32:34 | <vincenz> | it's foldr, not foldl :) |
| 00:32:44 | <Tac-Tics> | @src foldr2 |
| 00:32:44 | <lambdabot> | Source not found. Take a stress pill and think things over. |
| 00:32:46 | <vincenz> | > foldr [] (:) [1..10] |
| 00:32:47 | <lambdabot> | Couldn't match expected type `a -> b -> b' |
| 00:32:54 | <vincenz> | > foldr [] (flip (:)) [1..10] |
| 00:32:55 | <LoganCapaldo> | but vim doesn't talk back |
| 00:32:55 | <lambdabot> | Couldn't match expected type `a -> b -> b' |
| 00:32:58 | <vincenz> | meh |
| 00:32:58 | <dmwit> | Tac-Tics: It was ?let a little bit up, scroll back and you'll see it. |
| 00:33:00 | <vincenz> | ok, emacs then |
| 00:34:29 | <fasta> | I am stepping through the code at the speed of snails. |
| 00:35:06 | <LoganCapaldo> | snails...on speed? |
| 00:35:17 | <fasta> | A few hundred a second I guess. |
| 00:35:37 | <fasta> | But since the code normally executes at probably millions of steps a second... |
| 00:36:06 | <dmwit> | step fasta! |
| 00:36:11 | <dmwit> | Sorry, couldn't resist. |
| 00:36:18 | <LoganCapaldo> | lol |
| 00:36:49 | <fasta> | If I was just born a few millenia later, I could ignore more constant factors.. |
| 00:37:30 | <ddarius> | fasta: Well, you were born with a constant factor of that time. |
| 00:39:29 | <Cale> | LoganCapaldo: It was sort of a haha-only-serious thing. |
| 00:41:03 | <Cale> | LoganCapaldo: I was pointing out another good approach while mocking their hard-line take on TDD. |
| 00:45:44 | <halcyon10> | i just used parsec the first time. Man, i didn't know parsing is soo much fun :) |
| 00:45:56 | <stepcut> | halcyon10: haha |
| 00:46:19 | <LoganCapaldo> | Cale: that's what i thought but it was so well executed I couldn't tell if it was a _complete_ joke or if you were also throwing in some proof advocacy while you were at it |
| 00:47:37 | <dibblego> | can you open a file for write, but create it and its parent directories if it doesn't exist? |
| 00:48:08 | <Cale> | There might be something in the filepath module for that. |
| 00:48:18 | <dibblego> | I've been looking for it |
| 00:48:21 | <Cale> | But I don't think it's in System.Directory directly. |
| 00:48:45 | <dibblego> | there is createDirectoryIfMissing; I could putsomething together with that |
| 00:50:00 | <halcyon10> | :r |
| 00:50:20 | <halcyon10> | *doh* |
| 00:50:44 | <vwx> | Cale: what comment are you talking about? |
| 00:50:57 | <Cale> | http://programming.reddit.com/info/2y9jb/comments/c2yce9 |
| 00:50:58 | <lambdabot> | Title: Testing Misconceptions #1: Exploratory Programming (a response to redditors and ... |
| 00:51:06 | <Cale> | It parodies the article that it's attached to. |
| 00:51:28 | <Cale> | I basically replaced "unit testing" with "identifying and proving algebraic properties" |
| 00:51:33 | <SamB_XP> | a stress pill? |
| 00:51:40 | <SamB_XP> | lambdabot: you must be kidding! |
| 00:53:23 | <vwx> | Cale: do you personally ever use unit testing? |
| 00:53:39 | <Cale> | Somewhat. |
| 00:53:45 | <Cale> | I've used quickcheck. |
| 00:53:57 | <Tac-Tics> | @src List.(>>=) |
| 00:53:57 | <lambdabot> | Source not found. stty: unknown mode: doofus |
| 00:54:10 | <dibblego> | quickcheck is haddock on steroids |
| 00:54:12 | <Cale> | Most of the time I really do informally prove things in my head. |
| 00:54:38 | <dibblego> | expressing algebraic properties > writing them in English |
| 00:55:46 | <augustss> | dons talk at the Haskell WS about xmonad and property driven development was excellent |
| 00:56:41 | <vwx> | augustss: is there a video online? |
| 00:56:51 | <augustss> | I don't know |
| 00:56:52 | <Cale> | http://www.ludd.ltu.se/~pj/hw2007/HaskellWorkshop.html |
| 00:56:52 | <lambdabot> | Title: Haskell Workshop 2007 - List of Accepted Papers |
| 00:56:54 | <Cale> | yes |
| 00:57:25 | <Cale> | There are links there to all the Haskell Workshop talks. I've been watching them on and off all day :) |
| 00:57:31 | <augustss> | yes, there seems to be :) |
| 00:57:34 | <vwx> | wow super sweet |
| 00:58:11 | <augustss> | Cale: did you see my 50 year retrospective? |
| 00:58:34 | <Cale> | Not yet, which one is that in? |
| 00:58:50 | <augustss> | It's a 3 minute intro to the discussion |
| 00:58:55 | <Cale> | ah, cool |
| 00:59:06 | <augustss> | I mention that 1.3 was the last sane versio |
| 00:59:10 | <Cale> | heh |
| 00:59:13 | <sjanssen> | ooh, discussion |
| 00:59:17 | <sjanssen> | I bet that's the most interesting one |
| 00:59:24 | <user317> | hmm anyone know if netbsd linker supports -rpath=\$$ORIGIN ? readelf -d shows that the RPATH is in the binary like on linux, but it doesn't seem to do anything |
| 00:59:26 | <augustss> | well, according to Aione in 2035 |
| 00:59:37 | <Cale> | augustss: What do you think was the problem with 1.4? |
| 01:00:27 | <augustss> | Maybe I meant 1.4. I didn't have any internet connection when i prepared the slide |
| 01:00:44 | <augustss> | and it was )):30 after 5 beers |
| 01:00:47 | <augustss> | 00:30 |
| 01:01:08 | <Cale> | hehe :) |
| 01:05:42 | <hpaste> | dataangel pasted "more newb compile problems :P" at http://hpaste.org/3189 |
| 01:05:43 | <vwx> | any ideas how to make an inverse of this function? http://hpaste.org/3187 |
| 01:06:31 | <dataangel> | Anyone help with a newb compile problem? http://hpaste.org/3189 |
| 01:06:42 | <sjanssen> | dataangel: min (x, y) is a problem |
| 01:06:45 | <Cale> | dataangel: min(n,length board - 1) :: (Int, Int) -> (Int, Int) |
| 01:06:52 | <Cale> | It's partially applied to a pair. |
| 01:06:54 | <sjanssen> | dataangel: min x y -- is what you want |
| 01:06:55 | <dataangel> | oh @_@ |
| 01:07:07 | <dataangel> | blinded by years of C++ |
| 01:07:13 | <augustss> | vwx: you can do it with decodeFloat |
| 01:07:30 | <sorear> | vwx: deconFloat (F# f#) = Word32# (unsafeCoerce# f#) |
| 01:07:37 | <Cale> | Yeah, there's encodeFloat and decodeFloat |
| 01:07:58 | <vwx> | i couldn't figure out how to tell how many bits the mantissa has with decodeFloat |
| 01:08:07 | <sorear> | W32# rather |
| 01:08:14 | <augustss> | vwx: you'd have to know |
| 01:08:29 | <sorear> | vwx: you don't need to know |
| 01:08:34 | <sorear> | > decodeFloat 1.5 |
| 01:08:36 | <lambdabot> | (6755399441055744,-52) |
| 01:08:41 | <sorear> | see that -52? |
| 01:08:56 | <sorear> | > let (a,b) = decodeFloat 1.5 in a * 2^b |
| 01:08:57 | <lambdabot> | Exception: Prelude.^: negative exponent |
| 01:08:59 | <augustss> | vwx: you can figure out the number of bits with some of the other operations of floats |
| 01:09:00 | <sorear> | > let (a,b) = decodeFloat 1.5 in a * 2^^b |
| 01:09:01 | <lambdabot> | add an instance declaration for (Fractional Integer) |
| 01:09:06 | <Cale> | ** |
| 01:09:10 | <sorear> | > let (a,b) = decodeFloat 1.5 in fromInteger a * 2^^b |
| 01:09:11 | <lambdabot> | 1.5 |
| 01:09:31 | <vwx> | @type (^^) |
| 01:09:34 | <lambdabot> | forall a b. (Integral b, Fractional a) => a -> b -> a |
| 01:09:45 | <augustss> | :i RealFloat |
| 01:09:59 | <Cale> | er, yeah, not ** :) |
| 01:10:32 | <Cale> | I really liked SPJ's response to Harpy :) |
| 01:10:34 | <augustss> | vwx: floatRadix, floatDigits, and FloatRange help |
| 01:10:46 | <augustss> | but in the end, they don't give you the layout |
| 01:11:00 | <Cale> | (At least, I'm pretty sure that was SPJ's voice :) |
| 01:11:16 | <augustss> | vwx: if you really want the sequence of bytes, I'd just do some horrible thing with a memory buffer |
| 01:12:18 | <vwx> | augustss: but is Float guaranteed to always have the same representation on all haskell systems? and even if yes then there is still the need to deal with endian issues |
| 01:12:38 | <Cale> | vwx: No, but decodeFloat always has to produce the same thing. |
| 01:12:49 | <Cale> | (or equivalent things) |
| 01:13:31 | <augustss> | vwx: it's not guaranteed in the standard, but it is in practice |
| 01:13:31 | <halcyon10> | what unary function always returns the empty list? |
| 01:13:49 | <augustss> | halcyon10: const [] |
| 01:13:57 | <halcyon10> | ah thanks! |
| 01:14:47 | <vwx> | is there a remote possibility that floatRadix will not be 2? |
| 01:15:13 | <dataangel> | if you have a list of lists, is indexing an element: mylist !! x !! y, or is there a better idiom? |
| 01:15:57 | <augustss> | vwx: there's a remote one. IBM360/370 would have 16 |
| 01:16:02 | <chessguy> | @type (!! 1 !! 1) |
| 01:16:04 | <lambdabot> | The operator `!!' [infixl 9] of a section |
| 01:16:04 | <lambdabot> | must have lower precedence than the operand `(!!)' [infixl 9] |
| 01:16:25 | <vwx> | augustss: is there a haskell system for that computer? |
| 01:16:29 | <dataangel> | chessguy: I have no idea what that means |
| 01:16:39 | <chessguy> | @type ((!! 1) . (!! 1)) |
| 01:16:40 | <lambdabot> | forall a. [[a]] -> a |
| 01:16:46 | <augustss> | vwx: I'm sure Hugs could be made to run |
| 01:17:02 | <dataangel> | ah that makes sense |
| 01:17:06 | <augustss> | vwx: I've implemented arbitrary precision floats where I used 10 as a base |
| 01:17:32 | <chessguy> | @pl \xys x y -> ((xys !! x) !! y) |
| 01:17:32 | <lambdabot> | ((!!) .) . (!!) |
| 01:17:57 | <chessguy> | @pl \x y xys -> ((xys !! x) !! y) |
| 01:17:57 | <lambdabot> | flip . ((!!) .) . flip (!!) |
| 01:18:05 | <vwx> | does CLDouble have the same representation of Double? |
| 01:18:12 | <chessguy> | lots of ways to do it :) |
| 01:19:05 | <sjanssen> | vwx: on my system, yes |
| 01:19:18 | <sjanssen> | vwx: try :info CLDouble in ghci |
| 01:20:10 | <vwx> | sjanssen. yes. so if i copy a "long double" from c into haskell and then back into c, i will lose precision? |
| 01:20:39 | <sjanssen> | vwx: CLDouble should be the same as C's 'long double' |
| 01:20:52 | <sjanssen> | that's the entire purpose to the Cfoo types |
| 01:21:22 | <vwx> | hm... so haskell Double is actually c "long double" and not "double" ? |
| 01:22:09 | <sjanssen> | there are no guarantees on the relation of Foo to CFoo types |
| 01:22:21 | <vwx> | > sizeOf (1 :: Float) |
| 01:22:23 | <lambdabot> | Not in scope: `sizeOf' |
| 01:22:48 | <sjanssen> | on my particular platform, Double, CDouble and CLDouble happen to be the same |
| 01:23:24 | <vwx> | sjanssen: yes. this means that precision must be lost when a c "long double" (which is 10 bytes for 8 bytes for CLDouble) passes from c to haskell and back to c |
| 01:23:59 | <sjanssen> | GHC must be wrong, then |
| 01:24:11 | <sjanssen> | CLDouble *should* be the same as a 'long double' |
| 01:25:36 | <vwx> | maybe a LongDouble type should be added to haskell? |
| 01:27:38 | <sjanssen> | vwx: this is probably worth a bug report or email to the glasgow-haskell-users mailing list |
| 01:27:58 | <vwx> | surely they are already aware of this issue |
| 01:28:40 | <sjanssen> | vwx: it should at least be documented |
| 01:28:54 | <Pseudonym> | "LongDouble" is different on different platforms. |
| 01:29:03 | <Pseudonym> | It's 128 bit on Sparc, 80 bit on x86. |
| 01:29:16 | <Pseudonym> | And moreover, on Sparc it's software-emulated. |
| 01:34:05 | <dibblego> | ?type isSuffixOf |
| 01:34:13 | <lambdabot> | forall a. (Eq a) => [a] -> [a] -> Bool |
| 01:35:12 | <dataangel> | Is there a way to pass the elements of a tuple as the parameters of a function without writing them out? Like apply. |
| 01:35:29 | <dataangel> | in python you can write f(*[3, 4, 5]) and it's the same as writing f(3, 4, 5) |
| 01:36:06 | <sjanssen> | dataangel: you can use uncurry for 2-tuples |
| 01:36:59 | <dataangel> | sjanssen: that's good enough for now but why aren't their n-ary versions? |
| 01:37:04 | <dataangel> | *there |
| 01:38:43 | <sjanssen> | dataangel: Haskell doesn't provide any generic programming for tuples |
| 01:39:42 | <dons> | its just so rarely needed, you use lists and algebraic types instead |
| 01:39:50 | <dons> | particularly the latter |
| 01:40:40 | <dibblego> | is there a library to recurse down a directory, returning all filepaths? |
| 01:40:46 | <sjanssen> | dataangel: usually 3-tuples or larger are the wrong thing, anyway |
| 01:41:29 | <dons> | dibblego: yeah, bos wrote a lib for this. check hackage |
| 01:41:33 | <dons> | FileSomething |
| 01:41:36 | <dibblego> | thanks |
| 01:41:42 | <dons> | though its fun to write yourself |
| 01:41:59 | <dibblego> | FileManip? |
| 01:42:12 | <dibblego> | yeah I've written it; I just hate writing it twice :) |
| 01:42:34 | <dons> | FileManip, yeah |
| 01:46:14 | <sjanssen> | why are some packages missing haddocks on hackage? |
| 01:51:30 | <dibblego> | that library is very well written |
| 01:51:53 | <dibblego> | I wish the core of Haskell was like that |
| 01:52:10 | <dons> | sjanssen: some didn't generate |
| 01:52:15 | <dibblego> | ?type find |
| 01:52:17 | <lambdabot> | forall a. (a -> Bool) -> [a] -> Maybe a |
| 01:52:27 | <sjanssen> | dons: I'm especially curious why X11-extras doesn't have haddocks |
| 01:52:38 | <dons> | oh, might not have been regenerated |
| 01:52:41 | <dons> | check an older version |
| 01:53:16 | <sjanssen> | 0.2 has haddocks |
| 01:54:12 | <sjanssen> | dons: so, are these manually generated every month or something? |
| 01:54:17 | <dons> | something like that |
| 01:54:22 | <dons> | a cronjob seems like a good idea. |
| 01:54:28 | <dons> | or some on-demand script |
| 01:54:34 | <sjanssen> | X11-extras 0.3 has been on hackage for a very long time |
| 01:54:43 | <dons> | did we check it works ? |
| 01:54:59 | <sjanssen> | 'Setup haddock' works on my machine |
| 01:56:34 | <dibblego> | is the ap function named after applicative (function application in a monad) and not its similarity to fmap? |
| 01:58:00 | <sjanssen> | dibblego: after 'apply', I think |
| 01:58:08 | <dibblego> | ah ok cheers |
| 01:58:49 | <dibblego> | ?hoogle (Monad m) => (a -> b) -> m [a] -> m [b] |
| 01:58:50 | <lambdabot> | No matches, try a more general search |
| 02:04:56 | <byorgey> | @type liftM . fmap |
| 02:05:02 | <lambdabot> | forall (m :: * -> *) a b (f :: * -> *). (Monad m, Functor f) => (a -> b) -> m (f a) -> m (f b) |
| 02:05:05 | <byorgey> | erm |
| 02:05:07 | <byorgey> | @type liftM . map |
| 02:05:09 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => (a -> b) -> m [a] -> m [b] |
| 02:05:21 | <byorgey> | dibblego: ^^ |
| 02:05:29 | <dibblego> | ta |
| 02:10:36 | <falconair_> | I noticed that there was some talk of a library to communicate with erlang's binary protocol...is there actual work being done on it? |
| 02:11:22 | <dibblego> | ?type fmap . map |
| 02:11:24 | <lambdabot> | forall (f :: * -> *) a b. (Functor f) => (a -> b) -> f [a] -> f [b] |
| 02:19:35 | <hpaste> | Gwern pasted "xmonad build error" at http://hpaste.org/3190 |
| 02:25:25 | <iank> | <3 xmonad |
| 02:25:57 | <dons> | iank: :) |
| 02:25:57 | <dibblego> | ?hoogle (Functor f) => (a -> f b) -> [a] -> f [b] |
| 02:25:58 | <lambdabot> | No matches, try a more general search |
| 02:26:07 | <dons> | iank: you should join #xmonad :) |
| 02:27:09 | <dibblego> | why do people use liftM all the time when fmap will do? |
| 02:27:38 | <dons> | it can be more intuitive |
| 02:27:43 | <dons> | liftM (+) |
| 02:27:46 | <dons> | versus fmap (+) |
| 02:28:25 | <Korollary> | Are there any ICFP videos? |
| 02:29:49 | <ChilliX> | Korollary: everything was filmed, but it may take a while to psot-process |
| 02:30:23 | <ChilliX> | *post |
| 02:31:10 | <sjanssen> | Korollary: http://www.ludd.ltu.se/~pj/hw2007/HaskellWorkshop.html |
| 02:31:10 | <lambdabot> | Title: Haskell Workshop 2007 - List of Accepted Papers |
| 02:31:32 | <dibblego> | ?hoogle (a -> IO b) -> [a] -> IO [b] |
| 02:31:33 | <lambdabot> | No matches, try a more general search |
| 02:31:35 | <dons> | everything was filmed for the ACM library, so we'll probably never see it again... |
| 02:31:49 | <dons> | it won't be freely available, I guess? |
| 02:33:25 | <falconair_> | aren't these the ones: http://www.ludd.ltu.se/~pj/hw2007/HaskellWorkshop.html |
| 02:33:26 | <lambdabot> | Title: Haskell Workshop 2007 - List of Accepted Papers |
| 02:33:28 | <ChilliX> | dons: Are you sure that was meant to be exclusive> |
| 02:33:30 | <ChilliX> | ? |
| 02:33:45 | <ChilliX> | I thought its justa way of archiving it |
| 02:34:13 | <dibblego> | I'm having trouble thinking about how I'd write this function; is it even possible? (a -> IO b) -> [a] -> IO [b] |
| 02:34:32 | <dons> | ChilliX: hmm, well malcolm recorded his own versions. it was only rumour that it was exclusive. it was definitely stated it was for the digital library |
| 02:34:40 | <dons> | which usually means its non-free, doesn't it? |
| 02:34:46 | <sorear> | dibblego: mapM |
| 02:34:57 | <ChilliX> | dons: But it wasn't on the initiative of the ACM |
| 02:34:59 | <dibblego> | oh |
| 02:35:01 | <dibblego> | ?type mapM |
| 02:35:03 | <lambdabot> | forall a (m :: * -> *) b. (Monad m) => (a -> m b) -> [a] -> m [b] |
| 02:35:07 | <dibblego> | cheers :) |
| 02:35:13 | <ChilliX> | we should ask stefan |
| 02:35:23 | <dons> | ah yes, i saw him changing tapes |
| 02:35:24 | <sorear> | which one? |
| 02:35:31 | <ChilliX> | sorear: stefan wehr :) |
| 02:35:32 | <dons> | so maybe the rumours were misguided. |
| 02:35:41 | <dons> | sorear: unless you know the answer? :) |
| 02:35:47 | <FMota_> | ACTION wonders |
| 02:36:04 | <FMota_> | would you have a turing machine if you had a scanner, a printer, and infinite amounts of paper? |
| 02:36:04 | <ChilliX> | dons: it is supposed to go into the DL; it's just that I assumed it not to be exclusive |
| 02:36:05 | <FMota_> | :o |
| 02:36:19 | <ddarius> | FMota_: Not without some logic. |
| 02:36:23 | <dons> | i'd hope its non-exclusive, if ACM didn't do the work |
| 02:36:44 | <sorear> | FMota_: You'd also need to find some way to stop the paper from collapsing into a black hole |
| 02:36:49 | <FMota_> | ddarius: the logic is already there. |
| 02:37:01 | <FMota_> | sorear: smart-ass. |
| 02:37:07 | <FMota_> | ;) |
| 02:37:17 | <ddarius> | sorear: Just do the same thing Turing did with his tape. |
| 02:37:19 | <sorear> | FMota_: in general, the maximum amount of matter in a spherical region of space is proportional to the *radius*, not the volume |
| 02:37:31 | <SamB_XP> | dons: pirate pirate! |
| 02:37:53 | <FMota_> | :o |
| 02:38:11 | <_achilles_> | is there a way to cast a type in a where/let? |
| 02:38:13 | <FMota_> | hey, it's proportional to the circumference too! ;o |
| 02:40:05 | <_achilles_> | ? |
| 02:40:06 | <LoganCapaldo> | _achilles_: you mean add type annotations? |
| 02:40:14 | <_achilles_> | yeah |
| 02:40:24 | <pgavin> | is there a purely functional computer architecture? |
| 02:40:37 | <LoganCapaldo> | > let { foo :: Int -> Int -> Int ; foo x y = x +y } in foo 2 |
| 02:40:39 | <lambdabot> | <Int -> Int> |
| 02:40:45 | <LoganCapaldo> | > let { foo :: Int -> Int -> Int ; foo x y = x +y } in foo 2 3 |
| 02:40:47 | <lambdabot> | 5 |
| 02:40:59 | <sorear> | pgavin: No. You would generate infinite amounts of garbage. :) |
| 02:41:05 | <LoganCapaldo> | in other words, just like you would otherwise |
| 02:41:06 | <pgavin> | lol |
| 02:41:29 | <pgavin> | sorear: I think you could get close... at least on a small level |
| 02:41:30 | <LoganCapaldo> | > let f = g where { g :: Int ; g = 3 } in f |
| 02:41:32 | <lambdabot> | 3 |
| 02:42:11 | <pgavin> | if you took a normal risc isa and got rid of all the registers |
| 02:42:17 | <LoganCapaldo> | you can use layout of course in an actual file |
| 02:42:51 | <_achilles_> | ok... |
| 02:43:03 | <_achilles_> | apparently that doesn't work for my case however |
| 02:43:12 | <dataangel> | Why does List.insert put its argument before the first element which is greater than it? Coming from C++ that seems like odd behavior -- I'd expect you'd give an index for where to insert the element |
| 02:43:28 | <_achilles_> | but the help is appreciated |
| 02:43:30 | <ddarius> | :t insert |
| 02:43:32 | <lambdabot> | forall a. (Ord a) => a -> [a] -> [a] |
| 02:43:34 | <TSC> | insert means "insert into a sorted list" |
| 02:43:45 | <TSC> | It's not a general "add to the list" function |
| 02:43:56 | <SamB_XP> | @hoogle Int -> a -> [a] -> [a] |
| 02:43:56 | <lambdabot> | No matches, try a more general search |
| 02:43:57 | <LoganCapaldo> | _achilles_: what's the problem? |
| 02:44:02 | <SamB_XP> | @hoogle a -> [a] -> [a] |
| 02:44:03 | <lambdabot> | List.intersperse :: a -> [a] -> [a] |
| 02:44:03 | <lambdabot> | Prelude.(:) :: a -> [a] -> [a] |
| 02:44:03 | <lambdabot> | List.deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a] |
| 02:44:08 | <dataangel> | it's just called insert though |
| 02:44:16 | <TSC> | Yes, as in insertion sort |
| 02:44:23 | <_achilles_> | I'm looking to do: timeDiv n d = case n `mod` d of 0->1 + timeDiv (n/d) d; _ -> 0 |
| 02:44:28 | <ddarius> | dataangel: You, usually don't want to be inserting elements into the middle of lists. |
| 02:44:36 | <dataangel> | true |
| 02:44:39 | <dataangel> | not in haskell |
| 02:44:44 | <sjanssen> | ACTION laughs out loud at augustss's 'Haskell 2037' presentation |
| 02:44:52 | <wli> | I've discovered that there is some interest in NIH'ing IMVU. |
| 02:45:02 | <_achilles_> | looks like I want quot? |
| 02:45:05 | <LoganCapaldo> | @type mod |
| 02:45:07 | <lambdabot> | forall a. (Integral a) => a -> a -> a |
| 02:45:12 | <LoganCapaldo> | @type (/) |
| 02:45:14 | <lambdabot> | forall a. (Fractional a) => a -> a -> a |
| 02:45:19 | <_achilles_> | @type quot |
| 02:45:21 | <lambdabot> | forall a. (Integral a) => a -> a -> a |
| 02:45:31 | <LoganCapaldo> | or div |
| 02:45:34 | <LoganCapaldo> | @type div |
| 02:45:36 | <lambdabot> | forall a. (Integral a) => a -> a -> a |
| 02:45:40 | <_achilles_> | ah |
| 02:45:43 | <_achilles_> | mk |
| 02:45:50 | <wli> | They may also be interested in using Haskell to speed up program development (they're largely content creators). |
| 02:46:10 | <LoganCapaldo> | (IIRC div quot and rem / mod differ mainly in their behavior with negative numbers) |
| 02:46:38 | <LoganCapaldo> | So you probably want to use quot and rem or div and mod but not mod and quot or rem and div |
| 02:47:07 | <LoganCapaldo> | ACTION thinks theres a divmod too |
| 02:47:10 | <jcreigh> | oh, somebody had a good blog post on when to use one set over the other...lemme see if I can find it... |
| 02:47:14 | <LoganCapaldo> | @hoogle divmod |
| 02:47:14 | <lambdabot> | Prelude.divMod :: Integral a => a -> a -> (a, a) |
| 02:47:21 | <LoganCapaldo> | @hoogle quotRem |
| 02:47:22 | <lambdabot> | Prelude.quotRem :: Integral a => a -> a -> (a, a) |
| 02:48:21 | <hpaste> | chessguy pasted "first pass at a generalized class for an interpreter" at http://hpaste.org/3191 |
| 02:49:06 | <jcreigh> | here it is: http://praisecurseandrecurse.blogspot.com/2006/12/divisive-aftermath.html |
| 02:49:08 | <lambdabot> | Title: Praise, Curse, and Recurse: The Divisive Aftermath, http://tinyurl.com/269574 |
| 02:49:10 | <_achilles_> | I'm planning to use divMod |
| 02:49:20 | <_achilles_> | appreciate your help! |
| 02:50:56 | <chessguy> | i wonder how restrictive this class will be in that the code and data types are the same |
| 02:53:25 | <chessguy> | @seen sorear |
| 02:53:25 | <lambdabot> | sorear is in ##logic, #ghc, #xmonad, #haskell-overflow, #haskell-blah and #haskell. I last heard sorear speak 7m 43s ago. |
| 02:53:28 | <sorear> | ? |
| 02:53:45 | <chessguy> | hey, you've written some interpreters, haven't you? |
| 02:53:51 | <sorear> | yes |
| 02:54:00 | <halcyon10> | @pl (\x -> (take 4 (show x))++" %") |
| 02:54:01 | <lambdabot> | (++ " %") . take 4 . show |
| 02:54:03 | <chessguy> | i'm curious what you'll think of my idea |
| 02:54:22 | <chessguy> | i want to have a class like the one i just pasted, and then write a generalized REPL around it |
| 02:54:37 | <chessguy> | so that writing an interpreter is as easy as implementing this class |
| 02:55:26 | <chessguy> | so the scheme interpreter would be instantiating Interpret LispVal LispError |
| 02:56:54 | <chessguy> | (the scheme interpreter from the 48-hour tutorial, that is) |
| 02:59:23 | <chessguy> | heh. i've stunned him into silence with my brilliance |
| 03:00:17 | <sorear> | :) |
| 03:00:27 | <dataangel> | I have a function that takes a list and an integer. The function is only valid over a range that is a function of the length of the list. Is there a way to enforce (a C++ style runtime assertion?) this? I figure I add pattern matches for the invalid cases, but I'm not sure what to set the function to then |
| 03:00:53 | <dataangel> | err, the function is only valid when its integer parameter is within a range that is a function of the length of the list :) |
| 03:00:53 | <wli> | Yes |
| 03:00:58 | <sorear> | I'm not too optimistic. What if you have site effects? What if your language isn't homoiconic? What if evaluation can fail? |
| 03:01:06 | <wli> | Check your assertion, use error when it fails. |
| 03:01:11 | <chessguy> | what the heck is homoiconic? |
| 03:01:35 | <sorear> | http://en.wikipedia.org/wiki/Homoiconicity |
| 03:01:37 | <Syzygy-> | A weakening of isoiconic. |
| 03:01:40 | <Syzygy-> | :) |
| 03:01:52 | <chessguy> | right, ok |
| 03:02:09 | <chessguy> | well, i could introduce a third type parameter into the class to handle that |
| 03:02:10 | <adamjones> | dataangel: by "a function of the length of the list" do you mean within the 1..n bounds of the list or something else? |
| 03:02:47 | <chessguy> | sorear, as for side effects, the scheme interpreter code allows for that |
| 03:03:18 | <sorear> | chessguy: a -> a isn't good enough though. LispVal -> LispVal has no side effects. |
| 03:03:36 | <FMota_> | chessguy: Something along the lines of Freddie Mercury. |
| 03:03:58 | <chessguy> | sorear, err, you're right, that type isn't right |
| 03:03:58 | <FMota_> | Or Alan Turing. |
| 03:04:03 | <wli> | ACTION resembles that remark. |
| 03:04:17 | <sorear> | chessguy: You're going to need to add more and more and more things to your class, to the point where I think you'd likely be better off with repl :: (String -> IO String) -> IO () |
| 03:04:51 | <dataangel> | adamjones: it's a list of lists representing a grid of squares, and its only valid over the outermost "border" of squares. So for a 3x3 grid, it's valid for 0-7 (eight squares surrounding the middle) and for a 4x4 grid it's valid for 0-11 (12 squares surrounding the inner four) |
| 03:05:06 | <dibblego> | ?hoogle (Monad m) => ([a] -> b) -> m [a] -> m b |
| 03:05:07 | <lambdabot> | No matches, try a more general search |
| 03:05:20 | <dino-> | I was just looking for the Example link from the Haskell Home, the place where the source code for the Prelude and other basic things was. Has it moved? |
| 03:06:28 | <chessguy> | sorear, fair enough. do you think the idea of a generalized REPL is worth pursuing in a different fashion? |
| 03:06:31 | <adamjones> | dataangel: wli's suggestion would work pretty well. |
| 03:07:14 | <sorear> | chessguy: maybe... |
| 03:07:15 | <wli> | Anybody remember my suggestion about the fashion design assistant program? |
| 03:07:36 | <adamjones> | nope. |
| 03:07:48 | <SamB_XP> | sorear: uh, what about completion! |
| 03:08:10 | <dataangel> | brb |
| 03:09:03 | <wli> | Given that there's only one response and it's "no," I'll take that as "no one remembers and no one cares." |
| 03:09:47 | <ddarius> | wli: I'm sure I didn't hear it at all and I don't care. |
| 03:10:15 | <Korollary> | ACTION pats wli's back |
| 03:10:20 | <Korollary> | there there |
| 03:10:52 | <hpaste> | adamjones pasted "(no title)" at http://hpaste.org/3194 |
| 03:11:20 | <adamjones> | hmm, figures as soon as I contribute an answer the guy leaves. |
| 03:12:06 | <adamjones> | oh well, I'm still claiming this as "I finally knew enough to answer a question about haskell." Yay me! |
| 03:12:23 | <dino-> | Ah, Haskell Home Page history: 18:49, 4 October 2007 DonStewart (I don't think the example code page has value anymore) |
| 03:12:29 | <dino-> | Well, boo. |
| 03:12:31 | <dino-> | It had value to me. |
| 03:12:49 | <lament> | was it positive? |
| 03:13:20 | <hpaste> | (anonymous) pasted "(no title)" at http://hpaste.org/3195 |
| 03:13:36 | <dino-> | I understand it wasn't exactly the true source, but it was good to take a look at how some things were implemented. |
| 03:14:05 | <ddarius> | dino-: Why not just look at the Report? |
| 03:14:24 | <dino-> | ddarius: The report tells you the implementation of, say, reverse or foldl' ? |
| 03:16:42 | <ddarius> | dino-: It has definitions for every function in the standard libraries that it could define. |
| 03:17:31 | <chessguy> | it's not possible to define things like groups (in the abstract algebra sense) with type classes, is it? |
| 03:17:34 | <ddarius> | dino-: If that's not enough, you can readily get the source of the actual libraries. |
| 03:17:42 | <ddarius> | chessguy: No more than monads. |
| 03:18:05 | <gvdm> | you need something between the scanner and printing (to decide what to print based on what was scanned) |
| 03:18:09 | <chessguy> | ddarius, you mean the monad laws? |
| 03:18:21 | <ddarius> | chessguy: Yes. |
| 03:18:24 | <dino-> | ddarius: Ah, I see it. Thank you, I didn't know that was in there. |
| 03:19:03 | <ddarius> | dino-: Also, every (or most?) pages in the hierarchical libraries have a Source Code link at the top that takes you straight to the source. |
| 03:19:06 | <gvdm> | hmm, perhaps seeing that the scroll bar is not at the bottom before trying to reply to something would be an idea... |
| 03:19:45 | <ddarius> | chessguy: You can easily write: class Group g where (*) :: g -> g -> g; e :: g; inverse :: g -> g |
| 03:20:32 | <ddarius> | :t recip |
| 03:20:37 | <lambdabot> | forall a. (Fractional a) => a -> a |
| 03:20:39 | <chessguy> | so it's the axioms that they have to satisfy that's the problem |
| 03:21:32 | <chessguy> | what if you could somehow attach QC properties to a class so that you could instantiate it and then check to see if it's valid |
| 03:21:59 | <chessguy> | it wouldn't be a proof or a guarantee, but it would be a check |
| 03:22:41 | <ddarius> | You could add some quickcheck properties as default class members. |
| 03:23:26 | <chessguy> | it adds an Arbitrary requirement though |
| 03:23:44 | <chessguy> | an arbitrary one at that :) |
| 03:23:59 | <dibblego> | ?hoogle (a, a) -> [a] -> [a] |
| 03:24:00 | <lambdabot> | No matches, try a more general search |
| 03:24:02 | <ddarius> | chessguy: Everyone should be quickchecking all their code anyway! |
| 03:24:05 | <dibblego> | ?hoogle a -> a -> [a] -> [a] |
| 03:24:06 | <lambdabot> | No matches, try a more general search |
| 03:24:45 | <ddarius> | chessguy: You could just have some properties in the module that you export. |
| 03:25:32 | <chessguy> | but you still have no way of enforcing that instances pass the test |
| 03:25:54 | <ddarius> | If you want that then you need to use a different language. |
| 03:26:24 | <chessguy> | right, that's what i thought. i was just checking |
| 03:28:15 | <dino-> | ddarius: Ya, hadn't thought of that either, the Source code link. Which even works using the locally-installed copy of the API docs on my system. |
| 03:28:33 | <chessguy> | it still might be fun to write some classes for such algebraic structures, for instructive purposes |
| 03:29:36 | <Syzygy-> | chessguy: One benefit of class Group as sketched above is that with a diagonal :: g -> (g,g) you actually have all you need for group objects in generic categories. |
| 03:30:09 | <chessguy> | Syzygy-, i have no idea what that means |
| 03:30:13 | <dino-> | I'm confused about something. I'm trying to hack some code that's got mplus being called with two IO actions as arguments. But I don't see the docs showing IO as being an instance of MonadPlus. |
| 03:30:23 | <Syzygy-> | chessguy: In that case just ignore it. |
| 03:30:24 | <chessguy> | Syzygy-, i don't know anything about abstract algebra |
| 03:30:34 | <Syzygy-> | It's something cool from my corner of mathematics... :) |
| 03:30:35 | <chessguy> | i would be doing this to learn along the way |
| 03:30:46 | <Syzygy-> | A group is essentially a group object in the category of Sets. |
| 03:30:47 | <ddarius> | @instances MonadPlus |
| 03:30:51 | <lambdabot> | Either e, ErrorT e m, IO, Maybe, RWST r w s m, ReaderT r m, StateT s m, WriterT w m, [] |
| 03:31:07 | <ddarius> | Syzygy-: You own a corner of mathematics? |
| 03:31:11 | <Syzygy-> | Whereas a ring is a Semigroup (or Monoid) object in the category of abelian groups. |
| 03:31:31 | <Syzygy-> | ddarius: My corner of mathematics in the same sense of the word my as used in "my country" or "my neighbourhood" |
| 03:31:33 | <ddarius> | chessguy: Maybe formalize these things in Agda or Yarrow or Coq or Isabelle/HOL or Alf or Twelf or ... |
| 03:31:52 | <Syzygy-> | chessguy: Speaking of that ... http://blog.mikael.johanssons.org/archive/2007/08/coq-and-simple-group-theory/ |
| 03:31:55 | <lambdabot> | Title: Michi’s blog » Blog Archive » Coq and simple group theory, http://tinyurl.com/yvzdr7 |
| 03:31:59 | <chessguy> | ddarius, i've not even heard of most of those :) |
| 03:32:04 | <Syzygy-> | You will recognize the beginning there. |
| 03:32:20 | <Syzygy-> | chessguy: Most fo those are proof assistant systems. |
| 03:32:32 | <dino-> | Huh. But I don't see it in the instances list here: http://haskell.org/ghc/docs/latest/html/libraries/base/Control-Monad.html#t%3AMonadPlus |
| 03:32:34 | <lambdabot> | http://tinyurl.com/y25qsm |
| 03:32:38 | <chessguy> | Syzygy-, i guessed as much from the inclusion of Coq |
| 03:32:52 | <Syzygy-> | Aaaaanyway. Take a look at my blogpost there. |
| 03:32:57 | <dino-> | Where this is going is I don't understand what mplus means applied to IO actions. |
| 03:33:25 | <chessguy> | @src MonadPlus |
| 03:33:25 | <lambdabot> | Source not found. Wrong! You cheating scum! |
| 03:33:56 | <allbery_b> | @src IO mplus |
| 03:33:56 | <ddarius> | dino-: Essentially catch |
| 03:33:56 | <lambdabot> | m `mplus` n = m `catch` \_ -> n |
| 03:34:17 | <allbery_b> | ACTION *headdesk* |
| 03:34:30 | <allbery_b> | I should be using that... was wondering how to clean that code up |
| 03:35:22 | <ddarius> | I actually find that mildly ugly. |
| 03:35:46 | <Pseudonym> | Well, it's an implementation. |
| 03:35:52 | <Pseudonym> | You don't have to see it, exactly. |
| 03:36:04 | <allbery_b> | hm, except I'm not sure when that hit the libs. is it in 6.6.1? |
| 03:36:14 | <ddarius> | That's been there for a long long time. |
| 03:36:20 | <allbery_b> | ah |
| 03:36:24 | <chessguy> | by the way, i heard today that lazy expressions are supposedly going to get added to javascript in the near future |
| 03:36:47 | <allbery_b> | ACTION has some places where he does an IO actuion and if it fails supplies a default. mplus should clean those up nicely |
| 03:39:43 | <allbery_b> | could even encapsulate it further: flip mplus . return |
| 03:41:05 | <Syzygy-> | :t flip mplus . return |
| 03:41:13 | <lambdabot> | forall (m :: * -> *) a. (MonadPlus m) => a -> m a -> m a |
| 03:41:17 | <kpreid> | allbery_b: I think that pointfreeness is obfuscatory |
| 03:41:58 | <Pseudonym> | Sometimes it is, sometimes it isn't. |
| 03:42:10 | <Pseudonym> | Pointfreeness does help you avoid names for things that don't need names. |
| 03:42:13 | <kpreid> | that's why I said "that". |
| 03:42:14 | <chessguy> | @pl \x y -> x + y -- hardly obfuscatory |
| 03:42:14 | <lambdabot> | (+) |
| 03:42:21 | <Pseudonym> | On the other hand, it avoids names for things that should have names. |
| 03:42:22 | <kpreid> | Oh, sorry. |
| 03:42:30 | <kpreid> | I think that *that* pointfreeness is obfuscatory. |
| 03:42:46 | <kpreid> | ACTION grumbles at English. |
| 03:43:07 | <nornagon> | ACTION does likewise. |
| 03:43:23 | <chessguy> | @pl \m n -> c m \_ -> n |
| 03:43:23 | <lambdabot> | (line 1, column 13): |
| 03:43:23 | <lambdabot> | unexpected "\\" |
| 03:43:23 | <lambdabot> | expecting variable, "(", operator or end of input |
| 03:43:45 | <chessguy> | @pl \m n -> m `c` \_ -> n |
| 03:43:45 | <lambdabot> | (. const) . c |
| 03:44:00 | <allbery_b> | keep in mind that occurs only once (think withDefault val $ (some IO action)) |
| 03:44:24 | <Pseudonym> | @pl \c m n -> m `c` \_ -> n |
| 03:44:24 | <lambdabot> | flip flip const . ((.) .) |
| 03:44:45 | <allbery_b> | a comment will deal well enough, or I can expand it but I'm not sure (f `mplus` return dft) is that much better |
| 03:45:07 | <ddarius> | (`mplus` return default) |
| 03:46:32 | <ddarius> | What's a good Haskell Workshop video besides the Harpy one, the Debugger one, the HPC one or the Beauty in the Beast one? |
| 03:47:52 | <allbery_b> | ddarius: that's even worse :) |
| 03:48:06 | <dino-> | Does that mean (above with the `catch`) if m results in mzero, it will go on to execute n ? |
| 03:48:34 | <dino-> | referring to: m `mplus` n = m `catch` \_ -> n |
| 03:49:11 | <allbery_b> | yes. |
| 03:49:16 | <allbery_b> | @src IO mzero |
| 03:49:16 | <lambdabot> | mzero = ioError (userError "mzero") |
| 03:49:29 | <dino-> | Man, I wish that was in the HTML docs. :o |
| 03:49:50 | <allbery_b> | any I/O error is effectively mzero, so mplus gives you a convenient way to catch the error and supply a default |
| 03:51:19 | <dino-> | ddarius, allbery_b: Ok, thank you. |
| 03:54:51 | <dataangel> | If I want to list-ify all of the elements of a list, is this the best way to do that?: [ [elem] | elem <- mylist ] |
| 03:55:27 | <TSC> | map return |
| 03:55:36 | <glguy> | dataangel: your way is fine |
| 03:55:48 | <glguy> | map return , map (:[]) work too |
| 03:55:51 | <TSC> | map (:[]) is common too |
| 03:56:10 | <glguy> | dataangel: but since elem is a function in the Prelude |
| 03:56:15 | <glguy> | you'd be better off not shadowing it |
| 03:56:28 | <dataangel> | k |
| 03:56:34 | <TSC> | It's a shame there's no "singleton" function, like Data.Set.singleton |
| 03:57:33 | <nornagon> | return and :[] are the singleton functions :) |
| 03:57:41 | <TSC> | Yeah, but with that name |
| 03:57:47 | <Pseudonym> | Why? |
| 03:57:50 | <nornagon> | ?let singleton = return |
| 03:57:51 | <lambdabot> | <local>:2:12: Ambiguous type variable `m' in the constraint: `Monad... |
| 03:57:57 | <nornagon> | ?let singleton = return :: [a] |
| 03:57:57 | <lambdabot> | Couldn't match expected type `[a]' |
| 03:58:05 | <Pseudonym> | The operation is usually called "box", BTW. |
| 03:58:16 | <Pseudonym> | Though (:[]) is pronounced "the robot ninja monkey operator". |
| 03:58:23 | <nornagon> | haha |
| 03:58:24 | <nornagon> | ?let singleton = (:[]) |
| 03:58:25 | <glguy> | ?let singleton = return :: a -> [a] |
| 03:58:26 | <lambdabot> | Defined. |
| 03:58:27 | <lambdabot> | <local>:3:0: Multiple declarations of `L.singleton' Declared at: <loc... |
| 03:58:31 | <glguy> | heh |
| 03:58:34 | <nornagon> | beatcha! |
| 03:58:39 | <nornagon> | > singleton 3 |
| 03:58:40 | <lambdabot> | [3] |
| 03:59:00 | <glguy> | nornagon: looks like it used *my* version |
| 03:59:03 | <glguy> | ;) |
| 03:59:23 | <kig> | do any haskell gui toolkits assert at compile-time that e.g. initGUI is called before mainGUI? |
| 03:59:44 | <nornagon> | glguy: not from here... |
| 04:00:44 | <glguy> | They are playing a documentary about meth on every channel here |
| 04:01:21 | <Pseudonym> | It's the meth channel! All meth, all the time! |
| 04:01:38 | <Pseudonym> | That's from the Robert Crumb version of Elmo's World. |
| 04:02:55 | <allbery_b> | kig: you can't at compile time, unless the toolkit has its own monad and initGUI is really withGUI $ gui-using-code |
| 04:07:57 | <glguy> | I switched to a different channel and they have a show on called "Jail" |
| 04:08:15 | <glguy> | like cops, but just the part where they put people in jail |
| 04:08:31 | <glguy> | I guess this is what you get when you don't pay for cable.. |
| 04:08:42 | <wli> | Well, in the US, such a large fraction of the population goes to jail that it's a shared experience. |
| 04:08:59 | <ddarius> | You've gone to jail wli? |
| 04:09:07 | <Pseudonym> | glguy: No, it's what you get when you don't live on another continent. |
| 04:09:24 | <Pseudonym> | ddarius: No, but he was involved in a Milgram experiment. |
| 04:09:27 | <glguy> | and you are groomed to think that's ok from an early age, think monopolly "go directly to jail, do not pass go, do not collect $200" |
| 04:09:44 | <glguy> | Monopoly* |
| 04:09:46 | <wli> | ddarius: No. |
| 04:10:27 | <wli> | ddarius: But look for statistics on the subject some time, esp. those comparing them between contries. |
| 04:11:06 | <ddarius> | wli: You feel you have the experience of going to jail? |
| 04:11:13 | <wli> | ddarius: No. |
| 04:11:40 | <Pseudonym> | Hey, nobody here knows anything about it. You know what that means... Uninformed Opinion Time! |
| 04:12:26 | <Pseudonym> | Well _I_ think some time in jail is character-building. Except for me, of course. |
| 04:13:59 | <ddarius> | Well -I- think some time in jail would lead to the revocation of my clearance, so I'll refrain. |
| 04:14:47 | <Pseudonym> | Ah, but what if it was time in an enemy jail for espionage? |
| 04:14:54 | <wli> | Compare the fraction of the population incarcerated between countries. |
| 04:15:06 | <ddarius> | Pseudonym: My clearance would at least be suspended for that. |
| 04:15:18 | <lament> | spending time in jail certainly does little good to your employability. |
| 04:15:55 | <reffie> | #haskell-blah |
| 04:16:06 | <Pseudonym> | Good point. |
| 04:16:09 | <Pseudonym> | Or just stop. |
| 04:16:12 | <ddarius> | Sleep. |
| 04:18:26 | <glguy> | reffie: you have to type /join first |
| 04:18:42 | <reffie> | ? |
| 04:19:17 | <sjanssen> | glguy: reffie wasn't trying to get to the OT channel, he was trying to send you there! :P |
| 04:19:26 | <glguy> | </sarcasm> |
| 04:21:12 | <dmwit> | sjanssen: Yeah, IRC needs a /send command. |
| 04:21:28 | <sorear> | it exists |
| 04:21:30 | <sorear> | ACTION demos |
| 04:22:41 | <dmwit> | ACTION doesn't notice anything different |
| 04:23:05 | <sorear> | hmm. apparently it doesn't work if you're already there? |
| 04:23:23 | <sorear> | ACTION tries it on glguy |
| 04:23:23 | <glguy> | sorear: are you talking about /invite? |
| 04:23:44 | <sorear> | yes |
| 04:23:46 | <dataangel> | What's the preferred way to strip off the first and last elements of a list? I've written my own func but I dunno if there's something nicer builtin |
| 04:23:57 | <sorear> | init.tail |
| 04:26:36 | <bos> | > (init.tail) [] |
| 04:26:38 | <lambdabot> | Exception: Prelude.tail: empty list |
| 04:26:47 | <dmwit> | > init . drop 1 $ [] |
| 04:26:48 | <lambdabot> | Exception: Prelude.init: empty list |
| 04:26:57 | <bos> | ah, partial functions, how we love thee |
| 04:27:08 | <dmwit> | > drop 1 . reverse . drop 1 . reverse $ [] |
| 04:27:10 | <lambdabot> | [] |
| 04:27:14 | <dmwit> | =P |
| 04:27:29 | <sproingie> | @pl init . drop 1 $ [] |
| 04:27:29 | <lambdabot> | init (drop 1 []) |
| 04:27:35 | <sproingie> | meh |
| 04:27:39 | <chessguy> | err, do you need to reverse it twice? |
| 04:27:47 | <dmwit> | yes? |
| 04:27:56 | <glguy> | chessguy: to maintain the order |
| 04:28:01 | <chessguy> | oh, right |
| 04:28:07 | <chessguy> | ACTION shuts up |
| 04:28:23 | <chessguy> | @pl \xs -> init . drop 1 xs |
| 04:28:23 | <lambdabot> | (init .) . drop 1 |
| 04:28:33 | <chessguy> | sproingie, i think that's what you were looking for |
| 04:28:38 | <glguy> | nope |
| 04:28:39 | <sproingie> | there we go |
| 04:28:40 | <chessguy> | err |
| 04:28:54 | <chessguy> | @pl \xs -> (init . drop 1) xs |
| 04:28:54 | <lambdabot> | init . drop 1 |
| 04:28:57 | <dmwit> | ?pl \xs -> init . drop 1 $ xs |
| 04:28:57 | <lambdabot> | init . drop 1 |
| 04:29:18 | <chessguy> | @type (init .) . drop 1 |
| 04:29:21 | <lambdabot> | Couldn't match expected type `a1 -> [a]' |
| 04:29:21 | <lambdabot> | against inferred type `[a2]' |
| 04:29:23 | <sproingie> | that one was pretty obvious |
| 04:29:25 | <chessguy> | nice |
| 04:31:29 | <badkins> | Is there something I can do to get ghci to work more similarly to ghc? In other words, in other REPL's I'm familiar with, I can feed them input similar to what I'd feed the compiler/interpreter, but ghci seems quite different. I've been able to placate it by prefixing let in places, but I'm sure there's a better way. |
| 04:31:52 | <bos> | no, you can't |
| 04:31:59 | <dmwit> | badkins: Write a file, and load it with : repeatedly. |
| 04:32:10 | <badkins> | you're serious?? |
| 04:32:16 | <sjanssen> | badkins: yes |
| 04:32:20 | <badkins> | rats :( |
| 04:32:45 | <badkins> | thx for the info. I guess I've been spoiled with irb and clisp |
| 04:32:48 | <sjanssen> | badkins: Haskell is hard to parse and interpret incrementally |
| 04:32:52 | <sproingie> | emacs has a haskell-mode |
| 04:33:09 | <chessguy> | emacs' haskell mode isn't too bad |
| 04:33:25 | <sproingie> | you can reload the buffer with a key |
| 04:33:27 | <badkins> | I'm a vim guy, but I'll keep an open mind if it makes Haskelling easier |
| 04:33:37 | <chessguy> | well, two keys |
| 04:33:37 | <dd> | all this fuss about no shared state and you cant inject new functions into a runtime? |
| 04:33:38 | <sproingie> | shouldn't be too hard to do something in vi |
| 04:33:42 | <dmwit> | badkins: There's some nice vim things, too. |
| 04:33:42 | <sproingie> | someone might have already written it |
| 04:33:46 | <chessguy> | C-c C-r |
| 04:33:54 | <dmwit> | http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/Vim/ |
| 04:33:56 | <lambdabot> | Title: Haskell mode for Vim |
| 04:33:56 | <sjanssen> | badkins: two terminals with ghci and vim works well for me |
| 04:34:06 | <sjanssen> | badkins: so emacs isn't required by any means :) |
| 04:34:06 | <sproingie> | i always remap those C-c prefixed commands to something else |
| 04:34:13 | <sproingie> | well the common ones anyway |
| 04:34:14 | <badkins> | I wonder if I have that already, at least it does syntax highlighting. |
| 04:34:37 | <dmwit> | No, this is more than syntax highlighting. |
| 04:34:42 | <badkins> | ok |
| 04:34:43 | <sproingie> | two terminals is good too, not too hard to hit up-arrow and enter to reload |
| 04:34:57 | <dmwit> | badkins: It can create type declarations for you and do some minor introspection. |
| 04:35:01 | <sjanssen> | sproingie: or even : and enter |
| 04:35:49 | <dmwit> | badkins: It also knows enough about GHC to jump to the position of errors (which is more useful than it sounds like it should be). |
| 04:37:07 | <badkins> | Here's another newbie question. Prior to being exposed to Haskell, I was all set to learn Scheme followed by Lisp (I'm a Ruby programmer). After browsing through the Haskell School of Expression the other day, I'm really tempted to learn Haskell first. I'm sure I'll learn all 3 eventually - can anyone who knows Lisp & Haskell comment on a preferred order for ease of learning Lisp -> Haskell vs. Haskell -> Lisp ? |
| 04:37:22 | <sproingie> | we're partial to haskell :) |
| 04:37:28 | <dmwit> | ?quote lisp |
| 04:37:29 | <lambdabot> | qwe1234 says: every half-assed dynamically-typed, ass-slow scripting language is Lisp but a bit different |
| 04:37:33 | <dataangel> | alright, I must be stupid, but no matter of googling is helping me find the difference between (.) and ($) |
| 04:37:35 | <dmwit> | ?quote lisp |
| 04:37:36 | <lambdabot> | qwe1234 says: sometimes i think lisp is as deadly to programmer competence as java or basic. |
| 04:37:48 | <dataangel> | ACTION doesn't know how to search for symbols correctly |
| 04:37:53 | <dmwit> | :t (.) |
| 04:37:54 | <dmwit> | :t ($) |
| 04:37:57 | <TSC> | dataangel: (.) composes functions; ($) applies functions to arguments |
| 04:37:59 | <lambdabot> | forall b c a. (b -> c) -> (a -> b) -> a -> c |
| 04:38:00 | <lambdabot> | forall a b. (a -> b) -> a -> b |
| 04:38:00 | <sjanssen> | dataangel: (function1 . function2) vs. (function1 $ argument1) |
| 04:39:03 | <dataangel> | sjannsen: err, what's the difference between function1 $ argument1 and function1 argument1? |
| 04:39:09 | <chessguy> | Warning, completely off topic: http://xkcd.com/327/ |
| 04:39:10 | <lambdabot> | Title: xkcd - A webcomic of romance, sarcasm, math, and language - By Randall Munroe |
| 04:39:12 | <sjanssen> | dataangel: none |
| 04:39:23 | <badkins> | Yeah, I'm sure you're partial to Haskell, that's why I didn't ask a "which is better" question. I was just curious if there would be a natural order i.e. if one direction would have a natural progression of concepts. |
| 04:39:29 | <dataangel> | sjanssen: Then there must be a little more to it, or that is a totally useless operator ;p |
| 04:39:38 | <sjanssen> | dataangel: it's a precedence hack |
| 04:39:39 | <blackdog_> | i think it's easiest to think of $ as a grouping operator |
| 04:39:47 | <blackdog_> | what sjanssen said |
| 04:39:53 | <smack__> | dataangel: function1 $ function2 argumentToFunction2 |
| 04:39:58 | <sjanssen> | dataangel: you can replace (f (g x)) with (f $ g x) |
| 04:39:58 | <dmwit> | ?quote #lisp |
| 04:39:59 | <lambdabot> | dcnstrct says: even the #lisp people say go with haskell |
| 04:40:01 | <dmwit> | hee-hee! |
| 04:40:38 | <TSC> | dataangel: $ is also useful for sections (e.g. map ($5) [f1, f2, f3]) |
| 04:40:40 | <sproingie> | everything after the $ is effectively in parens |
| 04:41:03 | <dataangel> | I see |
| 04:41:22 | <dataangel> | So is there any diff between f . g x and f $ g x? |
| 04:41:23 | <sproingie> | i often find myself wishing other languages had a $ operator |
| 04:41:23 | <sjanssen> | TSC: pssh, obviously you use flip sequence 5 instead :P |
| 04:41:35 | <sjanssen> | dataangel: yes, there is a difference |
| 04:41:51 | <sjanssen> | dataangel: f . g x == \y -> f (g x y) |
| 04:41:52 | <dmwit> | f . g x = \y -> f (g x) y |
| 04:42:03 | <dmwit> | f $ g x = f (g x) |
| 04:42:29 | <sjanssen> | @unpl f . g x |
| 04:42:29 | <lambdabot> | (\ c -> f (g x c)) |
| 04:42:33 | <dmwit> | Oh, sjanssen's right. |
| 04:42:52 | <dataangel> | err, so it thinks you're doing f . (g x) ? |
| 04:43:10 | <TSC> | But f $ g x is equivalent to (f . g) x, right? |
| 04:43:14 | <sjanssen> | dataangel: f . g x and f . (g x) are the same thing |
| 04:43:16 | <sproingie> | generally speaking, $ is for application, . is for composition |
| 04:43:27 | <badkins> | @lambdabot: you're not quite getting it, it's either a then b or b then a not a or b |
| 04:43:27 | <lambdabot> | Unknown command, try @list |
| 04:44:05 | <dataangel> | sjanssen: I guess I'm still confused then. I don't understand why it becomes a new function that thinks g takes another parameter. |
| 04:44:07 | <dmwit> | badkins: uh? |
| 04:44:27 | <sjanssen> | dataangel: look at the type: |
| 04:44:29 | <sjanssen> | @type (.) |
| 04:44:32 | <lambdabot> | forall b c a. (b -> c) -> (a -> b) -> a -> c |
| 04:44:40 | <sproingie> | that's currying for you |
| 04:44:47 | <sjanssen> | dataangel: takes two functions, and produces a function |
| 04:44:50 | <sjanssen> | @type ($) |
| 04:44:50 | <dataangel> | sjannsen: Right |
| 04:44:52 | <lambdabot> | forall a b. (a -> b) -> a -> b |
| 04:45:15 | <sjanssen> | $ takes a function and a value, and yields the result of applying that value to the function |
| 04:45:20 | <cognominal_> | @src init |
| 04:45:20 | <lambdabot> | init [x] = [] |
| 04:45:21 | <lambdabot> | init (x:xs) = x : init xs |
| 04:45:21 | <lambdabot> | init [] = undefined |
| 04:45:21 | <dataangel> | sjannsen: So f . g x should take f, take g, make a new function (composition) and apply x to it. |
| 04:45:36 | <TSC> | That would be (f . g) x |
| 04:45:37 | <sjanssen> | dataangel: no, it doesn't parse that way |
| 04:46:08 | <sjanssen> | dataangel: (f . g x) parses as (f . (g x)). It does *not* parse as ((f . g) x) |
| 04:46:14 | <dataangel> | sjanssen: ah |
| 04:46:43 | <dataangel> | sjannsen: But (f $ g x) and ((f . g) x) would be the same? |
| 04:46:52 | <sjanssen> | dataangel: application (which is whitespace) binds tighter than any operator |
| 04:46:59 | <sjanssen> | dataangel: yep, those are the same |
| 04:47:07 | <dataangel> | sjannsen: guess that makes sense :) |
| 04:47:23 | <sproingie> | think of $ as application, but binding more loosely than anything else |
| 04:47:34 | <dmwit> | dataangel: and application (which is $) binds looser than any operator. |
| 04:47:39 | <dmwit> | ;-) |
| 04:48:06 | <sjanssen> | (it's also infixr instead of infixl, but that's another matter) |
| 04:48:14 | <dmwit> | It shouldn't be. |
| 04:48:26 | <Syzygy-> | I'm getting tempted to write a module for euclidean construction in either Haskell or Coq. |
| 04:48:36 | <Syzygy-> | Should get my ass back to research work instead though... |
| 04:48:38 | <sjanssen> | damnit, the parentheses were supposed to avoid this old argument! :) |
| 04:55:43 | <badkins> | dimwit: ah, it took me a while |
| 05:04:20 | <bos> | http://programming.reddit.com/info/2yj08/comments |
| 05:04:22 | <lambdabot> | Title: Using Emacs to remove some of the drudgery of Haskell leak hunting (reddit.com) |
| 05:05:06 | <chessguy> | hm, now that sounds interesting |
| 05:06:26 | <badkins> | > reverse "?olleh" |
| 05:06:28 | <lambdabot> | "hello?" |
| 05:06:51 | <chessguy> | bos++ nice one |
| 05:08:25 | <badkins> | > map reverse ["olleH", "!dlrow"] |
| 05:08:27 | <lambdabot> | ["Hello","world!"] |
| 05:11:46 | <badkins> | > sum [sum [1..5] .. sum [1..10]] |
| 05:11:47 | <lambdabot> | 1435 |
| 05:12:15 | <badkins> | cool, a replacement for ghci |
| 05:12:35 | <Korollary> | you can run lambdabot locally as well |
| 05:12:49 | <badkins> | why? |
| 05:13:53 | <Korollary> | people use some of its features for development, such as @pl, @src, etc. |
| 05:14:11 | <badkins> | interesting |
| 05:14:56 | <dmwit> | ?hoogle is also very nice |
| 05:15:35 | <badkins> | Haskell plus Google ? |
| 05:15:58 | <Korollary> | ?hoogle a -> a |
| 05:15:59 | <lambdabot> | Prelude.id :: a -> a |
| 05:15:59 | <lambdabot> | Control.Monad.Error.throwError :: MonadError e m => e -> m a |
| 05:15:59 | <lambdabot> | Control.Monad.State.put :: MonadState s m => s -> m () |
| 05:16:19 | <Korollary> | search based on type signature |
| 05:16:23 | <Mr_Awesome> | is it possible to have a variant with type different type variables in each case? |
| 05:16:48 | <opqdonut> | well you can have something like data Maybe a b = Left a | Right b |
| 05:17:25 | <bos> | more commonly known as Either a b |
| 05:17:29 | <Mr_Awesome> | heh |
| 05:18:26 | <opqdonut> | ah yes |
| 05:18:32 | <opqdonut> | blame it on the morning |
| 05:19:53 | <Mr_Awesome> | well im trying to do something like this: data X a b = F (a -> b) | G (a -> c, c -> b), but apparently its impossible to get a type like that in haskell |
| 05:20:09 | <sorear> | what's c? |
| 05:20:32 | <sorear> | you need to give bindings for all variables |
| 05:20:50 | <opqdonut> | yeah, you need to either have "X a b c" or use forall x. |
| 05:20:51 | <Mr_Awesome> | i know, but c can just be anything |
| 05:21:00 | <opqdonut> | then use forall |
| 05:21:00 | <sorear> | maybe you meant an existential, like data X a b = F (a -> b) | forall c. G (a -> c, c -> b) ? |
| 05:21:13 | <sorear> | think about what type you want for G |
| 05:21:20 | <Mr_Awesome> | oh, is that how you do it? |
| 05:21:27 | <sorear> | G :: (a -> c, c -> b) -> X a b -- with the forall |
| 05:21:34 | <sorear> | G :: (a -> c, c -> b) -> X a b c -- with the parameter |
| 05:21:35 | <sorear> | etc |
| 05:21:38 | <Mr_Awesome> | thats definitely the type i want |
| 05:21:50 | <Mr_Awesome> | X should not know the intermediate type in G |
| 05:22:00 | <Mr_Awesome> | thanks |
| 05:22:50 | <sorear> | also look into GADT syntax, which lets you write the constructor types you want - often much more intuitive than the current layer cake of position-sensitive modifiers |
| 05:23:21 | <sorear> | (you don't pay for GADTs unless you make essential use of the flexibility, so go ahead and use where-syntax for normal types) |
| 05:24:32 | <Mr_Awesome> | ok, ill look into i |
| 05:24:34 | <Mr_Awesome> | *it |
| 05:24:54 | <Mr_Awesome> | is it possible to restrict the a and b to be certain types for a variant of X ? |
| 05:25:19 | <sorear> | ... yes |
| 05:25:21 | <sjanssen> | Mr_Awesome: yes, this is the 'G' in GADT |
| 05:25:48 | <Mr_Awesome> | so i should basically just use GADT |
| 05:26:25 | <sorear> | Mr_Awesome: Why do you want to restrict a and b? |
| 05:27:08 | <Mr_Awesome> | for one of the variants, a and b should only be able to be certain types |
| 05:27:43 | <Mr_Awesome> | but for the other variants, they can be anything |
| 05:33:36 | <badkins> | I've been reading up on the value of Haskell's type system. My exposure to static typing is C++/Java, so I was thrilled when I moved to Ruby. I'm getting the impression that Haskell's type system is quite different and I shouldn't be too influenced from my C++/Java experience. Fair assessment? |
| 05:34:08 | <sarehu> | badkins: yes |
| 05:34:43 | <sarehu> | badkins: you will find Haskell's to be much more frustrating! And much more liberating... |
| 05:35:05 | <badkins> | interesting juxtaposition |
| 05:35:27 | <serishema> | ACTION smirks |
| 05:35:45 | <serishema> | ACTION until recently said that haskell was incomprehensible goblydegook, or a form of encryption. |
| 05:37:20 | <badkins> | Any satisfied customers here from a dynamically typed language background? Difficult transition? |
| 05:37:54 | <sarehu> | I had same background as you; don't remember the transition |
| 05:38:12 | <twifkak> | i'm mid ruby->haskell transition |
| 05:38:13 | <encryptio> | i was (and still am) a Perl guru, haskell took a long time to grasp |
| 05:38:38 | <encryptio> | but the type system had nothing to do with the mental issues i was having |
| 05:38:47 | <twifkak> | 1. it's true, you don't have to annotate types all the time in haskell |
| 05:39:19 | <twifkak> | 2. for practical purposes, you tend to do it at the function level |
| 05:39:34 | <sarehu> | the top-level definition level |
| 05:40:06 | <twifkak> | 3. despite (or maybe because of?) the magic auto-inferencing, you'll still fight the compiler from time to time |
| 05:40:24 | <twifkak> | 4. only in haskell, you /get/ something for it -- type safety really is safe |
| 05:40:32 | <opqdonut> | you only fight the compiler when you think it's wrong and you're right |
| 05:40:41 | <opqdonut> | :) |
| 05:41:05 | <serishema> | ACTION is investigating haskell as an alternative to php |
| 05:41:13 | <badkins> | I had a BASIC->Assembler->C->C++->Java->Ruby, so Haskell would be continuing forward on the functional dimension, but backwards on the static->dynamic dimension. I'm just trying to get a feel for what the static typing is buying me besides having the compiler catch errors since that simply hasn't been a problem with Ruby. |
| 05:41:16 | <twifkak> | also, all the cool ruby things like closures, haskell has exponentially more of |
| 05:41:48 | <twifkak> | so it doesn't feel ridiculously verbose like java (quite the opposite) |
| 05:41:51 | <Tela> | I found that, for some time, you can nearly pretend Haskell is dynamic. Then you hit the edge cases and once you learn enough to debug them you realize that it's really pretty smart to have types work like they do. |
| 05:41:59 | <badkins> | What hooked me while browsing SOE was the beauty of function composition. Quite nice. |
| 05:42:46 | <badkins> | ***serishema: are you serious about alternative to php? that seems like quite a jump! Deployment alone sounds painful. |
| 05:42:46 | <twifkak> | badkins: perhaps an interesting example of a use for static typing is QuickCheck |
| 05:43:05 | <encryptio> | I found that the type system never got in the way of me wanting to do what i wanted, and later found out how cool it was. |
| 05:43:22 | <encryptio> | er, 'doing what i wanted' |
| 05:43:33 | <bos> | twifkak: you're aware that there are QuickCheck implementations for dynamically typed languages, yes? |
| 05:43:45 | <twifkak> | bos: no, i'm not |
| 05:43:48 | <Shimei> | When using dynamic languages, like Ruby, I found the lack of types more confusing than worth it. I still like Ruby for other reasons though. |
| 05:43:56 | <bos> | http://www.cs.chalmers.se/~rjmh/ErlangQC/ |
| 05:43:57 | <lambdabot> | Title: Erlang QuickCheck |
| 05:43:58 | <Shimei> | *lack of static typing |
| 05:44:02 | <serishema> | badkins: i really hate php |
| 05:44:19 | <encryptio> | serishema: what language(s) do you like? |
| 05:44:21 | <serishema> | badkins: staticly compile, dump in the cgi-bin directory, i don't see the issue with deployment |
| 05:44:34 | <encryptio> | eheh... |
| 05:44:41 | <twifkak> | bos: interesting, i'll look :) |
| 05:45:16 | <twifkak> | in any case, i think it still applies -- QC automatically polymorphs on the statically inferred type of the function you pass it, and determines what random crap to throw at your function |
| 05:45:26 | <badkins> | serishema: I can understand hating php, but it seems unlikely that you'll find a Haskell equivalent. |
| 05:45:57 | <serishema> | badkins: there seem to be Network.CGI and Text.XHtml packages that can do what i want? |
| 05:46:23 | <encryptio> | in a VERY different way |
| 05:46:24 | <sjanssen> | hmm, how does this Erlang thing work? |
| 05:46:29 | <serishema> | encryptio: for web programming i'm used to asp .net. I like things that abstract all the CGI / HTML rubbish. |
| 05:46:31 | <sjanssen> | explicit types for the generators? |
| 05:46:48 | <badkins> | serishema: php is fast because mod_php runs in Apache. If you simply use Haskell as a cgi script, it'll be *way* slow |
| 05:47:06 | <opqdonut> | not necessarily |
| 05:47:13 | <opqdonut> | compiled vs. interpreted |
| 05:47:15 | <serishema> | badkins: it's only an assignment, i don't care about real world performance. |
| 05:47:42 | <serishema> | apparently there is FastCGI or something where it stays loaded. |
| 05:47:47 | <opqdonut> | yeah, i've been planning on doing my "database application project" (really web programming...) in Haskell too |
| 05:47:58 | <opqdonut> | yeah Fastcgi is nicer with haskell |
| 05:48:08 | <twifkak> | ACTION is waiting for somebody to mention HappS |
| 05:48:13 | <opqdonut> | you don't have to worry about efficiently storing state so much |
| 05:48:17 | <dataangel> | I'm doing [ fst full ++ snd full | full <- zip inner outer] where outer and inner are lists of lists, and outer always has 1 more list than inner. Is there an elegant way to append the last list in outer to this comprehension? |
| 05:48:37 | <badkins> | opqdonut: even with a compiled app, cgi is not the way to go |
| 05:49:04 | <Tela> | I've heard people critique HAppS pretty hard. I haven't really spent enough time with it to know. Is it nice? |
| 05:49:07 | <quicksilver> | badkins: sure enough, but still the speed will be much less of an issue |
| 05:49:28 | <twifkak> | sjanssen: judging from the first few pages, it's using erlang's pattern matching to specify input types |
| 05:49:31 | <badkins> | well if folks are just talking about school assignments, then sure. I do this for a living, so it's a tad different. |
| 05:49:37 | <quicksilver> | badkins: the main problem with CGI was perl scripts which took 2 seconds to load all their modules each time you ran them :) |
| 05:49:47 | <sjanssen> | dataangel: zip (inner ++ []) outer -- hackish, but it will work |
| 05:49:51 | <twifkak> | Tela: i have no idea -- i haven't heard much about it actually :/ |
| 05:49:58 | <quicksilver> | badkins: compared to that a compiled haskell app launches instantly... |
| 05:50:05 | <sjanssen> | dataangel: also, note that you can rewrite that as (zipWith (++) inner outer) |
| 05:50:06 | <smack__> | dataangel: zipWith (++) inner outer |
| 05:50:31 | <dataangel> | ACTION looks up zipWidth |
| 05:50:39 | <flux-_> | badkins, not every, even professional, web service needs high throughput - internal software, which is the majority of written software [citation needed ;)], might not have too many simultaneous users |
| 05:50:42 | <smack__> | @type zipWith |
| 05:50:44 | <lambdabot> | forall a b c. (a -> b -> c) -> [a] -> [b] -> [c] |
| 05:51:13 | <sjanssen> | twifkak: I'm not up on Erlang, what is the significance of ? in ?FORALL? |
| 05:51:29 | <badkins> | quicksilver: and db connection pooling, etc. ? The difference between theory and practice is much greater in practice than in theory. |
| 05:51:35 | <twifkak> | sjanssen: dunno :) |
| 05:51:51 | <quicksilver> | badkins: not every web application needs a database :) |
| 05:52:01 | <badkins> | right ;) |
| 05:52:17 | <quicksilver> | badkins: but yes, there may be other resources which take time to acquire, I agree |
| 05:52:36 | <dataangel> | sjannsen: zipWith works :) |
| 05:52:38 | <quicksilver> | ACTION knows whereof he speaks. He's been writing web applications on and off since 1994 |
| 05:52:48 | <twifkak> | i think what quicksilver meant to say was "not every web application needs a *relational* database" |
| 05:52:50 | <dataangel> | sjannsen: I still have the problem though of tacking the extra element in outerDiag on to the end though |
| 05:52:53 | <badkins> | quicksilver: in Haskell? :) |
| 05:53:02 | <dataangel> | sjannsen: err, nm, get your trick now |
| 05:53:06 | <sjanssen> | ah yes, page 8 finally tells me what I want to know: the generator is an explicit argument to FORALL |
| 05:53:31 | <dataangel> | sjannsen: I think a lot of this feels hackish sinces I'm using lists to represent a rigid square grid (more like an array :P) |
| 05:53:35 | <sjanssen> | not quite as nice as Haskell, where the generator is implicit, but workable |
| 05:53:35 | <badkins> | I'm sure an excellent Haskell web framework can be invented, but it seems like Python before Django/Turbogears and/or Ruby before Rails currently. |
| 05:54:00 | <quicksilver> | badkins: no, back in 1994 it was perl4 and CGI all the way :) |
| 05:54:24 | <quicksilver> | badkins: and if things were too slow we rewrote them in C! Yay! |
| 05:54:50 | <twifkak> | sjanssen: perhaps ? is a "adverb" on a predicate to mean "return a boolean" rather than "abort if false"? |
| 05:55:06 | <quicksilver> | badkins: But, anyhow, there is hAppS and Hope, which are interesting in different ways |
| 05:55:17 | <sjanssen> | lol, page 9 invents the Gen Monad with Erlang macros ;) |
| 05:55:34 | <Tela> | Ooh. I hadn't heard of Hope before... |
| 05:55:45 | <badkins> | quicksilver: probably as interesting as the Lisp stuff I dug up. yes it's used in production by a few folks, just not quite ready to abandon Rails for yet. |
| 05:56:01 | <quicksilver> | badkins: of course very few people are using haskell for web apps, either as a proportion of haskell users or of web-app writers |
| 05:56:08 | <quicksilver> | very very few |
| 05:57:45 | <badkins> | right. My current research into Scheme,Lisp,Haskell, etc. is for *way* down the road. One *big* plus with Haskell I see is ghc. The open source Lisp compiler market is fragmented and struggling. ghc seems to be a very nice compiler and the fact that it stands out as the leading one should attract more development resources. |
| 05:58:22 | <quicksilver> | I have little doubt that haskell is an excellent language for web application development |
| 05:58:27 | <quicksilver> | in fact, I have no doubt at all |
| 05:58:39 | <quicksilver> | but it doesn't have library maturity in that area yet |
| 05:58:48 | <badkins> | agreed |
| 05:58:52 | <quicksilver> | so you'd end up writing (partly) your own libraries on the way |
| 05:59:15 | <Korollary> | I don't think any language is incapacitated for web apps by its own very nature. It's all about libraries. |
| 05:59:33 | <quicksilver> | Korollary: right, but some languages are pretty poor for it. Like C. |
| 05:59:44 | <badkins> | that's why it's a future oriented task for me, in the short run there would be a loss of productivity, but with a language that is productive enough, it would be recouped later (in theory) |
| 06:00:25 | <badkins> | Korollary: to some degree yes, but some languages are worth a long term commitment in library development |
| 06:00:28 | <quicksilver> | empirically haskell lets me (makes me?) write code with fewer bugs, and easier to refactor without introducing bugs |
| 06:00:45 | <quicksilver> | that alone is a good reason to find it interesting |
| 06:01:15 | <newsham> | I'm watching lectures from Haskell Workshop 2007. are the papers also available online? |
| 06:01:51 | <Tela> | I had an interesting experience several hours ago where I did a major refactor of structure of my code. I just changed the most relevant part then let the type-checker tell me all the places that broke. Refactored in like 20 seconds :) |
| 06:03:30 | <quicksilver> | Tela: yes, I was talking about that yesterday |
| 06:03:40 | <badkins> | Tela: that's something I was used to doing in the Java world and thought I would miss. So far (18 months) I haven't missed it in Ruby, but I can see how I might possibly get bit by a refactoring at some point (I'm far from 100% test coverage). |
| 06:03:57 | <quicksilver> | Tela: really striking. If code works before, and you refactor something, then by the time it compiles again, it works again |
| 06:04:27 | <badkins> | quicksilver: assuming no semantic changes from refactoring ;) |
| 06:04:30 | <quicksilver> | badkins: yes, it's true that Java is so cumbersome you are forced to refactor *often* which makes tool support for refactoring feel really important |
| 06:04:49 | <quicksilver> | badkins: right, it's not some magic rule. But in practice if you're using the type system well, it seems to guide you correctly |
| 06:05:21 | <badkins> | quicksilver: I don't miss all the tools! It's been wonderful only needing vim :) |
| 06:07:09 | <badkins> | quicksilver: did you try other functional languages prior to Haskell, or come directly here? |
| 06:07:35 | <sjanssen> | I don't think I could ever get used to a dynamic language. How do people cope when simple misspellings are run-time errors? |
| 06:08:13 | <Tela> | I had done some large ruby refactors before that I couldn't work through. Generally, it led to complete rewrites on large sections of code. I'm not all that familiar with other static typed languages, so when things like that work in Haskell, I get ecstatic |
| 06:08:13 | <badkins> | sjanssen: it happens, but it's rare and quickly caught - things tend to not pass tests when they aren't spelled correctly :) |
| 06:09:00 | <quicksilver> | sjanssen: well at least perl has 'use strict' which catches most mis-spellings and you're a fool if you don't use it. I imagine the others have similar. |
| 06:09:16 | <quicksilver> | badkins: I have used a couple of varieties of ML |
| 06:09:26 | <quicksilver> | badkins: I've played with lisps, but never used them for anything serious |
| 06:10:08 | <Tela> | Lisp... If you want to talk about crippled libraries... |
| 06:11:56 | <badkins> | Tela: I do find it odd that some very capable languages have poor library support. It doesn't seem like time is the main impediment. Maybe the programmers that are attracted to such languages aren't interested in library development. |
| 06:12:52 | <Tela> | badkins: concerning Lisp, I feel like it's in the culture of the language. Everyone wants to do things their own way, so collaborative efforts are terribly scattered and redundant |
| 06:13:34 | <badkins> | Tela: how is the situation for Haskell? I would think it might be similar - intelligent, independent programmers, etc. |
| 06:14:35 | <Tela> | I'm always reassured by the strength of ghc. There are a lot of language extensions which are well supported because of it being fairly ubiquitous |
| 06:14:47 | <badkins> | Tela: I don't mind writing a ton of internal code, but I'd prefer to avoid the external facing stuff: relational db libraries, network protocols, foreign function interfaces, etc. |
| 06:15:28 | <quicksilver> | the haskell library situation is in a period of rapid growth |
| 06:15:38 | <quicksilver> | the rate of haskell library release in teh last 12 months has been impressive |
| 06:16:04 | <quicksilver> | http://hackage.haskell.org/packages/archive/pkg-list.html |
| 06:16:05 | <badkins> | Functional languages are getting a big boost, and I expect that to continue indefinitely. |
| 06:16:14 | <quicksilver> | (indeed, not everything is in that list but it's a good start) |
| 06:16:21 | <badkins> | 'hackage' what a great name :) |
| 06:16:47 | <Korollary> | There are a lot of perl modules that implement the same thing. Eventually, one of them wins out. It's a numbers game. |
| 06:18:36 | <badkins> | You guys have been helpful. Before I take off, any book recommendations? I think I'll pick up "The Haskell School of Expression". Any others that come highly recommended? |
| 06:19:32 | <Tela> | Not a book, but I had the biggest "clicking" moment when reading Write Your Own Scheme in 48 Hours |
| 06:19:40 | <Tela> | http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html |
| 06:19:43 | <lambdabot> | Title: Write Yourself a Scheme in 48 hours, http://tinyurl.com/l986o |
| 06:20:00 | <Pseudonym> | ?quote brain-dead |
| 06:20:00 | <lambdabot> | Pseudonym says: The Scheme programming language is optimised for writing small brain-dead tutorial compilers for. |
| 06:20:25 | <Tela> | I liked it as a Parsec example :) |
| 06:20:28 | <badkins> | Tela: thanks for the link |
| 06:21:08 | <badkins> | it's been del.icio.us'ified |
| 06:21:17 | <bos> | wow, we're almost to 2100 comments on the first 4 chapters of the book. |
| 06:21:53 | <sorear> | ACTION derived a great deal of enlightenment from The_Implementation_of_Functional_Programming_Languages, Simon Peyton-Jones, 1984; but I doubt it's "good for beginners" |
| 06:21:54 | <badkins> | ah, bos must be Bryan O'Sullivan - I'm in ur blog readin ur codz |
| 06:22:08 | <sorear> | badkins: /whois |
| 06:22:24 | <bos> | heh |
| 06:22:28 | <quicksilver> | badkins: I recommend Bryan's book when he's finished it :) |
| 06:22:40 | <Pseudonym> | sorear: Actually, that's the first book on functional programming that I read. |
| 06:22:47 | <quicksilver> | badkins: Huttons book programming in haskell comes highly recommended but it may be too basic for you :) |
| 06:23:02 | <badkins> | So can total newbies view the pages? |
| 06:23:09 | <Pseudonym> | No good for beginner programmers, perhaps, but I didn't understand lazy FP until I read it. |
| 06:23:24 | <bos> | badkins: not yet |
| 06:23:38 | <Pseudonym> | In fact, my first serious Orwell program (yes, Orwell) was a SK combinator compiler/interpreter. |
| 06:23:45 | <badkins> | np, with the amount of comments you're getting, you don't need more line noise :) |
| 06:23:48 | <sorear> | badkins: Of course they can. This isn't one of those things where the unworthy just see blank papaer. Anyone can read IFPL. |
| 06:24:12 | <Pseudonym> | And by "serious" I mean "non-assignment". |
| 06:24:25 | <sorear> | my first non-exercise Haskell program did symbolic differentiation |
| 06:25:07 | <Korollary> | Purely Functional Data Structures is also a good read. |
| 06:25:07 | <Pseudonym> | That's a good one. |
| 06:25:24 | <Pseudonym> | PFDS wasn't written in 1992 when I read SPJ's book. |
| 06:25:47 | <Tela> | My first one was the Text Munger Ruby Quiz. That was such a bad choice, heheh :) |
| 06:26:54 | <badkins> | quicksilver: I don't think a book on Haskell could be too basic for me at this point |
| 06:27:37 | <Pseudonym> | badkins: This is called a "keyboard". Don't be frightened by all the buttons! You don't need to press them all at once. |
| 06:27:47 | <quicksilver> | :) |
| 06:27:51 | <quicksilver> | actually you do |
| 06:28:03 | <quicksilver> | the secret omega-combinator is entered by hitting all the buttons at once |
| 06:28:16 | <Korollary> | SOE is good enough |
| 06:28:16 | <Tela> | or, if you use emacs |
| 06:28:22 | <Pseudonym> | Only if you need to type the hypothesised unicode replacement for function composition. |
| 06:28:36 | <Pseudonym> | Triple-bucky coke bottle, isn't it? |
| 06:28:46 | <badkins> | Pseudonym: huh? |
| 06:29:25 | <Pseudonym> | badkins: The snarky comment about function composition you don't need to worry about. |
| 06:29:27 | <Pseudonym> | However... |
| 06:29:36 | <Pseudonym> | http://catb.org/jargon/html/C/cokebottle.html |
| 06:29:38 | <lambdabot> | Title: cokebottle |
| 06:30:29 | <Pseudonym> | And the last comment in: http://catb.org/jargon/html/Q/quadruple-bucky.html |
| 06:30:29 | <lambdabot> | Title: quadruple bucky |
| 06:31:18 | <sorear> | badkins: seriously, think of Haskell as O'Caml but without the val/fun distinction, the rec/nonrec distinction, the value restriction, or the need for user-defined numeric functions to be monomorphic |
| 06:31:30 | <sorear> | badkins: the languages really are very similar |
| 06:31:42 | <Pseudonym> | i.e. O'Caml without the arbitrary restrictions. |
| 06:31:52 | <badkins> | sorear: thx, if I knew OCaml, that would be helpful I'm sure |
| 06:31:56 | <Pseudonym> | Which made some kind of sense in 1976. |
| 06:31:56 | <Tela> | Oh, and without that funky ;; |
| 06:32:02 | <quicksilver> | sorear: funnily enough the thing I like best is that constructors are first-class functions :) |
| 06:32:05 | <sorear> | badkins: oh, sorry, I thought you said you came from there |
| 06:32:09 | <badkins> | ;; is just in the repl, I know that much :) |
| 06:32:18 | <quicksilver> | sorear: I hate that in ocaml you can't do "map some" |
| 06:33:18 | <Tela> | badkins: I learned juust enough OCaml to realize that ;; is rare, but it's still just so striking that it's the first thing I see whenever I look at OCaml code |
| 06:33:30 | <dataangel> | How do I get the last two elements from a list? (take 2 $ reverse mylist) seems hackish, and (last mylist) only returns 1 item |
| 06:33:39 | <badkins> | Dr. Jon Harrop is reason enough for me to avoid OCaml ;) |
| 06:33:49 | <dibblego> | badkins, he's infiltrated Scala lately |
| 06:34:00 | <sjanssen> | quicksilver: that is interesting, when can you apply constructors? |
| 06:34:01 | <Korollary> | holy moly |
| 06:34:05 | <Mr_Awesome> | @src (->) loop |
| 06:34:05 | <lambdabot> | Source not found. Do you think like you type? |
| 06:34:17 | <Mr_Awesome> | the hell? |
| 06:34:48 | <badkins> | ?quote hell |
| 06:34:48 | <lambdabot> | puusorsa says: do not try this in a shell: :() { :&:; } ;: |
| 06:35:24 | <Korollary> | @src last |
| 06:35:25 | <lambdabot> | last [x] = x |
| 06:35:25 | <lambdabot> | last (_:xs) = last xs |
| 06:35:25 | <lambdabot> | last [] = undefined |
| 06:35:30 | <sjanssen> | dataangel: hackish: last $ zip xs (tail xs) -- will return the last two elements as a tuple |
| 06:35:45 | <quicksilver> | sjanssen: constructors are only applied to values |
| 06:36:00 | <quicksilver> | sjanssen: 'some 1' is fine and has type 'int option' |
| 06:36:09 | <quicksilver> | sjanssen: but 'some' is not a well-typed term in its own |
| 06:36:11 | <Mr_Awesome> | anyone happen to know offhand how loop is implemented for (->) ? |
| 06:36:35 | <sjanssen> | quicksilver: interesting, I wonder why they have that restriction |
| 06:36:56 | <quicksilver> | sjanssen: they've got constructors in a different syntax class from functions. I don't know why |
| 06:36:59 | <dataangel> | this is why I need to rewrite this to use an array type later ;p |
| 06:37:04 | <quicksilver> | you have to write "fn x => some x" |
| 06:37:06 | <quicksilver> | annoying |
| 06:37:22 | <quicksilver> | sjanssen: well, of course, I do know why, it's because they can appear in pattern matches ;) |
| 06:37:28 | <quicksilver> | sjanssen: but I don't know why they don't generalise |
| 06:37:39 | <Pseudonym> | > last . ap zip tail $ [1,2,3,4,5] |
| 06:37:41 | <lambdabot> | (4,5) |
| 06:37:52 | <quicksilver> | sjanssen: I used to define a constructor-function for each of my constructors. But that's boring. |
| 06:38:31 | <serishema> | ACTION wants to write a simple interpreter for a simple programming language |
| 06:38:45 | <sorear> | unlambda! |
| 06:38:45 | <serishema> | not sure how to go about doing it in haskell though |
| 06:38:51 | <serishema> | the lack of state is breaking my brain again. |
| 06:38:59 | <Korollary> | There's allegedly a write your own scheme guide in haskell. |
| 06:39:04 | <oerjan> | ACTION heard the word unlambda |
| 06:39:19 | <Pseudonym> | ACTION respectfully occurs to the "brain-dead" quote above |
| 06:39:23 | <Pseudonym> | refers, not occurs |
| 06:39:31 | <Korollary> | brain-dead, eh? |
| 06:39:32 | <dataangel> | I'd prefer to see a write your own C compiler in Haskell tutorial ;p |
| 06:39:37 | <Pseudonym> | ?quote brain-dead |
| 06:39:37 | <lambdabot> | Pseudonym says: The Scheme programming language is optimised for writing small brain-dead tutorial compilers for. |
| 06:40:13 | <Pseudonym> | In fact, a C compiler isn't a dumb idea. |
| 06:40:21 | <Pseudonym> | Something about as sophisticated as Allan Holub's book. |
| 06:40:28 | <serishema> | ACTION has written both interpters and compilers in C, but her brain just isn't getting around haskell today. |
| 06:40:37 | <Korollary> | baby steps |
| 06:41:04 | <ttfh> | serishema: maybe write a state-less interpreter first? then extend it with state |
| 06:41:31 | <lekro> | is there a function that separates lists like this: [1,2,3,4] -> [(1, [2,3,4]), (2, [1,3,4]), (3, [1,2,4]), (4, [1,2,3])] |
| 06:41:43 | <Pseudonym> | Half the problem is that the answer is probably easier in Haskell than in C. |
| 06:41:49 | <badkins> | "all lined up with the the first non-whitespace character after the do" bummer, I thought I left white space sensitivity behind with Python :( |
| 06:41:59 | <Pseudonym> | serishema: How simple is your language? |
| 06:42:05 | <dataangel> | lekro: that looks vaguely similar to List.inits but not the same thing |
| 06:42:15 | <TSC> | badkins: the layout-style is optional |
| 06:42:26 | <Pseudonym> | My first real interpreter in Haskell was for a subset of Lisp. Essentially an SECD machine. |
| 06:42:26 | <dataangel> | lekro: actually nm I misread your example, it's not even close ;p |
| 06:42:34 | <Pseudonym> | And it was about 20 lines not including parser. |
| 06:42:41 | <badkins> | TSC: ghc didn't think so :) |
| 06:43:09 | <TSC> | You have to use braces and semicolons instead |
| 06:43:09 | <badkins> | no biggy, gotta take the whole package |
| 06:43:17 | <TSC> | (like C) |
| 06:43:18 | <badkins> | like in C ? |
| 06:43:19 | <badkins> | :) |
| 06:43:24 | <Tela> | badkins do {x <- foo; y <- bar; return $ fn x y} |
| 06:43:31 | <oerjan> | lekro: i've heard that question before. here's my solution: |
| 06:44:19 | <Pseudonym> | ?whois serishema |
| 06:44:19 | <lambdabot> | Unknown command, try @list |
| 06:44:22 | <Pseudonym> | Whoops. |
| 06:44:24 | <oerjan> | > let extract l = [(x,bef++aft) | (bef,x:aft) <- zip (inits l) (tails l)] in extract [1,2,3,4] |
| 06:44:27 | <lambdabot> | [(1,[2,3,4]),(2,[1,3,4]),(3,[1,2,4]),(4,[1,2,3])] |
| 06:44:28 | <Pseudonym> | Ah, now I know! |
| 06:44:34 | <Pseudonym> | s/?/\// |
| 06:45:11 | <goalieca> | > 450! |
| 06:45:12 | <lambdabot> | parse error on input `}' |
| 06:45:34 | <lekro> | I thought it might be an idiom. Actually I'm trying to write a function that takes a list and generate a list of successors. A successor is defined as the original list with one element altered. But the elements don't have a meaningful Eq instance |
| 06:45:52 | <lekro> | oerjan: thanks, I'll have a look at this |
| 06:46:16 | <pjd> | ACTION wrote that one just recently |
| 06:46:29 | <pjd> | > zip <*> (zipWith (++) <$> inits <*> tail.tails) $ [1..4] |
| 06:46:31 | <lambdabot> | [(1,[2,3,4]),(2,[1,3,4]),(3,[1,2,4]),(4,[1,2,3])] |
| 06:46:36 | <lekro> | the order doesn't need to preserved for the successor |
| 06:46:42 | <lekro> | +be |
| 06:47:12 | <lekro> | ? <*> |
| 06:47:29 | <lekro> | oh, what was the syntax lambdabot likes |
| 06:48:03 | <pjd> | lekro: Control.Applicative |
| 06:48:08 | <lekro> | ?hoogle <*> |
| 06:48:08 | <lambdabot> | No matches found |
| 06:48:10 | <oerjan> | lekro: just use my (bef,x:aft) trick and do something different with the result |
| 06:49:13 | <oerjan> | lekro: hoogle is broken on * and $ |
| 06:49:35 | <dataangel> | after several hours of painstakingness, I have implemented an obscure recursive algorithm for checking if a given set of queen positions is valid for nqueens |
| 06:49:55 | <dataangel> | it handles the diagonal case without resorting to +/- 1 iterating ugliness |
| 06:50:00 | <pjd> | lekro: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Applicative.html |
| 06:50:02 | <lambdabot> | http://tinyurl.com/yyo64c |
| 06:50:50 | <pjd> | lekro: <$> and <*> is like fmap/liftM and ap, respectively |
| 06:50:54 | <pjd> | but nicer! |
| 06:51:07 | <badkins> | Wow, that "Write Yourself a Scheme in 48 Hours" tutorial looks great. Is Jonathan Tang now Audrey Tang (associated with pugs) ? |
| 06:53:55 | <Pseudonym> | badkins: Different person, I think. |
| 06:53:59 | <pjd> | lekro: that example is the (e ->) functor |
| 06:54:39 | <pjd> | each argument to <*> is a function of [1..4], which is like a shared environment |
| 06:55:00 | <Korollary> | badkins: why would you even think that?? |
| 06:55:25 | <quicksilver> | lekro: I'd write [(a,l\\[a]) | a <- l] |
| 06:55:41 | <quicksilver> | badkins: no, Audrey's name used to be Autrijus, not Jonathan :) |
| 06:55:57 | <badkins> | quicksilver: right, I should check wiki before posting in future :( |
| 06:56:06 | <pjd> | quicksilver: duplicates! |
| 06:56:14 | <badkins> | Korollary: How many Haskell experts with the last name of Tang do you know? |
| 06:56:27 | <badkins> | Korollary: it's a tiny community, no? |
| 06:56:33 | <lekro> | quicksilver: there can be duplicates in the list that must be considered both |
| 06:57:18 | <lekro> | also, testing for Eq can be quite expensive |
| 06:57:38 | <Pseudonym> | It's not that tiny any more. |
| 06:57:58 | <Korollary> | badkins: but why would you think that a Jonathan would become an Audrey somehow? |
| 06:58:39 | <badkins> | Korollary: Well, Autrijus (guy) became Audrey (girl) and is a well known Haskell hacker - not that big of a stretch |
| 06:59:41 | <lekro> | pjd: that's interesting. Do you know of a nice tutorial or introductory paper about those functions? |
| 06:59:48 | <badkins> | Pseudonym: tiny is relative. Try monster.com for 'Java', 'Python', 'Ruby', 'Lisp', 'Haskell' I'd say that might qualify as tiny :) |
| 07:00:01 | <pjd> | lekro: the paper is great |
| 07:00:21 | <badkins> | Korollary: speechless? :) |
| 07:00:45 | <Korollary> | badkins: if you know of Autrijus and Audrey, asking about Jonathan is again weird. |
| 07:00:45 | <pjd> | unfortunately, the "Write an applicative functor tutorial" craze hasn't quite taken off yet |
| 07:01:13 | <badkins> | Korollary: I didn't recall the guy's name since Audrey was the famous one |
| 07:01:14 | <lekro> | pjd: the paper seems to be gone |
| 07:01:21 | <Pseudonym> | badkins: "Community" is not the same as "job adverts on monster.com". |
| 07:01:29 | <Pseudonym> | I've never gotten a job from monster.com, even in C++. |
| 07:01:38 | <lekro> | I'm asking google right now if there's another place to find it |
| 07:01:42 | <roconnor> | applicative functors are obvious? |
| 07:01:53 | <Pseudonym> | People who post job adverts there don't want people who are smart enough to use Haskell. :-) |
| 07:02:03 | <roconnor> | ap :: A (a -> b) -> A a -> A b |
| 07:02:19 | <pjd> | lekro: oh dear! |
| 07:02:41 | <pjd> | well, Googling for the name turns up many other versions |
| 07:03:22 | <sjanssen> | > (\xs -> zip3 (inits xs) xs (drop 1 $ tails xs)) [1 .. 4] |
| 07:03:25 | <lambdabot> | [([],1,[2,3,4]),([1],2,[3,4]),([1,2],3,[4]),([1,2,3],4,[])] |
| 07:07:02 | <pjd> | > zip3 <$> inits <*> id <*> tail.tails $ [1..4] |
| 07:07:04 | <lambdabot> | [([],1,[2,3,4]),([1],2,[3,4]),([1,2],3,[4]),([1,2,3],4,[])] |
| 07:07:08 | <lekro> | pjd: I just remembered that I have online access to the Journal of Functional Programming. that's even easier :) |
| 07:07:42 | <newsham> | what's a "free monad"? |
| 07:09:22 | <opqdonut> | ?src nubBy |
| 07:09:23 | <lambdabot> | nubBy eq [] = [] |
| 07:09:23 | <lambdabot> | nubBy eq (x:xs) = x : nubBy eq (filter (\ y -> not (eq x y)) xs) |
| 07:10:25 | <pjd> | newsham: http://en.wikipedia.org/wiki/Free_object might or might not be relevant or helpful |
| 07:10:36 | <lekro> | what branch of mathematics do I have to learn more about to understand things like "Technically, a strong lax monoidal functor." Is it all category theory? |
| 07:11:24 | <pjd> | that sounds like category theory, yes |
| 07:12:49 | <hpaste> | sjanssen pasted "lekro's function" at http://hpaste.org/3197 |
| 07:14:17 | <hpaste> | sjanssen annotated "lekro's function" with "oops" at http://hpaste.org/3197#a1 |
| 07:17:11 | <lekro> | sjanssen: cool |
| 07:17:35 | <sjanssen> | @pl (\x xs ys -> (f x : xs) : map (x:) ys) |
| 07:17:35 | <lambdabot> | ap (flip . (((.) . (:)) .) . (:) . f) (map . (:)) |
| 07:17:56 | <lekro> | now I know by testing what it does, I'm still trying to grasp the why |
| 07:18:18 | <lekro> | that's a weird point-free form |
| 07:20:09 | <lekro> | I don't think I can use this for the assignment. Actually, the assignment was supposed to be written in Java but I want to demonstrate that Haskell is as good or better suited for this task (searching, A* etc). |
| 07:22:12 | <lekro> | I mean the point-free form would be useless. the paramorphism version could be just the thing I need, provided I fully understand it. |
| 07:22:35 | <sjanssen> | do you understand foldr? |
| 07:23:02 | <lekro> | I think so |
| 07:23:48 | <lekro> | it basically switches the : constructor with a given function and the [] at the end with the init argument |
| 07:24:03 | <lekro> | and it works with infinite lists |
| 07:24:26 | <sjanssen> | in 'foldr f', f gets the head and the accumulator (the transformed tail). In 'para f', f gets the head, the tail, and the accumulator |
| 07:25:26 | <lekro> | I see |
| 07:27:02 | <lekro> | I think I got it |
| 07:28:41 | <lekro> | is "paramorphism" a term from functional programming or is it from category theory, too? |
| 07:29:14 | <sjanssen> | lekro: category theory, apparently |
| 07:29:33 | <sior|sleep> | yeah, that's what wikipedia told me |
| 07:30:59 | <lekro> | well, the references in wikipedia to paramorphism are all computer science related |
| 07:31:31 | <sjanssen> | lekro: paramorphism is related to catamorphism, the list variant of which we call foldr |
| 07:32:54 | <ac> | foldr must iterate to the end of the list, so if possible foldl is better to use, right? |
| 07:33:11 | <oerjan> | ac: opposite |
| 07:33:13 | <sjanssen> | false |
| 07:33:30 | <sjanssen> | ac: foldr is the one with 'early exit' |
| 07:34:03 | <sjanssen> | > foldr (||) False $ repeat True |
| 07:34:05 | <lambdabot> | True |
| 07:34:11 | <sjanssen> | > foldl (||) False $ repeat True |
| 07:34:15 | <lambdabot> | Terminated |
| 07:34:25 | <pjd> | ac: the l and r in foldr/foldr are about their computational structure, not their order of evaluation |
| 07:35:35 | <sior|sleep> | ac: right and left refer to their associativity |
| 07:35:51 | <sjanssen> | lekro: http://citeseer.ist.psu.edu/meijer91functional.html has lots to say about the application of cata and para to FP |
| 07:35:53 | <lambdabot> | Title: Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire (Research ... |
| 07:39:14 | <ac> | does "foldl foo bar xs" == "foldl foo bar (reverse xs)"? |
| 07:39:28 | <ac> | (as long as the lists are finite) |
| 07:39:47 | <pjd> | nah |
| 07:39:58 | <oerjan> | with a flip foo perhaps |
| 07:40:16 | <oerjan> | no, wait |
| 07:40:23 | <sarehu> | foldr foo bar xs = foldl (flip foo) bar (reverse xs) |
| 07:40:31 | <roconnor> | 4^3903 |
| 07:40:31 | <newsham> | ac: did you mean one is foldl and the other foldr? |
| 07:40:35 | <roconnor> | > 4^3903 |
| 07:40:37 | <lambdabot> | 6920638318406398496710519232041580406680328127633078870148717405507236860495... |
| 07:40:53 | <ac> | newsham: no, I meant to type "foldl" twice |
| 07:40:58 | <roconnor> | > 3903*(logBase 10 4) |
| 07:41:00 | <lambdabot> | 2349.8401461530366 |
| 07:41:06 | <roconnor> | big number |
| 07:41:23 | <oerjan> | foldl1 foo xs = foldl1 (flip foo) (reverse xs) i think |
| 07:41:57 | <oerjan> | but the initial value would be at the wrong end |
| 07:42:03 | <ac> | that brings up another question for me: what's the difference between foldl and foldl1? |
| 07:42:29 | <wolverian> | the type |
| 07:42:46 | <oerjan> | @check \foo xs -> foldl1 (foo::Bool->Bool->Bool) xs == foldl1 (flip foo) (reverse xs) |
| 07:42:48 | <lambdabot> | Exception: Prelude.foldl1: empty list |
| 07:43:01 | <oerjan> | @check \foo xs -> not (null xs) ==> foldl1 (foo::Bool->Bool->Bool) xs == foldl1 (flip foo) (reverse xs) |
| 07:43:03 | <lambdabot> | Falsifiable, after 14 tests: <Bool -> Bool -> Bool>, [False,False,False,True... |
| 07:43:05 | <pjd> | by the way, you can visualize the grouping foldl and foldr as ((((0 1) 2) 3) ...) and (1 (2 (3 (...)))) |
| 07:43:20 | <oerjan> | darn |
| 07:43:33 | <ac> | > foldl (/) 1 (reverse [1,2,3,4]) |
| 07:43:34 | <lambdabot> | 4.1666666666666664e-2 |
| 07:43:38 | <ac> | > foldl (/) 1 ([1,2,3,4]) |
| 07:43:39 | <lambdabot> | 4.1666666666666664e-2 |
| 07:43:52 | <ac> | > foldl (flip (/)) 1 ([1,2,3,4]) |
| 07:43:53 | <lambdabot> | 2.6666666666666665 |
| 07:44:02 | <lekro> | > foldl (flip (:)) [] ([1,2,3]) |
| 07:44:03 | <lambdabot> | [3,2,1] |
| 07:44:06 | <lekro> | > foldl (flip (:)) [] (reverse [1,2,3]) |
| 07:44:07 | <lambdabot> | [1,2,3] |
| 07:44:44 | <ac> | > foldl (flip (:)) [] [1,2,3] |
| 07:44:45 | <lambdabot> | [3,2,1] |
| 07:44:48 | <newsham> | > foldl (\x y -> x*x+y) 3 [1,2,3] |
| 07:44:49 | <lambdabot> | 10407 |
| 07:44:51 | <newsham> | > foldl (\x y -> x*x+y) 3 [3,2,1] |
| 07:44:52 | <lambdabot> | 21317 |
| 07:44:59 | <ac> | I don't think you need to flip it |
| 07:45:07 | <lekro> | try it without flip |
| 07:45:07 | <pjd> | so, evaluating from the outside inwards, foldl "starts" at the end of the list, and foldr starts at the beginning |
| 07:45:08 | <newsham> | > foldl (\y x -> x*x+y) 3 [3,2,1] |
| 07:45:10 | <lambdabot> | 17 |
| 07:45:41 | <newsham> | qed. |
| 07:46:36 | <ac> | they're all three different |
| 07:47:12 | <newsham> | yes. therefore they're not the same. |
| 07:47:23 | <matthew-_> | yep, that last one doesn't square the accumulator |
| 07:48:18 | <newsham> | ?type foldl |
| 07:48:21 | <lambdabot> | forall a b. (a -> b -> a) -> a -> [b] -> a |
| 07:48:31 | <newsham> | also note you cant always flip the funcand get the same type |
| 07:48:47 | <newsham> | (so far funcs shown are all a->a->a) |
| 07:51:02 | <newsham> | > foldl (\x y -> ord y + x*x) 3 "test" |
| 07:51:04 | <lambdabot> | 1324162373 |
| 07:51:12 | <newsham> | > foldl (flip (\x y -> ord y + x*x)) 3 "test" |
| 07:51:13 | <lambdabot> | Couldn't match expected type `Char' against inferred type `Int' |
| 07:51:26 | <newsham> | > foldl (\x y -> ord y + x*x) 3 "tset" |
| 07:51:27 | <lambdabot> | 990182893 |
| 07:52:29 | <lekro> | cu and thank you all for your help |
| 07:54:33 | <EvilTerran> | @src foldl1 |
| 07:54:33 | <lambdabot> | foldl1 f (x:xs) = foldl f x xs |
| 07:54:33 | <lambdabot> | foldl1 _ [] = undefined |
| 07:54:58 | <newsham> | > foldl1 (+) [1,2,3] |
| 07:55:00 | <lambdabot> | 6 |
| 07:55:31 | <newsham> | no need to supply the operator's identity value |
| 07:55:46 | <EvilTerran> | although, in that case, it's better to use foldl' (+) 0, because that's the same for everything newsham's one does, and has the added bonus of being total |
| 07:55:48 | <ac> | yep. foldl1 is similar to reduce in Scheme |
| 07:55:57 | <newsham> | partial functions evil |
| 07:56:21 | <EvilTerran> | > foldl1 (+) [] |
| 07:56:24 | <lambdabot> | Exception: Prelude.foldl1: empty list |
| 07:56:25 | <chris00_297247> | see my naked ex on www.nackte-ex.de.gg <my revange! |
| 07:56:26 | <ac> | what's "partial"? |
| 07:56:27 | <EvilTerran> | > foldl (+) 0 [] |
| 07:56:28 | <lambdabot> | 0 |
| 07:57:47 | <pjd> | ac: "not defined for all parameters" |
| 07:57:58 | <newsham> | does "catch" catch those cases? (http://www.cs.york.ac.uk/fp/darcs/catch/catch.htm) |
| 07:57:59 | <lambdabot> | Title: Catch: A User Manual |
| 07:58:16 | <pjd> | ac: the empty list, in foldl1's case |
| 07:58:43 | <newsham> | ac: a partial function doesnt work for all possible inputs (given the allowable type) |
| 07:58:56 | <newsham> | a total function does. |
| 07:59:44 | <newsham> | you can use "Maybe" or other types of error reporting to make a total function that models a partial one |
| 08:00:44 | <newsham> | (ie. safeHead :: [a] -> Maybe a) |
| 08:04:31 | <roconnor> | at least when the domain of the function is decidable |
| 08:24:19 | <EvilTerran> | mandelbrotPointConvergesTo :: Complex Double -> Complex Double -- (kinda) undecidable domain |
| 08:33:47 | <quicksilver> | am I the only person who finds mod's behaviour with negative numbers stupid |
| 08:34:03 | <matthew-_> | try rem then |
| 08:34:12 | <quicksilver> | > (-4) `mod` 16 |
| 08:34:16 | <quicksilver> | > (-4) `rem` 16 |
| 08:34:16 | <lambdabot> | 12 |
| 08:34:18 | <lambdabot> | -4 |
| 08:34:20 | <sarehu> | > ((-2) `mod` 3, 2 `mod` (-3), (-2) `mod` (-3)) |
| 08:34:21 | <lambdabot> | (1,-1,-2) |
| 08:34:38 | <quicksilver> | that's odd, that's not what my ghci did |
| 08:34:53 | <quicksilver> | doh |
| 08:35:00 | <quicksilver> | bracketing error :P |
| 08:35:03 | <quicksilver> | ACTION slaps himself |
| 08:35:06 | <dmwit> | heh |
| 08:35:11 | <matthew-_> | ACTION helps out |
| 08:35:12 | <quicksilver> | mod does do what I expect, if I put the negative number in bracets |
| 08:35:43 | <quicksilver> | I wouldn't expect 'unary minus' to have lower precedence that `mod` though |
| 08:35:45 | <sieni> | > -4 `rem` 16 |
| 08:35:47 | <lambdabot> | -4 |
| 08:35:51 | <sieni> | oops |
| 08:35:54 | <sieni> | > -4 `mod` 16 |
| 08:35:56 | <lambdabot> | -4 |
| 08:35:59 | <quicksilver> | sieni: yeah, that's what I did |
| 08:36:07 | <sieni> | quicksilver: yeah I know, that has bitten me too :-) |
| 08:36:09 | <quicksilver> | I always expect unary minus to bind tight |
| 08:36:18 | <matthew-_> | you should have used the other minus - the unicode negative symbol |
| 08:37:02 | <osfameron> | yeah, haskell's unary minus is surprisingly loose |
| 08:37:29 | <sieni> | <insert a goatse related comment here> |
| 08:37:42 | <quicksilver> | <no please don't?> |
| 08:38:06 | <matthew-_> | <that's not a question> |
| 08:38:36 | <gvdm> | <let the conversational asides continue> |
| 08:38:45 | <hpaste> | nornagon pasted "Are these numbers really Gaussian?" at http://hpaste.org/3200 |
| 08:39:52 | <EvilTerran> | <insert the usual grumbles about unary minus> |
| 08:40:12 | <sieni> | http://yro.slashdot.org/comments.pl?sid=161505&threshold=1&commentsort=0&mode=thread&cid=13506813 |
| 08:40:15 | <lambdabot> | Title: Secretaries Sacked After Flamewar at Work, http://tinyurl.com/ysd8wf |
| 08:40:17 | <matthew-_> | <read the irc conversation> |
| 08:40:28 | <nornagon> | any statisticians care to comment on the above hpaste? :) |
| 08:40:36 | <yitz> | @go haskellwiki safe head |
| 08:40:39 | <lambdabot> | http://www.haskell.org/haskellwiki/Non-empty_list |
| 08:40:39 | <lambdabot> | Title: Non-empty list - HaskellWiki |
| 08:42:22 | <dmwit> | nornagon: Do you have a reason to suspect they are not Gaussian? |
| 08:42:40 | <opqdonut> | how do i drop every other element from a list? |
| 08:43:09 | <opqdonut> | (idiomatically= |
| 08:43:29 | <dmwit> | I don't think there's a good idiom. |
| 08:43:38 | <nornagon> | dmwit: well, my present ideas about whether or not they are is "They Kinda Look Like It" |
| 08:43:42 | <dmwit> | You could use the "chunks" thing that everybody is constantly writing. |
| 08:43:45 | <dmwit> | ACTION hunts for chunks |
| 08:43:52 | <opqdonut> | well, i'll go for mutually recursive i guess |
| 08:44:13 | <nornagon> | s/ideas/idea/ |
| 08:44:16 | <EvilTerran> | i've written evens and odds for such a purpose before |
| 08:44:19 | <opqdonut> | ehmm, even one recursive func works, of course |
| 08:44:44 | <EvilTerran> | evens [] = []; evens (x:xs) = x : odds xs; odds [] = []; odds (_:xs) = evens xs |
| 08:44:50 | <dmwit> | > filter (even . fst) . zipWith [1..] $ ["a","b","c"] |
| 08:44:58 | <quicksilver> | > map head . iterate (drop 2) $ [1..] |
| 08:44:58 | <lambdabot> | Couldn't match expected type `a -> b -> c' |
| 08:45:00 | <dmwit> | > filter (even . fst) . zip [1..] $ ["a","b","c"] |
| 08:45:04 | <lambdabot> | [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53... |
| 08:45:04 | <lambdabot> | [(2,"b")] |
| 08:45:31 | <dmwit> | > map snd . filter (even . fst) . zip [1..] $ ['a'..'m'] |
| 08:45:34 | <lambdabot> | "bdfhjl" |
| 08:46:30 | <quicksilver> | erm |
| 08:46:34 | <quicksilver> | what is wrong with mine? |
| 08:46:44 | <quicksilver> | > map head . iterate (drop 2) $ [1..] |
| 08:46:49 | <lambdabot> | [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53... |
| 08:46:58 | <quicksilver> | ah, the errors weren't lining up :) |
| 08:46:58 | <glguy> | quicksilver: only for streams? |
| 08:47:07 | <opqdonut> | nice one |
| 08:47:12 | <quicksilver> | well takeWhile (not null) then |
| 08:47:27 | <quicksilver> | using indices is horrible (no offence dmwit :P) |
| 08:47:33 | <yitz> | nornagon: IANAS, but I don't think so. But here is a quote from the source code of the random module in Python: |
| 08:47:49 | <dmwit> | quicksilver: I know. |
| 08:49:37 | <quicksilver> | by "what is wrong with mine" I didn't mean "why do the denizens of #haskell not like it", FWIW. I meant "why did lambdabot give an error?" :) |
| 08:49:43 | <quicksilver> | since it worked in my ghci |
| 08:49:48 | <quicksilver> | but I see they just didn't line up right |
| 08:49:57 | <yitz> | When x and y are two variables from [0, 1), uniformly |
| 08:49:57 | <yitz> | distributed, then |
| 08:49:58 | <yitz> | |
| 08:49:58 | <yitz> | cos(2*pi*x)*sqrt(-2*log(1-y)) |
| 08:49:58 | <yitz> | sin(2*pi*x)*sqrt(-2*log(1-y)) |
| 08:49:58 | <yitz> | |
| 08:50:00 | <yitz> | are two *independent* variables with normal distribution |
| 08:50:02 | <yitz> | (Lambert Meertens) |
| 08:50:12 | <nornagon> | yitz: i need it fast, with as few math calls as possible |
| 08:50:27 | <nornagon> | i'm thinking about an algorithm that will be running on the nintendo ds |
| 08:50:39 | <nornagon> | which is a handheld gaming system with no floating point |
| 08:50:49 | <nornagon> | it has fixed point maths functions, but they are sloooow |
| 08:51:50 | <yitz> | Again from random.py: "This is slightly faster than the normalvariate() function." (where they define a gaussian distr. in the usual way) |
| 08:52:16 | <yitz> | If you really want it to be Gaussian, I doubt you'll find anything better. |
| 08:52:35 | <dmwit> | You can do better if you're willing to lose a bit of Gaussian-ness. |
| 08:53:06 | <nornagon> | dmwit: yeah, i'm not too interested in statistical accuracy |
| 08:53:12 | <nornagon> | i just want something fast and Close Enough |
| 08:53:18 | <dmwit> | For example, if you have a random-int generator, just averaging a few such rands will give you something close-to-Gaussian. |
| 08:53:25 | <dmwit> | (where a few = 5 or 6) |
| 08:53:48 | <nornagon> | well, the pasted code was that for few = 2 |
| 08:54:08 | <dmwit> | nornagon: Aha. For a few = 2, what you will get is the "triangle" distribution. |
| 08:54:23 | <dmwit> | Not particularly Gaussian, but not a terrible approximation, either. |
| 08:55:02 | <opqdonut> | ygh, what was the syntax for cost-centre annotations again? |
| 08:55:12 | <nornagon> | dmwit: ah, so it is a triangle distribution |
| 08:55:24 | <nornagon> | it looks much better for few = 4 |
| 08:55:26 | <dmwit> | nornagon: Yes, it is the convolution of the uniform distribution with itself. |
| 08:55:27 | <nornagon> | thanks :) |
| 08:55:38 | <dmwit> | Each time you increase "a few", you convolve it with the uniform distribution again. |
| 08:57:40 | <nornagon> | two is really the maximum i can do due to the fact that my random numbers are in [0,MAX_INT32] |
| 08:58:07 | <dmwit> | nornagon: So divide *before* you add. ;-) |
| 08:58:16 | <nornagon> | that's a good point >.> |
| 08:59:45 | <nornagon> | thanks :) |
| 08:59:50 | <dmwit> | g'luck |
| 09:03:17 | <hpaste> | blarz pasted "xmonad build error" at http://hpaste.org/3201 |
| 09:03:35 | <blarz> | oh... wrong channel announce :) |
| 09:06:05 | <roconnor> | we could upload the haskell workshop videos to this new geektorrent thingy |
| 09:08:17 | <exDM69> | roconnor: what are the haskell workshop videos? |
| 09:08:33 | <exDM69> | something other than the Simon Peyton-Jones videos? |
| 09:08:49 | <exDM69> | is there any newbie-friendly material there? |
| 09:09:47 | <roconnor> | http://www.ludd.ltu.se/~pj/hw2007/HaskellWorkshop.html |
| 09:09:50 | <lambdabot> | Title: Haskell Workshop 2007 - List of Accepted Papers |
| 09:10:53 | <roconnor> | not sure if that is newbie oriented |
| 09:11:04 | <roconnor> | ACTION needs to restart X |
| 09:12:39 | <exDM69> | the modular synthesizer sounds intresting |
| 09:20:39 | <dmwit> | ?keal+ a planck curve is simply a logarithmic curve multiplied by a bell curve |
| 09:20:40 | <lambdabot> | my proof show math is broken right now |
| 09:20:47 | <dmwit> | shucks |
| 09:21:19 | <yitz> | @let evens = concatMap (drop 1) . takeWhile (not.null) . evalState (sequence $ repeat $ State (splitAt 2)) |
| 09:21:20 | <lambdabot> | <local>:4:0: Multiple declarations of `L.evens' Declared at: <local>:... |
| 09:21:31 | <yitz> | @undefine |
| 09:21:33 | <lambdabot> | Undefined. |
| 09:21:41 | <yitz> | @let evens = concatMap (drop 1) . takeWhile (not.null) . evalState (sequence $ repeat $ State (splitAt 2)) |
| 09:21:43 | <lambdabot> | Defined. |
| 09:21:52 | <yitz> | > evens [1..40] |
| 09:21:54 | <lambdabot> | [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40] |
| 09:24:06 | <roconnor> | @keal |
| 09:24:07 | <lambdabot> | Keal was so happy with T, coded in basic so run on anything, and does lot |
| 09:24:59 | <pjd> | yitz: nice |
| 09:25:12 | <dmwit> | I wish I felt comfortable pasting the whispers I've been getting. |
| 09:25:16 | <dmwit> | They're comedic gold. |
| 09:25:38 | <roconnor> | dmwit: you hear voices? |
| 09:25:55 | <dmwit> | That's one way of putting it. =) |
| 09:29:56 | <roconnor> | swiert: I heard your paper on the theory of patches wasn't accepted anywhere :( |
| 09:38:24 | <swiert> | roconnor: Yep. |
| 09:38:40 | <swiert> | In hind sight, this may have been a good thing. |
| 09:38:46 | <pjd> | philistines! |
| 09:38:48 | <swiert> | I'm not entirely pleased with it as it stands. |
| 09:39:38 | <swiert> | We do want to resubmit somewhere, but we're not entirely sure what to do with it. |
| 09:40:01 | <roconnor> | swiert: It looked nice to me. |
| 09:40:05 | <gour> | swiert: for darcs? |
| 09:40:17 | <roconnor> | I figured it would make a good reference for a smart editor |
| 09:40:19 | <swiert> | gour: for version control in general. |
| 09:40:34 | <roconnor> | I pointed vincenz to it for their collabrative editor project |
| 09:40:39 | <gour> | swiert: ahh, what do you think about darcs-2 ? |
| 09:41:37 | <swiert> | roconnor: I think we need to tone down the intro and discuss more related work. I'm also not entirely happy with formulating everything in terms of set manipulations. |
| 09:41:53 | <swiert> | It'd be nicer if there was some more abstract, logical characterization of what's going on. |
| 09:42:07 | <swiert> | gour: I haven't looked into darcs-2 too much to be honest. |
| 09:42:37 | <swiert> | gour: But I'm not terribly fond of their notion of commuting patches. |
| 09:43:00 | <ttfh> | exDM69: modular synths are fun, I have played with spiralsynth, usually you end up with a sound completely different from what you intended |
| 09:43:17 | <gour> | swiert: hmm, droundy is pushing some conflictor's code into unstable...let's see |
| 09:43:31 | <swiert> | gour: Oh - I'm definitely interested. |
| 09:43:33 | <ttfh> | exDM69: modular synths are fun, I have played with spiralsynth, usually you end up with a sound completely different from what you intended |
| 09:44:05 | <swiert> | jdagit is writing something up for the next TMR about darcs - that's certainly interesting. |
| 09:44:08 | <exDM69> | ttfh: I have written a modular synth with x86 assembly |
| 09:44:17 | <gour> | swiert: Heffalump is doing some testing...i hope something will come out so i don't need to move to hg for next project |
| 09:45:21 | <gour> | swiert: i read few days ago a hg book, but think darcs (by fixing exponential growth) is still very cool rcs |
| 09:45:34 | <exDM69> | ttfh: it was about 1.5 kilobytes in size. it had 2 tone generators, fm/am/ring modulation, ADSR, IIR hi/lo/bandpass/etc filter, a mixer and a delay loop echo |
| 09:45:52 | <swiert> | gour: hg? |
| 09:45:52 | <exDM69> | it was a very fun project, I wish I find the time to finish the project |
| 09:45:58 | <gour> | swiert: mercurial |
| 09:46:32 | <swiert> | ah. yes. |
| 09:46:36 | <gour> | swiert: are you aware of some newer talk about patch algebra than fosdem2006 listed at http://wiki.darcs.net/DarcsWiki/Talks ? |
| 09:46:37 | <lambdabot> | Title: Talks - DarcsWiki |
| 09:48:37 | <swiert> | gour: No thanks for the link. |
| 09:49:16 | <swiert> | gour: There's some punctuation missing in that sentence. |
| 09:50:00 | <gour> | which one? |
| 09:51:30 | <swiert> | I meant "No. Thanks for the link" instead of not thanking you. |
| 09:52:12 | <gour> | ok,i got it |
| 10:15:36 | <quicksilver> | swiert: I'm pleased to hear you don't trust commuting patches |
| 10:15:43 | <quicksilver> | swiert: I think it's a totally flawed idea :) |
| 10:16:06 | <quicksilver> | swiert: you can't tell if two patches commute unless you have a complete, decidable, operational semantics for the language... |
| 10:16:28 | <quicksilver> | s/operational/denotational/ I mean |
| 10:18:15 | <doserj> | but you can tell when they do not commute |
| 10:18:17 | <pjd> | amen to that |
| 10:19:05 | <pjd> | (...to swiert/quicksilver) |
| 10:25:49 | <SamB_XP> | quicksilver: sometimes you don't care THAT much |
| 10:26:22 | <SamB_XP> | what does it mean for two patches to commute anyway? |
| 10:39:10 | <swiert> | quicksilver: I'm not opposed to the idea of two patches commuting - that's not too strange. |
| 10:39:45 | <swiert> | quicksilver: I just don't like the way darcs proposes that commuting patches p . q results in q' . p' somehow. |
| 10:40:17 | <swiert> | i.e. forcing patches to commute, even if this may change their behaviour. |
| 10:42:03 | <roconnor> | swiert: the patches form a groupoid right? |
| 10:42:15 | <swiert> | roconnor: Yes - I think so. |
| 10:42:29 | <roconnor> | that is the reason for the primes? |
| 10:42:42 | <swiert> | Oh - no this is darcs patches I'm talking about. |
| 10:43:07 | <swiert> | IIRC, in darcs you can always commute a patch through other patches. |
| 10:43:20 | <roconnor> | what does commuting mean in a groupoid? |
| 10:44:15 | <swiert> | That's my objection to how darcs does things. |
| 10:45:06 | <swiert> | If you have patches p : A -> B and q : B -> C, it tries to find patches p' : A -> B' and q' : B' -> C. |
| 10:45:46 | <swiert> | But it underspecifies what p' and q' should actually do, besides the obvious condition that q . p = q' . p' |
| 10:46:27 | <roconnor> | right, there could be lots of q' and p' that work. |
| 10:46:37 | <swiert> | Exactly - but which one do you choose? |
| 10:46:52 | <swiert> | It's a bit like factoring numbers. |
| 10:46:55 | <roconnor> | we should just throw away the context and make a group |
| 10:47:04 | <roconnor> | then we can have commuting elementes :) |
| 10:47:39 | <roconnor> | Is the theory of groupoids well studies. I've only encountered it once in homotopy |
| 10:48:04 | <roconnor> | s/studies/studied/ |
| 10:48:18 | <roconnor> | s/./?/ |
| 10:48:31 | <swiert> | If you have the product of p * q, how do you factor out a q' and p'? It only works if p and q are relatively prime themselves. This (very roughly) corresponds to the condition we have on commuting patches: two patches only commute if they are entirely independent. |
| 10:48:49 | <swiert> | I only know Martin Hofmann's groupoid model of type theory. |
| 10:49:06 | <swiert> | And I've seen the term pop up in some category theory books... |
| 10:49:17 | <roconnor> | swiert: curves in a manifold form a groupoid, with the endpoints being the context |
| 10:49:32 | <roconnor> | and multiplication being concatination |
| 10:50:11 | <swiert> | Right. I think I can see how that works. |
| 10:50:47 | <roconnor> | (actually the elements are curves moduldo continuous deformation) |
| 10:51:46 | <quicksilver> | yes, and surfaces have a fundamental groupoid, don't though? |
| 10:52:14 | <quicksilver> | which is that under some sensible equivalence relation, or something |
| 10:52:23 | <quicksilver> | ACTION should probably check some reference works in case he's talking rubbish |
| 10:52:27 | <osfameron> | patches are curves? |
| 10:52:29 | <osfameron> | ACTION faints |
| 10:57:16 | <roconnor> | osfameron: better to say that patches can be represented as curves :P |
| 10:58:09 | <roconnor> | swiert: do you undersand what the endpoints of the groupoid types (the phantom types) are supposed to represent? |
| 10:58:31 | <roconnor> | I always think of them as contexts, but I don't know exactly what is included in the context |
| 10:58:58 | <roconnor> | are two contexts equal if they generate the same project? |
| 10:59:11 | <swiert> | roconnor: I'd say repository states. |
| 10:59:26 | <roconnor> | ok, I guess that is most natural |
| 11:01:00 | <swiert> | lunch. Bbl. |
| 11:03:41 | <ivanm> | @ask LoganCapaldo is that your meta-meta blog? If so, just found your church-code post... very nice! |
| 11:03:42 | <lambdabot> | Consider it noted. |
| 11:05:03 | <ADEpt> | Hi all. I have a question about combining two State monads in a single monadic code block. I read http://www.haskell.org/haskellwiki/Merging_ST_threads and I wonder if there are any other options? |
| 11:05:04 | <lambdabot> | Title: Merging ST threads - HaskellWiki |
| 11:05:22 | <int-e> | do you mean State or ST? |
| 11:05:46 | <ADEpt> | int-e: State |
| 11:07:34 | <int-e> | the embedState1 / embedState2 approach seems to be the right one to me. |
| 11:08:33 | <quicksilver> | that wiki page is poorly named |
| 11:08:47 | <quicksilver> | since it's not mostly about that :P |
| 11:09:14 | <quicksilver> | ADEpt: if it's something you do rather often, you can write a typeclass to make it all magically work |
| 11:09:22 | <ADEpt> | int-e: thing is, i have a statefull "processor" and a statefull "output generator", and I want to use them both simultaneously. So there is no nice decoupling into start/intermediate/end computations for me ... ANd lots of lift's still look ugly :( |
| 11:09:45 | <ADEpt> | quicksilver: I might be a little dense :( How do you propose to use a typeclass? |
| 11:10:36 | <quicksilver> | class MonadContainsState m s where { mcs_get :: m s; mcs_put :: s -> m () } |
| 11:11:05 | <ADEpt> | quicksilver: wouldnt that be a roll-your-own StateT? |
| 11:11:18 | <quicksilver> | no, it's a typeclass not a type :) |
| 11:11:37 | <quicksilver> | it's syntactically identical to MonadState m s though *except* it doesn't contain the fundep |
| 11:11:37 | <int-e> | or almost equivalently, class ParserState s where <methods to access and modify the parser's state which is part of s> |
| 11:11:43 | <quicksilver> | which is the whole point |
| 11:11:57 | <quicksilver> | because one Monad m might contain two different states , s and s' |
| 11:12:02 | <quicksilver> | as in your case it does |
| 11:12:48 | <ADEpt> | quicksilver: ah. and then I define both my State's to be and instance of this typeclass and ... I guess I see it now :) |
| 11:12:55 | <ADEpt> | s/and/an |
| 11:13:03 | <quicksilver> | ADEpt: I will spend five minutes trying to write a simple example for you. Let's see if that's long enough :) |
| 11:13:17 | <ADEpt> | quicksilver: thanks a lot! |
| 11:18:40 | <ttfh> | There's probably something I'm missing here, why use two state monads? couldn't you just put the two states in one? |
| 11:19:27 | <quicksilver> | encapsulation |
| 11:19:33 | <quicksilver> | giving the right type to the right code |
| 11:19:53 | <quicksilver> | ADEpt: ok it's taking more than five minutes, I'm more rsuty on this than I hoped. I'll get there though |
| 11:20:20 | <roconnor> | Shouldn't you make your own monad classes? |
| 11:20:36 | <quicksilver> | yes |
| 11:20:38 | <roconnor> | then build a state monad with both states |
| 11:20:46 | <roconnor> | and implement yout two monad classes |
| 11:20:49 | <quicksilver> | your own monad classes is the way to do it |
| 11:20:53 | <roconnor> | so you get the abstraction you want |
| 11:21:04 | <int-e> | I like quicksilver's class. |
| 11:21:54 | <ADEpt> | roconnor: point is, i dont need any "fancy" abstraction. I just want to be able to "get"/"modify" two different states, that's all. |
| 11:23:25 | <ttfh> | but isn't the simplest way to just put your states in a pair, and then you just look at one of them at a time and leave the other alone? |
| 11:23:51 | <quicksilver> | ttfh: yes, but that gives the wrong type to your smaller actions |
| 11:24:02 | <quicksilver> | you want to declare in the type 'this action only uses the processor state' |
| 11:24:12 | <quicksilver> | that's a more accurate type definition and makes the code more modular and more resuable |
| 11:24:13 | <int-e> | and it'll be horrible to modify your code if you need a triple at some later time. |
| 11:24:46 | <ttfh> | quicksilver: so you make two typeclasses, and then make your state monad an instance of both? |
| 11:25:11 | <ADEpt> | ttfh: no, 1 typeclass, as fara s I understand |
| 11:27:58 | <roconnor> | ADEpt: Two state monads distribute over each other. DistributeState :: StateMonad s1 (StateMonad s2 a) -> (StateMonad s2 (StateMonad s1)) or something like that |
| 11:28:18 | <roconnor> | Perhaps you could use that. not sure if that is a good idea or not. |
| 11:29:15 | <ADEpt> | roconnor: hmmmm.... how would "do modify (\state1 -> ...); modify (\state2 -> ...);" look like? |
| 11:30:50 | <roconnor> | something like do (distributeState (modify (\state1 ->...))); modify (\state2 -> ...) I thnk |
| 11:31:16 | <roconnor> | or distributeState would go on the other command |
| 11:31:27 | <roconnor> | depening on which type you want the whole thing to have. |
| 11:32:17 | <ttfh> | so something like: getState1 :: HasState1 m => m a ? |
| 11:32:35 | <ADEpt> | roconnor: that would be a "lift" in disguise, right? :) |
| 11:32:56 | <roconnor> | ADEpt: I'm not sure. It doesn't immediately strike me as the same thing. |
| 11:33:25 | <roconnor> | ADEpt: I was introduced to distributive monads recently, so now I just look for places to apply them :P |
| 11:34:03 | <roconnor> | lift gives you access to the inner monad |
| 11:34:10 | <roconnor> | while distrib exchanges the monads. |
| 11:35:13 | <roconnor> | so inside your distributeState call you can use distributeState again to get back to the original state. |
| 11:35:17 | <roconnor> | I think. |
| 11:35:46 | <int-e> | :t \f -> get >>= \s -> lift (runStateT f s) >>= \(a, s') -> put s' >> return a |
| 11:35:48 | <lambdabot> | forall a (m :: * -> *) a1 (t :: (* -> *) -> * -> *). (MonadTrans t, Monad m, MonadState a (t m)) => StateT a m a1 -> t m a1 |
| 11:44:11 | <hpaste> | quicksilver pasted "combining two state monads" at http://hpaste.org/3202 |
| 11:44:24 | <dcoutts_> | @seen bringert |
| 11:44:25 | <lambdabot> | I saw bringert leaving #haskell 24m 42s ago, and . |
| 11:44:25 | <quicksilver> | ttfh: well, that was lousy. 30 mins instead of 5 |
| 11:44:39 | <quicksilver> | ttfh: this seemed so easy last time I did it but I kept getting bitten by syntax this time :) |
| 11:44:57 | <ADEpt> | ACTION loads the page |
| 11:45:12 | <quicksilver> | ADEpt: :) |
| 11:45:27 | <dcoutts_> | @tell bringert I've made the zlib package bundle the zlib C code on windows, so we could actually use the zlib package in cabal-install (either as a dep or bundled) |
| 11:45:28 | <lambdabot> | Consider it noted. |
| 11:45:31 | <ttfh> | I am interested too :-) |
| 11:45:31 | <quicksilver> | ADEpt: anyhow the "point" is that I didn't have to lift 'count' or 'getname' |
| 11:45:45 | <dcoutts_> | dons: you might be interested in that same point |
| 11:45:45 | <quicksilver> | ADEpt: count, getname, and setname all auto-lifted themselves |
| 11:46:14 | <quicksilver> | ADEpt: the fact I had to explicitly lift putStrLn is a wart in the standard library, in my opinion |
| 11:46:30 | <roconnor> | quicksilver: that is moderately pleasent |
| 11:46:45 | <dcoutts_> | dons: I did basically the same as you did for that simple compression lib, just list all the C code in c-sources and let cabal build it |
| 11:47:01 | <quicksilver> | roconnor: it would be a lot nicer if you did import Prelude hiding(putStrLn); putStrLn = liftIO Prelude.putStrLn, too |
| 11:47:08 | <dcoutts_> | so that means we have a solution to the cabal tar gz issue on windows |
| 11:48:04 | <quicksilver> | ADEpt: what's nice is you end up with types which reflect the real constraints |
| 11:48:18 | <ttfh> | quicksilver: that looks a bit like Control.Monad.State.Class |
| 11:48:29 | <quicksilver> | ADEpt: so the type for 'combined' says "this action does IO, and it accesses the Int State and the String State" |
| 11:48:44 | <quicksilver> | ADEpt: but you can have other actions whose type indications they only do a subset of those things |
| 11:48:52 | <quicksilver> | ttfh: yes, it's the same class with the fundep removed :) |
| 11:49:09 | <quicksilver> | ttfh: and I didn't bother to write modify or whatever it's called |
| 11:49:43 | <ADEpt> | ACTION tries to apply this to his code |
| 11:49:47 | <ttfh> | quicksilver: Mmm, I don't understand fundeps yet :-( but I think I understand your example |
| 11:49:49 | <int-e> | mc_modify f = mc_put . f =<< mc_get |
| 11:49:57 | <quicksilver> | right, it's not hard :) |
| 11:50:06 | <quicksilver> | ttfh: the fundep restricts you to at most one 's' per 'm' |
| 11:50:14 | <quicksilver> | ttfh: which is exactly the constraint we're trying to escape here |
| 11:50:36 | <roconnor> | ACTION doesn't see any fundeps |
| 11:50:37 | <quicksilver> | incidentally if you had the situation where 'both' states were Ints, you'd have to newtype one or both |
| 11:50:41 | <quicksilver> | but that's not a bad idea |
| 11:50:49 | <quicksilver> | roconnor: the fundep in Control.Monad.State.Class |
| 11:50:53 | <int-e> | roconnor: the MonadState class has one |
| 11:51:08 | <roconnor> | yes |
| 11:51:15 | <quicksilver> | that's the one I'm talking about :) |
| 11:51:26 | <roconnor> | ah |
| 11:51:36 | <quicksilver> | MonadContains is MonadState without the fundep |
| 11:51:38 | <ttfh> | quicksilver: I don't quite understand, my state monad can only be an instance of one MonadState? |
| 11:51:42 | <quicksilver> | ttfh: yes |
| 11:51:48 | <quicksilver> | ttfh: that's precisely what the fundep says |
| 11:52:00 | <quicksilver> | ttfh: but yoru state monad can be as many instances of MonadContains as you want |
| 11:52:06 | <roconnor> | will haskell prime allow all IO commands to run in an arbitrary MonadIO? |
| 11:52:06 | <quicksilver> | well one per type |
| 11:52:12 | <quicksilver> | but with newtypes, you can do as many as you want |
| 11:52:16 | <quicksilver> | roconnor: I believe not. Shame. |
| 11:52:23 | <ttfh> | when would it be usefull with that extra restriction? |
| 11:52:27 | <roconnor> | oh well. |
| 11:52:35 | <roconnor> | not the biggest problem with Haskell 98 |
| 11:52:39 | <quicksilver> | ttfh: stops you needing type annotations in the simple case |
| 11:52:48 | <int-e> | ttfh: it helps the type checker. say if you write get >>= put |
| 11:52:59 | <ttfh> | I see |
| 11:53:15 | <quicksilver> | int-e: can you (or anyone else) explain why I needed the explicit signature on (v::Int) ? |
| 11:53:16 | <int-e> | ttfh: then the type checker can infer the type of the extracted state from the monad alone. |
| 11:53:44 | <quicksilver> | ah, I know the answer |
| 11:53:49 | <quicksilver> | damn |
| 11:53:56 | <int-e> | it's what I just said. |
| 11:53:57 | <quicksilver> | it might be mc_put from a different MonadContains instance |
| 11:53:59 | <quicksilver> | yes |
| 11:54:00 | <quicksilver> | :) |
| 11:54:08 | <quicksilver> | asking the question made me see the answer |
| 11:54:13 | <int-e> | @type 1 |
| 11:54:15 | <lambdabot> | forall t. (Num t) => t |
| 11:55:50 | <oerjan> | @kind 1 |
| 11:55:53 | <lambdabot> | * |
| 11:56:13 | <int-e> | @kind "" |
| 11:56:15 | <lambdabot> | parse error on input `"' |
| 11:56:22 | <int-e> | oerjan: how does that work? |
| 11:56:47 | <int-e> | @type undefined :: 12 |
| 11:56:49 | <lambdabot> | Only unit numeric type pattern is valid |
| 11:56:58 | <int-e> | @type undefined :: 1 |
| 11:57:00 | <lambdabot> | 1 :: GHC.Base.Unit |
| 11:57:10 | <int-e> | hack! |
| 11:57:19 | <ADEpt> | quicksilver: Am I right that your idea could not be done with State, only with StateT? |
| 11:57:28 | <balodja> | @type [] |
| 11:57:30 | <lambdabot> | forall a. [a] |
| 11:57:52 | <quicksilver> | ADEpt: no, it works for State |
| 11:58:07 | <quicksilver> | ADEpt: the general recipe is that your 'smaller' actions become polymorphic |
| 11:58:11 | <yaw> | hello |
| 11:58:31 | <quicksilver> | ADEpt: so where, currently, you have "foo :: State ProcessorState a" |
| 11:58:42 | <balodja> | @kind [] |
| 11:58:44 | <lambdabot> | * -> * |
| 11:58:51 | <quicksilver> | ADEpt: that becomes "foo :: (MonadContains m ProcessorState) => m a" |
| 11:58:59 | <int-e> | ADEpt: you can provide instances instance MonadContains (State (Int, String)) Int where and the same for String. |
| 11:59:19 | <quicksilver> | ADEpt: so instead of restricting foo to run in State ProcessorState precisely, you permit foo to run in 'Any monad m which has a processor state" |
| 11:59:27 | <quicksilver> | ADEpt: similarly with your other state |
| 12:00:23 | <yaw> | Hi there, I'm having trouble building yhc, is this an appropriate place to ask for help? |
| 12:01:02 | <swiert> | yaw: ndm (Neil Mitchell) hangs out here. He should be able to give you advice. |
| 12:01:11 | <int-e> | @seen ndm |
| 12:01:11 | <lambdabot> | I saw ndm leaving #haskell 16h 20m 12s ago, and . |
| 12:01:50 | <swiert> | yaw: but feel free to ask away. There might be people who can help. |
| 12:02:02 | <quicksilver> | ADEpt: then, in the end you provide the MonadContains instances for whatever combined monad you decide to use |
| 12:02:07 | <yaw> | thanks :) |
| 12:02:16 | <quicksilver> | ADEpt: but later you can provide instances for some other monad if you want and it still works :) Magic! |
| 12:02:38 | <quicksilver> | int-e, roconnor: did you happen to read my post on tunelling monads in the -cafe a few months back? that's related. |
| 12:02:52 | <ADEpt> | ACTION is completely lost already :) |
| 12:03:08 | <ADEpt> | and typechecker doesn't help any in this refactoring :) |
| 12:03:30 | <yaw> | basically, i've installed the dependencies, (it appears), but when i go "scons build" i get "Not in scope: 'strip'" in Front.hs |
| 12:03:39 | <yaw> | for building yhc |
| 12:03:54 | <yaw> | going off http://haskell.org/haskellwiki/Yhc/Building |
| 12:03:55 | <lambdabot> | Title: Yhc/Building - HaskellWiki |
| 12:04:42 | <quicksilver> | ADEpt: if you paste a small fragment with a couple of simple examples of your code, then I may be able to guide you in the right direction |
| 12:10:02 | <int-e> | quicksilver: I don't remember. But type classes and a newtype or two should help with that. |
| 12:10:28 | <quicksilver> | int-e: it does, yes, and I showed a possible solution |
| 12:10:47 | <quicksilver> | int-e: I'm surprised that more people aren't hitting these problems and there aren't more solutions out there |
| 12:10:59 | <quicksilver> | Either people have a larger tolerance to manual lfting than I do |
| 12:11:06 | <hpaste> | ADEpt pasted "trying to merge two State's" at http://hpaste.org/3203 |
| 12:11:11 | <quicksilver> | or people just aren't writing much disciplined monadic code |
| 12:11:34 | <ADEpt> | quicksilver: here. I trimmed as much as possible :) |
| 12:13:07 | <roconnor> | quicksilver: I don't read -cafe |
| 12:13:08 | <quicksilver> | ADEpt: best thing to do is to make correctly typed versions of modify, gets and whatever else you use frequently |
| 12:13:40 | <mux> | hi there |
| 12:13:56 | <ADEpt> | quicksilver: as in "make them methods of MonadContains"? |
| 12:14:13 | <quicksilver> | ADEpt: no, I'll give an example |
| 12:14:31 | <roconnor> | quicksilver: I was refered to http://www.mail-archive.com/haskell-cafe@haskell.org/msg04654.html |
| 12:14:33 | <lambdabot> | Title: Re: [Haskell-cafe] Switching monadic encapsulations, http://tinyurl.com/2283e4 |
| 12:15:26 | <int-e> | quicksilver: I'm aware of the problems but they didn't seem very hard. One level of lifting is usually okay, and for more levels you make a helper or a type class. Those helpers come in various shapes but they aren't really difficult, IMHO. |
| 12:16:00 | <quicksilver> | int-e: no, they're not very hard. I agree. But not much is written about them... |
| 12:16:16 | <quicksilver> | ADEpt: you probably do want to write mc_modify, as int-e suggested |
| 12:16:26 | <quicksilver> | ah |
| 12:16:41 | <hpaste> | ADEpt annotated "trying to merge two State's" with "well, for starters I got types of mc_get and mc_put wrong" at http://hpaste.org/3203#a1 |
| 12:16:48 | <quicksilver> | yeah |
| 12:16:51 | <quicksilver> | I just noticed that :) |
| 12:18:03 | <quicksilver> | you could write mc_modify f = do { v <- mc_get; mc_put (f v) } |
| 12:18:09 | <quicksilver> | just for convenience |
| 12:18:32 | <quicksilver> | but give it the right type (MonadContains m s) => (s -> s) -> m () |
| 12:18:40 | <mux> | what's this MonadContains stuff? |
| 12:18:48 | <quicksilver> | then you write specialisations of that where you fix the state type |
| 12:19:07 | <quicksilver> | so, you write diagramS_modify = mc_modify |
| 12:19:26 | <quicksilver> | but give it the type (MonadContains m DiagramS) => (DiagramS -> DiagramS) -> m () |
| 12:19:58 | <quicksilver> | then, you can just change 'setStep' to use diagramS_modify instead of modify, and it will have the right type |
| 12:20:00 | <int-e> | and you can write mc_gets f = liftM f mc_get (or mc_gets f = do s <- mc_get; return (f s)) |
| 12:20:47 | <quicksilver> | mux: http://hpaste.org/3202 |
| 12:20:59 | <quicksilver> | mux: ADEpt was asking how to combine two state monads into one big one |
| 12:21:08 | <mux> | I see |
| 12:21:17 | <mux> | interesting :-) |
| 12:21:19 | <quicksilver> | int-e, roconnor: http://www.haskell.org/pipermail/haskell-cafe/2007-July/028501.html if you're interested |
| 12:21:21 | <lambdabot> | Title: [Haskell-cafe] Monadic tunnelling: the art of threading one monad through anothe ..., http://tinyurl.com/3xmhco |
| 12:21:41 | <mux> | so when are you releasing mtl-quicksilver? :-) with MonadContains, InterleavableIO, etc |
| 12:22:06 | <quicksilver> | I'm not sure I have the abstractions right, yet |
| 12:22:52 | <quicksilver> | that's very odd. that mailing list post used to be top google hit for 'Monadic Tunnelling" and now it doesn't appear at all. *shrug* |
| 12:23:21 | <quicksilver> | ADEpt: quite often you can manage better named primitives than diagramS_modify, but that's the general pattern :) |
| 12:24:30 | <ttfh> | so if MonadContains is a less restricted version of Control.Monad.State.Class, could you build the latter from the former? (I'm no good at functional dependencies) |
| 12:25:21 | <swiert> | I may have missed parts of this discussion, but why don't you pair together the two states and write your own getFst, getSnd, putFst, and putSnd? |
| 12:25:46 | <ADEpt> | quicksilver: I wonder ... If i put setStep and setSwimline into one module and setGraph and setSection into another, and they would use ordinary get/put/modify, how hard would be to use this typeclass trick to combine states in that case? |
| 12:26:08 | <quicksilver> | swiert: because he wants his actions on the one state to be ignorant of the existence of the other |
| 12:26:22 | <ttfh> | swiert: if a part of the code uses only one of the states, this should be reflected in the type |
| 12:26:37 | <quicksilver> | swiert: so he wants to write code (as if) in State a on the one hand, and State b in the other hand, and then combined the two in State (a,b) |
| 12:27:02 | <quicksilver> | ADEpt: you could do it, but you'd need a different kind of embedding |
| 12:27:10 | <swiert> | Ok. Fair enough. |
| 12:27:32 | <quicksilver> | ADEpt: you'd need an embedding which pulled the particular state out of the global state, called 'runState' and pushed the result back in |
| 12:27:52 | <ADEpt> | ACTION seriously considers "darcs revert" and starting all over again |
| 12:28:11 | <quicksilver> | ADEpt: however, the basic point remains the same. You still need your types to be polymoprhic. |
| 12:28:38 | <quicksilver> | If you have an action 'A' in one monad and an action 'B' in a nother monad, you will *never* be able to write do { A; B } |
| 12:28:51 | <int-e> | ADEpt: you'd probably end up with lifting operations, something like the embedState1/embedState2 functions. |
| 12:29:04 | <quicksilver> | you need both A and B to be type-class polymorphic |
| 12:29:19 | <quicksilver> | if they're different monads, then do { A ; B } is a type error |
| 12:29:31 | <quicksilver> | if they're polymoprhic then do { A; B } just piles up the constraints |
| 12:29:47 | <quicksilver> | and then if you provide a 'solution' to the constraints that piled up, all is well |
| 12:31:23 | <quicksilver> | that's the basic trick behind all the "auto-lifting" effects you can acheive |
| 12:31:35 | <quicksilver> | (and that's why it's so annoying that putStrLn is not polymoprhic) |
| 12:32:12 | <ADEpt> | uh-oh |
| 12:32:16 | <vincenz> | ADEpt: what are you working on? |
| 12:32:20 | <vincenz> | dcoutts_: ping |
| 12:32:40 | <ADEpt> | i guess i'll need another go at that |
| 12:32:48 | <quicksilver> | ADEpt: however, if you choose your primitives to be polymorphic in the right way, everything else follows by type infrence |
| 12:32:54 | <ADEpt> | vincenz: sequence diagram generator, using graphviz |
| 12:33:07 | <quicksilver> | ADEpt: case in point. "setStep" |
| 12:33:26 | <ADEpt> | quicksilver: lemme paste another example of code, where I start from, ok? |
| 12:33:32 | <quicksilver> | ADEpt: as long as setStep uses modify, it has type which is rigidin the state |
| 12:33:47 | <quicksilver> | ADEpt: if you change setStep to use an new version of modify, then it becomes polymorphic |
| 12:34:09 | <quicksilver> | ADEpt: for example, if you got it to use mc_modify, instead of modify, that would be good enough |
| 12:34:20 | <quicksilver> | (the compiler would deudce the right type from \f -> f{step=x}) |
| 12:34:44 | <quicksilver> | of course, with a little namespace care you could use the name 'modify' for mc_modify |
| 12:34:51 | <quicksilver> | and there would be no conflict :) |
| 12:34:57 | <quicksilver> | might not even have to change that code |
| 12:35:57 | <hpaste> | ADEpt annotated "trying to merge two State's" with "that's where I start" at http://hpaste.org/3203#a2 |
| 12:36:52 | <quicksilver> | ADEpt: yeah, well you can try not changing any of those definitions |
| 12:37:02 | <quicksilver> | ADEpt: just stop importing gets/modify from C.M.S |
| 12:37:07 | <ADEpt> | quicksilver: now, see, I have one single huge state. Which I want to split in two, and move both halves of the state and appropriate state access helpers into separate modules |
| 12:37:14 | <quicksilver> | (or, rather, import them qualified) |
| 12:37:23 | <quicksilver> | ah right, sorry |
| 12:37:25 | <quicksilver> | Yes, I see |
| 12:37:46 | <ADEpt> | quicksilver: ... because those modules might be usefull by their own right. |
| 12:37:50 | <quicksilver> | yes |
| 12:37:53 | <quicksilver> | it's a good plan |
| 12:37:58 | <quicksilver> | I approve of your motivation :) |
| 12:38:19 | <ADEpt> | quicksilver: at minimum, I want at least half of state in separate module :) Other could reside along with "main" in the "Main" module |
| 12:38:25 | <quicksilver> | ACTION nods |
| 12:38:48 | <quicksilver> | well, from the point of view of incremental testing I wouldn't break what you already have |
| 12:38:58 | <quicksilver> | I'd start building the new version in a new file by copy-pasting stuff out and modifying it |
| 12:39:02 | <quicksilver> | and testing it in ghci |
| 12:39:12 | <quicksilver> | then when it looks good, port your other code over to using it :) |
| 12:39:59 | <ADEpt> | quicksilver: like, rip the half out, move to separate module, test it in ghci solo, then go back and plow over existing code? |
| 12:49:07 | <quicksilver> | ADEpt: yes |
| 12:49:23 | <angelkat> | Hey |
| 12:49:45 | <angelkat> | is there someon else on this network with angelkat as there nick? NIckserv wont allow me to identify |
| 12:50:28 | <ADEpt> | quicksilver: I guess I'll try splitting your example into modules first. (when my head stops aching :) |
| 12:50:36 | <quicksilver> | :) |
| 12:50:52 | <quicksilver> | ADEpt: it's a bit painful until you get your head around it, yes |
| 12:50:53 | <angelkat> | so thats a I dont know so? |
| 12:51:04 | <Zao> | angelkat: You may want to head over to #freenode or whatnot. |
| 12:51:38 | <Zao> | angelkat: Registered and last seen two years ago. |
| 12:51:46 | <Zao> | angelkat: You should be able to get a staffer to drop it. |
| 12:51:50 | <angelkat> | Zao: interesting. |
| 12:51:54 | <angelkat> | thanks you =) |
| 12:51:58 | <Zao> | /msg nickserv help :P |
| 12:52:08 | <angelkat> | I know how to use nickserv lol! |
| 12:52:34 | <angelkat> | also it forced mick when I joined. How strange. |
| 12:52:35 | <angelkat> | anyway |
| 12:52:36 | <angelkat> | byes |
| 12:52:58 | <kloeri> | angelkat: I can drop the angelkat registration if you like |
| 12:53:14 | <angelkat> | \o/ please |
| 12:53:27 | <angelkat> | nick AngelKat |
| 12:53:30 | <angelkat> | >.> |
| 12:53:37 | <angelkat> | (im not that much of a newb honest) |
| 12:53:38 | <kloeri> | done |
| 12:53:45 | <Angelkat> | thanks |
| 12:54:03 | <kloeri> | np |
| 12:57:44 | <pharm> | OK, so who's responsible for http://arcanux.org/lambdacats.html then? |
| 12:57:45 | <lambdabot> | Title: Lambdacats |
| 12:59:14 | <osfameron> | ooo, I hadn't seen all of those |
| 12:59:58 | <pharm> | (via as comment on lambda-the-ultimate btw) |
| 13:00:50 | <Angelkat> | lols at links |
| 13:00:52 | <osfameron> | they've been in the New SLogan thread |
| 13:00:59 | <ddarius> | pharm: See the mailing list |
| 13:01:29 | <pharm> | Ah, I'd skipped over most of that thread. |
| 13:01:35 | <quicksilver> | bos: harsh! "proliferation of half-bakery" |
| 13:02:48 | <raxas> | pharm: there are more kittens, lambdacats2..3 |
| 13:03:27 | <EvilTerran> | ACTION winces at flip concatMap |
| 13:03:36 | <Angelkat> | ACTION pounces on bincheol |
| 13:03:41 | <kaol> | :t flip concatMap |
| 13:03:44 | <lambdabot> | forall a b. [a] -> (a -> [b]) -> [b] |
| 13:03:56 | <binncheol> | Angelkat: wow |
| 13:04:54 | <roconnor> | flip concatmap :) |
| 13:05:03 | <matthew_-> | @type flip concatmap |
| 13:05:05 | <lambdabot> | Not in scope: `concatmap' |
| 13:05:08 | <Angelkat> | lunch time! |
| 13:05:12 | <Angelkat> | binncheol: come on! |
| 13:05:16 | <roconnor> | sorry, flip concatMap |
| 13:05:22 | <matthew_-> | @type flip concatMap |
| 13:05:22 | <binncheol> | ACTION runs |
| 13:05:23 | <lambdabot> | forall a b. [a] -> (a -> [b]) -> [b] |
| 13:05:34 | <bringert> | dcoutts_: great! re: zlib on windows |
| 13:05:48 | <EvilTerran> | :t (>>=) |
| 13:05:50 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => m a -> (a -> m b) -> m b |
| 13:06:47 | <mrd> | ugh. for some reason, my link to the outside world is incredibly slow today. |
| 13:08:03 | <quicksilver> | mrd: kittens in the tubes |
| 13:09:43 | <vincenz> | well there's a solution to that, watch porn |
| 13:09:48 | <vincenz> | "every time you ...., god kills a kitten" |
| 13:10:07 | <Spark> | interpret a proprietory movie format? |
| 13:10:16 | <roconnor> | vincenz: performUnsafeIO? |
| 13:10:24 | <vincenz> | erm.. |
| 13:10:33 | <vincenz> | yes, performUnsafeIO |
| 13:10:33 | <mrd> | ACTION watches lambdacats |
| 13:10:56 | <EvilTerran> | it's like thundercats... only, er, lambda |
| 13:10:56 | <mrd> | help desk says its campus wide.. woohoo |
| 13:11:10 | <Spark> | performUnsafeIOIOIOIO |
| 13:11:19 | <pharm> | ACTION is all in favour of performUnsafeIO leading to nasal daemons |
| 13:16:08 | <oerjan> | import Magick(unsafeSummonDaemon) |
| 13:17:10 | <EvilTerran> | unsafeSummonDaemon >>= nose |
| 13:17:10 | <osfameron> | safe summonDemon would lead to the invocation of the demon outside the protective pentagram being untypable ? |
| 13:17:45 | <vincenz> | EvilTerran: erm...unsafe is not monadic so no >>= |
| 13:17:53 | <oerjan> | instance Monad Pentagram |
| 13:17:53 | <_ry> | is there a HTTP parser out there I could peek at? |
| 13:17:56 | <vincenz> | and demon summoning uses phantom types |
| 13:18:11 | <vincenz> | hence, unsafe summoning would be summoning outside a region of the proper phantom type, aka outside the pentagram |
| 13:18:12 | <EvilTerran> | it could be in a non-IO monad |
| 13:18:27 | <vincenz> | EvilTerran: unsafe typically implies "m a -> a" |
| 13:18:54 | <oerjan> | :t unsafeSTtoIO |
| 13:18:57 | <lambdabot> | Not in scope: `unsafeSTtoIO' |
| 13:19:15 | <oerjan> | :t Control.Monad.ST.unsafeSTtoIO |
| 13:19:17 | <lambdabot> | Not in scope: `Control.Monad.ST.unsafeSTtoIO' |
| 13:19:21 | <EvilTerran> | ?type unsafeSTtoIO |
| 13:19:23 | <lambdabot> | Not in scope: `unsafeSTtoIO' |
| 13:19:32 | <EvilTerran> | ah, oerjan got there first, and it didn't work anyway. |
| 13:19:59 | <oerjan> | :t Control.Monad.ST.unsafeSTToIO |
| 13:20:02 | <lambdabot> | forall s a. GHC.ST.ST s a -> IO a |
| 13:30:55 | <bos> | i've always thought that "SCC" in GHC-speak meant "strongly connected component", but someone claims it doesn't. can anyone shed any light? |
| 13:32:26 | <roconnor> | CC is call centre |
| 13:32:34 | <matthew_-> | it means "Sodding-well Count the Calls here" |
| 13:32:47 | <roconnor> | not to be confused with call center |
| 13:33:03 | <matthew_-> | hello, how can I help you? |
| 13:33:40 | <roconnor> | matthew_-: I'm having trouble with my map |
| 13:34:35 | <EvilTerran> | have you tried switching it off and on again? |
| 13:35:30 | <matthew_-> | can you tell me the serial number of your map please? |
| 13:36:28 | <ToRA> | is there a cat on your map? |
| 13:36:44 | <matthew_-> | @slap ToRA |
| 13:36:45 | <lambdabot> | ACTION beats up ToRA |
| 13:39:23 | <ToRA> | @type flip map undefined cat |
| 13:39:25 | <lambdabot> | [Doc] |
| 13:39:50 | <EvilTerran> | what? |
| 13:39:54 | <EvilTerran> | ?type cat |
| 13:39:57 | <lambdabot> | [Doc] -> Doc |
| 13:44:28 | <birkenfeld> | @index cat |
| 13:44:28 | <lambdabot> | Language.Haskell.TH.PprLib, Text.PrettyPrint.HughesPJ, Text.PrettyPrint |
| 13:44:49 | <quicksilver> | I thought it was cost center |
| 13:44:52 | <quicksilver> | ACTION shrugs |
| 13:45:26 | <_ry> | is there a haskell http protocol parser out there? |
| 13:45:54 | <quicksilver> | I've not seen one |
| 13:46:00 | <quicksilver> | mind you HTTP is a pretty simple protocol :P |
| 13:46:10 | <quicksilver> | header fields newline body.... |
| 13:46:23 | <osfameron> | roll your own, what could possibly go wrong! |
| 13:46:25 | <quicksilver> | there is Network.HTTP which must internally sort it out, I guess |
| 13:54:04 | <_ry> | is there a rubygems like tool for cabal packages? |
| 13:55:46 | <EvilTerran> | there's cabal-install, but i don't think that's been released yet |
| 13:56:11 | <vincenz> | they're working on that |
| 13:58:52 | <_ry> | quicksilver: i think Network.HTTP is only an http client |
| 13:59:09 | <quicksilver> | _ry: well, you didn't specify which part of http you wanted to parse |
| 13:59:21 | <quicksilver> | _ry: but, parsing-wise, both "ends" of HTTP are very similar |
| 13:59:31 | <_ry> | oh yeah, of course. |
| 13:59:35 | <quicksilver> | a request is "VERB url\nHeaders\ncontent" |
| 13:59:42 | <quicksilver> | a response is "Headers\ncontent" |
| 14:04:50 | <EvilTerran> | or VERB url HTTP/version\n... |
| 14:06:26 | <yaw> | hey, is anyone here familiar with catch? (http://www-users.cs.york.ac.uk/~ndm/catch/) |
| 14:06:27 | <lambdabot> | Title: Neil Mitchell - Catch: Case Totality Checker for Haskell |
| 14:08:55 | <pharm> | I suspect Neil is (ndm on irc if he's around) :) |
| 14:09:36 | <quicksilver> | yaw: I'm familiar with the design and the general idea |
| 14:09:46 | <quicksilver> | yaw: I've read the paper and chatted to Neil but not actually used it :P |
| 14:10:41 | <yaw> | mmm |
| 14:10:48 | <yaw> | i'm just trying to get it to work |
| 14:11:06 | <yaw> | i keep getting "user error (invalid binary data found)" |
| 14:11:35 | <yaw> | there's a chance it's due to a small change i made in yhc to get the thing to compile |
| 14:12:06 | <yaw> | i guess i'll have to wait for neil for this |
| 14:12:06 | <quicksilver> | I'm not sure what that means |
| 14:12:10 | <quicksilver> | I think it reads yhc core |
| 14:12:16 | <quicksilver> | maybe wrong version of YHC, wrong core format? |
| 14:12:18 | <quicksilver> | (perhaps?) |
| 14:12:21 | <quicksilver> | malcolmw: ping |
| 14:12:24 | <yaw> | hmm |
| 14:12:33 | <malcolmw> | quicksilver: pong |
| 14:12:47 | <quicksilver> | malcolmw: yaw getting weird errors trying to get Catch (and thus yhc) working |
| 14:12:55 | <quicksilver> | malcolmw: are you aware of some tight version dependency there? |
| 14:13:09 | <yaw> | yhc appears to be working on its own |
| 14:13:17 | <yaw> | i can compile simple programs and run them with yhi |
| 14:13:31 | <yaw> | i had to edit a line of code to get yhc to compile though |
| 14:13:43 | <malcolmw> | quicksilver: I have a vague feeling that recent changes in yhc.core broke catch temporarily, but you would need to ask ndm for the details |
| 14:13:59 | <quicksilver> | I thought it might be something along those lines |
| 14:14:14 | <malcolmw> | and ndm is away this week (although he has appeared on IRC at times nonetheless...) |
| 14:14:19 | <quicksilver> | didn't yhc implement pattern guards (partly so that) catch could handle those? |
| 14:14:59 | <malcolmw> | yup, I implemented pattern guards in nhc98, then merged the compiler with yhc so that it could have the benefit too |
| 14:17:28 | <yaw> | Would anyone know which versions are compatible, if i can grab older versions of the software? |
| 14:24:42 | <madnificent> | vincenz: what do you study? |
| 14:24:51 | <vincenz> | madnificent: hmm? |
| 14:25:10 | <madnificent> | vincenz: you're on kuleuven... I saw you join... |
| 14:25:17 | <madnificent> | vincenz: I study there too... so I wondered |
| 14:25:23 | <vincenz> | oh |
| 14:25:28 | <vincenz> | that was random :) |
| 14:25:31 | <vincenz> | electronics |
| 14:25:40 | <vincenz> | woo, tunneling |
| 14:25:50 | <madnificent> | vincenz: LoL |
| 14:26:11 | <roconnor> | > 10000/600 |
| 14:26:12 | <vincenz> | irssi-proxy ftw |
| 14:26:15 | <lambdabot> | 16.666666666666668 |
| 14:26:23 | <vincenz> | madnificent: what do you study? |
| 14:26:33 | <madnificent> | 2 bach inf |
| 14:26:37 | <roconnor> | > 10000 `quotRem` 600 |
| 14:26:39 | <lambdabot> | (16,400) |
| 14:26:45 | <vincenz> | ACTION tried to follow a last year course in inf but was disaspointed |
| 14:26:59 | <madnificent> | vincenz: what was wrong? |
| 14:27:01 | <vincenz> | madnificent: why do you get 'set-theory' only in the last year |
| 14:27:03 | <vincenz> | and why is it so basic |
| 14:27:15 | <blarz> | > 2/3 |
| 14:27:16 | <lambdabot> | 0.6666666666666666 |
| 14:27:48 | <madnificent> | vincenz: perhaps you could send a mail to steegmans... dunno if he takes care of the master... |
| 14:29:40 | <dons> | ?users |
| 14:29:40 | <lambdabot> | Maximum users seen in #haskell: 420, currently: 377 (89.8%), active: 15 (4.0%) |
| 14:29:41 | <vincenz> | madnificent: do you peeps get haskell? |
| 14:32:15 | <madnificent> | vincenz: yup... but that's something for next year... |
| 14:32:30 | <madnificent> | and i assume it'll be some introduction to functional-programming |
| 14:32:37 | <vincenz> | spiffy |
| 14:32:45 | <madnificent> | the courses aren't too hard, you are encouraged to learn more on yourself... |
| 14:32:48 | <madnificent> | at least that is what I think |
| 14:32:54 | <vincenz> | ACTION remembers how he got scheme in his first year of uni, 9 years ago (damn, now I feel old) |
| 14:33:19 | <madnificent> | scheme sounds interesting too |
| 14:33:48 | <vincenz> | nowadays they use java in the first year, however. |
| 14:34:21 | <madnificent> | vincenz: which is utterly dull |
| 14:35:09 | <vincenz> | madnificent: not to mention, not a very good way to teach concepts |
| 14:35:57 | <madnificent> | vincenz: it is one of the languages I actually dislike... it has little or no beauty in itself |
| 14:44:06 | <roconnor> | ACTION wonders if ITA-software is a publicly traded company |
| 15:19:13 | <dons> | ?yow |
| 15:19:13 | <lambdabot> | When I met th'POPE back in '58, I scrubbed him with a MILD SOAP or |
| 15:19:13 | <lambdabot> | DETERGENT for 15 minutes. He seemed to enjoy it ... |
| 15:21:45 | <dons> | ah interresting, icfp top 15 had 8 FP teams (5 OCaml, 3 Haskell). |
| 15:22:04 | <osfameron> | and no FP teams in top 3 :-) |
| 15:22:26 | <roconnor> | Are the ICFP videos online? |
| 15:22:32 | <dons> | yeah, #3 was an ocaml/c++ guy |
| 15:24:13 | <exDM69> | what's icfp? |
| 15:24:23 | <dons> | a huge programming contest held each year |
| 15:24:33 | <dons> | haskell won it for the last 3 years, but C++ came in first this year |
| 15:24:43 | <dons> | ?go icfp contest |
| 15:24:46 | <lambdabot> | http://www.icfpcontest.org/ |
| 15:24:46 | <lambdabot> | Title: ICFP Programming Contest 2007 |
| 15:26:08 | <osfameron> | and Perl made a surprise 2nd place |
| 15:27:54 | <dcoutts_> | vincenz: pong |
| 15:27:59 | <dons> | morning dcoutts_ |
| 15:28:02 | <dons> | hey joe_hurd |
| 15:28:12 | <dcoutts_> | g'afternoon dons |
| 15:28:24 | <dons> | dcoutts_: ^^ more galois people taking over :) |
| 15:28:25 | <vincenz> | dcoutts_: hey, mind forwarding that email, or pinging them with my email |
| 15:28:36 | <dcoutts_> | vincenz: what email? |
| 15:29:24 | <quicksilver> | dcoutts_: gtk2hs. threading. You you just compile with -threaded and forkIO at will, as long as subthread's don't use gtk calls? |
| 15:29:52 | <quicksilver> | s/You you/Can you/; |
| 15:29:58 | <dcoutts_> | quicksilver: right, and use the alternative initGUI call |
| 15:30:02 | <vincenz> | quicksilver: yes |
| 15:30:13 | <kosmikus> | dons: how many new people has galois hired already since ICFP? ;) |
| 15:30:21 | <vincenz> | quicksilver: let me get you the code |
| 15:30:37 | <quicksilver> | dcoutts_: why do you need an alternative initGUI? |
| 15:30:39 | <dcoutts_> | dons: looks like I'll be able to make zlib, bzlib and perhaps even the iconv bindings build on windows just by bundling the C sources |
| 15:30:40 | <dons> | kosmikus: since icfp? hmm :) 0.5? (some applicatoins have come in) |
| 15:30:56 | <dcoutts_> | quicksilver: to promise that you take full responsibility for threading bugs |
| 15:30:57 | <quicksilver> | (compared to, say, openGL where you can mainLoop) |
| 15:31:00 | <vincenz> | quicksilver: launchGUI nodes edges = do |
| 15:31:00 | <vincenz> | initGUI |
| 15:31:00 | <vincenz> | timeoutAddFull (yield >> return True) priorityDefaultIdle 50 |
| 15:31:18 | <dcoutts_> | quicksilver: so people don't accidentally link with -threaded and get totally borked behaviour |
| 15:31:22 | <vincenz> | dcoutts_: or did that change? |
| 15:31:35 | <dcoutts_> | vincenz: that's for the single threaded rts |
| 15:31:45 | <vincenz> | ACTION used that for a multithreaded app |
| 15:31:45 | <dcoutts_> | and that works fine and is quite safe |
| 15:32:15 | <dcoutts_> | with the -threaded rts you have to be really careful with calling gui stuff from different threads |
| 15:32:23 | <vincenz> | ACTION nods |
| 15:34:14 | <kosmikus> | dons: there must have been a huge number of interested candidates at the dinner? |
| 15:34:40 | <dons> | kosmikus: i believe so. i think it was very successful, though we've not had a briefing yet about it. |
| 15:34:46 | <dons> | my impression was that there was lots of interest |
| 15:34:57 | <joe_hurd> | dcoutts: hi duncan, do you know if haddock-ghc is available? |
| 15:35:22 | <dcoutts_> | joe_hurd: there's a darcs repo for it somewhere |
| 15:35:34 | <dcoutts_> | @seen waern |
| 15:35:34 | <lambdabot> | I saw waern leaving #ghc and #haskell 4h 8m 19s ago, and . |
| 15:35:40 | <dons> | ah yes, dave waern |
| 15:35:43 | <dcoutts_> | joe_hurd: waern's the author |
| 15:35:52 | <dcoutts_> | @where haddock-ghc |
| 15:35:53 | <lambdabot> | I know nothing about haddock-ghc. |
| 15:36:18 | <joe_hurd> | do you know if its a stable thing to be unleased on innocent newbie users like myself? |
| 15:36:36 | <joe_hurd> | i wonder what unleased could mean? |
| 15:37:00 | <dcoutts_> | joe_hurd: it's kind of waiting for ghc-6.8 to be released |
| 15:37:13 | <quicksilver> | dcoutts_: Ah, ok |
| 15:37:14 | <dcoutts_> | and then the support for it in cabal needs to be updated I think |
| 15:37:20 | <quicksilver> | dcoutts_: so really it's the 'same' as openGL |
| 15:37:24 | <joe_hurd> | dcoutts_: ok, i |
| 15:37:35 | <quicksilver> | dcoutts_: just you took a decision to force people to make a visible decision by choosing the right version of initGUI |
| 15:37:37 | <dcoutts_> | quicksilver: right, but a change relative to normal gtk2hs behaviour |
| 15:37:39 | <joe_hurd> | sorry, mistype (new keyboard) |
| 15:37:54 | <joe_hurd> | dcoutts_: ok, i'm using 6.6.1 atm, so i'll wait. |
| 15:38:13 | <dcoutts_> | joe_hurd: we really need to bug waern about what needs to be done |
| 15:38:20 | <dcoutts_> | eg the support in cabal should go in now |
| 15:38:27 | <joe_hurd> | dcoutts_: am i allowed to ask when 6.8 will be unleashed? |
| 15:38:50 | <dcoutts_> | joe_hurd: it's not entirely clear yet, ask Igloo and JaffaCake |
| 15:39:36 | <JaffaCake> | asap, but not before it's ready |
| 15:39:46 | <joe_hurd> | dcoutts_: i completely agree: the existing haddock cannot cope with the result of alex or some 'deriving' extensions. v. annoying. |
| 15:40:29 | <dons> | JaffaCake: will base be tagged 3.0 or similar soon, so we can start updating hackage packages for it? |
| 15:40:42 | <joe_hurd> | JaffaCake: good answer, but not so useful for planning purposes. closer to a week or a decade from now? |
| 15:40:47 | <JaffaCake> | dons: I believe Igloo has it in hand |
| 15:40:58 | <dons> | ok. |
| 15:41:11 | <dons> | a list of broken packages to libraries@ might also be a good motivation |
| 15:41:16 | <JaffaCake> | joe_hurd: roughly 2-3 weeks, I guess |
| 15:41:27 | <dons> | dcoutts_: we need to get bytestring 0.9 tagged too |
| 15:41:32 | <joe_hurd> | JaffaCake: excellent news |
| 15:42:03 | <dons> | joe_hurd: do you know dcoutts and Igloo, btw? (also at oxford) |
| 15:42:18 | <dons> | if not, let me introduce dcoutts and Igloo (and JaffaCake!) |
| 15:42:35 | <quicksilver> | JaffaCake is in cambridge! ;) |
| 15:42:50 | <dons> | certainly, but worth introducing :) |
| 15:43:03 | <dons> | joe's a new theorem proving hacker at galois |
| 15:43:15 | <joe_hurd> | dons: i know dcoutts, but the aliases Igloo and JaffaCake baffle me. |
| 15:43:27 | <JaffaCake> | ACTION waves to joe_hurd |
| 15:43:31 | <dons> | Igloo is Ian Lynagh, and JaffaCake is Simon Marlow :) |
| 15:43:37 | <dons> | but don't tell anyone! |
| 15:43:46 | <joe_hurd> | hi guys, your secret is safe with me. |
| 15:44:01 | <dons> | quicksilver is also an interesting fellow |
| 15:44:13 | <dons> | another englishman, iirc. |
| 15:44:19 | <dons> | they're everywhere! |
| 15:44:29 | <JaffaCake> | ACTION goes home, bye folks |
| 15:44:32 | <joe_hurd> | and does quicksilver have another alias? |
| 15:44:34 | <dons> | ciao JaffaCake |
| 15:44:36 | <sjanssen> | mostly in England, though |
| 15:45:19 | <dons> | sjanssen: ah yes, good point |
| 15:46:48 | <joe_hurd> | i'm an irc newbie as well as a haskell newbie |
| 15:47:03 | <joe_hurd> | previously i was an email and sml junkie :-) |
| 15:48:19 | <joe_hurd> | quicksilver: just discovered whois, so hi to you too |
| 15:48:30 | <quicksilver> | :) |
| 15:48:33 | <quicksilver> | hi |
| 15:48:54 | <quicksilver> | I was at QM but I couldn't take the pace of academia, so I've retired to a quiet life in the City. |
| 15:49:22 | <joe_hurd> | quicksilver: you got sucked into the banking FP crowd? |
| 15:49:29 | <geocalc> | what is this pfe ??? |
| 15:49:35 | <chessguy> | so this looks interesting: http://developer.mozilla.org/en/docs/New_in_JavaScript_1.8 |
| 15:49:37 | <lambdabot> | Title: New in JavaScript 1.8 - MDC |
| 15:49:48 | <quicksilver> | joe_hurd: nah, not even an FP job. At least, not yet. |
| 15:49:53 | <quicksilver> | joe_hurd: just a programming job. |
| 15:50:08 | <vincenz> | quicksilver: and here I thought you were doing a phd |
| 15:50:21 | <quicksilver> | vincenz: I did once :) |
| 15:50:27 | <joe_hurd> | quicksilver: thought about that for a while, but decided to change continent instead of moving away from FP! |
| 15:51:05 | <vincenz> | @age quicksilver |
| 15:51:05 | <lambdabot> | Maybe you meant: arr ask |
| 15:51:36 | <quicksilver> | old enough to remember NCSA mosaic, but not old enough to have prorammed with punch cards. |
| 15:51:42 | <chessguy> | looks like javascript is getting lazy expressions, folds, and special notation for lambda functions. good stuff |
| 15:53:15 | <vincenz> | yeah, if now they just would fix scoping rules |
| 15:53:25 | <quicksilver> | not likely |
| 15:53:28 | <geocalc> | pfe Generate Programatica Project. <-- is it important for haskell ??? |
| 15:57:30 | <chessguy> | the scoping is a little annoying, but it's not too bad |
| 15:59:15 | <phlpp> | hi |
| 15:59:16 | <phlpp> | o instance for (Fractional Integer) arising from the literal `0.5' at Test.hs:156:16-18 |
| 15:59:28 | <phlpp> | i have a function like collatzNum :: Integer -> Integer |
| 15:59:45 | <phlpp> | and if x is even, i want to return x/2, if it's odd then 3x+1 |
| 16:00:22 | <quicksilver> | x `div` 2 |
| 16:00:32 | <phlpp> | thank you :) |
| 16:00:38 | <quicksilver> | is for numbers which support fractions :) |
| 16:00:47 | <quicksilver> | / is, I should say |
| 16:00:58 | <phlpp> | `div` means prefix op is used in infix mode? |
| 16:01:02 | <quicksilver> | right |
| 16:01:07 | <phlpp> | cool stuff |
| 16:01:08 | <phlpp> | :) |
| 16:01:10 | <quicksilver> | you could say div x 2 |
| 16:01:14 | <quicksilver> | if you preferred |
| 16:02:09 | <phlpp> | yeah, depending on how much lisp freak you are |
| 16:02:09 | <phlpp> | :D |
| 16:02:22 | <osfameron> | or (+) 1 2 instead of 1 + 2 :-) |
| 16:04:08 | <quicksilver> | or (let a/b = a`div`b in x/2) |
| 16:04:13 | <quicksilver> | if you like the / syntax |
| 16:04:29 | <MyCatSchemes> | Why do people here seem to consider Data.Graph to be evil, anyway? |
| 16:04:39 | <ski> | let (/) = div in x/2 |
| 16:04:58 | <quicksilver> | true, but I prefer a/b to (/) , syntax-wise :) |
| 16:05:11 | <quicksilver> | and I like showing off that you can do infix definitions |
| 16:05:29 | <osfameron> | yeah, infix definitions are cute |
| 16:06:04 | <phlpp> | wtf |
| 16:06:18 | <phlpp> | can i really redefine this / operator for my use? |
| 16:06:22 | <phlpp> | thats cooool. |
| 16:06:31 | <EvilTerran> | don't, though, you'll confuse everyone |
| 16:06:35 | <Saizan> | hiding the prelude one |
| 16:06:38 | <phlpp> | :> |
| 16:06:47 | <ski> | Hugs> let (+) ((+)+1) = (+) in (+) `id` 2 |
| 16:06:47 | <ski> | 1 :: Integer |
| 16:07:32 | <quicksilver> | phlpp: you can redefine almost anything |
| 16:07:33 | <ski> | (don't do that, either) |
| 16:07:49 | <quicksilver> | phlpp: there are some subtleties in monad notation and list comprehension |
| 16:07:57 | <quicksilver> | but -fno-implicit-prelude catches most of those |
| 16:08:19 | <phlpp> | hehe, ok. |
| 16:08:28 | <phlpp> | i really getting more in love with haskell |
| 16:08:43 | <phlpp> | (cause of reading and writing stuff here and because of advancing in my tutorial) |
| 16:10:48 | <chessguy> | @quote addict |
| 16:10:49 | <lambdabot> | chessguy says: heh. i think i'm officially addicted. i'm chatting in #haskell, helping hack on a haskellwiki page, browing a reddit thread about haskell, while playing a haskell video lecture in the |
| 16:10:49 | <lambdabot> | background |
| 16:11:09 | <MyCatSchemes> | phlpp: heh, I'm familiar with that feeling. |
| 16:12:43 | <madnificent> | I am having that feeling :-) |
| 16:17:22 | <byorgey> | yay Haskell! =) |
| 16:18:33 | <ddarius> | @user |
| 16:18:33 | <lambdabot> | Maximum users seen in #haskell: 420, currently: 377 (89.8%), active: 17 (4.5%) |
| 16:19:20 | <geocalc> | @active |
| 16:19:20 | <lambdabot> | Unknown command, try @list |
| 16:19:34 | <badkins> | Just out of curiosity, is lambdabot running Haskell code? |
| 16:19:46 | <geocalc> | yes |
| 16:19:51 | <Vulpyne> | It's written in Haskell, yeah. |
| 16:19:57 | <badkins> | cool. Is the source available to examine? |
| 16:20:05 | <olsner> | @where lambdabot |
| 16:20:05 | <lambdabot> | http://www.cse.unsw.edu.au/~dons/lambdabot.html |
| 16:20:27 | <badkins> | thx |
| 16:21:37 | <MyCatSchemes> | @src Fd |
| 16:21:38 | <lambdabot> | Source not found. I've seen penguins that can type better than that. |
| 16:21:52 | <MyCatSchemes> | @src System.Posix.Types.Fd |
| 16:21:52 | <lambdabot> | Source not found. You speak an infinite deal of nothing |
| 16:25:44 | <ski> | @version |
| 16:25:44 | <lambdabot> | lambdabot 4p548, GHC 6.6 (Linux i686 2.66GHz) |
| 16:25:44 | <lambdabot> | darcs get http://www.cse.unsw.edu.au/~dons/lambdabot |
| 16:36:17 | <roconnor> | the audio is cut off in don's talk :'( |
| 16:36:34 | <roconnor> | @where HPC |
| 16:36:34 | <lambdabot> | http://www.haskell.org/haskellwiki/Haskell_Program_Coverage |
| 16:36:51 | <ddarius> | roconnor: It wasn't for me. |
| 16:37:47 | <roconnor> | ddarius: thx, vlc / linux audio needs some quickcheck I think. |
| 16:38:14 | <roconnor> | replaying works |
| 16:39:04 | <roconnor> | audio dies in vlc at 12:48, but if you slide the slider around, it works again. |
| 16:39:51 | <sjanssen> | roconnor: worked perfectly in mplayer |
| 16:40:50 | <ddarius> | roconnor: Are you talking about another talk by the way? The Haskell Workshop one is presented by Andy Gill |
| 16:41:18 | <roconnor> | dons xmonad demo at the HW2007 |
| 16:42:33 | <phlpp> | is there a way to determine if in a list there's a certain cycle/pattern? so if in a list of Integers is a pattern like 4, 2, 1? |
| 16:43:00 | <ricky_clarkson> | Sort it, look for pairs. |
| 16:43:07 | <pizza_> | phlpp: there is indeed |
| 16:43:33 | <roconnor> | phlpp: a finite list? |
| 16:44:37 | <phlpp> | it SHOULD be a finite list. the problem is, if once this 4, 2, 1 pattern occured, it repeats infinitely.. so another option would be to test the 'input' list on sth. like [x, 4, 2, 1] = x |
| 16:44:53 | <MyCatSchemes> | Hrmn, how do you define infix operators, please? |
| 16:44:54 | <phlpp> | oh, hm, forget about the last one, it's nonsense i thikn |
| 16:45:09 | <ddarius> | MyCatSchemes: Exactly as you'd expect. |
| 16:45:20 | <EvilTerran> | > let x ? y = (y,x) in 1 ? 2 |
| 16:45:22 | <lambdabot> | (2,1) |
| 16:45:31 | <ddarius> | > let (?) x y = (y,x) in 1 ? 2 |
| 16:45:32 | <lambdabot> | (2,1) |
| 16:45:33 | <EvilTerran> | > let (?) = const in 1 ? 2 |
| 16:45:34 | <MyCatSchemes> | ACTION hugs everybody. ^_^ |
| 16:45:34 | <lambdabot> | 1 |
| 16:45:40 | <MyCatSchemes> | Thaaaaankooo. |
| 16:46:15 | <Saizan> | phlpp: do you know the pattern to look for in advance or not? |
| 16:46:20 | <MyCatSchemes> | Is there any need (or way?) to specify their fixity and precendence? |
| 16:46:51 | <ddarius> | For infinite lists there is nothing you can do. |
| 16:47:14 | <oerjan> | > let x ? y = x+y; infixr 5 ? in 2 ? 3 |
| 16:47:16 | <lambdabot> | 5 |
| 16:47:47 | <roconnor> | phlpp: are you doing something with the 3n+1 problem? |
| 16:47:56 | <phlpp> | Saizan: i know that the list one time will get to 4 (list values are calculated by a function), and as it gets to four, it will get to 4, 2, 1, 4, 2, 1, ... |
| 16:48:04 | <geocalc> | if i enable compile for ghci do this mean less good with ghc ? |
| 16:48:07 | <phlpp> | roconnor: exactly ;) |
| 16:48:28 | <roconnor> | isn't it traditional to just check for 1? |
| 16:48:40 | <phlpp> | im just trying to create a list with calculated values, just as exercies to get in this recursive way of thinking |
| 16:49:00 | <phlpp> | yeah, ok, you are right then |
| 16:49:16 | <phlpp> | if it reaches one, it should abort, stop calculating the list |
| 16:49:32 | <geocalc> | ACTION should ask again |
| 16:49:39 | <geocalc> | if i enable compile for ghci do this mean less good with ghc ? |
| 16:49:46 | <Saizan> | geocalc: what do you mean? |
| 16:49:48 | <sjanssen> | geocalc: huh? |
| 16:51:04 | <byorgey> | phlpp: just use takeWhile (/=1) |
| 16:51:28 | <Saizan> | takeUntil (==1) would be better, |
| 16:51:45 | <byorgey> | phlpp: note that because of lazy evaluation, you don't need to think in terms of "stopping" or "aborting" when 1 is reached. |
| 16:52:05 | <byorgey> | instead, think of it as two steps: 1) calculate the infinite, repeating list. |
| 16:52:06 | <geocalc> | --enable-library-for-ghci compile library for use with GHCi i have this with the setup Saizan sjanssen |
| 16:52:15 | <roconnor> | > cylce [4,2,1] |
| 16:52:16 | <lambdabot> | Not in scope: `cylce' |
| 16:52:18 | <byorgey> | 2) only take the beginning of the list up to the first occurrence of 1. |
| 16:52:20 | <roconnor> | > cycle [4,2,1] |
| 16:52:22 | <lambdabot> | [4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2... |
| 16:52:36 | <roconnor> | > takeUntil (==1) (cycle [4,2,1]) |
| 16:52:37 | <lambdabot> | Not in scope: `takeUntil' |
| 16:53:02 | <roconnor> | !!! |
| 16:53:28 | <byorgey> | takeUntil = takeWhile . not ? |
| 16:53:48 | <roconnor> | > takeWhile (/=1) (cycle [4,2,1]) |
| 16:53:50 | <lambdabot> | [4,2] |
| 16:53:54 | <Saizan> | takeUntil will give you the 1 at the end |
| 16:54:01 | <byorgey> | ah, I see |
| 16:54:03 | <Saizan> | but it's no more in the prelude |
| 16:54:08 | <byorgey> | that's not intuitive though |
| 16:54:23 | <byorgey> | (not to me at least) |
| 16:54:28 | <phlpp> | thanks byorgey |
| 16:54:28 | <phlpp> | :) |
| 16:54:30 | <phlpp> | and the others |
| 16:54:31 | <hpaste> | huamn pasted "Datagram socket ports?" at http://hpaste.org/3205 |
| 16:54:48 | <roconnor> | time to go home and make dinner |
| 16:54:50 | <byorgey> | phlpp: sure, have fun =) |
| 16:54:54 | <huamn_> | can anyone help me with this? port number seems to get multiplied by 256 |
| 16:54:58 | <byorgey> | roconnor: enjoy! |
| 16:55:04 | <geocalc> | @hoogle takeUntil |
| 16:55:04 | <lambdabot> | No matches found |
| 16:55:23 | <ski> | @hoogle (a -> Bool) -> [a] -> [a] |
| 16:55:23 | <lambdabot> | Prelude.dropWhile :: (a -> Bool) -> [a] -> [a] |
| 16:55:23 | <lambdabot> | Prelude.filter :: (a -> Bool) -> [a] -> [a] |
| 16:55:23 | <lambdabot> | Prelude.takeWhile :: (a -> Bool) -> [a] -> [a] |
| 16:56:25 | <phlpp> | takeWhile (/=1) (collatzList [5]) ++ [1] |
| 16:56:25 | <byorgey> | huamn_: what happens if you use port number 101 instead of 100? |
| 16:56:27 | <phlpp> | so that works fine for me |
| 16:56:28 | <phlpp> | ;)) |
| 16:56:32 | <phlpp> | great stuff |
| 16:56:45 | <huamn_> | byorgey, 19:56:39.312241 IP localhost > localhost: ICMP localhost udp port 25856 unreachable, length 48 |
| 16:56:57 | <byorgey> | > 256 * 101 |
| 16:56:58 | <lambdabot> | 25856 |
| 16:57:00 | <byorgey> | weird |
| 16:57:04 | <huamn_> | yes, it is. |
| 16:57:33 | <oerjan> | huamn_: wrong endianness perhaps? |
| 16:57:38 | <byorgey> | for a minute I thought maybe the 100 was getting interpreted as hexadecimal =) |
| 16:57:40 | <huamn_> | could be |
| 16:57:52 | <huamn_> | I'm just very new to haskell and don't know what I could do about it |
| 16:58:05 | <geocalc> | ACTION help =<< Saizan sjanssen |
| 16:58:07 | <huamn_> | endianness would quite much explain it |
| 16:58:12 | <huamn_> | I think |
| 16:58:17 | <sjanssen> | geocalc: where do you see this flag? |
| 16:58:57 | <geocalc> | in Setup.hs run |
| 16:59:22 | <sjanssen> | geocalc: oh, I think you can ignore that flag |
| 16:59:32 | <geocalc> | ok |
| 16:59:37 | <huamn_> | oerjan, any suggestions related to changing the endianness? |
| 17:00:25 | <huamn_> | actually print (show (PortNum 101)) also prints out "25586" |
| 17:00:46 | <huamn_> | so the conversion to Word16 is not quite what I'd like it to be, but I have no idea how to make it right :) |
| 17:00:57 | <byorgey> | huamn_: I just tried it on my machine and typing (PortNum 100) into ghci also produces 25600. |
| 17:01:59 | <huamn_> | should I invert the endianness myself? doesn't seem like an elegant solution |
| 17:02:05 | <oerjan> | hm... PortNum is a Num |
| 17:02:13 | <mrd> | yea |
| 17:02:16 | <mrd> | and it's an Enum |
| 17:02:21 | <mrd> | so use fromInteger, or toEnum |
| 17:02:35 | <mrd> | don't use PortNum directly |
| 17:02:35 | <oerjan> | try using just port instead of PortNum port |
| 17:03:07 | <mrd> | try this: print (101 :: PortNumber) |
| 17:03:13 | <mrd> | (is that the name of the type?) |
| 17:03:23 | <byorgey> | mrd: I tried that |
| 17:03:32 | <byorgey> | it gives the multiplied by 256 value. |
| 17:03:40 | <oerjan> | oh |
| 17:03:42 | <mrd> | even (toEnum 101 :: PortNumber) ? |
| 17:03:47 | <byorgey> | wait, no it doesn't |
| 17:04:02 | <byorgey> | hm, print (101 :: PortNumber) works fine |
| 17:04:17 | <mrd> | i've gleaned from the source code that the fromInteger method of Num PortNumber will do the endian conversion for you, and the Show instance does it back |
| 17:04:18 | <byorgey> | but print (PortNum 101) doesn't |
| 17:04:21 | <mrd> | right |
| 17:04:31 | <byorgey> | ah, interesting |
| 17:04:32 | <mrd> | because PortNum :: Int -> PortNumber |
| 17:04:37 | <byorgey> | right |
| 17:04:37 | <mrd> | and is a constructor |
| 17:04:42 | <oerjan> | right, so the contained Word16 value is not meant to be used directly |
| 17:04:50 | <mrd> | whereas fromInteger method is defined to do the endian conversion for you. |
| 17:04:58 | <mrd> | basically -- the export of PortNum is a flaw in the API |
| 17:05:03 | <mrd> | it is supposed to be abstract |
| 17:05:16 | <byorgey> | huamn_: you got all that? =) |
| 17:05:24 | <huamn_> | pretty much |
| 17:05:29 | <huamn_> | i removed the PortNum now it works |
| 17:05:31 | <huamn_> | :p |
| 17:05:32 | <mrd> | the comments indicate that it is a workaround to allow Network.BSD access to it |
| 17:05:39 | <huamn_> | tried to hassle around too much with the types |
| 17:05:48 | <huamn_> | thanks |
| 17:05:53 | <mrd> | huamn_: in general, if you have a var :: Int, and want a portnumber, do fromInteger var |
| 17:05:56 | <mrd> | er |
| 17:05:57 | <mrd> | fromIntegral var |
| 17:06:15 | <huamn_> | seems to be okay to just give the port directly to the sendTo |
| 17:06:23 | <mrd> | literal numbers are defined to be (fromInteger ...) already |
| 17:06:28 | <huamn_> | without constructing PortNum or applying fromInteger |
| 17:06:32 | <huamn_> | okay |
| 17:06:40 | <huamn_> | so it's just implicit (fromInteger 100) |
| 17:06:42 | <mrd> | right |
| 17:07:12 | <mrd> | and the context says "we want a PortNumber" and it also says "PortNumber is a Num" therefore "there is a fromInteger defined appropriately" |
| 17:07:31 | <huamn_> | ok |
| 17:07:48 | <mrd> | and yes, it would be wonderful if this was noted somewhere in the API |
| 17:07:52 | <huamn_> | :) |
| 17:07:55 | <huamn_> | indeed |
| 17:08:06 | <mrd> | there's a lot of broken things about Network.Socket, sadly |
| 17:11:08 | <huamn_> | I also didn't find any host-resolving stuff except the Network-package functions which do not seem to support UDP... where's the resolving-related functions which I could use with Network.Socket? Or am I just blind? :) |
| 17:12:22 | <mrd> | Network.BSD |
| 17:12:34 | <mrd> | I believe getHostByName type things live there |
| 17:12:49 | <huamn_> | ah yes |
| 17:12:55 | <huamn_> | thanks |
| 17:14:38 | <pizza_> | what does the $ do in haskell? |
| 17:14:53 | <birkenfeld> | pizza_: it's function application |
| 17:15:00 | <birkenfeld> | but with a very low priority |
| 17:15:04 | <oerjan> | @src $ |
| 17:15:05 | <lambdabot> | f $ x = f x |
| 17:15:24 | <mauke> | ($) = fmap fix return |
| 17:15:59 | <geocalc> | huamn_-> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsdns-1.0 ? |
| 17:16:01 | <lambdabot> | http://tinyurl.com/2bfgps |
| 17:16:59 | <huamn_> | the BSD-stuff is actually fine, I was just unable to locate it from there... :) |
| 17:18:16 | <ADEpt> | quicksilver: here? |
| 17:18:28 | <byorgey> | mauke, that's mean =) |
| 17:18:40 | <dcoutts_> | joe_hurd: btw: http://darcs.haskell.org/SoC/haddock.ghc/ |
| 17:18:41 | <lambdabot> | Title: Index of /SoC/haddock.ghc |
| 17:19:25 | <dcoutts_> | though I'm not absolutely sure that's the location of the latest haddock 2.0 code |
| 17:19:43 | <joe_hurd> | dcoutts_: thanks for the pointer, but i'll still wait for the release of ghc 6.8 |
| 17:19:52 | <dcoutts_> | good plan |
| 17:20:02 | <joe_hurd> | dcoutts_: too much of a newbie to enter those waters |
| 17:20:08 | <dcoutts_> | :-) |
| 17:23:09 | <pizza_> | is there a canonical "timer" function so that i could do something like "> time foo" and get the run time of foo? |
| 17:23:18 | <Cale> | pizza_: :set +s |
| 17:23:28 | <fasta> | pizza_: no |
| 17:23:56 | <pizza_> | Cale: ah, excllent, thank you |
| 17:24:39 | <fasta> | Was there any reason for the data structure in the ICFP contest to be purely functional? |
| 17:26:59 | <waern> | dcoutts: that's the right location |
| 17:27:12 | <dcoutts_> | waern: ok, btw, what's left to do? |
| 17:27:21 | <dcoutts_> | waern: we need some cabal changes right? |
| 17:27:24 | <waern> | dcoutts: support more extensions + fix bugs |
| 17:27:28 | <waern> | dcoutts: yes |
| 17:27:48 | <dcoutts_> | waern: and we need to reinstate the --read-iface thing in haddock right? |
| 17:28:03 | <waern> | dcoutts_: yes. since haddock shouldn't do the $topdir resolving itself |
| 17:28:13 | <dcoutts_> | waern: rather than having haddock relying exclusively on ghc-pkg |
| 17:28:31 | <waern> | dcoutts: yes that's another good reason |
| 17:28:32 | <MyCatSchemes> | Arsefeck! *tries to construct an infinite type* |
| 17:28:57 | <dcoutts_> | waern: cabal currently does not use the haddock -package stuff at all, cabal calls ghc-pkg itself, checks the files really exist and then calls haddock with --read-blah |
| 17:29:46 | <waern> | dcoutts_: yes, I know... |
| 17:29:48 | <dcoutts_> | waern: so what changes were needed in cabal for haddock-2.0 ? |
| 17:30:10 | <dcoutts_> | and would we need any changes at all if haddock-2.0 continues to support --read-interface ? |
| 17:30:31 | <waern> | dcoutts_: well.. support for detecting haddock-2.0 and sending it the GHC build params |
| 17:30:46 | <dcoutts_> | waern: ah yes, hmm. |
| 17:30:50 | <dcoutts_> | detecting is easy |
| 17:30:57 | <waern> | but me and nominolo was working on that |
| 17:31:05 | <waern> | I don't know how far the patch got though... |
| 17:31:13 | <MyCatSchemes> | I need a function which returns functions of the same type as itself. :/ |
| 17:31:34 | <waern> | dcoutts_: for the build params we wanted to introduce a new datatype instead of using lists of strings as it is now |
| 17:31:44 | <dcoutts_> | waern: it'd be nice if we could get those changes into cabal-1.2 so that people will be able to start using haddock-2.0 with ghc-6.8 without needing to upgrade their cabal |
| 17:32:09 | <waern> | dcoutts_: yes! you mean something like cabal-1.2.1? |
| 17:32:15 | <dcoutts_> | right |
| 17:32:55 | <dcoutts_> | waern: yeah, I already released cabal-1.2.0, but I'll bump it again to 1.2.1 by the time ghc-6.8.1 comes out |
| 17:33:20 | <dcoutts_> | so now is the time to get any cabal changes in, if you want haddock-2.0 to work 'out of the box' with ghc-6.8.1 |
| 17:33:42 | <byorgey> | MyCatSchemes: if you introduce a newtype it should be possible. |
| 17:34:04 | <waern> | dcoutts_: yeah. I'll talk to nominolo |
| 17:34:12 | <dcoutts_> | ok |
| 17:34:18 | <waern> | see if I can get his patch |
| 17:34:24 | <waern> | and take it from there |
| 17:34:27 | <byorgey> | newtype WeirdFunction a = WF (a -> WeirdFunction a) |
| 17:35:11 | <byorgey> | perfectly legitimate =) |
| 17:35:32 | <takamura> | hi |
| 17:35:43 | <byorgey> | hi takamura |
| 17:36:04 | <vincenz> | > maxBound :: Int |
| 17:36:05 | <lambdabot> | 2147483647 |
| 17:36:59 | <kaol> | > maxBound :: Char |
| 17:37:00 | <lambdabot> | '\1114111' |
| 17:37:44 | <byorgey> | MyCatSchemes: does that help? |
| 17:40:25 | <geocalc> | @hoogle Distribution.Simple.Program |
| 17:40:26 | <lambdabot> | No matches, try a more general search |
| 17:40:55 | <geocalc> | @hoogle Distribution |
| 17:40:56 | <lambdabot> | No matches found |
| 17:41:03 | <pgavin> | ping |
| 17:41:28 | <pgavin> | dcoutts_: hia |
| 17:41:39 | <dcoutts_> | pgavin: hi |
| 17:41:56 | <pgavin> | how was the hackathon? |
| 17:41:58 | <dcoutts_> | pgavin: we looked at your code during the hackathon, specifically kolmodin did |
| 17:42:03 | <dcoutts_> | pgavin: it was great fun |
| 17:42:08 | <pgavin> | great |
| 17:42:15 | <pgavin> | I wish I could've been there |
| 17:42:21 | <pgavin> | but there's an ocean in the way :) |
| 17:42:25 | <shapr> | @yow ! |
| 17:42:25 | <lambdabot> | Where's th' DAFFY DUCK EXHIBIT?? |
| 17:42:26 | <dcoutts_> | and nominolo amd kolmodin and I discussed deps at great length |
| 17:42:33 | <dcoutts_> | pgavin: heh, right |
| 17:42:47 | <dcoutts_> | pgavin: you missed out on nice German wheat beer too :-) |
| 17:43:01 | <pgavin> | dcoutts: aww, darn :) |
| 17:43:15 | <pgavin> | well, if I was there I would've brought some of my homebrew :) |
| 17:43:16 | <takamura> | I have a question: I'm calling LaTeX from a Haskell program on Windows using the "system" function, but latext shows a window with logging messages. This confuses the modal windows of my program and causes errors. I dissabled latex messages with --quiet option, but still, the window pops up (showing "entering extended mode"). Somebody knows how to disable this behaviour? |
| 17:44:04 | <pgavin> | takamura: I would suppose that's because windows doesn't really have the concept of a proper stdout/stdin |
| 17:44:24 | <dcoutts_> | takamura: on windows calling a command line prog always opens a terminal unless it was already called from a terminal |
| 17:44:28 | <pgavin> | takamura: perhaps you can create a pif or something for the latex execcutable |
| 17:44:40 | <allbery_b> | more that cmd.exe likes to open windows ==dcoutts_ |
| 17:44:43 | <dcoutts_> | takamura: to override that behaviour requires using win32 functions directly |
| 17:45:13 | <dcoutts_> | allbery_b: I bet if you use rawSystem you'd see the same behaviour |
| 17:45:26 | <dcoutts_> | rawSystem bypasses the command interpreter, ie cmd.exe |
| 17:45:29 | <geocalc> | ./Setup.lhs:9:7: |
| 17:45:29 | <geocalc> | Could not find module `Distribution.Simple.Program': |
| 17:45:29 | <geocalc> | where is this module ??? |
| 17:45:35 | <takamura> | win32 functions can be called from haskell? |
| 17:45:37 | <Zao> | Cabal, isn't it? |
| 17:45:44 | <allbery_b> | that's part of cabal, yes |
| 17:45:45 | <pgavin> | dcoutts_: is it a good time for me to get write access on the gtk2hs repo? |
| 17:45:46 | <dcoutts_> | geocalc: Cabal-1.2.x |
| 17:45:47 | <pgavin> | takamura: yes |
| 17:45:54 | <pgavin> | takamura: see the ffi |
| 17:46:03 | <pgavin> | takamura: it's really easy, actually :) |
| 17:46:04 | <geocalc> | ok thanks |
| 17:46:11 | <allbery_b> | takamura: also look at System.Win32 (IIRC) |
| 17:46:12 | <takamura> | thanks, i will take a look |
| 17:46:14 | <dcoutts_> | pgavin: ah, your last patch, I didn't apply it because it touched some core build files |
| 17:46:29 | <dcoutts_> | pgavin: perhaps you could look at that and tell me what changes were necessary |
| 17:46:34 | <pgavin> | dcoutts_: hmm, ok |
| 17:46:38 | <allbery_b> | ...and I thought that was cmd.exe but I admit to not knowing windows guts very well |
| 17:46:39 | <pgavin> | dcoutts_: lemme check |
| 17:46:47 | <dcoutts_> | pgavin: I'm perfectly happy to blindly apply patches that only modify gnomevfs or gstreamer |
| 17:47:20 | <pgavin> | dcoutts_: |
| 17:47:20 | <dcoutts_> | pgavin: if you want core changes too, please separate those out into self-contained patches with a description |
| 17:47:35 | <pgavin> | dcoutts_: I generally do try to separate them out like that |
| 17:47:40 | <pgavin> | dcoutts_: I may have missed one |
| 17:48:19 | <dcoutts_> | pgavin: aye, it sounded like in your patch description that you were not really intending to modify build files in non-trivial ways |
| 17:48:21 | <pgavin> | dcoutts_: there's one patch that touches Makefile.am, but I just made the heirarchyGen not be compiled with splitobs |
| 17:48:30 | <kaol> | how would I unescape URIs? (ie. turn %## into a character) I can't recall how an Int was turned into a Char, and I'd need to parse a hexadecimal digit too. |
| 17:48:46 | <dcoutts_> | pgavin: could you point me at the patch you want applied and I can look at it right now |
| 17:48:53 | <pgavin> | dcoutts_: err, heirarchyGenGst, rather |
| 17:50:23 | <pgavin> | dcoutts_: there's a big patch tagged "ou are no longer marked as being away |
| 17:50:23 | <pgavin> | *** You are no longer marked as being away |
| 17:50:23 | <pgavin> | *** You are no longer marked as being away |
| 17:50:23 | <pgavin> | *** You are no longer marked as being away |
| 17:50:28 | <pgavin> | ER |
| 17:50:31 | <pgavin> | hrrm |
| 17:50:55 | <dcoutts_> | pgavin: ? :-) |
| 17:51:00 | <pgavin> | tagged "gstreamer: lots of new code" |
| 17:51:05 | <pgavin> | sorry, paste error :) |
| 17:51:28 | <pgavin> | that patch touches makefile.am and configure,ac, but only gstreamer stuff |
| 17:51:37 | <pgavin> | that patch is pretty important |
| 17:52:32 | <dmwit> | Damn, people in here talk about their wives and girlfriends? |
| 17:52:35 | <dmwit> | I miss all the juicy stuff. |
| 17:52:37 | <pgavin> | that one and the "make heirarchyGenGst not use splitobjs" patch are the only ones that touch the build system |
| 17:52:45 | <kaol> | > readHex "ab" -- found that one at least |
| 17:52:47 | <lambdabot> | [(171,"")] |
| 17:53:02 | <kaol> | @hoogle Int -> Char |
| 17:53:03 | <lambdabot> | Char.chr :: Int -> Char |
| 17:53:03 | <lambdabot> | Char.intToDigit :: Int -> Char |
| 17:53:03 | <lambdabot> | Data.PackedString.indexPS :: PackedString -> Int -> Char |
| 17:54:52 | <allbery_b> | ...and toEnum :: Int -> Char |
| 17:55:35 | <MyCatSchemes> | @pl (\x y->takeWhile isJust $ (\a b->[Nothing])) |
| 17:55:35 | <lambdabot> | const (const (takeWhile isJust (const (const [Nothing])))) |
| 17:55:58 | <MyCatSchemes> | @pl (\x y->takeWhile isJust $ (\a b->[(Just a),(Just b),Nothing])) |
| 17:55:58 | <lambdabot> | const (const (takeWhile isJust ((. ((: [Nothing]) . Just)) . (:) . Just))) |
| 17:56:02 | <pgavin> | dcoutts_: one thing that might make this stuff easier is to split the top level makefile into parts that are included |
| 17:56:23 | <dcoutts_> | pgavin: aye perhaps |
| 17:56:26 | <pgavin> | dcoutts_: that way if e.g. I need to add modules for gstreamer, it only touches the included part |
| 17:56:56 | <dcoutts_> | pgavin: though I like to keep an eye on the build system changes generally since it's a tad fragile |
| 17:56:58 | <dcoutts_> | :-) |
| 17:57:08 | <pgavin> | dcoutts_: of course :) |
| 17:57:20 | <dcoutts_> | pgavin: until we get it all building with cabal of course :-) |
| 17:57:28 | <pgavin> | dcoutts_: I generally build at least once all the way through before sending a patch |
| 17:57:31 | <MyCatSchemes> | ACTION frowns at \bot. |
| 17:57:35 | <pgavin> | dcoutts_: right :) |
| 17:58:39 | <dcoutts_> | pgavin: oh I'm sure it actually builds for you, that's not a problem, experience has taught me that building on random different platforms is more trouble |
| 17:58:54 | <pgavin> | dcoutts_: oh, right, of course :) |
| 17:59:34 | <pgavin> | maybe I should set up virtualbox VMs for 3 or 4 distros for testing |
| 17:59:34 | <vincenz> | > let foo'bar x = x + 2 in foo'bar 4 |
| 17:59:36 | <lambdabot> | 6 |
| 17:59:41 | <vincenz> | spiffy, you can have ' in names |
| 17:59:44 | <dcoutts_> | pgavin: no need really |
| 17:59:59 | <dcoutts_> | pgavin: so I'm around for the next hour, so if you can point me at what you want reviewed and applied I can do that now |
| 18:00:00 | <pgavin> | dcoutts_: yeah, I wasn't completely serious |
| 18:00:11 | <pgavin> | dcoutts_: oh, ok.. |
| 18:00:21 | <pgavin> | well, pretty much everything :) |
| 18:00:24 | <dmwit> | :t par |
| 18:00:26 | <lambdabot> | forall a b. a -> b -> b |
| 18:00:41 | <pgavin> | but the patches labelled gtk can wait |
| 18:00:47 | <dcoutts_> | pgavin: so is the patch in an existing email? |
| 18:01:01 | <pgavin> | yeah, I think its waiting in the moderator queue |
| 18:01:17 | <dcoutts_> | oh, ok, can you post it somewhere so we can bypass that? |
| 18:01:22 | <pgavin> | oh, sure |
| 18:01:27 | <dcoutts_> | I'm not actually moderator |
| 18:05:09 | <saccade> | is there a superordinate category that contains both arithmetic and geometric progressions? |
| 18:05:49 | <saccade> | one that captures the property that you can choose every n'th element and get a similar kind of uniform progression |
| 18:06:50 | <pgavin> | dcoutts_: http://www.eng.fsu.edu/~pgavin/gtk2hs.gstreamer-20071008.dpatch.bz2 |
| 18:06:53 | <lambdabot> | http://tinyurl.com/28prjx |
| 18:07:16 | <dcoutts_> | pgavin: ok |
| 18:09:59 | <ADEpt> | does anyone have a good example of this: "an alternative way to deal with multiple transformers of the same type (i.e. many states, environments, or output) is to parameterize the transformer operations by an inedx specifying *which* state (environemnt, etc) you want to access, or update. the indexes are basically just used for their types, and one hopes that can be optimized away," (taken from: http://www.mail-archive.com/haskell-cafe@haskell.org/msg02534. |
| 18:11:52 | <shapr> | So whenever I use monad transformers, I start to sing the "transformers, more than meets the eye" theme song in my head... |
| 18:12:02 | <shapr> | Does that happen to anyone else? |
| 18:12:46 | <mrd> | she's not just a spaceship ... she's a transformer |
| 18:13:48 | <dcoutts_> | pgavin: ah this is the one I didn't apply last time: |
| 18:13:48 | <dcoutts_> | Thu Sep 6 22:21:29 BST 2007 Peter Gavin <pgavin@gmail.com> |
| 18:13:48 | <dcoutts_> | * gstreamer: lots of new code |
| 18:14:03 | <mrd> | spaceball 1 has now become .. megamaid |
| 18:14:09 | <dcoutts_> | as it touches Makefile.am configure and ./tools/hierarchyGenGst/TypeGen.hs quite a lot |
| 18:14:19 | <bos> | the gstreamer stuff in gtk2hs doesn't currently build. |
| 18:14:43 | <dcoutts_> | bos: we'll see if it builds with this big set of patches from pgavin |
| 18:14:51 | <dcoutts_> | I'm currently reviewing them |
| 18:14:52 | <bos> | ok, cool |
| 18:17:35 | <pgavin> | dcoutts_: right, it does touch a lot of stuff, sorry about that |
| 18:17:50 | <dcoutts_> | pgavin: what's the TypeGen stuff for? |
| 18:17:58 | <dcoutts_> | ACTION is currently reading that code |
| 18:17:58 | <pgavin> | bos: could you send me the error messages? |
| 18:18:22 | <pgavin> | dcoutts_: umm, well, gstreamer has a hierarchy that isn't rooted on GObject |
| 18:18:35 | <bos> | pgavin: not easily. i was doing the build while rpm packaging, and don't have logs. |
| 18:18:37 | <pgavin> | they actually created a new root object GstMiniObject |
| 18:18:43 | <dcoutts_> | pgavin: ok |
| 18:19:00 | <pgavin> | bos: hmm, can you send me the spec file? |
| 18:19:25 | <bos> | pgavin: where to? |
| 18:19:29 | <pgavin> | pgavin@gmail.com |
| 18:19:34 | <bos> | kk |
| 18:19:45 | <vincenz> | ACTION winces |
| 18:19:54 | <pgavin> | bos: which distro are you using? |
| 18:20:05 | <bos> | fedora, with a ghc 6.8.0 snapshot |
| 18:20:20 | <pgavin> | ah |
| 18:20:22 | <pgavin> | that might be why |
| 18:20:32 | <pgavin> | I haven't built against 6.8 yet |
| 18:20:36 | <pgavin> | just 6.6 |
| 18:20:38 | <bos> | i don't think so. the error looked quite straightforward and not compiler-related. |
| 18:20:39 | <glen_quagmire> | isn't 6.6.1 latest? |
| 18:20:53 | <bos> | pgavin: sent |
| 18:20:56 | <pgavin> | bos: ok, well, I'll check it out |
| 18:21:20 | <bos> | pgavin: in the spec file i sent you, i'm not configuring with --enable-gstreamer because of the build problem |
| 18:21:39 | <pgavin> | right |
| 18:22:34 | <pgavin> | bos: so are you using a home-rolled rpm for ghc 6.8? |
| 18:23:38 | <bos> | pgavin: i comaintain the fedora package of ghc |
| 18:24:03 | <bos> | so it's not homebuilt, it's the official fedora ghc 6.8.0 snapshot |
| 18:24:47 | <pgavin> | bos: ah, ok :) |
| 18:24:51 | <pgavin> | didn't realize :) |
| 18:25:02 | <geocalc> | Preprocessing executables for alex-2.1.0... |
| 18:25:02 | <geocalc> | Setup.lhs: alex command not found ??? howto solve this ??? |
| 18:25:38 | <pgavin> | geocalc: install alex :) |
| 18:25:50 | <geocalc> | i try |
| 18:26:02 | <pgavin> | geocalc: what OS/distro? |
| 18:26:25 | <geocalc> | linux paldo |
| 18:26:27 | <bos> | geocalc: just because it complains about no alex doesn't mean it needs alex |
| 18:27:03 | <pgavin> | yeah, those messages are confusing :) |
| 18:27:06 | <bos> | "Setup configure" has this unfortunate habit of checking for, and complaining about, things it doesn't need :-( |
| 18:27:40 | <pgavin> | bos: oh, just to let you know, the gstreamer code is 99% untested :) |
| 18:27:49 | <geocalc> | confusing yes |
| 18:28:06 | <pgavin> | and the gnomevfs code is 95% untested :) |
| 18:29:46 | <geocalc> | mmh the problem is the build aborted |
| 18:31:50 | <geocalc> | bad alex need alex to build |
| 18:33:26 | <pgavin> | geocalc: your distro doesn't include an alex package? |
| 18:35:14 | <geocalc> | my distro include only things building shared libs pgavin |
| 18:38:10 | <pgavin> | geocalc: did you just try doing ./setup build after the ./setup configure? |
| 18:38:26 | <pgavin> | geocalc: because I don't think alex really needs itself to build |
| 18:39:03 | <djfroofy> | has anyone used haskell to write a distributed application? thoughts about using haskell vs. erlang for this? |
| 18:39:20 | <geocalc> | the message is from build pgavin |
| 18:39:53 | <bos> | djfroofy: i don't know of anybody doing anything significant yet, so there's little to no library support. erlang has substantial library support right now. |
| 18:40:04 | <pizza_> | djfroofy: an excellent question |
| 18:40:34 | <bos> | haskell doesn't have any equivalents of mnesia or OTP yet, although HAppS could be argued to provide some of what mnesia gives you. |
| 18:41:29 | <shapr> | but it's not distributed |
| 18:42:18 | <bos> | well, it has that multi-master MACID monad doodad, right? |
| 18:42:34 | <shapr> | yeah |
| 18:43:25 | <djfroofy> | bos: thanks, that's what i thought. well i'm using erlang for the application my inquiry concerns. it isn't as elegant, but the shared nothing message passing semantics seems ideal for a distributed app. |
| 18:43:57 | <geocalc> | Could not find module `Distribution.Setup': |
| 18:43:58 | <geocalc> | it is a member of package Cabal-1.1.6.2, which is hidden now i have this message from the cabal alex at configure how i unhidd ??? |
| 18:44:13 | <bos> | djfroofy: you can do message passing locally in haskell, just not over the network. |
| 18:44:52 | <djfroofy> | bos: yeah. i like how erlang makes this `mostly' transparent. |
| 18:46:17 | <pgavin> | geocalc: ghc -package Cabal-1.1.6.2 --make Setup.lhs -o setup |
| 18:46:17 | <bos> | we can do mostly transparent in haskell, too. just nobody has. actually, that's not true. there have been a few initiatives, but they happened long before anybody really cared, and have bitrotted. |
| 18:46:49 | <geocalc> | thanks pgavin |
| 18:47:16 | <bos> | i know of glasgow distributed haskell (fairly silly idea, only a vehicle for publication and funding), port-based distributed haskell (dates to 2000, overly complex, dead), and something ChilliX did around 2000 too, also dead. |
| 18:48:54 | <djfroofy> | bob: does any haskell lib have mostly cross-platform asynchronous network io support using kernel polling (epoll, select ...)? |
| 18:49:09 | <djfroofy> | bos: sorry, bos, not bob |
| 18:49:26 | <shapr> | I wonder if the recently release network-bytestring could be used for that? |
| 18:49:30 | <bos> | yeah, the standard network package does that. |
| 18:50:12 | <djfroofy> | the standard network package uses select if available? where can i go to read about this? |
| 18:50:16 | <bos> | djfroofy: see also http://www.seas.upenn.edu/~lipeng/homepage/unify.html |
| 18:50:17 | <lambdabot> | Title: Unifying events and threads |
| 18:50:22 | <bos> | djfroofy: it always uses select. |
| 18:50:39 | <etnt`> | so where is put in the state Monad described ? been trying to find it via hoogle... |
| 18:50:58 | <bos> | the haskell networking model is that you fire off a thread per connection, and they're very lightweight. much like erlang, in fact. |
| 18:51:07 | <oerjan> | @src MonadState |
| 18:51:08 | <lambdabot> | Source not found. This mission is too important for me to allow you to jeopardize it. |
| 18:51:14 | <djfroofy> | bos: user level threads ... yeah i know this |
| 18:51:17 | <oerjan> | @hoogle MonadState |
| 18:51:18 | <lambdabot> | Control.Monad.State.MonadState :: class Monad m => MonadState s m |
| 18:51:41 | <dcoutts_> | bos: we need to form a consortium of hackers with good taste to define a quality collection of packages, ie core libs plus others of high standard |
| 18:51:57 | <bos> | djfroofy: so down in the bowels of the implementation, GHC's runtime uses select to see which threads have IO pending |
| 18:51:58 | <byorgey> | etnt`: note that put is a function in the MonadState class, so its definition is different for each monad that is an instance of MonadState. |
| 18:52:04 | <bos> | dcoutts_: yeah |
| 18:52:14 | <dcoutts_> | bos: now that the 'standard' bundled libs are ever smaller we need some other mechanism for defining what's definately ok to use and ship |
| 18:52:23 | <byorgey> | etnt`: but you might want to look at, e.g. Control.Monad.State.Lazy |
| 18:52:32 | <djfroofy> | bos: nice. but you can't compile GHC to use kqueue for BSD or epoll? |
| 18:52:42 | <bos> | djfroofy: i'm working on layering the low-level select code on top of a portable wrapper that will use more scalable mechanisms like epoll or kqueue |
| 18:52:54 | <byorgey> | etnt`: are you looking for some code, or for a text description/tutorial type thing? |
| 18:53:11 | <bos> | dcoutts_: cpan solves this quite well by allowing people to write reviews of, and vote on, packages |
| 18:53:18 | <bos> | dcoutts_: it's a nicely decentralised approach |
| 18:53:20 | <djfroofy> | bos: very intriguing. i'd like to know when this is done. |
| 18:53:26 | <dcoutts_> | bos: so hackage allows lots of experiments but we need some mechanism for identifying and maintaining quality packages |
| 18:53:32 | <bos> | djfroofy: given my workload, it's not rushing along |
| 18:53:46 | <dcoutts_> | bos: right, just some more info and stats on hackage would help |
| 18:54:14 | <djfroofy> | bos: i definitely understand. i'd help if i could only wrap my brain more around the language ;) |
| 18:54:24 | <etnt`> | byorgey: well I'm using the State monad and wanted to know how put operates on it |
| 18:54:50 | <dcoutts_> | bos: but I can't help thinking we need something additional that's a bit more organised for stamping some collection of packages as working together and being of a high standard, documented etc |
| 18:55:08 | <dcoutts_> | bos: and that does not need to be tied to release schedules of ghc etc |
| 18:55:13 | <byorgey> | etnt`: ah, ok. well, let's start here: |
| 18:55:14 | <byorgey> | @type put |
| 18:55:17 | <bos> | dcoutts_: yes, that would make some sense. essentially a distribution of haskell modules. |
| 18:55:20 | <lambdabot> | forall s (m :: * -> *). (MonadState s m) => s -> m () |
| 18:55:27 | <bos> | actually, not some sense, lots of sense. |
| 18:55:30 | <dcoutts_> | bos: exactly, a distribution |
| 18:55:31 | <EvilTerran> | @src State |
| 18:55:32 | <lambdabot> | Source not found. Your mind just hasn't been the same since the electro-shock, has it? |
| 18:55:33 | <byorgey> | the important part is s -> m () |
| 18:55:47 | <byorgey> | put takes one argument of whatever type the state is |
| 18:56:02 | <byorgey> | and it results in a monadic action which updates the state. |
| 18:56:06 | <bos> | dcoutts_: in the editing world, that's why i stick with xemacs over emacs. it has a "sumo" package that bundles loads of useful stuff in one place. |
| 18:56:45 | <dcoutts_> | bos: which partly helps with distribution, but more importantly with letting other people decide what is a consistent collection of high quality code |
| 18:56:53 | <waern> | dcoutts_: has pkg-config-depends been implemented in cabal yet? |
| 18:57:01 | <dcoutts_> | waern: yes |
| 18:57:12 | <waern> | dcoutts_: in 1.2.0? |
| 18:57:14 | <dcoutts_> | yes |
| 18:57:31 | <bos> | dcoutts_: the other thing that a distribution might do is encourage people to maintain their packages more actively. |
| 18:57:40 | <etnt`> | byorgey: hm...ok |
| 18:57:59 | <bos> | which would be valuable. there's quite a bit of half-finished stuff on hackage, at least some of which i'm responsible for :-) |
| 18:58:09 | <dcoutts_> | bos: aye, eg it could set goals and publish info on testing, coverage, documentation, etc etc |
| 18:58:26 | <byorgey> | etnt`: is there some specific code you're having trouble with? or just trying to understand it in general? |
| 18:58:48 | <dcoutts_> | bos: though all that infrastructure could be used on hackage for all packages, but we'd require packages in the distro to achieve certain levels |
| 18:59:11 | <byorgey> | etnt`: I could also try showing you a few examples if you want |
| 18:59:23 | <dcoutts_> | bos: eg, packages with QC/HUnit tests, hackage should display info about the tests, and use hpc to show test coverage |
| 18:59:42 | <dcoutts_> | bos: once you measure it an publish the info it encourages improvements by maintainers |
| 19:00:13 | <etnt`> | byorgey: well I had a session the other evening with dmwit and yitz where I tried to transform a simple program into using the State monad |
| 19:00:40 | <etnt`> | byorgey: it almost was finished, I can paste to hpaste.org how far I got |
| 19:00:46 | <byorgey> | etnt`: ok, sure |
| 19:00:58 | <bos> | dcoutts_: exactly |
| 19:02:54 | <hpaste> | etnt' pasted "using monads" at http://hpaste.org/3207 |
| 19:03:31 | <waern> | dcoutts_: ah, it's called pkgconfig-depends. |
| 19:03:41 | <etnt`> | byorgey: there you have it |
| 19:03:48 | <dcoutts_> | waern: yep |
| 19:03:58 | <hpaste> | sclv pasted "A pass at a difflike utility" at http://hpaste.org/3208 |
| 19:04:07 | <dcoutts_> | waern: @tell me if it works for you, but right now I'm off! |
| 19:04:17 | <waern> | dcoutts_: ok! |
| 19:04:36 | <sclv> | i just put a toy i'm working on for a char-by-char diff with handy output formats (eventually) on hpaste. |
| 19:04:55 | <sclv> | style/efficiency comments more than welcome |
| 19:05:42 | <sclv> | i'm working with sequences so i don't see any way around that ugly where clause at the end of the lcs section |
| 19:05:59 | <sclv> | (except maybe that for what i'm doing, a list is just as efficient) |
| 19:07:04 | <Saizan> | sclv: a :> ar = viewl as -- ? |
| 19:07:57 | <sclv> | Saizan: ooh, the :> can be used as a deconstructor? of course. how dim of me. |
| 19:08:58 | <Saizan> | being a constructor you can pattern match on it |
| 19:09:10 | <etnt`> | byorgey: if I run: sc2 [1,2,3,4,5] ghci complains about: No instance for (Show (State S ())) |
| 19:09:51 | <etnt`> | byorgey: so I was thinking I should make a function: State S () -> S |
| 19:10:18 | <etnt`> | byorgey: but I'm probably not thinking straight... |
| 19:12:02 | <Saizan> | ?type runState |
| 19:12:04 | <lambdabot> | forall s a. State s a -> s -> (a, s) |
| 19:12:15 | <Saizan> | ?type evalState |
| 19:12:17 | <lambdabot> | forall s a. State s a -> s -> a |
| 19:12:22 | <Saizan> | ?type execState |
| 19:12:23 | <lambdabot> | forall s a. State s a -> s -> s |
| 19:14:11 | <byorgey> | etnt`: sorry, I got a phone call |
| 19:14:20 | <etnt`> | byorgey: np |
| 19:14:21 | <byorgey> | etnt`: give me a minute to read what you posted |
| 19:16:42 | <paczesiowa> | can I use classes as types as in data A = A Integral Integral ? |
| 19:16:57 | <byorgey> | etnt`: ok, I see. you want a function like runState. |
| 19:17:00 | <byorgey> | @type runState |
| 19:17:02 | <lambdabot> | forall s a. State s a -> s -> (a, s) |
| 19:17:13 | <byorgey> | @type execState |
| 19:17:15 | <lambdabot> | forall s a. State s a -> s -> s |
| 19:17:23 | <byorgey> | there, execState is probably what you want actually. |
| 19:17:36 | <oerjan> | paczesiowa: no |
| 19:17:41 | <byorgey> | it encompasses both your 'initialize' and getting the state out at the end. |
| 19:18:03 | <paczesiowa> | oerjan: even with some exts? and why? |
| 19:18:28 | <etnt`> | byorgey: hm, so what should the second argument be ? |
| 19:18:34 | <ski> | paczesiowa : mayhap you want `data Integral a => A a = A a a' ? |
| 19:19:13 | <hpaste> | byorgey annotated "using monads" with "using execState" at http://hpaste.org/3207#a1 |
| 19:19:34 | <byorgey> | etnt`: the initial state. |
| 19:20:17 | <etnt`> | byorgey: aha, let me see... |
| 19:20:33 | <oerjan> | paczesiowa: not without wrapping it in an existential data type |
| 19:20:51 | <oerjan> | ski's suggestion is not quite the same either |
| 19:21:33 | <byorgey> | etnt`: also, instead of 'do { s <- get; put s }' you could just say 'return ()' |
| 19:21:47 | <ski> | (elaboration on intended usage could be handy) |
| 19:21:52 | <paczesiowa> | ski: but that requires both a to be the same type |
| 19:22:08 | <sclv> | @src putStrLn |
| 19:22:08 | <lambdabot> | putStrLn s = do putStr s; putChar '\n' |
| 19:22:11 | <EvilTerran> | that's something i don't quite get; data Foo a => Bar a = Bar a; data Bar a = Foo a => Bar a; and data Bar a = Bar (Foo a => a) seem to all be subtly different, but i'm not sure how they differ |
| 19:22:22 | <ski> | paczesiowa : indeed .. it wasn't clear (to me) whether that was intended or not |
| 19:22:43 | <etnt`> | byorgey: aah..that's wonderful, it works :-) |
| 19:22:53 | <byorgey> | excellent =) |
| 19:22:53 | <paczesiowa> | ski: can you turn that definition to e.g. Show a,b = A a b |
| 19:23:07 | <etnt`> | byorgey: many thanks! |
| 19:23:13 | <byorgey> | etnt`: you're welcome! |
| 19:23:14 | <paczesiowa> | ski: so I can have A 1 "foo" |
| 19:23:17 | <ski> | data (Show a,Show b) => A a b = ..a..b.. |
| 19:23:17 | <oerjan> | EvilTerran: i am not sure any but the first is legal |
| 19:23:27 | <byorgey> | etnt`: are you aware that the function "isOdd" already exists? |
| 19:23:28 | <EvilTerran> | I seem to recall that they all parse |
| 19:23:32 | <byorgey> | @type odd |
| 19:23:33 | <lambdabot> | forall a. (Integral a) => a -> Bool |
| 19:23:36 | <roconnor> | ACTION continues to work on porting Phooey to gtk2hs |
| 19:23:37 | <paczesiowa> | ski: thx, I tried with two (=>) |
| 19:23:45 | <EvilTerran> | i may be missing forall.s |
| 19:23:51 | <etnt`> | byorgey: I do now... :-) |
| 19:24:46 | <etnt`> | byorgey: I've read so many Monad papers, where the best one probably is Monads in Func.Prog by Wadler, it all seem so obvious.. |
| 19:25:15 | <byorgey> | etnt`: yes, but actually using them is a different matter... it just takes some practice =) |
| 19:25:29 | <etnt`> | byorgey: exactly! |
| 19:25:53 | <byorgey> | etnt`: also -- not to burst your bubble, you've learned a lot about the State monad etc. and that's worthwhile -- but sumCount could also be implemented much more simply |
| 19:26:08 | <ski> | EvilTerran : i think the last one isn't allowed in this case (at least one class arg must be univ. quantified over the argument type) |
| 19:26:25 | <EvilTerran> | that might be what i was thinking of |
| 19:26:41 | <etnt`> | byorgey: well yitz showed me an example that I'm still trying to decipher :-) |
| 19:27:02 | <byorgey> | > let sumCount xs = (sum odds, length odds) where odds = filter odd xs in sumCount [1..9] |
| 19:27:04 | <lambdabot> | (25,5) |
| 19:27:23 | <byorgey> | etnt`: did yitz's example involve things like ***? |
| 19:27:56 | <roconnor> | @hoogle ConnectedId |
| 19:27:57 | <lambdabot> | No matches found |
| 19:28:02 | <roconnor> | @hoogle ConnectId |
| 19:28:03 | <lambdabot> | No matches found |
| 19:28:17 | <hpaste> | etnt' annotated "using monads" with "yitz using monads example" at http://hpaste.org/3207#a2 |
| 19:28:41 | <etnt`> | byorgey: look at the bottom |
| 19:28:48 | <foo-nix> | I am using hugs at my university and at home. At the university I have the feature that I can use arrow keys to navigate through commands and stuff, if I do this at home I will get [[A^[[B^[[D^[[C stuff. Is there some option is hugs to set this, or is it the terminal I use (konsole and xterm both have it, whilst they dont have it at my uni). |
| 19:29:54 | <foo-nix> | For example I could press the up arrow to get the last command I (tried) to execute, at home this will give ^[[B |
| 19:30:16 | <conal> | roconnor: glad to hear it :) |
| 19:30:23 | <fasta> | I have a file containing #define FOO 1 and at the ghc commandline I say -DFOO 0, and I have macros that expand when FOO == 1, but still the macros expand. Why? |
| 19:30:43 | <Zao> | fasta: Because the source file redefines it. |
| 19:30:44 | <etnt`> | byorgey: you see, I've written a little Haskell to Erlang compiler, but my Haskell code sucks big time, so I'm trying to improve my Haskell technique... |
| 19:30:54 | <fasta> | Zao: I thought the compiler had precedence. |
| 19:31:01 | <fasta> | Zao: so, that believe is wrong? |
| 19:31:09 | <paczesiowa> | foo-nix: what system do you use? looks like readline problem |
| 19:31:12 | <Zao> | fasta: They just predefine things. |
| 19:31:18 | <fasta> | Zao: ok, thanks |
| 19:31:34 | <byorgey> | etnt`: I see. |
| 19:31:45 | <roconnor> | conal: Is the only way to safely make an event is to use mkEvent? |
| 19:31:48 | <foo-nix> | paczesiowa: I have a 32bit sempron (1600+) and I use opensuse 10.2 with both kde and fluxbox (both have this). |
| 19:32:06 | <conal> | roconnor: looking ... |
| 19:32:15 | <paczesiowa> | foo-nix: maybe try using ghci instead of hugs? |
| 19:32:18 | <fasta> | Zao: what's the value of an unset variable? |
| 19:32:21 | <foo-nix> | paczesiowa: The arrow do work when I am just in konsole or xterm |
| 19:32:31 | <foo-nix> | paczesiowa: Ok, let met try... |
| 19:32:54 | <roconnor> | conal: I suspect just using Cont is dangerous? |
| 19:32:59 | <foo-nix> | paczesiowa: Ah, that works. |
| 19:33:19 | <byorgey> | > let sumCount = arr filter >>> (sum &&& length) in sumCount [1..9] |
| 19:33:20 | <lambdabot> | Couldn't match expected type `[a] -> [a]' |
| 19:33:20 | <foo-nix> | paczesiowa: Thanks, but would you know a way to fix my hugs, or should I just go ask my system admin? |
| 19:33:21 | <Cale> | foo-nix: Maybe hugs wasn't built with readline? |
| 19:33:37 | <byorgey> | > let sumCount = arr (filter odd) >>> (sum &&& length) in sumCount [1..9] |
| 19:33:38 | <lambdabot> | (25,5) |
| 19:33:49 | <Cale> | You can run ldd `which hugs` to find out. |
| 19:33:50 | <foo-nix> | Cale: I didn't compile it, it was packaged, but I'll see if I can compile it myself... |
| 19:33:56 | <conal> | roconnor: hm. it's more about efficiency than safety, and only if you expect to have disappearing "clients" of an event. |
| 19:34:03 | <paczesiowa> | foo-nix: ghci is better than hugs anyway, and if you plan to stay with haskell for a while (we hope you will:) you'll end up using ghc anyway |
| 19:34:08 | <etnt`> | byorgey: nice :-) |
| 19:34:14 | <hpaste> | byorgey annotated "using monads" with "two alternate implementations of sumCount" at http://hpaste.org/3207#a3 |
| 19:34:37 | <byorgey> | etnt`: two nice, simple implementations for you =) |
| 19:34:45 | <conal> | roconnor: ... assuming memory is managed safely, which doesn't appear to be entirely true right now for wxHaskell. |
| 19:34:53 | <foo-nix> | paczesiowa: My fp teacher asked us to use hugs, but I dont think He has something against gchi, I will see if I can set it up in eclipse. |
| 19:35:00 | <roconnor> | conal: okay, maybe I will use Cont for my first attempt. |
| 19:35:09 | <foo-nix> | Cale, paczesiowa: Thanks a lot guys. You saved my day. |
| 19:35:12 | <conal> | roconnor: but in that case, the "ephemeral" stuff is not a solution, since it runs the finalizer too late. |
| 19:35:16 | <roconnor> | once I know what I'm doing, things may become more clear. |
| 19:35:23 | <conal> | roconnor: sure. |
| 19:35:27 | <etnt`> | byorgey: wow arrows...cool :-) |
| 19:35:30 | <ski> | roconnor : what are you doing ? |
| 19:35:49 | <roconnor> | conal: I'm attempting to port Phooey to gtk2hs |
| 19:35:53 | <roconnor> | ski: I'm attempting to port Phooey to gtk2hs |
| 19:35:58 | <paczesiowa> | foo-nix: lucky you:D I started today my fp classes but they use ocaml, and ocaml doesn't work with readline so I'm doomed to using files and loading/reloading |
| 19:36:03 | <foo-nix> | Cale, which hugs gave the /usr/bin/hugs executable. |
| 19:36:11 | <roconnor> | ski: ... not that I know DataDriven, wxHaskell, or gtk2hs |
| 19:36:18 | <foo-nix> | paczesiowa: ouch. |
| 19:36:22 | <roconnor> | it's a bit of a learning experience |
| 19:36:35 | <foo-nix> | paczesiowa: Might consider installing some stuff in your homedir. |
| 19:36:38 | <Cale> | foo-nix: yeah, now run ldd on that |
| 19:36:45 | <byorgey> | etnt`: also, did you see my comment about 'do { s <- get; put s }'? |
| 19:36:50 | <conal> | roconnor: i'll be glad to help if you run into difficulties. |
| 19:37:00 | <Cale> | foo-nix: that backquoted thing is supposed to run which hugs to get the location of the executable to pass to ldd |
| 19:37:01 | <roconnor> | conal: :) |
| 19:37:11 | <ski> | paczesiowa : ledit ? |
| 19:37:16 | <etnt`> | byorgey: yes, thx, I changed it in my code |
| 19:37:19 | <Cale> | foo-nix: which will tell you which libraries it's linked against |
| 19:37:39 | <byorgey> | etnt`: ok. also, 'do { put (0,0} }' is the same as just 'put (0,0)'. |
| 19:38:01 | <foo-nix> | Cale: I see some libs.... |
| 19:38:05 | <foo-nix> | What should I look for? |
| 19:38:10 | <Cale> | foo-nix: libreadlin |
| 19:38:11 | <paczesiowa> | ski: no idea what's that ledit, some kind of editor/ide? on ocaml classes they "force" us to use xemacs |
| 19:38:13 | <Cale> | foo-nix: libreadline |
| 19:38:15 | <etnt`> | byorgey: ok, I see |
| 19:38:16 | <foo-nix> | I see libncurses, is that the one? |
| 19:38:19 | <Cale> | nope |
| 19:38:28 | <foo-nix> | no libreadline |
| 19:38:30 | <hpaste> | birkenfeld annotated "using monads" with "little fix in the arrow example" at http://hpaste.org/3207#a4 |
| 19:38:37 | <Cale> | yeah, so that's why it doesn't work |
| 19:38:44 | <foo-nix> | I will need to get libreadline from somewhere and install it? |
| 19:38:55 | <paczesiowa> | foo-nix: you have libreadline |
| 19:39:13 | <Cale> | You clearly have libreadline, because it's working in ghci and bash |
| 19:39:14 | <paczesiowa> | foo-nix: just your version of hugs isn't compiled iwth support for it |
| 19:39:25 | <foo-nix> | paczesiowa: So I need to recompile it? |
| 19:39:35 | <byorgey> | ah, thanks birkenfeld++ |
| 19:39:42 | <Cale> | foo-nix: Unless there's another package you could use, yeah. |
| 19:39:42 | <ski> | paczesiowa : http://cristal.inria.fr/~ddr/ledit/ .. i happen to use that with ocaml |
| 19:39:43 | <lambdabot> | Title: ledit |
| 19:40:09 | <paczesiowa> | foo-nix: I wouldn't bother unless your teacher doesn't force you to, just stick with ghci |
| 19:40:10 | <ski> | paczesiowa : it is a readline-clone wrapper |
| 19:40:39 | <byorgey> | etnt`: one other thing: instead of having updateSte i | isOdd... and then updateStep i = ..., |
| 19:40:42 | <birkenfeld> | byorgey: why does it also work without "arr"? |
| 19:40:55 | <etnt`> | the span between beginner code and expert code in Haskell is much bigger than in, lets say, Erlang I think |
| 19:40:59 | <byorgey> | etnt`: it would be more idiomatic to say updateStep i | isOdd i = ... | otherwise = ... |
| 19:41:09 | <foo-nix> | paczesiowa: I weill, but trying to fix hugs is a nice uh, the dutch say 'uitdaging', uh, it's like.... uh competition like, sorry cant find the word. |
| 19:41:15 | <byorgey> | birkenfeld: oh, right |
| 19:41:22 | <Cale> | etnt: Well, that's sort of because Haskell is a research language :) |
| 19:41:27 | <paczesiowa> | foo-nix: challenge? |
| 19:41:31 | <byorgey> | birkenfeld: arr lifts pure functions to arrows |
| 19:41:34 | <foo-nix> | paczesiowa: That's the word ;) |
| 19:41:43 | <birkenfeld> | byorgey: is it because (->) is already an Arrow instance? |
| 19:41:45 | <byorgey> | birkenfeld: but in this case I'm using the pure function instance of arrows |
| 19:41:52 | <byorgey> | birkenfeld: right, so in this case arr = id |
| 19:41:52 | <foo-nix> | paczesiowa: Well, compiling isn't that much of a chalange, and I rather stick with my distro packages. |
| 19:41:59 | <birkenfeld> | ok, thanks :) |
| 19:42:13 | <roconnor> | conal: in iwidget' you call attrSource before you set the initial value, but attrSource calls get to set the inital value of the source; which means the inital values source won't be the inital value passed in. ... Is this a problem? |
| 19:42:15 | <foo-nix> | Well, paczesiowa and Cale, Thanks for your help. I will go funcitonal now. |
| 19:42:20 | <foo-nix> | *functional. |
| 19:42:23 | <Cale> | foo-nix: :) |
| 19:42:30 | <Cale> | foo-nix: Ask lots of questions here :) |
| 19:42:36 | <etnt`> | byorgey: ok, so otherwise is the same as True |
| 19:42:42 | <foo-nix> | Cale: Oh, dont say that to a geek like me ;) |
| 19:42:49 | <foo-nix> | Cale: Thanks man. |
| 19:42:59 | <byorgey> | etnt`: yup |
| 19:43:00 | <ski> | @src otherwise |
| 19:43:00 | <lambdabot> | otherwise = True |
| 19:43:06 | <Cale> | foo-nix: No problem |
| 19:43:10 | <foo-nix> | I will now see if I can close some xterms, to clean up my fluxbox dock |
| 19:43:27 | <sclv> | ok quick question: i have a function as such: iopen x = case x of {F -> "<B>"; S -> "<I>"; B -> "";} |
| 19:43:38 | <sclv> | is there an even more compact way to do this? |
| 19:44:12 | <byorgey> | sclv: well, you could define iopen by cases directly |
| 19:44:13 | <Cale> | sclv: Well, it's not more compact, but the slightly more idiomatic way I think is to write your cases separately. |
| 19:44:26 | <byorgey> | iopen F = "<B>" |
| 19:44:28 | <Cale> | iopen F = "<B>" |
| 19:44:30 | <Cale> | and so on |
| 19:44:35 | <paczesiowa> | iopen F = "<B>" newline open S = "<|>" ... |
| 19:44:49 | <Cale> | That was an I, not a | |
| 19:45:19 | <paczesiowa> | typo:> |
| 19:46:08 | <sclv> | right -- i had it that way originally and i'm trying to sacrifice idiomatic for concise. i was thinking maybe something with pattern matching on guards, but... |
| 19:46:51 | <roconnor> | conal: actually, from the commented out code, it seems you delibrately moved the setting of the inital value after the attrSource call |
| 19:46:53 | <byorgey> | sclv: well, otherwise I don't know of any way to make it shorter. |
| 19:47:35 | <foo-nix> | sweet, I managed to set gci up such that I can code in eclipse, and press the run button to check stuff. |
| 19:48:40 | <byorgey> | foo-nix: awesome =) |
| 19:48:52 | <shapr> | lambdacats must show up in the next HWN! |
| 19:49:30 | <conal> | roconnor: i tweaked that bit around in freiburg. looking at attrSource (in WinEvents), it does look pretty fishy, given the "get". |
| 19:49:48 | <Cale> | sclv: That's already pretty concise :) |
| 19:50:21 | <paczesiowa> | shapr: yeah tail recursion kicks ass:> |
| 19:50:24 | <Cale> | sclv: I suppose you could write a helper which would take the cases as parameters (essentially a fold for the type whose constructors are F,S,B) |
| 19:51:13 | <byorgey> | Cale: wouldn't that end up being longer overall? |
| 19:51:27 | <Cale> | byorgey: Yeah, but you might collapse some other stuff along with it. |
| 19:51:31 | <byorgey> | true. |
| 19:52:39 | <hpaste> | ADEpt pasted "Trying to interleave State's" at http://hpaste.org/3209 |
| 19:52:43 | <byorgey> | sclv: I recommend renaming 'iopen' to 'i'. That's four extraneous characters you can get rid of! |
| 19:53:01 | <birkenfeld> | hah |
| 19:53:09 | <foo-nix> | byorgey: No, eclipse catches the key event for <-, -> etc... |
| 19:53:13 | <foo-nix> | ;( |
| 19:53:29 | <sclv> | heh. its more the irritation of having to use braces and semis in haskell in order to fit it all on a line that irritates me |
| 19:53:30 | <byorgey> | foo-nix: I bet you can turn it off though. |
| 19:53:39 | <shapr> | @seen atomb |
| 19:53:39 | <lambdabot> | I saw atomb leaving #haskell 6d 17h 42m ago, and . |
| 19:53:41 | <shapr> | foo |
| 19:54:05 | <omnId> | sclv: you can omit the braces I believe |
| 19:54:09 | <foo-nix> | byorgey: Searching for it now, you should know how much my eclipse has in the preference menu. |
| 19:54:24 | <ADEpt> | @seen quicksilver |
| 19:54:24 | <lambdabot> | quicksilver is in #haskell and #ghc. I last heard quicksilver speak 3h 46m 27s ago. |
| 19:54:25 | <omnId> | > case 1 of 1 -> "yes"; 2 -> "no" |
| 19:54:27 | <lambdabot> | "yes" |
| 19:54:35 | <birkenfeld> | hmmm... iopen = flip lookup [(F, "<B>"), (S, "<I>"), (B, "")] ? |
| 19:54:37 | <ADEpt> | @seen int-e |
| 19:54:37 | <lambdabot> | I saw int-e leaving ##logic, #ghc, #haskell-overflow and #haskell 4h 51m 33s ago, and . |
| 19:54:37 | <byorgey> | foo-nix: oh, I know, I use eclipse at work =) |
| 19:54:49 | <omnId> | @type lookup |
| 19:54:51 | <lambdabot> | forall a b. (Eq a) => a -> [(a, b)] -> Maybe b |
| 19:54:55 | <omnId> | you'd need fromJust too |
| 19:54:59 | <birkenfeld> | right |
| 19:55:22 | <sclv> | for a bigger dictionary that sort of thing might make sense |
| 19:56:43 | <sclv> | the other tiny irritation (and this is all because i've just fallen so in love with haskell's sugar that i even care) is the need for "foo x = case x of" when it seems there'd be some handy way to reduce this. i seemed to recall a pattern matching in guards proposal/ghc extension that could knock some of it down |
| 19:57:16 | <omnId> | It wouldn't help in this case |
| 19:57:22 | <birkenfeld> | when do you need "foo x = case x of"? |
| 19:57:25 | <omnId> | foo x | S <- x = ... |
| 19:58:07 | <birkenfeld> | isn't that just multiple "foo <pattern here> = "? |
| 19:58:15 | <omnId> | cases and lambdas are the meat and potatoes of haskell expressions :) |
| 19:58:46 | <paczesiowa> | why can't I use smth like this instance Num a => Expresable a where...? |
| 19:58:53 | <Cale> | birkenfeld: yeah |
| 19:59:01 | <omnId> | birkenfeld: The guard match lets you omit the function/parameter in subsequent cases. |
| 19:59:04 | <mauke> | because that might not terminate |
| 19:59:15 | <omnId> | birkenfeld: so it's not much different than "case x of ..." |
| 19:59:30 | <paczesiowa> | mauke: what could not terminate? |
| 19:59:35 | <roconnor> | @seen dcoutts_ |
| 19:59:36 | <lambdabot> | dcoutts_ is in #haskell-overflow, #ghc, #haskell and #gentoo-haskell. I last heard dcoutts_ speak 55m 29s ago. |
| 19:59:48 | <mauke> | paczesiowa: type checking |
| 20:00:07 | <omnId> | instance Eq a => Eq a where (==) = (==) |
| 20:00:14 | <foo-nix> | hehe, who called him lambdabot? |
| 20:00:15 | <birkenfeld> | must be an individual flavor thing |
| 20:00:29 | <Heffalump> | foo-nix: shapr, I think. |
| 20:00:37 | <foo-nix> | :) |
| 20:00:39 | <foo-nix> | rofl |
| 20:00:53 | <paczesiowa> | but I can use instance Foo a => Foo [a] where... |
| 20:00:53 | <mauke> | I see instance G x => F x as a function definition: f x = g x |
| 20:00:54 | <nominolo> | lambdabot is a she |
| 20:01:04 | <omnId> | @quote female |
| 20:01:05 | <lambdabot> | lambdabot says: Of course i'm female |
| 20:01:09 | <shapr> | Heffalump: Pseudonym |
| 20:01:14 | <mauke> | paczesiowa: yes, because that corresponds to f (C x) = g x |
| 20:01:29 | <mauke> | paczesiowa: i.e. the function argument gets smaller, so you know it'll terminate somewhere |
| 20:02:07 | <paczesiowa> | and what if I know that it terminates? |
| 20:02:22 | <dmwit> | -fundecidable-instances? |
| 20:02:35 | <dmwit> | ACTION doesn't actually know |
| 20:02:38 | <omnId> | -fallow-..., I think |
| 20:02:40 | <mauke> | yes |
| 20:02:45 | <EvilTerran> | yeah, or {-# LANGUAGE UndecidableInstances #} |
| 20:02:52 | <EvilTerran> | er, #-} |
| 20:03:22 | <EvilTerran> | the coverage condition's a slightly crude way of ensuring termination |
| 20:03:52 | <omnId> | paczesiowa: I guess the problem is that some client of your module might define instance Expressable a => Num a where ..., and bam, infinite loop. |
| 20:03:54 | <EvilTerran> | but it does mean you stop and think about your code before you disable it |
| 20:04:11 | <paczesiowa> | -fallow-undecidable-instances and -fglasgow-exts helped |
| 20:04:47 | <paczesiowa> | I'm not going to sell that code, just having some fun (isn't it the way it should be?) |
| 20:05:18 | <omnId> | so -fallow-undecidable-instances and being careful is fine :) |
| 20:05:33 | <roconnor> | my new iwidget' type-checks. That's enough for tonight. Time for bed. |
| 20:05:51 | <conal> | roconnor: :) sleep well. |
| 20:07:23 | <vincenz> | night roconnor |
| 20:12:56 | <Mitar> | are haskell character literal escape codes in octa or decimal |
| 20:12:56 | <Mitar> | ? |
| 20:13:03 | <Mitar> | for example '\026' |
| 20:13:29 | <dmwit> | > ord 'a' |
| 20:13:32 | <lambdabot> | 97 |
| 20:13:36 | <dmwit> | > '\97' |
| 20:13:37 | <lambdabot> | 'a' |
| 20:13:49 | <dmwit> | > '\097' |
| 20:13:50 | <lambdabot> | 'a' |
| 20:14:17 | <Mitar> | thanks |
| 20:14:33 | <oerjan> | > '\0o97' |
| 20:14:34 | <lambdabot> | Improperly terminated character constant |
| 20:14:46 | <Cale> | > '\x97' |
| 20:14:47 | <lambdabot> | '\151' |
| 20:14:53 | <Cale> | > '\o57' |
| 20:14:55 | <lambdabot> | '/' |
| 20:14:59 | <Cale> | > '\57' |
| 20:15:00 | <lambdabot> | '9' |
| 20:15:05 | <Cale> | > '\x57' |
| 20:15:07 | <lambdabot> | 'W' |
| 20:15:20 | <dmwit> | cool |
| 20:15:23 | <Mitar> | so decimal by default |
| 20:15:31 | <Cale> | yeah |
| 20:15:34 | <Taejo> | Would it be a bad idea to use unsafePerformIO to implement a functional interface to an imperative implementation? |
| 20:15:34 | <dmwit> | Now we just need a \b for binary. =) |
| 20:15:41 | <earthy> | taejo: no |
| 20:15:49 | <Taejo> | cool |
| 20:15:50 | <paczesiowa> | > "zażółć gęślą jaźń" |
| 20:15:51 | <dmwit> | Taejo: If you know the function is pure, that's fine. |
| 20:15:51 | <lambdabot> | "za\380\243\322\263 g\281\347l\261 ja\378\324" |
| 20:16:01 | <earthy> | it is unsafe, not impossible |
| 20:16:10 | <kpreid> | Taejo: What kind of imperativeness? |
| 20:16:32 | <conal> | Taejo: does it always return the same result for the same (equal) argument? |
| 20:16:44 | <Taejo> | kpreid, e.g., implementing quicksort with linear extra space instead of NlogN to N^2 |
| 20:17:04 | <kpreid> | Taejo: Maybe the ST monad would do. |
| 20:17:18 | <Betovsky> | hmm |
| 20:17:24 | <Betovsky> | found a bug |
| 20:17:30 | <kpreid> | Taejo: Together with STArray/STUarray |
| 20:17:32 | <dmwit> | Hi Betovsky! |
| 20:17:33 | <Taejo> | kpreid, but I've still want to give it a pure interface (not IO or ST) |
| 20:17:34 | <Betovsky> | is there a place to see if was already reported? |
| 20:17:44 | <kpreid> | Taejo: that's what ST is for |
| 20:17:48 | <kpreid> | Taejo: it has a runST |
| 20:17:49 | <dmwit> | Betovsky: Which product did you find the bug in? |
| 20:17:55 | <Mitar> | how is this: ' character called in english? |
| 20:17:59 | <Betovsky> | ghc |
| 20:18:04 | <Betovsky> | one of the libs |
| 20:18:04 | <dmwit> | Mitar: single-quote |
| 20:18:06 | <n00b> | i am learning haskell but I can't seem to understand list comprehension |
| 20:18:07 | <Mitar> | thanks |
| 20:18:15 | <kpreid> | Mitar: or, apostrophe |
| 20:18:19 | <Taejo> | n00b, do you know set theory |
| 20:18:20 | <n00b> | is there any good tutorial |
| 20:18:23 | <Betovsky> | System.IO |
| 20:18:29 | <Betovsky> | hFileSize |
| 20:18:30 | <n00b> | yes |
| 20:18:31 | <paczesiowa> | n00b: or monads? |
| 20:18:41 | <hpaste> | omnId annotated "Trying to interleave State's" with "MonadState on pairs seems easier :)" at http://hpaste.org/3209#a2 |
| 20:18:42 | <Taejo> | kpreid, I'm looking up ST, thanks |
| 20:18:43 | <oerjan> | Betovsky: ghc trac |
| 20:19:09 | <Taejo> | n00b: list comprehensions are a lot like set comprehensions in maths |
| 20:19:09 | <n00b> | no manad |
| 20:19:12 | <oerjan> | @go ghc trac |
| 20:19:15 | <lambdabot> | http://hackage.haskell.org/trac/ghc |
| 20:19:16 | <lambdabot> | Title: GHC - Trac |
| 20:19:23 | <Betovsky> | thx |
| 20:19:31 | <byorgey> | n00b: what about list comprehensions do you find hard to understand? |
| 20:19:48 | <byorgey> | n00b: is there a specific example you're having trouble with? |
| 20:19:50 | <paczesiowa> | > [ 2*x | x <- [1,2,3,4,5] ] |
| 20:19:52 | <lambdabot> | [2,4,6,8,10] |
| 20:20:08 | <ADEpt> | omnId: and what if count,addone,getname,setname come from some library and could not be rewritten this way? or it's unfeasible to do so? |
| 20:20:42 | <quicksilver> | I must respectfully disagree :) |
| 20:20:43 | <paczesiowa> | [ 2*x | x <- [1,2,3,4,5] ] = it is a list of numbers 2*x where x comes from list [1,2,3,4,5] |
| 20:20:54 | <quicksilver> | omnId: that doesnt give the encapsulation and isolation I was aiming for |
| 20:21:27 | <omnId> | ADEpt: then a guess stacking them in that way would work :) |
| 20:21:30 | <n00b> | Using list comprehension, define a Haskell function countTrue, which returns the number of True value in boolean list |
| 20:21:47 | <ADEpt> | omnId: with lots of manual "lift"ing, right? |
| 20:21:50 | <byorgey> | n00b: is this for a class? or are you going through some tutorial? |
| 20:22:00 | <yallop> | http://hpaste.org/3210 Why does showIt work while showIt' is rejected by the type checker? (GHC 6.6.1) |
| 20:22:30 | <n00b> | class, but I just can't seem to get it |
| 20:22:39 | <vincenz> | elevators ftw! |
| 20:22:55 | <Cale> | > [(x,y) | x <- [1,2,3], y <- [4,5]] |
| 20:22:57 | <lambdabot> | [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] |
| 20:22:58 | <foo-nix> | Is there a way to make the namespace of the first where on line 12 in scope of the similarityScore's on lines 6, 7 and 8? http://pastebin.com/m5792ea8f |
| 20:22:58 | <n00b> | <paczesiowa> I understand the basic stuff |
| 20:23:03 | <oerjan> | n00b: well you cannot do it with _only_ a list comprehension |
| 20:23:12 | <Cale> | > [(x,y) | x <- [1,2,3], y <- [40,50]] |
| 20:23:13 | <lambdabot> | [(1,40),(1,50),(2,40),(2,50),(3,40),(3,50)] |
| 20:23:14 | <vincenz> | n00b: we can help you with haskell but, this is not a homework channel |
| 20:23:18 | <Cale> | > [x + y | x <- [1,2,3], y <- [40,50]] |
| 20:23:19 | <lambdabot> | [41,51,42,52,43,53] |
| 20:23:24 | <omnId> | ADEpt: I think so, I didn't look at what was there too hard. |
| 20:23:36 | <paczesiowa> | > let countTrue xs = length [x | x<- xs, x==True] in countTrue [True, False, True, False, False, True] |
| 20:23:38 | <lambdabot> | 3 |
| 20:23:39 | <Cale> | > [x + y | x <- [1,2,3], y <- [40,50], even x] |
| 20:23:40 | <lambdabot> | [42,52] |
| 20:23:53 | <quicksilver> | Cale: did you chance to look at the state combining class I wrote? |
| 20:23:58 | <Cale> | quicksilver: hm? |
| 20:24:00 | <vincenz> | > let l = [1..10] in [x | x <- l, x `mod` 2 == 0] |
| 20:24:02 | <lambdabot> | [2,4,6,8,10] |
| 20:24:06 | <dmwit> | > let countTrue xs = length [x | x <- xs, x] in countTrue [True, False, True, False, False, True] |
| 20:24:07 | <vincenz> | quicksilver: sicko |
| 20:24:08 | <lambdabot> | 3 |
| 20:24:19 | <quicksilver> | vincenz: eh? |
| 20:24:19 | <n00b> | <paczesiowa> |
| 20:24:23 | <vincenz> | dmwit: please don't give solutions to homework verbatim |
| 20:24:23 | <quicksilver> | Cale: http://hpaste.org/3202 |
| 20:24:25 | <paczesiowa> | dmwit: n1:D |
| 20:24:26 | <n00b> | <paczesiowa> it so easy for you |
| 20:24:28 | <vincenz> | quicksilver: the thing adept pasted |
| 20:24:33 | <quicksilver> | Cale: was wondering if you thought that was a bad/good idea |
| 20:24:56 | <dmwit> | vincenz: Okay, sorry. I was just shortening something I saw paczesiowa make. |
| 20:25:00 | <n00b> | I saw what you wrote but I want to understand it |
| 20:25:06 | <vincenz> | ah |
| 20:25:07 | <vincenz> | missed that one |
| 20:25:12 | <Cale> | quicksilver: It's a little odd to differentiate the parts of state by type along |
| 20:25:14 | <vincenz> | paczesiowa: please don't give answers to questions verbatim |
| 20:25:15 | <Cale> | alone* |
| 20:25:28 | <paczesiowa> | n00b: do you understand [x | x<- [1,2,3,4,5]] ? |
| 20:25:30 | <vincenz> | s/questions/homework questions/ |
| 20:25:41 | <n00b> | yes |
| 20:25:47 | <ADEpt> | quicksilver: i was trying to rewrite it for separate "library-like" modules and failed at the very beginning: http://hpaste.org/3209#a1 |
| 20:25:58 | <Cale> | quicksilver: Normally when I have multiple states to keep track of, I might form a new class for each component of the state, or else just define the getters and setters for each part separately |
| 20:26:07 | <n00b> | it is creating back the list |
| 20:26:19 | <Cale> | > [ 10*x | x <- [1..5]] |
| 20:26:22 | <lambdabot> | [10,20,30,40,50] |
| 20:26:28 | <Cale> | How about that? |
| 20:26:48 | <ADEpt> | Cale: would you care to elaborate for a slow person like me (i mean, on new class for each component of the state)? |
| 20:26:50 | <n00b> | [x | x <- [1,2,3,4,5]] |
| 20:27:08 | <Cale> | ADEpt: Well, basically the equivalent of MonadState. |
| 20:27:15 | <dylan> | homeworkpolice: it's always good to give example solutions that are slightly wrong for that purpose. <g> |
| 20:27:16 | <n00b> | yes it muliplies everything in the list by 10 |
| 20:27:19 | <omnId> | yallop: I don't know much about GADTs, but I'd suppose it's becuase showIt' doesn't have a Show a context. Have you tried reducing Showable' to * and removing the a from the G's result type? |
| 20:27:32 | <vincenz> | dylan: :D |
| 20:27:34 | <vincenz> | Cale++ |
| 20:27:56 | <Cale> | I don't know if there is an actual homework question being asked here? |
| 20:27:56 | <paczesiowa> | > [ 10*x | x <- [1..5], even x] |
| 20:27:58 | <lambdabot> | [20,40] |
| 20:28:03 | <paczesiowa> | n00b: how about that? |
| 20:28:06 | <n00b> | from 1 to 5 |
| 20:28:33 | <n00b> | multiplies everything by ten then filter the even numbers |
| 20:28:43 | <ADEpt> | Cale: would it work for library code which uses State (as in http://hpaste.org/3209#a1)? |
| 20:28:49 | <Cale> | > [ 10*x + y | x <- [1..5], y <- [1,2]] |
| 20:28:50 | <vincenz> | n00b: statements that do not bind (that do not use the <- arrow) filter |
| 20:28:50 | <lambdabot> | [11,12,21,22,31,32,41,42,51,52] |
| 20:28:51 | <yallop> | omnId: that works, but it's not really what I want |
| 20:28:53 | <foo-nix> | Is there a way to use where such that a fuction can be used in more declarations above? |
| 20:29:06 | <paczesiowa> | > [ 3*x | x <- [1..5], even x] |
| 20:29:06 | <yallop> | in my real type I have more constructors and I need to check that the types match up |
| 20:29:06 | <lambdabot> | [6,12] |
| 20:29:12 | <byorgey> | n00b: actually, the filtering of even numbers happens *before* the multiplying by 10. |
| 20:29:17 | <paczesiowa> | n00b: first it filters, then ultiplies |
| 20:29:18 | <omnId> | yallop: G is restricted to contructing on things in Show, but users of the Showable' type don't know that. There could be another constructor in Showable' that doesn't have the Show a => constraint. |
| 20:29:34 | <n00b> | <vincenz> explain more please |
| 20:29:38 | <n00b> | ok |
| 20:29:42 | <dylan> | > [x + 1 | x <- [1..5], even x] |
| 20:29:43 | <lambdabot> | [3,5] |
| 20:29:47 | <byorgey> | foo-nix: no, in that case just don't use where, make a new top-level function. |
| 20:30:04 | <vincenz> | n00b: [x | x <- somelist, foo x] |
| 20:30:04 | <yallop> | omnId: I thought that the point of GADTs is that when you pattern match you get type refinement |
| 20:30:07 | <n00b> | why does it filter first ?? |
| 20:30:14 | <vincenz> | n00b: that will return all the x's in somelist for which the function 'foo' is true |
| 20:30:18 | <foo-nix> | byorgey: Thanks, I just wanted to know for sure ;) |
| 20:30:25 | <paczesiowa> | n00b: thats the way it works |
| 20:30:29 | <yallop> | so the type checker should refine the type a on the rhs of the G match to Show a => a |
| 20:30:36 | <vincenz> | n00b: once you have those, it applies whatever is left of the | |
| 20:30:37 | <vincenz> | so |
| 20:30:40 | <yallop> | apparently it doesn't work that way for class constraints |
| 20:30:48 | <omnId> | yallop: hmm, I'm not sure. Like I said, I know little about them :/ |
| 20:31:00 | <vincenz> | n00b: [bar x | x <- alist, foo x] :: get all x's in alist, keep those that foo' gives true for and then apply bar to them |
| 20:31:13 | <n00b> | ok |
| 20:31:26 | <vincenz> | or otherwise said "for all x in alist, that are foo, do bar" |
| 20:31:29 | <vincenz> | therefore |
| 20:31:36 | <vincenz> | [bar x y | x <-alist, foo x, y <- blist] |
| 20:31:45 | <vincenz> | for all x in alist, that are foo, for all y in blist, do bar x y |
| 20:32:05 | <vincenz> | e.g |
| 20:32:15 | <n00b> | ok |
| 20:32:18 | <vincenz> | > [(x,y) | x <- [1,2], y <- ['a', 'b']] |
| 20:32:19 | <ADEpt> | Cale: (by "library" i mean "it was already written as a State monad and it's unfeasible to rewrite it all") |
| 20:32:19 | <n00b> | thanks vincent |
| 20:32:20 | <lambdabot> | [(1,'a'),(1,'b'),(2,'a'),(2,'b')] |
| 20:32:24 | <omnId> | yallop: I know existential types do that, i.e. types that are package with their context by not being forall qualified (Showable' a is short for forall a. Showable' a) |
| 20:32:27 | <n00b> | i am learning |
| 20:32:29 | <vincenz> | you get 4 elements, as you have 2 nested loops, one over x, one over y |
| 20:32:34 | <Cale> | ADEpt: no, it wouldn't work for that |
| 20:32:40 | <n00b> | you guys are better than my teach by farrrrrrrrrrr |
| 20:32:51 | <Cale> | ADEpt: But I think of monads as domain specific libraries/languages. |
| 20:33:10 | <paczesiowa> | makes you wonder how great must vincenz's teacher be:> |
| 20:33:11 | <dylan> | n00b: careful -- there are 400+ people here. One of them could be your teacher. <g> |
| 20:33:12 | <Cale> | > [(x,y,z) | x <- [1..20], y <- [x..20], z <- [y..20], x^2 + y^2 == z^2] |
| 20:33:13 | <lambdabot> | [(3,4,5),(5,12,13),(6,8,10),(8,15,17),(9,12,15),(12,16,20)] |
| 20:33:23 | <n00b> | haha |
| 20:33:54 | <vincenz> | for all x in 1..20, for all y in 1..20, for all z in 1..20, if x^2 + y^2 == z^2 then do (x,y,z) |
| 20:33:58 | <vincenz> | see how it's easy to read :) |
| 20:34:08 | <Cale> | all y in x..20 :) |
| 20:34:13 | <vincenz> | oh right, typo |
| 20:34:31 | <n00b> | ok |
| 20:34:35 | <n00b> | Using list comprehension, define a Haskell function allSame, which returns True if all the elements in the list are the same and False otherwise |
| 20:34:55 | <ADEpt> | Cale: so, it boils down to: if I'm the library author, I should aim at "MonadState m => m Int" signatures, not "State s Int", right?? |
| 20:35:46 | <omnId> | n00b: how would you check if all the elements are the same? |
| 20:35:47 | <Cale> | ADEpt: Well, you could also just define your own monad. |
| 20:35:58 | <vincenz> | oso fffffdfffdff |
| 20:36:00 | <vincenz> | f |
| 20:36:09 | <n00b> | by comparing it using === |
| 20:36:13 | <Cale> | vincenz's cat: Hello! Meow! |
| 20:36:14 | <n00b> | using == |
| 20:36:21 | <vincenz> | test |
| 20:36:21 | <n00b> | using == True |
| 20:36:24 | <vincenz> | crappy ssh connections |
| 20:36:38 | <vincenz> | n00b: so you know, what is the first thign you need to do? |
| 20:36:48 | <omnId> | n00b: what would you compare each element to? You just need to pick an arbitrary element out (let's say the first) to compare to every other. |
| 20:37:06 | <n00b> | the first element in the list |
| 20:37:37 | <vincenz> | it's odd to use list comprehension for that, seems more like a task for foldr |
| 20:37:57 | <omnId> | for all element x in the list xs, result in the test x == first element of xs |
| 20:38:05 | <ADEpt> | Cale: how would my own monad help? |
| 20:38:06 | <omnId> | that'd get you a list of Bools |
| 20:38:07 | <n00b> | haven't reached that topic |
| 20:38:30 | <yallop> | aha, it works in the HEAD |
| 20:38:55 | <omnId> | yallop: cool |
| 20:38:57 | <paczesiowa> | baz xs = null [y | y <- |
| 20:39:39 | <vincenz> | n00b: do you know null? |
| 20:39:47 | <n00b> | yes |
| 20:39:50 | <paczesiowa> | > null [] |
| 20:39:52 | <lambdabot> | True |
| 20:39:53 | <paczesiowa> | > null [1,2] |
| 20:39:54 | <lambdabot> | False |
| 20:40:07 | <Cale> | ADEpt: Perhaps I don't understand the problem? |
| 20:40:16 | <Cale> | ADEpt: Usually a library is a monad or it isn't. |
| 20:41:01 | <n00b> | allSame [x | x <- xs, x == True && xs == True] |
| 20:41:05 | <Cale> | I suppose if you're writing some generic things which work in arbitrary state monads, then you'd want (MonadState s m) constraints. |
| 20:41:20 | <foo-nix> | bye all |
| 20:41:34 | <mauke> | n00b: ... unlikely |
| 20:41:45 | <paczesiowa> | n00b: xs is a list co it can't be True (which is one element) |
| 20:41:48 | <Cale> | n00b: that would be a type error, because xs is a list |
| 20:42:08 | <paczesiowa> | > let allSame [x | x <- xs, x == True && xs == True] in allSame [1] |
| 20:42:09 | <lambdabot> | Parse error |
| 20:42:35 | <mrd> | "all the same" is another way of saying "all are duplicates" |
| 20:42:37 | <n00b> | let allSame xs = [x | x <- xs, x == True && xs == True] in allSame [1] |
| 20:42:40 | <mrd> | does that help? =) |
| 20:42:46 | <vincenz> | need a > |
| 20:42:54 | <paczesiowa> | > let allSame xs = [x | x <- xs, x == True && xs == True] in allSame [1] |
| 20:42:55 | <omnId> | n00b: (x == (head xs)), head gets the first element |
| 20:42:55 | <lambdabot> | Couldn't match expected type `[Bool]' against inferred type `Bool' |
| 20:43:10 | <ADEpt> | Cale: suppose that I have a code with is a State monad with a huge state. I see that code could be divided in two separate modules, which could have their own (standalone) use and state could be split in half between those modules. I would do that, except that I dont know how to write code that uses both parts (they would be STate monads as well) without lots of "lift"s |
| 20:43:53 | <Cale> | ADEpt: Yeah, you could do essentially what I was suggesting. |
| 20:43:57 | <n00b> | let allSame [x | x <- xs, x == (head xs)] in allSame [1] |
| 20:44:14 | <omnId> | allSame = ... [...] |
| 20:44:47 | <Cale> | ADEpt: which would be to define two classes each of which is similar to MonadState, but specifically for accessing each of the parts of the state which you're interested in. |
| 20:44:51 | <ADEpt> | Cale: and if I use MonadState, fundeps would get in my way when I'll try to use functions from both modules in a sngle function. That's why quicksilver re-defined MonadState as MonadContains without fundep in his example |
| 20:44:52 | <Taejo> | is there anything like a mutable array but growable? like a vector in Java or C++ |
| 20:44:53 | <omnId> | > let allSame = [x | x <- xs, x == (head xs)] in allSame [1, 1, 1, 1] -- you still need to reduce the list of Bools |
| 20:44:54 | <lambdabot> | Not in scope: `xs' |
| 20:45:00 | <omnId> | > let allSame xs = [x | x <- xs, x == (head xs)] in allSame [1, 1, 1, 1] -- you still need to reduce the list of Bools |
| 20:45:02 | <lambdabot> | [1,1,1,1] |
| 20:45:06 | <omnId> | bah |
| 20:45:11 | <paczesiowa> | Bools:> |
| 20:45:29 | <omnId> | n00b: a test on the right side of the [ | ... ] just filters results |
| 20:45:31 | <paczesiowa> | > let allSame xs = [x | x <- xs, x == (head xs)] in allSame [1, 1, 1, 2] |
| 20:45:32 | <lambdabot> | [1,1,1] |
| 20:45:37 | <Cale> | Taejo: Not in the GHC libs at least. |
| 20:45:55 | <paczesiowa> | little tip, don't use ==, try with /= |
| 20:45:56 | <Taejo> | Cale, thx |
| 20:46:02 | <omnId> | n00b: if you want the test to be a part of the resulting list, put it in the result part: [ ... | ] |
| 20:46:06 | <Cale> | Taejo: You could use something like a Data.Sequence of mutable arrays. |
| 20:46:24 | <n00b> | ok |
| 20:46:54 | <Taejo> | Cale, would that get me constant time access and amortised constant append? Isn't Data.Sequence a log(N) data structure? |
| 20:47:13 | <n00b> | let allSame xs = [x == (head xs)| x <- xs, ] in allSame [1] |
| 20:47:29 | <n00b> | let allSame xs = [x == (head xs)| x <- xs,] in allSame [1] |
| 20:47:36 | <omnId> | > let allSame xs = [x == (head xs)| x <- xs ] in allSame [1] -- forgot the > |
| 20:47:38 | <lambdabot> | [True] |
| 20:47:51 | <paczesiowa> | n00b: you need ">" char to make lambdabot listen to you |
| 20:47:53 | <EvilTerran> | n00b, firstly, you need > if you want it to do anything. secondly, you have a stray , |
| 20:48:03 | <omnId> | > let allSame xs = [x == (head xs)| x <- xs ] in allSame [1,1,1] |
| 20:48:05 | <lambdabot> | [True,True,True] |
| 20:48:07 | <omnId> | > let allSame xs = [x == (head xs)| x <- xs ] in allSame [1,1,1,2] |
| 20:48:08 | <lambdabot> | [True,True,True,False] |
| 20:48:09 | <Cale> | Taejo: We tend to consider log(n) as being essentially part of the constant. |
| 20:48:27 | <n00b> | > let allSame xs = [x == (head xs)| x <- xs,] in allSame [1,1,1,1] |
| 20:48:27 | <lambdabot> | Parse error |
| 20:48:28 | <omnId> | now you need a way to reduce the [Bool] into a single Bool, if all are true |
| 20:48:38 | <Taejo> | Cale, would I be going through all this if log(n) was bounded by a constant? |
| 20:48:42 | <n00b> | >let allSame xs = [x == (head xs)| x <- xs,] in allSame [1,1,1,1] |
| 20:48:42 | <madnificent> | omnId: fold ? |
| 20:48:49 | <omnId> | I don't *think* you can use a comp to do that |
| 20:48:50 | <mrd> | Data.Sequence is finger trees |
| 20:49:05 | <Cale> | Taejo: Do you really have exponential amounts of money with which to buy memory? |
| 20:49:05 | <omnId> | madnificent: the libraries already have a couple folds like that |
| 20:49:07 | <halcyon10> | n00b: you have a , too much |
| 20:49:27 | <madnificent> | omnId: sweet (I like to join in on n00b-stuff, I can learn much) |
| 20:49:33 | <Cale> | Taejo: and uniform access to all that exponentially growing amount of memory? |
| 20:49:35 | <omnId> | n00b: and put a space after the '>', LB doesn't understand the >let command :) |
| 20:49:41 | <paczesiowa> | omnId: you turned problem of reducing [a] to problem of reducing [Bool] |
| 20:49:49 | <n00b> | > let allSame xs = [x == (head xs)| x <- xs ] in allSame [1,1,1] |
| 20:49:50 | <lambdabot> | [True,True,True] |
| 20:50:00 | <omnId> | paczesiowa: yes |
| 20:50:20 | <Taejo> | Cale, true, but surely the overhead on a fingertree can be quite large too (I don't really know finger trees) |
| 20:50:25 | <mrd> | > null . drop 1 . nub $ [1,1,1,1] |
| 20:50:26 | <lambdabot> | True |
| 20:50:29 | <n00b> | >let allSame xs = [x == (head xs)| x <- xs,] in allSame [1,1,1,1] |
| 20:50:30 | <paczesiowa> | omnId: that's stupid:> |
| 20:50:40 | <mrd> | > and [True,True,True] |
| 20:50:41 | <Taejo> | vectors only give you linear overhead, not exponential |
| 20:50:41 | <lambdabot> | True |
| 20:50:43 | <Cale> | Taejo: It's pretty acceptable actually. Certainly worth trying. |
| 20:50:51 | <EvilTerran> | > let allSame = and . zipWith (&&) =<< tail in allSame [1,1,1,1] |
| 20:50:52 | <n00b> | > let allSame xs = [x == (head xs)| x <- xs ] in allSame [1,1,1] |
| 20:50:52 | <lambdabot> | Couldn't match expected type `[Bool]' |
| 20:50:53 | <lambdabot> | [True,True,True] |
| 20:50:58 | <Cale> | Taejo: I think most people are surprised to discover how good immutable structures can be. |
| 20:50:59 | <EvilTerran> | > let allSame = and . zipWith (==) =<< tail in allSame [1,1,1,1] |
| 20:51:00 | <lambdabot> | Couldn't match expected type `[Bool]' |
| 20:51:04 | <omnId> | paczesiowa: the problem description does say to use a comp :) *It's* stupid. |
| 20:51:08 | <EvilTerran> | bother. |
| 20:51:17 | <n00b> | i only want it to return one True Result |
| 20:51:19 | <madnificent> | Cale: but it damn hurts your brain to start thinking in it... |
| 20:51:25 | <mrd> | n00b: see 'and' |
| 20:51:31 | <omnId> | @src and |
| 20:51:31 | <lambdabot> | and = foldr (&&) True |
| 20:51:31 | <EvilTerran> | > zipWith (==) =<< tail $ [1,1,1,1] |
| 20:51:33 | <lambdabot> | [True,True,True] |
| 20:51:41 | <EvilTerran> | > and . (zipWith (==) =<< tail) $ [1,1,1,1] |
| 20:51:43 | <lambdabot> | True |
| 20:51:50 | <EvilTerran> | > and . (zipWith (==) =<< tail) $ [1,1,1,2,1] |
| 20:51:52 | <lambdabot> | False |
| 20:51:54 | <Taejo> | Cale, few things (in Computer Science) make me happier than a linear algorithm... and I don't want Haskell to make me throw that away |
| 20:52:19 | <n00b> | I can't use those. haven't reached that topic |
| 20:52:22 | <Cale> | Taejo: Use soft-O :) |
| 20:52:24 | <Cale> | hehe |
| 20:52:32 | <Taejo> | why use a breadth-first search if it has the same time complexity as Dijkstra's |
| 20:52:33 | <quicksilver> | Taejo: many people are unreasonable scared of log n |
| 20:52:37 | <mrd> | Taejo: they don't .. just brush up on amortized analysis |
| 20:52:48 | <mrd> | ACTION recommends Purely Functional Data Structures |
| 20:52:54 | <quicksilver> | Taejo: for real problems, log n is bounded by 32, so it's effectively a constant factor :) |
| 20:53:09 | <quicksilver> | I'm half-joking, but the point is that log n grows *extremely* slowly |
| 20:53:09 | <pizza_> | mrd: i just read that yesterday |
| 20:53:25 | <Cale> | The only reason that mutable structures give you constant time updates is that you have a finite amount of memory and so pointers are constant space anyway. |
| 20:53:25 | <Taejo> | quicksilver, it's a fair point |
| 20:53:47 | <Taejo> | ok, so as soon as we have infinite memory, FP will pwn everyody |
| 20:53:48 | <quicksilver> | its very easy for a fast n log n algorithm to be faster than a slow linear algorithm for, say, datasets no larger than the known universe |
| 20:53:52 | <Cale> | (or that arrays give constant time access) |
| 20:53:56 | <EvilTerran> | Cale has a point; with infinite memory, access is logarithmic |
| 20:53:59 | <n00b> | Using list comprehension, define a Haskell function unlucky, which returns all the days in a given year which have the date Friday 13th e.g. |
| 20:54:03 | <omnId> | n00b: there's another way, that paczesiowa's told me. |
| 20:54:07 | <monochrom> | It doesn't hurt my brain to think immutable. Already in imperative programming I visualize "mutation" as functional state passing. (Only when looking at efficiency am I aware of destructive updates.) |
| 20:54:20 | <Cale> | Well, asymptotic complexity is about what happens when the problem size grows without bound. |
| 20:54:40 | <KatieHuber> | is there a way to have GHC's -M option print out the rules for FFI _stub.h, _stub.c and _stub.o files? |
| 20:54:58 | <Cale> | It specifically doesn't matter what the performance is like on small cases when you're saying that some algorithm is O(n) time. |
| 20:55:02 | <mrd> | yea I find myself thinking persistantly all the time now |
| 20:55:11 | <mrd> | (vs ephemerally) |
| 20:55:27 | <Taejo> | there was a problem in last year's IOI where N*N*logN got 50%, versus 100% for N*N (I got 20% with N*N*N) |
| 20:55:36 | <monochrom> | When proving imperative programs correct, I see every command as a relation between pre-state and post-state. This is functional programming at its best. |
| 20:55:53 | <mrd> | well that's hoare triples |
| 20:56:13 | <Cale> | In practice, the constant factor often matters more than the logarithmic factor. |
| 20:56:15 | <monochrom> | No. |
| 20:57:03 | <Taejo> | Cale, yeah, but I'm learning Haskell by doing programming contests in it (http://squing.blogspot.com/2007/09/haskelling-saco-1.html) |
| 20:57:04 | <lambdabot> | Title: The Most Fuun You Can Have: Haskelling the SACO 1 |
| 20:57:29 | <mrd> | i've used hash-tables which turned out to be worse than just using some kind of tree |
| 20:58:46 | <Taejo> | mrd, yeah, definitely, hash tables can perform pretty badly (and finding good O(1) hash functions is non-trivial, i.e. impossible) |
| 20:59:20 | <hpaste> | ADEpt annotated "Trying to interleave State's" with "combined States :)" at http://hpaste.org/3209#a3 |
| 20:59:26 | <monochrom> | Hoare triples have a more complicated structure than what I said. It turns out that the extra complications are unnecessary. So even Hoare has abandoned it for the simpler relational semantics. |
| 20:59:37 | <ADEpt> | Cale: something like that? |
| 20:59:43 | <monochrom> | (Cf. Hoare and He's Unifying Theories of Programming.) |
| 20:59:45 | <mrd> | sure |
| 21:00:43 | <paczesiowa> | > let {xs = [1,1,1]} in null [y | y <- xs, y /= head xs] |
| 21:00:46 | <lambdabot> | True |
| 21:01:49 | <quicksilver> | ADEpt: those types look much better, yes |
| 21:01:59 | <n00b> | Using list comprehension, define a Haskell function unlucky, which returns all the days in a given year which have the date Friday 13th\ |
| 21:02:11 | <quicksilver> | ADEpt: that class "IntState" is a simplified/specialized version of my 'MonadContains' |
| 21:02:14 | <n00b> | HELP!!!!!! |
| 21:02:31 | <Cale> | ADEpt: Yeah, though I'd usually take the opportunity to give nicely descriptive names. |
| 21:02:42 | <Cale> | n00b: hehe :) |
| 21:03:07 | <Cale> | ADEpt: So not just IntState, but something like HasCounter |
| 21:03:11 | <ADEpt> | Cale: yep, of course. In library I would have a nicely named monad and nicely named typeclass |
| 21:03:30 | <quicksilver> | ADEpt: essentially IntState m is saying the samething as 'MonadContains m Int' |
| 21:03:33 | <Cale> | Also, what if you have two different Integer states? |
| 21:03:38 | <quicksilver> | Cale: newtypes |
| 21:03:51 | <Cale> | Yes, you can do that, I suppose :) |
| 21:03:54 | <ADEpt> | Cale: hmmmm.... |
| 21:03:56 | <quicksilver> | ADEpt: but, in practice it's always nice to have appropriate names |
| 21:04:07 | <ADEpt> | Cale: you are breaking my heart :) |
| 21:04:10 | <eddyp> | > let allSame xs = length [x | x <- xs, x == (head xs)] == length xs in allSame [1, 1, 1, 1] |
| 21:04:11 | <quicksilver> | ADEpt: like 'DiagramState' or 'UsesDiagram' |
| 21:04:12 | <lambdabot> | True |
| 21:04:14 | <quicksilver> | ADEpt: or some such |
| 21:04:24 | <eddyp> | > let allSame xs = length [x | x <- xs, x == (head xs)] == length xs in allSame [1, 1, 1, 2] |
| 21:04:25 | <lambdabot> | False |
| 21:04:28 | <Cale> | I just usually prefer building it directly into the interface, and naming the setters descriptively. |
| 21:04:28 | <ADEpt> | Cale: indeed, what if I have two different Int states? |
| 21:04:29 | <eddyp> | cool |
| 21:04:30 | <EvilTerran> | > cycle $ words "Mon Tue Wed Thu Fri Sat Sun" |
| 21:04:31 | <lambdabot> | ["Mon","Tue","Wed","Thu","Fri","Sat","Sun","Mon","Tue","Wed","Thu","Fri","Sa... |
| 21:04:54 | <Cale> | ADEpt: You can still have two classes that mimic the MonadState interface, but do different things :) |
| 21:05:11 | <Cale> | EvilTerran: cute |
| 21:06:04 | <ADEpt> | Cale, quicksilver, roconnor: thanks a lot :) |
| 21:06:18 | <EvilTerran> | > concatMap (enumFromTo 1) $ cycle [31,28,31,30,31,30,31,31,30,31,30,31] |
| 21:06:20 | <lambdabot> | [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,... |
| 21:06:43 | <Cale> | > [x | m <- [31,28,31,30,31,30,31,31,30,31,30,31], x <- [1..m]] |
| 21:06:45 | <lambdabot> | [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,... |
| 21:06:50 | <EvilTerran> | > zip (cycle $ words "Mon Tue Wed Thu Fri Sat Sun") (concatMap (enumFromTo 1) $ cycle [31,28,31,30,31,30,31,31,30,31,30,31]) |
| 21:06:50 | <lambdabot> | [("Mon",1),("Tue",2),("Wed",3),("Thu",4),("Fri",5),("Sat",6),("Sun",7),("Mon... |
| 21:07:05 | <quicksilver> | cute |
| 21:07:27 | <EvilTerran> | i don't know which year that is, but there's algorithms for working that sort of thing out |
| 21:07:33 | <EvilTerran> | @go doomsday algorithm |
| 21:07:35 | <lambdabot> | http://rudy.ca/doomsday.html |
| 21:07:35 | <lambdabot> | Title: Doomsday Algorithm — rudy.ca |
| 21:10:09 | <MyCatVerbs> | Elegant. |
| 21:13:00 | <hpaste> | omnId annotated "Trying to interleave State's" with "unsuccessful idea" at http://hpaste.org/3209#a5 |
| 21:13:28 | <omnId> | er, maybe I flipped the instance defs |
| 21:13:28 | <paczesiowa> | can I declare classes without parameters and why not? |
| 21:14:04 | <sjanssen> | paczesiowa: a) no. b) that doesn't make any sense :) |
| 21:14:22 | <shachaf> | paczesiowa: How would you know which class to use? |
| 21:14:31 | <mauke> | and what difference would it make? |
| 21:14:58 | <omnId> | yeah, I did, but still doens't fix it. |
| 21:14:58 | <paczesiowa> | so I could group Class1 a and Class2 a b in one Class |
| 21:15:21 | <paczesiowa> | they have different kindarity(?( |
| 21:15:46 | <shachaf> | paczesiowa: Can you give more context? |
| 21:16:18 | <omnId> | ADEpt: did you see that? |
| 21:16:38 | <paczesiowa> | data (Expresable a, Expresable b) => Expr a b = Expr a b |
| 21:16:39 | <paczesiowa> | class Expresable a |
| 21:16:39 | <paczesiowa> | instance Integral a => Expresable a |
| 21:16:58 | <paczesiowa> | and I would like to make Expr a b Expresable too |
| 21:17:36 | <paczesiowa> | So I could play with $ Expr (Expr "cat" 'b') 2 |
| 21:17:50 | <ADEpt> | omnId: hmm... looks interesting ... |
| 21:18:14 | <sjanssen> | paczesiowa: instance (Expresable a, Expresable b) => Expresable (Expr a b) |
| 21:18:20 | <n00b> | countTrue :: Bool -> Int |
| 21:18:29 | <ADEpt> | omnId: but if i have to roll my own MonadState without fundep, it would not be that different from the previous solution |
| 21:18:29 | <omnId> | ADEpt: I was thinking that since both libraries are polymorphic in MonadState a m for different a's that I could instanciate them into a since Statelike type on pairs. |
| 21:18:43 | <omnId> | ADEpt: the code as posted is incorrect |
| 21:18:59 | <n00b> | countTrue x = length([x | x <- xs, x == True]) |
| 21:19:09 | <n00b> | > countTrue x = length([x | x <- xs, x == True]) |
| 21:19:09 | <lambdabot> | Parse error |
| 21:19:20 | <paczesiowa> | sjanssen: thx, that at least compiles |
| 21:19:23 | <omnId> | ADEpt: the instances should be defined on MonadState (a, b) m, with the MonadState a m as the context. |
| 21:19:42 | <n00b> | > let countTrue x = length([x | x <- xs, x == True]) in counTrue [True,True] |
| 21:19:43 | <lambdabot> | Not in scope: `counTrue' |
| 21:19:52 | <n00b> | > let countTrue x = length([x | x <- xs, x == True]) in countTrue [True,True] |
| 21:19:53 | <lambdabot> | Not in scope: `xs' |
| 21:20:00 | <paczesiowa> | > let allSame xs = null[y | y <- xs, y /= (head xs)] in allSame [1,2] |
| 21:20:01 | <n00b> | > let countTrue xs = length([x | x <- xs, x == True]) in countTrue [True,True] |
| 21:20:01 | <lambdabot> | False |
| 21:20:02 | <lambdabot> | 2 |
| 21:20:04 | <paczesiowa> | > let allSame xs = null[y | y <- xs, y /= (head xs)] in allSame [1,1] |
| 21:20:05 | <lambdabot> | True |
| 21:20:42 | <n00b> | nice |
| 21:21:04 | <omnId> | ADEpt: if you flip the heads and contexts, the fundep problem goes away but you get ambiguous contraints. |
| 21:21:33 | <n00b> | I wrote the function in a text editor and run it and it keeps giving me errors |
| 21:21:48 | <Jaak> | > let countTrue = length . filter id in countTrue [True, False, True] |
| 21:21:49 | <lambdabot> | 2 |
| 21:22:02 | <paczesiowa> | Jaak: the point is to use list compr. |
| 21:22:23 | <paczesiowa> | Jaak: but it looks lovely:> |
| 21:22:29 | <Jaak> | > let countTrue xs = length [() | x <- xs, x] in countTrue [True, False, True] |
| 21:22:30 | <lambdabot> | 2 |
| 21:22:49 | <Jaak> | :) |
| 21:23:06 | <omnId> | er, no, there was a dumb error, 's' was used for the inner monad in the context, 'm' in the head. |
| 21:23:10 | <omnId> | ADEpt: ^ |
| 21:23:46 | <omnId> | ADEpt: but I fixed that and I got buried in type mismatches :D |
| 21:24:03 | <n00b> | countTrue :: [Bool] -> Int |
| 21:24:04 | <n00b> | countTrue x = length ([x | x <- xs, x == True]) |
| 21:24:10 | <n00b> | i got an error |
| 21:24:20 | <mauke> | about xs not in scope? |
| 21:25:04 | <hpaste> | omnId annotated "Trying to interleave State's" with "still doesn't work, but I fixed the dumb mistakes :D" at http://hpaste.org/3209#a6 |
| 21:25:25 | <n00b> | countTrue xs = length ([x | x <- xs, x == True]) |
| 21:25:34 | <n00b> | and I still get an error |
| 21:25:38 | <mauke> | what error? |
| 21:25:59 | <n00b> | Syntax error in declaration |
| 21:26:08 | <Jaak> | you're using ghci? |
| 21:26:11 | <n00b> | (unexpected ; ) |
| 21:26:13 | <n00b> | hugs |
| 21:26:18 | <n00b> | winhugs |
| 21:26:34 | <quicksilver> | well if it's an unexpected ; |
| 21:26:37 | <n00b> | is there suppsoe to be an identation |
| 21:26:38 | <quicksilver> | you probaby put a ; in :) |
| 21:26:53 | <quicksilver> | what you pasted here didn't have any ; in it.. |
| 21:27:12 | <EvilTerran> | (==True) is the identity; you don't need it |
| 21:27:25 | <quicksilver> | yeah but there's no harm having it |
| 21:27:33 | <quicksilver> | and arguably it does make it clearer, in this case |
| 21:27:44 | <EvilTerran> | why not /= False? ;) |
| 21:27:53 | <omnId> | or not . not? |
| 21:27:58 | <n00b> | nope |
| 21:27:59 | <Mr_Awesome> | or id? |
| 21:28:18 | <EvilTerran> | i'd whack a type signature in rather than ==True is all |
| 21:28:37 | <mauke> | or fmap fix return? |
| 21:28:47 | <n00b> | is possibly due to bad layout |
| 21:29:03 | <quicksilver> | n00b: hpaste the whole file and the exact error |
| 21:29:18 | <omnId> | = fix . const = (\x -> fix (const x)) = (\x -> x) = id |
| 21:29:25 | <omnId> | brilliant |
| 21:29:26 | <twanvl> | or const const id const const id id id |
| 21:29:40 | <Mr_Awesome> | or head . repeat |
| 21:29:42 | <halcyon10> | i like it this way, it makes sense cause if you weren't counting Trues but foos you would use (==foo) |
| 21:29:44 | <monochrom> | No sane person says "if you love me equals true, I love you too equals true" in natural languages or formal languages. |
| 21:29:55 | <hpaste> | n00b pasted "countTrue" at http://hpaste.org/3212 |
| 21:29:58 | <oerjan> | n00b: "possibly due to bad layout" is really almost any syntax error where a block _could_ have ended |
| 21:30:12 | <EvilTerran> | that's the whole file? |
| 21:30:16 | <quicksilver> | monochrom: but if the question is 'count all the elements which are true' then it makes perfect sense to count where (==True) |
| 21:30:26 | <Mr_Awesome> | monochrom: obviously, people do it in formal languages all the time |
| 21:30:42 | <monochrom> | perhaps as an exception it's ok. |
| 21:30:44 | <quicksilver> | n00b: and the exact error please |
| 21:31:04 | <quicksilver> | monochrom: and as halcyon10 point out, it generalises correctly to the =='A' case and the =="foo" case, etc etc |
| 21:31:13 | <monochrom> | Mr_Awesome: many people doing it in formal languages are not sane equals true. |
| 21:31:34 | <alzxul> | Could someone help me out with a function I'm trying to write? |
| 21:31:40 | <Mr_Awesome> | maybe they havent just thought things through |
| 21:31:46 | <monochrom> | Exactly. |
| 21:31:55 | <n00b> | syntax error in declaration (unesxpected ';', possibly due to bad layout) |
| 21:31:57 | <EvilTerran> | alzxul, don't ask to ask, ask! |
| 21:32:01 | <monochrom> | 99% of the people haven't thought things through. |
| 21:32:04 | <Jaak> | > length . (>>= guard) $ [True,False,True] |
| 21:32:06 | <lambdabot> | 2 |
| 21:32:09 | <quicksilver> | n00b: because that exact file works perfectly well in my ghci |
| 21:32:20 | <quicksilver> | n00b: are you sure you saved it, aren't loading hte wrong file, etc etc |
| 21:32:26 | <EvilTerran> | > sum . map fromEnum $ [True, False, True, True, False] |
| 21:32:28 | <lambdabot> | 3 |
| 21:32:41 | <Cale> | or [True, False] |
| 21:32:43 | <Cale> | > or [True, False] |
| 21:32:44 | <lambdabot> | True |
| 21:32:49 | <Cale> | > or [True, False, False] |
| 21:32:50 | <lambdabot> | True |
| 21:32:53 | <Cale> | > or [False, False, False] |
| 21:32:54 | <byorgey> | @type guard |
| 21:32:56 | <lambdabot> | False |
| 21:32:56 | <lambdabot> | forall (m :: * -> *). (MonadPlus m) => Bool -> m () |
| 21:33:04 | <Cale> | > and [True, False, True] |
| 21:33:05 | <lambdabot> | False |
| 21:33:09 | <Cale> | > and [True, True, True] |
| 21:33:10 | <lambdabot> | True |
| 21:33:12 | <omnId> | > or $ replicate (10^6) False |
| 21:33:13 | <EvilTerran> | i'd be sorely tempted to write it that way; i guess it'd my C coder side showing through ;) |
| 21:33:13 | <lambdabot> | False |
| 21:33:29 | <Cale> | all (=='a') "aaaaaa" |
| 21:33:34 | <Cale> | > all (=='a') "aaaaaa" |
| 21:33:35 | <lambdabot> | True |
| 21:33:36 | <alzxul> | Ok well I'm trying to write a function which computes ( x ^ y ) `mod` n for any n <= sqrt [maxint] without arithmetic overflow |
| 21:33:38 | <Cale> | > all (=='a') "aaaaaab" |
| 21:33:39 | <lambdabot> | False |
| 21:33:45 | <ADEpt> | omnId: now I'm lost there too :) |
| 21:33:59 | <n00b> | still getting a error |
| 21:34:04 | <shapr> | dons: I do have some Selenium feedback... I'm trying to make my own version of withSelenium that returns Either String Counts, and it's a pain :-) |
| 21:34:07 | <Mr_Awesome> | Cale: the hell are you doing? |
| 21:34:07 | <EvilTerran> | (length . filter id) would probably be the most idiomatic way, though. or length . filter (==True), depending on personal taste |
| 21:34:15 | <hpaste> | (anonymous) pasted "(no title)" at http://hpaste.org/3213 |
| 21:34:24 | <Cale> | Mr_Awesome: Demonstrating some functions which might be useful to n00b? :) |
| 21:34:33 | <alzxul> | I've written it, and I can't see what's wrong with it but when I give it values I know the answer for it doesn't come up with the right answer |
| 21:34:35 | <omnId> | ADEpt: count is :: MonadState Int m => m Int, right? |
| 21:34:36 | <EvilTerran> | alzxul, any particular reason you can't use Integer? |
| 21:34:41 | <Mr_Awesome> | Cale: ah, very good :) |
| 21:34:55 | <hpaste> | noob pasted "countTrue" at http://hpaste.org/3214 |
| 21:34:56 | <omnId> | ADEpt: I'm trying to get it to derive count :: MonadState (Int, a) m => m Int |
| 21:34:57 | <Cale> | alzxul: You're doing this with Ints or Integers? |
| 21:34:58 | <alzxul> | is that a built in function? |
| 21:35:01 | <alzxul> | Ints |
| 21:35:02 | <EvilTerran> | > 100 ^ 100 |
| 21:35:04 | <lambdabot> | 1000000000000000000000000000000000000000000000000000000000000000000000000000... |
| 21:35:07 | <Cale> | alzxul: You don't have to worry about overflow with integers. |
| 21:35:15 | <quicksilver> | EvilTerran: yes, because the exercies he is solving wants him to learn repeated squaring, perhaps? |
| 21:35:20 | <omnId> | ADEpt: then to StateT (Int, String) IO Int in the instantiation. |
| 21:35:31 | <EvilTerran> | quicksilver, that's why i asked, rather than saying "use Integer!") |
| 21:35:33 | <mauke> | alzxul: x `mod` n first, then repeatedly multiply, modding after each step |
| 21:35:36 | <n00b> | do you know what is wrong |
| 21:35:41 | <eddyp> | let doomsDay x = 28 + fromEnum (( x `mod` 4 ) == 0) in doomsDay 2009 |
| 21:35:44 | <eddyp> | >let doomsDay x = 28 + fromEnum (( x `mod` 4 ) == 0) in doomsDay 2009 |
| 21:35:50 | <dons> | shapr: i'll ping atomb |
| 21:35:53 | <eddyp> | > let doomsDay x = 28 + fromEnum (( x `mod` 4 ) == 0) in doomsDay 2009 |
| 21:35:55 | <lambdabot> | 28 |
| 21:35:59 | <eddyp> | > let doomsDay x = 28 + fromEnum (( x `mod` 4 ) == 0) in doomsDay 2008 |
| 21:36:01 | <lambdabot> | 29 |
| 21:36:04 | <eddyp> | > let doomsDay x = 28 + fromEnum (( x `mod` 4 ) == 0) in doomsDay 2004 |
| 21:36:06 | <lambdabot> | 29 |
| 21:36:08 | <eddyp> | > let doomsDay x = 28 + fromEnum (( x `mod` 4 ) == 0) in doomsDay 2003 |
| 21:36:10 | <lambdabot> | 28 |
| 21:36:11 | <omnId> | ADEpt: understand that? |
| 21:36:23 | <shapr> | dons: I think the real problem is that I'm not comfortable with monad transformers, I suspect understanding them will make this easy. |
| 21:36:28 | <alzxul> | you mean repeatedly multiply by x `mod` n ? |
| 21:36:37 | <monochrom> | quicksilver, halcyon10: I have one last doubt. If the point is generalization, I wonder why the claimed generalization is not carried out: "count e xs = length ([x | x <- xs, x == e])" and then "count True". If you don't want the generalization, I wonder why you say the generalization. |
| 21:36:45 | <n00b> | why am I getting that error |
| 21:37:00 | <quicksilver> | monochrom: because I am talking about teaching and learning |
| 21:37:16 | <quicksilver> | monochrom: and I am saying, if you teach/learn the == True version, you will appreciate teh generalisation |
| 21:37:32 | <quicksilver> | monochrom: my suggestion is that that version is pedagogically better for a beginner |
| 21:37:45 | <monochrom> | Alright then. Thanks. |
| 21:37:54 | <quicksilver> | monochrom: althouhg it is *also* good to have as an excercise undertanding of why the version without it works too :) |
| 21:38:10 | <shapr> | dons: Alternatively, I wish that withSelenium were -> IO (Either String a) instead of -> IO (Either String ()) |
| 21:38:17 | <quicksilver> | n00b: no, because I have told you that that exact code works in my ghci and you haven't told me anything else about what might be wrong. |
| 21:38:29 | <quicksilver> | n00b: my suggestion is that you are loading a different file into hugs by mistake |
| 21:38:44 | <omnId> | ADEpt: modules SInt and SString are imported unmodified, if you're looking for their definitions. |
| 21:39:05 | <Cale> | alzxul: Do you understand the algorithm for exponentiation where you do repeated squaring and multiplication by x? |
| 21:40:24 | <Cale> | alzxul: Essentially, you can use the binary expansion of the exponent to determine the steps you need to perform, and accomplish the whole task in log_2(n) + k multiplies, where n is the exponent, and k is the number of 1's in the exponent as expressed in binary. |
| 21:40:28 | <alzxul> | I think so, yes; I just can't get it to work when I have to do it to a specific modulo |
| 21:40:59 | <Cale> | alzxul: So you carry out that algorithm, but after each step, mod out by whatever modulus it is that you're using. |
| 21:41:12 | <n00b> | Paste the code in notepad saved it and run it and it worked |
| 21:41:16 | <quicksilver> | alzxul: do you know that (a * b) `mod` n is (a `mod` n * b `mod` n) |
| 21:41:18 | <n00b> | seems to be the editor |
| 21:41:19 | <eddyp> | ooh, how much does it take to compute googolplex? |
| 21:41:20 | <Cale> | If it's not working, and that's what you're doing, make sure you have the parentheses correct :) |
| 21:41:35 | <Cale> | > 10^100 |
| 21:41:36 | <omnId> | ADEpt: er, maybe it was right with the heads and contexts the other way 'round, I dunno 8-) |
| 21:41:36 | <lambdabot> | 1000000000000000000000000000000000000000000000000000000000000000000000000000... |
| 21:41:38 | <quicksilver> | alzxul: i.e. do you know that you can take modulus before multiplication as well as after and it's the same :) |
| 21:41:47 | <Cale> | > 10^(10^100) |
| 21:41:51 | <lambdabot> | Terminated |
| 21:41:57 | <quicksilver> | n00b: probably an extra space or something before something |
| 21:41:59 | <quicksilver> | n00b: annoying |
| 21:42:02 | <Cale> | That takes a bit of memory to store ;) |
| 21:42:22 | <eddyp> | here it started doing it |
| 21:42:32 | <Jaak> | > foldr (\b -> (. if b then (+1) else id)) id [True,False,True] 0 -- sowwy |
| 21:42:33 | <lambdabot> | 2 |
| 21:42:40 | <shapr> | @yarr |
| 21:42:40 | <lambdabot> | Drink up, me 'earties |
| 21:42:44 | <ADEpt> | omnId: you are right about type of count, but i think this gets too convoluted :) |
| 21:42:56 | <Cale> | However, you could easily do it modulo 7 |
| 21:43:09 | <Cale> | (or any other small modulus) |
| 21:44:00 | <Cale> | For example, a googolplex mod 517981837 is 121435358 |
| 21:44:09 | <n00b> | Using list comprehension, define a Haskell function unlucky, which returns all the days in a given year which have the date Friday 13th e.g. unlucky 2004 -> [(13,2,2004),(13,8,2004)] |
| 21:44:42 | <alzxul> | Hmm I am gonna get some sleep and then try again in the morning when im refreshed - thanks for the help guys hopefully it will work! |
| 21:44:50 | <Cale> | n00b: first write a function to generate all the days of the year |
| 21:45:08 | <Cale> | n00b: Then work out how to get the day of the week for any given day. |
| 21:46:32 | <mauke> | @list |
| 21:46:32 | <lambdabot> | http://www.cse.unsw.edu.au/~dons/lambdabot/COMMANDS |
| 21:46:35 | <omnId> | then filter [(weekday, date, month, year)] where (weekday, date) = (Friday, 13) |
| 21:47:46 | <omnId> | even generating all the days and their weekdays is a somewhat complex problem |
| 21:48:14 | <n00b> | day = (((13*m+3) ‘div‘ 5 + d + y + (y ‘div‘ 4) - (y ‘div‘ 100) + (y ‘div‘ 400)) ‘mod‘ 7) got this formula, Zeller's forumla |
| 21:48:28 | <n00b> | @google list comprehension |
| 21:48:31 | <lambdabot> | http://en.wikipedia.org/wiki/List_comprehension |
| 21:48:31 | <lambdabot> | Title: List comprehension - Wikipedia, the free encyclopedia |
| 21:48:43 | <n00b> | @google list comprehension in haskell |
| 21:48:47 | <lambdabot> | http://www.zvon.org/other/haskell/Outputsyntax/listQcomprehension_reference.html |
| 21:48:47 | <lambdabot> | Title: Haskell : list comprehension |
| 21:49:00 | <n00b> | @google haskell list comprehension |
| 21:49:01 | <lambdabot> | http://www.zvon.org/other/haskell/Outputsyntax/listQcomprehension_reference.html |
| 21:49:01 | <lambdabot> | Title: Haskell : list comprehension |
| 21:49:17 | <omnId> | [(<that formula>, d, m, y) | (d, m, y) <- wholeYear] |
| 21:51:09 | <Cale> | Um, hey, shouldn't the languages which don't have list comprehensions be talking about their equivalents to concatMap and filter, not map and filter? |
| 21:51:12 | <omnId> | wholeYear = ...; withWeekdays = <above>; thirteenths = [ ... | (w, d, m, y) <- withWeekdays, ... ] |
| 21:51:23 | <Cale> | (In the wikipedia article) |
| 21:53:41 | <omnId> | @let day y m d = (((13*m+3) `div` 5 + d + y + (y `div` 4) - (y `div` 100) + (y `div` 400)) `mod` 7) |
| 21:53:55 | <lambdabot> | Defined. |
| 21:53:57 | <omnId> | > day 2007 10 10 |
| 21:53:59 | <lambdabot> | 2 |
| 21:54:17 | <omnId> | > day 2007 10 14 |
| 21:54:18 | <lambdabot> | 6 |
| 21:54:24 | <omnId> | > day 2007 10 15 |
| 21:54:25 | <lambdabot> | 0 |
| 21:54:34 | <omnId> | 0 = Sunday, then |
| 21:54:45 | <djfroofy> | is there a package mgr for haskell similar to easy_install/gems/cpan? |
| 21:55:36 | <laz0r> | i would like to know that myself, but i think cabal or hackage aims to something like that |
| 21:56:15 | <omnId> | > day 1985 5 19 -- just curious :) |
| 21:56:15 | <lambdabot> | Unbalanced parenthesis |
| 21:56:23 | <omnId> | > day 1985 5 19 -- rawr |
| 21:56:24 | <lambdabot> | 6 |
| 21:56:34 | <ADEpt> | Cale, omnId, quicksilver: in the end code turned out to be quite simplier than my examples :) (if you are interested: http://adept.linux.kiev.ua/repos/flow2dot/) |
| 21:56:36 | <lambdabot> | Title: Index of /repos/flow2dot/ |
| 21:56:40 | <omnId> | ACTION was apparently born on a Saturday |
| 21:57:02 | <ADEpt> | djfroofy: keywords are "cabal","cabal-get" and "hackage" |
| 21:58:46 | <omnId> | @let weekday y m d = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"] !! day y m d |
| 21:58:50 | <lambdabot> | Defined. |
| 22:01:14 | <omnId> | @undefine |
| 22:01:17 | <lambdabot> | Undefined. |
| 22:01:36 | <omnId> | what am I thinking? 2 = Wednesday => 0 = Monday! |
| 22:03:07 | <eddyp> | can one undefine a function in ghci? |
| 22:03:27 | <hpaste> | n00b pasted "dayName" at http://hpaste.org/3215 |
| 22:03:29 | <paczesiowa> | is it possible to define a function which takes e.g. Int "or" String and does different thinks depending on input type? but that "or" is real "or" not some new datatype with 2 constructors |
| 22:03:31 | <omnId> | eddyp: :load to reload the initial state |
| 22:03:37 | <n00b> | dayName 3 |
| 22:03:46 | <n00b> | > dayName 3 |
| 22:03:47 | <lambdabot> | Not in scope: `dayName' |
| 22:03:58 | <omnId> | @let day y m d = (((13*m+3) `div` 5 + d + y + (y `div` 4) - (y `div` 100) + (y `div` 400)) `mod` 7) |
| 22:04:01 | <lambdabot> | Defined. |
| 22:04:09 | <oerjan> | eddyp: you can redefine it (only affects following lines) |
| 22:04:42 | <eddyp> | omnId: thanks |
| 22:05:00 | <oerjan> | paczesiowa: Either |
| 22:05:01 | <n00b> | let day y m d = (((13*m+3) `div` 5 + d + y + (y `div` 4) - (y `div` 100) + (y `div` 400)) `mod` 7) in day 2007 10 10 |
| 22:05:10 | <n00b> | > let day y m d = (((13*m+3) `div` 5 + d + y + (y `div` 4) - (y `div` 100) + (y `div` 400)) `mod` 7) in day 2007 10 10 |
| 22:05:11 | <lambdabot> | 2 |
| 22:05:14 | <hpaste> | omnId annotated "dayName" with "(!!) is list index" at http://hpaste.org/3215#a1 |
| 22:05:23 | <oerjan> | (it's a data type, but a default one for this use) |
| 22:06:05 | <Taejo> | paczesiowa, what's wrong with Either? |
| 22:06:19 | <omnId> | eddyp: :l for short. Or if you have a file loaded that you're working on, use :r[eload] to reload it. |
| 22:06:39 | <eddyp> | thanks |
| 22:06:42 | <EvilTerran> | Taejo, i think he wants to do it without the constructors. which is impossible, mind. |
| 22:06:55 | <paczesiowa> | oerjan: I know that, but I think I want some ugly hack to make this work, I want foo 1 -> "hello Im int", foo "dog" -> "hello Im string" |
| 22:06:59 | <Taejo> | what's wrong with constructors |
| 22:07:22 | <n00b> | thanks <omnId> |
| 22:07:27 | <Taejo> | you could hack something with type classe |
| 22:07:32 | <Taejo> | *classes |
| 22:07:43 | <omnId> | paczesiowa: the ugly hack could be instance Num [Char], then 1 would turn into a String |
| 22:07:44 | <EvilTerran> | you have to deal with the cases seperately? i dunno. sounds like a hankering for loose typing. |
| 22:07:54 | <omnId> | though [Char] in the head would need extensions |
| 22:08:24 | <paczesiowa> | Taejo: there's nothing wrong with Either for normal work, I just want to have some dirty ugly fun |
| 22:08:31 | <Taejo> | ok |
| 22:08:44 | <omnId> | @type 1 -- numeric literals are polymorphic, they can be instantiated in any type that belongs to Num |
| 22:08:46 | <lambdabot> | forall t. (Num t) => t |
| 22:09:08 | <Eelis> | @type 1.2 |
| 22:09:10 | <lambdabot> | forall t. (Fractional t) => t |
| 22:09:13 | <paczesiowa> | omnId: but what function should I overload? |
| 22:09:23 | <omnId> | paczesiowa: all the required ones. |
| 22:09:41 | <omnId> | paczesiowa: (+), (-), (*), and fromInteger I believe |
| 22:09:44 | <omnId> | @docs Prelude |
| 22:09:44 | <lambdabot> | http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html |
| 22:10:17 | <omnId> | you can say (+) = undefined; (-) = undefined, etc if you're fine with runtime errors. |
| 22:10:21 | <paczesiowa> | omnId: and besides, how would I later in foo know what is real type or argument |
| 22:10:32 | <paczesiowa> | *would know |
| 22:10:34 | <omnId> | paczesiowa: the real type is always String |
| 22:10:47 | <omnId> | 1 just happens to represent a String |
| 22:11:16 | <omnId> | If you need more than one type, use a union type. |
| 22:11:20 | <omnId> | like Either |
| 22:11:53 | <EvilTerran> | paczesiowa, have you seen Data.Generics? |
| 22:11:54 | <paczesiowa> | so I can case x of n -> ...; (and pattern here?) |
| 22:12:31 | <paczesiowa> | so I can use $ case x of n -> ...; (and what pattern here?) -> ... |
| 22:13:39 | <omnId> | if you're using Num [Char], and x :: String, then any string pattern would be fine. |
| 22:13:56 | <omnId> | (including list patterns, since:) |
| 22:13:59 | <omnId> | @src String |
| 22:13:59 | <lambdabot> | type String = [Char] |
| 22:16:03 | <omnId> | numeric literals would also be string patterns, since the pattern >1< expands at runtime to the result of fromInteger 1. |
| 22:16:19 | <omnId> | (iiuc) |
| 22:16:39 | <hpaste> | n00b pasted "date" at http://hpaste.org/3216 |
| 22:17:02 | <n00b> | <omnId> check out the code, it as a error |
| 22:17:09 | <omnId> | n00b: where is date' gettin the d m and y variables? |
| 22:17:32 | <omnId> | it isn't. |
| 22:17:33 | <n00b> | from date |
| 22:17:37 | <Taejo> | what's wrong with `instance Typed [Char] where'? GHC says "Illegal instance declaration for `Typed [Char]'" |
| 22:17:51 | <omnId> | d, m, and y are not in scope within the definition of date' |
| 22:18:00 | <paczesiowa> | -fallow-undecidable-instances -fglasgow-exts |
| 22:18:03 | <omnId> | only within the function that defines them as parameters |
| 22:18:12 | <omnId> | n00b: do you know C? |
| 22:18:50 | <oerjan> | Taejo: -fglasgow-exts |
| 22:19:03 | <Taejo> | oerjan, paczesiowa, thanks |
| 22:19:12 | <Taejo> | why is that not Haskell 98? |
| 22:19:15 | <omnId> | would you expect int date(int d, int m, int y) {return ...;} int date2(void) {return (dayName(date(d, m, y)));} to work? |
| 22:19:24 | <n00b> | no |
| 22:19:57 | <hpaste> | Taejo pasted "Paczesiowa's foo function" at http://hpaste.org/3217 |
| 22:20:13 | <Taejo> | paczesiowa, there you go |
| 22:20:23 | <n00b> | could you anotate it and tell me where I am going wrong |
| 22:20:24 | <Taejo> | "dynamic typing" in Haskell |
| 22:20:38 | <omnId> | n00b: date' doesn't do anything? |
| 22:20:58 | <paczesiowa> | Taejo: thx |
| 22:21:09 | <n00b> | ok |
| 22:21:13 | <Taejo> | does that satisfy you, paczesiowa? |
| 22:21:20 | <omnId> | Taejo: in Haskell98 instance heads (the type itself that the instance in being defined for) can only have one concrete type (the [] in [Char]) and others must be type variables (the a in [a]) |
| 22:21:43 | <Taejo> | omnId, thanks |
| 22:21:53 | <n00b> | I want to convert the result date with my day name |
| 22:22:33 | <paczesiowa> | Taejo: I have no idea:D after every dirty hack, after every -fallow-smth-dirty, comes another error "that's too dirty!" |
| 22:22:38 | <omnId> | then use dayName (day d m y) whereever you have a suitable d, m, and y in scope (say, a list comprehension) |
| 22:22:59 | <n00b> | let dayName x = ["Monday", "Tueday", "Wednesday", "Thurday", "Friday", "Saturday", "Sunday"] !! x; date d m y = (((13* m + 3) `div` 5 + d + y + (y `div` 4) - (y `div` 100) + (y `div` 400)) `mod` 7) in dayName (date 10 10 2007) |
| 22:23:10 | <n00b> | > let dayName x = ["Monday", "Tueday", "Wednesday", "Thurday", "Friday", "Saturday", "Sunday"] !! x; date d m y = (((13* m + 3) `div` 5 + d + y + (y `div` 4) - (y `div` 100) + (y `div` 400)) `mod` 7) in dayName (date 10 10 2007) |
| 22:23:10 | <omnId> | or put d, m, and y into dateprime's parameter list |
| 22:23:18 | <lambdabot> | "Wednesday" |
| 22:23:46 | <n00b> | what's that ??? |
| 22:23:48 | <Taejo> | @pl \ x -> ["Monday", "Tueday", "Wednesday", "Thurday", "Friday", "Saturday", "Sunday"] !! x |
| 22:23:50 | <lambdabot> | (["Monday", "Tueday", "Wednesday", "Thurday", "Friday", "Saturday", "Sunday"] !!) |
| 22:23:54 | <hpaste> | omnId annotated "date" with "if you just want to compose dayName and date, then add the params" at http://hpaste.org/3216#a1 |
| 22:24:22 | <omnId> | or you could have dayName take all three params and have it call day directly |
| 22:24:42 | <FMota_> | what's an arrow? |
| 22:24:49 | <n00b> | thanks |
| 22:25:19 | <omnId> | FMota_: I type with kind *->*->* that supports some methods and that follow certain laws (that I know nothing of) |
| 22:25:28 | <omnId> | s/I/a/ |
| 22:25:51 | <Taejo> | FMota_, a line with a wedge on one end (or both) |
| 22:25:59 | <omnId> | I just know that instance Arrow (->) is really useful :) |
| 22:26:02 | <FMota_> | :) thanks omnId |
| 22:26:18 | <smashor> | hello! |
| 22:26:20 | <FMota_> | Taejo: :/ |
| 22:26:23 | <omnId> | @kind (->) |
| 22:26:25 | <lambdabot> | ?? -> ? -> * |
| 22:26:46 | <omnId> | ^^ implementation detail, plug your ears and think * -> * -> * :) |
| 22:27:00 | <FMota_> | lol |
| 22:27:06 | <omnId> | @kind Kleisli IO |
| 22:27:08 | <lambdabot> | * -> * -> * |
| 22:27:54 | <hpaste> | smashor pasted "putStr vs. putStrLn" at http://hpaste.org/3218 |
| 22:28:27 | <newsham> | an arrow is something that takes an input and makes an output |
| 22:28:30 | <omnId> | putStrLn x = do putStr x; putStr "\n" -- effectively |
| 22:28:56 | <Taejo> | omnId, does it output the right newline on non-Unix systems? |
| 22:29:03 | <omnId> | *shrug* |
| 22:29:11 | <omnId> | seems to |
| 22:29:23 | <monochrom> | Yes, it does. |
| 22:29:25 | <mauke> | Taejo: that's not putStrLn's business |
| 22:29:27 | <smashor> | I've got a newbie question: I want to print out a string using putStr, and then I want to read in a line. when I run the program, first the line is read in and the string is print out. If I substitute putStr with putStrLn it has the correct order. |
| 22:29:44 | <mauke> | smashor: insert hFlush stdout; after putStr |
| 22:30:21 | <n00b> | Using list comprehension, define a Haskell function unlucky, which returns all the days in a given year which have the date Friday 13th e.g. unlucky 2004 ! [(13,2,2004),(13,8,2004)] |
| 22:30:24 | <n00b> | this part |
| 22:30:47 | <newsham> | your print is working, but its not being flushed out |
| 22:30:54 | <yitz> | smashor: |
| 22:30:56 | <paczesiowa> | smashor: or use this: |
| 22:30:58 | <paczesiowa> | main = do |
| 22:31:00 | <yitz> | @type hSetBuffering |
| 22:31:02 | <paczesiowa> | hSetBuffering stdout NoBuffering |
| 22:31:02 | <paczesiowa> | putStr("pytanie1") |
| 22:31:02 | <paczesiowa> | odpowiedz1 <- getLine |
| 22:31:02 | <paczesiowa> | putStr("pytanie2") |
| 22:31:02 | <lambdabot> | Not in scope: `hSetBuffering' |
| 22:31:03 | <paczesiowa> | odpowiedz2 <- getLine |
| 22:31:05 | <paczesiowa> | putStr(odpowiedz1 ++ odpowiedz2) |
| 22:31:07 | <paczesiowa> | sry for paste |
| 22:31:07 | <Taejo> | mauke, who's business is it? |
| 22:31:16 | <Taejo> | s/who's/whose |
| 22:31:20 | <yitz> | @type System.IO.hSetBuffering |
| 22:31:22 | <mauke> | Taejo: the IO subsystem |
| 22:31:22 | <lambdabot> | GHC.IOBase.Handle -> GHC.IOBase.BufferMode -> IO () |
| 22:31:33 | <mauke> | paczesiowa: eww, that's horribly inefficient |
| 22:31:36 | <mauke> | paczesiowa: also, you have too many ()'s |
| 22:31:45 | <yitz> | @src System.IO.BufferMode |
| 22:31:45 | <lambdabot> | Source not found. You speak an infinite deal of nothing |
| 22:31:52 | <Taejo> | So the IO subsystem translates "\n" to "\r\n"? |
| 22:31:52 | <yitz> | @type System.IO.BufferMode |
| 22:31:55 | <lambdabot> | Not in scope: data constructor `System.IO.BufferMode' |
| 22:32:01 | <Taejo> | What if I want to output "\n"? |
| 22:32:13 | <omnId> | mauke: parens don't break anything, at least :) |
| 22:32:21 | <mauke> | Taejo: writing '\n' to a text filehandle is translated appropriately for the platform |
| 22:32:21 | <paczesiowa> | mauke: that was code I used to show my newbe friend |
| 22:32:33 | <newsham> | is System.IO.interact appropriate for you? |
| 22:32:37 | <newsham> | might simplify things if so |
| 22:32:42 | <mauke> | Taejo: "\n" means newline. you write a newline, you get a newline |
| 22:33:03 | <mauke> | Taejo: that "newline" might be externally represented as "\013\010" but that's not your business |
| 22:33:15 | <Taejo> | mauke, that's horrible |
| 22:33:23 | <mauke> | that's how C works |
| 22:33:30 | <omnId> | hPutStr on a readBinaryFile'd file should put a single '\x10', regardless, iiuc |
| 22:33:42 | <omnId> | s/read/open/ |
| 22:33:46 | <Taejo> | ok, that's fair enough |
| 22:33:47 | <smashor> | mauke: paczesiowa: thanks, both are okay, thanks. |
| 22:33:48 | <Japsu> | @pl \(ax, ay) (bx, by) -> (bx-ax, by-ay) |
| 22:33:49 | <lambdabot> | uncurry (flip flip snd . (ap .) . flip flip fst . ((.) .) . (. subtract) . flip . (((.) . (,)) .) . subtract) |
| 22:33:53 | <Japsu> | UGH |
| 22:33:58 | <Japsu> | ACTION bashes lambdabot with a stick |
| 22:34:04 | <n00b> | I wrrote this unlucky year = [d == 13| (d,m,y) <- y,] |
| 22:34:15 | <n00b> | doesn't seems to gonna work |
| 22:34:19 | <omnId> | @type (-) *** (-) |
| 22:34:21 | <lambdabot> | forall a a1. (Num a, Num a1) => (a, a1) -> (a -> a, a1 -> a1) |
| 22:34:42 | <yitz> | @type System.IO.hSetBinaryMode |
| 22:34:43 | <lambdabot> | GHC.IOBase.Handle -> Bool -> IO () |
| 22:34:59 | <newsham> | omni: you can do fancy arrow-plumbing using do-notation without having to resort to *** and friends |
| 22:35:13 | <yitz> | That determines whether or not \n gets translated to \r\n on Windows |
| 22:35:23 | <mauke> | it doesn't get translated to \r\n :( |
| 22:35:24 | <Japsu> | omnId: I was hoping for lambdabot to do some arrow magic like that but instead it gave that... thing |
| 22:35:25 | <omnId> | newsham: but I *like* *** and friends! :D |
| 22:35:30 | <mauke> | it's translated to \013\010 |
| 22:35:37 | <dons> | its not too schooled up on arrows |
| 22:35:58 | <yitz> | Or you can just open the file using: |
| 22:36:09 | <yitz> | @type System.IO.openBinaryFile |
| 22:36:11 | <lambdabot> | FilePath -> GHC.IOBase.IOMode -> IO GHC.IOBase.Handle |
| 22:36:24 | <Japsu> | Hmm |
| 22:36:26 | <Japsu> | let's try this: |
| 22:36:44 | <Japsu> | @pl a b -> (fst b - fst a, snd b - snd a) |
| 22:36:45 | <lambdabot> | (line 1, column 5): |
| 22:36:45 | <lambdabot> | unexpected ">" or "-" |
| 22:36:45 | <lambdabot> | expecting variable, "(", operator or end of input |
| 22:36:46 | <newsham> | dons: liked your xmonad talk @ HW |
| 22:36:49 | <Japsu> | oops |
| 22:36:51 | <Japsu> | @pl \a b -> (fst b - fst a, snd b - snd a) |
| 22:36:52 | <lambdabot> | ap (ap . ((,) .) . flip ((-) . fst) . fst) (flip ((-) . snd) . snd) |
| 22:36:56 | <Japsu> | urgh. |
| 22:37:01 | <newsham> | do you know if the papers for HW are collected online somewhere (free?)? |
| 22:37:05 | <omnId> | probably @pl's first step :) |
| 22:37:14 | <dons> | newsham: cheers. hmm, no, but google can find them |
| 22:37:27 | <newsham> | yah, i dug up one of them (beauty/awkward squad) |
| 22:37:48 | <Japsu> | :t (***) |
| 22:37:50 | <lambdabot> | forall (a :: * -> * -> *) b c b' c'. (Arrow a) => a b c -> a b' c' -> a (b, b') (c, c') |
| 22:37:58 | <Japsu> | err |
| 22:37:59 | <Japsu> | no. |
| 22:38:01 | <Japsu> | not that. |
| 22:38:10 | <Japsu> | :t (&&&) |
| 22:38:12 | <lambdabot> | forall (a :: * -> * -> *) b c c'. (Arrow a) => a b c -> a b c' -> a b (c, c') |
| 22:38:17 | <newsham> | so it sounds like the next big missing haskell piece if a bug tracking system to call our own? ;-) |
| 22:38:22 | <newsham> | s/if/is/ |
| 22:38:23 | <Japsu> | bah |
| 22:39:43 | <hpaste> | n00b pasted "Friday 13" at http://hpaste.org/3219 |
| 22:39:52 | <newsham> | (did shapr call for a bug tracking system yet?) |
| 22:40:03 | <monochrom> | "Halibugs" |
| 22:40:05 | <n00b> | <omnId> take a look |
| 22:40:17 | <n00b> | trying to filter all friday 13 in a year |
| 22:40:20 | <Philippa_> | monochrom: cures bad breath? |
| 22:40:28 | <omnId> | n00b: dayName is a function, it needs arguments |
| 22:40:47 | <omnId> | (in unlucky's def) |
| 22:41:10 | <hpaste> | (anonymous) annotated "Friday 13" with "(no title)" at http://hpaste.org/3219#a1 |
| 22:42:12 | <n00b> | it keeps saying undefined varibale y |
| 22:42:19 | <n00b> | why ???? |
| 22:42:35 | <mauke> | because y isn't defined anywhere |
| 22:42:44 | <omnId> | n00b: in unlucky's list comp "(d) <- (d,m,y)" is invalid, remember generators take a list, (d,m,y) isn't a list. Isn't year the list you're pulling from? |
| 22:42:50 | <monochrom> | unlucky year = [(d,m,y ... |
| 22:44:05 | <omnId> | a list comp generator of the form "pat <- expr" evaluates expr and binds new names within the pat to each element of expr's resulting list (in turn) |
| 22:44:13 | <yitz> | @type uncurry ($) (subtract)***(subtract) |
| 22:44:16 | <lambdabot> | Couldn't match expected type `(a -> b, a)' |
| 22:44:16 | <lambdabot> | against inferred type `a1 -> a1 -> a1' |
| 22:44:27 | <yitz> | @type uncurry ($) $ (subtract)***(subtract) |
| 22:44:27 | <omnId> | @type uncurry ($) |
| 22:44:29 | <lambdabot> | Couldn't match expected type `(a -> b, a)' |
| 22:44:29 | <lambdabot> | against inferred type `(a1, a2) -> (a1 -> a1, a2 -> a2)' |
| 22:44:30 | <lambdabot> | forall a b. (a -> b, a) -> b |
| 22:44:58 | <omnId> | @. pl djinn (a->b, a->b) -> (a, a) -> (b, b) |
| 22:44:59 | <lambdabot> | f = uncurry (flip flip snd . (ap .) . flip flip fst . (((.) . (const .)) .) . liftM2 (,)) |
| 22:45:04 | <omnId> | bah |
| 22:45:22 | <newsham> | > > ((+2) &&& (+3) >>> (*2) *** (*3)) 5 |
| 22:45:22 | <lambdabot> | parse error on input `>' |
| 22:45:23 | <oerjan> | :t curry $ (subtract)***(subtract) |
| 22:45:25 | <newsham> | > ((+2) &&& (+3) >>> (*2) *** (*3)) 5 |
| 22:45:28 | <lambdabot> | (14,24) |
| 22:45:28 | <lambdabot> | forall a a1. (Num a, Num a1) => a -> a1 -> (a -> a, a1 -> a1) |
| 22:45:57 | <hpaste> | n00b annotated "Friday 13" with "Friday 13" at http://hpaste.org/3219#a2 |
| 22:45:59 | <newsham> | > ((5+2)*2, (5+3)*3) |
| 22:46:01 | <lambdabot> | (14,24) |
| 22:46:03 | <yitz> | @type subtract***subtract) |
| 22:46:05 | <lambdabot> | parse error on input `)' |
| 22:46:07 | <yitz> | @type subtract***subtract |
| 22:46:09 | <lambdabot> | forall a a1. (Num a, Num a1) => (a, a1) -> (a -> a, a1 -> a1) |
| 22:46:28 | <oerjan> | :t curry ($) $ (subtract)***(subtract) |
| 22:46:31 | <lambdabot> | Couldn't match expected type `(a, b)' |
| 22:46:31 | <lambdabot> | against inferred type `a1 -> b1' |
| 22:46:54 | <oerjan> | :t uncurry ($) . (subtract)***(subtract) |
| 22:46:56 | <lambdabot> | Couldn't match expected type `(a -> b, a)' |
| 22:46:56 | <lambdabot> | against inferred type `a1 -> a1' |
| 22:47:05 | <oerjan> | :t uncurry ($) . (subtract***subtract) |
| 22:47:07 | <lambdabot> | forall b'. (Num (b' -> b'), Num b') => (b' -> b', b') -> b' -> b' |
| 22:47:14 | <newsham> | oerjan: subtract is a binop, arrows are unary (no?) |
| 22:47:20 | <yitz> | @type uncurry (***) . (subtract***subtract) |
| 22:47:22 | <lambdabot> | forall b b'. (Num b, Num b') => (b, b') -> (b, b') -> (b, b') |
| 22:47:29 | <yitz> | Aha! |
| 22:47:43 | <djfroofy> | @let noway = [1:] |
| 22:47:43 | <lambdabot> | Parse error |
| 22:48:24 | <oerjan> | newsham: any binary function is also unary, by currying |
| 22:48:29 | <newsham> | > uncurry (+) $ ((+2) &&& (+3) >>> (*2) *** (*3)) 5 |
| 22:48:31 | <lambdabot> | 38 |
| 22:48:49 | <paczesiowa> | isn't every function unary? |
| 22:48:51 | <newsham> | i'm sure a do-notation arrow diagram would be a lot clearer |
| 22:49:04 | <newsham> | oerjan: you are of course correct |
| 22:49:16 | <djfroofy> | > [1:] |
| 22:49:17 | <lambdabot> | Parse error |
| 22:49:27 | <djfroofy> | > [1..] |
| 22:49:28 | <lambdabot> | [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,... |
| 22:49:34 | <yitz> | @type uncurry (***) . (subtract***subtract) (10,9) (8,7) |
| 22:49:36 | <lambdabot> | Couldn't match expected type `t -> a -> (a1 b c, a1 b' c')' |
| 22:49:36 | <lambdabot> | against inferred type `(a2 -> a2, a3 -> a3)' |
| 22:49:45 | <djfroofy> | cursed ... i though that would be the end all to this channel ;) |
| 22:50:24 | <yitz> | @type (uncurry (***) . (subtract***subtract)) (10,9) (8,7) |
| 22:50:25 | <omnId> | > fix ((1:) . map succ) |
| 22:50:25 | <lambdabot> | forall b b'. (Num b, Num b') => (b, b') |
| 22:50:27 | <lambdabot> | [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,... |
| 22:50:39 | <dolio> | > (uncurry (***) . (subtract***subtract)) (10,9) (8,7) |
| 22:50:40 | <lambdabot> | (-2,-2) |
| 22:50:44 | <yitz> | > (uncurry (***) . (subtract***subtract)) (10,9) (8,7) |
| 22:50:46 | <lambdabot> | (-2,-2) |
| 22:50:52 | <dolio> | ACTION wins. :) |
| 22:51:00 | <yitz> | > (flip $ uncurry (***) . (subtract***subtract)) (10,9) (8,7) |
| 22:51:01 | <lambdabot> | (2,2) |
| 22:51:05 | <yitz> | Yay! |
| 22:51:27 | <mauke> | > fix ((1 :) . (1 :) . ap (zipWith (+)) tail) |
| 22:51:29 | <lambdabot> | [1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17... |
| 22:51:40 | <omnId> | @type uncurry (***) |
| 22:51:42 | <lambdabot> | forall (a :: * -> * -> *) b c b' c'. (Arrow a) => (a b c, a b' c') -> a (b, b') (c, c') |
| 22:51:46 | <jaj> | > print "Hi!" |
| 22:51:48 | <lambdabot> | <IO ()> |
| 22:52:15 | <newsham> | > readFile "/etc/passwd" |
| 22:52:16 | <lambdabot> | <IO [Char]> |
| 22:52:27 | <yitz> | newsham: Watch it! |
| 22:52:37 | <omnId> | yes, it's an IO action :) |
| 22:52:38 | <jaj> | :) |
| 22:52:43 | <newsham> | > writeFile "/tmp/gotcha" "hello, earthling!" |
| 22:52:44 | <lambdabot> | <IO ()> |
| 22:53:00 | <omnId> | > system "rm -rf *" |
| 22:53:00 | <lambdabot> | Not in scope: `system' |
| 22:53:03 | <paczesiowa> | print "Hello World!" |
| 22:53:08 | <paczesiowa> | > print "Hello World!" |
| 22:53:09 | <lambdabot> | <IO ()> |
| 22:53:34 | <mauke> | @yhjulwwiefzojcbxybbruweejw |
| 22:53:34 | <lambdabot> | "\"#$%&'()*+,\"" |
| 22:53:44 | <omnId> | @. elite brain |
| 22:53:44 | <lambdabot> | bUT \/\/|-|ERE ArE WE gOiNg TO phiND 4 ducx aNd A |-|o5E 4t +hiz |-|ouR? |
| 22:53:58 | <mauke> | @yhjulwwiefzojcbxybbruweejw |
| 22:53:58 | <lambdabot> | "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\" |
| 22:54:10 | <paczesiowa> | does other (dirty, imperative) language-channels have channel bots? |
| 22:54:16 | <LoganCapaldo> | > unsafePerformIO $ writeFile "/tmp/gotcha" "Hello earthling" |
| 22:54:17 | <lambdabot> | Not in scope: `unsafePerformIO' |
| 22:54:17 | <lambdabot> | LoganCapaldo: You have 1 new message. '/msg lambdabot @messages' to read it. |
| 22:54:18 | <mauke> | paczesiowa: most channels do |
| 22:54:19 | <jaj> | > return "hello" |
| 22:54:20 | <lambdabot> | add an instance declaration for (Show (m [Char])) |
| 22:54:21 | <LoganCapaldo> | Blast |
| 22:54:23 | <mauke> | at least in my experience |
| 22:54:24 | <omnId> | @seen lambdabot |
| 22:54:25 | <lambdabot> | Yes, I'm here. I'm in #galois, #friendly-coders, #scannedinavian, #gentoo-haskell, ##logic, #xmonad, #unicycling, #perl6, #parrot, #jtiger, #haskell-soc, #haskell-overflow, #haskell-blah, #scala, # |
| 22:54:25 | <lambdabot> | haskell, #ghc and #darcs |
| 22:54:34 | <omnId> | #perl6 |
| 22:54:34 | <paczesiowa> | so how do they protect against these kind of attacks? |
| 22:54:43 | <mauke> | paczesiowa: most bots don't execute code |
| 22:54:53 | <paczesiowa> | > Data.IO.Unsafe.unsafePerformIO $ writeFile "/tmp/gotcha" "Hello earthling" |
| 22:54:54 | <lambdabot> | Not in scope: `Data.IO.Unsafe.unsafePerformIO' |
| 22:54:58 | <LoganCapaldo> | @seen ivanm |
| 22:54:59 | <lambdabot> | ivanm is in #xmonad, #haskell and #gentoo-haskell. I last heard ivanm speak 9h 31m 20s ago. |
| 22:55:20 | <newsham> | pac: most dont let you do arbitrary evals |
| 22:55:28 | <newsham> | you can have a bot without having an evaluator |
| 22:55:36 | <ddarius> | paczesiowa: lambdabot has been hit pretty hard with (well-meaning) attempts to subvert security. You are going to have to be a lot more clever. |
| 22:55:56 | <mauke> | basically, chroot and drop privileges |
| 22:55:57 | <omnId> | @run++ |
| 22:55:57 | <lambdabot> | <stdin>: hGetLine: end of file |
| 22:56:04 | <omnId> | :) |
| 22:56:05 | <n00b> | > puStr "Hello" ++ "World" |
| 22:56:05 | <lambdabot> | Not in scope: `puStr' |
| 22:56:09 | <mauke> | and setrlimits |
| 22:56:11 | <n00b> | > putStr "Hello" ++ "World" |
| 22:56:12 | <lambdabot> | Couldn't match expected type `[a]' against inferred type `IO ()' |
| 22:56:15 | <paczesiowa> | so first version would evaluate unsafe IO ? |
| 22:56:19 | <n00b> | > putStr "Hello" + "World" |
| 22:56:19 | <lambdabot> | Couldn't match expected type `IO ()' against inferred type `[Char]' |
| 22:56:25 | <monochrom> | hGetLife: end of life |
| 22:56:26 | <n00b> | > putStr "Hello" ++ "World" |
| 22:56:27 | <lambdabot> | Couldn't match expected type `[a]' against inferred type `IO ()' |
| 22:56:30 | <LoganCapaldo> | function application binds tighter than almost anythign else |
| 22:56:40 | <paczesiowa> | almost? |
| 22:56:47 | <omnId> | n00b: that parses as (putStr "Hello") ++ "World" |
| 22:56:47 | <LoganCapaldo> | parentheses |
| 22:56:48 | <mauke> | paczesiowa: record update |
| 22:56:52 | <pjd> | > putStr $ "Hello" ++ "World" |
| 22:56:53 | <lambdabot> | <IO ()> |
| 22:57:00 | <pjd> | heh |
| 22:57:02 | <pjd> | oops |
| 22:57:11 | <LoganCapaldo> | record update is a waaaay cooler response though |
| 22:57:21 | <monochrom> | > putStr " <IO ()>" |
| 22:57:22 | <lambdabot> | <IO ()> |
| 22:57:27 | <omnId> | n00b: function application is tighter that all operators (like (++)) |
| 22:57:28 | <mauke> | haha |
| 22:57:28 | <jaj> | > read 2 |
| 22:57:29 | <lambdabot> | add an instance declaration for (Num String) |
| 22:57:40 | <newsham> | > read "2" :: Float |
| 22:57:41 | <lambdabot> | 2.0 |
| 22:57:42 | <paczesiowa> | monochrom::D |
| 22:57:49 | <LoganCapaldo> | clever monchrom |
| 22:57:52 | <monochrom> | hehe |
| 22:57:53 | <LoganCapaldo> | whoah |
| 22:58:03 | <LoganCapaldo> | I fial |
| 22:58:12 | <LoganCapaldo> | I can't even type "fail" |
| 22:58:22 | <n00b> | > putStr "Hello" |
| 22:58:23 | <newsham> | byzantine |
| 22:58:24 | <lambdabot> | <IO ()> |
| 22:58:26 | <monochrom> | "monochrom::D" means monochrom has type D ? :) |
| 22:58:29 | <Japsu> | failature |
| 22:58:33 | <mauke> | > sqrt (-1) :: Complex (Complex Double) |
| 22:58:34 | <lambdabot> | add an instance declaration for (RealFloat (Complex Double)) |
| 22:58:34 | <lambdabot> | In th... |
| 22:58:40 | <mauke> | :( |
| 22:58:40 | <omnId> | @src D |
| 22:58:41 | <lambdabot> | Source not found. Wrong! You cheating scum! |
| 22:58:52 | <jaj> | > pi |
| 22:58:54 | <lambdabot> | 3.141592653589793 |
| 22:58:58 | <LoganCapaldo> | I think that's my favorite |
| 22:59:05 | <LoganCapaldo> | (you cheating scum) |
| 22:59:19 | <omnId> | So abusive |
| 22:59:26 | <newsham> | "I know everything hasn't been quite right with me, but I can assure you now, very confidentaly, that it's going to be all right again. I feel much better now. I really do." |
| 22:59:34 | <mauke> | @quote |
| 22:59:35 | <lambdabot> | OlegFacts says: Oleg solves NP-hard problems in N log N time... in the type system |
| 22:59:54 | <omnId> | @quote Oleg |
| 22:59:54 | <lambdabot> | Oleg says: The implementation of RSA on type level is left for future work |
| 23:00:04 | <monochrom> | hahahahaha |
| 23:00:21 | <jaj> | newsham, I can't let you do this Dave |
| 23:00:52 | <newsham> | ?remember lambdabot I know everything hasn't been quite right with me, but I can assure you now, very confidentaly, that it's going to be all right again. I feel much better now. I really do. |
| 23:00:52 | <lambdabot> | Done. |
| 23:00:56 | <newsham> | ;-) |
| 23:01:02 | <monochrom> | hehe |
| 23:01:10 | <omnId> | forger! |
| 23:01:54 | <omnId> | @vixen Who would win in a fight between you and Hal? |
| 23:01:55 | <lambdabot> | i might :) |
| 23:02:00 | <omnId> | lol |
| 23:02:04 | <paczesiowa> | can I Data.Typeable.cast some Typeable value x to e.g. Left n and use that n? |
| 23:02:19 | <jaj> | great |
| 23:02:54 | <n00b> | <omnId> i can't seem to figure it out could you help |
| 23:03:07 | <omnId> | n00b: unlucky? |
| 23:03:18 | <LoganCapaldo> | paczesiowa: you can probably cast to Either sometype someothertype |
| 23:03:23 | <mauke> | > cast (Left 42) |
| 23:03:24 | <lambdabot> | Add a type signature |
| 23:03:29 | <n00b> | i guess so |
| 23:03:36 | <mauke> | > cast (Left 42) :: Either Integer () |
| 23:03:37 | <omnId> | @type cast |
| 23:03:38 | <lambdabot> | Couldn't match expected type `Either Integer ()' |
| 23:03:39 | <lambdabot> | forall a b. (Typeable b, Typeable a) => a -> Maybe b |
| 23:03:40 | <mauke> | > cast (Left 42) :: Maybe (Either Integer ()) |
| 23:03:41 | <lambdabot> | Add a type signature |
| 23:04:05 | <mauke> | > cast (Left 'x') :: Maybe (Either Char ()) |
| 23:04:06 | <lambdabot> | Add a type signature |
| 23:04:08 | <omnId> | Left 42 :: Either Integer a, a isn't specified |
| 23:04:10 | <mauke> | I give up |
| 23:04:10 | <paczesiowa> | > fromJust ( cast (Left 42)) :: Either Integer () |
| 23:04:11 | <lambdabot> | Add a type signature |
| 23:04:21 | <omnId> | mauke: ^ |
| 23:04:26 | <LoganCapaldo> | mauke: it needed the type of Left 42 |
| 23:04:58 | <mauke> | > cast (Left 42 :: Either Integer ()) :: Maybe (Either Integer ()) |
| 23:05:00 | <omnId> | n00b: year is a [(Int,Int,Int)]? |
| 23:05:00 | <lambdabot> | Just (Left 42) |
| 23:05:21 | <paczesiowa> | mauke: thx |
| 23:05:53 | <omnId> | n00b: in the list comp, you'll want to extract the (d,m,y)'s from the year, [ ... | (d,m,y) <- year, ... ] |
| 23:06:26 | <paczesiowa> | > let f x = cast (x :: Either Integer ()) :: Maybe (Either Integer ()) in f (Left 1) |
| 23:06:28 | <lambdabot> | Just (Left 1) |
| 23:06:38 | <omnId> | > cast 'a' :: Maybe Int |
| 23:06:39 | <lambdabot> | Nothing |
| 23:07:12 | <hpaste> | (anonymous) annotated "Friday 13" with "(no title)" at http://hpaste.org/3219#a3 |
| 23:08:12 | <omnId> | n00b: well you'll need another function wholeYear :: Int -> [(Int, Int, Int)] that gives you the list of days in 2004, given the Int 2004. |
| 23:08:30 | <n00b> | ok |
| 23:10:34 | <omnId> | n00b: ignore dayName for now, just check that date d m y == 5 (for Friday). (And I'd rename that function to weekday) |
| 23:10:56 | <mightybyte> | Does haskell have any truly mutable data structures? |
| 23:10:57 | <omnId> | date has an invalid signature |
| 23:11:15 | <paczesiowa> | mightybyte: yes, inside IO monad |
| 23:11:39 | <yitz> | mightybyte: Yes, but they are in the IO or ST monad |
| 23:12:10 | <omnId> | n00b: with that wholeYear function, unlucky should look like [ ... | (d,m,y) <- wholeYear y, ... ] |
| 23:12:18 | <dons> | mightybyte: sure. lots of monadic mutable structures. |
| 23:12:22 | <mightybyte> | The reason I ask is that I'm working on generating chess endgame tables and if I'm going to generate big ones, I have to be able to modify the table in place. |
| 23:12:30 | <dons> | sure. |
| 23:12:34 | <omnId> | wholeYear gets you the list of dates, and the list comp generator extracts them. |
| 23:12:37 | <dons> | you can use whatever structure you'd like. |
| 23:12:44 | <smashor> | is there a predefined function for counting the elements of a list ? |
| 23:12:51 | <omnId> | length |
| 23:12:57 | <mightybyte> | I've been working on it in C++, and the more I do, the more I wish I was doing it in Haskell. |
| 23:12:57 | <mauke> | @hoogle [a] -> Int |
| 23:12:58 | <lambdabot> | Prelude.length :: [a] -> Int |
| 23:13:08 | <smashor> | ouch, thanks |
| 23:13:35 | <mightybyte> | Do these mutable structures impose much overhead on a per-element basis? |
| 23:13:54 | <dons> | they're compiled to the same code as in C, pretty much |
| 23:14:09 | <hpaste> | (anonymous) annotated "Friday 13" with "(no title)" at http://hpaste.org/3219#a4 |
| 23:14:18 | <paczesiowa> | mauke: is that cast idea possible with polimorphic types (like Either a b instead Either Integer ()), perhaps another -fallow-smth-dirty ? |
| 23:14:19 | <mightybyte> | Ok. I'm essentially looking for a huge random access array. |
| 23:14:26 | <dons> | sure. use a IOUArray then |
| 23:14:26 | <pjd> | mightybyte: they come in boxed and unboxed varieties |
| 23:14:31 | <n00b> | <omnId>take a look |
| 23:14:33 | <dons> | its just raw heap values |
| 23:14:35 | <n00b> | not perfect |
| 23:14:36 | <omnId> | n00b: you have to *write* the wholeYear function :) |
| 23:14:38 | <mightybyte> | Huge being > 32 bit index. |
| 23:14:41 | <mauke> | paczesiowa: I don't think so |
| 23:14:49 | <n00b> | ok |
| 23:14:50 | <dons> | mightybyte: do you have enough ram for that? |
| 23:14:53 | <dons> | or you want it lazy? |
| 23:14:55 | <mightybyte> | dons: Yes. |
| 23:15:00 | <dons> | ok, should be fun. |
| 23:15:04 | <mightybyte> | I have a machine with 8 gigs of RAM |
| 23:15:27 | <dons> | ghc's unboxed arrays are rather good |
| 23:15:37 | <dons> | be sure to use -O2 for maximum efficiency |
| 23:15:52 | <mightybyte> | Ok. This sounds great. |
| 23:16:00 | <dons> | here's an example, |
| 23:16:01 | <dons> | http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsievebits&lang=all |
| 23:16:03 | <hpaste> | omnId annotated "Friday 13" with "to start with" at http://hpaste.org/3219#a5 |
| 23:16:06 | <lambdabot> | Title: nsieve-bits benchmark | Gentoo : Intel® Pentium® 4 Computer Langu ..., http://tinyurl.com/sxpth |
| 23:16:12 | <dons> | outperforms C++ for the bit array benchmark |
| 23:16:21 | <dons> | well, one C++ program |
| 23:16:26 | <bos> | dons: you know your k-nucleotide code isn't compiling? |
| 23:16:27 | <paczesiowa> | mauke: even with smth so funky looking like this? case (cast x :: (forall a b . (Expresable a, Expresable b) => Maybe (Expr a b))) of |
| 23:16:27 | <dons> | and its with 10% of C. |
| 23:16:37 | <dons> | bos, so i heard. it probably uses lazy bytestring internals? |
| 23:16:52 | <bos> | no, it's just missing something trivial like -fglasgow-exts |
| 23:17:08 | <mightybyte> | dons: Ok, this is encouraging. |
| 23:17:08 | <dons> | oh? so someone should submit a bug ticket for that to the alioth tracker |
| 23:17:12 | <bos> | dons: are you back from germany yet? |
| 23:17:16 | <dons> | bos, looks ok here, http://shootout.alioth.debian.org/gp4/benchmark.php?test=knucleotide&lang=all |
| 23:17:18 | <lambdabot> | Title: k-nucleotide benchmark | Gentoo : Intel® Pentium® 4 Computer Lang ..., http://tinyurl.com/mnnkb |
| 23:17:20 | <dons> | bos, yeah, got back yesterday |
| 23:17:30 | <hpaste> | omnId annotated "Friday 13" with "er, and unlucky is supposed to *use* wholeYear, not get it as an argument :X" at http://hpaste.org/3219#a6 |
| 23:17:36 | <bos> | dons: have fun? |
| 23:17:46 | <omnId> | n00b: my last change: http://hpaste.org/3219/diff?old=5&new=6 |
| 23:17:53 | <mightybyte> | I keep encountering complex looping infrastructure code that I want to abstract. It would be so much easier in Haskell. |
| 23:17:59 | <dons> | bos, it was probably the best ICFP i've been to |
| 23:18:07 | <bos> | cool |
| 23:18:09 | <dons> | and along with the hackathon, and CUFP, was a very high energy event |
| 23:18:17 | <Beelsebob> | hmm... people who know maths, is there any way to simplify cos(tan^{-1}(n_x / n_y))? |
| 23:18:18 | <bos> | what made the difference? |
| 23:18:38 | <dons> | there was some real optimism in the air, and the beer was good? |
| 23:18:48 | <dons> | mightybyte: here's some kick butt Double arrays, http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all |
| 23:18:50 | <lambdabot> | Title: spectral-norm benchmark | Gentoo : Intel® Pentium® 4 Computer Lan ..., http://tinyurl.com/bruf8 |
| 23:18:53 | <dons> | we do beat C on that one |
| 23:19:04 | <EvilTerran> | n_x is the opposite, and n_y is the adjacent (in terms of the arctan)... |
| 23:19:14 | <mightybyte> | dons: Hmmm, I don't need double arrays. I try to stick to integer math. |
| 23:19:29 | <n00b> | <omnId> what would wholeYear be ??? |
| 23:19:46 | <EvilTerran> | cos is adjacent/hypotenuse, so n_y / sqrt(n_x^2 + n_y^2), Beelsebob |
| 23:20:14 | <Beelsebob> | EvilTerran: of course |
| 23:20:19 | <Beelsebob> | I know I was missing something obvious |
| 23:20:25 | <EvilTerran> | i've still got it :D |
| 23:20:46 | <EvilTerran> | ...man, i haven't done any non-negligable amount of trig for aaages. |
| 23:21:23 | <mightybyte> | dons: Thanks for the info. I'll have to see what I can do. |
| 23:21:26 | <omnId> | hmm, at a first approximation, [(d,m,y) | d <- [30], m <- [1..12]] -- hmm... I'm not so good at list comps. I need my hofs!! |
| 23:21:29 | <EvilTerran> | but yeah, in general, if you've got a trig function around an inverse trig function, i think it can always be reduced to fractions and square roots |
| 23:22:25 | <omnId> | [(<daysForMonthM>,m,y) | m <- [1..12]] -- better, now you'll need the days part |
| 23:22:34 | <omnId> | wait, no |
| 23:23:45 | <omnId> | that only gives 12 results, we'll need 365 |
| 23:24:16 | <omnId> | so [ (d,m,y) | m <- [1..12], d <- ... ] -- can you think of what to put in the ..., n00b? |
| 23:24:52 | <omnId> | the days range from 1 to something dependant on the month. |
| 23:24:57 | <omnId> | (and year) |
| 23:25:05 | <omnId> | darned February |
| 23:25:05 | <dons> | bos, I'll write up an ICFP summary, with video links. anything particular people would be interested in? |
| 23:25:22 | <dons> | besides how great the beer is in Freiburg? :) |
| 23:25:30 | <dons> | 'cause its rather good |
| 23:25:30 | <n00b> | feb as 29 plus leap years |
| 23:25:45 | <byorgey> | mmm... can you include free beer samples with your writeup? |
| 23:25:51 | <omnId> | n00b: do you know how to make a list from one to something? |
| 23:25:52 | <mrd> | mm beer |
| 23:26:03 | <omnId> | n00b: that's what you put in the ..., can you see why? |
| 23:26:03 | <n00b> | yes |
| 23:26:09 | <n00b> | 1..n |
| 23:26:11 | <bos> | dons: CUFP in particular, i'd guess |
| 23:26:13 | <dons> | byorgey: i'm not sure the interwebs can handle that. but google must have a new system in beta for that, no? |
| 23:26:22 | <omnId> | where n = <something based on the month and year> |
| 23:26:30 | <dons> | bos, ah yes. |
| 23:26:34 | <n00b> | yes |
| 23:26:39 | <byorgey> | dons: probably. Google Beer Search! |
| 23:26:48 | <bos> | the latest advances in typesetting big piles of type equations are not likely to grab teh redditors |
| 23:26:50 | <omnId> | so wholeYear y = [ (d,m,y) | m <- [1..12], d <- [1.. <blah>] ] so far |
| 23:27:05 | <n00b> | yes |
| 23:27:23 | <mrd> | bos: what advances? |
| 23:27:34 | <dons> | bos, though icfp was rather practically oriented this year |
| 23:27:37 | <omnId> | you might even make this another function, daysInMonthAndYear m y = ... |
| 23:27:40 | <dons> | with the linspire guys, for example, giving a report. |
| 23:27:51 | <omnId> | then wholeYear y = [ (d,m,y) | m <- [1..12], d <- [1..daysInMonthAndYear m y] ] |
| 23:28:01 | <bos> | dons: nice |
| 23:28:18 | <omnId> | n00b: follow? |
| 23:28:19 | <dons> | and a big haskell session on the last day |
| 23:28:59 | <n00b> | yes |
| 23:29:19 | <omnId> | n00b: you think you can manage this last function? |
| 23:30:06 | <n00b> | i'll try |
| 23:30:25 | <omnId> | it's mostly a simple case month of 1 -> 31; 2 -> <darned feb>; 3 -> 31; 4 -> 30; ... |
| 23:30:56 | <byorgey> | February Complicates Everything. |
| 23:32:06 | <omnId> | ACTION . o O (I wonder if everyone else always needs that "Thirty days have September..." rhyme, too) |
| 23:32:06 | <n00b> | yes |
| 23:32:29 | <byorgey> | ACTION does the counting on knuckles thing |
| 23:32:36 | <omnId> | explain |
| 23:33:16 | <byorgey> | make a fist with one hand. now point to each of your knuckles and the spaces in between them in turn, counting months as you go. |
| 23:33:42 | <byorgey> | so January is on your first knuckle, February is the space in between your first and second knuckles, March is the second knuckle, and so on |
| 23:33:49 | <omnId> | right |
| 23:33:57 | <byorgey> | when you get to the last knuckle, repeat it and start backwards. |
| 23:34:14 | <byorgey> | knuckles correspond to 31 days, spaces to 30, except February which you remember anyway. |
| 23:34:23 | <omnId> | cool |
| 23:34:27 | <n00b> | yes |
| 23:35:02 | <byorgey> | more generally, 31 day/30 day months alternate, except for July/August which are both 31. |
| 23:35:09 | <omnId> | I see |
| 23:36:11 | <n00b> | m == 7 && m == 8 |
| 23:36:34 | <byorgey> | supposedly because it wouldn't do for Augustus Caesar's month to be shorter than Julius's! |
| 23:36:44 | <hpaste> | dataangel pasted "Compile error contradicts itself?" at http://hpaste.org/3220 |
| 23:37:00 | <n00b> | what about year |
| 23:37:09 | <omnId> | bah. They can have their months sept, oct, nov, and dec should be 7, 8, 9, and 10! |
| 23:37:31 | <omnId> | s/months sept/months. Sept/ |
| 23:38:15 | <hpaste> | n00b pasted "LeapYear" at http://hpaste.org/3221 |
| 23:38:19 | <byorgey> | dataangel: if it expected [[Int]], but it found [Int], that's the same as trying to match the elements of [[Int]] (which have type [Int]) against the elements of [Int] (i.e., Int) |
| 23:38:25 | <byorgey> | so it's really saying the same thing |
| 23:38:53 | <n00b> | ok |
| 23:38:56 | <omnId> | it sees two lists [a] where a = [Int] and Int, respectively |
| 23:39:07 | <dataangel> | byorgey: ah |
| 23:39:51 | <byorgey> | dataangel: in general, it tries to match types [a] and [b] by trying to match a and b. |
| 23:40:13 | <n00b> | yeah |
| 23:40:22 | <EvilTerran> | indeed, types Foo...a... and Foo...b... by a and b |
| 23:40:34 | <omnId> | even generallier, T a to T b with a = b (and in this case T = []) |
| 23:40:38 | <EvilTerran> | regardless of what type constructor Foo may be |
| 23:40:48 | <ivanm> | hey LoganCapaldo... you were looking for me? |
| 23:40:57 | <n00b> | so basically we are limiting the inputs |
| 23:41:10 | <omnId> | n00b: hm? |
| 23:41:35 | <LoganCapaldo> | ivanm: yes and thanks |
| 23:41:46 | <n00b> | m for certain months can's be greater than say 30 or feb 28 all the rest 31 |
| 23:41:51 | <byorgey> | omnId: nice word =) |
| 23:42:06 | <omnId> | byorgey: I was proud of it myself =D |
| 23:42:13 | <EvilTerran> | > map (enumFromTo 1) [3,4,5] |
| 23:42:15 | <lambdabot> | [[1,2,3],[1,2,3,4],[1,2,3,4,5]] |
| 23:42:39 | <EvilTerran> | ([a..b] = enumFromTo a b) |
| 23:42:43 | <n00b> | @google hpaste |
| 23:42:45 | <ivanm> | LoganCapaldo: no probs.... was googling for church encoding when I found that article |
| 23:42:46 | <lambdabot> | http://hpaste.org/ |
| 23:42:46 | <lambdabot> | Title: recent - hpaste |
| 23:42:59 | <EvilTerran> | @hpaste <- this works too |
| 23:43:00 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 23:43:05 | <omnId> | hpaste: url |
| 23:43:06 | <hpaste> | Haskell paste bin: http://hpaste.org/ |
| 23:43:13 | <omnId> | @wehre paste |
| 23:43:13 | <lambdabot> | http://hpaste.org/new |
| 23:43:32 | <EvilTerran> | hpaste: botsnack |
| 23:43:38 | <EvilTerran> | hm |
| 23:43:41 | <EvilTerran> | @botsnack |
| 23:43:41 | <lambdabot> | :) |
| 23:43:47 | <omnId> | hpaste /= \bot |
| 23:44:00 | <EvilTerran> | so i see. thought it might reply to that anyway. |
| 23:44:35 | <n00b> | <omnId> are you gonna finsih explaining |
| 23:44:37 | <n00b> | ??? |
| 23:45:03 | <_achilles_> | question |
| 23:45:17 | <omnId> | n00b: which part? daysForMonthAndYear? |
| 23:46:08 | <jaj> | http://www.weirdasianews.com/2006/10/13/world-record-in-japan-largest-orgy/ |
| 23:46:11 | <lambdabot> | Title: World Record in Japan: Largest Orgy | Weird Asia News, http://tinyurl.com/yee9w2 |
| 23:46:28 | <omnId> | n00b: oh, I didn't see the new paste. /me looks |
| 23:46:33 | <mauke> | jaj: old news is old |
| 23:46:46 | <omnId> | _achilles_: fire away, silly |
| 23:46:47 | <EvilTerran> | also, offtopic is #haskell-blah |
| 23:46:52 | <_achilles_> | does there exist a function which turns strings into an array of one char strings? |
| 23:47:04 | <jaj> | mauke, I didn't say it was new |
| 23:47:06 | <_achilles_> | "abc" -> ["a", "b", "c"] |
| 23:47:07 | <koala_man> | is it an orgy when the people are paired up and don't shuffle? |
| 23:47:07 | <mauke> | _achilles_: map (: []) |
| 23:47:22 | <omnId> | > map (\x -> [x]) "abc" |
| 23:47:23 | <jaj> | mauke, but it's new to me :) |
| 23:47:24 | <lambdabot> | ["a","b","c"] |
| 23:47:32 | <_achilles_> | hmm |
| 23:47:34 | <EvilTerran> | > map return "foo" :: [[Char]] |
| 23:47:35 | <lambdabot> | ["f","o","o"] |
| 23:47:52 | <omnId> | (\x -> [x]) = (\x -> x : []) = (\x -> (: []) x) = (: []) |
| 23:48:02 | <_achilles_> | wow... |
| 23:48:05 | <EvilTerran> | @pl (\x -> [x] |
| 23:48:05 | <lambdabot> | (line 1, column 11): |
| 23:48:05 | <lambdabot> | unexpected end of input |
| 23:48:05 | <lambdabot> | expecting variable, "(", operator or ")" |
| 23:48:08 | <EvilTerran> | @pl \x -> [x] |
| 23:48:08 | <lambdabot> | return |
| 23:48:11 | <EvilTerran> | also |
| 23:48:53 | <omnId> | n00b: isLeapYear looks correct. |
| 23:48:58 | <EvilTerran> | @src [] return |
| 23:48:58 | <lambdabot> | return x = [x] |
| 23:49:11 | <omnId> | n00b: except I think you should indent the guards |
| 23:49:54 | <omnId> | n00b: if the parser sees something at the level of a declaration, it starts a new declaration. |
| 23:51:02 | <yitz> | @type takeWhile (not.null) . evalState (sequence $ repeat $ State $ splitAt 1) |
| 23:51:04 | <lambdabot> | forall a. [a] -> [[a]] |
| 23:51:23 | <omnId> | @slap yitz |
| 23:51:23 | <lambdabot> | why on earth would I slap yitz |
| 23:51:29 | <omnId> | because he's silly! |
| 23:51:32 | <yitz> | > takeWhile (not.null) . evalState (sequence $ repeat $ State $ splitAt 1) $ [1,2,3,4] |
| 23:51:34 | <lambdabot> | [[1],[2],[3],[4]] |
| 23:51:46 | <hpaste> | (anonymous) pasted "(no title)" at http://hpaste.org/3222 |
| 23:51:56 | <dons> | shapr: :) http://arcanux.org/lambdacats/lift-concat.jpg |
| 23:52:05 | <yitz> | thanks, that felt good. |
| 23:53:51 | <omnId> | what in the world is that, (anonymous)? |
| 23:53:54 | <EvilTerran> | > map (take 1) . init . tails $ [1..10] |
| 23:53:56 | <lambdabot> | [[1],[2],[3],[4],[5],[6],[7],[8],[9],[10]] |
| 23:55:29 | <hpaste> | noob pasted "lengths" at http://hpaste.org/3223 |
| 23:55:35 | <shapr> | dons: :-) |
| 23:55:44 | <n00b> | <omnId> check that out |
| 23:56:17 | <omnId> | n00b: awesome, but you might want to indent some parts |
| 23:56:23 | <dons> | shapr: we've a culture all our own now. |
| 23:56:25 | <hpaste> | Paczesiowa pasted "(no title)" at http://hpaste.org/3224 |
| 23:56:27 | <shapr> | heh, yes! |
| 23:56:42 | <Paczesiowa> | can anyone fix that? |
| 23:56:55 | <n00b> | ok |
| 23:56:57 | <omnId> | n00b: now daysForMonthAndYear m y = mLengths y !! m |
| 23:57:05 | <EvilTerran> | Paczesiowa, er, you know you've misspelt "Expressible"? |
| 23:57:30 | <omnId> | n00b: er, s/m/(m - 1)/ since (!!) is 0-based |
| 23:57:33 | <Paczesiowa> | yeah, now I know. thx |
| 23:57:45 | <omnId> | n00b: daysForMonthAndYear m y = mLengths y !! (m - 1) |
| 23:57:53 | <hpaste> | noob annotated "lengths" with "lengths" at http://hpaste.org/3223#a1 |
| 23:58:13 | <EvilTerran> | i wouldn't expect you to need that many explicit foralls; that seems to be what's causing the problem |
| 23:58:31 | <Paczesiowa> | should get some sleep, 6 hours took me writing 2 lines of code. and they are ugly and dont work |
| 23:58:31 | <EvilTerran> | {-Couldn't match expected type `Maybe (Expr a b)' <- here, a & b are fixed elsewhere |
| 23:58:50 | <EvilTerran> | against inferred type `forall a1 b1. (Expresable a1, Expresable b1) => Maybe (Expr a1 b1)' <- here, they aren't |
| 23:59:05 | <EvilTerran> | so the types are different; the first is a subset (or element) of the second |
| 23:59:53 | <EvilTerran> | but it can't just make the second type more specific, because you've told it that it's got to be that general |
Back to channel and daily index: content-negotiated html turtle