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:29 | <bjrn> | What's the largest open source Haskell project, in lines of code? |
| 00:00:40 | <sbahra> | ghc? |
| 00:00:41 | <dons> | ghc |
| 00:00:47 | <sbahra> | ghc. |
| 00:00:47 | <bjrn> | Ah, except ghc :) |
| 00:00:48 | <dons> | also the oldest. |
| 00:01:00 | <dons> | hmm. one of the other compilers. |
| 00:01:09 | <dons> | or theorem provers. |
| 00:01:13 | <dons> | in the ~100k range. |
| 00:01:24 | <ddarius> | dons: Do we have code metrics on GHC? |
| 00:01:24 | <dons> | there's ~1.5M loc on hackage.haskell.org |
| 00:01:31 | <dons> | spread over 800 projects, fwiw. |
| 00:01:32 | <ddarius> | Like that silly ohloh thing? |
| 00:01:34 | <Pseudonym> | The oldest Haskell program still in use. THat's a tough one. |
| 00:01:53 | <Pseudonym> | Probably one of the nofib programs. |
| 00:02:00 | <BMeph> | dcoutts: ping |
| 00:02:19 | <dons> | Pseudonym: yeah, there's some ~1990 era programs in ther. |
| 00:02:24 | <dons> | one from wadler, and some others. |
| 00:02:40 | <Pseudonym> | Yes. |
| 00:02:50 | <Pseudonym> | For some definition of "used", anyway. |
| 00:03:02 | <dons> | ACTION can't wait for full metrics for hackge. |
| 00:03:08 | <dons> | there's *so* much code there. |
| 00:03:16 | <dons> | we got several hundred new modules today, thanks to henning. |
| 00:03:25 | <dons> | if people didn't notice, haskore+supercollider+realtime music |
| 00:04:07 | <ivanm> | dons: what kind of metrics are you after? |
| 00:04:13 | <dcoutts> | BMeph: pong |
| 00:04:23 | <jikim> | BMeph: Mostly I learnt from #algorithms. |
| 00:04:35 | <BMeph> | dcoutts: I just noticed - the c-i bootstrap script works for me, but 'cabal update' still doesn't go through. Should I add that info to the Trac? |
| 00:04:59 | <dcoutts> | BMeph: this is the issue with paths and config files right? |
| 00:05:07 | <BMeph> | jikim: Ah. Okay, that sounds ... complex. Thanks. :) |
| 00:06:06 | <BMeph> | dcoutts: Well, as far as I care, it's about figuring out why I can't get cabal-install to install anything anymore. :\ |
| 00:06:50 | <BMeph> | dcoutts: At work, that is; it's fine at home. Of course, I'm the network admin at home, heh-heh. ;) |
| 00:07:16 | <dcoutts> | BMeph: so I suspect it's just the old style config files going wrong |
| 00:07:46 | <dcoutts> | BMeph: as a workaround you could backup your ~/.cabal/config and then rm it, let it be re-created and edit the paths |
| 00:08:41 | <BMeph> | dcoutts: ...sounds interesting. I'll give it a go. :) |
| 00:08:44 | <ivanm> | dcoutts: that reminds me, I saw that cabal-install has a boostrap script... would that work as well if I download the sources locally (for when I install it at uni, where I have no CLI net access :@ ) |
| 00:09:00 | <m3lawren> | q |
| 00:09:14 | <dcoutts> | ivanm: no, the bootstrap script needs wget or curl |
| 00:09:25 | <ivanm> | *nod* |
| 00:09:33 | <ivanm> | in that case I'd be better of doing it manually? |
| 00:09:45 | <SamB_XP> | how do you have no cli net access? |
| 00:10:19 | <ivanm> | because to get net access, I have to log in to the proxy via the web browser |
| 00:10:37 | <ivanm> | and it uses some autoproxy thing that I've never managed to work out to get going at the command line |
| 00:10:57 | <SamB_XP> | ivanm: I would recommend transferring |
| 00:10:58 | <ivanm> | and when I asked tech support, they at first had no idea what I was talking about and then didn't see why I'd want it |
| 00:11:39 | <ivanm> | SamB_XP: what, transferring unis? |
| 00:11:44 | <SamB_XP> | YES |
| 00:11:46 | <ivanm> | that's a bit... harsh, isn't it? |
| 00:11:49 | <SamB_XP> | NO! |
| 00:11:56 | <ivanm> | especially when I've only got a couple of months to go... |
| 00:12:13 | <ozy`> | ivanm: clearly, the only reason to be there is to be working on haskell... |
| 00:12:16 | <SamB_XP> | well, okay ... |
| 00:12:21 | <bjrn> | Pseudonym: Thanks for linking to the SPJ interview, it's nice :) |
| 00:12:28 | <ivanm> | ozy`: nope, I do haskell on my own.. |
| 00:12:39 | <ivanm> | (I _do_ have cli access in the labs controlled by the maths sysadmins, but not in those controlled centrally) |
| 00:12:44 | <SamB_XP> | I guess if you're in your last semester, you can stick it out the rest of the time most easily ... |
| 00:12:50 | <SamB_XP> | oh |
| 00:12:59 | <ozy`> | ivanm: :p |
| 00:13:01 | <SamB_XP> | why don't you just play in the maths labs then ??? |
| 00:13:09 | <ozy`> | can you take your computer into the labs? |
| 00:13:21 | <SamB_XP> | ACTION thought ivanm was saying that this was a university-network-wide thing |
| 00:13:22 | <ivanm> | ozy`: yes, I normally use my laptop |
| 00:13:51 | <SamB_XP> | if it's just in the mis-managed computer labs, yeah, don't transfer over that ;-) |
| 00:13:51 | <ivanm> | but we'll be having a practical exam there, and I need to use the computers there rather than my own laptop |
| 00:14:04 | <ivanm> | SamB_XP: just the generic computers used by us undergrads :p |
| 00:14:07 | <SamB_XP> | instead, install an alternative OS |
| 00:14:12 | <SamB_XP> | ;-P |
| 00:14:19 | <SamB_XP> | or, er, I mean, boot one |
| 00:14:25 | <ivanm> | SamB_XP: it already _is_ using linux in the labs I'm talking about :p |
| 00:14:40 | <ddarius> | ivanm: Maybe he meant install Windows |
| 00:14:58 | <ivanm> | pfffftttt..... |
| 00:15:15 | <ivanm> | one of the only advantages of these labs is that it runs *nix |
| 00:15:28 | <ivanm> | of course, it would help if they actually updated the software and made sure it all worked properly :@ |
| 00:15:31 | <eyu100> | @hoogle foldr |
| 00:15:31 | <lambdabot> | Prelude foldr :: (a -> b -> b) -> b -> [a] -> b |
| 00:15:32 | <lambdabot> | Data.ByteString foldr :: (Word8 -> a -> a) -> a -> ByteString -> a |
| 00:15:32 | <lambdabot> | Data.Foldable foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b |
| 00:15:36 | <eyu100> | @hoogle foldl |
| 00:15:36 | <lambdabot> | Prelude foldl :: (a -> b -> a) -> a -> [b] -> a |
| 00:15:36 | <lambdabot> | Data.ByteString foldl :: (a -> Word8 -> a) -> a -> ByteString -> a |
| 00:15:36 | <lambdabot> | Data.Foldable foldl :: Foldable t => (a -> b -> a) -> a -> t b -> a |
| 00:16:05 | <eyu100> | foldl add 3 [5, 4] |
| 00:16:10 | <eyu100> | > foldl add 3 [5, 4] |
| 00:16:10 | <ivanm> | ACTION got the lecturer to ask them to install ghc there... after they eventually installed it it complained about libreadline... so I just installed it in my home directory and it works \o/ |
| 00:16:11 | <lambdabot> | Not in scope: `add' |
| 00:16:16 | <eyu100> | > foldl (+) 3 [5, 4] |
| 00:16:17 | <lambdabot> | 12 |
| 00:16:28 | <eyu100> | > foldl (+) 3 [5, 4, 3] |
| 00:16:29 | <lambdabot> | 15 |
| 00:16:39 | <eyu100> | > foldr (+) 3 [5, 4, 3] |
| 00:16:40 | <lambdabot> | 15 |
| 00:16:49 | <eyu100> | > foldr (-) 3 [5, 4, 3] |
| 00:16:50 | <lambdabot> | 1 |
| 00:17:23 | <Saizan> | > foldr f z [a,b,c] :: Expr |
| 00:17:24 | <lambdabot> | f a (f b (f c z)) |
| 00:17:29 | <Saizan> | > foldl f z [a,b,c] :: Expr |
| 00:17:31 | <lambdabot> | f (f (f z a) b) c |
| 00:18:10 | <mauke> | > foldr f z [a,b,c] |
| 00:18:11 | <lambdabot> | f a (f b (f c z)) |
| 00:18:51 | <mauke> | > foldl (+) 3 [5, 4, 3] :: Expr |
| 00:18:53 | <lambdabot> | 3 + 5 + 4 + 3 |
| 00:19:36 | <ushdf> | > foldl (*) 1 [1..100] |
| 00:19:37 | <lambdabot> | 933262154439441526816992388562667004907159682643816214685929638952175999932... |
| 00:19:41 | <ushdf> | > foldl (*) 1 [1..10] |
| 00:19:42 | <lambdabot> | 3628800 |
| 00:19:49 | <mauke> | > foldl (*) 1 [1..10] :: Expr |
| 00:19:50 | <lambdabot> | 1 * 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 |
| 00:20:14 | <ushdf> | what do you normally use :: Expr to do |
| 00:20:19 | <ushdf> | in real coding situations |
| 00:20:19 | <eyu100> | > foldl1 (*) [1, 2, 3] |
| 00:20:21 | <lambdabot> | 6 |
| 00:20:39 | <shrughes> | you don't |
| 00:20:42 | <mauke> | > product [1 .. 100] |
| 00:20:43 | <ushdf> | thank god |
| 00:20:44 | <lambdabot> | 933262154439441526816992388562667004907159682643816214685929638952175999932... |
| 00:20:46 | <ddarius> | ushdf: It's a "hack" primarily for this purpose. |
| 00:20:48 | <eyu100> | fold1 (-) [6, 5, 4] |
| 00:20:54 | <Saizan> | ushdf: you don't, it's mostly an hack for teaching |
| 00:20:57 | <eyu100> | > foldl1 (-) [6, 5, 4] |
| 00:20:59 | <lambdabot> | -3 |
| 00:21:07 | <eyu100> | > foldr1 (-) [6, 5, 4] |
| 00:21:08 | <lambdabot> | 5 |
| 00:21:11 | <ddarius> | However, there are symbolic algebra libraries that work essentially the same way. |
| 00:21:15 | <mauke> | e.g. if you want to know what that did |
| 00:21:23 | <ushdf> | i get what it does |
| 00:21:24 | <mauke> | > foldl1 (-) [6, 5, 4] :: Expr |
| 00:21:25 | <lambdabot> | 6 - 5 - 4 |
| 00:21:30 | <mauke> | > foldr1 (-) [6, 5, 4] :: Expr |
| 00:21:31 | <lambdabot> | 6 - (5 - 4) |
| 00:21:33 | <eyu100> | > foldr1 (-) [6, 5, 4] :: Expr |
| 00:21:34 | <lambdabot> | 6 - (5 - 4) |
| 00:21:46 | <mauke> | you can see how it's grouped |
| 00:21:46 | <eyu100> | > foldr1 (-) [1..100] :: Expr |
| 00:21:47 | <lambdabot> | 1 - (2 - (3 - (4 - (5 - (6 - (7 - (8 - (9 - (10 - (11 - (12 - (13 - (14 - (... |
| 00:21:51 | <ushdf> | that is useful |
| 00:21:54 | <eyu100> | > foldr1 (-) [1..100] |
| 00:21:55 | <lambdabot> | -50 |
| 00:21:59 | <eyu100> | > foldr1 (-) [1..102] |
| 00:22:01 | <lambdabot> | -51 |
| 00:22:05 | <eyu100> | > foldr1 (-) [1..101] |
| 00:22:07 | <lambdabot> | 51 |
| 00:22:09 | <ushdf> | folding is the strangest thing i've seen in this language |
| 00:22:11 | <eyu100> | interesting |
| 00:22:22 | <mmorrow> | @src reverse |
| 00:22:23 | <lambdabot> | reverse = foldl (flip (:)) [] |
| 00:22:25 | <shrughes> | folding is a very normal thing |
| 00:22:38 | <ushdf> | i know but i've never seen it |
| 00:22:40 | <shrughes> | You do it all the time in other languages |
| 00:22:41 | <ushdf> | expressed anything like that |
| 00:22:42 | <eyu100> | @hoogle reverse |
| 00:22:42 | <lambdabot> | Prelude reverse :: [a] -> [a] |
| 00:22:42 | <lambdabot> | Data.ByteString reverse :: ByteString -> ByteString |
| 00:22:42 | <lambdabot> | Data.List reverse :: [a] -> [a] |
| 00:22:44 | <mmorrow> | @src concat |
| 00:22:45 | <lambdabot> | concat = foldr (++) [] |
| 00:22:47 | <ddarius> | It just captures a simple recursion patterns. Left folds, in particular, are absolutely rampant in imperative code. |
| 00:22:53 | <mml`> | i am surprised flip is not a primitive in some other functional languages, e.g. scheme |
| 00:22:59 | <eyu100> | > reverse "yobananaboy" |
| 00:23:00 | <lambdabot> | "yobananaboy" |
| 00:23:04 | <ivanm> | ddarius: which symbolic algebra libraries? |
| 00:23:12 | <ddarius> | It's not a primitive in Haskell. |
| 00:23:14 | <eyu100> | > reverse "YO BANANA BOY" |
| 00:23:15 | <lambdabot> | "YOB ANANAB OY" |
| 00:23:27 | <eyu100> | > reverse reverse "YO BANANA BOY" |
| 00:23:28 | <lambdabot> | Couldn't match expected type `[a]' |
| 00:23:32 | <ivanm> | I ended up just installing and using maxima the last time I needed to do symbolic calculations... |
| 00:23:33 | <eyu100> | > reverse (reverse "YO BANANA BOY") |
| 00:23:34 | <lambdabot> | "YO BANANA BOY" |
| 00:23:38 | <mml`> | ddarius: granted, no. i guess i should have said standard library. |
| 00:24:03 | <ushdf> | > reverse "i met a guy and he spoke in the strangest language, he said to me 'em ot dias eh egaugnal tsegnarts eht ni ekops eh dna yug a tem i'" |
| 00:24:04 | <lambdabot> | "'i met a guy and he spoke in the strangest language he said to me' em ot d... |
| 00:24:10 | <ushdf> | fuck you lambdabot |
| 00:24:32 | <BMeph> | dcoutts: Meh, no dice. It just rewrites the same file, and bombs out some more. :| |
| 00:24:59 | <eyu100> | > reverse "he said (lol) : (lol) dias eh" |
| 00:25:00 | <lambdabot> | "he said )lol( : )lol( dias eh" |
| 00:25:04 | <mauke> | > reverse "IN GIRVM IMVS NOCTE ET CONSVMIMVR IGNI" |
| 00:25:05 | <lambdabot> | "INGI RVMIMVSNOC TE ETCON SVMI MVRIG NI" |
| 00:25:18 | <ushdf> | >:O |
| 00:25:19 | <eyu100> | > reverse "he said (lol) ' (lol) dias eh" |
| 00:25:20 | <lambdabot> | "he said )lol( ' )lol( dias eh" |
| 00:25:27 | <eyu100> | > reverse "he said lol ' lol dias eh" |
| 00:25:29 | <lambdabot> | "he said lol ' lol dias eh" |
| 00:25:34 | <mauke> | "ǝɯoɹpuılɐd" ǝsɹǝʌǝɹ < |
| 00:25:42 | <Pseudonym> | > reverse "SATOR AREPO TENET OPERA ROTAS" |
| 00:25:43 | <lambdabot> | "SATOR AREPO TENET OPERA ROTAS" |
| 00:25:47 | <ushdf> | semper ubi, sub ubi |
| 00:25:56 | <mauke> | always where under where |
| 00:26:02 | <ushdf> | :D |
| 00:26:30 | <mauke> | > transpose . words $ "SATOR AREPO TENET OPERA ROTAS" |
| 00:26:31 | <lambdabot> | ["SATOR","AREPO","TENET","OPERA","ROTAS"] |
| 00:26:48 | <ushdf> | hmph |
| 00:26:56 | <ushdf> | what's the equivalent to an explode function |
| 00:27:04 | <mauke> | id |
| 00:27:17 | <eyu100> | @hoogle id |
| 00:27:17 | <lambdabot> | Prelude id :: a -> a |
| 00:27:17 | <lambdabot> | Data.Function id :: a -> a |
| 00:27:17 | <lambdabot> | Text.Read Ident :: String -> Lexeme |
| 00:27:19 | <eyu100> | @src id |
| 00:27:19 | <lambdabot> | id x = x |
| 00:27:27 | <BMeph> | unsafePerformIO(sendLaunchCodes)? ;p |
| 00:27:37 | <stepcut> | ?tick ^skf |
| 00:27:38 | <lambdabot> | ^SKF: 0.00 @ N/A N/A |
| 00:27:44 | <eyu100> | > id x |
| 00:27:52 | <lambdabot> | x |
| 00:27:57 | <eyu100> | > id 5 |
| 00:27:58 | <lambdabot> | 5 |
| 00:28:01 | <ddarius> | ivanm: I'm not sure what, if any, symbolic attributes DoCon has, but there doesn't seem to be any handy library on hackage. Googling turns up some things. |
| 00:28:01 | <ushdf> | that seems profoundly useless |
| 00:28:15 | <mauke> | :t flip id |
| 00:28:16 | <lambdabot> | forall b c. b -> (b -> c) -> c |
| 00:28:22 | <eyu100> | [(Float, Float, Float)] |
| 00:28:25 | <Pseudonym> | ushdf: Its main use is for plugging in higher-order functions. |
| 00:28:25 | <eyu100> | > [(Float, Float, Float)] |
| 00:28:26 | <lambdabot> | Not in scope: data constructor `Float'Not in scope: data constructor `Float... |
| 00:28:32 | <Pseudonym> | Where you want "nothing" done. |
| 00:28:36 | <ushdf> | an example? |
| 00:28:44 | <mauke> | :t foldr id (.) |
| 00:28:45 | <lambdabot> | forall b c a. [((b -> c) -> (a -> b) -> a -> c) -> (b -> c) -> (a -> b) -> a -> c] -> (b -> c) -> (a -> b) -> a -> c |
| 00:28:50 | <ushdf> | you mean monadic functions? |
| 00:28:56 | <Pseudonym> | > foldr (.) id |
| 00:28:57 | <lambdabot> | Overlapping instances for Show ([a -> a] -> a -> a) |
| 00:28:57 | <lambdabot> | arising from... |
| 00:28:59 | <Pseudonym> | That. |
| 00:29:06 | <BMeph> | @src join |
| 00:29:06 | <mauke> | :t foldr (.) id |
| 00:29:06 | <lambdabot> | join x = x >>= id |
| 00:29:07 | <lambdabot> | forall a. [a -> a] -> a -> a |
| 00:29:08 | <ushdf> | ACTION can't read those yet |
| 00:29:10 | <Pseudonym> | > foldr (.) id [(+1),(*2)] 5 |
| 00:29:11 | <lambdabot> | 11 |
| 00:29:22 | <ivanm> | ddarius: yeah, I saw DoCon, but couldn't work out how it was meant to be used :s |
| 00:29:28 | <ddarius> | You can always tell a functional programmer from a non-functional programmer because non-functional programmers don't understand the point of the id function. |
| 00:29:35 | <Saizan> | > zipWith id [(+1),(*2)] [5,3] |
| 00:29:36 | <lambdabot> | [6,6] |
| 00:29:40 | <BMeph> | ushdf: ^^ Like that, ushd. ;) |
| 00:29:41 | <ushdf> | ACTION feels excluded |
| 00:29:44 | <Pseudonym> | It's like asking what's the point of "void" in C-like languages. |
| 00:29:50 | <Pseudonym> | Why would you want no value? |
| 00:29:58 | <ushdf> | i know what the point of void is |
| 00:30:02 | <mauke> | what's the point of having the number 0? |
| 00:30:06 | <mauke> | it doesn't do anything |
| 00:30:13 | <Pseudonym> | id is the identity for (.) |
| 00:30:19 | <ivanm> | Pseudonym: well, why would you? :p |
| 00:30:22 | <mauke> | id is the identity. |
| 00:30:31 | <ivanm> | unless your name is Freud |
| 00:30:33 | <ivanm> | ;-) |
| 00:30:37 | <ushdf> | ACTION groans |
| 00:30:40 | <Pseudonym> | And in Haskell, where everything is algebraic, if you have an operator with an identity, you give the identity. |
| 00:30:48 | <Pseudonym> | To make the algebra complete. |
| 00:30:52 | <Pseudonym> | id . f = f . id = f |
| 00:31:07 | <ushdf> | i'm used to "." as "concatenate" |
| 00:31:09 | <ushdf> | what's it mean in haskell ;) |
| 00:31:16 | <Pseudonym> | It's function composition. |
| 00:31:19 | <ushdf> | also "end of sentence" |
| 00:31:24 | <Pseudonym> | f . g = \x -> f (g x) |
| 00:31:30 | <eyu100> | > product [2, 3] |
| 00:31:32 | <lambdabot> | 6 |
| 00:31:34 | <ushdf> | ohh ok |
| 00:31:35 | <eyu100> | > sum. product [2, 3] |
| 00:31:36 | <lambdabot> | Overlapping instances for Show (a1 -> a) |
| 00:31:36 | <lambdabot> | arising from a use of `... |
| 00:31:39 | <eyu100> | > sum . product [2, 3] |
| 00:31:40 | <lambdabot> | Overlapping instances for Show (a1 -> a) |
| 00:31:40 | <lambdabot> | arising from a use of `... |
| 00:31:43 | <mauke> | f∘g |
| 00:31:48 | <Pseudonym> | RIght. |
| 00:31:49 | <ushdf> | wait just to be clear you mean |
| 00:31:54 | <ushdf> | f . g = \x -> f(g(x)) |
| 00:31:55 | <ushdf> | ? |
| 00:31:58 | <eyu100> | > (sum . product) [2, 3] |
| 00:31:59 | <lambdabot> | No instance for (Num [a]) |
| 00:31:59 | <lambdabot> | arising from a use of `product' at <in... |
| 00:32:05 | <mauke> | (x) better written as x |
| 00:32:08 | <Pseudonym> | Yes, but in Haskell, that's less clear. |
| 00:32:08 | <dibblego> | yes, some of those parentheses are redundant |
| 00:32:27 | <Pseudonym> | But that's more traditional mathematical notation, yes. |
| 00:32:34 | <ushdf> | i like this language more every time i learn something about it |
| 00:32:40 | <ddarius> | Yeah, void is probably another way to test it swapping sides. |
| 00:32:47 | <ushdf> | how's it benchmark, usually? |
| 00:32:53 | <mauke> | huhu |
| 00:32:55 | <eyu100> | > (+).(*) 2 3 |
| 00:32:56 | <lambdabot> | Overlapping instances for Show (a -> b -> b) |
| 00:32:56 | <lambdabot> | arising from a use ... |
| 00:32:57 | <mauke> | threadring! |
| 00:33:02 | <eyu100> | > (+) . (*) 2 3 |
| 00:33:03 | <lambdabot> | Overlapping instances for Show (a -> b -> b) |
| 00:33:03 | <lambdabot> | arising from a use ... |
| 00:33:26 | <Pseudonym> | eyu100: You multiply 2 by 3. Then what does (+) do? |
| 00:33:31 | <mauke> | http://shootout.alioth.debian.org/debian/benchmark.php?test=threadring&lang=all |
| 00:33:33 | <lambdabot> | Title: thread-ring benchmark | Debian : AMD™ Sempron™ Computer Language Benchmarks ..., http://tinyurl.com/5nmnqh |
| 00:33:51 | <Pseudonym> | Note that your syntax is also a bit off, but please try to think logically about what you're trying to express. |
| 00:33:57 | <eyu100> | > (+) . (*) 2 3 4 |
| 00:33:58 | <lambdabot> | Overlapping instances for Show (a -> b -> b) |
| 00:33:58 | <lambdabot> | arising from a use ... |
| 00:34:00 | <Pseudonym> | > (+1) . (*2) $ 3 |
| 00:34:01 | <lambdabot> | 7 |
| 00:34:10 | <ivanm> | Pseudonym: logic? what's that? :p |
| 00:34:13 | <Pseudonym> | :-) |
| 00:34:19 | <Pseudonym> | The ($) is low-precende function application. |
| 00:34:22 | <Pseudonym> | You could also write this: |
| 00:34:27 | <Pseudonym> | > ((+1) . (*2)) 3 |
| 00:34:29 | <lambdabot> | 7 |
| 00:34:31 | <Pseudonym> | Or: |
| 00:34:37 | <Pseudonym> | > let f = (+1) . (*2) in f 3 |
| 00:34:38 | <lambdabot> | 7 |
| 00:34:44 | <ushdf> | > ((+1) . (*2)) 3 :: Expr |
| 00:34:45 | <lispy> | hey, Pseudonym |
| 00:34:46 | <lambdabot> | 3 * 2 + 1 |
| 00:34:55 | <Pseudonym> | Hey hey! |
| 00:35:14 | <ushdf> | ACTION is in love!!!!!! |
| 00:35:20 | <Pseudonym> | Group hug! |
| 00:35:21 | <ushdf> | :O |
| 00:35:32 | <lispy> | ushdf: but Pseudonym is already married, so don't get your hopes up |
| 00:35:32 | <ushdf> | > human intimacy |
| 00:35:33 | <lambdabot> | Not in scope: `human'Not in scope: `intimacy' |
| 00:35:48 | <ushdf> | i knew you wouldn't understand |
| 00:35:50 | <ddarius> | What are the polygamy laws like down under? |
| 00:36:08 | <Pseudonym> | ddarius: Lacking. |
| 00:36:18 | <ushdf> | that's the best kind of law |
| 00:49:59 | <ushdf> | ACTION throws up on lambdabot |
| 00:50:54 | <dolio> | @vixen You want a hug? |
| 00:50:54 | <lambdabot> | i think you know the answer to that one, silly |
| 00:51:17 | <dolio> | @vixen Clean yourself off. |
| 00:51:17 | <lambdabot> | ouch! I just spilt hot coffee on myself! |
| 01:12:47 | <lispy> | ?vixen You doing anything later? |
| 01:12:47 | <lambdabot> | i'll hafta plead the fifth on that one. |
| 01:13:17 | <lispy> | ?vixen I have some codata I was hoping you could take a thunk at. |
| 01:13:18 | <lambdabot> | you remind me of that actor, whatshisname |
| 01:13:58 | <dmwit> | Ronald Reagan? |
| 01:27:43 | <robcrusemefrac> | http://gpirate.com |
| 01:27:44 | <lambdabot> | Title: Gpirate.com - The World's Biggest Torrent Search Engine |
| 01:27:53 | <robcrusemefrac> | http://gpirate.com |
| 01:27:54 | <lambdabot> | Title: Gpirate.com - The World's Biggest Torrent Search Engine |
| 01:31:36 | <ivanm> | yay, spammers :s |
| 01:34:19 | <adekoba> | does ghc have a --make-clean function, or something similar? |
| 01:34:23 | <adekoba> | probably not |
| 01:34:34 | <ddarius> | No |
| 01:35:24 | <Shimei2> | Does anyone know if the funtional graph library has the searching algorithms described in the user manual somewhere in its current iteration? I'm looking for the depth-first/breadth-first searches in particular. |
| 01:36:11 | <Saizan> | Shimei2: like in http://haskell.org/ghc/docs/latest/html/libraries/fgl/Data-Graph-Inductive-Query-DFS.html ? |
| 01:36:14 | <lambdabot> | Title: Data.Graph.Inductive.Query.DFS, http://tinyurl.com/4larya |
| 01:36:33 | <Shimei2> | Ah, thanks. I was looking for that. |
| 01:36:48 | <newsham> | yay http://shootout.alioth.debian.org/u64q/benchmark.php?test=regexdna&lang=all |
| 01:36:50 | <lambdabot> | Title: regex-dna benchmark | x64 Ubuntu : Intel® Q6600® quad-core Computer Language B ..., http://tinyurl.com/47qxv5 |
| 01:37:02 | <newsham> | 12.48sec 519bytes (gz) |
| 01:37:17 | <newsham> | 56% 64% 84% 59% |
| 01:41:37 | <dmwit> | You know what's crazy? |
| 01:42:17 | <lispy> | dmwit: what? |
| 01:42:18 | <Pseudonym> | Putting underwear on your head and saluting is normally seen as crazy. |
| 01:42:21 | <dmwit> | The first few times are not so different -- 9s up to 12s -- but they look hugely different at a glance because 8s has only one digit, while 11-12s have two digits. |
| 01:42:26 | <ivanm> | mrd: you around? |
| 01:43:03 | <dmwit> | (Actually, going from 12s to 9s is quite an achievement... but not the order of magnitude achievement it looks like at a glance.) |
| 01:46:36 | <mml`> | what are "interesting alternative programs"? |
| 01:46:59 | <ddarius> | dmwit: I'll sell you a watch for $99.99 |
| 01:47:10 | <mml`> | the perl program seems to spank everything else. how do i read that part of the chart? |
| 01:47:14 | <mrd> | ivanm: what's up |
| 01:47:37 | <dmwit> | mml`: What are you talking about? |
| 01:48:11 | <mml`> | http://tinyurl.com/47qxv5 |
| 01:48:13 | <lambdabot> | Title: regex-dna benchmark | x64 Ubuntu : Intel® Q6600® quad-core Computer Language B ... |
| 01:48:47 | <dmwit> | Oh, I didn't see the alternative programs section, sorry. Your comment makes total sense now. |
| 01:49:19 | <ivanm> | mrd: is this something of yours? http://209.85.173.104/search?q=cache:http%3A%2F%2Fpeople.cse.iitd.ernet.in%2F~cs5050211%2Femacs%2Fcabal-mode.el |
| 01:49:20 | <lambdabot> | http://tinyurl.com/4yep9k |
| 01:49:38 | <dmwit> | I think the deal there is that each benchmark has certain rules about how you can solve the problem. If you don't follow the rules, they stick you in a separate section. |
| 01:49:40 | <mrd> | i wrote a simple and stupid cabal.el |
| 01:50:09 | <ivanm> | simple and stupid? it at least generates the fields! :p |
| 01:50:23 | <ivanm> | whereas the one with haskell-mode doesn't |
| 01:50:40 | <ivanm> | I just can't seem to get it to work... or doesn't it actually have any font-locks or menu? |
| 01:50:59 | <mrd> | as i was saying :) it just has some keybinds to insert fields |
| 01:51:15 | <mml`> | dmwit: indeeed: http://shootout.alioth.debian.org/u64q/faq.php#alternative |
| 01:51:15 | <ivanm> | ahhhh |
| 01:51:16 | <lambdabot> | Title: Read the FAQ! | x64 Ubuntu : Intel® Q6600® quad-core Computer Language Benchma ... |
| 01:51:31 | <ivanm> | mrd: have you ever thought about sending that functionality upstream to haskell-mode? |
| 01:51:35 | <mrd> | actually it should highlight field names |
| 01:51:45 | <mrd> | i didn't even know haskell-mode had cabal support |
| 01:52:00 | <ivanm> | 2.4 does at least, but it's just font stuff |
| 01:52:05 | <ivanm> | yours doesn't seem to do that :s |
| 01:52:12 | <mrd> | ("^[^:]*:" 1 'font-lock-keyword-face) |
| 01:52:23 | <mrd> | oh |
| 01:52:26 | <mrd> | buggy |
| 01:52:35 | <mrd> | probably should have a \\( \\) group in there |
| 01:54:07 | <ivanm> | *nod* |
| 01:58:38 | <lispy> | oh how i love regular expressions....I was just debugging them earlier |
| 02:10:31 | <ddarius> | lispy: Decided to replace your sexpr parser with a pile of regex? |
| 02:11:20 | <lispy> | ddarius: no, but the lexer had a buggy regular expression |
| 02:38:54 | <hasenov_> | hello, we need to write some code in java for a project and i was wondering if i could use a haskell interface |
| 02:39:13 | <bd_> | If you're required to use Java, it's probably a bad idea to use haskell. |
| 02:39:23 | <hasenov_> | sort of like jython, i looked at jaskell but i'm not sure if its stable enough |
| 02:39:33 | <bd_> | That wouldn't be java then :) |
| 02:39:39 | <bd_> | It would be Haskell... on the java interpreter. |
| 02:39:51 | <bd_> | But if you're required to use Java, it's again probably a bad idea. |
| 02:40:32 | <hasenov_> | well, we definetly need to implement one part in java, which is to make numbers arbitrarily large (haskell already provides that feature so we can't use it) |
| 02:41:10 | <hasenov_> | so we thought we could import the java code in jaskell and use lazy evaluation and all that good stuff in there |
| 02:41:33 | <hasenov_> | im not sure if here is the right place to ask, but does jaskell support infinite lists like haskell? |
| 02:42:18 | <hasenov_> | and if there is some better interface, some ffi to java, that would also be good |
| 02:43:00 | <PHO_> | ACTION thinks about FFI to JNI API |
| 02:43:20 | <PHO_> | ACTION haven't tried that |
| 02:46:00 | <PHO_> | http://java.sun.com/docs/books/jni/html/invoke.html#11202 |
| 02:46:12 | <PHO_> | ah, it doesn't look so easy |
| 02:47:18 | <adu> | PHO_: hmmm |
| 02:47:35 | <adu> | ACTION thinks about FFI to Python API |
| 02:48:22 | <dolio> | jaskell seemed pretty crazy, last I looked. |
| 02:48:59 | <adu> | dolio: is there a pyskell? |
| 02:49:13 | <dolio> | Haven't looked for that. |
| 02:49:27 | <dolio> | Google says no. |
| 02:49:30 | <adu> | 2way would be nice |
| 02:49:32 | <PHO_> | hasenov_: why don't you implement the Java part and Haskell part separetely and make them communicate with some kind of RPC? |
| 02:49:55 | <PHO_> | oops, separately. sorry |
| 02:51:23 | <hasenov_> | PHO_: i remember reading somewhere where you can call python code from haskell using ffi |
| 02:51:28 | <adu> | I think the most likely use case I can see for Python<->Haskell API would be to do OOP in Python, then implement the innermost algorithms in pure fast Haskell :) |
| 02:52:12 | <lispy> | I'd rather do the OOP in Haskell though, personally. It seems to have a richer object system :) |
| 02:52:23 | <hasenov_> | PHO_: oops sorry, i guess we could do something like that but that introduces problems like blocking and threads |
| 02:52:28 | <lispy> | See the OOHaskell paper if you have any doubts :) |
| 02:52:41 | <dcoutts> | @yarr! |
| 02:52:41 | <lambdabot> | Where d' all t' pirates come from? |
| 02:52:41 | <lambdabot> | Great Yarrmouth! |
| 02:52:51 | <adu> | lispy: right, but it takes popular ideas and cuts them in half, and takes other ideas and glues them together |
| 02:53:13 | <adu> | lispy: it certainly makes it hard to switch between the two realms of design |
| 02:53:19 | <hasenov_> | am i correct in assuming that that the Int type can be infinitely large? |
| 02:53:30 | <adu> | hasenov_: no, thats Integer |
| 02:53:31 | <dolio> | No. That's Integer. |
| 02:53:45 | <dolio> | Int is machine-sized, more or less. |
| 02:54:07 | <PHO_> | Int is at least (or at most) 30 bits long IIRC |
| 02:54:14 | <hasenov_> | oh ok, so with Integer, it doesnt have an overflow limit like in java? |
| 02:54:40 | <adu> | hasenov_: the limit is how big your memory is |
| 02:54:51 | <humasect> | ac: hello |
| 02:54:57 | <dolio> | I think the actual guarantee in the report is below 30 bits. |
| 02:56:47 | <dolio> | Oh, I guess it is guaranteed to be 30. |
| 02:57:04 | <dolio> | I stand corrected. |
| 02:57:20 | <dolio> | > 2^30 |
| 02:57:20 | <lambdabot> | 1073741824 |
| 02:58:30 | <dons> | newsham: regex-dna roxors, http://shootout.alioth.debian.org/u64q/benchmark.php?test=regexdna&lang=all |
| 02:58:37 | <lambdabot> | Title: regex-dna benchmark | x64 Ubuntu : Intel® Q6600® quad-core Computer Language B ..., http://tinyurl.com/47qxv5 |
| 02:59:37 | <PHO_> | Faster than g++!! |
| 03:02:03 | <ushdf> | ACTION dispute resolution |
| 03:02:55 | <dons> | PHO_: :-) parallel regex search. |
| 03:03:08 | <dons> | faster than perl, using the perl regex matcher. |
| 03:03:13 | <dolio> | That ATS code is awful. :) |
| 03:03:28 | <dons> | 3600 bytes versus 500 bytes for haskell. |
| 03:03:33 | <dons> | so yes, ATS makes its flaws clear. |
| 03:03:45 | <lispy> | Is ATS a new language? |
| 03:03:49 | <dons> | haskell looks pretty good there in terms of conciseness/performance. |
| 03:05:06 | <PHO_> | I don't know anything about ATS but the code looks implementing its own parallelism. Right? |
| 03:05:25 | <dolio> | It's embedding C code that calls pthreads. |
| 03:05:35 | <dolio> | If I'm reading correctly. |
| 03:05:43 | <dolio> | I guess they have no threading/parallelism library. |
| 03:06:57 | <mmorrow> | heh, a nice touch: |
| 03:06:58 | <mmorrow> | substCh etc = [etc] |
| 03:07:09 | <PHO_> | http://www.ats-lang.org/ hmm |
| 03:07:20 | <dons> | mmorrow: i liked that too. |
| 03:07:20 | <lambdabot> | Title: Home Page for ATS |
| 03:07:36 | <dons> | overall, we're doing well. |
| 03:07:36 | <dons> | http://shootout.alioth.debian.org/u64q/benchmark.php?test=regexdna&lang=all |
| 03:07:38 | <lispy> | dons: how long are the talks usually? (the ones at galois) |
| 03:07:39 | <lambdabot> | Title: regex-dna benchmark | x64 Ubuntu : Intel® Q6600® quad-core Computer Language B ..., http://tinyurl.com/47qxv5 |
| 03:07:41 | <dons> | but we need a few more parallel programs. |
| 03:07:45 | <dons> | lispy, 45 minues. |
| 03:07:50 | <dons> | lispy, so you're on next tuesday. |
| 03:07:55 | <dons> | we have a talk on thursday. |
| 03:08:56 | <lispy> | dons: oh wait, the 7th or the tuesday after that? |
| 03:08:58 | <dons> | we need a better parallel binary trees. |
| 03:09:09 | <dons> | checking... |
| 03:09:13 | <dons> | i thought we decided on the 14th? |
| 03:09:26 | <lispy> | dons: Yeah, I thought we moved to the 14th too |
| 03:09:26 | <dons> | but i'm checking. its whatever we agreed on. |
| 03:09:30 | <lispy> | oh okay |
| 03:09:46 | <dons> | oh, you wanted 14th? yes. ok. |
| 03:09:52 | <dons> | looks like i did not actually update that :) |
| 03:09:59 | <dons> | that works well though. |
| 03:10:00 | <mmorrow> | what's the difference between regex-pcre-builtin and regex-pcre ? |
| 03:10:03 | <lispy> | dons: I just checked the pdxfunc and i didn't see a schedule for the next talk yet. But, you say, there is one on the 9th? |
| 03:11:07 | <mmorrow> | i wanna add them/it to regexqq now that 6.10 is almost here and everyone'll have quasiquotes |
| 03:11:17 | <lispy> | dons: should I expect to talk for the whole 45 min (or should I plan to talk for 30 and answer questions for 15?), can I bring my laptop with slides (keynote probably)? |
| 03:11:22 | <dons> | lispy: so, 2nd, 7th and 14th. |
| 03:11:46 | <mmorrow> | ah, n/m. they're the same thing it looks like. |
| 03:11:56 | <dons> | i'm about to announce the 2nd, then dcoutts on tuesday. and lispy on the following tuesday. |
| 03:12:06 | <lispy> | dons: are the talks usually at 10:30am? |
| 03:12:25 | <dons> | yep. |
| 03:12:30 | <mmorrow> | err, actually i don't think they are.. |
| 03:12:35 | <dons> | 10.30 - 11.20 or so, with questions |
| 03:12:42 | <lispy> | okay cool |
| 03:12:55 | <lispy> | dons: so many details :) |
| 03:13:07 | <dons> | i'll be sending you details tomorrow i think. |
| 03:13:13 | <dons> | when i do all the other announces. |
| 03:13:23 | <lispy> | dons: I'll try to make it to at least one of those two talks then. I'd like to meet people and see how it works, but it sounds pretty standard so far. |
| 03:13:29 | <dons> | yep |
| 03:13:50 | <lispy> | dons: oh and just to reconfirm, so bringing my own laptop with slides is the norm? |
| 03:13:57 | <dons> | yes. |
| 03:14:01 | <lispy> | dons: is there a white or chalk board? |
| 03:14:05 | <dons> | whiteboard. |
| 03:14:08 | <lispy> | awesome |
| 03:14:20 | <lispy> | Doubt I'll use it, but it's nice to know just in case |
| 03:14:22 | <humasect> | @lastspoke |
| 03:14:22 | <lambdabot> | Unknown command, try @list |
| 03:14:26 | <dons> | sjanssen: chameneos is parallelisable, http://shootout.alioth.debian.org/u64q/benchmark.php?test=chameneosredux&lang=all |
| 03:14:28 | <lambdabot> | Title: chameneos-redux benchmark | x64 Ubuntu : Intel® Q6600® quad-core Computer Lang ..., http://tinyurl.com/6zcher |
| 03:14:30 | <lispy> | ?lastspoke lambdabot |
| 03:14:30 | <lambdabot> | Unknown command, try @list |
| 03:14:36 | <ivanm> | is community.haskell.org down? |
| 03:14:50 | <humasect> | i think its right there where you wrote it |
| 03:15:37 | <sjanssen> | hmm |
| 03:15:46 | <dons> | looks like we can improve mandelbrot too, http://shootout.alioth.debian.org/u64q/benchmark.php?test=mandelbrot&lang=all |
| 03:15:48 | <lambdabot> | Title: mandelbrot benchmark | x64 Ubuntu : Intel® Q6600® quad-core Computer Language ..., http://tinyurl.com/4v5dcg |
| 03:15:52 | <dons> | port the C++ version |
| 03:16:03 | <humasect> | code.haskell.org warning, also down |
| 03:17:46 | <kig> | how do i print the uppercase version of each line in a file so that memory usage is O(maximum line size)? map putStrLn . lines . map Char.toUpper =<< readFile "my_file" doesn't quite work |
| 03:18:25 | <dons> | well, memory use should be O(1) |
| 03:18:45 | <lispy> | yeah, where the constant is 4GB ;) |
| 03:18:59 | <dons> | mapM_ putStrLn . map toUpper . lines =<< readFile "f" |
| 03:19:10 | <dons> | but better to use Data.ByteString.Lazy |
| 03:19:11 | <dons> | for speed |
| 03:19:14 | <bd_> | that should be fine though |
| 03:19:17 | <dons> | yeah |
| 03:19:22 | <bd_> | I wonder if kig was confused by the GC? |
| 03:19:26 | <dolio> | 4 gigabytes... of time! |
| 03:19:34 | <bd_> | under a certain size it would appear to be O(n) on the file size |
| 03:19:34 | <humasect> | @tell_me_O_of map toUpper . lines ["asd","asd"] |
| 03:19:34 | <lambdabot> | Unknown command, try @list |
| 03:19:36 | <kig> | ooh, mapM_ |
| 03:19:44 | <bd_> | @does_this_halt fix id |
| 03:19:44 | <kig> | thank you |
| 03:19:45 | <lambdabot> | Unknown command, try @list |
| 03:19:58 | <lispy> | ?faq Does this halt: fix id |
| 03:19:59 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 03:20:43 | <kig> | and yeah, O(1) indeed |
| 03:20:47 | <humasect> | hehe |
| 03:21:04 | <bd_> | the lines bit isn't really needed though |
| 03:21:11 | <dons> | sjanssen: apparently you can also parallelise reverse-complement, http://shootout.alioth.debian.org/u64q/benchmark.php?test=revcomp&lang=all |
| 03:21:13 | <lambdabot> | Title: reverse-complement benchmark | x64 Ubuntu : Intel® Q6600® quad-core Computer L ..., http://tinyurl.com/3qkop7 |
| 03:21:42 | <Saizan> | why not just putStr . map toUpper =<< readFile "file" ? |
| 03:22:12 | <dolio> | That C++ mandelbrot is actually surprisingly nice. |
| 03:23:16 | <dons> | can we port it plz :) |
| 03:23:40 | <ivanm> | hmmm.... I can ssh into haskell, but the web interface is down :s |
| 03:23:42 | <kig> | i'm writing examples on how to do line-wise IO, toUpper is a bit bad example. better change it to reverse |
| 03:24:30 | <sbahra> | kig, why? |
| 03:25:22 | <kig> | toUpper is block-size oblivious |
| 03:26:14 | <sjanssen> | dons: looks like C++ manages parallel results with spinlocks |
| 03:26:56 | <sjanssen> | dons: notice how C++ uses 16.57 CPU seconds while GHC only uses 6.16 |
| 03:27:33 | <sbahra> | Why is that bad? |
| 03:27:49 | <adu> | sbahra: because 16 > 6 |
| 03:27:52 | <sbahra> | Lies. |
| 03:28:38 | <lispy> | > let 16 = 2 in 16 > 6 |
| 03:28:39 | <lambdabot> | True |
| 03:29:16 | <lispy> | > let 16 > 6 = False in 16 > 6 |
| 03:29:17 | <lambdabot> | False |
| 03:29:23 | <adu> | lol |
| 03:29:34 | <sjanssen> | dons: I think chameneos is just too serial for a parallel version -- every thread contends on a single lock |
| 03:30:14 | <dmort> | > pl f s = (s `elem`) . words |
| 03:30:14 | <lambdabot> | mueval: SrcLoc {srcFilename = "<unknown>.hs", srcLine = 2, srcColumn = 15} |
| 03:30:14 | <lambdabot> | ... |
| 03:31:03 | <lispy> | does anyone know how to upload project source once you have a projet on the c.h.o? |
| 03:32:04 | <dmort> | pl f s = (s `elem`) . words |
| 03:32:07 | <adu> | lispy: i dunno, i was trying to do that about a month ago, and I couldn't figure out how |
| 03:32:42 | <sbahra> | adu, http://shootout.alioth.debian.org/u64q/benchmark.php?test=chameneosredux&lang=all |
| 03:32:44 | <lambdabot> | Title: chameneos-redux benchmark | x64 Ubuntu : Intel® Q6600® quad-core Computer Lang ..., http://tinyurl.com/6zcher |
| 03:32:53 | <lispy> | adu: if you have ssh keys setup, then I think it's just a matter of scp repo code.haskell.org:somepath/to/project |
| 03:33:16 | <lispy> | adu: but, it's the somepath/to/project that I'm ignorant of |
| 03:33:35 | <lispy> | I was thnking about emailing the admins, but if the info is already available that would be nice :) |
| 03:34:04 | <Saizan> | lispy: /srv/code/$project |
| 03:35:01 | <lispy> | Saizan: thank you very much sir |
| 03:35:20 | <Saizan> | np |
| 03:35:25 | <adu> | hey, I don't see Aenigma on the front page |
| 03:36:49 | <sjanssen> | dons: actually, I think there is one tiny change we can make. Can you test this on a multi core box? http://hpaste.org/10777#a1 |
| 03:37:17 | <sjanssen> | http://hpaste.org/10777/diff?old=0&new=1 might make all the difference :) |
| 03:44:20 | <dons> | trying sjanssen |
| 03:44:35 | <sjanssen> | dons: the third annotation might be very slightly better |
| 03:45:50 | <dons> | so i should just check on quad core. |
| 03:46:22 | <sjanssen> | dons: also, "-qm -qw" seems spurious |
| 03:46:43 | <sjanssen> | dons: yeah |
| 03:46:52 | <lispy> | yay, now autoproc is on code.haskell.org |
| 03:46:59 | <lispy> | and I think gwern is going to take over the project too |
| 03:48:50 | <ivanm> | since community.haskell.org is down, is it still possible to apply for project hosting? |
| 03:49:23 | <sjanssen> | dons: or maybe -qm -qw is best, I don't really know |
| 03:53:27 | <hasenov_> | does anyone know any sites that show you how to find large prime numbers? |
| 03:53:45 | <Cale> | hasenov_: How large? |
| 03:53:47 | <hasenov_> | besides the haskellwiki entry |
| 03:54:04 | <Cale> | hasenov_: Like, mersenne prime large, or usably large? |
| 03:55:23 | <b7j0c> | looking for some simple advice. i have a file i am parsing, every few chars i read i check for some sort of match and signal an error if the data is bad. this will result in a very nested set of case statements...is there a more haskellish way to avoid deep nesting of case statements? |
| 03:55:36 | <Heffalump> | b7j0c: yes, use an error or maybe monad |
| 03:56:11 | <b7j0c> | thanks heffalump. is error a monad too? i know of maybe |
| 03:56:13 | <mauke> | http://mauke.ath.cx/stuff/c/array-pointer.html |
| 03:56:15 | <lambdabot> | Title: C Programming: What is the difference between an array and a pointer? |
| 03:56:20 | <mauke> | excellent |
| 03:56:28 | <Heffalump> | Either is a monad |
| 03:56:54 | <mauke> | dns + apache is working again |
| 03:56:57 | <b7j0c> | thanks i will do some digging |
| 03:57:04 | <b7j0c> | thanks heffalump |
| 03:58:03 | <mml`> | this is slightly OT, but does anybody have a favorite curses (or at least non-GUI) bittorrent client? |
| 03:58:19 | <hackage> | Uploaded to hackage: graphmod 1.1.3 |
| 03:58:19 | <hackage> | Uploaded to hackage: haskell-lexer 1.0 |
| 03:59:15 | <dons> | sjanssen: ok. |
| 04:00:55 | <dons> | arch linux has 602 haskell packages now. |
| 04:06:38 | <sjanssen> | dons: the ones to try out are http://hpaste.org/10777#a2 and http://hpaste.org/10777#a3 (the latter might be considered cheating) |
| 04:07:40 | <dons> | ok |
| 04:07:56 | <dons> | and with what flagss? +RTS -N4 {-qw -qm} |
| 04:07:56 | <dons> | ? |
| 04:08:16 | <sjanssen> | +RTS -K100M -N5 -qm -qw -RTS 6000000 |
| 04:08:33 | <dons> | ok. |
| 04:11:00 | <adu_> | isn't Either usually used for errors tho? |
| 04:11:18 | <bd_> | tho...? |
| 04:11:44 | <dons> | sjanssen: not getting any speedup. with a1 I can get more cpu utilisatoin, but longer running times, without -qw -qm. with -qw -qm i get the same as with no -N value. |
| 04:12:17 | <sjanssen> | so -qw -qm are probably bad for chameneos |
| 04:12:21 | <dons> | 134% cpu 47.255 total gets dramatically slower with -N4 and no -qw -qm |
| 04:12:47 | <dons> | getting GC stats... |
| 04:12:48 | <sjanssen> | did you have a chance to try a3? |
| 04:12:54 | <dons> | yeah. a little slower overall |
| 04:13:00 | <sjanssen> | weird |
| 04:13:02 | <dons> | sorry, i tried a1, a2 and a3 |
| 04:13:12 | <dons> | no GC happening. |
| 04:13:25 | <dons> | hmm. 9 tasks created. |
| 04:13:42 | <dons> | how many threads are forked? |
| 04:13:57 | <sjanssen> | 3 for the first run |
| 04:14:09 | <sjanssen> | 10 for the second |
| 04:17:04 | <sjanssen> | a3 should get a nearly perfect 2x speed up, I can't imagine what is going on there |
| 04:24:18 | <dons> | hmm. ok. trying again. |
| 04:26:53 | <dons> | $ ghc -O2 -threaded -funbox-strict-fields --make C.hs -fbang-patterns |
| 04:27:03 | <dons> | $ time ./C +RTS -N5 -RTS 6000000 |
| 04:27:04 | <dons> | ? |
| 04:27:13 | <sjanssen> | dons: yeah |
| 04:27:42 | <dons> | much slower. weird. |
| 04:27:47 | <dons> | maybe lots of context swapping |
| 04:28:11 | <sjanssen> | must be |
| 04:28:46 | <sjanssen> | dons: so failing a properly threaded version, the original should be a bit faster without -threaded |
| 04:28:49 | <dons> | ./C +RTS -N5 -RTS 6000000 55.02s user 47.11s system 155% cpu 1:05.56 total |
| 04:29:05 | <dons> | versus about 4.7s without -N |
| 04:29:06 | <sjanssen> | wow |
| 04:29:19 | <dons> | ./C 6000000 5.19s user 0.00s system 97% cpu 5.306 total |
| 04:29:29 | <cjb> | so, question: are there any standard unix utilities that could be made faster by rewriting with par? |
| 04:29:38 | <bd_> | cjb: sort, maybe? |
| 04:29:59 | <cjb> | 'cause it seems that they're all written in C, and that it's so ridiculously hard to do on-demand SMP in C that I bet some are missin |
| 04:30:00 | <cjb> | g |
| 04:30:43 | <sjanssen> | dons: yeah, I guess context switches are so expensive that they eat up any concurrency gains |
| 04:37:26 | <dons> | ./C +RTS -N5 -qm -RTS 6000000 5.40s user 0.03s system 99% cpu 5.448 total |
| 04:37:34 | <dons> | gets it back down to single core performance. |
| 04:38:02 | <sjanssen> | -qm is the "don't migrate" flag? |
| 04:38:06 | <dons> | yeah. |
| 04:38:12 | <dons> | so keeps them on whatever they're on. |
| 04:38:15 | <dons> | but notice no parallelism |
| 04:38:20 | <dons> | ./C 6000000 5.18s user 0.02s system 99% cpu 5.208 total |
| 04:39:07 | <sjanssen> | is it possible to start a thread on a specific capability? |
| 04:39:47 | <dons> | yes, forkOnIO |
| 04:39:56 | <dons> | so maybe that would work... |
| 04:40:03 | <dons> | i do that in thread-ring |
| 04:40:07 | <dons> | should have remembered that :-) |
| 04:40:12 | <dons> | look at thread-ring #2 |
| 04:41:41 | <sjanssen> | so we want to start all the threads on the first "run" on CPU 1, and all the threads on the second run on CPU 2 |
| 04:42:13 | <newsham> | > sum [0.9**n | n <-[1..100]] |
| 04:42:15 | <lambdabot> | 8.99976094741001 |
| 04:42:22 | <newsham> | >>> sum(0.9**n for n in xrange(100)) |
| 04:42:23 | <newsham> | 9.9997343860111219 |
| 04:42:30 | <newsham> | oops! |
| 04:42:39 | <newsham> | forgot n==0 |
| 04:42:41 | <sjanssen> | dons: and then run with -qm |
| 04:44:15 | <mmorrow> | newsham: i was about to tell you about derive, but upon just checking it looks like you already saw it :) |
| 04:44:17 | <sjanssen> | dons: http://hpaste.org/10777#a4 |
| 04:44:28 | <mmorrow> | newsham: cool stuff http://www.thenewsh.com/~newsham/store/DeriveBinary.hs |
| 04:45:16 | <mmorrow> | newsham: i have a darcs repo of some template-haskell utils i've been putting together (need to update it with some more stuff i've got...) |
| 04:45:19 | <mmorrow> | ACTION gets the link |
| 04:45:44 | <mmorrow> | http://code.haskell.org/~morrow/code/haskell/th-utils/ |
| 04:45:55 | <lambdabot> | Title: Index of /~morrow/code/haskell/th-utils |
| 04:46:10 | <mmorrow> | it assumes ghc >= 6.9 though (i believe ...) |
| 04:46:27 | <mmorrow> | (because of the template-haskell lib, not any extensions or anything) |
| 04:47:26 | <mmorrow> | whoa, i haven't updated that for a while. got a bunch more stuff to put in. |
| 04:47:56 | <sbahra> | cjb, grep |
| 04:47:59 | <mmorrow> | the best part is instance of Lift for all of the TH ast: |
| 04:48:00 | <sbahra> | cjb, diff |
| 04:48:08 | <mmorrow> | , $(lift =<< reify ''Info) |
| 04:48:12 | <lunabot> | TyConI (DataD [] Language.Haskell.TH.Syntax.Info [] [NormalC Language.Has... |
| 04:48:18 | <sbahra> | cjb, not sure if gnu tar has been parallelised (probably has, BSD tar has) |
| 04:48:30 | <sbahra> | cjb, find |
| 04:49:38 | <dons> | sjanssen: ./D 6000000 +RTS -N5 -qm 9.36s user 0.00s system 192% cpu 4.874 total |
| 04:49:41 | <dons> | :) |
| 04:49:52 | <dons> | we're in business. |
| 04:50:05 | <humasect> | mmorrow: where is modules -> graphviz ? =) |
| 04:50:12 | <humasect> | (just wondering =) |
| 04:50:33 | <mmorrow> | heh. just added that to the short list. (really.) :) |
| 04:50:40 | <int-e> | system 192%. heh. crazy. |
| 04:50:50 | <humasect> | hehe ok ^_^ |
| 04:50:57 | <newsham> | mmorrow: thank you. on the one hand its disheartening that someone else did it already and much better, but on the other hand, it was fun to learn, and I think I have some interesting strange cases I may want to support that arent supported by the derive lib |
| 04:51:34 | <sjanssen> | dons: hmm, possibly faster than the C++ leader. Do you know how your machine compares to the shootout machine? |
| 04:51:38 | <dons> | sjanssen: so, ./D 6000000 +RTS -N5 -qm -sstderr 9.24s user 0.02s system 188% cpu 4.913 total |
| 04:51:42 | <dons> | its hmm. a bit faster i think. |
| 04:51:48 | <dons> | but its loadedup. |
| 04:51:53 | <dons> | 14:51:49 up 148 days, 15:15, 69 users, load average: 1.71, 1.56, 1.42 |
| 04:52:46 | <sjanssen> | hopefully they don't consider this cheating |
| 04:53:03 | <dons> | i think we're pretty loose with parallelisation strategies |
| 04:53:14 | <int-e> | well there isn't much to parallelize otherwise. |
| 04:53:16 | <dons> | so does it give the same output? |
| 04:53:29 | <mmorrow> | newsham: totally. i think it was most definitely worth doing despite that it's already been done in derive. some of the derive code is somewhat unreadable (on account of the way it's prettyprinted), and there're a ton of side-case/whatever that need to be added to it/written in general to get closer to awesome. (don't get me wrong, derive's is sweet and all). |
| 04:53:30 | <sjanssen> | int-e: right |
| 04:53:35 | <dons> | i'll upload it. |
| 04:54:00 | <newsham> | i'll check out your util lib.. gotta run.. |
| 04:54:13 | <mmorrow> | newsham: i've been trying to make a list lately of things other than instances to derive... |
| 04:54:17 | <mmorrow> | cool, have fun :) |
| 04:54:43 | <_dontpanic_> | 'm going to bed |
| 04:54:46 | <_dontpanic_> | thanks for the helps |
| 04:55:00 | <mmorrow> | night |
| 04:56:36 | <dons> | sjanssen: how would you describe the parallelisation strategy? |
| 04:58:50 | <sjanssen> | dons: coarse grained parallelism by running the two separate trials simulataneously |
| 04:59:18 | <dons> | ok. |
| 04:59:26 | <dons> | we do gain over single core, 5.3s to 4.0s |
| 04:59:58 | <dons> | on a loaded machine. |
| 05:00:03 | <dons> | so expecting a bit better on the shootout. |
| 05:00:40 | <dons> | submitted. http://alioth.debian.org/tracker/index.php?func=detail&aid=311147&group_id=30402&atid=411646 |
| 05:00:42 | <int-e> | dons: can you paste the sstderr output somewhere, please? |
| 05:00:43 | <lambdabot> | Title: Alioth: The Computer Language Benchmarks Game: Detail: 311147 Haskell GHC: paral ..., http://tinyurl.com/42dpa3 |
| 05:01:01 | <dons> | yes. |
| 05:01:34 | <dons> | http://www.cse.unsw.edu.au/~dons/chameneos-rts.txt |
| 05:03:54 | <int-e> | Heh, it's almost boring actually. Virtually no GC time (ok, that shouldn't be surprising), and two fairly balanced worker threads, as desired. |
| 05:03:57 | <int-e> | thanks |
| 05:05:09 | <dons> | yes. |
| 05:06:15 | <Saizan> | so running with -N2 (or 3?) would give the same results? |
| 05:06:55 | <sjanssen> | Saizan: yes |
| 05:07:04 | <dons> | yep |
| 05:07:14 | <dons> | fomr -N1 to -N2 show speedup |
| 05:07:37 | <dons> | how does the C++ program do its parallelisationnn? |
| 05:08:10 | <sjanssen> | one run at a time, spinlocks instead of blocking mutexes |
| 05:09:46 | <sjanssen> | so they waste a lot of CPU, but it turns out to be a net win |
| 05:14:29 | <int-e> | a spinlock ... hmm. yes, because all that matters in this benchmark is making progress, and every time you take the lock - no matter which thread does it - you get progress. |
| 05:16:09 | <dons> | so can we do something in that direction? |
| 05:16:30 | <sjanssen> | they apparently don't count chameneos-redux in the default rankings, why? |
| 05:16:39 | <dons> | oh, not enough programs submitted to it yet/ |
| 05:16:57 | <dons> | actually, its looking pretty comprehensive |
| 05:17:41 | <dons> | note how poorly erlang does due to all the switching, i suppose |
| 05:17:56 | <dons> | languages good at threading need careful scheduling support too |
| 05:24:07 | <unmarshal> | if i'm inside a monad and i need to do something like foldM but over a Data.Map must I do a toList on the Map or is there any other function that will allow me to do this |
| 05:29:47 | <Cale> | unmarshal: I think there's a foldM in Data.Foldable |
| 05:30:29 | <Cale> | unmarshal: That is, if you're just folding over the elements |
| 05:30:50 | <Cale> | unmarshal: The usual thing is to use toList though. |
| 05:32:29 | <Saizan> | :t Data.Map.fold |
| 05:32:31 | <lambdabot> | forall a b k. (a -> b -> b) -> b -> M.Map k a -> b |
| 05:33:30 | <int-e> | dons: so that C++ implementation of lock() (on x86-64) is essentially a loop consisting of a cmpxchg, and a sched_yield if the cmpxchg fails. (It's noteworthy that the implementation does not use pthread_spin_lock (which would probably perform horribly, because it doesn't suspend the thread voluntarily) |
| 05:34:35 | <unmarshal> | Cale: thanks, i'll just use toList, seemed incorrect, but i used google code search and found a bunch of examples |
| 05:34:38 | <unmarshal> | thanks |
| 05:35:01 | <unmarshal> | this is my first foray into actually using monad transformers |
| 05:35:10 | <mmorrow> | , eval "eval \"42\"" |
| 05:35:12 | <unmarshal> | so running into little things i haven't thought about before hehe |
| 05:35:13 | <lunabot> | <<Dynamic>> |
| 05:35:19 | <mmorrow> | oh SnAP |
| 05:35:32 | <mmorrow> | hackery FTW! |
| 05:36:21 | <mmorrow> | , maybe Nothing fromDynamic (fromDynamic (eval "eval \"42\"") :: Maybe Dynamic) :: Maybe Integer |
| 05:36:24 | <lunabot> | Just 42 |
| 05:36:35 | <mmorrow> | ACTION does a giddy dance |
| 05:37:36 | <Twey> | :t fromDynamic |
| 05:37:37 | <lambdabot> | forall a. (Typeable a) => Dynamic -> Maybe a |
| 05:37:54 | <Twey> | Oh ah. TH. |
| 05:38:52 | <lispy> | I love how that reads |
| 05:39:14 | <lispy> | maybe nothing from dynamic, from dynamic eval "eval 42" |
| 05:39:38 | <mmorrow> | the eval function has itself in its environment, so you can nest them infinitely deep |
| 05:39:45 | <int-e> | dons: Not sure we can match that without changing the RTS. We need a different locking primitive instead of MVars, the problem with MVars being that only one thread gets woken up when it's being filled, while the C++ version has several threads just waiting (busily) for an opportunity to jump in and do some work. |
| 05:40:10 | <Saizan> | , fix error |
| 05:40:14 | <lunabot> | Killed. |
| 05:40:15 | <mmorrow> | and the /best part/ is that that function itself is what's being used at the /top/ level in the evaluator |
| 05:40:22 | <mmorrow> | , eval "fix error" |
| 05:40:25 | <lunabot> | <<[Char]>> |
| 05:40:44 | <mmorrow> | , eval "fix (eval \"error\")" |
| 05:40:47 | <lunabot> | luna: Couldn't match expected type `a -> a' |
| 05:40:47 | <lunabot> | against inferred type `Data.Dynamic.Dynamic' |
| 05:40:57 | <sjanssen> | int-e: perhaps STM could work? |
| 05:41:19 | <int-e> | I don't know enough of the STM internals to speculate on that. |
| 05:42:03 | <dons> | hmm |
| 05:42:11 | <dons> | ok. |
| 05:42:16 | <dons> | too hard to make much progress here. |
| 05:42:17 | <ivanm> | http://hpaste.org/10778 <-- do people think this is an adequate summary of haskell for mathematicians? |
| 05:42:21 | <dons> | we can move on to other things. |
| 05:42:54 | <crutcher> | I've got a performance issue I don't understand. Its small, but measurable on large numbers of iterations. http://hpaste.org/10779 |
| 05:43:03 | <mmorrow> | Twey: Data.Dynamic.fromDynamic |
| 05:43:15 | <int-e> | I also think that this behaviour of MVars is generally very useful. |
| 05:43:22 | <crutcher> | In this code snippet, z' and z'' are very similar, but z'' uses an accumulator. |
| 05:43:37 | <crutcher> | I would think that z'' would be faster, but it isn't. |
| 05:44:33 | <Saizan> | crutcher: that's a lazy accumulator |
| 05:44:40 | <crutcher> | ? |
| 05:44:43 | <quicksilver> | crutcher: well, the accumulator wastes a little bit of space and time. |
| 05:44:55 | <quicksilver> | crutcher: meanwhile GHC manages to infer strictness automatically on the first one. |
| 05:45:11 | <quicksilver> | (I'm guesing it does; that would be consistent with it being faster) |
| 05:46:36 | <crutcher> | is it strictness, or does it notice (x + (y + z'' y)) and reduce this to ((x+y) + z'' y), and go ahead and compute (x+y)? |
| 05:48:14 | <quicksilver> | no |
| 05:48:21 | <quicksilver> | there are no associative laws in GHC |
| 05:48:45 | <Saizan> | crutcher: try adding '!' on the a parameter of f, like f !a 0 = ..; that should make z'' the fastest |
| 05:49:02 | <crutcher> | what does that mean? |
| 05:49:19 | <Axman6> | makes it strict |
| 05:49:25 | <Axman6> | a strict* |
| 05:50:14 | <lispy> | f !a 0 = ...; is the same as f a b | a `seq` False, or something like that. I know I have it wrong actually. |
| 05:50:17 | <crutcher> | I get a parse error when I do that. |
| 05:50:31 | <lispy> | crutcher: maybe you need to compile with -fglasgow-exts ? |
| 05:50:47 | <lispy> | if that works there is probably a more specific option for just bang patterns |
| 05:51:26 | <crutcher> | nope, still doesn't work. |
| 05:52:24 | <Axman6> | -Xbangpatterns i think |
| 05:52:31 | <Axman6> | -XBangPatterns maybe |
| 05:52:43 | <crutcher> | -fbang-patterns |
| 05:52:58 | <chrisdone> | anyone used pappy? |
| 05:53:02 | <crutcher> | that worked, but isn't faster. |
| 05:53:32 | <Axman6> | try using $! |
| 05:53:39 | <Axman6> | @src ($!) |
| 05:53:39 | <lambdabot> | f $! x = x `seq` f x |
| 05:54:01 | <Saizan> | crutcher: btw, are you compiling with -O2 ? |
| 05:54:20 | <crutcher> | no, let me try that. |
| 05:54:33 | <quicksilver> | ah then my previous comment about inferring strictness is way off :) |
| 05:54:42 | <quicksilver> | no such thing happens without optimisation. |
| 05:55:41 | <crutcher> | k, with -O2 z'' is in fact faster, without any games played with seq |
| 05:56:18 | <Saizan> | yeah, it can infer the strictness for such a simple loop, especially since you've specified Int, i guess |
| 05:57:18 | <BMeph|asleep> | Go for Int#, now! :) |
| 05:59:29 | <crutcher> | is that the unboxed Int? how would I do that? |
| 06:00:27 | <mmorrow> | pattern match on an Int and extract the unboxed part |
| 06:01:11 | <mmorrow> | f (I# n) = W# (int2word# n) |
| 06:01:13 | <int-e> | BMeph|asleep: ghc does that for you, if it can infer the required strictness |
| 06:01:35 | <mmorrow> | yeah, saying nothing about if you actually /need/ to do that.. |
| 06:02:20 | <BMeph> | Kuhl. :) |
| 06:04:59 | <int-e> | but here's a puzzle. why does z' get compiled to, paraphrasing the core, z' n = case n of 0 -> 0; -2147483648 -> let n' = divInt (-2147483648) 5 in n' + z' n'; n -> let n' = divInt n 5 in n' + z' n' ? |
| 06:06:19 | <sjanssen> | int-e: I'm not sure, but I've seen it before |
| 06:06:23 | <int-e> | Ah. I see why. a `div` b | a == minBound && b == (-1) = overflowError |
| 06:06:47 | <dons> | haskell.org down? |
| 06:06:49 | <int-e> | (from the Integral instance for Int) |
| 06:07:03 | <int-e> | dons: no? |
| 06:07:08 | <dons> | hmm |
| 06:07:54 | <int-e> | that should be written as b == (-1) && a == minBound, perhaps. |
| 06:09:34 | <ozy`> | okay, having just seen how one defines a list representing the entire Fibonacci sequence, I have to admit that lazy evaluation is really really cool... but I'm still curious as to why it's the default |
| 06:10:02 | <dons> | int-e: can you try again, refreshing? |
| 06:10:08 | <dibblego> | because it's the most often desired |
| 06:10:34 | <dons> | hmm. i can get it from code.haskell.org |
| 06:10:47 | <int-e> | dons: still works for me. |
| 06:11:05 | <dons> | yep. ok. |
| 06:11:08 | <dons> | something wrong on my end. |
| 06:11:11 | <unmarshal> | hmm |
| 06:11:14 | <unmarshal> | not loading for me |
| 06:11:53 | <int-e> | http://downforeveryoneorjustme.com/haskell.org |
| 06:11:54 | <lambdabot> | Title: It's just you. |
| 06:12:10 | <unmarshal> | weird, must be me too then |
| 06:12:14 | <unmarshal> | comcast dons? |
| 06:12:14 | <int-e> | (see. no need to even visit the page. lambdabot tells us all we need to know :) |
| 06:12:18 | <dons> | unmarshal: yeah. maybe. |
| 06:12:20 | <unmarshal> | yeah |
| 06:12:49 | <dons> | is it down for comcast, or just me? :) |
| 06:12:55 | <unmarshal> | down for me as well |
| 06:13:01 | <unmarshal> | The server at haskell.org is taking too long to respond. |
| 06:13:10 | <Axman6> | OpenDNS says it's down |
| 06:13:14 | <dons> | is it down for everyone, or just comcast? :) |
| 06:13:28 | <BMeph> | ozy': Because it's easier to tell where you can use strictness for better effect than laziness. :) |
| 06:13:36 | <ozy`> | OpenDNS sucks.... OrSoIHear |
| 06:13:40 | <aprocter> | down for me as well (not on Comcast) |
| 06:13:54 | <unmarshal> | PST? |
| 06:13:58 | <ozy`> | BMeph: heh, that works for me |
| 06:14:01 | <unmarshal> | im in california |
| 06:14:06 | <unmarshal> | sf |
| 06:14:08 | <BMeph> | Same here. |
| 06:14:14 | <aprocter> | Missouri |
| 06:14:43 | <dons> | hmm. down for the states? |
| 06:14:50 | <BMeph> | Oh - by "the server," does the Wiki count, or do you mean c.h.o, and hackage? :) |
| 06:14:51 | <dons> | yale got moved to europe? |
| 06:14:58 | <dons> | BMeph: just the wiki. |
| 06:15:10 | <dons> | c.h.o is elsewhere, hackage is another elsewhere. |
| 06:15:14 | <aprocter> | It's back for me now |
| 06:15:20 | <ivanm> | the wiki is up down under... |
| 06:15:21 | <dons> | back now. |
| 06:15:22 | <dons> | phew. |
| 06:15:23 | <BMeph> | dons: Then, I think it's just Comcast; it's paging fine for me. |
| 06:15:27 | <dons> | life returns to normal. |
| 06:15:58 | <BMeph> | dons: Heh-heh, cable envy. ;) |
| 06:16:12 | <unmarshal> | back for me as well |
| 06:16:15 | <Axman6> | me too |
| 06:16:36 | <Axman6> | all is well people, do about your business as usual |
| 06:16:41 | <Axman6> | go* |
| 06:17:04 | <Adamant> | it work for US SE on Comcrap |
| 06:17:49 | <Adamant> | ugh. I really hate sounding like I don't know English because of a overly short response. |
| 06:21:04 | <BMeph> | Adamant: At least you don't have an ovary short response... ;) |
| 06:21:19 | <Adamant> | heh heh heh |
| 06:21:50 | <Adamant> | I almost had "soundling" in the sentence before I corrected it. |
| 06:22:05 | <TSC> | ivanm: Are you the Graphalyze ivanm? |
| 06:22:20 | <ivanm> | TSC: yes |
| 06:22:34 | <ivanm> | yay! someone saw my ANNOUNCE! :p |
| 06:22:44 | <TSC> | Yeah, I did (: |
| 06:22:50 | <TSC> | ivanm: It's a pity your talk is all the way north in Brisbane; it looks interesting |
| 06:23:07 | <ivanm> | TSC: well, I'm not going down to you :p |
| 06:23:23 | <ivanm> | I can show you my draft talk outline (I'll be doing the slides up this weekend) if you want... |
| 06:23:32 | <BMeph> | dons: Oh, thanks for the Mersenne link; I tried to pull up the file with all digits in it, and crashed the browser. :) |
| 06:23:47 | <dons> | hehe |
| 06:23:47 | <ivanm> | same here :s |
| 06:23:51 | <TSC> | ivanm: Will you put the slides up when you've done them? |
| 06:23:54 | <ivanm> | yup |
| 06:24:00 | <TSC> | Cool |
| 06:24:08 | <humasect> | ac ~ |
| 06:25:37 | <Axman6> | @src (+++) |
| 06:25:37 | <lambdabot> | Source not found. You untyped fool! |
| 06:25:46 | <Axman6> | hmm |
| 06:25:59 | <Axman6> | HAppS needs _some_ documentation -_- |
| 06:26:26 | <humasect> | @src Text.Html.(+++) |
| 06:26:26 | <lambdabot> | Source not found. Wrong! You cheating scum! |
| 06:26:40 | <Saizan> | (+++) is likely from Text.XHtml, yeah |
| 06:26:51 | <Saizan> | @hoogle (+++) |
| 06:26:51 | <lambdabot> | Control.Arrow (+++) :: ArrowChoice a => a b c -> a b' c' -> a (Either b b') (Either c c') |
| 06:26:51 | <lambdabot> | Text.ParserCombinators.ReadP (+++) :: ReadP a -> ReadP a -> ReadP a |
| 06:26:51 | <lambdabot> | Text.ParserCombinators.ReadPrec (+++) :: ReadPrec a -> ReadPrec a -> ReadPrec a |
| 06:27:06 | <Axman6> | yeah it appears it is |
| 06:27:29 | <humasect> | i made lots of webpage stuff in the last few days with Text.Html ; pretty neat stuff. i am glad to use haskell for the task, it is much easier and simpler; also more fun |
| 06:28:37 | <pantsd_> | How would I get the integer part of a divions (i.e. 5/2 -> 2 ) |
| 06:28:39 | <pantsd_> | ? |
| 06:28:53 | <ivanm> | > 5 `div` 2 |
| 06:28:54 | <lambdabot> | 2 |
| 06:29:00 | <ac> | humasect: ~ |
| 06:29:01 | <ivanm> | > 5 `quot` 2 |
| 06:29:03 | <lambdabot> | 2 |
| 06:29:15 | <humasect> | ac =) |
| 06:29:16 | <ivanm> | ^^ div for remainders, quot for moduli |
| 06:29:18 | <pantsd_> | yays! |
| 06:29:21 | <pantsd_> | thanks |
| 06:29:25 | <ivanm> | no worries |
| 06:29:37 | <ivanm> | > 5 `divrem` 2 |
| 06:29:38 | <lambdabot> | Not in scope: `divrem' |
| 06:29:39 | <Cale> | uh |
| 06:29:42 | <humasect> | here ac: http://96.51.4.55/~humasect/ |
| 06:29:42 | <lambdabot> | Title: Hoovy Studios |
| 06:29:50 | <ivanm> | or have I got them the wrong way round? |
| 06:29:53 | <humasect> | under 'novapilot' |
| 06:29:53 | <ivanm> | @hoogle quot |
| 06:29:53 | <lambdabot> | Prelude quot :: Integral a => a -> a -> a |
| 06:29:54 | <lambdabot> | Text.XHtml.Frameset quote :: Html -> Html |
| 06:29:54 | <lambdabot> | Text.XHtml.Strict quote :: Html -> Html |
| 06:29:59 | <Cale> | div is the quotient and mod is the corresponding remainder |
| 06:30:04 | <Cale> | there's also quot and rem |
| 06:30:14 | <Axman6> | rem cunfuses me |
| 06:30:19 | <Axman6> | confuses too. far out |
| 06:30:20 | <Cale> | They have slightly different behaviour with regard to negative values |
| 06:30:35 | <Cale> | > rem (-1) 5 |
| 06:30:36 | <lambdabot> | -1 |
| 06:30:37 | <Axman6> | > (-10) `rem` 3 |
| 06:30:38 | <lambdabot> | -1 |
| 06:30:41 | <Cale> | > mod (-1) 5 |
| 06:30:42 | <lambdabot> | 4 |
| 06:30:46 | <ozy`> | Axman6: how about the foo fighters, then? |
| 06:31:01 | <Axman6> | so so |
| 06:31:08 | <Axman6> | :P |
| 06:31:31 | <Axman6> | they were on one of the episodes of the west wing i was watching last night |
| 06:31:57 | <ac> | humasect: cool. So it /is/ for games. Is there a darcs repository? |
| 06:32:36 | <humasect> | ac: yes, but, i am not sure if i can have that online yet. i am working on seeing if i can get haddock up at least |
| 06:50:03 | <opqdonut_> | Cale: no, I meant approximation in the sense "finds a solution x with utility at least \omega(x) \ge \omega^*/\alpha where \omega^* is the optimum utility" |
| 06:50:31 | <opqdonut_> | Cale: and yes, I know this isn't a decision problem |
| 06:51:01 | <Cale> | I'm sure it could be encoded into one |
| 06:51:10 | <opqdonut_> | yes |
| 06:51:40 | <opqdonut_> | tho I can't recall how the problems of type "is X > n?" behaved |
| 06:54:39 | <Cale> | I wonder if there are, say, polynomial time algorithms for getting arbitrarily good approximations in the sense that I mentioned (where the probability that the answer is incorrect is less than e), what that implies about the complexity of the exact problem. |
| 06:56:38 | <dons> | http://haskell.org/haskellwiki/Haskell_Platform |
| 06:56:40 | <lambdabot> | Title: Haskell Platform - HaskellWiki |
| 06:58:48 | <Cale> | It's sort of like saying that mostly the problem is not so hard, but I suppose it's possible there might be small islands of difficulty. |
| 07:03:38 | <damg> | are there standard zip functions which fail with lists are of different lengths? |
| 07:04:16 | <Cale> | damg: no |
| 07:04:57 | <damg> | Cale, thank you, I hoped I've overseen them ;) |
| 07:09:16 | <Axman6> | anyone with much HAppS experience? (or even not all that much at all) i don't understand why i get this error for BlogPage, but not CommentPage, when they;'re using almost the same code. http://hpaste.org/10780#a1 |
| 07:12:54 | <BMeph> | Heh-heh: "...the Haskell Platform doesn’t have a glue layer designed to uniformize APIs." (from http://dutherenverseauborddelatable.wordpress.com/2008/09/27/a-quick-update-on-batteries/) Sounds like someone is either tough-to-impress, or is-overlooking-something-major... >;) |
| 07:12:56 | <lambdabot> | Title: A quick update on Batteries « Il y a du thé renversé au bord de la table, http://tinyurl.com/4c54wg |
| 07:13:38 | <humasect> | what would they be overlooking, BMeph ? |
| 07:14:18 | <dons> | they're overlooking the base library. |
| 07:14:24 | <dons> | which is missing from ocaml. |
| 07:14:28 | <dons> | it provides our glue layer. |
| 07:14:37 | <dons> | the platform can require librarise use that glue, before inclusion. |
| 07:14:58 | <dons> | if they reinvent say, an exception handling mechanism, or a tree type, they don't get in till they use the base types. |
| 07:15:11 | <Saizan> | Axman6: methodSP vs. method |
| 07:15:15 | <humasect> | ah, i see.. |
| 07:15:25 | <Axman6> | Saizan: sure... what? |
| 07:16:08 | <Saizan> | Axman6: you're wrapping processComment with methodSP, while processPost with method |
| 07:16:20 | <Saizan> | Axman6: SP stands for ServicePart |
| 07:16:42 | <Axman6> | ah, i see |
| 07:16:53 | <Axman6> | this is whay i get for not copying and pasting |
| 07:18:01 | <dons> | BMeph:, humasect: make sense? |
| 07:18:24 | <dons> | unlike ocaml, we have too many libraries and too many developers. |
| 07:18:24 | <humasect> | i thought ocaml had a base library. with Array and stuff |
| 07:18:32 | <dons> | so we can use people to force things to happen :) |
| 07:18:35 | <Axman6> | you know, one day i'm going to type a sentense on IRC without a typo |
| 07:18:38 | <humasect> | hmm.. |
| 07:18:39 | <Axman6> | and i shall be a great day |
| 07:18:40 | <dons> | instead of having to write all the glue ourselves. |
| 07:18:59 | <humasect> | 'ourselves' - isn't that the same pot where the 'too many devs' belong? hehe |
| 07:19:02 | <dons> | also, we're a coherent community, so we can modify upstream, instead of fork + glue. |
| 07:19:18 | <dons> | the ocaml guys have to add glue, since they can't get upstream agreement. |
| 07:19:40 | <dons> | as was mentioned at CUFP, there are 101 ocaml prelude implementations. |
| 07:19:44 | <dons> | so why not write another one. :) |
| 07:20:03 | <dons> | (btw, ocaml isn't haskell's competitor, python is) |
| 07:20:12 | <humasect> | ahh, i see |
| 07:20:48 | <humasect> | hehe, this i figured when someone mentioned "isn't pyhton's incoming feature list a lot like haskell feature list?" |
| 07:21:08 | <Spark> | i don't understand the obsession with python |
| 07:21:36 | <dons> | its a good hill to climb. |
| 07:21:45 | <humasect> | why is there a mention of ocaml at all? from the article? |
| 07:21:51 | <humasect> | =) |
| 07:21:54 | <Spark> | but it's not a big hill, neither does it have an interesting view :) |
| 07:22:15 | <dons> | it has a big user base, and uses that i at least see haskell better suited to. |
| 07:22:18 | <dons> | i.e. writing programs. |
| 07:22:45 | <Beelsebob> | dons: heh, oddly, I always found python's biggest strength was writing server side bits of web apps |
| 07:22:45 | <Spark> | that doesn't distinguish it from most other languages |
| 07:23:02 | <dons> | find another enemy then :) |
| 07:23:08 | <Beelsebob> | which I'd also put as one of haskell's biggest weaknesses |
| 07:23:15 | <dons> | server side web apps? |
| 07:23:24 | <Beelsebob> | as in, the server side chunk of a web app |
| 07:23:41 | <dons> | isn't that the hottest area this year? (stable happs, fastcgi, sqlite/taksuen, kibro, panda, json serving, ...) |
| 07:23:50 | <slarba> | hmm, isn't ocaml a decent stepping stone towards "real" functional language like haskell? :) |
| 07:23:52 | <dons> | we're not comprehensive, but it is hot. |
| 07:23:58 | <humasect> | ah, that is interesting, dons; i too also see that way where python's use is more suited and for greater benefit with haskell chosen and applied instead |
| 07:24:12 | <Beelsebob> | yeh, it's still not really there dons -- I don't think it ever will be in a compiled language |
| 07:24:25 | <dons> | oh. well, that's a philosophical issue. |
| 07:24:28 | <humasect> | i've seen haskell uncompiled before. |
| 07:24:35 | <Spark> | i can't help thinking python is for people who don't know better |
| 07:24:39 | <dons> | run it in runhaskell if you don't want compiled code. |
| 07:24:49 | <Beelsebob> | heh |
| 07:25:15 | <BMeph> | dons: Force the Use, Luke! ;) |
| 07:25:19 | <Saizan> | i think eval+serializable continuations makes a big difference for webapps |
| 07:25:43 | <Beelsebob> | the other thing about python and web apps is tripple quoted strings |
| 07:25:51 | <humasect> | read/show is fine for many things.. |
| 07:28:18 | <ozy`> | slarba: I'd say so. I had to learn OCaml before I could make any sense of Haskell... |
| 07:28:19 | <RayNbow> | Beelsebob: '''these ones?''' or """these ones?""" |
| 07:28:40 | <BMeph> | RaynBow: The second ones. |
| 07:29:01 | <BMeph> | Er... *s/n/N/ :) |
| 07:29:10 | <RayNbow> | ACTION knows someone that prefers the first ones |
| 07:29:30 | <Axman6> | Saizan: you wouldn't happen to know how to use textfield in HAppS would you? |
| 07:29:35 | <RayNbow> | BMeph: ray[tab] = RayNbow... that way you don't have to use the shift key :) |
| 07:30:54 | <Saizan> | Axman6: no, that's another Text.Xhtml function? |
| 07:32:26 | <Axman6> | probably. i think i have it now... |
| 07:32:30 | <dancor> | how can i find the Monad instance of Either using only lbot |
| 07:32:56 | <Axman6> | whoot |
| 07:34:19 | <Baughn> | dons: Given that I'd probably end up compiling my own ghc anyway, is there any benefit to using arch? |
| 07:34:53 | <Saizan> | @instances-importing Control.Monad.Error Monad |
| 07:34:54 | <lambdabot> | ((->) r), ArrowMonad a, Cont r, ContT r m, Either e, ErrorT e m, IO, Maybe, RWS r w s, RWST r w s m, Reader r, ReaderT r m, ST s, State s, StateT s m, Writer w, WriterT w m, [] |
| 07:35:23 | <Saizan> | that's not a solution though |
| 07:38:30 | <dons> | Baughn: you don't have to compile your own ghc? |
| 07:38:52 | <dons> | Baughn: but no, if you're a developer comfortable with building ghc on your own, and using cabal-install, any distro will do. |
| 07:40:29 | <Baughn> | dons: Right. I figured I should try it (since I've broken debian pretty badly), but it wouldn't even install, so I guess.. |
| 07:40:38 | <Baughn> | ACTION makes a fist in the general direction of nforce |
| 07:44:31 | <glguy> | @seen dons |
| 07:44:31 | <lambdabot> | dons is in #xmonad, #haskell, #ghc, #darcs and #arch-haskell. I last heard dons speak 5m 38s ago. |
| 07:44:37 | <glguy> | oh |
| 07:44:42 | <dons> | glguy: |
| 07:45:03 | <glguy> | dons: I talked to Oleg after that talk. He said that in his tests he was out-peforming lazy IO by a factor of 2 |
| 07:45:32 | <dons> | lazy IO on Char? |
| 07:45:38 | <ivanm> | is there a standard date datatype? |
| 07:45:40 | <dons> | or on chunked arrays? |
| 07:45:45 | <ivanm> | System.Time doesn't seem to have anything :s |
| 07:45:46 | <glguy> | dons: both using char, I'd imagine |
| 07:45:49 | <Baughn> | ivanm: Several |
| 07:45:54 | <glguy> | his and system.io |
| 07:45:55 | <dons> | ok. that's less than I'd have thought. |
| 07:46:11 | <ivanm> | Baughn: where? |
| 07:46:18 | <dons> | so there's 32k times less laziness in lazy bytestrings |
| 07:46:29 | <Baughn> | ivanm: The Data.Time hierarchy |
| 07:46:32 | <dons> | so i hope only to match the performance |
| 07:46:37 | <dons> | but get resource safety. |
| 07:46:49 | <Baughn> | ivanm: Data.Time.Calendar, probably; ignore the julian and easter dates |
| 07:47:14 | <ivanm> | I don't seem to have a Data.Time heirarchy... |
| 07:47:18 | <ivanm> | you mean System.Time? |
| 07:47:20 | <dons> | glguy: sound reasonable? |
| 07:47:38 | <ivanm> | and I dont' have a System.Time.Calendar module either... |
| 07:47:55 | <glguy> | http://www.haskell.org/pipermail/haskell-cafe/2008-September/047738.html |
| 07:48:02 | <lambdabot> | Title: [Haskell-cafe] Lazy vs correct IO [Was: A round of golf], http://tinyurl.com/3gyv9l |
| 07:48:05 | <Baughn> | ivanm: No, really Data.Time |
| 07:48:20 | <ivanm> | well, I don't have anything called Data.Time with 6.8.3... |
| 07:48:22 | <Baughn> | ivanm: It's in the time package |
| 07:48:27 | <Baughn> | You may need to install it |
| 07:48:50 | <glguy> | dons: writing an iterator based io with bytestrings sounds great |
| 07:48:51 | <ivanm> | hmmmm.... looks like the docs aren't with the ghc ones, which is why I couldn't find it... |
| 07:49:12 | <dons> | glguy: hopefully the best of both worlds. |
| 07:49:17 | <dons> | maybe we should sit down some time and talk about it. |
| 07:49:20 | <Baughn> | ivanm: http://www.haskell.org/ghc/docs/latest/html/libraries/index.html <-- Yes they are. -_- |
| 07:49:21 | <lambdabot> | Title: Haskell Hierarchical Libraries |
| 07:49:28 | <dons> | since my hard trouble was understanding how to use oleg's combinator/monad stacks |
| 07:49:35 | <ivanm> | Baughn: not locally they're not :p |
| 07:49:35 | <dons> | and you saw the tutorial on that. |
| 07:49:48 | <dons> | yeah, that email you link to was one i was using. |
| 07:49:51 | <ivanm> | but thanks for that... |
| 07:49:55 | <Baughn> | ivanm: If you download the documentation tarball, it'll be in there |
| 07:49:57 | <ivanm> | I though it would be in the same doc package... |
| 07:50:01 | <ivanm> | Baughn: I built mine... |
| 07:50:14 | <grkz> | /part |
| 07:50:17 | <ivanm> | and must have rebuilt time since then, so it's seperate (different haddock version) |
| 07:50:33 | <Baughn> | ivanm: Anyway, there you go. Have fun. |
| 07:50:53 | <ivanm> | heh, yeah |
| 07:52:04 | <dancor> | hoogle should index instances.. |
| 07:53:13 | <Baughn> | ACTION loads up the library documentation a couple times to prime firefox |
| 07:53:26 | <Baughn> | ..so now I'm using its history module for bookmarks. Whee. |
| 07:53:38 | <mmorrow> | @tell chrisdone http://hpaste.org/10781#a0 |
| 07:53:39 | <lambdabot> | Consider it noted. |
| 07:58:22 | <hackage> | Uploaded to hackage: AERN-Real 0.9.7 |
| 07:59:44 | <mib_cx3gt3> | guys i got a question in class that i need u guys to help me decipher |
| 07:59:56 | <mib_cx3gt3> | Write a Haskell function countChange that calculates the number of different ways we can make change of n cents, given denominations of 1 cent, 2 cents, … , d cents ( i.e. if d=5, the denominations of coins available are 5 cents, 4 cents, 3 cents, 2 cents and 1 cent ) Examples: · count_ |
| 08:00:19 | <mib_cx3gt3> | · count_change (-10) 0 = 0 · count_change 5 3 = 5 · count_change 50 5 = 3765. |
| 08:00:27 | <mib_cx3gt3> | ^^^ |
| 08:00:49 | <mib_cx3gt3> | those r example, jus can't seem to see how my teach come by those answer |
| 08:00:52 | <mib_cx3gt3> | any help?? |
| 08:01:23 | <Wild_Cat> | mib_cx3gt3: you want all the possible combinations of coins whose sum is equal to n. |
| 08:01:51 | <chrisdone> | mmorrow: ohh nice ;D |
| 08:01:51 | <lambdabot> | chrisdone: You have 1 new message. '/msg lambdabot @messages' to read it. |
| 08:01:59 | <Deewiant> | for instance for 5 3, the 5 ways are [[3,2],[3,1,1],[2,2,1],[2,1,1,1],[1,1,1,1,1]] |
| 08:02:00 | <Wild_Cat> | that is, if n is 5 cents, you want 1+1+1+1+1, 1+1+1+2, 1+1+3, etc. |
| 08:02:27 | <Wild_Cat> | yeah, what Deewiant said. |
| 08:02:32 | <mib_cx3gt3> | oh |
| 08:03:26 | <mib_cx3gt3> | so... how would i go about writing a code for that? |
| 08:04:10 | <dolio> | First, consider how you'd select one coin. |
| 08:04:21 | <mib_cx3gt3> | k |
| 08:04:30 | <dolio> | Then, figure out how you make change for the amount less that one coin. |
| 08:04:56 | <mmorrow> | chrisdone: :)) |
| 08:05:23 | <mmorrow> | , let f n = (iterate (\x -> "(show . "++x++")") "id") !! n in maybe [] ($ 42) (fromDynamic (eval (f 4 ++ ":: Integer -> String")) :: Maybe (Integer -> String)) |
| 08:05:26 | <lunabot> | "\"\\\"\\\\\\\"42\\\\\\\"\\\"\"" |
| 08:05:38 | <dolio> | Of course, it's slightly more complex than that. |
| 08:05:53 | <ivanm> | where is TimeLocale defined? @hoogle doesn't know :s |
| 08:05:54 | <dolio> | Because you also have to make sure you don't count both [1,2,1,1] and [2,1,1,1] and so on. |
| 08:06:14 | <Deewiant> | ivanm: http://holumbus.fh-wedel.de/hayoo/hayoo.html?query=timelocale |
| 08:06:16 | <mmorrow> | , maybe [] ($ 42) (fromDynamic (eval "show :: Integer -> String") :: Maybe (Integer -> String)) |
| 08:06:16 | <lambdabot> | Title: Hayoo! |
| 08:06:19 | <lunabot> | "42" |
| 08:07:12 | <ivanm> | thanks Deewiant |
| 08:07:12 | <mmorrow> | , fmap (eval . show) [0..4] |
| 08:07:15 | <lunabot> | [<<Integer>>,<<Integer>>,<<Integer>>,<<Integer>>,<<Integer>>] |
| 08:07:35 | <Deewiant> | ivanm: rule of thumb: if Hoogle doesn't know, try Hayoo :-) |
| 08:07:59 | <ivanm> | heh |
| 08:08:20 | <ivanm> | damn, it doesn't look like System.{Time,Locale} is compatible with Data.Time :@ |
| 08:08:36 | <ivanm> | I just want it to print out today's date properly according to the user's locale! :s |
| 08:08:47 | <Lord_Illidan> | I was checking out the Haskell implemented of Project Euler problem 18 on the haskellwiki.. Got it finally, a very concise piece of programming. |
| 08:08:52 | <dancor> | ACTION had to do that once.. |
| 08:08:56 | <Lord_Illidan> | But how do you guys come up with it? |
| 08:09:31 | <dibblego> | Lord_Illidan, lots of practice |
| 08:09:37 | <dancor> | ivanm: it isn't related to Locale i think |
| 08:09:45 | <mib_cx3gt3> | guys i don't know how to start the ques |
| 08:09:56 | <mib_cx3gt3> | countchange a n |
| 08:10:00 | <dolio> | Which one is 18? |
| 08:10:04 | <ivanm> | Data.Time.Format takes in a TimeLocale for formatTime :s |
| 08:10:08 | <Lord_Illidan> | haskell.org/haskellwiki/Euler_problems/11_to_20#Problem_18 |
| 08:10:10 | <mib_cx3gt3> | |n == 0 = 0 |
| 08:10:17 | <Lord_Illidan> | warning, contains Spoilers, bla, bla |
| 08:10:27 | <ivanm> | dancor: ummm.... dependending on your locality, the date gets printed differently |
| 08:10:36 | <ivanm> | mainly to do with date/month order |
| 08:10:37 | <Axman6> | Lord_Illidan: linking to the actual problem might be more useful ;) |
| 08:10:43 | <dancor> | ivanm: see showRecent in http://dzl.no-ip.org:81/gitweb/?p=rr.git;a=blob;f=src/Main.hs |
| 08:10:52 | <Lord_Illidan> | http://projecteuler.net/index.php?section=problems&id=18 |
| 08:10:53 | <lambdabot> | Title: Problem 18 - Project Euler |
| 08:10:54 | <mmorrow> | lol: http://en.wikipedia.org/wiki/Tupper%27s_self-referential_formula |
| 08:10:55 | <lambdabot> | Title: Tupper's self-referential formula - Wikipedia, the free encyclopedia |
| 08:11:02 | <dolio> | Oh yeah. That one is quite nice. |
| 08:11:15 | <mmorrow> | http://upload.wikimedia.org/wikipedia/commons/8/88/Tupper%27s_self_referential_formula_plot.png |
| 08:11:17 | <lambdabot> | http://tinyurl.com/4oal2s |
| 08:11:23 | <mib_cx3gt3> | anyhelp ??? |
| 08:11:35 | <dolio> | I just did dynamic programming when I first did that one. |
| 08:11:36 | <Lord_Illidan> | I wasn't too sure about the algorithm, although I did think the best way was to start at the bottom.. which worked |
| 08:11:49 | <dolio> | Then when I saw the zipWith version, I felt embarassed. :) |
| 08:11:53 | <Axman6> | mib_cx3gt3: paste code, and tell us what the problem is |
| 08:11:54 | <dancor> | @users |
| 08:11:54 | <lambdabot> | Maximum users seen in #haskell: 515, currently: 467 (90.7%), active: 19 (4.1%) |
| 08:12:30 | <Lord_Illidan> | heh, I worked it out on a piece of paper |
| 08:12:39 | <Lord_Illidan> | you know, a dry run |
| 08:12:50 | <ivanm> | dancor: that prints the correct time/date for that time zone, but doesn't necessarily use the correct date format AFAICT |
| 08:12:59 | <Lord_Illidan> | and the zipWith version was amazingly concise, it's like it was designed for this very problem. |
| 08:13:14 | <Lord_Illidan> | I mean, the zipWith function, sry |
| 08:13:48 | <ivanm> | > getZonedTime |
| 08:13:49 | <lambdabot> | Not in scope: `getZonedTime' |
| 08:14:10 | <mib_cx3gt3> | http://www.mibbit.com/pb/tj2m5L |
| 08:14:11 | <lambdabot> | Title: Mibbit: PasteBin |
| 08:14:32 | <mib_cx3gt3> | stuck there don't know what to do from there |
| 08:14:41 | <dancor> | ivanm: oh maybe utcToLocalZonedTime? |
| 08:15:23 | <ivanm> | dancor: nope, it ignores locale |
| 08:15:31 | <dancor> | rightrigth |
| 08:15:32 | <ivanm> | it just does the correct date/time for the time zone |
| 08:15:48 | <mib_cx3gt3> | how am i gonna make haskell find the number of ways / all the ways we can change cents, given the denom |
| 08:16:32 | <dancor> | ivanm: i can't even find new locale stuff.. only old-locale.. |
| 08:16:43 | <ivanm> | System.Locale? |
| 08:16:50 | <dancor> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/old-locale |
| 08:16:51 | <lambdabot> | Title: HackageDB: old-locale-1.0.0.0, http://tinyurl.com/3g9buk |
| 08:16:52 | <Axman6> | mib_cx3gt3: what are you trying to do? |
| 08:17:04 | <dancor> | oh maybe new is part of ghc? |
| 08:17:05 | <ivanm> | yeah, that's all I could find as well |
| 08:17:20 | <mib_cx3gt3> | Write a Haskell function countChange that calculates the number of different ways we can make change of n cents, given denominations of 1 cent, 2 cents, … , d cents ( i.e. if d=5, the denominations of coins available are 5 cents, 4 cents, 3 cents, 2 cents and 1 cent ) |
| 08:17:20 | <ivanm> | dancor: that's the locale stuff that GHC uses AFAICT |
| 08:17:23 | <EvilTerran> | mib_cx3gt3, well, your program will need some concept of all the different coin denominations |
| 08:17:47 | <mib_cx3gt3> | how do i do that, seems kinda complex |
| 08:18:06 | <EvilTerran> | ah, ok, so you're not told those ahead of time - in that case, i guess your coin types should be a parameter to countChange |
| 08:18:06 | <dancor> | ivanm: defaultTimeLocale has the right dateTimeFmt tho? |
| 08:18:07 | <ivanm> | dancor: looks like dons to the rescue again :p http://cgi.cse.unsw.edu.au/~dons/blog/2008/06/24 |
| 08:18:08 | <lambdabot> | Title: Haskell hacking |
| 08:18:14 | <EvilTerran> | so whoever's using it can specify them |
| 08:18:14 | <Deewiant> | denominations d = [1..d] |
| 08:18:18 | <dancor> | everytime |
| 08:18:38 | <EvilTerran> | > [1..5] |
| 08:18:39 | <lambdabot> | [1,2,3,4,5] |
| 08:18:40 | <mib_cx3gt3> | all i was given was a example |
| 08:18:56 | <mib_cx3gt3> | · count_change (-10) 0 = 0 · count_change 5 3 = 5 · count_change 50 5 = 3765. |
| 08:19:08 | <dons> | dcoutts_: if a library makes it into the platform, it should get bumped to 1.0 :) |
| 08:19:40 | <Axman6> | Deewiant: i think the demoninations might be something like 1,2,5,10,25,50,100 or something |
| 08:19:43 | <EvilTerran> | mib_cx3gt3, i suspect you could apply loads of combinatorics and get a very short algorithm out at the end involving factorials and whatnot |
| 08:19:52 | <Deewiant> | Axman6: the problem description is quite explicit |
| 08:19:55 | <int-e> | Axman6: they aren't. |
| 08:19:57 | <Deewiant> | it's [1..d] |
| 08:20:01 | <dcoutts> | dons: heh heh |
| 08:20:11 | <EvilTerran> | mib_cx3gt3, but you might be expected to brute-force it instead of sidestepping the problem with maths |
| 08:20:27 | <Axman6> | oh, heh, i missed that it kept doing after 2 cents |
| 08:20:28 | <ivanm> | though I would have thought that something like defaultTimeLocale would have been IO... or is unsafePerformIO being used? |
| 08:20:36 | <int-e> | mib_cx3gt3: are you confused about which argument is which? |
| 08:21:04 | <EvilTerran> | int-e, well, i am :P |
| 08:21:20 | <Deewiant> | the first is n, the second is d |
| 08:21:23 | <int-e> | EvilTerran: the first argument is the amount; the second specifies the denominations. |
| 08:21:26 | <mib_cx3gt3> | yeah i am blanked |
| 08:21:28 | <mib_cx3gt3> | sorry |
| 08:21:47 | <EvilTerran> | ok |
| 08:21:47 | <int-e> | EvilTerran: and 5 for denominations means [1..5] as Deewiant says. |
| 08:21:55 | <EvilTerran> | i got that bit |
| 08:22:10 | <int-e> | at least with that interpretation the result agrees with the given examples :) |
| 08:22:13 | <EvilTerran> | the strange selection of denominations is what made me think a combinatorics approach would work |
| 08:22:29 | <dolio> | How many ways are there to make change with only 1 cent coins? |
| 08:22:54 | <mib_cx3gt3> | i.e. if d=5, the denominations of coins available are 5 cents, 4 cents, 3 cents, 2 cents and 1 cent |
| 08:23:02 | <EvilTerran> | mib_cx3gt3, yes, we got that |
| 08:23:09 | <dolio> | What if d=1? |
| 08:23:26 | <mib_cx3gt3> | i guess it's only 1cent |
| 08:23:32 | <Axman6> | and 1 way |
| 08:23:33 | <int-e> | or maybe even easier, d = 0 :) |
| 08:23:37 | <dolio> | Right. So what's the answer if d=1? |
| 08:23:45 | <int-e> | (and n>=0) |
| 08:23:51 | <dolio> | Yeah. |
| 08:24:10 | <dolio> | Well, n>0, depending on how you interpret making change for 0 cents. |
| 08:24:36 | <int-e> | easy. you give no coins at all |
| 08:24:41 | <int-e> | exactly one way to do that. |
| 08:24:45 | <dolio> | :) |
| 08:24:48 | <Axman6> | > [1..(-3)] |
| 08:24:49 | <lambdabot> | [] |
| 08:24:56 | <Axman6> | handeh |
| 08:25:20 | <dolio> | What about negative cents? |
| 08:25:22 | <ejt> | > [0, -1 .. -3 ] |
| 08:25:24 | <lambdabot> | [0,-1,-2,-3] |
| 08:25:35 | <dolio> | Apparently those cases are supposed to be 0. |
| 08:26:03 | <Axman6> | ACTION doesn't like negative money |
| 08:26:07 | <Kvasir> | hello |
| 08:26:48 | <mib_cx3gt3> | yeah 0 for negs |
| 08:26:58 | <dolio> | Or, actually, the example is 'foo (-10) 0 = 0' so it's hard to tell if that's specifying the d=0 case or the n<0 case. |
| 08:27:00 | <int-e> | dolio: we have no example where n=0. |
| 08:27:05 | <mib_cx3gt3> | this ques seems more complex than i thought |
| 08:27:22 | <Twey> | ACTION frowns. |
| 08:27:34 | <Twey> | Can't do a backwards range? |
| 08:27:42 | <Twey> | > [5..1] |
| 08:27:43 | <lambdabot> | [] |
| 08:27:45 | <dolio> | int-e: Yeah. He should just turn in a paper that says, "the problem was ill-specified". :) |
| 08:27:45 | <EvilTerran> | ACTION randomly shouts "DYNAMIC PROGRAMMING!" and runs off into the bushes |
| 08:27:47 | <Twey> | :( |
| 08:27:51 | <quicksilver> | > [5,4..1] |
| 08:27:52 | <EvilTerran> | > [5,4..1] -- Twey |
| 08:27:52 | <lambdabot> | [5,4,3,2,1] |
| 08:27:53 | <Twey> | Hahaha |
| 08:27:53 | <lambdabot> | [5,4,3,2,1] |
| 08:27:55 | <Twey> | Aha |
| 08:27:55 | <ivanm> | grrr..... even using the locale, I can't seem to get it to produce locale-specific dates :@ |
| 08:28:03 | <Twey> | > [5, 4 .. ] |
| 08:28:04 | <quicksilver> | it's exactly like BASIC |
| 08:28:05 | <lambdabot> | [5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18... |
| 08:28:07 | <int-e> | mib_cx3gt3: it's not that complicated really to express count_change recursively. it's a bit harder to make it efficient |
| 08:28:11 | <quicksilver> | the "STEP" defaults to +1 |
| 08:28:12 | <Twey> | Ahh. |
| 08:28:13 | <Twey> | 'kay. :) |
| 08:28:37 | <ivanm> | for some reason, it thinks I'm using American dates?!?!?!? |
| 08:28:39 | <EvilTerran> | int-e, as i said, a dynamic programming approach would make it efficient |
| 08:29:17 | <int-e> | EvilTerran: yes, I know. But it's hard to get that working without the naive implementation as a reference. |
| 08:29:22 | <EvilTerran> | indeed |
| 08:29:28 | <EvilTerran> | naive implementation first |
| 08:29:40 | <ivanm> | is there anyway I can work out what locale I'm actually in? I'm guessing TimeLocale is an inbuilt value rather than using the environment :@ |
| 08:29:43 | <EvilTerran> | then apply equational reasoning to get an equivalent but more efficient version |
| 08:30:20 | <EvilTerran> | Richard Bird style :) |
| 08:30:37 | <int-e> | and the naive implementation is good enough for the count_change 50 5 case anyway. |
| 08:30:52 | <quicksilver> | ivanm: not to be unduly pedantic, but TimeLocale is a type, it's not a value at all. |
| 08:31:00 | <int-e> | EvilTerran: uh. I skipped a few steps there *g* |
| 08:31:21 | <dons> | policy taking shape, http://haskell.org/haskellwiki/Haskell_Platform |
| 08:31:24 | <lambdabot> | Title: Haskell Platform - HaskellWiki |
| 08:31:24 | <ivanm> | quicksilver: yes, I meant timeLocale |
| 08:31:35 | <ivanm> | I thought it would actually specify the locale as defined by the system... |
| 08:31:49 | <EvilTerran> | int-e, pages? i was thinking more along the lines of lectures... ;) |
| 08:31:52 | <quicksilver> | ivanm: did you mean 'defaultTimeLocale' ? |
| 08:31:54 | <int-e> | EvilTerran: (I have an editor window open with a naive and two dynamic programming implementations for count_change) |
| 08:32:12 | <EvilTerran> | er, pages? what? where did i get that from |
| 08:32:13 | <dons> | Cale, ddarius can someone do a killer logo for the haskell platform? :) |
| 08:32:16 | <EvilTerran> | ACTION goes to get coffee |
| 08:32:37 | <dolio> | Just switch out the y-combinator for a memoizing combinator. Efficiency. :) |
| 08:32:44 | <EvilTerran> | sorry, just woke up, and this channel caught my attention while i was checking my email. i should go away before i start making even less sense :P |
| 08:32:45 | <ivanm> | quicksilver: yeah, that thingy :p |
| 08:32:59 | <int-e> | EvilTerran: Does 124 characters count as a one-liner? (I can save 12 characters on the function name) |
| 08:33:09 | <EvilTerran> | ... probably |
| 08:33:23 | <EvilTerran> | if you can get it below 80 characters, it's definitely a one-liner |
| 08:33:54 | <quicksilver> | ivanm: I'm not surprised it doesn't represent the system locale, since it doesn't have 'IO' type. |
| 08:34:41 | <quicksilver> | ivanm: but I'm surprised that there isn't something like getCurrentLocale :: IO TimeLocale :-/ |
| 08:34:47 | <ivanm> | I originally thought it might have been doing unsafe magic |
| 08:34:48 | <ivanm> | yeah :s |
| 08:35:25 | <ivanm> | I mean, there's setLocale... |
| 08:35:55 | <quicksilver> | odd. |
| 08:37:38 | <ivanm> | oh well, looks like I'll have to enforce my own date format ;-) |
| 08:41:57 | <RayNbow> | mib_cx3gt3: still working on that count_change problem? |
| 08:42:51 | <int-e> | EvilTerran: well, 74 characters without handling the pesky n<0 case, and with a single letter identifier. Oh, and with far too few spaces. |
| 08:44:40 | <Xenoblitz> | hi guys has anyone ever used HGL? |
| 08:47:34 | <RayNbow> | mib_cx3gt3, http://i296.photobucket.com/albums/mm178/ShinNoNoir85/count_change.jpg |
| 08:50:34 | <ivanm> | quicksilver: I suppose one problem with having _proper_ locales is that the date would be harder to parse, because you'd have to know in advance what locale it was printed in |
| 09:06:07 | <damg> | hm, looks like i pulled the wrong plug ... |
| 09:38:08 | <ivanm> | is there a common representation for directories/files and URLs? |
| 09:38:21 | <ivanm> | i.e. something like FilePath that also supports URLs? |
| 09:38:41 | <luqui> | ACTION doesn't think so |
| 09:38:47 | <ivanm> | *nod* |
| 09:38:53 | <ivanm> | oh well, time for a wrapper data type |
| 09:39:13 | <luqui> | data Location = File FilePath | URL URL |
| 09:39:15 | <luqui> | :-) |
| 09:39:30 | <mm_freak_> | ivanm: represent a file path as a URL |
| 09:39:37 | <mm_freak_> | file:///path/to/file |
| 09:39:56 | <Leaves> | hello, I have something like this: data A = A Int Int Int Int, and sometimes I want to do the same action on all of the ints, of course I can do f (A a b c d) = A (a+1) (b+1) (c+1) (d+1) but do you know if I can let A derive something so I can do f a = map (+1) a ? |
| 09:40:10 | <ivanm> | hmmmmm..... I'm not sure if that'll work too well... |
| 09:40:21 | <mm_freak_> | Leaves: turn your A into a functor |
| 09:40:24 | <ivanm> | since I'll be doing file-level manipulation as well... |
| 09:40:27 | <RayNbow> | ah, netsplit is over? |
| 09:40:46 | <mm_freak_> | Leaves: but you'll have to generalize your Int for that to work |
| 09:40:47 | <EvilRanter> | ivanm, there's Network.URI |
| 09:40:47 | <Baughn> | Leaves: Then you can use fmap. Alternately, since it's just a bunch of ints, why not use [Int]? |
| 09:40:49 | <quicksilver> | I bet there is a URL representation in some library. |
| 09:41:14 | <luqui> | data Quad a = Quad a a a a ; instance Functor Quad where ... |
| 09:41:22 | <EvilRanter> | Baughn, that would mean the length wasn't enforced at compile-time, though |
| 09:41:40 | <Baughn> | EvilRanter: True, and by using Functor the element type wouldn't be enforced at compile-time |
| 09:41:45 | <Baughn> | It's a trade-off either way |
| 09:42:07 | <Baughn> | Although, you could make A a functor and then type A' = A Int |
| 09:42:13 | <EvilTerran> | how would using lists enforce the element type at compile-time? |
| 09:42:17 | <quicksilver> | Baughn: that's not true. |
| 09:42:17 | <luqui> | Baughn, right |
| 09:42:28 | <quicksilver> | Baughn: the element type of 'Quad Int' is enforced at compile time! |
| 09:42:30 | <EvilTerran> | any more so than data Quad a = ... would, i mean |
| 09:42:54 | <Leaves> | well, [Int] is not good, since it's fixed lengts and often the different Ints have different meanings, I guess it might me better if I do myMap f (A a b c d) = A (f a) (f b) (f c) (f d) |
| 09:42:58 | <Baughn> | quicksilver: So it is, and using type to name that would be natural. NEver mind me. |
| 09:43:03 | <quicksilver> | actually I often find extra generality is useful, anyway. |
| 09:43:18 | <lunabot> | 1 |
| 09:43:21 | <luqui> | Leaves, if the different ints have different meanings, then what is the meaning of doing the same thing to all of them? |
| 09:43:30 | <Axman6> | why not just make a function mapA f (A a b c d) = A (f a) (f b) (f c) (f d) |
| 09:43:33 | <mm_freak_> | Leaves: as said, generalize your Int to 'a' and turn your A into a functor… then derive a special case from it |
| 09:43:34 | <EvilTerran> | ACTION looks askance at lunabot |
| 09:43:39 | <Baughn> | Leaves: No, luqui's suggestion is good. Make Quad a functor, then type A = Quad Int |
| 09:43:41 | <EvilTerran> | i asked you that over PM! |
| 09:43:48 | <mm_freak_> | data Quad a = Quad a a a a |
| 09:43:51 | <Leaves> | Ok, I will try that |
| 09:44:13 | <mm_freak_> | instance Functor Quad where fmap f (Quad a b c d) = Quad (f a) (f b) (f c) (f d) |
| 09:44:16 | <luqui> | there is only one correct instance of Functor Quad, right? |
| 09:44:18 | <mm_freak_> | type IntQuad = Quad Int |
| 09:44:36 | <ivanm> | EvilTerran: hmmmm... they're URI datatype seems overly complex to me :s |
| 09:44:44 | <luqui> | when is that the case in general? would it be possible to set up a deriving clause for Functor when it is? |
| 09:45:00 | <quicksilver> | luqui: well that's only informally true. |
| 09:45:14 | <luqui> | quicksilver, do elaborate :-) |
| 09:45:16 | <EvilTerran> | luqui, well, you could do it with Data.Generics, i think |
| 09:45:18 | <quicksilver> | luqui: fmap f (Quad a b c d) = Quad (f a) b c d is perfectly valid |
| 09:45:28 | <quicksilver> | luqui: there might be a good rason to only map some components. |
| 09:45:28 | <luqui> | quicksilver, it does not typecheck |
| 09:45:36 | <Leaves> | luqui: Well they represent different bytes in a Word of an encryption algorithm, for some steps in the algorithm they have different meaning while in other step not |
| 09:46:10 | <Leaves> | luqui: (this was just an example to ask the question, in the app it actually are Word8's) |
| 09:46:11 | <EvilTerran> | , everywhere (mkT (^2)) (1,2,3,4) |
| 09:46:12 | <lunabot> | (1,4,9,16) |
| 09:46:19 | <luqui> | Leaves, sure. |
| 09:47:16 | <luqui> | ACTION wonders why each bot has some magic metacharacter, and why bots don't just respond to being addressed directly instead... |
| 09:47:25 | <EvilTerran> | given "data Quad a = Quad a a a a deriving (Typeable, Data)", your instance would be "instance Functor Quad where fmap f = everywhere (mkT f)", i think |
| 09:48:00 | <mm_freak_> | Leaves: UArray Int Word8 |
| 09:48:06 | <luqui> | EvilTerran, thanks. I'm much less pragmatic than that, more interested in the the theory :-) |
| 09:48:08 | <mm_freak_> | wouldn't that work? |
| 09:48:27 | <pastorn> | @pl \(x,y) -> (y,x) |
| 09:48:28 | <lambdabot> | uncurry (flip (,)) |
| 09:48:34 | <luqui> | mm_freak_, size not enforced at compile time again |
| 09:48:37 | <idnar> | lunabot: everywhere (mkT (^2)) (1,2,3,4) |
| 09:48:43 | <maltem> | quicksilver: What would the instance header for the Quad exampe look like? |
| 09:48:45 | <idnar> | heh |
| 09:48:52 | <mm_freak_> | luqui: indeed |
| 09:48:55 | <EvilTerran> | pastorn, i'd suggest just defining "swap ~(x,y) = (y,x)" |
| 09:49:08 | <luqui> | Yay for lazy tuples! |
| 09:49:17 | <luqui> | I mean lazy tuple pattern matching of course |
| 09:49:21 | <idnar> | why make it lazy? |
| 09:49:22 | <EvilTerran> | it should be in Data.Tuple, IMO, but oh well |
| 09:49:24 | <quicksilver> | nah, I was wrong. |
| 09:49:27 | <EvilTerran> | i've also heard it called flop |
| 09:49:41 | <mm_freak_> | > fmap (+1) (2,3) |
| 09:49:43 | <lambdabot> | (2,4) |
| 09:49:43 | <EvilTerran> | idnar, because we like laziness? |
| 09:49:46 | <mm_freak_> | huh?! |
| 09:49:54 | <quicksilver> | despite being apparently useful, I find I very rarely use it. |
| 09:49:57 | <mm_freak_> | i expected (3,4) or an error, but not (2,4) |
| 09:49:59 | <EvilTerran> | mm_freak_, (a,) is a functor |
| 09:50:00 | <quicksilver> | (swap/flop) |
| 09:50:01 | <mm_freak_> | > fmap (+1) (2,3,4,5) |
| 09:50:03 | <lambdabot> | No instance for (Functor ((,,,) t t1 t2)) |
| 09:50:03 | <lambdabot> | arising from a use of ... |
| 09:50:06 | <luqui> | ACTION is of the opinion that Haskell would be cleaner without strict pattern matching on tuples |
| 09:50:09 | <mm_freak_> | EvilTerran: ah, ok |
| 09:50:21 | <idnar> | EvilTerran: maybe I'm just confused; I don't understand how it makes a difference here |
| 09:50:24 | <EvilTerran> | mm_freak_, a Functor must be (* -> *) |
| 09:50:37 | <mm_freak_> | EvilTerran: yeah, i realized just right now |
| 09:50:40 | <EvilTerran> | so you couldn't have a Functor instance for (,) that affected both elements |
| 09:50:52 | <EvilTerran> | > (\ ~(_,_) -> "ok") undefined |
| 09:50:54 | <lambdabot> | "ok" |
| 09:50:57 | <EvilTerran> | > (\ (_,_) -> "not ok") undefined |
| 09:50:58 | <lambdabot> | "* Exception: Prelude.undefined |
| 09:51:03 | <EvilTerran> | idnar, that's why |
| 09:51:09 | <mm_freak_> | luqui: lazy pattern matching? how would that work? |
| 09:51:14 | <mm_freak_> | looking into the future? |
| 09:51:34 | <luqui> | EvilTerran, however I think for swap the two are equivalent (in the subset of haskell without seq) |
| 09:51:35 | <maltem> | mm_freak_: no, just failing later |
| 09:51:39 | <EvilTerran> | mm_freak_, i think luqui is thinking of ~ patterns |
| 09:51:42 | <Leaves> | I have now done data Quad a = Quad a a a a, and then type Word = Quad Word8, but now I do not have a constructor for Word anymore? |
| 09:51:43 | <idnar> | EvilTerran: hmm |
| 09:51:54 | <EvilTerran> | luqui, pretty sure that's not the case |
| 09:52:01 | <mm_freak_> | maltem: i prefer them to fail where they're supposed to fail |
| 09:52:01 | <luqui> | EvilTerran, got a counterexample? |
| 09:52:08 | <EvilTerran> | > (\ (x,y) -> (y,x)) undefined |
| 09:52:09 | <lambdabot> | * Exception: Prelude.undefined |
| 09:52:13 | <EvilTerran> | > (\ ~(x,y) -> (y,x)) undefined |
| 09:52:14 | <lambdabot> | (* Exception: Prelude.undefined |
| 09:52:16 | <mm_freak_> | EvilTerran: ~ patterns? what's that? |
| 09:52:20 | <quicksilver> | Leaves: the constructor is 'Qud' |
| 09:52:25 | <quicksilver> | Leaves: 'Quad' |
| 09:52:38 | <EvilTerran> | luqui, you can tell by the ( in the second one that you've got (_|_, _|_) instead of _|_ |
| 09:52:38 | <maltem> | mm_freak_: indeed ~ patterns aren't used terribly often |
| 09:52:55 | <mm_freak_> | what are ~ patterns? |
| 09:53:01 | <luqui> | EvilTerran, ah yes. I was thinking in my ideal subset of haskell where (_|_, _|_) = _|_, :-) |
| 09:53:10 | <idnar> | EvilTerran: ah, your second example helps me out |
| 09:53:10 | <EvilTerran> | mm_freak_, they're defined in the report |
| 09:53:18 | <luqui> | in which of course it's the same, because ~(a,b) is the same as (a,b) :-) |
| 09:53:23 | <quicksilver> | luqui: it would be bizarrely inconsistent to have tuples lazy by default and all other types are strict by default. |
| 09:53:45 | <EvilTerran> | mm_freak_, http://haskell.org/onlinereport/exps.html#sect3.17.2 |
| 09:53:48 | <Saizan> | mm_freak_: for types with only a constructor there's no way to fail a pattern match, apart from _|_ |
| 09:53:50 | <lambdabot> | Title: The Haskell 98 Report: Expressions |
| 09:53:53 | <quicksilver> | (a,b) shouldn't be any different from data Pair a b = Pair a b |
| 09:54:04 | <luqui> | quicksilver, agreed. I would generalize to all single constructor types |
| 09:54:07 | <EvilTerran> | "Matching the pattern ~apat against a value v always succeeds. The free variables in apat are bound to the appropriate values if matching apat against v would otherwise succeed, and to _|_ if matching apat against v fails or diverges. (Binding does not imply evaluation.)" |
| 09:54:19 | <luqui> | quicksilver, which has its own sort of inconsistency, but also another kind of consistency |
| 09:54:24 | <luqui> | which haskell presently lacks |
| 09:54:27 | <quicksilver> | luqui: yes, that's a supportable view. |
| 09:54:36 | <EvilTerran> | i prefer to have the option |
| 09:54:39 | <Saizan> | Miranda was like that |
| 09:55:00 | <EvilTerran> | it's one extra character to make a strict match into a irrefutable one |
| 09:55:09 | <luqui> | quicksilver, get my email? |
| 09:55:16 | <EvilTerran> | if you had implicit irrefutable matches, i'm not sure how you'd make them strict if you wanted to |
| 09:55:26 | <mm_freak_> | interesting… i didn't know you could enforce lazy pattern matching |
| 09:55:33 | <luqui> | EvilTerran, there would be no such thing as a strict match in the semantics |
| 09:55:39 | <quicksilver> | luqui: yes. |
| 09:56:00 | <luqui> | so you wouldn't be allowed to want to :-) |
| 09:56:02 | <Saizan> | EvilTerran: soemthing like seq of the components, i imagine |
| 09:56:06 | <mm_freak_> | Saizan: so? you mean that pattern matching against a single-constructor type may enforce evaluation unnecessarily? |
| 09:56:12 | <dolio> | You'd use bang patterns. :) |
| 09:56:12 | <EvilTerran> | luqui, i don't follow |
| 09:56:33 | <Saizan> | mm_freak_: yeah, you don't need it to choose between alternatives |
| 09:56:46 | <luqui> | EvilTerran, if (_|_, _|_) = _|_, then what does it mean for a function to strictly match on a tuple, rather than lazily? |
| 09:56:47 | <quicksilver> | EvilTerran: luquis view is that there is no value distinguishing between _|_ and (_|_,_|_) |
| 09:57:04 | <EvilTerran> | i ... see... |
| 09:57:33 | <quicksilver> | EvilTerran: he would rather the laziness was forced to be only at the component-site, not at the pair-constructor site. |
| 09:57:40 | <Leaves> | quicksilver: thanks, that constructor works |
| 09:57:44 | <EvilTerran> | so tuples would pattern-match like newtypes, only with more than one component? |
| 09:58:02 | <mm_freak_> | > (\a@(x,y) -> a `seq` 0) (undefined,undefined) |
| 09:58:04 | <lambdabot> | 0 |
| 09:58:05 | <EvilTerran> | as in, matching against (_,_,...,_) would always succeed |
| 09:58:08 | <mm_freak_> | there is =) |
| 09:58:13 | <luqui> | EvilTerran, roughly yes... |
| 09:58:30 | <Leaves> | why is a list not an instance of Functor (ie, why is there map for a list and not fmap)? |
| 09:58:37 | <mm_freak_> | Leaves: it is |
| 09:58:38 | <EvilTerran> | there is an instance |
| 09:58:43 | <EvilTerran> | there's just map as well |
| 09:58:45 | <mm_freak_> | > fmap (+1) [1,2,3] |
| 09:58:47 | <lambdabot> | [2,3,4] |
| 09:58:55 | <mm_freak_> | map is a special case of fmap |
| 09:58:57 | <luqui> | > (+1) . [1.2.3] |
| 09:58:58 | <EvilTerran> | @check \f xs -> map f xs == fmap f (xs :: [Int]) |
| 09:58:58 | <lambdabot> | Couldn't match expected type `a -> b' against inferred type `[a1]' |
| 09:58:58 | <lambdabot> | Overlapping instances for Show (Int -> b) |
| 09:58:59 | <lambdabot> | arising from a use of ... |
| 09:59:00 | <sjanssen> | luqui: I'm having trouble finding it in the logs, what exactly are you proposing? |
| 09:59:07 | <EvilTerran> | er |
| 09:59:09 | <luqui> | aww no CalePrelude anymore (that could be good) |
| 09:59:18 | <Leaves> | mm, but couldn't map just be removed and fmap be renamed map? |
| 09:59:21 | <luqui> | sjanssen, that (_|_,_|_) = _|_ |
| 09:59:32 | <mm_freak_> | Leaves: yes, it could |
| 09:59:33 | <sjanssen> | hmm |
| 09:59:33 | <luqui> | sjanssen, (and the generalization to all single-constructor datatypes) |
| 09:59:37 | <EvilTerran> | Leaves, some people want that |
| 09:59:38 | <mm_freak_> | and IIRC it used to be that way |
| 09:59:51 | <Leaves> | I think that would look nicer |
| 09:59:53 | <EvilTerran> | Leaves, but it's not been done that way. blame the simons. |
| 09:59:54 | <sjanssen> | luqui: so "data (,) a b = (,) !a !b"? |
| 09:59:56 | <mm_freak_> | i wouldn't replace map by fmap, but i'd rename the functions |
| 09:59:56 | <luqui> | Leaves, some people even want fmap to be removed and renamed to (.) |
| 10:00:05 | <luqui> | sjanssen, no! |
| 10:00:09 | <mm_freak_> | like map → lmap and fmap → map |
| 10:00:16 | <luqui> | sjanssen, because then (_|_,42) = _|_ |
| 10:00:32 | <sjanssen> | luqui: this seems like a significant change |
| 10:00:35 | <luqui> | sjanssen, more or less, every tuple pattern match would be lazy. |
| 10:00:45 | <dibblego> | fmap → (.) |
| 10:00:48 | <sjanssen> | luqui: I think this will cause massive space leaks |
| 10:00:58 | <luqui> | sjanssen, yes it is. It isn't a formal proposal, I like haskell how it is. I think it would be the slightest bit cleaner with this change :-) |
| 10:00:59 | <EvilTerran> | sjanssen, the idea is that (\(_,_) -> ...) _|_ would work |
| 10:01:06 | <luqui> | sjanssen, do you have an example? |
| 10:01:22 | <EvilTerran> | i'm happy putting in ~s when i want that behaviour |
| 10:01:22 | <luqui> | sjanssen, or some indication to why you think it would cause space leaks? |
| 10:01:36 | <EvilTerran> | as can be seen by the line that started this whole discussion |
| 10:01:41 | <luqui> | EvilTerran, aye, me too, it's not so bad. I just found that I started putting ~ everywhere :-) |
| 10:01:59 | <EvilTerran> | [10:48] <EvilTerran> pastorn, i'd suggest just defining "swap ~(x,y) = (y,x)" |
| 10:02:07 | <EvilTerran> | ^ it's my fault :/ |
| 10:02:08 | <mm_freak_> | luqui: honestly i've never had problems with strict pattern matching, and i wouldn't know where lazy pattern matching has advantages for me |
| 10:02:24 | <mm_freak_> | seems like if you don't know that that exists, you don't really need it… same as arrows =) |
| 10:02:27 | <pastorn> | EvilTerran: doesn't look as mysterious |
| 10:02:37 | <luqui> | mm_freak_, it gets really hairy once you start doing funny recursion stuff |
| 10:02:41 | <EvilTerran> | pastorn, it only looks mysterious the first time you see it, imo |
| 10:02:41 | <Saizan> | luqui: there was recently a thread on an huge space leak caused by lazy tuple matching in a let |
| 10:02:52 | <luqui> | mm_freak_, interestingly, the place it first got hairy for me was the first day I was exposed to arrows :-) |
| 10:02:57 | <EvilTerran> | after that, you know what it is, and it loses its mystery |
| 10:03:03 | <mm_freak_> | hehe |
| 10:03:08 | <pastorn> | > swap ~(1,2) |
| 10:03:08 | <lambdabot> | mueval: SrcLoc {srcFilename = "<unknown>.hs", srcLine = 3, srcColumn = 1} |
| 10:03:08 | <lambdabot> | ... |
| 10:03:14 | <sjanssen> | luqui: because all variables matched in a tuple are actually thunks, eg. "fst foo", "snd foo" |
| 10:03:15 | <Saizan> | luqui: and apparently it's a known problem for which there are special optimizations in GHC |
| 10:03:18 | <pastorn> | > swap (1,2) |
| 10:03:19 | <lambdabot> | Not in scope: `swap' |
| 10:03:22 | <sjanssen> | luqui: become thunks, tha tis |
| 10:03:23 | <EvilTerran> | pastorn, ~ is for patterns, not expressions |
| 10:03:31 | <pastorn> | huh? |
| 10:03:37 | <pastorn> | never used before... |
| 10:03:42 | <pastorn> | how does it work? |
| 10:03:42 | <EvilTerran> | @let swap ~(x,y) = (y,x); swap' (x,y) = (y,x) |
| 10:03:43 | <lambdabot> | Defined. |
| 10:03:44 | <luqui> | Saizan, hmmm interesting |
| 10:03:56 | <EvilTerran> | pastorn, http://haskell.org/onlinereport/exps.html#sect3.17.2 |
| 10:03:57 | <lambdabot> | Title: The Haskell 98 Report: Expressions |
| 10:04:00 | <sjanssen> | Wadler's "full laziness" optimization is related to this, right? |
| 10:04:24 | <ivanm> | what's the difference between Network.URI and Network.URL? |
| 10:04:44 | <EvilTerran> | i don't have a Network.URL... |
| 10:04:46 | <Saizan> | luqui: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/44708 |
| 10:04:48 | <EvilTerran> | there's one difference :P |
| 10:04:50 | <lambdabot> | Title: Gmane Loom |
| 10:05:20 | <ivanm> | EvilTerran: heh |
| 10:05:26 | <ivanm> | http://hackage.haskell.org/packages/archive/url/1.0.1/doc/html/Network-URL.html |
| 10:05:27 | <lambdabot> | Title: Network.URL, http://tinyurl.com/3nefbn |
| 10:05:30 | <ivanm> | it's in the url package |
| 10:05:40 | <EvilTerran> | ivanm, URI and URL are both defined at tedious and confusing length by the w3c |
| 10:05:58 | <ivanm> | *nod* |
| 10:06:15 | <EvilTerran> | although those two look like they serve much the same purpose |
| 10:06:17 | <ivanm> | all I want is the ability for people to include a URL which will then get printed as part of a generated document... |
| 10:06:31 | <ivanm> | should I even bother with either, or just use a String? |
| 10:07:12 | <EvilTerran> | i'd probably just use a string |
| 10:07:19 | <ivanm> | *nod* |
| 10:07:28 | <EvilTerran> | give it a type alias so your type sigs are more self-documenting |
| 10:07:42 | <EvilTerran> | type URL = String or something |
| 10:07:52 | <ivanm> | I think I'll stick with FilePath for local locations, since that will actually use and manipulate files |
| 10:09:46 | <ivanm> | *sigh* not again... |
| 10:09:56 | <lilac> | good ol' freenode |
| 10:10:04 | <papermachine> | forever net-split |
| 10:15:33 | <Leaves> | is there also a class for fzip like Functor is for fmap? |
| 10:16:37 | <luqui> | Leaves, Applicative, sortof. |
| 10:16:45 | <wjt> | fzip :: (a -> b -> c) -> f a -> f b -> f c ? |
| 10:18:02 | <luqui> | ACTION loves Applicative with most of his heart |
| 10:18:08 | <dolio> | Applicative isn't really guaranteed to be zippish. |
| 10:18:29 | <luqui> | dolio, what law would you expect of zip that Applicative breaks? |
| 10:18:56 | <dolio> | The Applicative instance for [] doesn't zip lists. |
| 10:19:07 | <dolio> | The one for ZipList does, of course. |
| 10:19:11 | <luqui> | yes that is true. what law expresses "zippishness" though? |
| 10:19:37 | <luqui> | I'm just having trouble visualizing that... |
| 10:19:37 | <dolio> | I'm not sure there's any law that expresses it. |
| 10:19:51 | <EvilTerran> | Leaves, Data.Generics.Twins can do it |
| 10:19:57 | <luqui> | well then it's awful hard to enforce via a typeclass :-) |
| 10:20:30 | <dolio> | Presumably a zip identifies common structure between two functor-ish (or not, even) values, and combines things at corresponding positions. |
| 10:20:36 | <EvilTerran> | Leaves, and category-extras has Control.Functor.Zip |
| 10:20:56 | <luqui> | dolio, maybe the law is expressible via Traversable then? |
| 10:21:35 | <EvilTerran> | Control.Functor.Zip.fzip :: Zip f => f a -> f b -> f (a, b) |
| 10:21:41 | <EvilTerran> | http://hackage.haskell.org/packages/archive/category-extras/0.53.5/doc/html/Control-Functor-Zip.html |
| 10:21:42 | <lambdabot> | Title: Control.Functor.Zip, http://tinyurl.com/4wbucw |
| 10:21:48 | <Leaves> | I think that looks like what I want |
| 10:22:23 | <EvilTerran> | category-extras is a bit arcane, mind |
| 10:22:29 | <Saizan> | luqui: zipWith f (toList x) (toList y) == toList (fzip f x y) ? a bit restrictive |
| 10:22:29 | <Leaves> | *thinks he is making haskell programming to hard for hisselve.. |
| 10:23:13 | <EvilTerran> | note Control.Functor.Zip.counbizip :: (PreCoCartesian r sr, PreCoCartesian s ss, PreCoCartesian t st, Bifunctor q r s t) => t (st (q a c) (q b d)) (q (sr a b) (ss c d)) |
| 10:23:22 | <EvilTerran> | i think they might've got a bit carried away there |
| 10:23:25 | <EvilTerran> | :P |
| 10:23:35 | <Leaves> | :) |
| 10:23:45 | <luqui> | Saizan, well it may or may not be too restrictive, but I think it misses the "essence" either way... |
| 10:23:51 | <EvilTerran> | ... |
| 10:24:10 | <EvilTerran> | ACTION needs to work out how to stop xchat showing all the comings and goings in a netsplit |
| 10:24:12 | <Axman6> | god damnit freenode |
| 10:24:16 | <EvilTerran> | but still show people coming and going otherwise |
| 10:24:23 | <Leaves> | mm, currently tha lib is still plain haskell98, so maybe I should just define myZip and stick with the std libraries :) |
| 10:24:26 | <Axman6> | EvilTerran: get irssi |
| 10:24:30 | <luqui> | EvilTerran, category-extras is *about* maximizing carried-awayness |
| 10:24:43 | <Axman6> | it's bve3en failing a bit with the overjoins, but doing ok most of the time |
| 10:24:50 | <luqui> | EvilTerran, right click on the channel name |
| 10:25:03 | <EvilTerran> | Axman6, "how do i fix xchat?" "install irssi" is a bit of a non-sequiteur |
| 10:25:13 | <EvilTerran> | it should be fairly straightforward to write an extension for what i want |
| 10:25:23 | <quicksilver> | you can zip traversabale to foldable |
| 10:25:23 | <luqui> | EvilTerran, there's an option to disable join/part messages. |
| 10:25:27 | <Saizan> | heh, i got the join flood on irssi this time |
| 10:25:30 | <luqui> | not perfect but it'll do |
| 10:25:30 | <EvilTerran> | luqui, yeah, i see that, but i like to know when individuals are coming and going |
| 10:25:31 | <quicksilver> | wowo |
| 10:25:34 | <quicksilver> | you can zip traversabale to foldable |
| 10:25:34 | <luqui> | ah |
| 10:25:39 | <quicksilver> | I was just saying. |
| 10:25:52 | <quicksilver> | (with the structure coming from the traversable) |
| 10:26:06 | <luqui> | quicksilver, not really sure what you're saying, but it sounds cool. |
| 10:26:09 | <dolio> | That doesn't identify common structure, though. It just takes it from one or the other. |
| 10:26:13 | <quicksilver> | yes |
| 10:26:22 | <quicksilver> | but that's true of the list zip |
| 10:26:30 | <quicksilver> | it arbitrarily takes the structure of the shorter list. |
| 10:26:56 | <quicksilver> | luqui: Traversable t, Foldable f => t a -> f b -> t (a,b) |
| 10:27:11 | <quicksilver> | without the ability to 'check for common structures at the type level' |
| 10:27:20 | <quicksilver> | (e.g. list length, tree shape) you're a bit stuck. |
| 10:27:47 | <dolio> | What do you put in the t if there aren't enough bs in the f? |
| 10:28:30 | <luqui> | dolio, lol |
| 10:28:54 | <luqui> | I love that we're in a field where that sentence is sensical |
| 10:29:07 | <dolio> | :) |
| 10:29:33 | <quicksilver> | dolio: I error out, IIRC |
| 10:30:19 | <EvilTerran> | ACTION concludes that he has no idea how to work Data.Generics.Twins.gzip :: GenericQ (GenericM Maybe) -> GenericQ (GenericM Maybe) |
| 10:32:15 | <ivanm> | with System.Directory, what happens if it can't create the directory due to permission problems, etc.? |
| 10:33:06 | <quicksilver> | ivanm: exception, I presume |
| 10:33:26 | <quicksilver> | ivanm: yes, there is a list of exceptions it can throw, in the docs. |
| 10:33:33 | <ivanm> | is there a "safe" way of doing so? i.e. something like FilePath -> IO Bool, where it returns True if it was successful? |
| 10:33:49 | <quicksilver> | catch the exception ;) |
| 10:33:56 | <mib_4avzu3> | Write a Haskell function countChange that calculates the number of different ways we can make change of n cents, given denominations of 1 cent, 2 cents, … , d cents ( i.e. if d=5, the denominations of coins available are 5 cents, 4 cents, 3 cents, 2 cents and 1 cent ) |
| 10:34:02 | <ivanm> | you can catch exceptions? :o |
| 10:34:03 | <besiria> | what regex library should i use? |
| 10:34:07 | <quicksilver> | in IO you can, yes. |
| 10:34:09 | <ivanm> | for some reason, I thought you couldn't do that... :s |
| 10:34:11 | <mib_4avzu3> | that's my ques, is thee anyone who can help me |
| 10:34:13 | <quicksilver> | othetwise they'd be pretty useless. |
| 10:34:14 | <mib_4avzu3> | with this |
| 10:34:16 | <mib_4avzu3> | please |
| 10:34:26 | <ivanm> | (the good old try-catch-finally blocks in Java... *shudder*) |
| 10:34:30 | <mib_4avzu3> | fell asleep earlier |
| 10:34:37 | <ivanm> | @hoogle catch |
| 10:34:37 | <lambdabot> | package catch |
| 10:34:37 | <lambdabot> | Prelude catch :: IO a -> (IOError -> IO a) -> IO a |
| 10:34:37 | <lambdabot> | Control.Exception catch :: IO a -> Exception -> IO a -> IO a |
| 10:34:40 | <dolio> | Hahaha. |
| 10:35:32 | <quicksilver> | I note that exception-throwing code composes much better than Bool-returning code |
| 10:35:47 | <quicksilver> | (although 'exception-throwing' could be Maybe/Error monad instead of IO exceptions) |
| 10:35:55 | <mib_4avzu3> | ?? |
| 10:36:07 | <quicksilver> | mib_4avzu3: this isn't #homework-help |
| 10:36:20 | <quicksilver> | mib_4avzu3: we'll be delighted to answer specific questions and help you with attempts that don't work. |
| 10:37:10 | <mib_4avzu3> | well i don't seem too know how to make it pull out the possible combinations of cents |
| 10:37:36 | <luqui> | dolio, the zip property: fzip (funzip a) = a where funzip = fmap fst &&& fmap snd |
| 10:37:44 | <luqui> | (taking fzip :: f a -> f b -> f (a,b)) |
| 10:38:06 | <dolio> | Oh, Hmm... |
| 10:38:16 | <quicksilver> | I think you have a missing 'uncurry' luqui |
| 10:38:24 | <quicksilver> | but the point you're making is clear enough :) |
| 10:38:31 | <dolio> | Yeah, that's pretty good. |
| 10:38:35 | <luqui> | quicksilver, you're right |
| 10:38:39 | <EvilTerran> | mib_4avzu3, if i remember right, your function took the number of cents to make change for as its first parameter, and the highest denomination of coin as its second parameter |
| 10:38:43 | <EvilTerran> | mib_4avzu3, is that right? |
| 10:39:24 | <dolio> | That allows quicksilver's version to qualify, though, so I must oppose you. :) |
| 10:39:25 | <quicksilver> | luqui's property is satisfied by my version |
| 10:39:40 | <Saizan> | http://comonad.com/reader/2008/zipping-and-unzipping-functors/ <- oh, btw :) |
| 10:39:43 | <quicksilver> | as long as your Traversable instance is compatible with your Foldable one. |
| 10:39:50 | <lambdabot> | Title: The Comonad.Reader » Zipping and Unzipping Functors |
| 10:39:54 | <quicksilver> | which should probably go without saying. |
| 10:40:20 | <luqui> | Saizan, actually the follow-up article "cozipping" is the inspiration for above property |
| 10:40:37 | <EvilTerran> | ... |
| 10:40:40 | <EvilTerran> | i don't know why i bother |
| 10:40:45 | <EvilTerran> | sometimes |
| 10:40:53 | <besiria> | what is the diff between regex-pcre and regex-pcre-builtin packages: |
| 10:41:50 | <quicksilver> | dolio: but do you think you can do any better, without embedding a whole lot more into the type system? |
| 10:42:14 | <dolio> | No, certainly not. |
| 10:42:33 | <quicksilver> | ACTION nods |
| 10:42:40 | <quicksilver> | in that case I'm happy with my version |
| 10:43:00 | <dolio> | I'd just make a Zip class and handwave the 'that's a zip, that's not' qualifications. |
| 10:43:09 | <luqui> | dolio, me too |
| 10:43:12 | <quicksilver> | and will point people cheerfully to http://www.haskell.org/haskellwiki/Foldable_and_Traversable |
| 10:43:14 | <lambdabot> | Title: Foldable and Traversable - HaskellWiki |
| 10:43:24 | <dolio> | Or not. I'm not sure I've ever desired a generalized zip. |
| 10:43:41 | <luqui> | we wanted one for perl 6 for some silly reason... |
| 10:43:52 | <luqui> | ah yes, hyperoperators |
| 10:44:20 | <Saizan> | dolio: you haven't worked enough with comonadic intepreters, then. (unsurprisingly :) |
| 10:44:33 | <quicksilver> | although |
| 10:44:39 | <dolio> | I guess not. :) |
| 10:44:46 | <quicksilver> | fons-- # suggesting that using State instead of Supply is an 'advantage' |
| 10:45:17 | <dolio> | What do you use those for? Dataflow languages? |
| 10:45:17 | <luqui> | quicksilver, you mean Data.Supply? |
| 10:45:31 | <quicksilver> | well I wrote my own mini-supply monad |
| 10:45:47 | <quicksilver> | it's just a stream treated as a pop-only stack |
| 10:46:07 | <luqui> | oh. state with restricted operations |
| 10:46:11 | <quicksilver> | indeed. |
| 10:46:18 | <luqui> | yeah that's one I keep rewriting :-) |
| 10:46:20 | <quicksilver> | But everything is just State+Cont with restricted operations. |
| 10:46:27 | <luqui> | heh :-) |
| 10:46:33 | <quicksilver> | for that matter, all types are Integer with restricted operations. |
| 10:46:33 | <Saizan> | dolio: yeah |
| 10:47:20 | <luqui> | quicksilver, actually.... |
| 10:48:09 | <luqui> | I think you're wrong there. Obviously it's true from a strict "computational-power" perspective, but once you go back into Haskell, Integer is not expressive enough to capture laziness |
| 10:48:13 | <Saizan> | quicksilver: i'm not a number! i'm a free ADT! |
| 10:48:30 | <quicksilver> | luqui: well you'd need to embed a complete haskell interpreter, yes. |
| 10:48:52 | <quicksilver> | luqui: without doing that I'm not absolutely sure what the universal structure is |
| 10:48:57 | <quicksilver> | probably something like Tree Int? |
| 10:49:17 | <quicksilver> | anyhow, the point is that the "that's just *foo* with restricted operations" is sometimes said as if it was a criticism. |
| 10:49:23 | <quicksilver> | but it really shouldn't be; it should be a compliment. |
| 10:49:27 | <luqui> | ACTION didn't intend it that way |
| 10:49:31 | <quicksilver> | Type systems are all about restricting operations. |
| 10:49:35 | <quicksilver> | no, but fons apparently did. |
| 10:49:35 | <luqui> | criticism I mean |
| 10:49:44 | <luqui> | ah |
| 10:50:03 | <luqui> | anyway Data.Supply is nicer than Supply anyway for stuff like unique identifiers |
| 10:50:20 | <luqui> | I mean... sortof. it's less deterministic, but it has nice parallelism properties |
| 10:50:44 | <luqui> | heh "less deterministic" |
| 10:50:46 | <quicksilver> | yeah, Data.Supply is somethign slightly different. |
| 10:51:48 | <luqui> | so... not to pry... but any chance I can get that reactive from you. sorry if I'm being a bother. |
| 10:51:56 | <quicksilver> | heh |
| 10:52:00 | <quicksilver> | that's not prying it's nagging :P |
| 10:52:05 | <luqui> | er yeah |
| 10:52:35 | <quicksilver> | sent. |
| 10:52:42 | <luqui> | there is a company that wishes to depend upon it :-) maybe you should change for it :-) |
| 10:52:55 | <luqui> | muchas gracias |
| 10:53:01 | <luqui> | *charge |
| 10:53:32 | <quicksilver> | heh. |
| 10:53:50 | <quicksilver> | It's still not deterministic for nearly-simultaneous events. |
| 10:53:57 | <quicksilver> | I wouldn't personally recommend it over conal's impl. |
| 10:54:01 | <luqui> | lol |
| 10:54:06 | <quicksilver> | But you're welcome to pore over it and see what you can see. |
| 10:54:10 | <luqui> | it works does it not? |
| 10:54:14 | <quicksilver> | it works, yes. |
| 10:54:18 | <quicksilver> | at least in my tests. |
| 10:54:22 | <luqui> | then I would recommend it over conal's |
| 10:54:30 | <luqui> | (although I do find his quite beautiful) |
| 10:54:49 | <luqui> | it just has very subtle issues |
| 10:54:56 | <luqui> | whereas yours is more direct |
| 10:58:22 | <hackage> | Uploaded to hackage: AERN-Real 0.9.7.1 |
| 10:58:28 | <luqui> | You might be interested, quicksilver, actually. I believe I am quite close to a beautiful and efficient frp which is quite different. It uses type-level times. |
| 10:58:46 | <luqui> | but "closeness" is a hard thing to judge for this kind of thing |
| 10:59:05 | <mm_freak_> | how do i define class derivation rules? |
| 10:59:06 | <quicksilver> | luqui: I will certainly be interested. |
| 10:59:11 | <quicksilver> | mm_freak_: (a) you don't. |
| 10:59:20 | <quicksilver> | mm_freak_: (b) see Data.Derive, DrIFT, or TH. |
| 10:59:30 | <mm_freak_> | hehe ok |
| 10:59:38 | <mm_freak_> | i'll try not to do =) |
| 10:59:50 | <quicksilver> | there is no standard way to express derivations |
| 10:59:53 | <quicksilver> | but TH is capable of it, of course |
| 10:59:55 | <lilac> | mm_freak_: (c) hack on GHC :) |
| 11:00:01 | <quicksilver> | and Data.Derive and DrIFT are tools for it. |
| 11:00:59 | <Stinger_> | http://www.explosm.net/comics/1415/ |
| 11:01:00 | <lambdabot> | Title: Comics - Explosm.net |
| 11:01:01 | <luqui> | quicksilver, the essence is a monad: At t a, which represents a value of type a at time t, together with a type relation t :< t'. Behavior t a = forall t'. t :< t' -> At t' a |
| 11:01:14 | <Stinger_> | aaand that was the wrong channel to post that, sorry |
| 11:01:52 | <quicksilver> | luqui: interesting. |
| 11:02:13 | <luqui> | which makes t' a region variable in Behavior, which you can use to enforce a monotonicity property |
| 11:02:35 | <luqui> | (that the value of a bound behavior is only demanded in a monotone fashion), and that allowed a nice optimization |
| 11:02:41 | <luqui> | I'll blog about it soon |
| 11:03:08 | <luqui> | but I don't *have* it, yet, which is distressing. still hard to implement just right... |
| 11:03:23 | <mm_freak_> | luqui: that somehow sounds similar to uniqueness types |
| 11:03:29 | <papermachine> | How many different FRP implementations are there now? |
| 11:03:40 | <luqui> | papermachine, many many many.... most of them have problems |
| 11:04:02 | <luqui> | mm_freak_, actually, support for linear types allows that same optimization ;-) |
| 11:04:17 | <luqui> | mm_freak_, (linear types are similar to uniqueness types) |
| 11:04:25 | <mm_freak_> | yeah… i'd be happy to see those in haskell |
| 11:04:44 | <mm_freak_> | that would turn a lot of monadic code into non-monadic code |
| 11:05:04 | <luqui> | ACTION has no problem with monads. |
| 11:05:21 | <mm_freak_> | yeah, but i find it evil to use monads just to enforce destructive update |
| 11:05:21 | <luqui> | I like the cleanliness of do-notation for a lot of things. |
| 11:05:35 | <luqui> | mm_freak_, I find destructive update evil. |
| 11:05:37 | <mm_freak_> | where otherwise declarative manner would be fine |
| 11:05:41 | <luqui> | no matter what you use to enforce it |
| 11:06:05 | <luqui> | or you mean destructive update as an optimization technique? |
| 11:06:08 | <mm_freak_> | destructive update is often the way to go… if you have a value, which you change into another and then never refer back again, you want destructive update for speed |
| 11:06:13 | <mm_freak_> | yes |
| 11:06:20 | <luqui> | okay I haven't any problem with that :-) |
| 11:06:36 | <luqui> | but IORef I have a problem with, whether it is implemented in IO or with a uniqueness type |
| 11:06:55 | <luqui> | not to say I don't use it :-) |
| 11:07:02 | <mm_freak_> | and linear/uniqueness types are a means to declare types as such explicitly… that would allow GHC to do quite insane optimizations =) |
| 11:07:14 | <luqui> | I just don't use it anywhere but in the guts of a nice abstraction |
| 11:07:24 | <mm_freak_> | IORef is not what i'm referring to, but rather things like IArray |
| 11:07:26 | <mm_freak_> | uhm |
| 11:07:29 | <mm_freak_> | MArray i mean |
| 11:08:58 | <luqui> | mm_freak_, yeah. As a purely personal opinion, I find monads nicer for non-combinatory things (i.e. where there's no function a -> a -> a on your type). |
| 11:09:24 | <luqui> | and they are utterly horrible if you do have such a combinator |
| 11:09:35 | <mm_freak_> | yeah |
| 11:10:34 | <luqui> | hmm you just convinced me though |
| 11:10:35 | <mm_freak_> | and such types would also allow one to describe highly imperative algorithms declaratively, like the sieve of eratosthenes, which i currently implement using STUArray |
| 11:10:42 | <kig> | writing the equivalent of an eager readFile in asm sure makes one appreciate more convenient languages |
| 11:11:08 | <luqui> | since you could use support for uniqueness types to prove that your monad instance satisfies uniqueness |
| 11:11:38 | <mm_freak_> | i wonder if you could make uniqueness types without hacking on GHC |
| 11:11:51 | <dolio> | Not having uniqueness typing essentially means you have to throw everyting in ST to get the optimization. |
| 11:11:53 | <luqui> | mm_freak_, you mean using a type system hack? |
| 11:12:07 | <mm_freak_> | yeah |
| 11:12:30 | <luqui> | mm_freak_, after having thoroughly explored the idea when trying to get linear types (for aforementioned optimization), I will conject: no |
| 11:12:53 | <luqui> | or perhaps yes with a *lot* of garbage overhead in the way |
| 11:13:02 | <mm_freak_> | leaving the optimization aside, couldn't you disallow threading somehow? |
| 11:13:25 | <luqui> | mm_freak_, yes there was one way |
| 11:13:35 | <luqui> | using region variables and continuation passing style |
| 11:13:41 | <mm_freak_> | how? maybe a Unique monad, which is similar to Id? |
| 11:13:45 | <luqui> | it was hell hard to work with |
| 11:13:55 | <luqui> | I'll see if I kept that experiment |
| 11:14:05 | <luqui> | I didn't get very far because CPS is such a bitch |
| 11:14:15 | <luqui> | especially when combined with complicated types |
| 11:14:35 | <mm_freak_> | yeah |
| 11:14:36 | <luqui> | mm_freak_, you could make a monad, but then you wouldn't get the ability for combinators |
| 11:15:50 | <mm_freak_> | true |
| 11:16:05 | <mm_freak_> | i guess, a GHC hack is the best one could do |
| 11:16:23 | <luqui> | yeah that would definitely be the way to go imo |
| 11:16:25 | <mm_freak_> | this is probably the only virtue of Clean that's missing in haskell |
| 11:16:29 | <luqui> | unfortunately.... |
| 11:16:42 | <luqui> | mm_freak_, doesn't clean have serialization? |
| 11:16:55 | <mm_freak_> | serialization? |
| 11:16:55 | <dolio> | Clean's dynamics are supposed to be better than what you have in GHC, too. |
| 11:17:23 | <luqui> | mm_freak_, freeze/thaw |
| 11:17:38 | <mm_freak_> | you don't need that in Clean, AFAIK |
| 11:17:41 | <luqui> | maybe it doesn't, and dynamics is what I was thinking of |
| 11:17:56 | <luqui> | mm_freak_, oh no not that kind of freeze thaw |
| 11:18:01 | <luqui> | I mean writing a value to disk |
| 11:18:05 | <luqui> | for example |
| 11:18:13 | <Deewiant> | show/read? |
| 11:18:17 | <dolio> | Pickling, marshalling, ... |
| 11:18:19 | <mm_freak_> | Clean has no such explicit separation of pure and impure world like haskell |
| 11:18:39 | <luqui> | mm_freak_, sure it does |
| 11:18:57 | <dolio> | The impure world is the one where you pass RealWorld tokens manually. |
| 11:19:03 | <quicksilver> | writing data to disk is easy; the question is whether or not you can write functions and thunks. |
| 11:19:06 | <quicksilver> | (to disk) |
| 11:19:16 | <luqui> | quicksilver, aye. |
| 11:19:30 | <mm_freak_> | yeah… impure operations in Clean are expressed in a more straightforward way… no things like monads and stuff |
| 11:19:50 | <luqui> | mm_freak_, depends on your definition of straightforward. |
| 11:19:58 | <quicksilver> | I think it's up for discussion whether linear uniqueness typing is really more straightforward than monads |
| 11:20:04 | <mm_freak_> | it just makes sure that you don't thread the world's state |
| 11:20:05 | <quicksilver> | but it may *look* more straightforward. |
| 11:20:12 | <luqui> | I find haskell to be just as straightforward, once you understand that IO is not a magic token and just an opaque functor like any other |
| 11:20:32 | <quicksilver> | interestingly GHC's implementation of IO uses magic token passing. |
| 11:20:37 | <Deewiant> | ?src IO |
| 11:20:38 | <lambdabot> | newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #)) |
| 11:20:41 | <quicksilver> | which suggests that the two are not really that different. |
| 11:20:49 | <mm_freak_> | quicksilver: they haven't invented a totally new concept of expressing computations, like haskell has… in that way it's a bit more straightforward |
| 11:20:57 | <luqui> | quicksilver, haha. by magic token I meant token in the parsing sense |
| 11:21:06 | <mm_freak_> | it's what you would expect when looking at the referential transparency problem for the first time |
| 11:21:08 | <luqui> | i.e. IO is something you "mark" impure types with |
| 11:21:08 | <quicksilver> | luqui: yeah, sorry, bad juxtaposition of phrases |
| 11:21:18 | <quicksilver> | luqui: I was already composing my sentence before yours appeared |
| 11:21:24 | <luqui> | haha :-) |
| 11:21:25 | <mmorrow> | dolio: do you know any particulars about Clean's Dynamics? |
| 11:21:31 | <mm_freak_> | let me add, i like haskell's approach much more |
| 11:22:01 | <dolio> | mm_freak_: All Haskell has done is written combinators so you don't have to pass things around manually. |
| 11:22:08 | <luqui> | once you get down to it, I don't think I would care |
| 11:22:11 | <mm_freak_> | but Clean code optimizes better usually, because there are some type level quirks, which haskell doesn't feature |
| 11:22:12 | <dolio> | Presumably, at least. I don't know what kind of sugar Clean has. |
| 11:22:21 | <luqui> | so little of my programs are in IO these days, it doesn't matter either way :-) |
| 11:22:57 | <dolio> | mmorrow: I know the Typeable like stuff in Clean is more integrated into the compiler, so I think it has less limitations than what has been done Data.Typeable and Data.Dynamic and such. |
| 11:23:31 | <luqui> | ACTION likes the explicit Typeable though. it gives you free theorems |
| 11:23:38 | <dolio> | I think you might be able to make a dynamic wrapper of a polymorphic value, for instance. |
| 11:24:31 | <quicksilver> | is that really a fault with Typeable though? |
| 11:24:38 | <quicksilver> | I thought that was more a fault with haskell |
| 11:24:39 | <mmorrow> | dolio: hmm. it's on my list to re-look at the reimplem of Dynamic by hs-plugins to get around the Typeable constraint. It'd be great to drop that.. |
| 11:24:45 | <quicksilver> | that polymorphic values aren't truly first-class. |
| 11:24:52 | <mmorrow> | hmm |
| 11:25:18 | <dolio> | Perhaps. |
| 11:25:25 | <luqui> | but in ghc, aren't they? |
| 11:25:55 | <mmorrow> | is that the same as saying "once you put something in an existential box, you can't put it back into the typesystem" (or something)? |
| 11:26:00 | <mmorrow> | like |
| 11:26:00 | <luqui> | ACTION 's ideal language is an extension of his coq |
| 11:26:03 | <quicksilver> | in ghc's implementaiton, polymorphic values are truly first class, yes. |
| 11:26:23 | <quicksilver> | but the syntax of haskell doesn't quite capture that |
| 11:26:27 | <mmorrow> | newtype Box = forall a. Box a |
| 11:26:29 | <quicksilver> | until you add higher rank types, at least. |
| 11:26:41 | <mapreduce> | @hoogle (a -> b) -> (a -> Maybe b) |
| 11:26:42 | <lambdabot> | Prelude ($) :: (a -> b) -> a -> b |
| 11:26:42 | <lambdabot> | Prelude ($!) :: (a -> b) -> a -> b |
| 11:26:42 | <lambdabot> | Data.Function ($) :: (a -> b) -> a -> b |
| 11:26:52 | <quicksilver> | mmorrow: have a look at http://www.haskell.org/pipermail/haskell-cafe/2008-May/042809.html |
| 11:26:55 | <lambdabot> | Title: [Haskell-cafe] Data.Dynamic over the wire, http://tinyurl.com/5hdut4 |
| 11:26:56 | <quicksilver> | mmorrow: and especially replies to it. |
| 11:27:14 | <mmorrow> | awesome, every time i forget about that, i get re-linked to it :) |
| 11:27:22 | <luqui> | mapreduce, I can't fathom what you want that function to do |
| 11:27:28 | <chr1s> | mapreduce: (.) Just |
| 11:27:40 | <luqui> | other than that of course |
| 11:27:47 | <quicksilver> | mmorrow: jhc's implementation of stuff is often a source of inspiration when you want to step outside the GHC box. |
| 11:27:53 | <chr1s> | or would you rather have (a -> b) -> (Maybe a -> Maybe b), that's called fmap |
| 11:28:00 | <dolio> | There's still no way to write things such that 'typeOf foo' yields a type rep of 'forall n. Num n => n', though. |
| 11:28:01 | <mmorrow> | jhc is cool indeed |
| 11:28:01 | <mapreduce> | I would not rather have that. |
| 11:28:07 | <mapreduce> | I'm looking for a good name for that function. |
| 11:28:13 | <dolio> | As far as I know. |
| 11:28:24 | <mmorrow> | dolio: yeah, suckage (afaik) |
| 11:28:26 | <quicksilver> | :t (Just .) |
| 11:28:27 | <lambdabot> | forall b a. (a -> b) -> a -> Maybe b |
| 11:28:32 | <quicksilver> | is as good a name as any |
| 11:28:33 | <quicksilver> | IMO> |
| 11:28:44 | <luqui> | mapreduce, "total" |
| 11:28:55 | <luqui> | mapreduce, meaning it marks a function as total, and casts it into the type of partial functions |
| 11:29:24 | <luqui> | but I would use (Just .) in most cases, because it's simple enough... |
| 11:29:44 | <luqui> | the spelling (.) Just is more elusive for some reason |
| 11:29:52 | <zyb> | . |
| 11:30:21 | <quicksilver> | well sections are great, once you get used to it. |
| 11:30:45 | <quicksilver> | they're extremely obfuscating until you're used to them though. |
| 11:30:50 | <quicksilver> | tis very subjective! |
| 11:31:15 | <mapreduce> | I didn't think functions that returned Maybes were partial functions. |
| 11:31:23 | <mapreduce> | I thought, say, head, was a partial function. |
| 11:31:28 | <mapreduce> | But I can see the equivalence. |
| 11:31:55 | <SamB_XP> | mapreduce: functions that return Maybe can be used to model partial functions, see ;-) |
| 11:31:56 | <luqui> | mapreduce, yeah the term is overloaded a bit. the one you're taking about is more common. |
| 11:32:00 | <Saizan> | well, you can see the Maybe monad as adding the possibility of failure |
| 11:32:24 | <quicksilver> | Maybe is a way of making a partial function total :) |
| 11:32:33 | <luqui> | quicksilver, :-) |
| 11:32:52 | <mm_freak_> | in fact, Maybe is redundant |
| 11:33:14 | <mm_freak_> | IMO lists are cleaner |
| 11:33:20 | <luqui> | yeah, that's easy. total f x = case f x of _|_ -> Nothing; x -> Just x. no problem! |
| 11:33:46 | <mm_freak_> | but Maybe is a good type to show the power of algebraic type system to beginners |
| 11:34:09 | <luqui> | mm_freak_, lists are cleaner? what do you mean? That's like saying monads are cleaner than types. |
| 11:34:17 | <idnar> | working with 0- and 1-item lists is cleaner? |
| 11:34:28 | <idnar> | that sounds rather painful to me |
| 11:34:42 | <dolio> | Don't use booleans, use ints. :) |
| 11:34:58 | <luqui> | I agree with the former, dolio, but not the latter :-) |
| 11:35:33 | <mm_freak_> | luqui: ?! |
| 11:35:41 | <EvilTerran> | if the list syntax were overloaded so [x] = (return x) and [] = mzero |
| 11:35:48 | <luqui> | ACTION views Bool as a red herring of a design flaw |
| 11:35:53 | <quicksilver> | EvilTerran: that might be quite interesting. |
| 11:35:53 | <SamB_XP> | luqui: hmm? |
| 11:36:01 | <EvilTerran> | Maybe would be as terse as lists to use |
| 11:36:04 | <quicksilver> | EvilTerran: I thought that sometimes to make applicative more readable |
| 11:36:10 | <mm_freak_> | (isqrt :: Integer -> Maybe Integer) could be written as (isqrt :: Integer -> [Integer]) as well |
| 11:36:12 | <quicksilver> | EvilTerran: [x] instead of pure x |
| 11:36:17 | <mm_freak_> | it would have the same monadic properties |
| 11:36:54 | <SamB_XP> | mm_freak_: what if someone decided to make it return TWO values ?" |
| 11:36:55 | <EvilTerran> | [x0 ... xN] = msum . map return $ x0:...:xN:[] |
| 11:37:06 | <EvilTerran> | or something |
| 11:37:10 | <mm_freak_> | SamB_XP: pattern-match against (x:xs) instead of [x] |
| 11:37:19 | <mm_freak_> | SamB_XP: or be monadic and use (>>=) |
| 11:37:23 | <EvilTerran> | would be necessary so other list-like constants would work |
| 11:37:37 | <luqui> | now that design flaw may be necessary in Haskell. But you never use Bool in dependent types: you return a property or its negation instead. I try to apply that as much as I can to my Haskell programs without entering type hell |
| 11:37:40 | <EvilTerran> | that'd be pretty handy, actually, for when you're using things like the Logic monad |
| 11:37:52 | <EvilTerran> | or Omega |
| 11:38:21 | <dolio> | So what is the appropriate type of filter? |
| 11:38:29 | <SamB_XP> | luqui: I don't see the big deal |
| 11:38:49 | <mm_freak_> | SamB_XP: for example: fourthRoot x = isqrt x >>= isqrt |
| 11:38:51 | <luqui> | dolio, that would be a case where doing it correctly would firmly enter type hell |
| 11:39:07 | <SamB_XP> | dolio: are you kidding? |
| 11:39:11 | <dolio> | Doing what correctly? |
| 11:39:19 | <EvilTerran> | luqui, can you give an example in a dependently-typed context? |
| 11:39:20 | <mm_freak_> | SamB_XP: that's what you would do with Maybe, anyway… and you'd additionally get the feature of allowing multiple fourth roots |
| 11:39:20 | <SamB_XP> | filter isn't even provably productive in most cases |
| 11:39:53 | <dolio> | SamB_XP: It's total. |
| 11:40:09 | <SamB_XP> | dolio: what about infinite lists ? |
| 11:40:15 | <dolio> | There are no infinite lists. |
| 11:40:34 | <Philippa_> | luqui: not really, doing it correctly just needs a type for "evaluable predicate". A function yielding bool's as good as any other there |
| 11:40:38 | <EvilTerran> | there could be infinite codata lists, but filter may only work on data lists |
| 11:41:11 | <luqui> | filter : forall (f : a -> P) (xs : [a]) -> { xs' : [a] | all P xs' } |
| 11:41:18 | <luqui> | er, modulo syntax errors :-) |
| 11:42:10 | <luqui> | f : a -> P a that is |
| 11:42:37 | <chrisdone> | how might I abstract this if/else crap so that “findM jbobau' lines” isn't repeated three times? http://hpaste.org/10783 |
| 11:43:04 | <dolio> | I think you mean: filter : {a : Set} (f : a -> Bool) -> [a] -> Sigma (xs : [a]) (all f xs) |
| 11:43:32 | <SamB_XP> | I doubt it |
| 11:43:35 | <dolio> | Plus some magic that all the stuff in xs come from the input [a]. |
| 11:43:47 | <luqui> | dolio, that would be the agda spelling. hmm, you're right, bools are sufficient here. |
| 11:46:34 | <luqui> | I should refine my statement then. Thanks for showing me that I overgeneralized my rule of thumb. |
| 11:47:10 | <luqui> | But a Bool can very often be refined to return more information. |
| 11:48:08 | <lunabot> | 42 |
| 11:48:15 | <dolio> | Sure. A test followed by fetching something could be turned into a fetch of a Maybe, for instance. |
| 11:48:28 | <quicksilver> | I refer you to the comment about initial objects. |
| 11:48:58 | <quicksilver> | "follow James McKinna's observation |
| 11:48:58 | <quicksilver> | (which give rise to views in Epigram): you don't need to |
| 11:48:58 | <quicksilver> | produce elements of an *arbitrary* whatever-it-is when you |
| 11:48:59 | <quicksilver> | can produce elements of the *initial* whatever-it-is." |
| 11:49:05 | <luqui> | ACTION thinks he may be mislearning design advice, because the only thing he has written for the last few months are implementations of frp libraries |
| 11:49:16 | <luqui> | so I'm learning design rules that only apply to frp libraries :-) |
| 11:53:27 | <luqui> | chrisdone, I have no idea what your code means |
| 11:54:30 | <quicksilver> | chrisdone: using 'guard' |
| 11:54:51 | <dolio> | Now, of course, maybe you have something more like: filter : {a : Set} {P : a -> True} (f : Decidable P) -> [a] -> Sigma (xs : [a]) (all P xs) ... |
| 11:55:23 | <Philippa_> | quicksilver: and an ErrorT or similar where necessary and some kind of catch, yeah |
| 11:55:27 | <luqui> | dolio, aye. filter kind of missed the point though. |
| 11:55:27 | <dolio> | And Decidable P = forall a -> Either (P a) (Not (P a)) |
| 11:55:51 | <luqui> | as an example (it was a case my rule of thumb was fine with) |
| 11:55:57 | <dolio> | But since filter only looks at the Left or the Right, it's essentially a Bool. |
| 11:56:31 | <quicksilver> | Philippa_: MaybeT might be enough in this case. |
| 11:56:44 | <chrisdone> | quicksilver: I was looking for MaybeT. so it actually exists |
| 11:56:50 | <luqui> | I'm just barely getting into real-world dependent type programming |
| 11:56:52 | <quicksilver> | Philippa_: or cheating and using IO's built-in exceptions might work too. |
| 11:56:58 | <quicksilver> | chrisdone: it exists in your head, and my head |
| 11:57:04 | <quicksilver> | but not in the standard lib :) |
| 11:57:07 | <chrisdone> | oh, lame |
| 11:57:09 | <quicksilver> | I think it's on hackage though. |
| 11:57:14 | <chrisdone> | yay |
| 11:57:19 | <luqui> | I think I would prefer to have filter : (a -> Bool) -> List a -> List a, and a separate prop_filter which verifies what it does |
| 11:57:22 | <Philippa_> | but ErrorT does what you want and it's in the mtl |
| 11:57:49 | <luqui> | but I don't know, since I have written a total of about 300 lines of DT code so far, so I have no idea what good practice is :-) |
| 11:57:50 | <idnar> | luqui: I thought you were getting rid of booleans :P |
| 11:58:09 | <luqui> | idnar, I revoked my rule of thumb after the above examples |
| 11:58:20 | <idnar> | ah, okay |
| 11:58:32 | <idnar> | I got lost about halfway through that conversation |
| 11:58:46 | <idnar> | "filter : {a : Set} (f : a -> Bool) -> [a] -> Sigma (xs : [a]) (all f xs)" means nothing to me |
| 11:58:49 | <quicksilver> | ACTION hands idnar a warm fuzzy thing. |
| 11:59:02 | <idnar> | nevermind "filter : {a : Set} {P : a -> True} (f : Decidable P) -> [a] -> Sigma (xs : [a]) (all P xs)" |
| 11:59:06 | <mmorrow> | lunabot can do private messages now if anyone wants to mess around (if you r00t my puter, please don't delete my laptop contents :):):)) |
| 11:59:16 | <luqui> | idnar, it's all very cool stuff, but hardly relevant |
| 11:59:53 | <mmorrow> | but i'll put a $20 bounty on my /etc/passwd ;) |
| 12:00:39 | <luqui> | yay, bot hasking! |
| 12:00:41 | <mmorrow> | eval :: String -> Dynamic |
| 12:00:55 | <mmorrow> | eval has eval in it's environment as well |
| 12:01:04 | <mmorrow> | so you can nest evals infinitely deep |
| 12:01:09 | <mmorrow> | (fyi :)) |
| 12:01:22 | <chrisdone> | Philippa_: MaybeT is more suited though because I don't actually care about what the error is. it's not really an error in that sense |
| 12:01:47 | <mmorrow> | , eval "fmap (*2) [0..4]" |
| 12:01:47 | <SamB_XP> | mmorrow: why don't you just place a private key in a particular location, and award a prize for someone who uses it to encrypt the information regarding how to pay them ? |
| 12:01:51 | <lunabot> | <<[Integer]>> |
| 12:02:11 | <quicksilver> | I'll raise mmorrow to $30 for his /etc/passed :P |
| 12:02:14 | <mmorrow> | SamB_XP: now you're thinkin ;) |
| 12:02:20 | <mmorrow> | quicksilver: heh |
| 12:02:49 | <Olathe> | . let f = "eval \" ++ f in eval f |
| 12:03:10 | <mmorrow> | in the extremely low chance (heh..err) someone gets it, i'll paypal you |
| 12:03:14 | <Olathe> | No error message. |
| 12:03:17 | <Olathe> | . let f = "eval \"" ++ f in eval f |
| 12:03:23 | <mmorrow> | the . got changed to , |
| 12:03:24 | <Olathe> | , let f = "eval \"" ++ f in eval f |
| 12:03:26 | <Olathe> | Ahh. |
| 12:03:27 | <lunabot> | luna: out of memory (requested 1048576 bytes) |
| 12:04:09 | <dolio> | ] runST (unsafeIOToST (readFile "/etc/passwd")) |
| 12:04:11 | <lunabot> | luna: Not in scope: `runST' |
| 12:04:11 | <lunabot> | Not in scope: `unsafeIOToST' |
| 12:04:13 | <mmorrow> | , maybe [] id (fromDynamic (eval "fmap (*2) [0..9]") :: Maybe [Integer]) |
| 12:04:14 | <SamB_XP> | I suppose the old array buffer overflow is out of the question ? |
| 12:04:17 | <lunabot> | [0,2,4,6,8,10,12,14,16,18] |
| 12:04:36 | <mmorrow> | SamB_XP: it's locked down tighter than something that's reallly tight! |
| 12:05:01 | <mmorrow> | the evaluator is actually using that exact same eval function at the top level also... |
| 12:06:20 | <SamB_XP> | well, we do have the power of unsafeCoerce at our fingertips, don't we ? |
| 12:06:31 | <mmorrow> | , unsafeCoerce |
| 12:06:32 | <lunabot> | luna: Not in scope: `unsafeCoerce' |
| 12:06:38 | <mmorrow> | , Unsafe.unsafeCoerce |
| 12:06:39 | <lunabot> | luna: Not in scope: `Unsafe.unsafeCoerce' |
| 12:06:45 | <SamB_XP> | I said nothing about the NAME of unsafeCoerce |
| 12:06:58 | <mmorrow> | heh, indeed you do, if you can conjure it ;) |
| 12:07:29 | <ivanm> | with runInteractiveCommand, why should passing in the input be forked? |
| 12:07:43 | <quicksilver> | ivanm: because. thats. how. unix. works. |
| 12:07:44 | <quicksilver> | ;) |
| 12:07:51 | <ivanm> | heh |
| 12:08:03 | <quicksilver> | because if the forked program blocks on input, it will stop sending output |
| 12:08:04 | <ivanm> | because I've seen code that doesn't fork input, but does fork output >_> |
| 12:08:06 | <quicksilver> | and vice / versa |
| 12:08:13 | <quicksilver> | oh, it doesn't matter which you fork |
| 12:08:16 | <quicksilver> | whichever is more convenient |
| 12:08:21 | <ivanm> | oh, as long as it's one of them? |
| 12:08:22 | <quicksilver> | just as long as you decouple the two. |
| 12:08:25 | <ivanm> | *nod* |
| 12:08:40 | <quicksilver> | as long as the child process can't have output blocking input while the parent process has the vice-versa. |
| 12:08:55 | <ivanm> | so if I want to get the output of the result and write it to a file, and the input is just show foo, it'd probably be easier/better to fork the input? |
| 12:09:10 | <quicksilver> | which is acheived by decoupling in the parent, or by making assumptions about how the child behaves. |
| 12:09:19 | <quicksilver> | yeah, for fixed static input forking the input makes most sense. |
| 12:09:26 | <quicksilver> | don't forget in haskell that can be super-light-weight |
| 12:09:33 | <ivanm> | *nod* |
| 12:09:35 | <quicksilver> | forkIO (hPrint foo) |
| 12:09:37 | <chrisdone> | , unsafeCallCthulhu |
| 12:09:39 | <lunabot> | luna: Not in scope: `unsafeCallCthulhu' |
| 12:09:41 | <quicksilver> | forkIO (hPrint in foo) |
| 12:09:42 | <ivanm> | @hoogle forkIO |
| 12:09:43 | <lambdabot> | Control.Concurrent forkIO :: IO () -> IO ThreadId |
| 12:09:43 | <quicksilver> | rather. |
| 12:10:10 | <SamB_XP> | chrisdone: now, now -- mmorrow didn't place a bounty on his (in)sanity! |
| 12:11:38 | <ivanm> | so if use waitForProcess, do I have to worry about when the fork finishes? |
| 12:11:47 | <mmorrow> | , , toUTF8 (take 10 ['\8704'..]) |
| 12:11:48 | <lunabot> | luna: parse error on input `toUTF8' |
| 12:11:50 | <mmorrow> | , toUTF8 (take 10 ['\8704'..]) |
| 12:11:51 | <lunabot> | ∀∁∂∃∄∅∆∇∈∉ |
| 12:11:56 | <ivanm> | and closing the in channel? |
| 12:12:36 | <SamB_XP> | ∂∆∈ |
| 12:12:43 | <chrisdone> | λ_λ |
| 12:12:43 | <SamB_XP> | only those work here :-P |
| 12:12:55 | <chrisdone> | they all work here. yay ubuntu |
| 12:13:18 | <ilyak_> | SamB_XP: You aren't right |
| 12:13:23 | <ivanm> | all work here... |
| 12:13:24 | <SamB> | all look horrid here except for ∅∆∈ |
| 12:13:34 | <SamB> | ... probably because they are all too tall and get clipped |
| 12:13:36 | <ilyak_> | Every of those characters work, your font don't have some glyphs |
| 12:13:37 | <ivanm> | chrisdone: it's to do with the fonts you choose, not the distro you use |
| 12:13:51 | <ilyak_> | I see 6 characters and four boxes |
| 12:14:00 | <ilyak_> | But then again on another font I'll see more |
| 12:14:07 | <SamB> | ilyak_: those boxes are what I call "not working" |
| 12:14:50 | <ilyak_> | SamB: Those boxes are due to your font |
| 12:15:01 | <SamB> | ilyak_: MAYBE |
| 12:15:01 | <ilyak_> | Not due to 'here', if here means IRC |
| 12:15:03 | <ivanm> | quicksilver: and what about the error handle? |
| 12:15:22 | <SamB> | by "here" I meant "in this client configuration" |
| 12:15:44 | <mmorrow> | ivanm: these two have worked for me http://hpaste.org/10784 |
| 12:16:06 | <ivanm> | thanks mmorrow |
| 12:16:26 | <mmorrow> | np |
| 12:17:36 | <ivanm> | what's the difference between command and process? with process you pass the args in after you start running the command? |
| 12:18:47 | <ilyak_> | SamB: Oh |
| 12:18:52 | <ilyak_> | It's fine then, sorry |
| 12:19:01 | <mmorrow> | you can do with command runCmd "cat | head -100" (unlines "asdf\njkl") |
| 12:19:29 | <mmorrow> | but process doesn't give you a shell |
| 12:19:37 | <ivanm> | ahhhh |
| 12:20:03 | <ivanm> | I'm wanting to basically do: cmd < input > output |
| 12:20:47 | <ivanm> | so I use the in handle for the input, then get the output from the out handle and then print that to file |
| 12:21:12 | <mmorrow> | also, runCmd seems to complain about broken pipes, this'll stop the err msgs but is possibly hackish: runCmd "cat 2> /dev/null | head -100 2> /dev/null | tac" (unlines "asdf\njkl") |
| 12:22:03 | <ivanm> | heh |
| 12:22:06 | <mmorrow> | exactly, you just talk to it over the handles |
| 12:22:25 | <mmorrow> | and if you're not talking to it, it's sleeping |
| 12:22:32 | <ivanm> | how should I code the file writing? openFile file WriteMode ? |
| 12:22:54 | <mmorrow> | sounds good |
| 12:23:14 | <ivanm> | oh, wait, it's an image file, so I'll be wanting openBinaryFile |
| 12:23:35 | <SamB_XP> | ivanm: does that follow ? |
| 12:23:53 | <ivanm> | well, I'm guessing that... |
| 12:24:03 | <ivanm> | the output from dot is meant to be an image... |
| 12:24:08 | <SamB_XP> | ACTION reminds ivanm that image does not imply binary ;-P |
| 12:24:09 | <ivanm> | "Note: if you will be working with files containing binary data, you'll want to be using openBinaryFile. " <-- from the haddock docs |
| 12:24:13 | <ivanm> | SamB_XP: oh? |
| 12:24:19 | <ivanm> | I thought it did :s |
| 12:24:25 | <SamB_XP> | ivanm: a technicality, I suppose ... |
| 12:24:28 | <SamB_XP> | but true none the less |
| 12:24:42 | <mmorrow> | ivanm: i got squirt from mohws. it's super fast Handle to Handle http://hpaste.org/10784#a2 |
| 12:24:42 | <ivanm> | so I should just use openFile? |
| 12:24:50 | <SamB_XP> | ivanm: no, don't mind me |
| 12:25:00 | <ivanm> | SamB_XP: heh... |
| 12:25:03 | <SamB_XP> | it probably IS binary |
| 12:25:17 | <SamB_XP> | but it doesn't HAVE to be just because it's an image |
| 12:25:18 | <ivanm> | mmorrow: what/who is mohws? |
| 12:25:24 | <ivanm> | SamB_XP: hmmmm..... |
| 12:25:31 | <lilac> | ivanm: for instance, ppm and svg aren't binary but are images |
| 12:25:32 | <mmorrow> | http://code.haskell.org/mohws |
| 12:25:33 | <lambdabot> | Title: Index of /mohws |
| 12:25:37 | <ivanm> | lilac: *nod* |
| 12:25:42 | <SamB_XP> | lilac: well, SOME ppm are text |
| 12:25:46 | <SamB_XP> | some are binary |
| 12:25:50 | <ivanm> | so is it safe to use openFile for binary data? |
| 12:26:03 | <lilac> | SamB_XP: true :) |
| 12:26:03 | <SamB_XP> | same with pbm, pgm, etc. |
| 12:26:05 | <mmorrow> | if you just use ByteStrings it won't matter /and/ it'll be a lot faster |
| 12:26:23 | <ivanm> | mmorrow: I wasn't planning on using ByteStrings... should I? :o |
| 12:26:33 | <SamB_XP> | xpm is also text |
| 12:26:41 | <SamB_XP> | C, even ;-P |
| 12:26:41 | <mmorrow> | i probably would if you're read/writing images.. |
| 12:27:08 | <mmorrow> | err, if you're just going Handle-to-Handle though, that squirt function'll be perfect |
| 12:27:13 | <lilac> | SamB_XP: don't forget ascii art ;-) |
| 12:27:30 | <ivanm> | would bytestring still work if it isn't an image (e.g. dot -Tdot returns text) |
| 12:27:32 | <ivanm> | ? |
| 12:27:36 | <mmorrow> | yeah |
| 12:27:43 | <ivanm> | *nod* |
| 12:27:44 | <mmorrow> | it's just bytes |
| 12:27:49 | <SamB_XP> | lilac: well, I'm aware of the existance of such, but I wasn't including that in the definition of image for the purpose of this conversation |
| 12:27:54 | <ivanm> | but if I'm using that squirt, do I have to worry about bytestrings? |
| 12:28:01 | <SamB_XP> | since I'm sure that isn't what was meant to start with ;-) |
| 12:28:28 | <mmorrow> | no, it'll squirt it super fast for you, without having to worry about String vs. ByteString or whatever |
| 12:28:28 | <SamB_XP> | and I don't think dot supports ASCII art output either |
| 12:28:44 | <ivanm> | SamB_XP: ASCII art, no... dot format output, yes |
| 12:28:53 | <SamB_XP> | I know |
| 12:29:05 | <SamB_XP> | but dot format output doesn't count as an image really |
| 12:29:09 | <kig> | guessing here, but i reckon the difference between openFile and openBinaryFile is only seen on windows, where openFile converts a plain \n to \r\n |
| 12:29:17 | <SamB_XP> | kig: you'd be surprised |
| 12:29:32 | <EvilTerran> | openFile may interpret the file as unicod |
| 12:29:43 | <EvilTerran> | e. it's up to the implementation |
| 12:29:57 | <EvilTerran> | @quote pcrs |
| 12:29:58 | <lambdabot> | pcrs says: Premature carriage ret |
| 12:30:05 | <dolio> | In GHC 6.10 it'll use the current locale. |
| 12:33:30 | <ivanm> | if I forkIO printing to to the input handle, do I have to worry about closing it still? |
| 12:33:57 | <mmorrow> | here's a runWithInput with all kinds of forking and such http://hpaste.org/10784#a3 |
| 12:34:16 | <ivanm> | Gah! ;-) |
| 12:34:17 | <mmorrow> | (and it let's you specify the input as a (Handle -> IO ()) |
| 12:34:30 | <mmorrow> | so you can use String or ByteStrings or whatever |
| 12:35:09 | <mmorrow> | and use foldM for pipes (i've wanted to do this, but haven't yet) |
| 12:35:20 | <ivanm> | this is getting even more confusing! :p |
| 12:36:37 | <ivanm> | ummm..... so if I squirt, should I just use openFile and not worry about being binary or not? |
| 12:37:27 | <mmorrow> | i don't think you'll have to worry about if it's binary or not (i think) |
| 12:38:34 | <Baughn> | Haddock fails to build, citing my lack of profiling libraries for ghc 6.8.3; is this reasonable? (Actually, let me paste the error) |
| 12:38:58 | <ivanm> | hmmmm.... the only thing with squirt is, there's no way of telling if it transferred the data over fully or not, or if it threw an exception... |
| 12:39:00 | <Baughn> | http://hpaste.org/10785 <-- Error. |
| 12:39:21 | <Baughn> | Am I running into a hackage package designed for 6.10, or what? |
| 12:40:21 | <mightybyte> | Is there a Haskell library that allows one to build cross-platform GUIs? |
| 12:40:30 | <ivanm> | mightybyte: gtk2hs? |
| 12:40:32 | <Baughn> | mightybyte: Gtk2hs? |
| 12:40:42 | <mightybyte> | Ok, thanks. |
| 12:40:45 | <ivanm> | there's also qthaskell, but I don't think it's finished yet... |
| 12:41:20 | <mightybyte> | I was looking in the standard libraries, I guess I should have been in hackage. |
| 12:42:02 | <ivanm> | mmorrow: wityrtInput, what are the Maybe handles for? |
| 12:42:10 | <mightybyte> | Although I don't even see gtk2hs in hackage. |
| 12:42:12 | <mmorrow> | ivanm: so this'll get a png from dot: http://hpaste.org/10784#a7 |
| 12:42:26 | <dmwit> | mightybyte: I don't think it's on hackage. |
| 12:42:30 | <Baughn> | mightybyte: gtk2hs is legacy. It has its own site; google. |
| 12:42:35 | <dmwit> | mightybyte: It doesn't use Cabal for its build system. |
| 12:42:35 | <mmorrow> | ivanm: if you don't want any {err,out}put, just pass Nothing |
| 12:42:36 | <mightybyte> | Heh |
| 12:42:44 | <dmwit> | (yet) |
| 12:42:50 | <mightybyte> | Ok |
| 12:42:57 | <EvilTerran> | Baughn, "legacy"? |
| 12:43:04 | <ivanm> | *nod* |
| 12:43:08 | <Baughn> | EvilTerran: "Pre-Baughn cCode" |
| 12:43:09 | <ivanm> | EvilTerran: before cabal |
| 12:43:11 | <EvilTerran> | ah |
| 12:43:46 | <ivanm> | dmwit: yeah, blame dcoutts... with his gtk2hs hat, he blames his c2hs hat for not playing nicely with his cabalhat |
| 12:44:00 | <ivanm> | ;-) |
| 12:44:20 | <dmwit> | heh |
| 12:44:59 | <dmwit> | ?remember ivanm yeah, blame dcoutts... with his gtk2hs hat, he blames his c2hs hat for not playing nicely with his cabalhat |
| 12:45:00 | <lambdabot> | I will never forget. |
| 12:45:03 | <dmwit> | Liar! |
| 12:45:17 | <ivanm> | well, there should be a space between "cabal" and "hat"... |
| 12:45:33 | <dmwit> | ?forget ivanm yeah, blame dcoutts... with his gtk2hs hat, he blames his c2hs hat for not playing nicely with his cabalhat |
| 12:45:34 | <lambdabot> | Done. |
| 12:45:40 | <dmwit> | ?remember ivanm yeah, blame dcoutts... with his gtk2hs hat, he blames his c2hs hat for not playing nicely with his cabal hat |
| 12:45:40 | <lambdabot> | Done. |
| 12:45:45 | <ivanm> | :D |
| 12:45:49 | <mauke> | tell preflex, it really won't forget :-) |
| 12:46:02 | <ivanm> | mauke: it just disappears for long periods of time... |
| 12:46:04 | <dmwit> | preflex should learn to accept ?remember, then... |
| 12:46:18 | <mauke> | ivanm: yeah, I don't know how that happened |
| 12:46:32 | <mauke> | recv threw an exception and it died |
| 12:46:51 | <ivanm> | mmorrow: what's the purpose of the first catch? to check if that command actually exists? |
| 12:47:03 | <ivanm> | mauke: sure, blame someone else... |
| 12:47:03 | <mauke> | maybe I'll just add a loop to restart it if it dies |
| 12:47:40 | <ivanm> | yes, because that worked _so well_ for lambdabot :p |
| 12:48:05 | <mauke> | oh, and it only happened on freenode |
| 12:48:12 | <mauke> | the efnet instance was still alive |
| 12:48:38 | <mmorrow> | ivanm: the catch in ghci? or in the function? the one in ghci is probably unneeded, but the finally is nice |
| 12:49:06 | <mauke> | anyway, the good news is that preflex Does Not Lose State |
| 12:49:38 | <ivanm> | in the function |
| 12:52:18 | <masklinn> | Is there any functional language out there with a *full* IEEE754 support? |
| 12:52:40 | <ivanm> | mmorrow: and why are you using MVars? so you can fork it and still get the results? |
| 12:53:14 | <dmwit> | masklinn: I'm not sure; what's missing, in your opinion? |
| 12:53:45 | <ivanm> | dmwit: a value for Infinity :p |
| 12:53:51 | <dmwit> | > 1/0 |
| 12:53:53 | <lambdabot> | Infinity |
| 12:54:04 | <ivanm> | no, that's a textual description! |
| 12:54:09 | <ivanm> | I want the full printed value! :p |
| 12:54:17 | <dmwit> | > isInfinite (1/0) |
| 12:54:18 | <lambdabot> | True |
| 12:54:25 | <dmwit> | ivanm: heh |
| 12:54:38 | <masklinn> | dmwit, I don't know, a friend asked me and a cursory search gave me e.g. a haskell-cafe thread saying that "Haskell does not allow you to change rounding mode, NaN signallng mode, etc. |
| 12:54:38 | <dmwit> | > decodeFloat (1/0) -- the full printed value |
| 12:54:39 | <masklinn> | " |
| 12:54:40 | <lambdabot> | (4503599627370496,972) |
| 12:54:54 | <masklinn> | there's also http://www.cse.unsw.edu.au/~dons/haskell-1990-2000/msg06108.html |
| 12:54:55 | <lambdabot> | Title: Re: rounding in haskell |
| 12:54:58 | <ivanm> | heh |
| 12:55:11 | <ivanm> | if I use withFile, is there any way of getting any errors out? |
| 12:55:26 | <ivanm> | use something like try or catch? |
| 12:56:05 | <masklinn> | dmwit: and OCaml doesn't seem to support full 754 either, so I was wondering if *any* functional language did. |
| 12:57:38 | <dmwit> | masklinn: I think you may have misunderstood that post. |
| 12:57:52 | <dmwit> | That post at no point claims Haskell does 754 wrong. |
| 12:58:20 | <quicksilver> | haskell does 754 fine, as far as I know |
| 12:58:22 | <hackage> | Uploaded to hackage: AERN-RnToRm 0.4.1 |
| 12:58:27 | <quicksilver> | but it doesn't expose all the functionality of 754 |
| 12:58:29 | <masklinn> | where did i say that haskell did 754 wrong? |
| 12:58:53 | <masklinn> | please go back to my initial question: I asked if any functional language had (exposed) full IEEE754 support |
| 12:59:09 | <quicksilver> | haskell certainly doesn't expose it all. |
| 12:59:15 | <quicksilver> | so on that criterion is fails. |
| 13:00:09 | <masklinn> | well that's what I'd gathered from my searches, but i was wondering if 1. I'd missed things, and 2. if any other functional language had such upport as well as 3. if maybe there was a nonstandard haskell library implementing full IEEE754 support |
| 13:00:57 | <dolio> | What kind of stuff is missing? I've never looked very closely at floating point stuff. |
| 13:01:18 | <dolio> | Oh, I guess you answered that. |
| 13:02:07 | <lilac> | masklinn: full IEEE754 support would need to be stateful, so asking a pure functional language to support it is asking for difficulties |
| 13:02:23 | <lilac> | that said, an IEEE754 monad might be possible. |
| 13:02:42 | <lilac> | but you presumably wouldn't be able to do hardware floating point outside the monad |
| 13:02:52 | <masklinn> | lilac, oh would it? (as i said it's a question a friend asked me, since I often roam in functional lands/sites/blogs/whatever, but I don't know much of 754) |
| 13:03:08 | <masklinn> | lilac: why does full IEEE754 require statefulness? |
| 13:03:28 | <masklinn> | stuff like changing the rounding mode? |
| 13:03:34 | <quicksilver> | masklinn: for exaactly the reasons you gave :) |
| 13:03:43 | <quicksilver> | although I'm not sure if it's true. |
| 13:03:46 | <quicksilver> | you could have different types |
| 13:03:54 | <quicksilver> | DoubleWithThisRounding |
| 13:03:56 | <quicksilver> | DoubleWithThatRounding |
| 13:04:06 | <quicksilver> | DoubleWithNanAsAValue |
| 13:04:12 | <quicksilver> | DoubleWithNanAsAnException |
| 13:04:35 | <quicksilver> | ugly names aside, that's probably more elegant than making state changes explicit. |
| 13:05:59 | <ivanm> | mmorrow: what do you think of this? http://hpaste.org/10786 |
| 13:06:09 | <ivanm> | (the runGraphviz function) |
| 13:06:11 | <masklinn> | quicksilver: wouldn't it be possible to handle that with parameterized type extensions thingies? |
| 13:06:32 | <quicksilver> | masklinn: yup. |
| 13:06:38 | <quicksilver> | masklinn: more than one way to encode it. |
| 13:06:46 | <dmwit> | quicksilver: Hmm, that seems like it might be inefficient; the implementations would have to explicitly change the 754 mode before *every* calculation, wouldn't they? |
| 13:06:54 | <ivanm> | seems to work here... passing invalid params returns False... |
| 13:06:54 | <dmwit> | i.e. they couldn't assume the processor was in the right mode... |
| 13:07:21 | <ivanm> | hmmmm.... not quite, if the output of the command fails then the file still exists... |
| 13:08:02 | <quicksilver> | dmwit: no, the compiler ought to be able to propagate information about which mode it was in |
| 13:08:16 | <dmwit> | quicksilver: That requires compiler collusion. ;-) |
| 13:08:22 | <quicksilver> | yes. |
| 13:08:25 | <quicksilver> | very much so. |
| 13:08:34 | <dmwit> | Okay, then I'm with you. |
| 13:08:59 | <quicksilver> | well something has to generate the iee754 opcodes :) |
| 13:09:04 | <ivanm> | mmorrow: I take it back... I managed to break the ghci pipe! :o |
| 13:09:05 | <quicksilver> | and that something isn't haskell user code. |
| 13:09:13 | <dmwit> | Harpy ;-) |
| 13:09:13 | <quicksilver> | so I assumed it was intended to be solved in the compiler |
| 13:09:16 | <weakish> | I'm learning haskell via http://en.wikibooks.org/wiki/Haskell, just wondering where can I get answers to the exercises? |
| 13:09:17 | <lambdabot> | Title: Haskell - Wikibooks, collection of open-content textbooks |
| 13:09:37 | <ivanm> | ahhh, must be my deletion command... |
| 13:10:16 | <lilac> | quicksilver: that'd require the compiler to know the order in which floating-point calculations were forced. sounds somewhat hard :) |
| 13:11:03 | <mauke> | heh, just use a different core for each mode |
| 13:11:08 | <lilac> | hehe |
| 13:11:16 | <dmwit> | lilac: Nah, the run-time could track the current mode. |
| 13:11:19 | <quicksilver> | lilac: I don't think so. The compiler knows that by definition. |
| 13:11:24 | <quicksilver> | the compiler writes the code. |
| 13:11:42 | <lilac> | quicksilver: the compiler doesn't know the order in which values get forced |
| 13:11:58 | <lilac> | (since that can change at runtime) |
| 13:12:50 | <lilac> | dmwit: the run-time could track the current mode, but would that be any faster than setting the mode at the start of each batch of computations? |
| 13:13:04 | <lilac> | either way it seems pretty horrible |
| 13:13:10 | <ivanm> | http://hpaste.org/10786 <-- can people see what's wrong with my runGraphviz function here? |
| 13:13:24 | <ivanm> | at first it tested OK, but now it doesn't (this is in ghci) :s |
| 13:13:39 | <lilac> | on a more worrying note, you can already change the rounding mode in IO via FFI, which kinda violates purity in a pretty brutal way :-( |
| 13:13:54 | <ivanm> | the problem occurs when I pass an invalid parameter (the String argument) to graphviz :s |
| 13:14:03 | <dmwit> | lilac: If it's in IO, it doesn't break purity. ;-) |
| 13:14:15 | <dmwit> | (I know. You're right. It's just a joke.) |
| 13:14:15 | <ivanm> | if I run it once, it works... if I run it twice, it doesn't |
| 13:15:29 | <ivanm> | how does one debug IO? :s |
| 13:15:53 | <lilac> | dmwit: since you can write to arbitrary memory locations with FFI, purity is lost anyway. |
| 13:16:00 | <ivanm> | how does one add breakpoints? |
| 13:16:00 | <lilac> | ACTION hadn't realised how nasty the IO monad really is ;-) |
| 13:16:41 | <quicksilver> | lilac: quite often the compiler infers strictness on FP types |
| 13:16:49 | <quicksilver> | lilac: because they are strict types and are used with strict operators. |
| 13:17:02 | <quicksilver> | lilac: in those cases, the compiler generates code which it does know the sequence of. |
| 13:18:19 | <lilac> | quicksilver: sure, in those cases that's fine. but pretty much whenever the compiler creates a thunk containing floating-point operations, you'd have to set the rounding mode too. |
| 13:18:59 | <quicksilver> | lilac: well you'd annotate the thunk with the needed mode and change if you ahd to, yes. |
| 13:19:51 | <lilac> | sure. |
| 13:20:25 | <quicksilver> | and propogate those marks up as far as you could |
| 13:20:32 | <quicksilver> | and avoid un-necessary mode changes |
| 13:20:33 | <quicksilver> | etc. |
| 13:20:36 | <quicksilver> | it's a tractable problem. |
| 13:20:40 | <quicksilver> | it might be a pain, sure. |
| 13:22:25 | <lilac> | since you can call fesetround from FFI anyway, i'm not sure whether it'd be worth the effort, really. |
| 13:22:38 | <quicksilver> | me neither. |
| 13:22:49 | <quicksilver> | I've never worked in a field that cared about FP rounding modes. |
| 13:22:56 | <quicksilver> | but obviously some people do. |
| 13:23:01 | <lilac> | ACTION works in a field which cares about it |
| 13:23:05 | <mmorrow> | ivanm: awesome. graphviz is great. how does it work? |
| 13:23:14 | <Baughn> | lilac: What sort of field is that? |
| 13:23:18 | <ivanm> | my function? poorly :s |
| 13:23:26 | <ivanm> | if the second arg is invalid, it crashes :s |
| 13:23:49 | <mmorrow> | second arg to which function? |
| 13:24:19 | <ivanm> | runGraphviz |
| 13:24:27 | <lilac> | Baughn: we want to get the same results on x86 and sparc (otherwise some of our unit tests fail). which means we want to turn off the 80-bit precision mode on doubles ;-) |
| 13:24:43 | <ivanm> | I think I'm missing an exception catching or something... |
| 13:24:51 | <ivanm> | maybe I need to try the origing runCommand? |
| 13:24:56 | <Baughn> | lilac: So it's just for unit tests? Well, okay.. |
| 13:25:20 | <Baughn> | Though I'd be tempted to round off the answers to "good enough" precision |
| 13:25:47 | <lilac> | Baughn: by hand? in each of our million lines of code? :-) |
| 13:26:23 | <quicksilver> | lilac: that's not FP rounding modes, though. |
| 13:26:25 | <lilac> | our software is quite chaotic -- a difference in the 65th bit can make a large difference to the final result ;-/ |
| 13:26:26 | <mmorrow> | ivanm: heh. maybe just check it yourself? if you just do dot -Tinvalid it'll give you a list of supported output formats |
| 13:26:29 | <lilac> | quicksilver: true. |
| 13:26:30 | <quicksilver> | lilac: that's turning off large doubles. |
| 13:26:37 | <mmorrow> | (or dot -Twhatevererere) |
| 13:26:57 | <quicksilver> | I thouhgt 80-bit doubles were off by default in ghc/gcc these days |
| 13:26:59 | <ivanm> | yeah... |
| 13:27:02 | <quicksilver> | unless you asked for them explicitly. |
| 13:27:07 | <ivanm> | maybe I should provide an enumeration of possible formats? |
| 13:27:16 | <mmorrow> | sounds nice |
| 13:27:20 | <lilac> | quicksilver: not in gcc last time i checked. |
| 13:27:47 | <Baughn> | quicksilver: No, you still have to pass -fexcess-precision |
| 13:27:56 | <Baughn> | Wait. -ffloat-store. |
| 13:28:09 | <quicksilver> | -fexcess-precision turns them on, not off, surely? |
| 13:28:21 | <Baughn> | -fexcess-precision should turn it on, if it existed. ;) |
| 13:28:32 | <Baughn> | The problem is that -ffloat-store makes things noticably slower |
| 13:28:50 | <Baughn> | Oh, but I think you get the same effect by using -fpmath=sse, which may be on by default on some setups |
| 13:29:17 | <quicksilver> | ACTION nods |
| 13:29:55 | <ivanm> | mmorrow: dammit, it still won't work :s |
| 13:30:09 | <Baughn> | @instances-importing Control.Arrow Arrow |
| 13:30:10 | <lambdabot> | (->), Kleisli m |
| 13:30:19 | <ivanm> | and I'd prefer not to provide an enumeration, in case the possible outputs change (or are different from in diferent versions) |
| 13:31:06 | <dolio> | -fexcess-precision is real. |
| 13:32:46 | <Baughn> | Sure? Google came up blank |
| 13:33:01 | <dolio> | Well, ghc didn't complain when I passed it. |
| 13:33:08 | <dolio> | I know I've heard it before, too. |
| 13:33:20 | <ivanm> | mmorrow: can you see anything obviously wrong with that function? |
| 13:33:57 | <Baughn> | dolio: Oh, I see. GHC-specific -ffloat-store-suppressing flag? |
| 13:34:22 | <dolio> | What's -ffloat-store do? The opposite? |
| 13:34:34 | <quicksilver> | forces floats into memory after every op |
| 13:34:44 | <quicksilver> | to chomp them from 80bit to 64 or 32 |
| 13:34:49 | <lilac> | not every op, actually :( |
| 13:34:49 | <quicksilver> | I think? |
| 13:35:19 | <dolio> | In any case, yes, I think -fexcess-precision keeps them in registers. |
| 13:35:24 | <Baughn> | The funny thing is, SSE2 is *already* 64-bit, so -ffloat-store should (I believe) be a no-op |
| 13:35:34 | <Baughn> | (As is mmx and sse) |
| 13:36:11 | <Baughn> | ..well, except that it still causes them to be stored back, presumably for hysterical raisins. Or I could be entirely wrong. |
| 13:36:37 | <quicksilver> | well MMX/SSE are 32 bit, IIRC. |
| 13:36:49 | <Baughn> | Hm. So they are. |
| 13:36:50 | <quicksilver> | SSE2 supports variable sizes. |
| 13:36:57 | <Baughn> | Oh well; at least sse2 supports doubles |
| 13:37:00 | <quicksilver> | yup. |
| 13:37:06 | <quicksilver> | SSE was 4x32 |
| 13:37:14 | <quicksilver> | SSE2 lets you use those 128 bits in other ways |
| 13:37:17 | <quicksilver> | including 64x2 |
| 13:37:21 | <quicksilver> | but not 128x1 |
| 13:37:27 | <quicksilver> | I can't remember what the other options are. |
| 13:37:38 | <Baughn> | http://www.haskell.org/pipermail/glasgow-haskell-bugs/2007-February/007348.html <-- It's just, this thing seems to suggest that ghc still passes -ffloat-store even when using sse2 |
| 13:37:39 | <lambdabot> | Title: [GHC] #1138: The -fexcess-precision flag is ignored if supplied on the command l ..., http://tinyurl.com/5yfw4w |
| 13:37:42 | <quicksilver> | SSE was basically for opengl. |
| 13:37:57 | <quicksilver> | although not officially. |
| 13:39:08 | <quicksilver> | but opengl is all about 4x32 bit quantities. |
| 13:42:56 | <jmg> | hi |
| 13:43:26 | <ivanm> | what does it mean if I get a "Process haskell broken pipe" error? |
| 13:43:55 | <daf> | ivanm: your Haskell process is writing to a pipe that's been closed on the other end, I imagine |
| 13:44:23 | <mmorrow> | ivanm: this seems to work http://hpaste.org/10786#a1 |
| 13:44:50 | <mmorrow> | (had to comment out stuff since i didn't have those imports) |
| 13:45:25 | <ivanm> | mmorrow: yeah, I was just trying to avoid including your whole runWith functions :s |
| 13:46:13 | <mmorrow> | yeah, it's nice to have a function which wraps everything nicely so you don't have to worry about flushing handle/random misc |
| 13:46:55 | <ivanm> | also because I don't understand your code :p |
| 13:47:35 | <ArthurClemens> | I have been trying to parse an actionscript file (java syntax) with javadoc annotations, using Parsec. Either it is not trivial, or I just don't understand how. Does anyone have experience with this? |
| 13:49:26 | <mmorrow> | ivanm: all it pretty much does is (1) it needs to write/read something (2) newEmptyMVar (3) forkIO (4) the forked proc writes () to that mvar when it's done (5) the main thread that was sleeping on that mvar wakes up when the mvar fills up. repeat.. |
| 13:49:48 | <mmorrow> | ok, i gotta run, good luck |
| 13:49:53 | <ivanm> | heh, thanks |
| 13:50:36 | <dblazakis> | ArthurClemens: are you trying to write an actionscript parser? i think Parsec has some ready made lexers, but you'll have to write the parser yourself |
| 13:50:58 | <ArthurClemens> | it is for generating documentation |
| 13:51:30 | <dblazakis> | ArthurClemens: so, you want to parse just the javadoc? |
| 13:51:52 | <ArthurClemens> | well, they belong to class members, so I need to parse them too |
| 13:52:14 | <ArthurClemens> | I am used to regex, so this is hard for me |
| 13:52:18 | <mib_t5hrat> | guys i tried to work out the question this is what i got |
| 13:52:26 | <mib_t5hrat> | Write a Haskell function countChange that calculates the number of different |
| 13:53:26 | <dblazakis> | ArthurClemens: how far have you gotten? it is fairly time consuming writing a parser for a "real" language |
| 13:53:32 | <EvilTerran> | the number of different ... ? |
| 13:53:58 | <ArthurClemens> | I am starting |
| 13:54:04 | <quicksilver> | actually it's not that time consuming writing the parser, when you'r used to it |
| 13:54:05 | <mib_t5hrat> | ways we can make change of n cents, given denominations of 1 cent, 2 cents, |
| 13:54:14 | <quicksilver> | but you need to design an AST for your language |
| 13:54:20 | <quicksilver> | (or the fragment you're trying to parse) |
| 13:54:23 | <ArthurClemens> | AST? |
| 13:54:24 | <quicksilver> | and that, IME, is that harder bit. |
| 13:54:31 | <quicksilver> | abstract syntax tree |
| 13:54:37 | <quicksilver> | a data structure which stores the parsed file. |
| 13:55:20 | <mib_hyumkc> | Write a Haskell function countChange that calculates the number of different ways we can make change of n cents, given denominations of 1 cent, 2 cents, … , d cents ( i.e. if d=5, the denominations of coins available are 5 cents, 4 cents, 3 cents, 2 cents and 1 cent ) |
| 13:55:22 | <ski> | @let named a f = loop a where loop a = f a loop |
| 13:55:22 | <lambdabot> | Defined. |
| 13:55:26 | <ski> | > named 5 $ \n factorial -> if n == 0 then 1 else n * factorial (n-1) |
| 13:55:28 | <lambdabot> | 120 |
| 13:55:33 | <ski> | @type named |
| 13:55:34 | <lambdabot> | forall t1 t. t1 -> (t1 -> (t1 -> t) -> t) -> t |
| 13:55:36 | <mib_hyumkc> | http://mibbit.com/pb/l7UHHU |
| 13:55:37 | <lambdabot> | Title: Mibbit: PasteBin |
| 13:55:42 | <dblazakis> | quicksilver: writing a parser is fairly time consuming for a full language, cause most have warts, but yeah designing a servicable AST is, i agree, harder |
| 13:55:48 | <ski> | @hoogle t1 -> (t1 -> (t1 -> t) -> t) -> t |
| 13:55:48 | <lambdabot> | Foreign.Marshal.Utils withMany :: (a -> (b -> res) -> res) -> [a] -> ([b] -> res) -> res |
| 13:56:11 | <mib_hyumkc> | that's the code i have so far, i think i am on the wrong track |
| 13:56:28 | <ski> | could the above variant of `fix' be useful enough to warrant a standard name ? |
| 13:56:33 | <quicksilver> | dblazakis: using a decent parser combinator, writing the parser is just writing down the grammar |
| 13:56:41 | <quicksilver> | quantifier: modulo, perhaps, left recursion. |
| 13:56:50 | <quicksilver> | ski: is it mfix for cont, or something like that? |
| 13:57:04 | <earthy> | quicksilver: nope, good combinators can also deal with left recursion. |
| 13:57:14 | <quicksilver> | earthy: indeed, but I only said 'decent' ;) |
| 13:57:23 | <ski> | quicksilver : it's just an instance of plain `fix', with some arguments swapped |
| 13:57:28 | <ArthurClemens> | ah, a data structure. I didn't know the abbreviation. |
| 13:57:35 | <earthy> | (the resulting parsers may not necessarily be efficient... or give nice error messages...) |
| 13:58:04 | <ski> | > fix (\factorial n -> if n == 0 then 1 else n * factorial (n-1)) 5 -- this is the same, basically |
| 13:58:05 | <lambdabot> | 120 |
| 13:58:22 | <hackage> | Uploaded to hackage: mmtl 0.1 |
| 13:58:34 | <ski> | (but using the other argument order, we can get away with using `... $ \ .. -> ...' |
| 13:58:36 | <dblazakis> | quicksilver: well, some language have some ugly context sensitve stuff to deal with |
| 13:58:39 | <ski> | ) |
| 13:58:42 | <mib_hyumkc> | i was thinking of using list comprehension to generate the numbers |
| 13:58:50 | <ivanm> | @ask mmorrow what purpose do the maybe (return()) ... lines serve? |
| 13:58:51 | <lambdabot> | Consider it noted. |
| 14:00:05 | <mib_hyumkc> | any help?? |
| 14:00:42 | <dblazakis> | quicksilver: parsing ECMAsript is ugly if you do ti right becasue of the optionaly semicolon thing, parsing C++ is ugly -- and those are two of the most used languages |
| 14:01:06 | <ski> | (i just thought of it because of in <http://hpaste.org/10786#a1> .. `squirt' ought to use `forever' instead of the ugly `do ...; let loop = ...; loop' .. but in more general cases, one needs a parameter/accumulator/state .. so this is similar to "named `let'" in Scheme) |
| 14:02:33 | <ski> | (quicksilver : however, there might be something interesting wrt `Cont' here .. hm) |
| 14:03:09 | <ivanm> | hmmmmm.... is there any way I can try and track down which handles have broken pipes? |
| 14:04:21 | <Baughn> | @djinn ((a -> b -> m a) -> a -> [b] -> m a) -> (a -> m a) -> a -> m () |
| 14:04:22 | <lambdabot> | Error: Undefined type [] |
| 14:04:35 | <ski> | ACTION is a fan of `done = return ()' .. |
| 14:04:39 | <Baughn> | @djinn ((a -> b -> m a) -> a -> x b -> m a) -> (a -> m a) -> a -> m () |
| 14:04:40 | <lambdabot> | -- f cannot be realized. |
| 14:04:41 | <quicksilver> | ivanm: handle SIGPIPE |
| 14:04:44 | <quicksilver> | ivanm: probably ignore it. |
| 14:04:51 | <ivanm> | hmmm? |
| 14:05:05 | <quicksilver> | that's how you stop a broken pipe killing your process |
| 14:05:08 | <ivanm> | ghci keeps crashing because of broken pipes, and I want to work out where/why |
| 14:05:13 | <ivanm> | so I can fix that up |
| 14:05:43 | <ski> | Baughn : what yer for ? |
| 14:06:05 | <Baughn> | ski: Trying to fold, spindle and mutilate foldM into what you wanted |
| 14:06:12 | <Baughn> | ski: Without any actual effort on my part |
| 14:06:34 | <Baughn> | Well, it's basically iterateM, isn't it? |
| 14:07:20 | <ski> | Baughn : well, `named' is not monadic *per*se* (unless there's something with `Cont o' hiding) |
| 14:07:32 | <ski> | @type iterateM |
| 14:07:33 | <lambdabot> | Not in scope: `iterateM' |
| 14:07:46 | <mib_hyumkc> | any help |
| 14:07:56 | <mib_hyumkc> | Write a Haskell function countChange that calculates the number of different ways we can make change of n cents, given denominations of 1 cent, 2 cents, … , d cents ( i.e. if d=5, the denominations of coins available are 5 cents, 4 cents, 3 cents, 2 cents and 1 cent ) |
| 14:08:05 | <quicksilver> | ivanm: you try to read from a handle which is closed. |
| 14:08:06 | <ivanm> | quicksilver: handle SIGPIPE doesn't do anything anyway... |
| 14:08:13 | <quicksilver> | ivanm: or write to a handle which is close.d |
| 14:08:18 | <ivanm> | quicksilver: yes, but I'm trying to work out which handle is closed |
| 14:08:31 | <mib_hyumkc> | http://mibbit.com/pb/EbUeQv |
| 14:08:33 | <lambdabot> | Title: Mibbit: PasteBin |
| 14:10:25 | <ski> | Baughn : `(a -> m a) -> a -> m ()' would just iterate along the state .. i wanted to get a hold of the iteration function, so i can decide for myself when/if to iterate on with a state (possibly several times) |
| 14:13:07 | <ski> | > named (Node 0 [Node 1 [Node 2 [],Node 3 []],Node 4 [Node 5 []]]) $ \(Node a ts) flatten -> a : concatMap flatten ts |
| 14:13:08 | <lambdabot> | [0,1,2,3,4,5] |
| 14:13:25 | <dolio> | @type flip $ fix . flip |
| 14:13:26 | <lambdabot> | forall a c. a -> (a -> (a -> c) -> c) -> c |
| 14:13:44 | <ski> | *nod* |
| 14:13:53 | <ivanm> | @ask mmorrow which license are you willing to distribute runWIthInput under? |
| 14:13:54 | <lambdabot> | Consider it noted. |
| 14:16:02 | <ivanm> | @tell mmorrow actually, using an invalid output type crashes your code as well >_> |
| 14:16:02 | <lambdabot> | Consider it noted. |
| 14:16:55 | <ski> | > let reverse xs = named (xs,[]) $ \(xs,rev) loop -> case xs of [] -> rev; x:xs -> loop (xs,x:rev) in reverse [0,1,2,3] |
| 14:16:59 | <ski> | et.c. |
| 14:17:05 | <lambdabot> | [3,2,1,0] |
| 14:17:58 | <dolio> | > let rev xs = (flip $ fix . flip) (xs,[]) $ \(xs,rev) loop -> case xs of [] -> rev ; x:xs -> loop (xs,x:rev) in rev [0,1,2,3] |
| 14:17:59 | <lambdabot> | [3,2,1,0] |
| 14:18:52 | <dolio> | @pl \f a -> let loop b = f b loop in loop a |
| 14:18:52 | <lambdabot> | fix . flip |
| 14:19:03 | <dolio> | @pl \a f -> let loop b = f b loop in loop a |
| 14:19:03 | <lambdabot> | flip (fix . flip) |
| 14:19:04 | <lilac> | mib_hyumkc: what counts as a 'different way'? is [1,1,1,3] different from [3,1,1,1]? |
| 14:19:41 | <ski> | (it would of course be nice if one could avoid tupling ..) |
| 14:19:45 | <Deewiant> | :t flip (fix . flip) |
| 14:19:46 | <lambdabot> | forall a c. a -> (a -> (a -> c) -> c) -> c |
| 14:20:48 | <lilac> | @djinn a -> (a -> (a -> c) -> c) -> c |
| 14:20:48 | <lambdabot> | -- f cannot be realized. |
| 14:20:54 | <lilac> | thought not :) |
| 14:22:23 | <Japsu> | > 9.93 * 33 |
| 14:22:23 | <ski> | > let reverse xs = (\foo -> fix foo xs []) $ \loop xs rev -> case xs of [] -> rev; x:xs -> loop xs (x:rev) in reverse [0,1,2,3] |
| 14:22:25 | <lambdabot> | 327.69 |
| 14:22:25 | <lambdabot> | [3,2,1,0] |
| 14:23:09 | <ski> | (possibly that is a more readable idiom than using `flip (fix . flip)' ..) |
| 14:24:45 | <ski> | ACTION wonders whether one could come up with some nice syntax for "named `let'"s, "compatible" with pattern-matching .. |
| 14:34:11 | <ivanm> | @tell mmorrow I'm cheating: pre-defined outputs, so the only possible errors come from not being able to write to the specified file (and my code already handles that!) |
| 14:34:12 | <lambdabot> | Consider it noted. |
| 14:40:28 | <magthe> | in TH, how do I "look up" a symbol by name? |
| 14:40:50 | <EvilTerran> | reify? |
| 14:42:04 | <lilac> | magthe: can you clarify what you mean? (or hpaste.org something?) |
| 14:44:20 | <jberryman> | when using a type with record syntax accessor functions, is there a way to apply a function to the record in a similar manner to fmap on functors? i.e. something less ugly than: type{accessor = f (accessor type)} |
| 14:44:50 | <jberryman> | I tried to define a function that encapsulated the above but it didn't work |
| 14:44:53 | <quicksilver> | jberryman: not a built in way, no. |
| 14:45:02 | <magthe> | well, I'm mostly just playing around at the moment to get a feel for TH... I have a function that returns a definition, this function takes a "base name", the result should be calls to a few functions, their names derived from the base name |
| 14:45:06 | <quicksilver> | what you want to do is use Lenses, also known as functional references. |
| 14:45:11 | <quicksilver> | then you write |
| 14:45:23 | <quicksilver> | modify accessor f type |
| 14:45:26 | <quicksilver> | or something ;) |
| 14:45:55 | <jberryman> | quicksilver: thanks, will do the google thing. So much to learn there is :) |
| 14:46:07 | <mib_hyumkc> | lilac i was thinking of generating all the possible numbers |
| 14:46:22 | <quicksilver> | jberryman: there is an implementation on hackage as 'data-accessor' |
| 14:46:34 | <quicksilver> | last I looked at it I didn't like their choice of primitives quite as much as my own. |
| 14:47:43 | <magthe> | lilac, EvilTerran: http://hpaste.org/10788 |
| 14:48:39 | <EvilTerran> | i see |
| 14:48:47 | <EvilTerran> | what type is f_base? String? |
| 14:48:54 | <magthe> | EvilTerran: yes |
| 14:49:18 | <EvilTerran> | i think you need a VarE for that |
| 14:49:46 | <magthe> | EvilTerran: ah, ok... can I mix that into the [d| ... |] notation later on? |
| 14:50:06 | <EvilTerran> | f1 = varE . mkName $ f_base ++ "2" |
| 14:50:11 | <EvilTerran> | should do it |
| 14:50:18 | <EvilTerran> | that'll make f1 :: ExpQ |
| 14:50:25 | <EvilTerran> | which is the right type for splicing with $(...) |
| 14:51:06 | <magthe> | EvilTerran: thanks, I'll try |
| 14:51:07 | <lilac> | mib_hyumkc: do you just want to count them, or do you want to find them all? |
| 14:51:59 | <pastorn> | is there some easy way to implement a max/min-heap? |
| 14:52:07 | <jaak_> | Hey, i'm trying to write some networking code with bytestring and binary, but things doesn't seem to work |
| 14:52:13 | <jaak_> | http://hpaste.org/10789 |
| 14:52:31 | <pastorn> | Data.Set balances with the middle value at the top |
| 14:52:35 | <jaak_> | so i guess the million dollar question is: how do i fix this |
| 14:52:41 | <pastorn> | not very algorithm friendly... :/ |
| 14:53:11 | <EvilTerran> | pastorn, won't extract-min be O(log n) in any heap implementation? |
| 14:53:21 | <EvilTerran> | which is what it is for Data.Set |
| 14:53:21 | <quicksilver> | jaak_: and if I answer your question, I get a million dollars? |
| 14:53:24 | <pastorn> | EvilTerran: O(1) |
| 14:53:27 | <quicksilver> | jaak_: that sounds good. |
| 14:53:30 | <jaak_> | server gets nast "*** Exception: too few bytes. Failed reading at byte position 5" |
| 14:53:34 | <EvilTerran> | really? |
| 14:53:36 | <jaak_> | no, i get |
| 14:53:38 | <EvilTerran> | ACTION goes to look up heads |
| 14:53:40 | <EvilTerran> | *heaps |
| 14:53:57 | <pastorn> | EvilTerran: depends on how you want to implement it |
| 14:54:03 | <pastorn> | this is for the napsack problem |
| 14:55:10 | <quicksilver> | jaak_: does it print anything before the exception? |
| 14:55:13 | <jaak_> | looks like lazy IO is root of all evil... but i'm not sure |
| 14:55:15 | <jaak_> | yep |
| 14:55:25 | <jaak_> | 1 to 9 |
| 14:55:40 | <quicksilver> | jaak_: then your problem is that your encoding is binary |
| 14:55:47 | <jaak_> | really? |
| 14:55:49 | <quicksilver> | jaak_: but you try to use '\n' as a separator |
| 14:55:52 | <quicksilver> | that's not going to work ;P |
| 14:56:01 | <quicksilver> | \n is ascii 10 or ascii 13 or both. |
| 14:56:14 | <jaak_> | i'm using lines |
| 14:56:14 | <lilac> | what's so bad about lazy IO? |
| 14:56:26 | <jaak_> | so there shouldn't be any '\n's |
| 14:56:27 | <quicksilver> | jaak_: yes but you 'encode' function produces a \n |
| 14:56:34 | <quicksilver> | jaak_: when you ask it to encode 10 |
| 14:56:39 | <jaak_> | oh blimey |
| 14:56:51 | <quicksilver> | ACTION slaps jaak_ around with a moldy trout |
| 14:56:59 | <quicksilver> | don't try to mix binary protocols with text protocols ;) |
| 14:57:05 | <lilac> | i suspect the lazy IO issue is that it can cause 'pure' code to do weird things. but so can using the IO monad to write to arbitrary bits of memory, so... |
| 14:57:11 | <quicksilver> | with a binary protocol I recommend just sending length first. |
| 14:57:14 | <jaak_> | quicksilver: oh man, thanks! |
| 14:57:29 | <jaak_> | so i should just send list and read list |
| 14:57:37 | <magthe> | EvilTerran: thanks, that did it ;) |
| 14:57:37 | <quicksilver> | well that would work too. |
| 14:57:54 | <EvilTerran> | :) |
| 14:58:03 | <jaak_> | @slap jaak_ |
| 14:58:04 | <lambdabot> | ACTION jabs jaak_ with a C pointer |
| 14:59:45 | <jaak_> | i'm off now, thanks again |
| 15:10:46 | <matthew-_> | @seen dons |
| 15:10:46 | <lambdabot> | dons is in #arch-haskell, #ghc, #darcs, #xmonad and #haskell. I don't know when dons last spoke. |
| 15:11:00 | <mauke> | preflex: seen dons |
| 15:11:00 | <preflex> | dons was last seen on #haskell 6 hours, 38 minutes and 47 seconds ago, saying: Cale, ddarius can someone do a killer logo for the haskell platform? :) |
| 15:12:06 | <Baughn> | Re: Said platform, is there a mailing list or some such yet? |
| 15:12:49 | <Baughn> | I wanted to plead for at least Edison to be included. ;_; |
| 15:13:40 | <Axman6> | i had a look at edison, and i couldn't see what it was really, nor did it looked anywhere near finished |
| 15:13:46 | <ArthurClemens> | what is the killer platform? |
| 15:13:53 | <Axman6> | that's from 5 mins of checking it out though |
| 15:14:13 | <quicksilver> | Baughn: I don't think there will be any additions for the initial release. |
| 15:14:30 | <Baughn> | Axman6: It's a bunch of data structures. Some documentation would be good, but it's pretty much complete as-is |
| 15:14:39 | <Baughn> | quicksilver: So.. no heaps for us? |
| 15:15:18 | <Baughn> | Oh well. So long as it includes cabal-install, telling users to "say cabal install in the dir to install" should be reasonably simple. :P |
| 15:15:26 | <quicksilver> | Baughn: not in the initial release. |
| 15:15:41 | <quicksilver> | but that leaves you plenty of time to campaign for its inclusion in 1.1 |
| 15:16:05 | <Baughn> | quicksilver: Don't think I won't. That's why I'm asking for.. well, contact information |
| 15:17:39 | <Baughn> | There should be some information on that wiki page about where it's being discussed |
| 15:18:15 | <quicksilver> | it's a wiki page |
| 15:18:17 | <quicksilver> | add some information :) |
| 15:18:29 | <Axman6> | make it up! |
| 15:18:58 | <Baughn> | And if I write down that all discussion happens in #haskell-platform, will that actually become true? -_- |
| 15:19:20 | <quicksilver> | it might do |
| 15:19:25 | <quicksilver> | I would not be in favour, though. |
| 15:19:37 | <quicksilver> | I think the discussion should be in #haskell until the volume proves too loud. |
| 15:19:46 | <quicksilver> | I believe in splitting discussion fora lazily, not in advance. |
| 15:20:26 | <Baughn> | Same, relaly |
| 15:20:37 | <Axman6> | no preemptive multitasking for you? |
| 15:26:19 | <Jaak> | quicksilver++ |
| 15:33:42 | <dmead> | hakell!!!!!!!! |
| 15:33:45 | <dmead> | err |
| 15:33:46 | <dmead> | haskell!!!!11 |
| 15:34:48 | <RayNbow> | @karma haskell |
| 15:34:49 | <lambdabot> | haskell has a karma of 0 |
| 15:34:53 | <RayNbow> | haskell++ |
| 15:35:38 | <Axman6> | @karma haskell |
| 15:35:38 | <lambdabot> | haskell has a karma of 1 |
| 15:35:44 | <Axman6> | excellent |
| 15:35:44 | <mauke> | preflex: karma haskell |
| 15:35:44 | <preflex> | karma for haskell: 9 |
| 15:36:05 | <quicksilver> | @where kuribas-indentation |
| 15:36:05 | <lambdabot> | http://kuribas.hcoop.net/haskell-indentation.el |
| 15:36:12 | <quicksilver> | oMG it remembered for a whole day |
| 15:36:14 | <quicksilver> | @botsnack |
| 15:36:14 | <lambdabot> | :) |
| 15:39:05 | <Leaves> | Hello, haskell defaults to converting a Word8 to decimal when showing, do you know how to show the hex value of a Word8? |
| 15:39:25 | <byorgey> | Leaves: you could use printf |
| 15:39:29 | <mauke> | > 42 :: Word8 |
| 15:39:30 | <lambdabot> | 42 |
| 15:39:37 | <quicksilver> | > showHex 42 "" |
| 15:39:38 | <mauke> | > showHex (42 :: Word8) "" |
| 15:39:38 | <lambdabot> | /tmp/3416115484415809881:67:40: Not in scope: `showHex' |
| 15:39:39 | <lambdabot> | /tmp/1748025794699974571:67:44: Not in scope: `showHex' |
| 15:39:43 | <mauke> | nooooo |
| 15:39:48 | <quicksilver> | ACTION slaps lambdabot for being a useless thing. |
| 15:39:52 | <mauke> | > printf |
| 15:39:53 | <lambdabot> | Overlapping instances for Show (String -> r) |
| 15:39:53 | <lambdabot> | arising from a use ... |
| 15:40:00 | <quicksilver> | Leaves: showHex is the answer, anyhow. |
| 15:40:05 | <byorgey> | > printf "%x" (42 :: Word8) |
| 15:40:06 | <lambdabot> | Add a type signature |
| 15:40:07 | <mauke> | > printf "%x" (42 :: Word8) :: String |
| 15:40:08 | <lambdabot> | "2a" |
| 15:40:26 | <RayNbow> | :t printf |
| 15:40:27 | <lambdabot> | forall r. (PrintfType r) => String -> r |
| 15:41:41 | <Deewiant> | lambdabot-- |
| 15:42:11 | <Leaves> | quicksilver: I don't seem to have the showHex function, I can't find it on google either |
| 15:42:17 | <quicksilver> | @hoogle showHex |
| 15:42:17 | <lambdabot> | Numeric showHex :: Integral a => a -> ShowS |
| 15:42:21 | <quicksilver> | there it is :) |
| 15:42:34 | <Deewiant> | @index showHex |
| 15:42:35 | <lambdabot> | Numeric |
| 15:45:27 | <Leaves> | quicksilver: ok, thanks, I was wondering what ShowS ment but I get it now ;) |
| 15:51:15 | <BeelsebobWork_> | how do I get ghc to produce a binary from a module not named Main? |
| 15:51:23 | <BeelsebobWork_> | (but with a main function in it) |
| 15:52:17 | <Deewiant> | --main-is ? |
| 15:52:45 | <BeelsebobWork_> | ah, yeh, minus a minus |
| 15:52:46 | <BeelsebobWork_> | cheers |
| 15:52:54 | <Deewiant> | no sweat |
| 16:13:01 | <camio> | quicksilver: Why did you use the IO in your futures instead of something unamb based? |
| 16:14:15 | <quicksilver> | because I don't believe in blocking values. |
| 16:14:49 | <quicksilver> | I don't believe it is "ordinary" haskell semantics to have a value of type "a" which has the semantics "I may block for a while before returning the value a" |
| 16:15:15 | <quicksilver> | worse still "I may block for a while, waiting for some external occurrence, before returning the value a" |
| 16:15:32 | <ttmrichter> | What happened to the PDF versions of the GHC documentation between 6.8.2 and 6.8.3? When I look at http://www.haskell.org/ghc/docs/6.8.2/ they're there, but when I look at http://www.haskell.org/ghc/docs/6.8.3/ there's only the HTML format. |
| 16:15:33 | <lambdabot> | Title: Index of /ghc/docs/6.8.2 |
| 16:15:35 | <quicksilver> | and even worse than that, other combinators which can some how look inside blocking values and get partial information. |
| 16:15:42 | <camio> | Ah, I see. It certainly makes it very difficult to reason and debug with that sort of semantics. |
| 16:15:43 | <quicksilver> | and use that to combine them. |
| 16:16:34 | <quicksilver> | I'm being a little bit unfairly negative. |
| 16:16:45 | <quicksilver> | Actually I think blocking values is a very interesting thing to study. |
| 16:16:55 | <quicksilver> | and I think it deserves study, explanation, and a formal semantics. |
| 16:17:06 | <quicksilver> | however, I think it's misrepresentation to call it 'pure haskell' |
| 16:17:12 | <quicksilver> | in my mind, it's a subtly different semantic. |
| 16:17:36 | <quicksilver> | so, I took the decision to push the blocking parts, and the 'waiting for external events' part into IO |
| 16:17:39 | <quicksilver> | our generic sin bin. |
| 16:17:47 | <opqdonut> | :) |
| 16:17:48 | <quicksilver> | but certainly there is no doubt that IO operations are 'allowed to' block, and so on. |
| 16:18:02 | <daf> | IO purgatory |
| 16:18:02 | <quicksilver> | of course, that's buried in the implementation. |
| 16:18:14 | <quicksilver> | when actually *using* my Reactive impl, you shouldn't need to see the IO anywhere. |
| 16:18:20 | <quicksilver> | (except when you interface to an IO-bound library) |
| 16:18:40 | <papermachine> | quicksilver, where is this implementation? |
| 16:19:03 | <camio> | Thanks for that explination. I'm going to try to make some interactive OpenGL demos with it. |
| 16:21:35 | <quicksilver> | papermachine: hmm. probably on hpaste. |
| 16:22:28 | <Deewiant> | http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=36 ? |
| 16:22:36 | <papermachine> | quicksilver, only thing I see there is something called OBJ loader |
| 16:22:52 | <quicksilver> | Deewiant's one is basically it. |
| 16:22:57 | <quicksilver> | but there is a slightly newer version. |
| 16:23:42 | <quicksilver> | papermachine: http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=65#a65 |
| 16:23:57 | <papermachine> | thanks. |
| 16:23:58 | <Deewiant> | deus? |
| 16:23:58 | <quicksilver> | camio: have you seen my basic openGL demo? |
| 16:24:04 | <quicksilver> | the hard part is writing the glue, really |
| 16:24:07 | <camio> | quicksilver: It looks like there's a memory leak in the blocking read of mappended futures. |
| 16:24:09 | <quicksilver> | to pipe the events in. |
| 16:24:14 | <camio> | No, I haven't seen it. |
| 16:24:41 | <quicksilver> | you could be right abotu the memory leak. Where? |
| 16:25:03 | <camio> | Well, the two threads don't kill one another after they putMVar. |
| 16:25:21 | <quicksilver> | http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=66#a66 |
| 16:25:25 | <camio> | So the MVar will stay in memory indefinately if the event doesn't happen. |
| 16:25:36 | <quicksilver> | camio: nope, that will get cleared on the next GC. |
| 16:26:01 | <quicksilver> | as I understand GHC's GC, at least. |
| 16:26:20 | <quicksilver> | MVars which have putters but no takers, or vice versa, are eligible to be GCed. |
| 16:26:22 | <camio> | How so? If blockingReadFuture takes an indefinate length of time, the GC cannot know if it needs to kill it. |
| 16:26:28 | <quicksilver> | oh, yes. |
| 16:26:30 | <quicksilver> | that's certainly true. |
| 16:26:35 | <quicksilver> | if the IO action blocks forever. |
| 16:26:42 | <camio> | yep |
| 16:26:44 | <quicksilver> | that's why you use 'Never' if you know that's the case. |
| 16:26:56 | <camio> | Right, but in real time systems you don't. |
| 16:27:35 | <quicksilver> | ACTION nods |
| 16:27:38 | <quicksilver> | yes, good point. |
| 16:30:18 | <quicksilver> | camio: the thing about my example is all the ugliness in the glue |
| 16:30:23 | <quicksilver> | IORefs to store the Event, the Reactive, etc. |
| 16:30:31 | <quicksilver> | I need to abstract the glue a bit better :) |
| 16:30:37 | <quicksilver> | but I haven't worked on it for a few weeks. |
| 16:31:01 | <camio> | Yeah, the glue is tough stuff. |
| 16:31:34 | <geezusfreeek> | ooh we are talking FRP |
| 16:31:36 | <camio> | I haven't seen a proposal yet that works and interfaces well with glut (ie. everything (input & output) needs to be on the same thread) |
| 16:32:29 | <geezusfreeek> | i've been working on a pure core for a FRP library based on reactive |
| 16:32:51 | <geezusfreeek> | the only ugly part should be some unsaveInterleaveIO at the top level, once i get to that |
| 16:33:21 | <quicksilver> | camio: I used a Chan to pipe the events, which is wrong. |
| 16:33:41 | <quicksilver> | camio: well actually a Chan isn't wrong, but forking a separate thread to read from it is wrong. |
| 16:33:55 | <quicksilver> | Can lead to event delivery getting delayed until GHC chooses to schedule that thread |
| 16:34:00 | <quicksilver> | so you can get slight UI delays. |
| 16:34:11 | <quicksilver> | I need to use threads less, I think. |
| 16:34:27 | <camio> | Yeah, we're seeing delays up to 0.5s using threads. |
| 16:34:28 | <quicksilver> | but the running GL code only in the main thread is fine. |
| 16:34:40 | <geezusfreeek> | my design is single threaded with plans to add some parallel combinators later on |
| 16:34:48 | <quicksilver> | in my code the delay is until the next time you poke the event pump |
| 16:34:54 | <quicksilver> | so it can be unbounded time if you're unlucky. |
| 16:35:01 | <camio> | yikes |
| 16:35:08 | <quicksilver> | the next external event (of any kind) will poke the pump and notice the pending event |
| 16:35:14 | <Axman6> | ok, here's a question: why do input and output have to be lumped together? the more i think about it, the more it seems like seperating the two makes more sense; output can't really change a program's state, it's only input where issues arrise. i'm sure there's flaws in my logic... |
| 16:35:16 | <quicksilver> | of course, if you commit to some consistent source of events |
| 16:35:22 | <quicksilver> | like a timer tick |
| 16:35:29 | <quicksilver> | then you have bounded error. |
| 16:35:34 | <quicksilver> | Axman6: that is one of the things FRP gives you. |
| 16:35:41 | <quicksilver> | Axman6: a strong separation between output and input. |
| 16:35:45 | <Axman6> | excellent |
| 16:35:56 | <Axman6> | so...i'm not retarded then? |
| 16:35:59 | <quicksilver> | no, you're wise. |
| 16:36:08 | <quicksilver> | camio: I didn't find the main-thread thing to be an issue, though. |
| 16:36:16 | <quicksilver> | camio: I only run IO actions in the main thread. |
| 16:36:31 | <quicksilver> | (there is an event pump which checks for pending IO actions at the end of the callback) |
| 16:36:44 | <camio> | Ah |
| 16:36:49 | <Axman6> | always seemed a bit \silly to me that i'd have to go through hoops to do soemthing as simple as putStrLn :\ |
| 16:37:02 | <quicksilver> | Axman6: A generic problem with haskell's IO monad is that it is too much. |
| 16:37:08 | <quicksilver> | It is a generic sin bin for all kinds of concepts |
| 16:37:27 | <quicksilver> | explicit memory management, blocking, forking, non-determinism |
| 16:37:39 | <quicksilver> | as well as more traditionally 'IO' thinks like input and output. |
| 16:37:47 | <quicksilver> | It's perfectly sound to bundle them all together. |
| 16:37:52 | <mmorrow> | @tell ivanm whichever of the bsd licenses you're using (re: ".. license are you willing to distribute runWIthInput under?") |
| 16:37:53 | <lambdabot> | Consider it noted. |
| 16:37:55 | <quicksilver> | but just like any good type system, the more you can separate the better. |
| 16:38:02 | <pa-ching> | It's a perfectly cromulent monad. |
| 16:38:16 | <quicksilver> | cromulent, but, alas, we embiggened it too well. |
| 16:38:31 | <mmorrow> | heh, i /thought/ i just heard cromulent |
| 16:38:33 | <lambdabot> | mmorrow: You have 4 new messages. '/msg lambdabot @messages' to read them. |
| 16:41:15 | <Axman6> | quicksilver: well, maybe in 5 years if no one else's done it, i'll do my PhD on the separation of I and O |
| 16:41:52 | <lightstep> | yay to write-only memory |
| 16:43:13 | <Axman6> | lightstep: excellent for apps that need extreme security, even they don't know what they've done |
| 16:44:20 | <lightstep> | that's true, but it still like the sound of it |
| 16:45:10 | <lightstep> | http://www.thinkgeek.com/stuff/looflirpa/shrinter.shtml <- like this |
| 16:46:17 | <camio> | quicksilver: Is nonblockingReadFuture supposed to only return (Just (t,x)) after t has occurred? |
| 16:46:28 | <geezusfreeek> | in a sense, FRP could be seen as such a separation. an arrow from I to O |
| 16:46:44 | <quicksilver> | camio: it's supposed to return Nothing (immediately) if the future has not yet occurred. |
| 16:46:53 | <quicksilver> | camio: nad Just (t,x) (immediately) if it has. |
| 16:47:05 | <geezusfreeek> | quicksilver, you have FRP code up? i would like to see it if so |
| 16:47:22 | <quicksilver> | well I pasted my reactive impl and a very simple GL demo |
| 16:47:33 | <geezusfreeek> | aha. on hpaste? |
| 16:47:46 | <quicksilver> | http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=65 |
| 16:47:48 | <camio> | <- trying to figure out how to solve the nbr append problem. |
| 16:47:49 | <quicksilver> | http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=66 |
| 16:48:17 | <geezusfreeek> | ACTION peeks |
| 16:48:31 | <quicksilver> | camio: note that I haven't tried to solve the value caching problem at all. |
| 16:48:42 | <quicksilver> | I have decided that value caching is less important than semantics I believe in. |
| 16:48:46 | <quicksilver> | this is only an exploration. |
| 16:48:56 | <quicksilver> | although if it is useful for someone that's a bonus ;) |
| 16:49:33 | <camio> | By value caching are you referring to having mappend always return the correct order? |
| 16:51:15 | <camio> | quicksilver: I think I have a solution to the correct odering problem. Do you want to hear it? |
| 16:51:28 | <quicksilver> | camio: yes please. |
| 16:51:45 | <quicksilver> | (by the value caching problem I was referring to fmap not recalculating the value) |
| 16:51:57 | <camio> | make nonblockingReadFuture be of type Future a -> IO (UtcTime, Maybe a). |
| 16:52:16 | <camio> | So if it returns nothing, you are guarenteed that the future occurs after time t. |
| 16:52:17 | <quicksilver> | and have it yield a lowerbound? |
| 16:52:27 | <quicksilver> | yes, I considered that. |
| 16:52:41 | <quicksilver> | I'm not sure why I didn't try it. |
| 16:52:48 | <quicksilver> | I will think about it again, thank you ;) |
| 16:52:55 | <camio> | Then mappend becomes easy. |
| 16:53:04 | <camio> | np |
| 16:53:27 | <Deewiant> | what is this 'Deus' package? |
| 16:53:55 | <mmorrow> | ArthurClemens: re: parsing java(script). check out WebBits on hackage. it has a (works well) javascript parser (uses parsec) which is (at least i was surprised) suprisingly concise. i would' |
| 16:54:21 | <geezusfreeek> | i don't have my code up, but just for reference my types at this moment are data Time t = Always | At t; newtype TimedVal t a = Timed (t, a); newtype Future t a = Future (Maybe (TimedVal t a)); newtype Event t a = Event [Future t a]; newtype Signal t a = Signal (a, Event t a) |
| 16:54:32 | <mmorrow> | ve done the AST differently maybe, but that might just be my personal taste |
| 16:54:42 | <geezusfreeek> | just a pure core |
| 16:54:55 | <quicksilver> | Deewiant: just some random hierarchy name I use for stuff I'm working on. |
| 16:55:00 | <geezusfreeek> | the reasoning behind Event being a list is to convey Never with [] |
| 16:55:14 | <Deewiant> | quicksilver: so none of this is released anywhere? |
| 16:55:20 | <hugo_> | is there any way for me to store the value of a computation ? |
| 16:55:30 | <quicksilver> | Deewiant: well, it's released on hpaste and moonpatio ;) |
| 16:55:32 | <hugo_> | i have this monad that always returns the same value for the same input |
| 16:55:37 | <Deewiant> | :-P |
| 16:55:42 | <geezusfreeek> | the list is populated with unsafeInterleaveIO and the combinators will be carefully written to be as lazy as possible |
| 16:55:50 | <hugo_> | and i dont want haskell to be doing that computation all the time ... :/ |
| 16:56:03 | <quicksilver> | hugo_: yes. give it a name and it will only be computed once. |
| 16:56:05 | <mmorrow> | hugo_: you could use a Map in an MVar stashed away somewhere possibly |
| 16:56:21 | <hugo_> | quicksilver: with a "let/where" clause ? |
| 16:56:29 | <quicksilver> | yes, for example. |
| 16:56:38 | <hugo_> | ólright |
| 16:56:42 | <quicksilver> | your question wasn't very precise so my answer is not very precise ;) |
| 16:56:47 | <hugo_> | yes ok |
| 16:56:48 | <mmorrow> | ah, yeah i may have misinterpreted what you wanted.. |
| 16:56:53 | <hugo_> | ill try to be more precise |
| 16:56:57 | <quicksilver> | geezusfreeek: yes, that's a more literal embedding into blocking pure values. |
| 16:57:10 | <quicksilver> | geezusfreeek: I'm trying to avoid such things but if you make them work taht's great :) |
| 16:57:28 | <Axman6> | raer, why do all the interesting discussions happen when i should be asleep? |
| 16:57:29 | <hugo_> | im using hxt, and curl, so i have this function that uses curl, and returns an IO String, then i want to parse it with hxt in several different ways |
| 16:57:53 | <hugo_> | and i dont want to be sending http requests whenever i call my "getHTML" function with the same url |
| 16:57:57 | <geezusfreeek> | quicksilver, yes, it's a blocking core. i intend to get around that by writing a nonblocking top level |
| 16:58:23 | <hackage> | Uploaded to hackage: ForSyDe 3.0 |
| 16:59:15 | <geezusfreeek> | i got tired of playing with unsafePerformIO and IORefs, is all ;) |
| 17:08:11 | <mmorrow> | hugo_: possibly have something like newtype HtmlCache = HtmlCache (MVar (Map URL String)), then everytime you call getHTML check the Map in the MVar first |
| 17:08:23 | <mmorrow> | (type URL = String or whatever) |
| 17:09:01 | <ziman> | oh, does λ-bot limit eval's output less in queries? right now she threw 6 lines at me (from a single > "badger " command) |
| 17:09:13 | <mmorrow> | possibly also you could HtmlCache (MVar (Map URL (ClockTime, String))) |
| 17:09:28 | <mmorrow> | and refresh old entries or something |
| 17:10:22 | <mmorrow> | ziman: in private /msgs the limit is much larger |
| 17:10:42 | <mmorrow> | hmm, lunabot should do that too |
| 17:17:55 | <Apocalisp> | Is HList a monoid by any stretch? |
| 17:19:39 | <ddarius> | HList isn't anything |
| 17:19:47 | <ddarius> | It's a library |
| 17:20:56 | <mauke> | isn't HList basically (,)? |
| 17:21:25 | <Apocalisp> | more like HCons e l | HNil |
| 17:22:04 | <mauke> | ok, so Maybe (,) |
| 17:22:11 | <Apocalisp> | ah! |
| 17:22:15 | <vixey> | (,) will do fine |
| 17:29:14 | <RayNbow> | @seen int-e |
| 17:29:14 | <lambdabot> | I saw int-e leaving #ghc, #haskell-overflow and #haskell 7h 25m 26s ago, and . |
| 17:29:45 | <dons> | ?users |
| 17:29:46 | <lambdabot> | Maximum users seen in #haskell: 515, currently: 503 (97.7%), active: 11 (2.2%) |
| 17:33:28 | <leimy> | neat |
| 17:33:33 | <leimy> | buttloads of lurking |
| 17:33:38 | <dons> | yup |
| 17:37:05 | <Axman6> | leimy: everyone knows there's only three outspoken comp sci guys around. |
| 17:37:10 | <Axman6> | dons is two of them >_> |
| 17:37:18 | <leimy> | heh |
| 17:37:44 | <leimy> | I sometimes wish I'd have stayed in academia |
| 17:39:09 | <Eridius> | leimy: yeah but then you'd have to deal with students, and publishing papers... |
| 17:39:12 | <leimy> | true |
| 17:39:14 | <dons> | Axman6: :P |
| 17:39:35 | <leimy> | but that's probably less soul-crushing than having one's designs misunderstood by management that makes decisions for new product directions without asking engineers |
| 17:39:46 | <leimy> | or driven by a sales force that's maybe only technically qualified to sell used cars |
| 17:39:49 | <leimy> | ACTION is bitter today |
| 17:40:11 | <leimy> | Whatever, I guess it's a paycheck. |
| 17:40:26 | <dons> | thoughts on the platform, guys? http://haskell.org/haskellwiki/Haskell_Platform |
| 17:40:28 | <lambdabot> | Title: Haskell Platform - HaskellWiki |
| 17:40:29 | <dons> | questions? |
| 17:40:36 | <dons> | if you add questions, i can turn them into tickets. |
| 17:40:41 | <dons> | add questions here, i should say |
| 17:40:50 | <leimy> | Nice |
| 17:40:51 | <andyjgill> | Cool pics, dons. tulip, is assume. |
| 17:41:04 | <leimy> | ACTION wishes there was an SNMP implementation for Haskell |
| 17:41:06 | <leimy> | :-) |
| 17:41:11 | <dons> | the original graphs were tulips, yeah. |
| 17:41:26 | <dons> | andyjgill: i think we can get the tracer out this week, btw. |
| 17:41:33 | <dons> | jodee's here, and i'm doing some releases. |
| 17:41:42 | <leimy> | system admins I know absolutely HATE the idea of cabal install :-) |
| 17:41:48 | <andyjgill> | Great. That would be useful to everyone. |
| 17:41:50 | <dons> | leimy: ok. that's fine. |
| 17:41:58 | <leimy> | they see it as yet another version of CPAN |
| 17:42:01 | <dons> | the platform is for admins, so they know what native package to install. |
| 17:42:03 | <leimy> | to screw up their machines with. |
| 17:42:03 | <Taggnostr> | @src Just |
| 17:42:03 | <lambdabot> | Source not found. |
| 17:42:13 | <leimy> | dons: that's great then :-) |
| 17:42:13 | <dons> | leimy: right. they wouldn't use cabal-install |
| 17:42:24 | <dons> | its for developers, who install in $HOME |
| 17:42:26 | <dons> | not globally. |
| 17:42:52 | <dons> | but admins can easily answer the users query: "Please can you install `Haskell'" |
| 17:43:10 | <dons> | they just have to install the platform metapackage from their distro. |
| 17:43:29 | <Zao> | dons: And then get nagged for the bazillion extralibs packages the distro has split everything into. |
| 17:43:40 | <dons> | no no. 1 package. |
| 17:43:44 | <dons> | a metapackage. |
| 17:44:20 | <Zao> | Ah, you're talking about a future dream world. |
| 17:44:20 | <dons> | probably gentoo and arch will be the first compliant distros. |
| 17:44:29 | <dons> | Zao: yes. 2 weeks away :) |
| 17:44:32 | <dons> | get ready for the *future* ! |
| 17:44:50 | <Zao> | s/future/breakage :P |
| 17:44:51 | <leimy> | so wait |
| 17:44:55 | <dons> | andyjgill: can we hand out ghc on usb keys at the next ICFP |
| 17:44:55 | <leimy> | system admin installs one package? |
| 17:44:56 | <dons> | :) |
| 17:45:03 | <dons> | leimy: apt get haskell-platform |
| 17:45:03 | <leimy> | how the hell do they deal with dependencies changing? |
| 17:45:26 | <andyjgill> | Great idea. Why not get ones with the Galois logo? (sponsored by Galois). |
| 17:45:32 | <leimy> | dons: I guess I need to read more |
| 17:45:33 | <dons> | hmm. nice idea. |
| 17:45:43 | <leimy> | what if I need four different versions of some lib for some reason? |
| 17:45:45 | <dons> | leimy: distros could support the platform by just having all the subpackages |
| 17:45:52 | <dons> | leimy: then you're not targetting the platform. |
| 17:45:56 | <andyjgill> | Like mugs or teeshirts. but actually useful. |
| 17:45:57 | <dons> | you're building on something else. |
| 17:46:00 | <dons> | andyjgill: yeah. |
| 17:46:10 | <dons> | and preloaded with haskell :) |
| 17:46:12 | <dcoutts> | leimy: if your distro supports that you can do that, cabal-install can certainly handle multiple versions of the same package |
| 17:46:14 | <leimy> | dons: I see, so by targetting and keeping up with "the platform" I'm able to make my stuff work everywhere |
| 17:46:19 | <dons> | leimy: right. |
| 17:46:25 | <leimy> | interesting |
| 17:46:28 | <dons> | application authors will target what the platform provides. |
| 17:46:30 | <leimy> | it's strict on developers |
| 17:46:33 | <leimy> | update or die |
| 17:46:35 | <leimy> | :-) |
| 17:46:38 | <dons> | just like you might only base on the python library set. |
| 17:46:46 | <leimy> | if the platform moves and I don't, my stuff isn't with the platform. |
| 17:47:00 | <leimy> | I can handle that |
| 17:47:01 | <dons> | it'll depend on an older version. |
| 17:47:05 | <leimy> | right. |
| 17:47:15 | <leimy> | makes sense |
| 17:47:22 | <dons> | but yes, a lot of stability and clarity for application developers. |
| 17:47:36 | <leimy> | So I should target the platform if I care about distribution |
| 17:47:50 | <leimy> | which sounds good, especially since I get paid to code :-) |
| 17:48:05 | <leimy> | unfortunately the closest I've been to commercial haskell is erlang :-) |
| 17:48:15 | <leimy> | not that erlang's so bad, it's just not haskell. |
| 17:48:22 | <papermachine> | What GUI libraries are in the Platform? |
| 17:48:31 | <papermachine> | I can't find a list of what's in and what isn't |
| 17:49:45 | <dons> | the initial release is what is currently known as extralibs, + zlib, http, binary and utf8-string |
| 17:49:53 | <dons> | so a small target to get our procedures right. |
| 17:50:07 | <dons> | http://trac.haskell.org/haskell-platform/ |
| 17:50:08 | <lambdabot> | Title: haskell-platform - Trac |
| 17:50:10 | <Baughn> | And cabal-install? |
| 17:50:13 | <dons> | of course. |
| 17:50:22 | <Baughn> | Yay. That's the most important. bit. ^_^ |
| 17:50:37 | <Baughn> | The platform is a nice idea, but just being able to tell people "run cabal install <foo>"... |
| 17:50:40 | <dons> | after that, people will be able to propose libraries and tools from hackage (And a few special exceptions) for inclusion |
| 17:50:54 | <Baughn> | Haddock, happy, alex.. |
| 17:51:29 | <Baughn> | ACTION is very happy about the whole thing. |
| 17:53:25 | <dons> | would someone like to make a logo for the haskell platform? |
| 17:53:34 | <dons> | perhaps based on ideas from that bubble graph. |
| 17:53:35 | <Baughn> | Eh? I thought we already had one |
| 17:53:38 | <dons> | some kind of package swarm |
| 17:54:00 | <dons> | a swarm of lambda bees |
| 17:54:02 | <idnar> | dons: you could have a picture of Haskell Curry on a gallows |
| 17:54:03 | <Beelsebob> | dons: a lambda on its side -- so it looks like a platform :P |
| 17:54:06 | <Leaves> | dons: what about doing for versions a.b.c where when a changes it breaks backwards compatibility, when b changes it keeps backwards compatibility (but not forward, so new functions may be addes) and c for bugfixes, this would be really usefull, since then in the cabal files you don't need the < stuff anymore, just depend on lib-1.1.* and this will always work |
| 17:54:25 | <Baughn> | http://haskell.org/sitewiki/images/4/43/Small-package-bubbles.png <-- This one gets my vote, with the bubbles rearranged as a lambda |
| 17:54:31 | <dons> | cabal now supports base 3.* syntax |
| 17:54:41 | <dons> | so you can by default specify ranges that satisfy the version system. |
| 17:54:48 | <dons> | which actually works, unlike saying, base >= 3 |
| 17:55:51 | <Leaves> | note that when ghc is smart it even works when a package depends on liba-1.0 and libb-1.0 and when libb has the function f which is used, when liba introduces also a function f in liba-1.1 then if ghc is smart it knows it has to take the f from libb.. |
| 17:57:53 | <Leaves> | dons: yes, but when you depend on lib-2008.0.* and then in 2009 the next lib lib-2009.0.0 is released which is backwards compatible you have to add this to the former pakcage that depens on this lib |
| 17:58:10 | <dons> | no no, you don't depend on the platform itself. |
| 17:58:13 | <dons> | it provides no code. |
| 17:58:22 | <dons> | you pick from libs *in* the platform. |
| 17:59:07 | <Leaves> | dons: aah, I though you ment that all packages in the platform had to use that verison policy? |
| 18:00:14 | <Leaves> | I see, so the platform is versioned yyyy.major.minor, the packages all still use their own version scheme |
| 18:02:37 | <leimy> | Leaves: yep, you could say Platform contains those packages |
| 18:02:44 | <leimy> | or those versions of those packges |
| 18:02:46 | <gbacon> | > let { digits = "0123456789"; strs n = case n of { 0 -> [[]]; _ -> digits >>= \c -> map (c:) $ strs (n-1) } } in length $ strs 4 |
| 18:02:50 | <andyjgill> | Random question: has anyone got an example of using a pseudo-tty in Haskell? I can not find any users for openPseudoTerminal in System.Posix.Terminal |
| 18:02:52 | <gbacon> | > let { digits = "0123456789"; strs n = case n of { 0 -> [[]]; _ -> digits >>= \c -> map (c:) $ strs (n-1) } } in length $ strs 4 |
| 18:02:54 | <lambdabot> | 10000 |
| 18:09:23 | <rwbarton> | Has anyone tried building darcs yhc recently? |
| 18:10:05 | <rwbarton> | I get this error: http://hpaste.org/10792 |
| 18:11:05 | <chrisdone> | tip of the day: “undefined” is awesome |
| 18:15:07 | <_andre> | hello |
| 18:15:15 | <_andre> | anyone here using Agda? |
| 18:15:24 | <dons> | swiert does. |
| 18:15:53 | <_andre> | i'm having trouble building it |
| 18:17:16 | <lightstep> | why is bytestring not in the platform? is it in bse? |
| 18:17:46 | <bos> | it's in extralibs |
| 18:19:20 | <gbacon> | why would runplugs complain about __stginit_mtlzm1zi1zi0zi1_ControlziMonadziError_ being undefined? |
| 18:21:16 | <RayNbow> | dons, will the Haskell, Batteries Included platform get a flashy name? |
| 18:21:39 | <luite_> | and will it get an Enterprise Edition? |
| 18:21:46 | <olsner> | "ghc"? :P |
| 18:23:23 | <dons> | RayNbow: The HDK ? :) |
| 18:24:12 | <RayNbow> | dons: hmm... but people might compare Haskell to Java (JDK) then... is that something desirable? |
| 18:24:26 | <dons> | hehe |
| 18:24:48 | <vegai> | or MDK, the game? |
| 18:24:52 | <leimy> | I think so |
| 18:25:08 | <augustss> | dons: will the platform packages work on windows? it happens to me all the time that some cool package doesn'y work under windows. |
| 18:25:10 | <leimy> | I think when you compare Haskell to Java, in a serious way, you start to realize how very wrong you were about something. |
| 18:25:17 | <leimy> | what that is, I don't know |
| 18:25:21 | <dons> | augustss: yes, they absolutely must. |
| 18:25:28 | <dons> | augustss: that's a hurdle for inclusion. |
| 18:25:37 | <dons> | augustss: we're going to build windows installers too |
| 18:25:48 | <leimy> | that's cool |
| 18:26:13 | <dons> | augustss: we can use inclusion in the package as a hurdle to force api standardisation and portability. |
| 18:26:32 | <dcoutts> | augustss: I'm hoping to build windows installers next week |
| 18:26:52 | <leimy> | from now on, Haskell Platform will be known as, Vindaloo |
| 18:26:55 | <leimy> | ? |
| 18:27:21 | <dcoutts> | augustss: having decent build reporting will also make it clearer to you and to package maintainers if things do not build on windows |
| 18:28:12 | <dcoutts> | augustss: a bit of public naming and shaming in that area should go a long way :-) |
| 18:29:08 | <dons> | a unix-only platform would be a separate thing that could be tackled later. |
| 18:29:48 | <Botje> | murder death stack overflow! |
| 18:29:49 | <lightstep> | maybe the platform release can be at the say time is hcar? since both are twice-a-year summaries of haskell library development |
| 18:29:57 | <lightstep> | s/say/same/ |
| 18:30:10 | <RayNbow> | dons: will readline be included in the Haskell Platform? (because that's a package I was not able to build under Windows) |
| 18:30:36 | <dcoutts> | lightstep: I think the most useful thing would be for it do be in sync but out of phase with ghc releases |
| 18:31:03 | <dcoutts> | lightstep: a window of a month or so for maintainers to update packages for new ghc releases |
| 18:31:21 | <dons> | RayNbow: its not useful to ask specific questions, "is X in or out". since that's not how it is decided. |
| 18:31:24 | <dcoutts> | eg gtk+ releases usually have to be 3 months before gnome releases |
| 18:31:39 | <dons> | the burden will be on the proposer for it to go in to show that metrics are satsified. |
| 18:31:48 | <dons> | and for now, we only start with extralibs |
| 18:31:54 | <dcoutts> | right, dons and myself are not deciding |
| 18:32:02 | <dcoutts> | we're not the gate keepers |
| 18:32:30 | <dons> | no politics, no arguments. only statistics. |
| 18:32:37 | <dcoutts> | the standards for inclusion are a discussion the community needs to have and one we will start after the first release |
| 18:32:48 | <dons> | working out what the standards are is the next thing, as dcoutts says |
| 18:33:06 | <dons> | probably we can write a paper on automated metrics for quality afterwards :) |
| 18:33:17 | <dcoutts> | and we'll then use those standards and that protocol for the next round of additions |
| 18:52:02 | <olsner> | @ty fromRight |
| 18:52:03 | <lambdabot> | Not in scope: `fromRight' |
| 18:52:20 | <olsner> | @hoo Either a b -> b |
| 18:52:21 | <lambdabot> | Maybe you meant: hoogle hoogle+ show todo yow |
| 18:52:24 | <olsner> | @hoogle Either a b -> b |
| 18:52:24 | <lambdabot> | Prelude either :: (a -> c) -> (b -> c) -> Either a b -> c |
| 18:52:24 | <lambdabot> | Data.Either either :: (a -> c) -> (b -> c) -> Either a b -> c |
| 18:52:24 | <lambdabot> | Data.Typeable typeOf2 :: Typeable2 t => t a b -> TypeRep |
| 18:54:13 | <Deewiant> | ?ty either (error "fromRight :: Left") id |
| 18:54:15 | <lambdabot> | forall a b. Either a b -> b |
| 18:54:48 | <olsner> | > either undefined id (Right "right") |
| 18:54:49 | <lambdabot> | "right" |
| 18:55:35 | <djsiegel> | Hey, I want to parse a simple, small XML document and I have no idea where to start. I'm seeing way too many XML parsing options. I don't want to use tagsoup, and I don't want to have to use do arrow notation. Can someone point me to a simple tutorial? I haven't found one yet. |
| 18:56:33 | <djsiegel> | HaXml seems fine, but I just can't find a 15-line tutorial that shows me how to extract the data I need from my Document once I've called xmlParse. |
| 18:56:45 | <vixey> | djsiegel: Maybe that info is in the documentation? |
| 18:57:03 | <vixey> | although isn't HaXml for constructing XML? |
| 18:57:07 | <djsiegel> | I've been pouring over the haddocs for a while. |
| 18:57:08 | <vixey> | rather than parsing it.. |
| 18:57:09 | <ADINSX> | http://pastebin.com/m60338c0b Hi, im trying to get a list of Strings out of a file with the lines function |
| 18:57:12 | <djsiegel> | HaXml does both. |
| 18:57:16 | <vixey> | oh I see |
| 18:57:18 | <ADINSX> | i thought readLine was supposed to return a string |
| 18:57:30 | <ADINSX> | but apparently it returns an IO string, how do i get the string information out? |
| 18:59:31 | <Beelsebob> | ADINSX: using >>= |
| 18:59:48 | <Beelsebob> | readLine >>= somethingThatDoesSomethingWithTheString |
| 19:00:05 | <Beelsebob> | readline >>= putStrLn -- for example |
| 19:00:15 | <ADINSX> | so readline >>= lines |
| 19:00:18 | <ADINSX> | to return a list of strings |
| 19:00:20 | <ADINSX> | ? |
| 19:00:28 | <Beelsebob> | nope, once you're in the IO monad you can't get out again |
| 19:00:38 | <ADINSX> | what really? |
| 19:00:41 | <ADINSX> | hmm |
| 19:00:43 | <Beelsebob> | so readLine >>= (return . lines) |
| 19:00:45 | <Beelsebob> | yes, really |
| 19:00:57 | <Beelsebob> | otherwise you can do all sorts of crazy stuff |
| 19:01:03 | <Beelsebob> | (that's unsafe) |
| 19:01:11 | <ADINSX> | hmmm |
| 19:01:13 | <Beelsebob> | what I recommend doing is having a top level IO based function |
| 19:01:26 | <Beelsebob> | which calls into purely functional stuff to do the bulk of the work |
| 19:01:44 | <Beelsebob> | incidentally, there's already a nice function for doing that called interact |
| 19:01:54 | <Beelsebob> | interact takes a function from String -> String, and performs IO |
| 19:02:02 | <Beelsebob> | it runs the function lazily |
| 19:02:17 | <ADINSX> | ah ok |
| 19:02:22 | <Beelsebob> | so if you give it something like (unlines . processCommand . lines) you get nice interactive behavior |
| 19:02:46 | <ADINSX> | i saw some stuff on interact but ignored it since i thought there would be an easier way |
| 19:02:55 | <Beelsebob> | interact *is* the easy way |
| 19:03:00 | <Beelsebob> | it's not the most powerful way |
| 19:03:02 | <Beelsebob> | but it is the easy way |
| 19:03:17 | <ADINSX> | gotcha |
| 19:03:22 | <Beelsebob> | (it's also surprisingly powerful when you think about what processCommands can actually be |
| 19:07:43 | <Baughn> | It's also surprisingly easy to get wrong and deadlock, but meh. :P |
| 19:09:26 | <Philippa_> | plus you always end up trying to decide whether you're reading and writing anyway and frankly you really /want/ helper functions for that bit |
| 19:09:37 | <Philippa_> | I'm tempted to say just doing it with monadic IO is actually a higher-level approach |
| 19:23:36 | <b_jonas> | ah, there are new lambdacats |
| 19:23:47 | <b_jonas> | two |
| 19:23:47 | <newsham> | url? |
| 19:23:54 | <b_jonas> | google "lambdacats" |
| 19:24:07 | <b_jonas> | @g lambdacats |
| 19:24:07 | <lambdabot> | Maybe you meant: gazetteer get-shapr ghc girl19 google gsite gwiki . ? @ v |
| 19:24:11 | <b_jonas> | @google lambdacats |
| 19:24:15 | <lambdabot> | http://arcanux.org/lambdacats.html |
| 19:24:15 | <lambdabot> | Title: Lambdacats |
| 19:24:38 | <rwbarton> | Can I tell cabal install to install a specific version of a package (not the latest one)? |
| 19:24:42 | <Botje> | @protontorpedo |
| 19:24:43 | <lambdabot> | how is haskell different than java? |
| 19:24:56 | <Botje> | heh heh |
| 19:25:03 | <_zenon_> | Is that a real quote? |
| 19:25:40 | <ziman> | @protontorpedo |
| 19:25:41 | <lambdabot> | wil I make mroe $$ than learning java or APL or smalltalk or plt scheme or ruby or perl or clisp? |
| 19:25:58 | <newsham> | public class Id<A> implements F<A,A> { public A call(A arg) { return arg; } } |
| 19:26:36 | <tromp_> | your $$ depend more on the company than on the language... |
| 19:27:02 | <Botje> | a cobol or smalltalk hacker will normally make more |
| 19:27:07 | <Botje> | because there are less of them :) |
| 19:27:32 | <newsham> | go with Rexx |
| 19:27:36 | <newsham> | are JCL |
| 19:29:56 | <newsham> | recently a company started selling a product that emulated ibm mainframes and rather than have their billion dollar overinflated market get eaten up, IBM tried to sue them out of existence and when they figured they couldnt do that, just bought htem to icebox the product. |
| 19:30:07 | <newsham> | lots of overinflated costs in that market |
| 19:30:32 | <Botje> | heh heh |
| 19:30:36 | <b_jonas> | newsham: heh |
| 19:34:03 | <quicksilver> | @tell camio I remembered the problem with that solution.. But, thanks for making me thinkj about it. |
| 19:34:04 | <lambdabot> | Consider it noted. |
| 19:41:06 | <b800> | is there any way to do ioctl-level calls in haskell? |
| 19:41:18 | <b800> | googling hasn't really helped me unless i'm doing something wrong |
| 19:42:57 | <newsham> | b800: you can call C API's directly with FFI |
| 19:43:14 | <b800> | good to know |
| 19:43:31 | <b800> | i was wondering if there was a library or something, but i guess i can dive into FFI |
| 19:43:37 | <Philonous> | @src newIORef |
| 19:43:38 | <lambdabot> | newIORef v = stToIO (newSTRef v) >>= \ var -> return (IORef var) |
| 19:43:38 | <b800> | i haven't used FFI ever before though |
| 19:43:41 | <halberd> | what's the first thing you do after you learn the basics of a new programming language? |
| 19:43:57 | <halberd> | not haskell in particular |
| 19:44:00 | <newsham> | "ioctl" is really broad, there's not going to be a library for that. but there might be libraries that cover specific sets of ioctls |
| 19:44:04 | <b800> | generally, forget them |
| 19:44:11 | <newsham> | such as terminal controls or packet filter, for example |
| 19:44:25 | <halberd> | for example do you translate a program in another language that you already know, into the new language? |
| 19:44:30 | <newsham> | halberd: write lots of stuff in it and read some simpler examples |
| 19:44:36 | <Philonous> | @src IORef |
| 19:44:36 | <lambdabot> | newtype IORef a = IORef (STRef RealWorld a) |
| 19:44:43 | <b800> | newsham: well, there could always be a binding like ioctl :: Handle -> Request -> IO () |
| 19:45:02 | <b800> | then look up the actual requests from somewhere else, but that would be asking a lot |
| 19:45:23 | <newsham> | b800: right, but the ioctl API is a catch-all for things that dont fit the normal read/write API model, and it supports arbitrary in-out buffers |
| 19:46:10 | <Philonous> | So IORefs are compiler magic? Or are they actually definable in haskell? |
| 19:46:16 | <newsham> | the call to the ioctl function isnt the hard part, its arranging to marshall data into and out of the odd structures |
| 19:46:20 | <dibblego> | @where hlist |
| 19:46:20 | <lambdabot> | http://homepages.cwi.nl/~ralf/HList |
| 19:46:40 | <idnar> | @type newIORef |
| 19:46:42 | <lambdabot> | Not in scope: `newIORef' |
| 19:46:46 | <daedra> | anyone recommend a tutorial on lambda calculus? |
| 19:47:00 | <newsham> | dae: i imagine wikipedia would have a decent intro |
| 19:47:05 | <idnar> | heh |
| 19:47:17 | <daedra> | yeah it is quite good |
| 19:47:38 | <Philonous> | Strange, he knew that one a second ago |
| 19:47:54 | <idnar> | Philonous: that was @src |
| 19:48:02 | <idnar> | which just looks stuff up in a text file, I believe |
| 19:48:04 | <Philonous> | Oh, right |
| 19:50:08 | <newsham> | I think IORef's are just a layer on top of STRef? those are probably "compiler magic" in as much as the built-in IO stuff is kind of "compiler magic" |
| 19:50:24 | <newsham> | <- kinda guessing here |
| 19:50:45 | <olsner> | STRef is (in ghc) a wrapper around a MutVar# which has a bunch of (impure?) primitives |
| 19:51:05 | <newsham> | you could probably invent your own IORefs using other APIs like the FFI stuff |
| 19:51:22 | <Philonous> | I see |
| 19:52:10 | <olsner> | but for all intents and purposes it's magic (but it could probably be implemented as something explicitly stored and managed in the state threaded through ST) |
| 19:53:32 | <lightstep> | they can also be programmed in pure haskell |
| 19:53:52 | <lightstep> | oh, maybe not |
| 19:54:01 | <lightstep> | because they're too polymorphic |
| 19:54:48 | <lightstep> | it the type was newSTRef :: MyClass a => a -> ST s (STRef s a), you could do that |
| 19:54:56 | <olsner> | yeah, I'm not sure if you can make them typecheck properly in the type system |
| 19:55:08 | <olsner> | maybe with unsafeCoerce :P |
| 19:55:20 | <newsham> | Typeable? |
| 19:55:30 | <b_jonas> | you can't implement them efficently anyway |
| 19:55:59 | <lightstep> | you can have access to them in O(log #vars) |
| 19:56:13 | <b_jonas> | lightstep: yeah, but also consider garbage collection |
| 19:56:17 | <b_jonas> | you can't garbage collect them |
| 19:56:40 | <lightstep> | why not? |
| 19:57:03 | <newsham> | if you store your refs in a datastructure, they'll always be referenced |
| 19:57:44 | <mmorrow> | just looked up {ST,IO}Ref |
| 19:57:50 | <mmorrow> | data STRef s a = STRef (MutVar# s a) |
| 19:57:54 | <mmorrow> | newtype IORef a = IORef (STRef RealWorld a) |
| 19:58:09 | <b_jonas> | I'll have to understand ST and STRef once |
| 19:58:23 | <hackage> | Uploaded to hackage: hlibev 0.1 |
| 19:58:24 | <Philonous> | So, when would I want to use a IORef instead of just binding the value to a name? |
| 19:58:28 | <lightstep> | newsham, only the newer version of the structure (with the new values) will be references |
| 19:58:50 | <newsham> | light: *nod* but if the rest of the program stops using the value, it doesnt go away |
| 19:58:52 | <lightstep> | *will have |
| 19:59:22 | <b_jonas> | lightstep: yes, as in when you create lots of iorefs and quickly forget about each |
| 19:59:48 | <Philonous> | Oh btw. are IORefs global? |
| 20:00:10 | <mmorrow> | Philonous: newtype MMap a b = MMap (Map a (b, IORef (MMap b a))) |
| 20:00:33 | <mmorrow> | Tree (IORef (Tree a)) |
| 20:01:04 | <newsham> | phil: your binding to the ioref is scoped. |
| 20:01:06 | <mmorrow> | i've wanted to mess with iorefs of mvars in trees or maps, but haven't really |
| 20:01:47 | <lightstep> | newsham, a compiler could be start enough to know that is a dictionary has Unique keys, and you lost the reference to some Unique value, it can throw this part of the dictionary (this would be hard and very hacky, but fits the standard) |
| 20:02:19 | <mmorrow> | with an IORef, you can modify a scope which has diverged from you's world |
| 20:02:37 | <mmorrow> | slash communicate |
| 20:02:53 | <mmorrow> | Chans are cool how they're implemented |
| 20:02:57 | <mmorrow> | @src Chan |
| 20:02:58 | <lambdabot> | Source not found. Just try something else. |
| 20:03:17 | <mmorrow> | data Chan a = Chan (MVar (Stream a)) (MVar (Stream a)) |
| 20:03:24 | <b_jonas> | Philonous: yes, quite global |
| 20:03:52 | <newsham> | lightstep: so when I have a dictionary with the key "bar" (string) and there are no "bar" strings in the program memory then it should forget the entry for "bar" in all dictionaries? |
| 20:04:28 | <mmorrow> | type Stream a = MVar (ChItem a) |
| 20:04:32 | <mmorrow> | data ChItem a = ChItem a (Stream a) |
| 20:04:52 | <lightstep> | no, only dictionaries with Unique keys, this is a type that you can't construct "by structure" (it's in the Data.Unique module) |
| 20:05:17 | <b_jonas> | lightstep: how can you have Data.Unique without io? |
| 20:05:24 | <b_jonas> | lightstep: isn't that a devil's loop? |
| 20:05:25 | <mmorrow> | expanding ... |
| 20:05:28 | <mmorrow> | data Chan a = Chan (MVar (MVar (ChItem a))) (MVar (MVar (ChItem a))) |
| 20:07:18 | <lightstep> | b_jonas, since my hypothetical compiler has a specialized garbage collector (that recognizes two special types), it can probably also have a pragma that tells it some type is unique, which i promise not to break |
| 20:07:39 | <b_jonas> | lightstep: that wouldn't be pure I think |
| 20:07:46 | <b_jonas> | so you shouldn't do that |
| 20:08:27 | <lightstep> | inside my state monad, there will be a counter that will generate unique object, which are not exposed to the user but only used in the implementation of refs |
| 20:08:42 | <dcoutts> | rwbarton: cabal install foo-1.0 -- to install a specific version |
| 20:08:56 | <gbacon> | grrrr |
| 20:09:13 | <dcoutts> | rwbarton: or arbitrary constraints: cabal install "foo < 3.2" |
| 20:09:19 | <lightstep> | and the garbage collector sees which unique values are currently reachable, and throws all the rest away from the environment |
| 20:11:19 | <b_jonas> | lightstep: dunno... |
| 20:11:22 | <b_jonas> | I'm not sure that would work |
| 20:11:56 | <lightstep> | the GHC collector already has a special case for references. the the language doesn't dictate garbage collection at all |
| 20:12:16 | <b_jonas> | lightstep: sure, it has to have one |
| 20:12:21 | <rwbarton> | dcoutts: thanks. |
| 20:12:31 | <b_jonas> | lightstep: basically a garbage collector usually has to know every type |
| 20:12:37 | <b_jonas> | unless it's conservative |
| 20:12:59 | <b_jonas> | so it has to know IORefs and all other low-level types |
| 20:13:15 | <rwbarton> | dcoutts: unfortunately, the old version of package A depends on an old version of package B but A's .cabal file doesn't know about that fact. |
| 20:13:18 | <lightstep> | yeah |
| 20:13:37 | <dcoutts> | rwbarton: you can specify versions or constraints on both |
| 20:13:45 | <b_jonas> | well, at least the primitive types. IORef itself might be a composite type implemented in haskell. |
| 20:13:55 | <dcoutts> | rwbarton: cabal install "foo < 2" "bar < 2" |
| 20:13:57 | <b_jonas> | from some other similar primitve type that is |
| 20:14:38 | <dons> | ?users |
| 20:14:38 | <lambdabot> | Maximum users seen in #haskell: 515, currently: 508 (98.6%), active: 22 (4.3%) |
| 20:14:48 | <rwbarton> | dcoutts: oh, interesting, so cabal install B-old A-old isn't the same as cabal install B-old; cabal install A-old |
| 20:15:21 | <rwbarton> | dcoutts: Mysterious, but it works. Thanks :) |
| 20:17:52 | <dcoutts> | rwbarton: right, it considers both simultaneously and finds a consistent installation plan |
| 20:18:17 | <dcoutts> | it uses a simple constraint solver |
| 20:18:32 | <rwbarton> | dcoutts: And I guess it prefers packages specified on the command line over other versions that happen to be installed |
| 20:18:58 | <dcoutts> | the ones given on the command line are considered as constraints |
| 20:19:47 | <daedra> | lambdabot: help |
| 20:19:48 | <rwbarton> | Right, so in this case the .cabal file for A just specifies B; it doesn't know that B-old will work but B-new will fail. That's why I'm a little confused |
| 20:20:03 | <daedra> | !help |
| 20:20:04 | <gbacon> | is it a known problem that lambdabot out of darcs isn't building currently? |
| 20:20:08 | <mmorrow> | , let unD = maybe undefined id . fromDynamic ; q = toDyn ((\x -> x `dynApp` (toDyn x)) (toDyn (\x -> x `dynApp` (toDyn x)))) in iterate unD q |
| 20:20:10 | <lunabot> | [<<Dynamic>>,<<Dynamic>>,<<Dynamic>>,<<Dynamic>>,<<Dynamic>>,<<Dynamic>>,... |
| 20:20:16 | <olsner> | heh, "error-czeching" |
| 20:20:40 | <mmorrow> | is that some <letter>-combinator> |
| 20:20:43 | <mmorrow> | ? |
| 20:20:51 | <daedra> | Lhelp |
| 20:20:51 | <dcoutts> | rwbarton: right, it says it needs it but specifies no version constraint, but if you specify one on the command line then it's all good |
| 20:20:57 | <mmorrow> | err, i guess it'd be y? |
| 20:21:46 | <daedra> | how do I query lambdabot? |
| 20:21:59 | <mmorrow> | > 42 |
| 20:22:00 | <lambdabot> | 42 |
| 20:22:08 | <daedra> | > help |
| 20:22:12 | <mmorrow> | @help |
| 20:22:13 | <lambdabot> | help <command>. Ask for help for <command>. Try 'list' for all commands |
| 20:22:24 | <daedra> | mmorrow: thanks |
| 20:22:28 | <mmorrow> | :) |
| 20:26:07 | <daedra> | is there a separate bot for books/resources? if not what books do you recommend to learn haskell? |
| 20:26:23 | <Deewiant> | @where realworldhaskell |
| 20:26:23 | <lambdabot> | http://www.realworldhaskell.org/ |
| 20:26:36 | <Vq^> | @where programming in haskell |
| 20:26:37 | <lambdabot> | I know nothing about programming. |
| 20:26:46 | <Deewiant> | more accurately http://book.realworldhaskell.org/read/ |
| 20:26:54 | <lambdabot> | Title: Real World Haskell |
| 20:27:05 | <Vq^> | http://www.cs.nott.ac.uk/~gmh/book.html |
| 20:27:17 | <lambdabot> | Title: Programming in Haskell |
| 20:28:01 | <Philonous> | It appears one can build his own little dataflow language with MVars. Cool. |
| 20:34:43 | <mmorrow> | Philonous: totally |
| 20:35:30 | <mmorrow> | domino toppling with threads |
| 20:38:17 | <Philonous> | I've recently read that Haskells threads are cheap (at least in ghc). So I guess parallel programming in haskell should be rather pain-free. |
| 20:38:58 | <Philonous> | Or are there other pitfalls to overcome? |
| 20:39:04 | <Phyx-> | hi, i'm having a problem with map (\([(x1,x2)],y)->(x1,(x2++y))) . it keeps telling me that it's getting into an endless recursion, which i don't really get |
| 20:39:35 | <noZone> | ... the conservation of pain: you can shovel it here or there, but there is always pain. |
| 20:39:45 | <mml`> | :t (\([(x1,x2)],y)->(x1,(x2++y))) |
| 20:39:46 | <lambdabot> | forall t a. ([(t, [a])], [a]) -> (t, [a]) |
| 20:40:07 | <Deewiant> | that's one ugly type you've got there :-P |
| 20:40:19 | <Saizan> | Phyx-: endless recursion or infinite type? however you've to give us more context |
| 20:40:19 | <mml`> | truly |
| 20:40:57 | <mml`> | :t map (\([(x1,x2)],y)->(x1,(x2++y))) |
| 20:40:57 | <b_jonas> | > map (\([(x1,x2)],y)->(x1,(x2++y))) ([(3,"li")],"st") |
| 20:40:58 | <lambdabot> | forall t a. [([(t, [a])], [a])] -> [(t, [a])] |
| 20:40:58 | <lambdabot> | Couldn't match expected type `[([(t, [a])], [a])]' |
| 20:41:02 | <b_jonas> | > map (\([(x1,x2)],y)->(x1,(x2++y))) [([(3,"li")],"st")] |
| 20:41:03 | <lambdabot> | [(3,"list")] |
| 20:41:06 | <b_jonas> | crazy |
| 20:42:20 | <mml`> | > map (\([(x1,x2)],y)->(x1,(x2++y))) [([(3, "li")],"st")] |
| 20:42:21 | <lambdabot> | [(3,"list")] |
| 20:42:42 | <mml`> | no less crazy now, even though it returned something :) |
| 20:42:42 | <leimy> | does GHC 6.8.3 have the parallel garbage collector available? |
| 20:42:58 | <Deewiant> | nope |
| 20:43:25 | <Deewiant> | ?djinn ([(t, [a])], [a]) -> (t, [a]) |
| 20:43:25 | <lambdabot> | Error: Undefined type [] |
| 20:43:28 | <Deewiant> | meh |
| 20:43:35 | <Deewiant> | ?djinn ([(t, Maybe a)], Maybe a) -> (t, Maybe a) |
| 20:43:36 | <lambdabot> | Error: Undefined type [] |
| 20:43:44 | <Deewiant> | ?djinn (Maybe (t, Maybe a), Maybe a) -> (t, Maybe a) |
| 20:43:45 | <lambdabot> | -- f cannot be realized. |
| 20:44:05 | <Deewiant> | ?djinn Maybe a -> a |
| 20:44:05 | <lambdabot> | -- f cannot be realized. |
| 20:44:26 | <leimy> | ?djinn a -> a |
| 20:44:27 | <lambdabot> | f a = a |
| 20:44:41 | <Phyx-> | Saizan: i'm just trying the map one result to another |
| 20:44:46 | <Phyx-> | i think the function terminates |
| 20:44:52 | <Phyx-> | or rather i'm pretty sure |
| 20:44:54 | <Phyx-> | *looks* |
| 20:45:12 | <Saizan> | Phyx-: can you paste the code? |
| 20:45:12 | <Phyx-> | yeah it does |
| 20:45:22 | <rwbarton> | Maybe isn't very useful in djinn, since Maybe a is "equivalent" to () |
| 20:45:25 | <Saizan> | that function is not problematic by itslef |
| 20:45:31 | <rwbarton> | ?djinn (Maybe a -> (), () -> Maybe a) |
| 20:45:32 | <lambdabot> | f = (\ _ -> (), \ _ -> Nothing) |
| 20:45:38 | <Phyx-> | Saizan: one sec |
| 20:45:47 | <Saizan> | rwbarton: what? |
| 20:45:59 | <Deewiant> | ?djinn Either a b -> (a -> b) -> b |
| 20:45:59 | <lambdabot> | f a b = |
| 20:46:00 | <lambdabot> | case a of |
| 20:46:00 | <lambdabot> | Left c -> b c |
| 20:46:00 | <lambdabot> | Right d -> d |
| 20:46:09 | <Deewiant> | ?djinn Maybe a -> a -> a |
| 20:46:09 | <b_jonas> | rwbarton: even if a appears twice? |
| 20:46:10 | <lambdabot> | f a b = |
| 20:46:10 | <lambdabot> | case a of |
| 20:46:10 | <lambdabot> | Nothing -> b |
| 20:46:10 | <lambdabot> | Just c -> c |
| 20:46:10 | <Saizan> | ?djinn Maybe a -> (a -> b) -> b -> b |
| 20:46:11 | <lambdabot> | f a b c = |
| 20:46:12 | <lambdabot> | case a of |
| 20:46:14 | <lambdabot> | Nothing -> c |
| 20:46:16 | <lambdabot> | Just d -> b d |
| 20:46:33 | <Saizan> | Maybe a is not isomorphic to () |
| 20:46:33 | <b_jonas> | ?djinn Maybe a -> Int -> Either a Int |
| 20:46:34 | <lambdabot> | Error: Undefined type Int |
| 20:46:40 | <b_jonas> | ?djinn Maybe a -> Integer -> Either a Integer |
| 20:46:41 | <lambdabot> | Error: Undefined type Integer |
| 20:46:47 | <b_jonas> | ?djinn Maybe a -> int -> Either a int |
| 20:46:48 | <lambdabot> | f a b = |
| 20:46:48 | <lambdabot> | case a of |
| 20:46:48 | <lambdabot> | Nothing -> Right b |
| 20:46:48 | <lambdabot> | Just c -> Left c |
| 20:47:01 | <rwbarton> | Saizan: No, but it is isomorphic when you identify two functions whenever they have the same domain and target. |
| 20:47:07 | <Saizan> | Maybe (forall a. a) is (if there's not bottom like in _|_( |
| 20:47:17 | <rwbarton> | Saizan: And djinn is just telling you "is there a function with given domain and target" |
| 20:47:52 | <rwbarton> | i.e. in intuitionistic logic, Maybe a = True | a = True = () |
| 20:48:27 | <Deewiant> | ?djinn () -> (a -> b) -> b -> b |
| 20:48:28 | <lambdabot> | f _ _ a = a |
| 20:48:28 | <Saizan> | djinn is giving you a total function with that type, if there's one |
| 20:48:36 | <b_jonas> | rwbarton: I see |
| 20:48:58 | <b_jonas> | um, not completely |
| 20:49:01 | <b_jonas> | but whatever |
| 20:49:01 | <Saizan> | rwbarton: what do you mean with Maybe a = True | a = True = () ? |
| 20:49:01 | <Deewiant> | Saizan: and his point seems to be that replacing Maybe a with () or vice versa won't change whether djinn gives a result or not |
| 20:49:04 | <Deewiant> | I think |
| 20:49:06 | <rwbarton> | Saizan: Yes, which only depends on whether the corresponding proposition is true in intuitionistic logic |
| 20:49:14 | <b_jonas> | ?djinn Maybe a -> int -> Either a int |
| 20:49:15 | <lambdabot> | f a b = |
| 20:49:15 | <lambdabot> | case a of |
| 20:49:15 | <lambdabot> | Nothing -> Right b |
| 20:49:15 | <lambdabot> | Just c -> Left c |
| 20:49:20 | <b_jonas> | ?djinn () -> int -> Either a int |
| 20:49:21 | <lambdabot> | f _ a = Right a |
| 20:49:28 | <b_jonas> | uh huh |
| 20:49:31 | <b_jonas> | makes sense |
| 20:49:48 | <rwbarton> | Right, sometimes it will use the Just a case if it happens to need an a somewhere. That seems to be random. |
| 20:49:52 | <rwbarton> | But it can't rely on it |
| 20:51:25 | <Saizan> | i see, so Bool is isomorphic to () too in this sense? |
| 20:51:39 | <rwbarton> | Saizan: Right |
| 20:51:58 | <Phyx-> | Saizan: well, if i were to paste the function since it uses alot of other fucntion i would end up pasting more than a 100 lines, i can give the sample output the function i call the one i'm pasting over |
| 20:52:04 | <Phyx-> | and the call to it |
| 20:52:52 | <rwbarton> | Saizan: [a] also |
| 20:53:34 | <Saizan> | Phyx-: we need to see where you call that function, and with which arguments |
| 20:53:57 | <Phyx-> | how i call it is simple |
| 20:54:00 | <Phyx-> | g s=collapse (f s) |
| 20:54:00 | <Phyx-> | f = (parseElements <$> (between '(' ')')) |
| 20:54:12 | <Saizan> | rwbarton: 1 + X, for every X ? |
| 20:54:18 | <Phyx-> | with the type of f being |
| 20:54:19 | <Phyx-> | f :: [Char] -> [([(Elements, [Char])], [Char])] |
| 20:54:32 | <Saizan> | Phyx-: use hpaste.org |
| 20:54:43 | <mmorrow> | ?djinn ([a] -> (), () -> [a]) |
| 20:54:43 | <lambdabot> | Error: Undefined type [] |
| 20:54:53 | <ziman> | ?djinn (() -> [a], [a] -> ()) |
| 20:54:53 | <lambdabot> | Error: Undefined type [] |
| 20:54:55 | <mmorrow> | ?djinn |
| 20:54:55 | <lambdabot> | Cannot parse command |
| 20:54:56 | <ziman> | aaa :) |
| 20:54:58 | <mmorrow> | ?djinn help |
| 20:54:58 | <lambdabot> | -- f cannot be realized. |
| 20:55:01 | <mmorrow> | ?djinn env |
| 20:55:02 | <lambdabot> | -- f cannot be realized. |
| 20:55:07 | <Saizan> | ?djinn-env |
| 20:55:08 | <lambdabot> | data () = () |
| 20:55:08 | <lambdabot> | data Either a b = Left a | Right b |
| 20:55:08 | <lambdabot> | data Maybe a = Nothing | Just a |
| 20:55:08 | <lambdabot> | data Bool = False | True |
| 20:55:08 | <lambdabot> | data Void |
| 20:55:10 | <lambdabot> | type Not x = x -> Void |
| 20:55:12 | <lambdabot> | class Eq a where (==) :: a -> a -> Bool |
| 20:55:15 | <mmorrow> | ah |
| 20:55:39 | <rwbarton> | ?djinn-add data [a] = Empty | Cons a [a] |
| 20:55:40 | <lambdabot> | Cannot parse command |
| 20:55:48 | <rwbarton> | ?djinn-add data List a = Empty | Cons a (List a) |
| 20:55:49 | <lambdabot> | Error: Recursive types are not allowed: List |
| 20:55:56 | <mmorrow> | does djinn allow adding/subtracting to/from its env dynamically? |
| 20:56:02 | <mmorrow> | heh, awesome |
| 20:56:03 | <Deewiant> | yes, with ?djinn-add |
| 20:56:13 | <Deewiant> | but list doesn't work as evidenced above :-/ |
| 20:56:20 | <Deewiant> | hmm |
| 20:56:21 | <mmorrow> | aww, no recursive types... |
| 20:56:36 | <Deewiant> | ?djinn-add data List a = Empty | Cons a (List2 a) |
| 20:56:37 | <lambdabot> | Error: Undefined type List2 |
| 20:56:41 | <Deewiant> | meh |
| 20:57:31 | <mmorrow> | ?djinn-add data List0 a b = Nil0 | Cons0 a b |
| 20:57:38 | <Deewiant> | :-P |
| 20:57:44 | <mmorrow> | ?djinn-env |
| 20:57:45 | <lambdabot> | data () = () |
| 20:57:45 | <lambdabot> | data Either a b = Left a | Right b |
| 20:57:45 | <lambdabot> | data Maybe a = Nothing | Just a |
| 20:57:45 | <lambdabot> | data Bool = False | True |
| 20:57:45 | <lambdabot> | data Void |
| 20:57:51 | <lambdabot> | type Not x = x -> Void |
| 20:57:52 | <lambdabot> | class Eq a where (==) :: a -> a -> Bool |
| 20:57:57 | <lambdabot> | data List0 a b = Nil0 | Cons0 a b |
| 20:58:47 | <mmorrow> | ?djinn-add data List a = Nil | Cons a (List0 () (List a)) |
| 20:58:47 | <lambdabot> | Error: Recursive types are not allowed: List |
| 20:59:25 | <Deewiant> | you can define lists up to a certain length :-) |
| 20:59:44 | <mmorrow> | i was trying to pull a fast one. didn't work :p |
| 20:59:49 | <ziman> | ?djinn-add data Mu f = In (f (Mu f)) |
| 20:59:50 | <lambdabot> | Error: Recursive types are not allowed: Mu |
| 20:59:53 | <Deewiant> | data List a = Nil | Cons1 a | Cons2 a a | Cons3 a a a | Cons4 a a a a ... |
| 21:00:09 | <Deewiant> | ?djinn-del List0 |
| 21:00:43 | <rwbarton> | djinn is supposed to return total functions, and you can write recursive functions without explicit recursion if you allow recursive datatypes |
| 21:00:52 | <Deewiant> | ?djinn-ver |
| 21:00:53 | <lambdabot> | Djinn version 2008-08-10. |
| 21:01:08 | <mmorrow> | ah |
| 21:01:12 | <Deewiant> | wow, that's new |
| 21:01:13 | <Deewiant> | http://www.augustsson.net/Darcs/Djinn/NEWS |
| 21:01:38 | <Saizan> | i wonder how hard would be to extend it with Mu/Nu and cata/ana, so you get termination for free |
| 21:01:55 | <mmorrow> | termination being defined as what? |
| 21:02:04 | <rwbarton> | ?djinn-add class Functor f where fmap :: (a -> b) -> f a -> f b |
| 21:02:16 | <rwbarton> | ?djinn (b -> c) -> f b -> f c |
| 21:02:16 | <lambdabot> | -- f cannot be realized. |
| 21:02:23 | <rwbarton> | ?djinn (a -> b) -> f a -> f b |
| 21:02:24 | <lambdabot> | -- f cannot be realized. |
| 21:02:29 | <rwbarton> | ?djinn Functor f => (b -> c) -> f b -> f c |
| 21:02:30 | <Saizan> | mmorrow: that every closed term is strong normalizing |
| 21:02:30 | <lambdabot> | -- f cannot be realized. |
| 21:02:31 | <mmorrow> | ?djinn-add class CoFunctor f where cofmap :: (a -> b) -> f b -> f a |
| 21:02:32 | <ushdf> | > <3 |
| 21:02:32 | <lambdabot> | mueval: SrcLoc {srcFilename = "<unknown>.hs", srcLine = 2, srcColumn = 8} |
| 21:02:33 | <lambdabot> | ... |
| 21:02:35 | <rwbarton> | ?djinn Functor f => (a -> b) -> f a -> f b |
| 21:02:36 | <lambdabot> | f = fmap |
| 21:03:03 | <rwbarton> | ?djinn-del Functor |
| 21:03:04 | <Saizan> | well, for the codata part termination is more subtle i guess? |
| 21:03:19 | <mmorrow> | Saizan: hmm. that mean that evaluating to nf completes in finite time, right? |
| 21:03:25 | <mmorrow> | s/mean/means/ |
| 21:03:28 | <Saizan> | yes |
| 21:04:44 | <Saizan> | http://homepages.inf.ed.ac.uk/wadler/papers/free-rectypes/free-rectypes.txt |
| 21:04:56 | <mmorrow> | ?djinn (Funtor f) => f (f a -> a) -> f a |
| 21:04:56 | <lambdabot> | Error: Class not found: Funtor |
| 21:04:57 | <lambdabot> | http://tinyurl.com/62s2nh |
| 21:05:01 | <mmorrow> | ?djinn (Functor f) => f (f a -> a) -> f a |
| 21:05:01 | <lambdabot> | Error: Class not found: Functor |
| 21:05:03 | <mmorrow> | grr |
| 21:05:16 | <mmorrow> | ah, i keep forgetting |
| 21:05:31 | <mmorrow> | (no recursion..) |
| 21:05:33 | <Deewiant> | might as well keep it there |
| 21:05:34 | <Deewiant> | ?djinn-add class Functor f where fmap :: (a -> b) -> f a -> f b |
| 21:05:38 | <mmorrow> | ?djinn (Functor f) => f (f a -> a) -> f a |
| 21:05:39 | <lambdabot> | -- f cannot be realized. |
| 21:06:00 | <rwbarton> | djinn doesn't understand that the type signature of fmap should be forall a b. (a -> b) -> f a -> f b |
| 21:06:06 | <rwbarton> | it thinks a and b are type constants |
| 21:06:15 | <mmorrow> | ahh, i see now |
| 21:06:41 | <rwbarton> | So, that makes the Functor class not very useful |
| 21:06:44 | <rwbarton> | in djinn |
| 21:06:48 | <Deewiant> | I don't. What function has that type :-P |
| 21:07:42 | <rwbarton> | @mmorrow-djinn (Functor f) => f (f a -> a) -> f a :) |
| 21:07:43 | <lambdabot> | Unknown command, try @list |
| 21:08:45 | <mmorrow> | sweet: http://www.augustsson.net/Darcs/MersenneTwister/MersenneTwister.hs |
| 21:08:47 | <lambdabot> | http://tinyurl.com/4oywuu |
| 21:08:56 | <Apocalisp> | @hoogle [a] -> [a] -> ([a],[a],[a]) |
| 21:08:57 | <lambdabot> | No results found |
| 21:10:01 | <BMeph> | Deewiant: That's the signature for loeb. :) |
| 21:10:55 | <mmorrow> | , let go a = fmap ($ go a) a in go [(!!2),\x -> 2 * (x!!0), const 23] |
| 21:10:56 | <lunabot> | [23,46,23] |
| 21:11:16 | <BMeph> | f xs = fmap (\fs -> fs (f xs)) |
| 21:11:27 | <byorgey> | loeb still blows my mind. |
| 21:11:34 | <mmorrow> | , let go f a = f ($ go f a) a in go fmap [(!!2),\x -> 2 * (x!!0), const 23] |
| 21:11:36 | <lunabot> | [23,46,23] |
| 21:11:42 | <BMeph> | bryorgey: As well it should... ;) |
| 21:11:42 | <mmorrow> | , let go f a = f ($ go f a) a in go |
| 21:11:44 | <lunabot> | luna: No instance for (GHC.Show.Show |
| 21:11:44 | <lunabot> | ((((a -> b) -> b) -> t -> a) -> t -> a)) |
| 21:11:44 | <lunabot> | arising from a use of `GHC.Show.show' at <interactive>:1:43-83 |
| 21:11:49 | <roconnor> | @type loeb |
| 21:11:50 | <lambdabot> | Not in scope: `loeb' |
| 21:11:56 | <roconnor> | @where loeb |
| 21:11:56 | <lambdabot> | I know nothing about loeb. |
| 21:12:07 | <BMeph> | I'm not sure if the Comonadi version is as impressive, but it should be... :) |
| 21:12:09 | <roconnor> | oh f (f a -> a) -> f a / |
| 21:12:12 | <roconnor> | oh f (f a -> a) -> f a ? |
| 21:12:31 | <BMeph> | *Comonad |
| 21:12:45 | <mmorrow> | @let cocopuff f a = f ($ cocopuff f a) a :: ((((a -> b) -> b) -> r -> a) -> r -> a)) |
| 21:12:45 | <lambdabot> | Parse error |
| 21:12:46 | <roconnor> | Is box really a comonad? |
| 21:13:15 | <mmorrow> | @let cocopuff = (\f a -> f ($ cocopuff f a) a) :: ((((a -> b) -> b) -> r -> a) -> r -> a)) |
| 21:13:16 | <lambdabot> | Parse error |
| 21:13:18 | <b_jonas> | this costuff is crazy |
| 21:13:50 | <BMeph> | <rwbarton> @mmorrow-djinn (Functor f) => f (f a -> a) -> f a <"mmorrow-djinn"> f xs = fmap (\fs -> fs (f xs)) |
| 21:13:54 | <olsner> | 'tis corazy! |
| 21:14:32 | <BMeph> | roconnor: Isn't Box the Monad, and Diamond the Comonad? :) |
| 21:14:34 | <mmorrow> | @pl \xs -> fmap (\fs -> fs (f xs)) |
| 21:14:35 | <lambdabot> | fmap . flip id . f |
| 21:14:39 | <mmorrow> | swEET |
| 21:14:41 | <BMeph> | Or is it the other way around? |
| 21:14:42 | <olsner> | mmorrow: is a cocopuff a puff? |
| 21:15:03 | <mmorrow> | i'm just not sure |
| 21:15:04 | <ziman> | is a coconut a nut? |
| 21:15:11 | <BMeph> | b_jonas: Don't you mean it's "cosane"? ;p |
| 21:15:31 | <roconnor> | BMeph: I'm not sure. I thought they were neither, but I forget. |
| 21:15:54 | <mmorrow> | coco* seems to add a delicious factor to * is many cases, though |
| 21:16:03 | <mmorrow> | cocopebbles vs. pebbles |
| 21:16:07 | <mmorrow> | etc |
| 21:16:17 | <BMeph> | roconnor: Well, s//isomorphic to/ |
| 21:16:25 | <byorgey> | cocoa vs. a |
| 21:16:58 | <mmorrow> | totally |
| 21:17:09 | <tristes_tigres> | hi |
| 21:23:43 | <tristes_tigres> | ghc 6.10.1 beta is released. How close is the actual release, I wonder |
| 21:27:00 | <b_jonas> | BMeph: maybe, lol |
| 21:27:53 | <hugo__> | hey people |
| 21:27:59 | <hugo__> | try to google for: the answer to life, the universe and everything |
| 21:28:09 | <EvilTerran> | @go the answer to life, the universe and everything = |
| 21:28:12 | <lambdabot> | http://en.wikipedia.org/wiki/Answer_to_Life,_the_Universe,_and_Everything |
| 21:28:12 | <lambdabot> | Title: Answer to Life, the Universe, and Everything - Wikipedia, the free encyclopedia |
| 21:28:16 | <hugo__> | nah |
| 21:28:22 | <hugo__> | you gotta go with your browser |
| 21:28:25 | <hugo__> | or else it wont work |
| 21:28:26 | <EvilTerran> | hm, apparently lambdabot doesn't do google calc results |
| 21:28:31 | <EvilTerran> | i know what it does :P |
| 21:28:33 | <hugo__> | :D |
| 21:28:38 | <hugo__> | hehehe |
| 21:28:46 | <EvilTerran> | http://google.com/search?q=the+answer+to+life+the+universe+and+everything+= |
| 21:28:48 | <lambdabot> | Title: the answer to life the universe and everything = - Google Search, http://tinyurl.com/4snskz |
| 21:28:55 | <SamB_XP> | @go the answer to life, the universe and everything |
| 21:28:58 | <SamB_XP> | @go the answer to life, the universe and everything |
| 21:29:00 | <lambdabot> | http://en.wikipedia.org/wiki/Answer_to_Life,_the_Universe,_and_Everything |
| 21:29:00 | <lambdabot> | Title: Answer to Life, the Universe, and Everything - Wikipedia, the free encyclopedia |
| 21:29:04 | <ddarius> | @google 1 + 1 |
| 21:29:05 | <lambdabot> | 1 + 1 = 2 |
| 21:29:16 | <SamB_XP> | hmm, I could have sworn it had calculator support ... |
| 21:29:22 | <SamB_XP> | and apparantly it does |
| 21:29:52 | <EvilTerran> | ACTION goes back to trying to thrash out a quick-n-dirty proof assistant |
| 21:30:02 | <olsner> | @go "the answer to life, the universe and everything" |
| 21:30:05 | <lambdabot> | http://en.wikipedia.org/wiki/Answer_to_Life,_the_Universe,_and_Everything |
| 21:30:05 | <lambdabot> | Title: Answer to Life, the Universe, and Everything - Wikipedia, the free encyclopedia |
| 21:30:08 | <olsner> | nope, okay |
| 21:30:12 | <EvilTerran> | as someone who has never written a proof assistant in haskell, this is quite tricky |
| 21:30:14 | <SamB_XP> | @go the answer to life, the universe and everything + 1 |
| 21:30:16 | <lambdabot> | http://en.wikipedia.org/wiki/Answer_to_Life,_the_Universe,_and_Everything |
| 21:30:16 | <lambdabot> | Title: Answer to Life, the Universe, and Everything - Wikipedia, the free encyclopedia |
| 21:30:20 | <EvilTerran> | enough! |
| 21:30:25 | <EvilTerran> | :P |
| 21:30:36 | <EvilTerran> | you could play with it in PM, try to trick it into working there |
| 21:31:01 | <olsner> | easy for you to say :) |
| 21:31:12 | <EvilTerran> | wha? |
| 21:31:17 | <b_jonas> | so if a maybe is a -> (b -> a) -> a, then a comaybe is (a -> a -> b) -> a |
| 21:31:47 | <EvilTerran> | b_jonas, er, that type strikes me as somewhat empty |
| 21:32:04 | <b_jonas> | EvilTerran: yeah, looks like |
| 21:32:18 | <b_jonas> | but don't they say that a cofoo is like a foo but with all the function arrows reversed? |
| 21:32:31 | <b_jonas> | perhaps a comaybe is empty |
| 21:32:33 | <ttt--> | is there a way to use foo and bar as setters if you define a type like Foo = Foo { foo :: String, bar :: String }? |
| 21:32:43 | <b_jonas> | or perhaps we should write it as a class |
| 21:32:44 | <b_jonas> | like |
| 21:33:27 | <b_jonas> | class Maybe mb where { maybe :: mb -> a -> (b -> a) -> a; } |
| 21:33:29 | <EvilTerran> | ttt--, not directly, no |
| 21:33:31 | <b_jonas> | no wait |
| 21:33:37 | <b_jonas> | class Maybe mb where { maybe :: mb b -> a -> (b -> a) -> a; } |
| 21:33:51 | <b_jonas> | in which case, a comaybe would be like |
| 21:33:51 | <ttt--> | EvilTerran, im willing to settle for indirectly |
| 21:33:59 | <EvilTerran> | ttt--, given x :: Foo, you can write x { foo = newValueForFoo } |
| 21:34:15 | <EvilTerran> | or you can look into "functional references" |
| 21:34:22 | <EvilTerran> | ?go functional references |
| 21:34:24 | <lambdabot> | No Result Found. |
| 21:34:27 | <b_jonas> | class CoMaybe cmb where { maybe :: ((a -> b -> a) -> a) -> cmb b; } |
| 21:34:27 | <EvilTerran> | ... |
| 21:34:30 | <ddarius> | setFoo rec x = rec { foo = x } |
| 21:34:35 | <b_jonas> | that looks less empty |
| 21:34:59 | <b_jonas> | but not too useful |
| 21:35:29 | <ttt--> | ok thanks :) |
| 21:35:33 | <b_jonas> | ACTION googles comaybe and it says "Did you mean: maybe" |
| 21:36:17 | <BMeph> | @cogoogle maybe |
| 21:36:26 | <lambdabot> | http://www.maybe.com/ |
| 21:36:26 | <lambdabot> | Title: Maybe.com: some sentences with "maybe" or "may be" |
| 21:36:34 | <bos> | what's the current state of GHC on ARM? |
| 21:37:18 | <EvilTerran> | argh, the design space i'm playing with for my proof assistant is too big |
| 21:37:20 | <EvilTerran> | i keep getting lost |
| 21:37:35 | <BMeph> | bos: Wouldn't it be fun to have GHC on Larabee, before they release the chip? ;) |
| 21:37:55 | <bos> | BMeph: it would indeed. |
| 21:38:13 | <b_jonas> | lol |
| 21:38:18 | <b_jonas> | what does cogoogle do? |
| 21:38:24 | <EvilTerran> | if we can get GHC on OpenMoko, I may have a burst of extravagance and buy a Neo FreeRunner to play with |
| 21:38:48 | <b_jonas> | @help cogoogle |
| 21:38:48 | <lambdabot> | help <command>. Ask for help for <command>. Try 'list' for all commands |
| 21:38:50 | <EvilTerran> | actually, it's linux-based, so that shouldn't be too hard |
| 21:38:51 | <EvilTerran> | i guess |
| 21:39:00 | <EvilTerran> | http://www.openmoko.com/product.html <- SHINEY |
| 21:39:09 | <lambdabot> | Title: openmoko.com | Products |
| 21:41:31 | <b_jonas> | @codjinn Maybe a -> a |
| 21:41:32 | <lambdabot> | -- f cannot be realized. |
| 21:41:36 | <b_jonas> | strange |
| 21:41:46 | <b_jonas> | @codjinn a -> Maybe a |
| 21:41:47 | <lambdabot> | f = Just |
| 21:41:53 | <EvilTerran> | i presume codjinn is getting typo-corrected to djinn |
| 21:41:55 | <b_jonas> | shouldn't it reverse the arrow? |
| 21:42:02 | <b_jonas> | typo-corrected? |
| 21:42:08 | <b_jonas> | @djunn a -> Maybe a |
| 21:42:08 | <lambdabot> | f = Just |
| 21:42:11 | <b_jonas> | possible, yeah |
| 21:42:14 | <EvilTerran> | @djinnxx a -> a |
| 21:42:14 | <lambdabot> | f a = a |
| 21:42:21 | <EvilTerran> | probable |
| 21:42:25 | <EvilTerran> | likewise cogoogle |
| 21:42:51 | <EvilTerran> | which is a shame, 'cos it'd be nice to have a @cogoogle that you could give a URL to and get back a search term for which it was the first result :P |
| 21:43:10 | <b_jonas> | EvilTerran++ lollollol |
| 21:43:16 | <EvilTerran> | :D |
| 21:43:19 | <b_jonas> | depends on the ;hl= parameter though |
| 21:43:50 | <ddarius> | I'm pretty sure the url itself would give you the url as the first result. |
| 21:43:53 | <b_jonas> | &hl= parameter actually for google doesn't like semicolons |
| 21:44:05 | <EvilTerran> | ddarius, that's cheating :P |
| 21:44:28 | <b_jonas> | yep, it should give the _simplest_ search terms |
| 21:44:41 | <EvilTerran> | by breadth-first search! |
| 21:44:53 | <b_jonas> | still, the dependence from &hl= is quite significant |
| 21:45:11 | <EvilTerran> | i'll go harass my friend who works for google into implementing such a thing as his 20% project :P |
| 21:49:00 | <b_jonas> | I guess @codjinn a -> Maybe a does the same as @djinn Comaybe a -> a |
| 21:49:23 | <b_jonas> | ot should do at least |
| 21:49:38 | <EvilTerran> | i'm still not sure what Comaybe is |
| 21:49:43 | <lilac> | codjinn should be a synonym for @type |
| 21:49:55 | <EvilTerran> | and cotype a synonym for djinn? |
| 21:50:03 | <b_jonas> | sure |
| 21:50:08 | <b_jonas> | makes sense |
| 21:50:25 | <EvilTerran> | if anything, @cotype is more a self-explanatory name than @djinn |
| 21:50:33 | <EvilTerran> | *is a more |
| 21:50:52 | <leimy> | dons: so far Haskell Platform looks like a really sane idea |
| 21:50:53 | <leimy> | :-) |
| 21:51:25 | <b_jonas> | and @corun should compress an output to a short code that generates it |
| 21:51:32 | <hugo__> | i like the haskell platform, whatever that is |
| 21:51:43 | <hugo__> | it has haskell, and platform in the name, so it can only be good |
| 21:51:51 | <b_jonas> | and @cohelp should find the command you need given a description |
| 21:51:58 | <EvilTerran> | hehe |
| 21:52:27 | <EvilTerran> | saying :) on its own should make lambdabot say "@cobot" |
| 21:52:41 | <b_jonas> | lol |
| 21:52:44 | <b_jonas> | @bot |
| 21:52:44 | <lambdabot> | :) |
| 21:52:46 | <b_jonas> | :) |
| 21:52:50 | <EvilTerran> | :) |
| 21:53:03 | <SamB_XP> | EvilTerran: you mean @cobotsnack |
| 21:53:09 | <EvilTerran> | that too |
| 21:53:13 | <SamB_XP> | both? |
| 21:53:17 | <b_jonas> | what would @mpose do then? |
| 21:53:20 | <EvilTerran> | at random? i dunno |
| 21:53:29 | <dons> | leimy: sane is good. |
| 21:53:34 | <EvilTerran> | b_jonas, er, rot? |
| 21:53:37 | <b_jonas> | or @cohoogle |
| 21:53:53 | <b_jonas> | EvilTerran: heh |
| 21:54:01 | <leimy> | dons: pre-ordered the book btw |
| 21:54:06 | <leimy> | looks like a winner |
| 21:54:09 | <hugo__> | does haskell has a "Date" type constructor ? |
| 21:54:13 | <bos> | thanks! |
| 21:54:36 | <EvilTerran> | hugo__, there's things in Data.Time.* |
| 21:54:41 | <dons> | woo |
| 21:54:47 | <hugo__> | allright, ill check them :) thanks EvilTerran |
| 21:55:04 | <hugo__> | i can't wait to be a haskell l33tz0r, so that i can also help people the same way you guys help me :) |
| 21:56:20 | <BMeph> | dons, bos: cha-CHING! ;) |
| 21:56:54 | <smtms> | hugo__, start your Ph.D. studies now! ;-) |
| 21:56:58 | <EvilTerran> | ACTION settles down to read http://www.cs.cornell.edu/Info/Projects/NuPrl/cs671/cs671-fa99/postscript%20files/makedoc.ps |
| 21:57:00 | <lambdabot> | http://tinyurl.com/4dndfl |
| 21:57:57 | <hugo__> | :D |
| 21:58:24 | <hackage> | Uploaded to hackage: maccatcher 0.1.0 |
| 21:59:05 | <Phyx-> | hi, can anyone help me with this http://phyx.pastebin.com/d1f7f8e34 |
| 21:59:25 | <hugo__> | why is day 0 1858-11-17 ? |
| 21:59:33 | <hugo__> | is it the haskell curry birthday ? |
| 22:00:02 | <bos> | no, just the convention. |
| 22:00:04 | <lilac> | only if he lived to be 124 |
| 22:00:16 | <hugo__> | aha |
| 22:00:19 | <SamB_XP> | who's convention is that ? |
| 22:00:30 | <bos> | it's the base of the Modified Julian Day system |
| 22:00:38 | <hugo__> | ah, nice |
| 22:01:18 | <Phyx-> | Saizan: http://phyx.pastebin.com/d1f7f8e34 is the source |
| 22:01:30 | <bos> | http://en.wikipedia.org/wiki/Julian_Day |
| 22:02:35 | <rwbarton> | Phyx-: I don't think the error you pasted can be produced by this code, it's probably coming from somewhere else |
| 22:02:39 | <rwbarton> | Phyx-: are you using Parsec? |
| 22:03:38 | <Phyx-> | rwbarton: it's produced by that code according to ghci, the place is specifically in the collapse (f s) part, and no i'm not using any external parser lib |
| 22:04:10 | <Phyx-> | i've used the collapse function before in other functions |
| 22:04:16 | <EvilTerran> | well, there are no non-exhaustive patterns in lambdas there |
| 22:04:17 | <Phyx-> | just with this one it doesn't like it |
| 22:04:57 | <EvilTerran> | what's the source of "collapse"? |
| 22:04:58 | <lilac> | Phyx-: is Parser a function type? |
| 22:05:00 | <rwbarton> | yeah, there's only one lambda, and it's clearly exhaustive |
| 22:05:19 | <Phyx-> | lilac: yes |
| 22:05:38 | <ddarius> | "xmonad: High assurance that there aren't bugs such as overlapping windows" |
| 22:06:33 | <MyCatVerbs> | ddarius: "unless some freak adds that feature in anyway, but don't worry. We'll ostracise'm." |
| 22:06:53 | <MyCatVerbs> | ddarius: (er, floating windows? meta+click, meta+t? :) |
| 22:10:49 | <Phyx-> | http://phyx.pastebin.com/d1a59e68f <-- can it be that it just doesn't know what to match against? |
| 22:11:34 | <rwbarton> | Phyx-: I'm not sure I understand the question. Certainly I can imagine definitions of collapse that would produce that behavior. |
| 22:12:22 | <Saizan> | yeah, the relevant thing is the definition of collapse |
| 22:12:42 | <Phyx-> | so basically i need to redefine collapse? i'm just trying to map one type to another |
| 22:12:45 | <rwbarton> | e.g. collapse = \ [([((NewElements NewElement,""),(NoElements,"e5"))],"somethingelse")] -> [] |
| 22:13:53 | <Saizan> | redefine or fix it |
| 22:14:17 | <Saizan> | if you want to call on inputs such as s |
| 22:14:50 | <Saizan> | "it" |
| 22:15:22 | <Phyx-> | ok |
| 22:25:57 | <mjrosenb> | hey, i remember someone in here talking about source preproc. is there any documentation on this? |
| 22:27:50 | <MyCatVerbs> | mjrosenb: in the sense of #ifdefs? The -cpp flag turns it on in GHC, as does the {-# LANGUAGE CPP #-} pragma. |
| 22:29:14 | <MyCatVerbs> | mjrosenb: it's pretty much the standard C preprocessor, but I'm not sure whether it has some of the more esoteric (read: subtle and confusing and very, very fun) features. |
| 22:29:56 | <MyCatVerbs> | mjrosenb: you might also want to try man 1 cpphs, if you have GHC installed. :) |
| 22:30:32 | <mjrosenb> | this was for adding disjunctive patterns to haskell |
| 22:30:51 | <mjrosenb> | so i feel that it would be a bit more powerful than cpp |
| 22:31:02 | <MyCatVerbs> | mjrosenb: oh. Read up on Template Haskell, and... I've forgotten the name of the feature. |
| 22:32:09 | <mjrosenb> | MyCatVerbs: is it possible to do something in template haskell, and not encase it in $() ? |
| 22:32:55 | <MyCatVerbs> | mjrosenb: that's exactly the one, but I can't remember what it's called. D'oh. :D |
| 22:33:21 | <mjrosenb> | whee.. |
| 22:33:41 | <mjrosenb> | it also gives you a parsed haskell expression, i assume |
| 22:33:58 | <mjrosenb> | err |
| 22:34:08 | <BMeph> | MyCatVerbs: Quasiquoting, maybe? ;) |
| 22:34:27 | <mjrosenb> | there's a way to use a function that does a transform on the ast of some haskell? |
| 22:34:35 | <mjrosenb> | s/there's/is there/ |
| 22:34:56 | <sjanssen> | mjrosenb: yes, Template Haskell |
| 22:35:09 | <Saizan> | yup something like $(func [| <some haskell> |]) |
| 22:35:25 | <MyCatVerbs> | BMeph: ah, that's the one. |
| 22:35:51 | <EvilTerran> | although you can't extend the syntax within [|...|]s that way - it has to be valid before you manipulate it |
| 22:35:55 | <MyCatVerbs> | BMeph: you can tell I haven't been following this place much lately. :) |
| 22:36:00 | <mjrosenb> | Saizan: so every example i've seen is handed a value, not an ast. |
| 22:36:00 | <EvilTerran> | that's what the quasiquoting's for |
| 22:36:12 | <EvilTerran> | , [| \x -> x + 1 |] |
| 22:36:14 | <lunabot> | LamE [VarP x_0] (InfixE (Just (VarE x_0)) (VarE +) (Just (LitE (IntegerL ... |
| 22:36:32 | <mjrosenb> | oic... |
| 22:36:57 | <EvilTerran> | [|...|] is the inverse of $(...) |
| 22:37:08 | <mjrosenb> | ACTION thought that the [|...|] notation had been snagged for parallelized vectors, and whatnot |
| 22:37:17 | <EvilTerran> | ideally, you'd never need to use those LamE, VarP, etc constructors directly |
| 22:37:20 | <sjanssen> | mjrosenb: that's [: :] |
| 22:37:25 | <mjrosenb> | my bad. |
| 22:37:31 | <EvilTerran> | and you could work entirely with $(...) and [|...|] |
| 22:37:41 | <EvilTerran> | unfortunately, the syntax is too limited for that |
| 22:37:54 | <EvilTerran> | in part because there's no [|...|] analogue for patterns |
| 22:38:04 | <EvilTerran> | also $(...) doesn't work in types, iirc |
| 22:38:20 | <rwbarton> | , [t| Integer |] |
| 22:38:23 | <lunabot> | ConT Integer |
| 22:38:28 | <rwbarton> | , [p| (x,y) |] |
| 22:38:30 | <lunabot> | luna: Tempate Haskell pattern brackets are not supported yet |
| 22:38:48 | <rwbarton> | , [d| f x = x * x |] |
| 22:38:50 | <lunabot> | FunD f [Clause [VarP x_0] (NormalB (InfixE (Just (VarE x_0)) (VarE *) (Ju... |
| 22:39:09 | <Saizan> | "Tempate" :) |
| 22:39:28 | <rwbarton> | ! |
| 22:39:29 | <EvilTerran> | , let roll 0 = [| id |]; roll i | i > 0 = [| \f -> $(roll (i-1)) . flip f |] in ($(roll 0) (,,) 1 2 3, $(roll 1) (,,) 1 2 3, $(roll 2) (,,) 1 2 3) |
| 22:39:31 | <lunabot> | luna: GHC stage restriction: `roll' |
| 22:39:31 | <lunabot> | is used in a top-level splice, and must be imported, not defined locally |
| 22:39:34 | <EvilTerran> | grr |
| 22:39:46 | <EvilTerran> | i'm sure that worked a few days ago |
| 22:40:31 | <mjrosenb> | Prelude Language.Haskell.TH> [| \x->x+1 |] |
| 22:40:31 | <mjrosenb> | <interactive>:1:1: parse error on input `|' |
| 22:40:32 | <EvilTerran> | although i remember that stage restriction thing from way before lunabot even existed, so now i'm just confused |
| 22:40:42 | <EvilTerran> | mjrosenb, :set -XTemplateHaskell |
| 22:41:07 | <mjrosenb> | ahh. |
| 22:41:14 | <EvilTerran> | for the syntactic extensions |
| 22:41:33 | <mjrosenb> | EvilTerran: i also need to import something else apparently |
| 22:41:41 | <EvilTerran> | and :m + Language.Haskell.TH for the types and functions |
| 22:42:07 | <mjrosenb> | No instance for (Show ExpQ) |
| 22:43:08 | <Saizan> | EvilTerran: mmorrow changed something in the eval mechanism recently so you can use "eval" in your expressions, it might be related that |
| 22:43:09 | <EvilTerran> | indeed not |
| 22:43:16 | <EvilTerran> | ExpQ = Q Exp |
| 22:43:23 | <EvilTerran> | Q is the monad that splices work in |
| 22:43:46 | <EvilTerran> | i forget how i got around that |
| 22:44:29 | <EvilTerran> | mjrosenb, try "runQ [| ... |]" |
| 22:44:45 | <EvilTerran> | runQ :: Q a -> IO a, effectively |
| 22:46:27 | <mjrosenb> | EvilTerran: that did it |
| 22:46:29 | <mjrosenb> | thanks |
| 22:48:57 | <EvilTerran> | np :) |
| 22:49:31 | <EvilTerran> | /nick HelpfulTerran |
| 22:51:22 | <Peaker> | EvilTerran: that would break the nick's coolness |
| 22:51:23 | <rwbarton> | you're helping someone use TH. That's pretty evil :) |
| 22:52:05 | <EvilTerran> | Peaker, yeah, i know, then it wouldn't be an interesting anagram any more... |
| 22:52:07 | <EvilTerran> | i think... |
| 22:52:19 | <ziman> | anagram of what? |
| 22:52:30 | <EvilTerran> | > sort "evilterran" == sort "irrelevant" |
| 22:52:31 | <lambdabot> | True |
| 22:52:43 | <ziman> | oh :) |
| 22:52:47 | <EvilTerran> | :D |
| 22:54:12 | <Peaker> | how do you get a list of lines from a file handle? |
| 22:54:42 | <chessguy> | @hoogle Handle |
| 22:54:43 | <lambdabot> | System.IO data Handle |
| 22:54:43 | <lambdabot> | Control.Exception handle :: (Exception -> IO a) -> IO a -> IO a |
| 22:54:43 | <lambdabot> | Control.Exception handleJust :: (Exception -> Maybe b) -> (b -> IO a) -> IO a -> IO a |
| 22:54:43 | <Peaker> | lines . hGetContents I guess? |
| 22:54:44 | <Saizan> | fmap lines . hGetContents |
| 22:54:50 | <Peaker> | thanks |
| 22:55:01 | <Saizan> | with usual disclaimer about lazy IO |
| 22:55:03 | <MyCatVerbs> | Saizan: you mean that without the (.), surely? |
| 22:55:22 | <Saizan> | ?type fmap lines . hGetContents |
| 22:55:22 | <lambdabot> | Not in scope: `hGetContents' |
| 22:55:42 | <Saizan> | MyCatVerbs: however no, since hGetContents takes a parameter, the handle |
| 22:55:51 | <MyCatVerbs> | Saizan: oh right of course, my bad. |
| 22:56:10 | <EvilTerran> | lines .: hGetContents in caleskell :P |
| 22:56:20 | <EvilTerran> | (where (.) = fmap and (.:) = (.).(.)) |
| 22:56:29 | <Peaker> | why does "x<-blah" show x in ghci? |
| 22:56:32 | <EvilTerran> | ?type fmap fmap fmap |
| 22:56:33 | <lambdabot> | forall (f :: * -> *) a b (f1 :: * -> *). (Functor f1, Functor f) => (a -> b) -> f (f1 a) -> f (f1 b) |
| 22:57:04 | <ziman> | filter ((sort "helpfulterran" ==) . sort) . lines <$> readFile "/usr/share/dict/cracklib-words" |
| 22:57:04 | <Saizan> | Peaker: :set -fno-print-bind-result |
| 22:57:07 | <ziman> | [] |
| 22:57:10 | <ziman> | :( |
| 22:57:32 | <Peaker> | Saizan: thanks |
| 22:57:33 | <EvilTerran> | the sequence of types you get from (fmap, fmap fmap, fmap fmap fmap, fmap fmap fmap fmap, ...) is quite interesting, actually |
| 22:57:44 | <bd_> | :t fix fmap |
| 22:57:45 | <lambdabot> | Occurs check: cannot construct the infinite type: a = f a |
| 22:57:46 | <lambdabot> | Expected type: (a -> b) -> a -> b |
| 22:57:46 | <lambdabot> | Inferred type: (a -> b) -> f a -> f b |
| 22:57:50 | <bd_> | :( |
| 22:58:36 | <mjrosenb> | Peaker: :set -fno-print-bind-contents |
| 22:58:42 | <mjrosenb> | gah |
| 22:58:50 | <mjrosenb> | efb, and it looks like i got it wrong |
| 22:58:53 | <mjrosenb> | : ( |
| 22:59:57 | <rwbarton> | EvilTerran: Wow, that's weird. |
| 23:01:28 | <EvilTerran> | yeah, it's kinda unexpected |
| 23:03:09 | <ivanm> | mmorrow: you around? |
| 23:08:34 | <povman> | monad monad monad monad monad monad monad monad monad, FUNCTION FUNCTION, etc |
| 23:10:30 | <chessguy> | is that some kind of gregorian chant? |
| 23:11:06 | <povman> | more of a variant of the badger mushroom song |
| 23:12:36 | <mml`> | oh shit, that is going to be stuck in my head all night |
| 23:12:42 | <mml`> | ^ povman |
| 23:12:56 | <povman> | lala :) |
| 23:13:37 | <ivanm> | povman: so what would be the equivalent of "a snake!"? "unsafe, unsafe!"? :p |
| 23:14:03 | <povman> | haha yeah - although 'list' has the right number of syllables |
| 23:15:40 | <TomMD> | Glória in excélsis Monade, et in terra pax homínibus bonć háscell. |
| 23:15:49 | <TomMD> | Gregorian Haskell, you say? |
| 23:15:55 | <chessguy> | ACTION giggles |
| 23:18:06 | <povman> | Fame in the highest Monade , and upon earth peace hominibus bonc hascell. |
| 23:18:25 | <lispy> | ACTION wonders if the "llama llama llama duck" song has a haskell variant |
| 23:18:30 | <povman> | uh oh |
| 23:18:43 | <EvilTerran> | here's a lambda, there's a lambda, and another little lambda |
| 23:18:45 | <FunctorSalad> | enjoy the soundness |
| 23:19:06 | <FunctorSalad> | (think I got that one from here actually) |
| 23:19:23 | <FunctorSalad> | http://www.cs.washington.edu/orgs/student-affairs/cseband/studio/Enjoy%20The%20Soundness.mp3 |
| 23:19:36 | <lambdabot> | http://tinyurl.com/4nx9lx |
| 23:19:56 | <FunctorSalad> | it mentions ML though. what is our diplomatic relationship to ML? |
| 23:20:11 | <FunctorSalad> | ;-) |
| 23:20:25 | <lispy> | We're lazier than ML |
| 23:20:31 | <lispy> | That's about it, as far as I can tell |
| 23:20:56 | <EvilTerran> | lazy lambda, constant lambda, lambda lambda LET |
| 23:21:05 | <FunctorSalad> | so it isn't like the (mostly jokular) math-physics infights? ;-) |
| 23:22:11 | <adu> | I have a question about CFile |
| 23:22:13 | <povman> | FunctorSalad: is that a drum machine? |
| 23:22:23 | <adu> | does CFile represent "FILE" or "FILE *"? |
| 23:22:34 | <FunctorSalad> | povman: huh? it isn't my song ;-) |
| 23:22:38 | <EvilTerran> | I was once a monad, I bound in a do, but i never saw the way, the arrow could bind too... |
| 23:22:40 | <povman> | oh :p |
| 23:23:10 | <FunctorSalad> | povman: and I didn't listen recently enough to take a guess |
| 23:24:23 | <EvilTerran> | i was only h-ninety-eight, but it came after, and now listen, PhD, to the typechecker! |
| 23:24:30 | <povman> | EvilTerran: these lyrics belong on the haskell wiki |
| 23:24:40 | <EvilTerran> | s/ninety/nine/, too many syllables |
| 23:24:59 | <povman> | EvilTerran: i was just h98? |
| 23:25:11 | <EvilTerran> | povman, well, it goes with "i was once a monad" |
| 23:25:15 | <povman> | or but |
| 23:25:28 | <EvilTerran> | ah, syllables again |
| 23:25:37 | <Boney> | ACTION is expecting one of these songs to be about lazyness. |
| 23:26:23 | <sereven> | [1..] bottles of beer on the wall, [1..] bottles of beer. Take one down pass it around, [2..] bottles of beer on the wall. [2..] bottles of beer on the .... |
| 23:26:57 | <FunctorSalad> | hehe |
| 23:27:41 | <EvilTerran> | did you ever see a lambda / pass a lambda / to a lambda? / lambda's lambda / adds a lambda / lambda, lambda, let! |
| 23:28:15 | <adu> | does anyone know about CFile? |
| 23:28:28 | <Boney> | let beer_song bottles = show(bottles) ++ " bottles of beer on the wall, " ++ show(bottles) ++ " bottles of beer. Take one down, pass it around, " ++ (beer_song (bottles - 1)) |
| 23:28:31 | <FunctorSalad> | sereven: unlike lists though, you can't put bottles in a cycle and suddenly have infinitely many |
| 23:28:33 | <Boney> | beer_song 99 |
| 23:28:37 | <Boney> | > let beer_song bottles = show(bottles) ++ " bottles of beer on the wall, " ++ show(bottles) ++ " bottles of beer. Take one down, pass it around, " ++ (beer_song (bottles - 1)) |
| 23:28:37 | <lambdabot> | mueval: SrcLoc {srcFilename = "<unknown>.hs", srcLine = 3, srcColumn = 1} |
| 23:28:37 | <lambdabot> | ... |
| 23:28:55 | <r3m0t> | Boney: you're thinking in brackets |
| 23:28:59 | <povman> | Boney: that sentence will forever remain unevaluated |
| 23:29:21 | <Boney> | It's been a little while since I've used haskell. |
| 23:29:28 | <Boney> | I'm usually using Mercury. |
| 23:29:32 | <povman> | adu: according to the docs it's just FILE |
| 23:29:33 | <Boney> | anyway, you get the idea. |
| 23:29:38 | <adu> | povman: ok thanks |
| 23:29:40 | <Boney> | also, there's no base-case in my song. |
| 23:29:43 | <FunctorSalad> | unsafePerformBeerIntake |
| 23:29:56 | <povman> | adu: i guess if it doesn't work that way, try using it as FILE * :P |
| 23:29:56 | <adu> | povman: I also just found this function: "fdToCFile :: Fd -> IO (Ptr CFile)" which also answers it :P |
| 23:30:18 | <adu> | :) |
| 23:31:34 | <Boney> | > let beer_song bottles = (show bottles) ++ " bottles of beer on the wall, " ++ (show bottles) ++ " bottles of beer. Take one down, pass it around, " ++ (beer_song (bottles - 1)) |
| 23:31:34 | <lambdabot> | mueval: SrcLoc {srcFilename = "<unknown>.hs", srcLine = 3, srcColumn = 1} |
| 23:31:35 | <lambdabot> | ... |
| 23:31:48 | <Boney> | that message is unhelpful. |
| 23:31:54 | <povman> | > let beer_song bottles = show bottles ++ " bottles of beer on the wall, " ++ show bottles ++ " bottles of beer. Take one down, pass it around, " ++ (beer_song (bottles - 1)) in beer_song 99 |
| 23:31:56 | <lambdabot> | "99 bottles of beer on the wall, 99 bottles of beer. Take one down, pass it... |
| 23:31:59 | <Saizan> | Boney: you need an in |
| 23:32:27 | <povman> | someone allow large output from lambdabot kthx |
| 23:32:35 | <Boney> | oh, I was using it like GHCi. |
| 23:37:22 | <lispy> | ?let beer_song bottles = show bottles ++ " bottles of beer on the wall, " ++ show bottles ++ " bottles of beer. Take one down, pass it around, "++ beer_song (bottles - 1) |
| 23:37:23 | <lambdabot> | Defined. |
| 23:37:34 | <lispy> | > drop 100 (beer_song 99) |
| 23:37:35 | <lambdabot> | "er on the wall, 98 bottles of beer. Take one down, pass it around, 97 bot... |
| 23:37:42 | <ivanm> | does anyone else here find that wiki.darcs.net has no text? |
| 23:38:08 | <lispy> | ivanm: works for me |
| 23:38:18 | <povman> | ivanm: full to the brim |
| 23:38:18 | <lispy> | "Distributed. Interactive. Smart. |
| 23:38:18 | <lispy> | Darcs is a free, open source, source code management system. " |
| 23:38:27 | <ivanm> | hmmmm.... for some reason wiki.darcs.net and google have no text! :o |
| 23:38:45 | <povman> | ivanm: check the light on your monitor. is it turned on? |
| 23:38:47 | <lispy> | > drop 1000 $ beer_song 99 |
| 23:38:49 | <lambdabot> | "around, 87 bottles of beer on the wall, 87 bottles of beer. Take one down... |
| 23:38:57 | <ivanm> | @slap povman |
| 23:38:58 | <lambdabot> | ACTION karate-chops povman into two equally sized halves |
| 23:39:04 | <BMeph> | ivanm: Someone's spoofing ya, man - run! ;) |
| 23:39:18 | <ivanm> | oh, looks like it's because of fontconfig changes I made |
| 23:39:34 | <povman> | i feel a sense of duality |
| 23:41:00 | <povman> | does anyone know what co-enumerable means and how it is any different to enumerable? |
| 23:41:22 | <povman> | regarding functions |
| 23:43:50 | <povman> | or rather, can anyone explain why a function might be approximable from above but not from below |
| 23:49:59 | <rwbarton> | I think a co-enumerable set is just the complement of an enumerable set. E.g., the set of Turing machines that do not halt on empty input. |
| 23:53:01 | <lispy> | > reverse . take 100 . reverse $ beer_song 99 |
| 23:53:17 | <lambdabot> | thread killed |
| 23:53:24 | <lispy> | > length $ beer_song 99 |
| 23:53:35 | <lambdabot> | mueval: Prelude.read: no parse |
| 23:53:36 | <lispy> | oh, right no basecase |
| 23:53:39 | <povman> | lispy: |
| 23:53:40 | <povman> | yeah |
| 23:55:19 | <dons> | ?users |
| 23:55:20 | <lambdabot> | Maximum users seen in #haskell: 515, currently: 478 (92.8%), active: 15 (3.1%) |
| 23:55:41 | <povman> | rwbarton: but eg const is enumerable and co-enumerable |
| 23:56:08 | <povman> | where enumerable === approximable from above |
| 23:57:34 | <rwbarton> | Something should be both enumerable and co-enumerable if and only if it is computable. |
| 23:58:02 | <rwbarton> | But I feel more confident saying that about sets than about functions. |
| 23:59:21 | <povman> | ACTION ponders |
| 23:59:29 | <povman> | (thanks bts) |
| 23:59:32 | <povman> | w |
Back to channel and daily index: content-negotiated html turtle