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:14 | <Cale> | RayNbow: In Ubuntu, it's easy to install. You just tick a checkbox or two |
| 00:00:28 | <Cale> | (and then restart your X session) |
| 00:00:38 | <Twey> | Peaker: It does return, when you run the monad |
| 00:00:44 | <Twey> | Peaker: It's just sugar for CPS |
| 00:00:49 | <MyCatVerbs> | Er... |
| 00:00:50 | <RayNbow> | Cale: I'm using Arch on my netbook, but I think I'll manage |
| 00:00:51 | <Twey> | CPS isn't that scary |
| 00:01:02 | <Peaker> | Twey: it does not return, in the sense of never binding the next actions (talking about ContT) |
| 00:01:06 | <MyCatVerbs> | It's just sugar for delimited continuations. Not full continuations. :D |
| 00:01:14 | <Cale> | RayNbow: There might be some environment variable munging to be done normally. :) |
| 00:01:16 | <RayNbow> | (on my Windows machines I'm using Microsoft's IME) |
| 00:01:26 | <Twey> | RayNbow: RayNbow http://wiki.archlinux.org/index.php/Scim |
| 00:01:40 | <Twey> | Minus one RayNbow, if you like. |
| 00:02:00 | <Twey> | Peaker: I'm not sure I follow |
| 00:02:30 | <Cale> | I like how I got 10 points for that comment, probably just because it was in Japanese. |
| 00:02:38 | <Twey> | Hahaha |
| 00:03:05 | <Twey> | 日本語を使う人々は必ず人気になるんだ! |
| 00:03:43 | <pumpkin> | zomg more japanese |
| 00:03:44 | <RayNbow> | btw Cale, why didn't you use 本当に面白い? |
| 00:04:01 | <Cale> | RayNbow: I could have, I suppose :) |
| 00:04:11 | <skorpan> | ℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵℵ |
| 00:04:22 | <Twey> | 実に sounds better, to my non-native ear |
| 00:04:23 | <MyCatVerbs> | AIEEE SNAKES |
| 00:04:32 | <MyCatVerbs> | Oh wait, Alephs. |
| 00:04:33 | <Peaker> | Twey: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5295#a5295 -- call that never returns |
| 00:04:38 | <Twey> | Like ‘in truth’ as opposed to just ‘really’ |
| 00:04:41 | <pumpkin> | the connotation is different |
| 00:04:58 | <Twey> | (§§§) — snakes in a basket |
| 00:05:03 | <ray> | time to change my putty font again |
| 00:05:09 | <RayNbow> | ACTION can't judge which sounds better... my knowledge of the Japanese language is quite limited... |
| 00:05:10 | <Cale> | Or Sims money. |
| 00:05:28 | <skorpan> | âð |
| 00:05:31 | <Peaker> | Twey: see the example? "gotoAfter ()" looks like an ordinary action -- but its one that never ever returns |
| 00:05:43 | <skorpan> | a snowflake on a pedestal! |
| 00:06:40 | <Peaker> | Twey: I guess maybe you could say that other monad transformers also "never return" from some actions, but here its combined with a jump, rather than just terminating the computation |
| 00:07:03 | <Twey> | Peaker: But that's not right |
| 00:07:07 | <Twey> | It does get there |
| 00:07:11 | <Peaker> | Twey: run it |
| 00:07:30 | <MyCatVerbs> | Twey: #SSSSSSS# roomful of snakes. |
| 00:07:52 | <MyCatVerbs> | Twey: not pictured: the fountain that you q'd from to make them all come after you, you stupid bloody adventurer. |
| 00:07:52 | <Peaker> | Twey: created http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5295#a5296 -- which should actually compile |
| 00:08:06 | <lament> | SSSSSS@SSSSSS |
| 00:08:08 | <Twey> | Peaker: I did |
| 00:08:20 | <Twey> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5295#a5297 |
| 00:08:30 | <Twey> | You only need to import Control.Monad.Cont |
| 00:08:32 | <MyCatVerbs> | lament: meh. That's only threatening if I have no mana and no hitpoints. :) |
| 00:08:33 | <cads> | I just got killed by a stunning slime mold and a kitten. |
| 00:08:36 | <Twey> | The others are exported from it |
| 00:08:58 | <Peaker> | Twey: "never gets here, haha!" was not printed |
| 00:09:11 | <Asztal> | http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=2503#a2503 <- any ideas what's happening there? |
| 00:09:23 | <ray> | i stopped playing nethack when i got killed by a purple worm on level 3 or so |
| 00:09:29 | <Twey> | Peaker: No — but it does return, in the sense that control is handed back to the main function |
| 00:09:35 | <Twey> | Oh, I see what you mean |
| 00:09:45 | <MyCatVerbs> | ray: you're supposed to laugh when you get owned that atrociously by the RNG. :) |
| 00:09:48 | <Phyx-> | bed time, thanks for all the help today guys, appreciate it |
| 00:09:49 | <Peaker> | the function callCC gives to the action never returns |
| 00:09:55 | <Asztal> | mkTree and NTree should be interchangable there :( |
| 00:09:58 | <Peaker> | the action, that is |
| 00:09:59 | <MyCatVerbs> | ray: what happened anyway, you ran into a shrieker? =D |
| 00:10:00 | <lament> | ray: you must have done something stupid |
| 00:10:04 | <ray> | yeah, shriekers |
| 00:10:18 | <lament> | oh, ouch |
| 00:10:19 | <MyCatVerbs> | Cool. Purple worms rule. |
| 00:10:21 | <lament> | just failing to Elbereth, then |
| 00:10:22 | <ray> | they called a purple worm |
| 00:10:32 | <ray> | engulf, die |
| 00:10:40 | <ray> | i didn't stop playing because of that |
| 00:10:49 | <MyCatVerbs> | wwwwwww @ <- fucked adventurer. |
| 00:10:59 | <Twey> | Asztal: To start with, you have an over-large function :-P |
| 00:10:59 | <ray> | it was just a coincidence that i got owned so bad in the last game i played |
| 00:11:03 | <Twey> | What is mkTree? |
| 00:11:03 | <lament> | &@ - fucked adventurer. |
| 00:11:27 | <Peaker> | Twey: anyway, that was the thing I found most confusing about continuations, I think I found the same confusion in Scheme's call-cc |
| 00:11:45 | <Peaker> | Twey: everybody says the continuation is passed as a function -- but its passed as a goto'er, not a function |
| 00:11:54 | <Peaker> | (talking about the transformer here) |
| 00:12:04 | <Cale> | But it is a function... |
| 00:12:12 | <Twey> | It is indeed |
| 00:12:15 | <Peaker> | a function/action returns |
| 00:12:23 | <Cale> | not just an action |
| 00:12:28 | <Cale> | a function giving an action |
| 00:12:55 | <Asztal> | Twey: mkTree's a method of the Tree class, which NTree is an instance of (http://hackage.haskell.org/packages/archive/hxt/8.3.0/doc/html/Data-Tree-Class.html) |
| 00:13:13 | <Cale> | You can return a value along with that "goto" |
| 00:13:33 | <Peaker> | Cale: yeah, I'm referring to the action. In Haskell, an action bind can do anything at all, so its less surprising. but I was baffled about the function callCC passes in Scheme -- if it returns, then everything will execute O(callCC count) times |
| 00:13:58 | <Berengal> | > runCont (do x <- return 5; y <- return 7; return (x+y)) show |
| 00:13:59 | <lambdabot> | "12" |
| 00:14:05 | <Berengal> | > runCont (do x <- return 5; y <- Cont (\cc -> "Hehehe"); return (x+y)) show |
| 00:14:06 | <lambdabot> | "Hehehe" |
| 00:14:14 | <Peaker> | Cale: I was wondering how its avoided, it simply being a goto rather than an actual function is something nobody seems to even mention |
| 00:14:31 | <Twey> | Asztal: Then what's NTree? |
| 00:14:40 | <Cale> | Well, it's actually more general than goto |
| 00:14:54 | <Peaker> | Cale: because labels are values? |
| 00:14:59 | <Cale> | yeah |
| 00:15:15 | <Peaker> | its pretty horrible, and yet an amazing testament to the power of transformers :) |
| 00:15:18 | <Asztal> | Twey: data NTree = NTree a [NTree a] |
| 00:15:26 | <Asztal> | with a more-or-less obvious instance of Tree |
| 00:15:49 | <Asztal> | (mkTree = NTree) |
| 00:15:53 | <Twey> | ITYM data NTree a = ... |
| 00:16:02 | <Asztal> | yes, sorry |
| 00:16:08 | <Twey> | Hmm |
| 00:16:27 | <Twey> | Pass; sorry :-\ Maybe someone else |
| 00:16:46 | <Phyx-> | heheheh i need to update my graph tracer to detect cycles :P |
| 00:17:03 | <Phyx-> | i suppose i should keep a list of my current path |
| 00:17:16 | <Phyx-> | never repeat nodes that appear on that path |
| 00:17:55 | <Phyx-> | gn |
| 00:18:48 | <Peaker> | how do you throw in ErrorT? |
| 00:18:59 | <Peaker> | @src MonadError |
| 00:19:00 | <lambdabot> | class (Monad m) => MonadError e m | m -> e where |
| 00:19:00 | <lambdabot> | throwError :: e -> m a |
| 00:19:00 | <lambdabot> | catchError :: m a -> (e -> m a) -> m a |
| 00:19:01 | <Peaker> | Using that? |
| 00:19:08 | <Peaker> | @src ErrorT throwError |
| 00:19:09 | <lambdabot> | Source not found. That's something I cannot allow to happen. |
| 00:21:46 | <RayNbow> | @users |
| 00:21:47 | <lambdabot> | Maximum users seen in #haskell: 658, currently: 562 (85.4%), active: 15 (2.7%) |
| 00:24:44 | <Peaker> | Ok, I'm getting closer to coroutines http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5299#a5299 |
| 00:26:49 | <jmcarthur> | i implemented cooperative threads in haskell once, with decent performance. i am really upset that i lost that work |
| 00:27:20 | <aconbere> | anyone know of a good description of how to employ the random monad in practice? |
| 00:28:35 | <jaredj> | !seen jaredj |
| 00:29:07 | <jaredj> | it's scary. every time i join nobody talks |
| 00:29:31 | <aconbere> | sssshhhh |
| 00:29:45 | <jaredj> | and i can't work the bot anymore :( |
| 00:30:15 | <jmcarthur> | @seen jaredj |
| 00:30:16 | <lambdabot> | jaredj is in #haskell. I last heard jaredj speak 31s ago. |
| 00:30:53 | <jmcarthur> | aconbere: hard to speak of the random monad specifically without talking about monads generally, i think |
| 00:31:32 | <aconbere> | jmcarthur: certainly, I just need some examples of using the monad |
| 00:31:58 | <aconbere> | ah look, the code has an example include |
| 00:31:59 | <aconbere> | d |
| 00:32:04 | <jmcarthur> | aconbere: http://hackage.haskell.org/packages/archive/MonadRandom/0.1.3/doc/html/Control-Monad-Random.html |
| 00:32:08 | <jmcarthur> | ... yeah :) |
| 00:33:07 | <jaredj> | many .hs have import qualified Data.Map as M |
| 00:33:13 | <jaredj> | can you do that with :m in ghci? |
| 00:33:32 | <jmcarthur> | jaredj: not that i know of, but you do get tab completion in ghci at least :) |
| 00:33:57 | <jaredj> | *nod* verranice |
| 00:35:25 | <Peaker> | jmcarthur: doh :( |
| 00:35:29 | <Peaker> | jmcarthur: github, next time :P |
| 00:42:27 | <jaredj> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5300#a5300 |
| 00:42:47 | <jaredj> | parsec type error. help? |
| 00:43:19 | <amckinley> | anyone around to answer some questions about stm + io? |
| 00:44:46 | <Philippa> | jaredj: use the parsec 2 package? The modules are found under Text.ParserCombinators.Parsec |
| 00:45:44 | <jaredj> | i could.. in the absence of other info isn't 3 better? |
| 00:46:04 | <amckinley> | jaredj: whats the error? |
| 00:46:07 | <Philippa> | no, 3's still rather experimental |
| 00:46:43 | <Philippa> | tbh, 3's a good use case for custom error messages - that's something that's still in research though :-( |
| 00:47:02 | <jaredj> | at the bottom of the paste. no instance for (Stream String Identity Char). |
| 00:47:11 | <jaredj> | oic |
| 00:47:32 | <amckinley> | jaredj: i think you hit the monomorphism restriction :) |
| 00:47:47 | <jaredj> | the last bit should be [Char] not Char but i don't know how to get it that way |
| 00:47:59 | <amckinley> | jaredj: try adding this pragma to the top of your file: |
| 00:48:00 | <amckinley> | {-# LANGUAGE NoMonomorphismRestriction #-} |
| 00:48:28 | <jaredj> | same |
| 00:48:52 | <amckinley> | darn |
| 00:48:59 | <amckinley> | i missed the paste; just joined |
| 00:49:25 | <Philippa> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5300#a5300 |
| 00:49:43 | <Philippa> | jaredj: I could swear you don't want the instance to be [Char] for the last parm |
| 00:49:56 | <Philippa> | unless your basic tokens are [Char]/String |
| 00:50:28 | <jaredj> | well you're right. but i'm using manyTill, so the one I think it's choking on shouldn't matter |
| 00:50:32 | <Philippa> | hrmm. That instance or a related one really should be in one of the modules too - is it in Text.Parsec? |
| 00:50:59 | <jaredj> | ...! |
| 00:51:05 | <jaredj> | import Text.Parsec and it works |
| 00:51:44 | <jaredj> | if i import Text.Parsec do i get Text.Parsec.Prim too (e.g.) or do i still have to import that if i want it |
| 00:51:50 | <jaredj> | ? |
| 00:51:57 | <Philippa> | best I can offer there is RTFM :-) |
| 00:52:02 | <jaredj> | heh k |
| 00:52:05 | <jaredj> | thanks |
| 00:52:43 | <Philippa> | jaredj: could you email the package maintainer and tell him you ran into this? It's mildly non-obvious to a package designer that someone might not import Text.Parsec |
| 00:52:54 | <jaredj> | ok |
| 00:53:14 | <Philippa> | but some of the instances can be shifted to Text.Prim, or a big "import Text.Parsec or doom!" notice can be added to the docs |
| 00:55:34 | <vininim> | also I had some success with attoparsec |
| 00:55:59 | <vininim> | the incremental parser isn't stack friendly though |
| 00:57:45 | <alexsuraci> | I |
| 00:57:51 | <alexsuraci> | ...I hate you, enter key. |
| 00:58:19 | <alexsuraci> | I'm building Pugs on Arch x64 from AUR, almost near the checkpoint when a "Missing header file: pcre" error hit me. Any ideas? |
| 00:58:26 | <Peaker> | ok, I just wrote this code, and already I don't understand it :-) |
| 00:58:29 | <Peaker> | but it seems to work! http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5299#a5301 |
| 00:58:41 | <Peaker> | a pretty good approximation of Python generators -- can go further |
| 00:59:04 | <Peaker> | you get two-way yields |
| 00:59:46 | <Peaker> | I would like to have the yield passing implicit in the monad now... This is going to be difficult.. |
| 01:09:28 | <Peaker> | Ok, I just made the official coroutine challenge! |
| 01:09:30 | <Peaker> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5299#a5302 |
| 01:10:03 | <Peaker> | I wrote an action the way it *should* look - I think its quite a challenge to implement GeneratorT (using ContT) so that it actually works |
| 01:10:17 | <Peaker> | it was pretty difficult to get the previous paste working, and this is considerably more difficult |
| 01:11:04 | <Peaker> | it could prove Python's advanced "generators" are just a library feature in Haskell too :) It would also allow nested yield calls which aren't allowed in Python! |
| 01:16:36 | <tompledger> | Are you totally determined to generalise it to monads other than IO? That goes beyond Python! |
| 01:16:46 | <tompledger> | @src MonadTrans |
| 01:16:46 | <lambdabot> | Source not found. This mission is too important for me to allow you to jeopardize it. |
| 01:17:47 | <tompledger> | Isn't there a lift method in the monad transformer class? Does it create extra traffic in and out of 'yield land.? |
| 01:18:19 | <tompledger> | 'yield land' |
| 01:19:38 | <hackagebot> | vacuum 0.0.94 |
| 01:22:25 | <jaredj> | i wrote a little parser. now i want to test it. |
| 01:22:38 | <mmorrow> | Baughn: just uploaded a new vacuum, which has a closureType you can use + an initial version of vacuumLazy (** which doesn't work like one would want, and i have a small fear that there's the possibility that making it do so might be impossible given the hooks we currently have, but we'll see) |
| 01:22:46 | <jaredj> | since it uses parsec, i can run it on a string and so it's pure and so i should use quick check - right? |
| 01:23:11 | <Cale> | jaredj: sure |
| 01:23:11 | <mmorrow> | jaredj: quickcheck is nice for parsers |
| 01:23:19 | <mmorrow> | , randE() |
| 01:23:22 | <lunabot> | (x11 :: x3) (x11 (- 5)) (x3 x1 (x4 x14)) :: forall x14 x12 x7 x4 x3 x6 . x9 |
| 01:23:24 | <mmorrow> | , randE() |
| 01:23:27 | <lunabot> | [x3 x10, ["This is a string. "]] |
| 01:23:44 | <Cale> | jaredj: If you have a pretty printer for the stuff you're parsing, you can create some really strong quickcheck tests. |
| 01:24:21 | <Cale> | (like that if you take a syntax tree, pretty print it, and parse the result, you get back the same thing) |
| 01:24:34 | <jaredj> | ok. so the little thing i have is (1) zero or more lines consisting of NAME:VALUE, and optional \r; (2) a blank line optionally with \r |
| 01:25:00 | <kpreid> | \r?! Where'd this file come from? |
| 01:25:06 | <jaredj> | right there i have two different Show instances i'll want to test, eh? |
| 01:25:17 | <jaredj> | well - it's dos line endings, yknow |
| 01:25:21 | <jaredj> | possibly |
| 01:25:22 | <jaredj> | or not |
| 01:25:39 | <jaredj> | i don't want to accidentally get \r's on the end of the values |
| 01:25:41 | <kpreid> | you should probably write a rule which matches maybe-\r-then-\n |
| 01:25:45 | <kpreid> | then use that |
| 01:25:46 | <jaredj> | ah - that's a property |
| 01:25:51 | <jaredj> | yes. yes i have that |
| 01:25:54 | <jaredj> | in the parser. |
| 01:26:00 | <kpreid> | rather than matching "\r after each of my rules" |
| 01:26:08 | <mmorrow> | Peaker: what is the desired output of the main in that paste? |
| 01:26:10 | <kpreid> | make it an integral part of the line separator |
| 01:26:22 | <jaredj> | but how do i nicely turn a Map String String into (1) keys and values with \r on the end, and (2) without the \r? |
| 01:26:24 | <p_l> | DOS/Windows/TOPS/internet is CRLF, Unix is LF ('\n'), Old Mac is CR "\r" |
| 01:26:32 | <jaredj> | i would write instance Show blablabla but i need two instances |
| 01:27:23 | <jaredj> | more importantly: where do i write the quickcheck tests? |
| 01:27:52 | <jaredj> | my module will be Text.OFX1. do i make a Tests.hs alongside? put it in the toplevel of my project? what's the convention |
| 01:28:03 | <fracture> | is there an easy way to produce an infinite list of repeated applications of a function to a value? |
| 01:28:14 | <kpreid> | fracture: iterate |
| 01:28:18 | <fracture> | so it'd be like [f x, f (f x), f (f (f x)), etc] |
| 01:28:19 | <kpreid> | > iterate succ 0 |
| 01:28:20 | <lambdabot> | [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,... |
| 01:28:21 | <fracture> | ah k thanks |
| 01:28:23 | <mmorrow> | > let ppMap m = show (M.toList m) ++ "\r" in ppMap (M.fromList (zip [0..] ["a","b","zomg"])) |
| 01:28:24 | <lambdabot> | "[(0,\"a\"),(1,\"b\"),(2,\"zomg\")]\r" |
| 01:28:35 | <mmorrow> | > let ppMap m = show (M.toList m) ++ "\r" in text $ ppMap (M.fromList (zip [0..] ["a","b","zomg"])) |
| 01:28:37 | <fracture> | kpreid ... as in bancus? |
| 01:28:37 | <lambdabot> | [(0,"a"),(1,"b"),(2,"zomg")] |
| 01:28:45 | <kpreid> | > iterate show "hi" |
| 01:28:46 | <lambdabot> | ["hi","\"hi\"","\"\\\"hi\\\"\"","\"\\\"\\\\\\\"hi\\\\\\\"\\\"\"","\"\\\"\\\... |
| 01:28:55 | <kpreid> | fracture: hm? I'm not bancus |
| 01:28:57 | <skorpan> | jesus |
| 01:29:05 | <fracture> | ok |
| 01:29:10 | <mmorrow> | > fix (("hi"++) . show) |
| 01:29:10 | <jaredj> | > iterate id 1 |
| 01:29:12 | <lambdabot> | [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,... |
| 01:29:12 | <lambdabot> | "hi\"hi\\\"hi\\\\\\\"hi\\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"hi... |
| 01:29:17 | <fracture> | (old lojban guy; saw you were in #lojban) |
| 01:29:34 | <mmorrow> | > fix (1:) |
| 01:29:36 | <lambdabot> | [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,... |
| 01:29:43 | <skorpan> | > fix fix |
| 01:29:44 | <lambdabot> | Occurs check: cannot construct the infinite type: a = a -> a |
| 01:29:47 | <skorpan> | aw man |
| 01:29:48 | <kpreid> | fracture: yes...we're both in #lojhban |
| 01:29:51 | <jaredj> | mmorrow: pointless... |
| 01:29:59 | <skorpan> | > fix (fix:) |
| 01:30:00 | <lambdabot> | Overlapping instances for GHC.Show.Show ((a -> a) -> a) |
| 01:30:00 | <lambdabot> | arising from a u... |
| 01:30:10 | <kpreid> | skorpan; two fixes makes a broken |
| 01:30:11 | <skorpan> | @type fix (fix:) |
| 01:30:12 | <lambdabot> | forall a. [(a -> a) -> a] |
| 01:30:19 | <jaredj> | ;) |
| 01:30:38 | <skorpan> | @type fix |
| 01:30:39 | <lambdabot> | forall a. (a -> a) -> a |
| 01:30:50 | <skorpan> | fix is so magical |
| 01:30:55 | <skorpan> | it's the Y combinator, right? |
| 01:31:15 | <mmorrow> | > let iterate = fix (\k f a -> a : f a : (k . f . f) a) in iterate (*2) 2 |
| 01:31:17 | <lambdabot> | Occurs check: cannot construct the infinite type: a = a -> a |
| 01:31:45 | <kpreid> | skorpan: practically, no |
| 01:31:48 | <Berengal> | mmorrow: Is there a reason why vacuum-cairo doesn't work properly when compiled? |
| 01:31:50 | <mmorrow> | > let iterate = fix (\k f a -> a : f a : k f ((f . f) a)) in iterate (*2) 2 |
| 01:31:52 | <lambdabot> | [2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,26... |
| 01:32:07 | <skorpan> | kpreid: are you saying that theoretically it is though? |
| 01:32:10 | <kpreid> | skorpan: fix f = f (fix f) |
| 01:32:26 | <Alpounet> | @src fix |
| 01:32:26 | <mmorrow> | Berengal: i'm not sure since it's not my package, but it vacuum works fine compiled. what is the breakage? |
| 01:32:26 | <lambdabot> | fix f = let x = f x in x |
| 01:32:31 | <kpreid> | you'd get identical results, but I don't know whether they would be equivalently efficient |
| 01:32:44 | <skorpan> | kpreid: how can lambda calculus be "efficient"? |
| 01:32:51 | <mmorrow> | Berengal: something like "ARR WORDS ENTERED!!"? |
| 01:32:52 | <kpreid> | in Haskell, I mean |
| 01:32:56 | <Berengal> | mmorrow: I just get the default picture thingy, then the program crashes when it's done |
| 01:33:04 | <mmorrow> | Berengal: oh, i'm not sure |
| 01:33:15 | <Berengal> | s/when it's done/when I close the window/ |
| 01:33:18 | <mmorrow> | Berengal: what did you try to `view'? |
| 01:33:20 | <pejo> | skorpan, you could count the number of reduction steps, for example. |
| 01:33:29 | <mmorrow> | (ie does "view 42" work?) |
| 01:33:29 | <skorpan> | pejo: yeah, i just realised that :P |
| 01:33:53 | <kpreid> | in lambda calculus, the Haskell-style definition of fix cannot be written because it contains a self-reference |
| 01:34:01 | <skorpan> | kpreid: indeed |
| 01:34:02 | <Berengal> | mmorrow: Nope |
| 01:34:13 | <mmorrow> | Berengal: if "view 42" doesn't work then it may be a problem with one or more of your cairo, gtk2hs, vacuum-cairo pkgs |
| 01:34:33 | <Berengal> | mmorrow: The strange thing is it works in ghci... |
| 01:34:44 | <Berengal> | Well, once, I have to restart ghci if I want to view something again |
| 01:34:47 | <Twey> | kpreid: No self-references allowed? |
| 01:34:49 | <Twey> | No recursion? |
| 01:34:58 | <skorpan> | Twey: i think he's right |
| 01:35:08 | <mmorrow> | Berengal: oh, odd. hmm does the prog your calling it from look like? |
| 01:35:09 | <SamB> | Twey: that doesn't follow |
| 01:35:16 | <mmorrow> | *what does the prog ... |
| 01:35:17 | <skorpan> | you can still do recursion using e.g. the Y combinator |
| 01:35:18 | <SamB> | well, in typed lambda calculus, I guess it does ... |
| 01:35:23 | <Twey> | SamB: How do you recurse without referring to yourself? |
| 01:35:27 | <mmorrow> | * .. you're .. |
| 01:35:32 | <Twey> | Except via mutual recursion, I guess |
| 01:35:36 | <Twey> | But I think that's cheating |
| 01:35:48 | <SamB> | Twey: Y! |
| 01:35:50 | <mmorrow> | , fix (\k m n -> m : k n (m+n)) 0 1 |
| 01:35:51 | <Twey> | Ohh. |
| 01:35:52 | <RyanT5000> | Twey: try looking up the "fixed point combinator" |
| 01:35:52 | <lunabot> | [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,109... |
| 01:36:11 | <Berengal> | mmorrow: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5303#a5303 |
| 01:36:31 | <mmorrow> | y f = let z = f (unsafeCoerce x x); {-# NOINLINE z #-} in z z |
| 01:36:57 | <mmorrow> | which is the same as fix, except it has the slightly more general type ((a -> b) -> b) |
| 01:38:27 | <mmorrow> | Berengal: oh, you may have to get your program to sit on an MVar or something to delay main exiting |
| 01:38:54 | <Berengal> | mmorrow: Ah, will try that |
| 01:39:59 | <mmorrow> | Berengal: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5303#a5304 |
| 01:40:01 | <Alpounet> | :t fix |
| 01:40:03 | <lambdabot> | forall a. (a -> a) -> a |
| 01:40:05 | <mmorrow> | does that work? |
| 01:41:37 | <Berengal> | mmorrow: Nope, and it exits right away (thread blocked indefinitely) |
| 01:41:40 | <mmorrow> | `y' is illegal on account of the infinite type |
| 01:41:45 | <mmorrow> | oops, i botched y |
| 01:41:49 | <Berengal> | Which also happened when I used infinite types... |
| 01:41:50 | <mmorrow> | y f = let z x = f (unsafeCoerce x x); {-# NOINLINE z #-} in z z |
| 01:42:13 | <mmorrow> | Berengal: ok, try |
| 01:42:31 | <Berengal> | s/infinite types/threadDelay/ :/ |
| 01:42:38 | <mmorrow> | ohh, yeah since view returns immediately.. |
| 01:43:06 | <mmorrow> | try http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5303#a5305 |
| 01:43:20 | <mmorrow> | (just adds a getLine after view to the original paste) |
| 01:43:22 | <mmorrow> | (hax) |
| 01:44:01 | <Berengal> | mmorrow: Still same result... It seems to block until after I close the window, then "thread blocked indefinitely" |
| 01:44:11 | <Berengal> | And still only the default picture |
| 01:44:21 | <mmorrow> | hmm |
| 01:44:29 | <mmorrow> | ACTION tries running it |
| 01:45:46 | <mmorrow> | Berengal: ah, you need -threaded |
| 01:45:55 | <Berengal> | Ah, obviously... |
| 01:46:04 | <mmorrow> | i guess it's making a foreign call which blocks without it.. |
| 01:49:01 | <Berengal> | Hmm, fmap still kills sharing, even at O2 |
| 01:50:07 | <mmorrow> | , vacuum (fmap (*2) (take 4 (repeat 1)) |
| 01:50:09 | <mmorrow> | , vacuum (fmap (*2) (take 4 (repeat 1))) |
| 01:50:09 | <lunabot> | luna: parse error (possibly incorrect indentation) |
| 01:50:12 | <lunabot> | [(0,[1,2]),(1,[]),(2,[3,4]),(3,[]),(4,[5,6]),(5,[]),(6,[7,8]),(7,[]),(8,[])] |
| 01:50:18 | <mmorrow> | , vacuum ((take 4 (repeat 1))) |
| 01:50:21 | <lunabot> | [(0,[1,2]),(1,[]),(2,[1,3]),(3,[1,4]),(4,[1,5]),(5,[])] |
| 01:50:36 | <mmorrow> | , vacuum ((take 4 (fix (1:))) |
| 01:50:38 | <lunabot> | luna: parse error (possibly incorrect indentation) |
| 01:50:39 | <mmorrow> | , vacuum ((take 4 (fix (1:)) |
| 01:50:41 | <lunabot> | luna: parse error (possibly incorrect indentation) |
| 01:50:49 | <mmorrow> | , vacuum (take 4 (fix (1:))) |
| 01:50:52 | <lunabot> | [(0,[1,2]),(1,[]),(2,[1,3]),(3,[1,4]),(4,[1,5]),(5,[])] |
| 01:51:05 | <mmorrow> | dang, so does take |
| 01:51:12 | <mmorrow> | , vacuum (fix (1:)) |
| 01:51:15 | <lunabot> | [(0,[1,0]),(1,[])] |
| 01:52:00 | <vininim> | wat |
| 01:52:17 | <vininim> | ,t vacuum |
| 01:52:18 | <lunabot> | luna: Couldn't match expected type `(a1 |
| 01:52:29 | <vininim> | :t vacuum |
| 01:52:30 | <lambdabot> | Not in scope: `vacuum' |
| 01:52:49 | <mmorrow> | , vacuum (fix (\xs -> let x = 0; go 0 = xs; go n = x : go (n-1) in go 4)) |
| 01:52:52 | <lunabot> | [(0,[1,2]),(1,[]),(2,[1,3]),(3,[1,4]),(4,[1,0])] |
| 01:52:56 | <Berengal> | mkTree looks like a list, but fmap increases the number of nodes to 2^n :/ |
| 01:53:26 | <mmorrow> | oh, n/m that's just the ptrs for the list... |
| 01:54:11 | <mmorrow> | yeah, fmap does kill all sharing (but you _are_ creating new nodes after all) |
| 01:54:22 | <mmorrow> | , vacuum (fmap (*2) (take 4 (repeat 1))) |
| 01:54:24 | <lunabot> | [(0,[1,2]),(1,[]),(2,[3,4]),(3,[]),(4,[5,6]),(5,[]),(6,[7,8]),(7,[]),(8,[])] |
| 01:54:26 | <mmorrow> | , vacuum (fmap id (take 4 (repeat 1))) |
| 01:54:29 | <lunabot> | [(0,[1,2]),(1,[]),(2,[1,3]),(3,[1,4]),(4,[1,5]),(5,[])] |
| 01:54:42 | <mmorrow> | id preserves it thankfully |
| 01:55:15 | <mmorrow> | , [$ty| vacuum |] |
| 01:55:19 | <lunabot> | forall a . a -> [] ((Int, [] Int)) |
| 01:55:47 | <mmorrow> | @where vacuum |
| 01:55:49 | <lambdabot> | I know nothing about vacuum. |
| 01:56:02 | <mmorrow> | @where+ vacuum http://moonpatio.com/vacuum/ |
| 01:56:03 | <lambdabot> | I will never forget. |
| 01:58:14 | <Alpounet> | @where vacuum |
| 01:58:15 | <lambdabot> | http://moonpatio.com/vacuum/ |
| 01:59:00 | <akway> | hey all |
| 01:59:31 | <byorgey> | greetings, akway |
| 02:00:13 | <akway> | so whats going on |
| 02:03:20 | <byorgey> | you know, the usual... saving the world with Haskell programs, that sort of thing |
| 02:04:09 | <jaredj> | ...i defined an instance Arbitrary Char, and newtype Value = Value String |
| 02:04:16 | <jaredj> | how do i make an instance Arbitrary Value? |
| 02:05:07 | <byorgey> | jaredj: the easiest way is to turn on GeneralizedNewtypeDeriving and put 'deriving Arbitrary' after the newtype declaration =) |
| 02:05:08 | <copumpkin> | you just write arbitrary and coarbitrary or the type |
| 02:05:15 | <copumpkin> | oh, that works? :o |
| 02:05:41 | <byorgey> | assuming QuickCheck declares an instance Arbitrary a => Arbitrary [a] |
| 02:05:45 | <byorgey> | which I think it does |
| 02:05:49 | <jaredj> | byorgey: yes |
| 02:08:09 | <fracture> | is it possible to define a type to be an array with particular bounds? |
| 02:08:21 | <fracture> | like type foo = Array (1,10) Int |
| 02:08:22 | <fracture> | or something |
| 02:08:36 | <fracture> | (or is array size inherently a runtime thing?) |
| 02:08:50 | <byorgey> | fracture: sadly, no, not without some type gymnastics |
| 02:08:56 | <fracture> | ok |
| 02:09:31 | <Berengal> | byorgey: Could you remove runtime bounds checking using that? |
| 02:10:22 | <copumpkin> | only with dependent types? |
| 02:10:25 | <dino-> | Is this what dependent type means? Being able to do that? |
| 02:10:36 | <dino-> | ah ^ |
| 02:10:50 | <byorgey> | it would be very easy in a system with dependent types, yes |
| 02:12:15 | <byorgey> | you could do it in Haskell too, but you'd have to declare a bunch of types to represent whatever data you want to carry around at the type level, plus a bunch of type families or multi-parameter type classes to do the computation, etc. etc. |
| 02:12:26 | <copumpkin> | hmm |
| 02:12:37 | <copumpkin> | but for indexing into the array with values computed at runtime? |
| 02:13:11 | <byorgey> | copumpkin: if you wanted it to be statically safe in Haskell, then you wouldn't be able to use normal Ints for the indices |
| 02:13:16 | <copumpkin> | and guaranteeing that despite being computed at runtime, they'll never be above 10 |
| 02:13:19 | <copumpkin> | yeah |
| 02:13:27 | <copumpkin> | I think I see |
| 02:13:44 | <byorgey> | but you could do it with a special data type for representing the indices, which had some type information to connect it to the type level indices for the array |
| 02:13:52 | <copumpkin> | yeah |
| 02:13:53 | <byorgey> | using GADTs with a phantom type parameters most likely |
| 02:15:15 | <SamB> | it's a bit easier in Coq or Agda ... |
| 02:15:34 | <byorgey> | much easier. |
| 02:15:59 | <SamB> | it's called understatement |
| 02:16:12 | <byorgey> | heh, right =) |
| 02:16:32 | <mmorrow> | hah |
| 02:16:35 | <jaredj> | thanks all. good night for now |
| 02:26:52 | <gwern> | @remember HalAbelson If I have not seen farther, it is because giants were standing on my shoulders. |
| 02:26:52 | <lambdabot> | Done. |
| 02:26:56 | <gwern> | @flush |
| 02:29:32 | <fracture> | do most people dangle "then" on the same line as the if, or put it on the next line |
| 02:29:41 | <fracture> | (or is it pretty evenly split?) |
| 02:29:52 | <hatds> | I think more people put it on the next line |
| 02:29:56 | <SamB> | next line, I think |
| 02:30:12 | <SamB> | and then curse about having to indent it, if in a do |
| 02:30:23 | <fracture> | ouch |
| 02:30:28 | <fracture> | you have to indent it in a do? |
| 02:30:39 | <SamB> | basically |
| 02:30:43 | <fracture> | a |
| 02:30:43 | <fracture> | h |
| 02:30:54 | <hatds> | you always have to indent then/else at least one space farther than if |
| 02:31:10 | <hatds> | well modulo {,} and place things on one line |
| 02:31:33 | <Cale> | fracture: It should always look like this: |
| 02:31:35 | <jeff_s_> | can you put the blocks in braces instead? |
| 02:31:36 | <Cale> | if foo |
| 02:31:38 | <Cale> | then bar |
| 02:31:41 | <Cale> | else quux |
| 02:31:57 | <SamB> | assuming the if is indented to do's statement-start column, i.e. not in a subexpression |
| 02:32:01 | <Cale> | The important thing being that the 'then' and 'else' line up |
| 02:32:03 | <fracture> | oh weird... I'd been doing the then on the same level as the if |
| 02:32:10 | <fracture> | (seemed to be working...? dunno) |
| 02:32:16 | <SamB> | fracture: it might be an extension? |
| 02:32:20 | <fracture> | dunno |
| 02:32:21 | <fracture> | using ghc |
| 02:32:26 | <SamB> | fracture: it's fine if not in a do, anyway |
| 02:32:27 | <Cale> | Well, the actual rule is more general, but you'll have fewer problems like this |
| 02:32:31 | <fracture> | ok |
| 02:32:54 | <fracture> | well, here's a bummer... haskel-mode in emacs refuses to indent the "then" anywhere but the if's level |
| 02:32:59 | <Cale> | Inside a do-block, if you indent something to the same as the rest of the block, you'll start a new line of the do-block |
| 02:33:09 | <Cale> | Which means that your if-expression will be cut in two |
| 02:33:09 | <fracture> | so either ditch haskell-mode, dangle the then, or turn off it's auto indent |
| 02:33:11 | <SamB> | fracture: yeah, that's where the cursing comes in |
| 02:33:43 | <Cale> | fracture: really? I don't remember it being that bad, but I mostly used the simple indenter |
| 02:34:03 | <SamB> | fracture: I think you just don't hit <TAB> on that line, actually |
| 02:34:19 | <hatds> | hmm.. normally if you aren't in a do you don't have to indent then/else? I thought the special thing about do-layout only applied to the do block and the outer block containing 'do' |
| 02:34:58 | <SamB> | hatds: well, it tries to insert a semicolon if you don't indent the then ... |
| 02:35:21 | <SamB> | (or the else, but that is generally indented the same as the then ;-) |
| 02:35:40 | <hatds> | ah right |
| 02:36:13 | <SamB> | I'm not exactly sure how this could be fixed ... |
| 02:36:16 | <Cale> | Wow, it is that bad... |
| 02:36:20 | <Cale> | hmm |
| 02:36:35 | <SamB> | I mean, allowing then at the same column as if |
| 02:36:49 | <hatds> | hmm, neat. I wonder if I will switch to lined up if/then/else when not in do if it would be too fragile |
| 02:36:53 | <Cale> | ACTION wonders if it is something possibly fixed in newer versions of haskell-mode |
| 02:37:26 | <fracture> | haskell-mode seems *really* bad so far |
| 02:37:29 | <hatds> | *wouldn't |
| 02:37:31 | <SamB> | there are two places the fix would have to be done: the parsers, and the Report |
| 02:37:47 | <SamB> | fracture: I think the indentation is just hard :-( |
| 02:37:52 | <fracture> | another annoyance so far: it doesn't seem to handle paragraph fill in non-multiline comments properly |
| 02:38:08 | <fracture> | probably that too |
| 02:38:17 | <SamB> | fracture: what does, for you? |
| 02:38:28 | <SamB> | handle M-q for comments, I mean |
| 02:38:33 | <fracture> | C++ mode |
| 02:38:46 | <SamB> | how about conf-mode? |
| 02:39:00 | <fracture> | dunno conf-mode |
| 02:39:06 | <SamB> | or is that config-mode? |
| 02:39:08 | <Cale> | hmm, apparently this version of haskell-mode is the newest... |
| 02:39:09 | <SamB> | ACTION doesn't remember |
| 02:39:12 | <fracture> | generic-mode? |
| 02:39:23 | <SamB> | fracture: well, it'd have to be something with comments! |
| 02:39:23 | <fracture> | I dunno if that does |
| 02:39:35 | <Cale> | fracture: anyway, there's another indenter available for Haskell... |
| 02:39:41 | <fracture> | sh mode fails it |
| 02:39:54 | <Cale> | fracture: I think it was obtained by replacing 'smart' with 'simple' |
| 02:39:55 | <fracture> | I think a few modes do... probably most other than the c mode |
| 02:40:01 | <SamB> | fracture: I think there's some add-on you can install that fixes it most everywhere |
| 02:40:30 | <fracture> | Cale: yeah, I think I tried that one, and it seemed just like basic manual indentation |
| 02:40:46 | <fracture> | which would be totally fine, except that I have hardly any clue about the rules for indenting haskell code still (heheh) |
| 02:40:58 | <Cale> | fracture: Pretty much, except that it looks at the line above and tries to guess which spots you might want to line something up with |
| 02:41:59 | <SamB> | fracture: you might try filladapt |
| 02:42:03 | <fracture> | oh wait... I might actually be using the simple indenter |
| 02:43:35 | <Cale> | If you're getting "Sole indentation" then you're not. |
| 02:43:41 | <fracture> | ah ok |
| 02:44:04 | <fracture> | anyway; I'll look into the mode more later... gonna stick to the problem at hand for now :) |
| 02:44:09 | <fracture> | (thanks for the help though) |
| 02:44:46 | <Cale> | tapping space a couple times also works, though it's annoying :P |
| 02:45:01 | <fracture> | yeah ;) |
| 02:46:57 | <Cale> | aha! |
| 02:47:00 | <SamB> | fracture: what version of Emacs are you using, anyway? |
| 02:47:01 | <Cale> | There's a setting for it |
| 02:47:20 | <fracture> | gnu emacs 21.2.1 |
| 02:47:27 | <fracture> | cale: ah? |
| 02:47:41 | <SamB> | fracture: does that have fill-paragraph-handle-comment ? |
| 02:47:50 | <fracture> | btw, I was just thinking about it... is it not the same as let/in inside of a do block? |
| 02:47:52 | <SamB> | it's a variable |
| 02:47:57 | <fracture> | nope |
| 02:47:59 | <fracture> | oh wait |
| 02:48:04 | <fracture> | nope |
| 02:48:17 | <fracture> | is it introduced by some mode I might not have on? |
| 02:48:21 | <fracture> | (fill-mode maybe?) |
| 02:48:41 | <SamB> | it's in fill.el |
| 02:49:16 | <fracture> | d'oh only have elc's here for some reason |
| 02:49:51 | <fracture> | err but anyway so like |
| 02:49:53 | <fracture> | inside of a do |
| 02:50:00 | <fracture> | if you put "in" on the next line at the same level as "let" |
| 02:50:10 | <fracture> | it probably doesn't handle it as you'd mean, correct? |
| 02:50:19 | <fracture> | but outside of do's people put the in on the same column, no? |
| 02:50:53 | <fracture> | (at least, real world haskell does) |
| 02:51:56 | <Cale> | Hmm, there is a setting for how much to indent after an if, but it seems to disregard it for the next line... |
| 02:52:00 | <murphy__> | hi! question about compiling ... if i've run the runhaskell "configure" command, and then I run "build," why would I see a "run configure command first" error message? |
| 02:52:15 | <murphy__> | I don't understand ... (total newbie, btw) |
| 02:52:17 | <fracture> | cale: d'oh |
| 02:52:40 | <Cale> | murphy__: What are you trying to compile? |
| 02:53:38 | <murphy__> | I am trying to compile X11 |
| 02:53:44 | <murphy__> | to ultimately build xmonad |
| 02:53:50 | <jzhou> | do we really need ghc to build itself? |
| 02:53:58 | <Cale> | murphy__: Okay, the easiest thing to do is to get cabal-install first. |
| 02:54:16 | <Cale> | murphy__: and then use that to install xmonad, which will install the other libraries you'll need |
| 02:54:17 | <hatds> | fracture: you don't use 'in' inside a do |
| 02:54:33 | <murphy__> | hrm. OK. Let me see if I can find that. |
| 02:54:41 | <Cale> | murphy__: I'll get you a link |
| 02:54:48 | <bd_> | jzhou: Yes. It lets us apply all of GHC's optimizations to itself, and also acts as a fairly tough regression test. Plus, what else will you build it with? |
| 02:54:49 | <fracture> | hatds: I'm pretty sure you can if you put it on one line, eh? |
| 02:54:50 | <Cale> | http://hackage.haskell.org/packages/archive/cabal-install/0.6.2/cabal-install-0.6.2.tar.gz |
| 02:55:06 | <Cale> | murphy__: ^^ inside that tarball you will find a bootstrap.sh which you should run |
| 02:55:09 | <fracture> | (what if you indent the in?) |
| 02:56:01 | <Cale> | It is so stupid that after all this time we still don't have a text editor which properly understands the offside rule. |
| 02:56:04 | <jzhou> | bd_: thx, but is it "easy" and possible to build ghc using the official binaries for linux? |
| 02:56:06 | <hatds> | fracture: yes, you can do that, but saying "let ... in ..." denotes an expression, so if you are inside a do there would still be a let without an 'in' somewhere outside it |
| 02:56:30 | <fracture> | indenting works |
| 02:56:31 | <fracture> | just tried |
| 02:56:37 | <bd_> | jzhou: Sure, but it takes a while :) |
| 02:56:39 | <Cale> | (however, if you're inside a do, there's not much reason to have a let *with* an in. |
| 02:56:44 | <fracture> | main = do |
| 02:56:44 | <fracture> | let f = 2 :: Int |
| 02:56:44 | <fracture> | in putStrLn (show f) |
| 02:56:44 | <fracture> | putStrLn (show f) |
| 02:56:48 | <fracture> | second use of f is out of scope |
| 02:56:58 | <fracture> | Cale: to limit scope, no? |
| 02:57:07 | <jzhou> | bd_: thanks for the confirmation, that encourages me to continue building :) |
| 02:57:08 | <murphy__> | got it cale |
| 02:57:08 | <hatds> | Cale: well, in so much as one would ever use a let inside a let |
| 02:57:12 | <murphy__> | working on it now |
| 02:57:12 | <Cale> | Well, yes, you might want that :) |
| 02:57:20 | <murphy__> | looks like I have some more dependencies to add! hah |
| 02:57:38 | <Berengal> | Limiting scope is the only reason I can think of, but in haskell expressions are usually small enough that you don't need that |
| 02:57:41 | <fracture> | so anyway: if your rationale about if/then is general, it seems we should indent the "in" further than a let also, right? |
| 02:57:45 | <fracture> | (outside of do's) |
| 02:58:10 | <Cale> | fracture: yeah, usually I just go with one space |
| 02:58:17 | <Cale> | let foo = bar |
| 02:58:19 | <Cale> | in quux |
| 02:58:33 | <fracture> | ah k, cool |
| 02:59:09 | <Cale> | murphy__: Is the cabal-install bootstrap.sh not working? |
| 02:59:30 | <Cale> | murphy__: It should just work, if not, it might be your ghc version. |
| 03:00:21 | <Cale> | murphy__: also, Debian and Ubuntu separate a lot of the things which ghc normally comes with into separate packages, in case you're using one of those |
| 03:01:31 | <dino-> | And I've seen missing deps for cabal-install with Gentoo |
| 03:01:40 | <dino-> | Using an ebuild of ghc |
| 03:02:32 | <dino-> | But my experience with that is low and from some months ago, so it may be out of data now. You see, they make me use Gentoo at work for the servers. Under duress. |
| 03:03:31 | <murphy__> | yeah, exactly cale |
| 03:03:40 | <murphy__> | I had to go into synaptic and get the http and zlib libraries |
| 03:03:50 | <murphy__> | installing those now and then trying to bootstrap again |
| 03:04:00 | <Cale> | okay |
| 03:04:17 | <murphy__> | oh bugger |
| 03:04:17 | <dino-> | murphy__: Is this Debian or Ubuntu? What GHC version are the up to? |
| 03:04:23 | <murphy__> | ubuntu |
| 03:04:25 | <dino-> | (Just curious) |
| 03:04:32 | <dino-> | s/the/they/ |
| 03:04:33 | <murphy__> | getting a segfault when compiling http |
| 03:04:45 | <murphy__> | 6.8.2 = version |
| 03:05:53 | <Cale> | murphy__: err... |
| 03:06:02 | <Cale> | @where hpaste |
| 03:06:03 | <lambdabot> | http://hpaste.org/ |
| 03:06:09 | <murphy__> | haha, is the version too early? |
| 03:06:10 | <Cale> | could you go there and paste the output? |
| 03:06:15 | <Cale> | 6.8.2 is a little old |
| 03:06:18 | <Cale> | But it should work |
| 03:06:39 | <murphy__> | let me see if I can get a newer version |
| 03:06:59 | <dino-> | murphy__: You can get the generic binary install of 6.10.3 |
| 03:07:07 | <dino-> | But this will be a configure ; make install thing |
| 03:07:19 | <dino-> | Not all squeaky apt clean. |
| 03:07:53 | <dino-> | But it's not hard to remove a GHC manually. I feel like newer GHC is worth it. |
| 03:08:00 | <murphy__> | that's fine |
| 03:08:13 | <murphy__> | I'd rather be up to speed than have to deal with old dependencies |
| 03:08:17 | <murphy__> | and cruft |
| 03:08:48 | <dino-> | Excellent. Here: http://haskell.org/ghc/download_ghc_6_10_3.html |
| 03:08:52 | <dino-> | Binary Packages |
| 03:09:14 | <murphy__> | got it. downloading. |
| 03:09:48 | <dino-> | I don't know what the libtinfo.so.5 is about, but I got the one without "ghc-6.10.3-i386-unknown-linux-n.tar.bz2" for Debian lenny |
| 03:10:33 | <murphy__> | I downloaded the same. |
| 03:14:37 | <murphy__> | great! it's installing. Bootstrap is working awesome, too. |
| 03:14:50 | <murphy__> | Nothing like a new build to get things running smoothly. |
| 03:14:59 | <dino-> | murphy__: Cool. I was just investigating other things you may have needed like libgmp |
| 03:15:09 | <dino-> | But probably your prior apt-get adventures got that. |
| 03:15:20 | <murphy__> | indeed. |
| 03:15:52 | <doctormach> | Is it possible to write the ((->) e) Functor instance in a pointful manner? |
| 03:17:24 | <aconbere> | I'm looking at doing some profiling on a haskell application, this is my first forray into this, and I'm not sure the meaning of -auto and -auto-all |
| 03:17:27 | <murphy__> | this is fantastic. Thanks for your help, dino. |
| 03:18:02 | <hatds> | doctormach: you mean fmap f g e = (f . g) e ? |
| 03:18:03 | <dino-> | murphy__: If you ever need to remove it (say installing a newer one), this Haskell-cafe post details directories: http://www.haskell.org/pipermail/haskell-cafe/2007-November/034362.html |
| 03:18:46 | <doctormach> | hatds: Yes, thanks |
| 03:19:08 | <hatds> | ghc doesn't come with an uninstall? |
| 03:19:24 | <dino-> | hatds: Boy am I going to feel stupid if it does. |
| 03:54:00 | <malouin> | Ok, I'm in Part II of All About Monads. |
| 03:54:06 | <malouin> | Identity... check, Maybe... check, Error... |
| 03:54:34 | <malouin> | I think I can't understand this because somehow Error is parameterized by another monad, and I don't see how bind and return are implemented. |
| 03:54:43 | <malouin> | any ideas what I am missing? |
| 03:54:55 | <roconnor> | Error is parameterized by another monad? |
| 03:55:00 | <roconnor> | link? |
| 03:55:21 | <myname> | quit |
| 03:55:28 | <myname> | |
| 03:55:38 | <myname> | \quit |
| 03:55:39 | <malouin> | http://www.haskell.org/all_about_monads/html/errormonad.html |
| 03:55:59 | <Cale> | malouin: Perhaps you mean that Error is parametrised by the type of error? |
| 03:56:15 | <Cale> | (Well, Either is) |
| 03:56:21 | <malouin> | err, I mean MonadError needs another monad. |
| 03:56:23 | <Cale> | For each type e, Either e is a monad. |
| 03:56:32 | <malouin> | as in class (Monad m) => MonadError e m | m -> e |
| 03:56:41 | <Cale> | The MonadError class only has one monad type at a time |
| 03:56:46 | <Cale> | e means the type of error |
| 03:57:13 | <roconnor> | ``The MonadError class is parameterized over the type of error information |
| 03:57:28 | <roconnor> | oh |
| 03:57:36 | <roconnor> | the class constrain isn't a parameterisation |
| 03:57:53 | <roconnor> | it just means you have to make it a Monad before you can go on further and make it a MonadError |
| 03:57:57 | <dmwit> | Holy! |
| 03:58:11 | <dmwit> | I hit ":e Main.hs" in ghci by accident and it worked! |
| 03:58:41 | <roconnor> | malouin: it is the same as how a type has to be an Ord before it can be a Num |
| 03:58:51 | <dmwit> | ghci++ |
| 03:58:51 | <roconnor> | er |
| 03:58:56 | <roconnor> | malouin: it is the same as how a type has to be an Eq before it can be a Num |
| 03:59:00 | <roconnor> | @src Num |
| 03:59:00 | <lambdabot> | class (Eq a, Show a) => Num a where |
| 03:59:00 | <lambdabot> | (+), (-), (*) :: a -> a -> a |
| 03:59:00 | <lambdabot> | negate, abs, signum :: a -> a |
| 03:59:00 | <lambdabot> | fromInteger :: Integer -> a |
| 03:59:10 | <malouin> | ok. |
| 03:59:32 | <roconnor> | MonadError adds more methods |
| 03:59:48 | <roconnor> | specifically throwError and catchError |
| 03:59:51 | <NEEDMOAR> | @src (-) |
| 03:59:51 | <lambdabot> | x - y = x + negate y |
| 04:00:09 | <NEEDMOAR> | @src abs |
| 04:00:10 | <lambdabot> | Source not found. |
| 04:01:33 | <malouin> | hmm... |
| 04:01:57 | <malouin> | So what is an instance of Monad? |
| 04:02:06 | <dmwit> | ?instances Monad |
| 04:02:07 | <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, [] |
| 04:02:37 | <dmwit> | ...or was that a more metaphysical question? |
| 04:03:19 | <roconnor> | malouin: specific data type (constructors) are instances of Monads |
| 04:03:29 | <malouin> | so I would make a data MyError... instance Monad MyError ... instance MonadError MyError...? |
| 04:03:44 | <roconnor> | malouin: Identity, Maybe, or (Either String), etc. |
| 04:03:55 | <roconnor> | malouin: ya |
| 04:04:18 | <roconnor> | instance MonadError SomeErrorType MyError |
| 04:04:54 | <malouin> | so it seems like Identity and Maybe have an associated type, but Error doesn't. |
| 04:05:42 | <Cale> | malouin: hm? It's the other way around. |
| 04:06:05 | <Cale> | malouin: Error has an extra associated type which Identity and Maybe don't have |
| 04:06:30 | <malouin> | I am trying to refer to 'data Maybe a = Nothing | Just a |
| 04:06:33 | <roconnor> | malouin: I'm not sure what you mean by associated type. A type parameter? |
| 04:06:42 | <malouin> | as the "type" associated with Maybe |
| 04:06:49 | <malouin> | and by associated I mean instance Monad Maybe |
| 04:06:54 | <Cale> | malouin: vs. data Either a b = Left a | Right b ? |
| 04:07:04 | <Cale> | and instance Monad (Either e) ? |
| 04:07:06 | <malouin> | Cale: good point. |
| 04:07:18 | <Aleran> | if I have a function that accepts three arguments and a list with three elements, how can I pass the contents of that list as the arguments for the function? |
| 04:07:40 | <Cale> | Aleran: I suppose you can pattern match the list... |
| 04:08:23 | <Cale> | Aleran: case myList of [x,y,z] -> f x y z; _ -> ... what if the list has a different number of elements ... |
| 04:08:25 | <roconnor> | Aleran: let [a,b,c] = param in foo a b c -- however using a list is like this is somewhat indicates a poor design. |
| 04:11:45 | <Aleran> | thanks. I'll try to figure this out. Or rework my design. |
| 04:12:49 | <dmwit> | It doesn't necessarily indicate bad design. I've had a few cases where I've wanted such a thing, especially using the list monad. |
| 04:13:02 | <dmwit> | replicateM 3 -- guaranteed to return lists of length 3, but no way to see that from the type |
| 04:13:16 | <roconnor> | dmwit is right. It isn't always bad |
| 04:13:19 | <malouin> | Is there a datatype in the standard library that is an instance of Error, MonadError? |
| 04:13:29 | <dmwit> | roconnor is also right. It is a code smell. |
| 04:13:36 | <dmwit> | <3 |
| 04:13:44 | <roconnor> | malouin: String is an instance of Error |
| 04:13:55 | <roconnor> | malouin: and (Either String) is an instance of MonadError |
| 04:14:34 | <malouin> | is there some code that I could look at that defines Either String as an instane of MonadError? |
| 04:16:12 | <malouin> | well, actually nm, that is staring right at me here. |
| 04:17:04 | <malouin> | Either e is a Monad... |
| 04:17:45 | <ksf> | ...and every m Error is a MonadError |
| 04:17:52 | <ksf> | that's the instance you'll have to look for. |
| 04:17:58 | <roconnor> | malouin: only when e is an instance of Error |
| 04:18:16 | <roconnor> | (according the the mtl (monad transformer library)) |
| 04:18:16 | <ksf> | Monad m => m Error , that is. |
| 04:18:36 | <roconnor> | ksf: that's not quite right |
| 04:18:44 | <roconnor> | Error is a class, not a type. |
| 04:18:51 | <ksf> | yeah, I figure I looked into the wrong crystal ball. |
| 04:19:06 | <malouin> | Error a => Either a is a Monad? |
| 04:20:39 | <roconnor> | malouin: yes |
| 04:21:16 | <roconnor> | malouin: (according to the mtl) |
| 04:24:00 | <dmwit> | ?src MonadError |
| 04:24:01 | <lambdabot> | class (Monad m) => MonadError e m | m -> e where |
| 04:24:01 | <lambdabot> | throwError :: e -> m a |
| 04:24:01 | <lambdabot> | catchError :: m a -> (e -> m a) -> m a |
| 04:24:11 | <malouin> | aha, I found what I am looking for in the Control.Monad.Error source |
| 04:24:30 | <malouin> | instance (Error e) => Monad (Either e) where |
| 04:24:37 | <malouin> | instance (Error e) => MonadError e (Either e) where ... |
| 04:24:39 | <dmwit> | Use the source, Luke! |
| 04:24:47 | <malouin> | :) |
| 04:25:33 | <dmwit> | I had a colleague once who said he liked C because even the most basic functions are implemented as a library. |
| 04:25:53 | <dmwit> | I didn't think of it at the time, but I should have told him I like Haskell because even the most basic functions are implemented as a readable library. |
| 04:27:12 | <Cale> | dmwit: A *readable* library |
| 04:27:32 | <dmwit> | Right. =) |
| 04:27:41 | <dmwit> | That emphasis is important. |
| 04:28:33 | <Cale> | Though some of the most basic functions in Haskell are primops... |
| 04:28:47 | <Cale> | But not too many. |
| 04:28:58 | <dmwit> | Yeah, the analogy doesn't quite play over. |
| 04:29:10 | <dmwit> | If you want to use a different allocator, for example, that's a lot harder in Haskell than in C. |
| 04:30:16 | <bruce`> | I have a question -- should I just go ahead and shoot? |
| 04:30:26 | <dmwit> | Yes. |
| 04:30:31 | <QtPlaty[HireMe]> | bruce`: Yes |
| 04:30:42 | <dmwit> | If it involves more than a line or two of code, paste it on the web somewher. |
| 04:30:46 | <dmwit> | ?hpaste is a good one |
| 04:30:47 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 04:31:50 | <dmwit> | Cale: Of course, the things that are primops in Haskell aren't exactly library functions in C, either. Int+# or whatever, for example. |
| 04:31:57 | <Cale> | yeah |
| 04:32:30 | <malouin> | ok, this is starting to make sense. |
| 04:32:50 | <dmwit> | malouin: Oh no! Quick, tackle something harder! |
| 04:32:54 | <bruce`> | So, I'm generating a really long combinatorial list. I want to do statistics on it -- basically, a kind of histogram, but with multiple counters, arrays, etc. I want to go through the combinatorial list once, and generate all the statistics. |
| 04:32:58 | <dmwit> | Monad transformers, or arrows, maybe. |
| 04:32:59 | <malouin> | thanks roconnor,Cale,dmwit ksf |
| 04:33:14 | <malouin> | dmwit: well, I'm trying to work my way towards understanding monad transformers. |
| 04:33:28 | <malouin> | because I need some IO + state. |
| 04:33:29 | <dmwit> | malouin: No problem. Once you get monads, monad transformers are very nearly trivial. |
| 04:33:51 | <Cale> | malouin: Are you sure that you need State? |
| 04:34:05 | <dmwit> | bruce`: Sounds like fun! |
| 04:34:05 | <Cale> | malouin: IO already has a lot of state mechanisms built into it. |
| 04:34:20 | <dmwit> | bruce`: What have you tried so far? |
| 04:34:52 | <Cale> | bruce`: Sounds for a job for foldl' and a record datatype with strict fields for each of the statistics. |
| 04:34:57 | <Cale> | sounds like* |
| 04:35:09 | <bruce`> | I think the way to do this properly is with mutable arrays, and this would be simple if there were only one accumulator array -- use STUArray or whatever. But I'm not sure how to make it work if you want a structure-of-arrays: an arbitrary conglomerate of arrays, individual counters, and so forth... |
| 04:35:10 | <bruce`> | . |
| 04:35:30 | <malouin> | Cale: basically, I am working from dons's "roll your own" IRC bot, and I want my bot to remember things. |
| 04:35:52 | <dmwit> | bruce`: Mutable arrays? ...in the accumulator? |
| 04:35:56 | <dmwit> | That sounds a bit odd. |
| 04:36:31 | <Cale> | malouin: It's already a Reader, yeah? |
| 04:36:33 | <dmwit> | I'm with Cale on this one: an own data type seems like the way to go. |
| 04:36:54 | <Cale> | malouin: You can just add IORefs to the Bot datatype that store the state. |
| 04:36:55 | <malouin> | Cale: yes |
| 04:37:28 | <malouin> | ah, hmm... sounds like ocaml style. |
| 04:37:59 | <Cale> | malouin: Well, given that the machinery is already there, you might as well use it :) |
| 04:38:15 | <dmwit> | There are pointers in every language, if you know where to look. ;-) |
| 04:38:28 | <malouin> | Wah, ok, awesome. |
| 04:39:02 | <Cale> | malouin: Another option to consider is just to pass the state around by hand in the parameters. |
| 04:39:05 | <bruce`> | I'm doing a histogram -- basically, each element of the combinatorial list is scored, in multiple ways, and the appropriate member of the histogram needs to be incremented. The problem is, if you use a list, you'll need to go through the entire list to increment one element. If you use a Map, you'll need to go through log N elements. But if you use an updateable array, you get the famous O(1) performance... but if you have multiple |
| 04:39:07 | <bruce`> | arrays, I'm not really sure how to do that in Haskell. Or, *if* you can do that in Haskell... |
| 04:39:16 | <malouin> | Cale: yes, I tried that... briefly ;) |
| 04:39:33 | <Cale> | malouin: If you have a small loop for the bot, that's usually not too bad, but for complicated things, it gets annoying. |
| 04:39:45 | <dmwit> | bruce`: You're right, a mutable array does sound just right for a histogram. |
| 04:39:58 | <dmwit> | bruce`: You should learn about the ST monad; it's perfect for this kind of thing. |
| 04:40:11 | <Cale> | How many entries will the histogram have? |
| 04:40:34 | <Berengal1> | How about a diffarray? |
| 04:40:35 | <dmwit> | Cale: n-tuple? =) |
| 04:41:13 | <Cale> | dmwit: No, I was going to say that if you can quantify that, the accesses on Data.Map become O(1) magically :) |
| 04:41:26 | <bruce`> | There are (currently) two scores (each with their own histogram), and two individual counters (one of which is a total counter). |
| 04:41:30 | <dmwit> | =) |
| 04:41:58 | <Cale> | I would seriously consider using Data.Map to accumulate the histogram, and only replace it after determining that it was really too slow. |
| 04:42:01 | <dmwit> | Cale: I like my n-tuple idea better, for its qualities as a joke-suggestion. =) |
| 04:42:24 | <Cale> | Having a nice pure immutable datatype is so much nicer to work with than anything mutable. |
| 04:42:41 | <Cale> | and it really can be quite efficient up to reasonably large sizes |
| 04:44:12 | <bruce`> | I've been looking at the ST monad, which does seem to be the right thing to use. What I don't understand is the connection to mutable arrays. Each mutable array is a monad in its own right, as I understand it; what I sort of doubt is that just making an ST monad out of a datastructure with mutable arrays in it will cause everything to Just Work... |
| 04:44:29 | <Cale> | No... the mutable arrays themselves are not monads :) |
| 04:44:36 | <dmwit> | Mutable arrays are not monads. |
| 04:44:46 | <Cale> | (nor are they even monadic computations, but there are monadic computations which produce them) |
| 04:44:53 | <dmwit> | Not even mutable, one-element arrays, even though they seem just like Identity. |
| 04:45:27 | <bruce`> | OK, so how would it work, then? How does the ST monad know about/deal with mutable arrays? |
| 04:45:30 | <Cale> | So for STArray, you'd use the MArray interface |
| 04:45:45 | <mauke> | ST provides mutable variables, including arrays |
| 04:46:00 | <dmwit> | bruce`: ST provides its own mutable array type with read and write operations that yield ST actions. |
| 04:46:02 | <Berengal1> | Note that mutable boxed arrays are slow |
| 04:46:21 | <dmwit> | Berengal1: I didn't find them so when I was using them. |
| 04:46:39 | <Cale> | and you'd use newArray or newListArray to create a new array, and then start filling/modifying it with readArray and writeArray |
| 04:47:36 | <Cale> | newArray takes a pair of indices (the smallest and largest), an initial element to fill the array with, and gives an ST computation which when executed produces a new array with those bounds and initialised as required. |
| 04:47:54 | <bruce`> | OK, so I'd put *references* to the mutable arrays in the datastructure, then make the ST monad with the datastructure as the state? |
| 04:48:03 | <Berengal1> | dmwit: The GC has to scan the entire array if it has been mutated inbetween runs |
| 04:48:39 | <Cale> | bruce`: Well, if you're doing it this way, you might as well just create the arrays inside the ST computation, and freeze them into plain Arrays at the end |
| 04:48:43 | <mauke> | bruce`: ST has no hidden state |
| 04:49:00 | <bruce`> | Yeah, if I'm interested in the mutable arrays at all I should use the unboxed ones in this case. |
| 04:49:03 | <Cale> | You shouldn't need an additional datastructure I would think... |
| 04:49:09 | <Cale> | I'll make an example... |
| 04:49:24 | <dmwit> | Cale: He'll probably want an additional datastructure if he's going to have two arrays and some counters. |
| 04:49:37 | <Cale> | dmwit: Well, you can just make them parameters if there are so few. |
| 04:49:48 | <Cale> | (to your loop) |
| 04:49:49 | <dmwit> | ACTION shrugs |
| 04:49:54 | <dmwit> | design choice, I guess |
| 04:50:15 | <dmwit> | Data structures are easier to extend in the future than parameter lists. |
| 04:51:44 | <bruce`> | Really, this is more of an exercise than anything else -- I'm mainly interested in knowing *how* to do this kind of thing in cases where the performance really is critical 8^) |
| 04:52:10 | <Cale> | or, in fact, not even parameters |
| 04:52:19 | <Cale> | but define the loop directly in the do-block inside a let |
| 04:53:06 | <dmwit> | Yeah, that seems more like it. |
| 04:53:22 | <Cale> | or, perhaps forM |
| 04:53:34 | <Cale> | all the stuff will be in scope |
| 04:56:03 | <dmwit> | Cale++ MonadRandom is awesome |
| 04:56:14 | <dmwit> | I keep finding places where it's exactly what I wanted. |
| 04:57:12 | <dmwit> | ACTION checks to see if it's on Hackage yet |
| 05:01:04 | <Cale> | bruce`: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5307#a5307 |
| 05:01:57 | <Cale> | bruce`: That's a silly program, but it should illustrate the idea. |
| 05:02:15 | <bruce`> | OK, thanks -- let me look at it... |
| 05:02:32 | <Cale> | bruce`: But to be honest, I would use a Data.Map and a foldl' :) |
| 05:02:42 | <pumpkin> | but the speed! |
| 05:02:56 | <Cale> | Let's see... |
| 05:03:09 | <pumpkin> | I don't actually think it'll be noticeably different :P |
| 05:03:48 | <bruce`> | I'll try it out on my own application in all three ways and see if it actually is noticabley different 8^) |
| 05:04:01 | <bruce`> | Might take a while, though. |
| 05:05:00 | <Cale> | haha |
| 05:05:16 | <Cale> | My Data.Map version just beat the STUArray one |
| 05:05:28 | <pumpkin> | nice :) |
| 05:05:31 | <Cale> | But, let me get a better string |
| 05:05:33 | <pumpkin> | -O2 ? |
| 05:05:37 | <Cale> | No, in ghci |
| 05:05:43 | <pumpkin> | ah |
| 05:05:45 | <Cale> | Perhaps I should actually compile it |
| 05:06:15 | <pumpkin> | would probably be even faster as an IntMap, assuming ghc isn't slow at doing ord |
| 05:06:15 | <aconbere> | I'm trying to take a look at some profiling info for my app. I've compiled it with -prof -auto-all and run it with +RTS -p |
| 05:06:19 | <aconbere> | and I get a .prof file |
| 05:06:22 | <rzezeski> | Can someone please tell me how I could implement the following in Haskell... |
| 05:06:23 | <aconbere> | but it's empty |
| 05:06:24 | <rzezeski> | user=> (map #(filter odd? %) [[3,5,6] [6 8 9] [1 2 10]]) |
| 05:06:25 | <rzezeski> | ((3 5) (9) (1)) |
| 05:06:34 | <rzezeski> | the above is Clojure |
| 05:06:42 | <Cale> | map (filter odd) |
| 05:06:49 | <pumpkin> | > map (filter odd) [[3,5,6] [6 8 9] [1 2 10]] |
| 05:06:49 | <rzezeski> | I tried that |
| 05:06:50 | <lambdabot> | Couldn't match expected type `t -> t1 -> [a]' |
| 05:06:51 | <dmwit> | Cale: I bet accumArray beats both of them... |
| 05:07:01 | <Cale> | > map (filter odd) [[3,5,6] [6,8,9] [1,2,10]] |
| 05:07:03 | <lambdabot> | Couldn't match expected type `t -> t1 -> [a]' |
| 05:07:11 | <Cale> | > map (filter odd) [[3,5,6],[6,8,9],[1,2,10]] |
| 05:07:13 | <lambdabot> | [[3,5],[9],[1]] |
| 05:07:14 | <Cale> | damn spaces :) |
| 05:07:17 | <Cale> | hehe |
| 05:07:20 | <pumpkin> | lol |
| 05:07:25 | <pumpkin> | had my scratching my head, sadly |
| 05:07:36 | <pumpkin> | rzezeski: that's valid clojure? |
| 05:07:49 | <pumpkin> | with that inconsistent space/comma thing? |
| 05:08:04 | <dmwit> | I sometimes wish Haskell would ignore commas in more places. |
| 05:08:12 | <dmwit> | Like at the end of record declarations and stuff. |
| 05:08:19 | <rzezeski> | bah, I did the same thing and that's why it didn't work, since I'm a newb in Haskell I thought it was the type system killing me |
| 05:08:20 | <dmwit> | or allow things like [3, 4, 5,] |
| 05:08:26 | <mauke> | dmwit: just use perl :-) |
| 05:08:30 | <rzezeski> | pumpkin: yes, commas are optional |
| 05:08:37 | <pumpkin> | ack :P |
| 05:08:54 | <mauke> | [3, 4,, 5,,,] |
| 05:09:07 | <dmwit> | eww |
| 05:09:08 | <Cale> | Okay, once compiled, the STUArray version is marginally faster |
| 05:09:12 | <dmwit> | I don't want *that*. |
| 05:09:15 | <rzezeski> | I was mixing Haskell and Clojure syntax, excuse me :) |
| 05:09:20 | <Cale> | 0m1.056s vs. 0m1.412s |
| 05:09:24 | <pumpkin> | ah |
| 05:09:32 | <aconbere> | anybody profile info? |
| 05:09:49 | <Cale> | ACTION makes a bigger example |
| 05:10:16 | <jeffz``> | aconbere: is your program exiting normally? |
| 05:10:53 | <Cale> | 0m8.349s vs. 0m9.593s |
| 05:11:06 | <Cale> | So it appears to be mostly in the constant term! |
| 05:11:11 | <aconbere> | jeffz`: you know what... I thought it was, but now that I think about it perhaps the way I'm exiting is invalid |
| 05:11:13 | <Cale> | That's surprising. |
| 05:11:54 | <Cale> | bruce`: Anyway, that should give some idea of the difference between STUArray and Data.Map. |
| 05:11:55 | <pumpkin> | Cale: I'd imagine if you exponentially increased the size of your alphabet, you'd notice more of a difference, and a much bigger memory footprint :P |
| 05:12:04 | <Cale> | pumpkin: Well, perhaps, yes. |
| 05:12:16 | <Cale> | pumpkin: but not *that* much. |
| 05:12:23 | <pumpkin> | nope :) |
| 05:12:27 | <jeffz`> | aconbere, I think I've noticed in the past that exiting prematurely or just at the wrong moment leaves an empty .prof |
| 05:12:43 | <Cale> | Well, as the size of the alphabet increases exponentially, you'll get a linear slowdown in the map. |
| 05:12:50 | <pumpkin> | exactly |
| 05:13:01 | <pumpkin> | and you'll get an exponential increase in memory for the array |
| 05:13:04 | <pumpkin> | which is awesome |
| 05:14:24 | <Cale> | Well, to be fair, there will be a similar increase in memory for the Map assuming that the whole alphabet gets used |
| 05:14:52 | <pumpkin> | yeah :) |
| 05:15:14 | <Cale> | But if there's a possibility that the data is sparse, the Map will kill it :) |
| 05:15:45 | <pumpkin> | IntMap should allow things like Chars to be inserted into it |
| 05:15:52 | <pumpkin> | anything trivially mappable to an Int |
| 05:15:52 | <bruce`> | Actually, if the histogram is too big, I'd expect serious cache-coherence problems -- in that case, a Map might well be more efficient. (though for my current application this is not the case) |
| 05:16:16 | <Cale> | bruce`: How many entries in the histogram? |
| 05:16:29 | <pumpkin> | class Intable a where intate :: a -> Int |
| 05:16:35 | <Cale> | by the way, the pure version is: countLetters' = foldl' (\m x -> M.insertWith' (+) x 1 m) M.empty . filter isAlpha . map toLower |
| 05:16:36 | <pumpkin> | ;) |
| 05:16:45 | <Cale> | pumpkin: haha |
| 05:17:20 | <pumpkin> | or fromListWith' (+) . flip zip (repeat 1) |
| 05:17:25 | <pumpkin> | I think that should work |
| 05:17:33 | <bruce`> | However many you want -- but I've been using maybe 100 or so. Also, the distribution should be skewed -- which might concievably make a list more efficient than either 8^\ |
| 05:17:34 | <Cale> | yeah, it should |
| 05:17:36 | <pumpkin> | obviously with the isAlpha and toLower |
| 05:18:07 | <Cale> | bruce`: I suspect Data.Map will be close enough in performance, and has a much nicer interface than any of the other options. |
| 05:18:25 | <smithll> | Hi, I am playing with quickcheck2 and I am trying to get a non empty list of positive integers... |
| 05:18:28 | <smithll> | prop_test_pos :: (Integral a) => [Positive a] -> Bool |
| 05:18:31 | <smithll> | prop_test_pos xs = all (>0) xs |
| 05:18:34 | <smithll> | positve seems to work... |
| 05:18:43 | <smithll> | prop_test_list :: (Num a) => NonEmptyList [a] -> Bool |
| 05:18:43 | <smithll> | prop_test_list xs = not $ null xs |
| 05:18:47 | <smithll> | but this doesn't |
| 05:18:49 | <Cale> | It's sort of my default associative data structure. :) It's only when it doesn't work that I'll consider switching to something else. |
| 05:19:04 | <pumpkin> | whatever you do, don't use HashTable |
| 05:19:58 | <Cale> | Well, along with functions ;) |
| 05:20:39 | <Cale> | Functions tend to be really bad finite map structures if you're doing lots of inserts though :) |
| 05:21:12 | <Cale> | Basically as bad as association lists. |
| 05:21:14 | <pumpkin> | I'd actually really like to see ghc not get painfully slow for functions with a lot of patterns |
| 05:21:17 | <Aleran> | is this the best way to do call a function on every element on a list and then sum the results? |
| 05:21:26 | <bruce`> | Ungh, I don't thing I'm going to get this done tonight. Thanks for the tips, everyone; I'll try and log in tomorrow and let you know how it goes. |
| 05:21:30 | <Aleran> | sum (map numAsWord [1..100]) |
| 05:21:40 | <Cale> | Aleran: yep :) |
| 05:21:40 | <pumpkin> | alright, bbiab |
| 05:22:02 | <inimino> | numAsWord? |
| 05:22:12 | <inimino> | @ty numAsWord |
| 05:22:14 | <lambdabot> | Not in scope: `numAsWord' |
| 05:22:27 | <Aleran> | numAsWord is my own function sorry |
| 05:22:28 | <inimino> | ...? |
| 05:22:30 | <Cale> | inimino: I suspect it's something he wrote himself |
| 05:22:30 | <inimino> | oh |
| 05:22:36 | <smithll> | not $ null [] |
| 05:23:12 | <Cale> | newtype NonEmptyList a = NonEmpty [a] |
| 05:23:16 | <Cale> | this is the problem |
| 05:23:18 | <inimino> | oh, I missed the part where he said "call a function on every element" |
| 05:23:21 | <dmwit> | smithll: I suspect the problem is that NonEmptyList [a] is not the same type as [b] for any b. |
| 05:23:28 | <Cale> | prop_test_list (NonEmpty xs) = not $ null xs |
| 05:23:34 | <Cale> | ^^ smithll |
| 05:23:39 | <dmwit> | smithll: (Without specifically seeing your code, it's hard to say more than that.) |
| 05:23:59 | <smithll> | I wll give that a try |
| 05:23:59 | <Cale> | Prelude Test.QuickCheck> quickCheck (\(NonEmpty xs) -> not (null xs)) |
| 05:23:59 | <Cale> | +++ OK, passed 100 tests. |
| 05:24:33 | <Cale> | The newtypes are rather convenient even with lambdas, because of the explicit tag :) |
| 05:24:35 | <hackagebot> | windowslive 0.2 |
| 05:24:56 | <dmwit> | Oh, NonEmptyList is a type defined by quickcheck. ^_^ |
| 05:25:19 | <Cale> | Right, it just tweaks the random generator :) |
| 05:25:43 | <Cale> | Prelude Test.QuickCheck Data.List> quickCheck (\(Ordered xs) -> sort xs == xs) |
| 05:25:43 | <Cale> | +++ OK, passed 100 tests. |
| 05:26:54 | <Cale> | ACTION wonders |
| 05:27:07 | <Cale> | @check \(Ordered xs) -> sort xs == xs |
| 05:27:08 | <lambdabot> | Not in scope: data constructor `Ordered' |
| 05:27:29 | <mmorrow> | Peaker: coroutines: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5308 |
| 05:27:30 | <Cale> | I suppose I'll have to upgrade the QuickCheck at some point |
| 05:30:14 | <Cale> | Oh, right, the new one is installed, but for whatever stupid reason, it seems that global packages have priority over user ones |
| 05:30:53 | <Cale> | Hmm... |
| 05:34:14 | <aconbere> | jeffz`: thanks that got me going :) |
| 05:35:39 | <smithll> | So putting it all together a non empty list of postive would look something like this... |
| 05:35:46 | <smithll> | prop_test_pos :: (Integral a) => [Positive a] -> Bool |
| 05:35:46 | <smithll> | prop_test_pos xs = all (>0) xs |
| 05:35:46 | <smithll> | prop_test_list :: (Num a) => NonEmptyList [a] -> Bool |
| 05:35:46 | <smithll> | prop_test_list (NonEmpty xs) = not $ null xs |
| 05:35:46 | <smithll> | prop_test_pos_not_null :: (Integral a) => NonEmptyList [Positive a] -> Bool |
| 05:35:48 | <smithll> | prop_test_pos_not_null (NonEmpty xs) = all (>0) xs && (not $ null xs) |
| 05:36:11 | <smithll> | but that gives... |
| 05:36:17 | <smithll> | Could not deduce (Num [Positive a]) from the context (Integral a) |
| 05:36:17 | <smithll> | arising from the literal `0' at Commodity.hs:114:45 |
| 05:36:17 | <smithll> | Possible fix: |
| 05:36:17 | <smithll> | add (Num [Positive a]) to the context of |
| 05:36:17 | <smithll> | the type signature for `prop_test_pos_not_null' |
| 05:36:19 | <smithll> | or add an instance declaration for (Num [Positive a]) |
| 05:36:21 | <smithll> | In the second argument of `(>)', namely `0' |
| 05:36:24 | <smithll> | In the first argument of `all', namely `(> 0)' |
| 05:36:26 | <smithll> | In the first argument of `(&&)', namely `all (> 0) xs' |
| 05:36:42 | <povman> | Is there any point in converting a FunPtr to a StablePtr? |
| 05:38:00 | <sjanssen> | smithll: please don't paste so much in the channel |
| 05:38:06 | <smithll> | sorry |
| 05:38:39 | <mmorrow> | @paste |
| 05:38:40 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 05:39:01 | <copumpkin> | moo |
| 05:39:10 | <copumpkin> | http://world.cs.brown.edu/ would approve |
| 05:39:11 | <mmorrow> | omnomnom |
| 05:39:14 | <dmwit> | smithll: You probably want NonEmptyList (Positive a). |
| 05:39:45 | <Lemmih> | povman: I'd say no. |
| 05:40:07 | <Cale> | yep, that's the problem :) |
| 05:40:19 | <povman> | Lemmih: Leet. I'll have that patch for you soon... |
| 05:40:20 | <smithll> | dmwit: yes, that seems to work. Thanks |
| 05:40:31 | <copumpkin> | dammit, someone outdid us on pidigits again |
| 05:40:51 | <Lemmih> | povman: Refresh my memory, what patch? |
| 05:41:39 | <dmwit> | copumpkin: Well, if we can parallelize it... =) |
| 05:41:40 | <povman> | Lemmih: Apologies - I mean the one that lets Sdl start in haskell rather than C |
| 05:41:50 | <sjanssen> | copumpkin: that's what you get for publicizing it |
| 05:41:55 | <copumpkin> | I know :( |
| 05:43:05 | <Lemmih> | povman: Oh, you're Luke Worth. |
| 05:48:12 | <copumpkin> | seems like the fastest pidigits entry avoided a division |
| 05:56:03 | <Gracenotes> | copumpkin: indeed, it seems we are no longer #1! |
| 05:56:18 | <copumpkin> | there's an optimization to be had in ours at least |
| 05:56:31 | <copumpkin> | their entry is only performing one division per iteration |
| 05:56:35 | <copumpkin> | ours is doing two |
| 05:56:45 | <copumpkin> | but they've shuffled things around a bit so I'm not sure how to do that too |
| 05:59:35 | <Gracenotes> | WE ARE AT WAR |
| 05:59:42 | <Gracenotes> | o_O |
| 06:03:43 | <cnwdup> | Is it possible to load a data Plugin s using System.Plugins or does s has to be known at compile time? |
| 06:06:44 | <hackagebot> | linear-maps 0.5 |
| 06:06:49 | <Lemmih> | cnwdup: It has to be known at compile time. |
| 06:07:15 | <cnwdup> | Lemmih, why? |
| 06:07:16 | <Lemmih> | cnwdup: You could probably hide it and use Data.Typeable, though. |
| 06:08:03 | <Lemmih> | cnwdup: Because 'Plugin s' doesn't exist. Only concrete data exists. |
| 06:08:23 | <cnwdup> | http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2504#a2504 So this won't be possible? |
| 06:08:47 | <cnwdup> | toAnyPlugin maps Plugin s to AnyPlugin. Tell me if you need the code for that. |
| 06:09:03 | <cnwdup> | (Relevant are the first 4 lines of main and loadPlugin. |
| 06:09:05 | <cnwdup> | ) |
| 06:10:43 | <Lemmih> | Should all the plugins have the same type? |
| 06:11:00 | <cnwdup> | Plugin s is a plugin with the state s. In fact every plugin should have a different s. |
| 06:11:15 | <cnwdup> | But I try not to operate on s from the main application so I thought it'd be fine. |
| 06:11:33 | <cnwdup> | s/try not to/do not/ |
| 06:11:35 | <Lemmih> | cnwdup: Why not hide the type parameter? |
| 06:11:42 | <cnwdup> | Lemmih, how? |
| 06:12:00 | <cnwdup> | I thought I was doing this with toAnyPlugin. |
| 06:12:12 | <Lemmih> | cnwdup: data Plugin = forall s. Plugin { getState :: IO s, setState :: s -> IO () } |
| 06:13:00 | <cnwdup> | Let me try that. |
| 06:13:01 | <Lemmih> | cnwdup: You definitely have to change 'loadPlugin'. |
| 06:13:54 | <Lemmih> | cnwdup: 'mapM loadPlugins fns' gives you 'forall s. [Plugins s]'. You're interesting in '[forall s. Plugin s]'. |
| 06:15:16 | <cnwdup> | I cannot hide s because I'd like to query the plugin's state from within another plugin. And I want static type checking for that. |
| 06:15:24 | <cnwdup> | Lemmih, how would that change look like? |
| 06:15:35 | <Lemmih> | cnwdup: Use Data.Typeable for that. |
| 06:15:52 | <cnwdup> | What's the difference between forall s. [Plugin s] and [forall s. Plugin s]? |
| 06:16:11 | <Lemmih> | cnwdup: getState :: IO Dynamic. |
| 06:17:07 | <cnwdup> | Lemmih, then the compiler cannot tell me if I am doing something wrong. |
| 06:17:08 | <Lemmih> | cnwdup: The first one is a list of plugins with the same 's' parameter. The second is a list of plugins with their own 's' parameter. |
| 06:17:40 | <cnwdup> | Lemmih, how can I achieve the second one? |
| 06:17:52 | <Lemmih> | cnwdup: That's right. It's impossible to statically check that. |
| 06:18:15 | <Lemmih> | cnwdup: data Plugin = forall s. Plugins { ... |
| 06:19:22 | <cnwdup> | Okay. Thank you. |
| 06:20:30 | <cnwdup> | But it should be possible to statically check it in the plugin's code. And I'd like to maintain this kind of safety. |
| 06:20:59 | <cnwdup> | Say Plugin Int includes the module of Plugin String and wants to query the Int. It knows the state and knows how to operate on that. |
| 06:21:25 | <cnwdup> | In the main application I do wrap the states using Dynamics. But I do not want that the be at Plugin level because I loose static type safety. |
| 06:21:41 | <cnwdup> | *lose |
| 06:21:43 | <Lemmih> | cnwdup: But what if it is wrong? What if it thinks it's a 'Plugin Int' but it really is a 'Plugin Char'. |
| 06:22:50 | <cnwdup> | Then the plugin cannot and should not be compiled. But since Plugin Char includes Plugin Int it knows if there's something wrong with the plugin code. |
| 06:22:53 | <Lemmih> | cnwdup: You cannot get compile-time guarantees of code you'll load at run-time. |
| 06:23:08 | <cnwdup> | If something goes wrong in the main application where I use Dynamics I cannot do something about that. |
| 06:23:16 | <cnwdup> | But in the plugin code I feel like I can. |
| 06:23:57 | <Lemmih> | Maybe I don't understand what you're trying to do. |
| 06:24:10 | <cnwdup> | Would you mind if I post the plugin's code? |
| 06:24:44 | <Lemmih> | What you're trying to do seems impossible if you subscribe to a linear understanding of time, |
| 06:25:29 | <cnwdup> | I think it is possible but I might explain it inadequate. |
| 06:25:32 | <Lemmih> | It's a free internet. You can paste anything you want. |
| 06:26:42 | <cnwdup> | http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2506#a2506 those are my plugins. In PluginB i know the type of PluginA and I just want to ensure that PluginB operates on the correct state (an Int) and not confuses it with something different. |
| 06:27:14 | <cnwdup> | In the main application I load the plugin and wrap everything in Dynamics. But at plugin level I do not see why I can't guarantee type safety. |
| 06:27:44 | <cnwdup> | http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2505#a2505 here's the plugin code. line 31-34 and 69-77 are relevant only. |
| 06:29:09 | <cnwdup> | I think I could put the toAnyPlugin call in the Plugin code. But I feel it doesn't belong in there. |
| 06:31:30 | <Lemmih> | cnwdup: Ah, you need to convert the plugins to AnyPlugins immediately after you load them. |
| 06:31:42 | <cnwdup> | I try that in main. But it doesn't work. |
| 06:31:55 | <Lemmih> | cnwdup: loadPlugin :: FilePath -> IO AnyPlugin |
| 06:32:29 | <cnwdup> | would it be the same to write mapM (toAnyPlugin inChan <$> loadPlugin) fns? |
| 06:33:24 | <cnwdup> | Eh, plugins <- mapM (\fn -> loadPlugin fn >>= toAnyPlugin inChan) fns |
| 06:34:03 | <copumpkin> | do I need anything but MagicHash to use strict pairs? |
| 06:34:07 | <copumpkin> | unlifted pairs? |
| 06:34:12 | <copumpkin> | the (# #) things |
| 06:34:17 | <Lemmih> | copumpkin: Unboxed tuples. |
| 06:34:23 | <copumpkin> | that's what I meant :P |
| 06:34:38 | <Lemmih> | copumpkin: -XUnboxedTuples |
| 06:34:43 | <copumpkin> | oh I see :) |
| 06:34:45 | <copumpkin> | thanks |
| 06:34:58 | <Lemmih> | cnwdup: It may work. |
| 06:35:37 | <kniu> | I'm trying to write something impressive so that my mom won't think learning Haskell is a waste of time. |
| 06:35:46 | <Lemmih> | cnwdup: I'd create a new type 'data NoType;' and then change loadPlugin to 'FilePath -> IO (Plugin NoType)'. |
| 06:35:51 | <kniu> | Is there an easy-to-use graphics library so that I can whip up some games? |
| 06:35:54 | <cnwdup> | http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2507#a2507 (changed loadPlugin), now I get Ambiguous type variable s in the constraint Typeable s arising from the use of toAnyPlugin (line 82). |
| 06:36:20 | <Lemmih> | cnwdup: Yes, hence NoType. Using '()' would also cut it. |
| 06:37:10 | <rob__> | Hi! I have a question about HaXml, maybe somebody could point me in the right direction |
| 06:37:13 | <cnwdup> | Lemmih, can you explain that? I don't see why this error is being reported and how your solution would help. |
| 06:37:37 | <rob__> | I have used DtdToHaskell to generate my Haskell types from my DTD file |
| 06:38:03 | <rob__> | and now I'd like to read an actual XML file that references this DTD |
| 06:38:20 | <rob__> | I'm using fReadXml for that |
| 06:38:26 | <Lemmih> | cnwdup: Loading a value of type 'a' doesn't make sense. Similarly it is imposible to load a 'Plugin s'. You must give it a concrete type. |
| 06:38:44 | <rob__> | like this: contents <- fReadXml xmlFile |
| 06:39:04 | <cnwdup> | Lemmih, with "loading" do you mean the result of loadPlugin or the result of load_? |
| 06:39:08 | <Lemmih> | cnwdup: () and NoType should work since you're not using the type at all. |
| 06:39:27 | <rob__> | the error I'm getting is: Ambiguous type variable `a' in the constraint: |
| 06:39:27 | <rob__> | `XmlContent a' |
| 06:39:27 | <rob__> | arising from a use of `fReadXml' at processxml.hs:29:26-41 |
| 06:39:27 | <rob__> | Probable fix: add a type signature that fixes these type variable(s) |
| 06:39:41 | <Lemmih> | cnwdup: The result of load_. |
| 06:40:10 | <cnwdup> | Lemmih, so I have to change the type of toAnyPlugin for that, don't I? |
| 06:40:11 | <dmwit> | rob__: In the future, please post long code and errors to hpaste. |
| 06:40:23 | <dmwit> | rob__: Now that you've transgressed, though... have you tried following GHC's advice? |
| 06:40:32 | <dmwit> | (i.e. adding an explicit type signature?) |
| 06:40:39 | <rob__> | I frankly don't understand it unfortunately |
| 06:40:50 | <Berengal> | > read "123" |
| 06:40:52 | <lambdabot> | * Exception: Prelude.read: no parse |
| 06:41:04 | <dmwit> | rob__: fReadXml is polymorphic in its return type. |
| 06:41:12 | <rob__> | ok |
| 06:41:15 | <dmwit> | rob__: That kind of polymorphism is a little bit tricky to do inference on, right? |
| 06:41:25 | <rob__> | sure |
| 06:41:27 | <Lemmih> | cnwdup: Probably. |
| 06:41:28 | <dmwit> | Because how do you know what type it should return? |
| 06:41:37 | <dmwit> | So, you sometimes have to tell it what type it should return. |
| 06:41:43 | <dmwit> | This is one such case. |
| 06:41:53 | <rob__> | ok |
| 06:42:08 | <cnwdup> | Lemmih, if I change it from Plugin s to Plugin () (or something hiding the type) I cannot do the wrapping/un-wrapping using Dynamics. |
| 06:42:15 | <Lemmih> | cnwdup: It's important to realise why it conceptually makes no sense to load a 'Plugin s' value. |
| 06:42:19 | <dmwit> | As Berengal demonstrated above, this is commond for things with "read" in their name. =) |
| 06:42:36 | <dmwit> | > (read "123" :: Int, read "123" :: Rational, read "()" :: ()) |
| 06:42:37 | <lambdabot> | (123,* Exception: Prelude.read: no parse |
| 06:42:44 | <dmwit> | > (read "123" :: Int, read "123 % 3" :: Rational, read "()" :: ()) |
| 06:42:46 | <lambdabot> | (123,41 % 1,()) |
| 06:42:56 | <cnwdup> | Lemmih, yeah. I do not see that. I want ghc to load Plugin s of a given s but any s. Shouldn't that be possible? I do not operate on s. |
| 06:43:12 | <Lemmih> | cnwdup: I'd move the AnyPlugin code into the plugin code and then never load a 'Plugin s'. |
| 06:43:23 | <cnwdup> | Lemmih, that'd be best I guess. |
| 06:43:27 | <Lemmih> | cnwdup: It is if you hide the 's'. |
| 06:43:29 | <rob__> | so something like: fReadXml xmlFile :: IO XML ? |
| 06:43:44 | <dmwit> | Seems reasonable to me. |
| 06:44:39 | <bnijk> | what's the name of that haskell OS? |
| 06:44:45 | <Berengal> | bnijk: House? |
| 06:45:01 | <bnijk> | maybe |
| 06:45:21 | <cnwdup> | Are there libraries to modify Haskell sources using haskell? Like parsing a function and rewriting it? |
| 06:45:43 | <Berengal> | cnwdup: Like template haskell? |
| 06:45:52 | <Lemmih> | cnwdup: Haskell-src-exts is fairly good. |
| 06:45:52 | <rob__> | hm that's not working, I'd have to define a class XML then, right? |
| 06:46:04 | <cnwdup> | Berengal, Lemmih, thanks. I'll take a look at both. |
| 06:46:06 | <Berengal> | rob__: Not a class, a type |
| 06:46:48 | <Berengal> | rob__: But you said you had already generated these, did you not? |
| 06:48:15 | <rob__> | yeah that's the thing |
| 06:48:45 | <rob__> | I was using this tool DtdToHaskell from the HaXml package to automatically convert the DTD to Haskell types |
| 06:49:03 | <dmwit> | rob__: How about you comment out the error-filled part of the code, then use :i to find out what instances of XmlContent are available to you? |
| 06:49:12 | <rob__> | what I want to do now is reading the values from an actual xml document |
| 06:50:50 | <rob__> | oh I did not know about this option, thank you very much |
| 06:59:49 | <rob__> | dmwit, thanks a bunch, this brings me a little further |
| 07:06:38 | <ski> | Do push-ups |
| 07:06:40 | <ski> | Then a sauce |
| 07:06:41 | <ski> | Evade |
| 07:08:15 | <Eridius> | @pl \a b -> uncurry f =<< liftM2 (,) a b |
| 07:08:16 | <lambdabot> | ((uncurry f =<<) .) . liftM2 (,) |
| 07:08:18 | <Eridius> | heh |
| 07:08:36 | <dmwit> | Because \a b -> uncurry f =<< liftM2 (,) a b is TOO READABLE |
| 07:09:04 | <dmwit> | :t \a b -> uncurry f =<< liftM2 (,) a b |
| 07:09:05 | <lambdabot> | forall a b (m :: * -> *) b1. (Show a, Show b, SimpleReflect.FromExpr (m b1), Monad m) => m a -> m b -> m b1 |
| 07:09:11 | <dmwit> | bah |
| 07:09:12 | <Eridius> | ACTION feels like there's some alternative to uncurry f =<< liftM2 (,) a b that doesn't involve wrapping and unwrapping with the tuple, but he's missing it |
| 07:09:14 | <dmwit> | :t \f a b -> uncurry f =<< liftM2 (,) a b |
| 07:09:15 | <lambdabot> | forall a b (m :: * -> *) b1. (Monad m) => (a -> b -> m b1) -> m a -> m b -> m b1 |
| 07:09:32 | <dmwit> | uh |
| 07:10:01 | <Eridius> | and I don't mean join (f <$> a <*> b) |
| 07:10:15 | <dmwit> | ?pl \ma mb -> ma >>= \a -> mb >>= f a |
| 07:10:15 | <lambdabot> | (. ((. f) . (>>=))) . (>>=) |
| 07:10:18 | <dmwit> | yuck |
| 07:10:43 | <dmwit> | :t liftM2 |
| 07:10:44 | <lambdabot> | forall a1 a2 r (m :: * -> *). (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r |
| 07:11:04 | <dmwit> | :t \f a b -> join (liftM2 f a b) |
| 07:11:05 | <ski> | @type \f a b -> join (liftM2 f a b) |
| 07:11:06 | <lambdabot> | forall a1 a2 (m :: * -> *) a. (Monad m) => (a1 -> a2 -> m a) -> m a1 -> m a2 -> m a |
| 07:11:06 | <lambdabot> | forall a1 a2 (m :: * -> *) a. (Monad m) => (a1 -> a2 -> m a) -> m a1 -> m a2 -> m a |
| 07:11:10 | <ski> | (: |
| 07:11:59 | <dmwit> | or just do { a <- ma; b <- mb; f a b } -- this is not really so heinous, you know |
| 07:12:00 | <Eridius> | ACTION is trying to avoid the join |
| 07:12:05 | <ski> | maybe it would be nice to call this `extendM2' or something .. |
| 07:12:08 | <Eridius> | bah! |
| 07:12:34 | <dmwit> | Eridius: Well, you can't avoid the join, that's for sure. |
| 07:12:41 | <dmwit> | Why do you want to? |
| 07:12:54 | <Eridius> | ACTION doesn't want to type join |
| 07:13:07 | <Eridius> | I'm perfectly happy if something does the join for me |
| 07:13:07 | <dmwit> | ... |
| 07:13:18 | <Eridius> | :P |
| 07:13:19 | <dmwit> | Seriously? |
| 07:13:29 | <Eridius> | ACTION is just being silly, he knows |
| 07:13:32 | <dmwit> | ACTION hits Eridius over the head with a Get Things Done stick |
| 07:13:36 | <Eridius> | ouch |
| 07:13:39 | <Eridius> | ACTION isn't trying to get things done |
| 07:13:52 | <dmwit> | ACTION then hits dmwit over the head with a Get Things Done stick |
| 07:13:55 | <dmwit> | yoink! |
| 07:13:58 | <Eridius> | ACTION chuckles |
| 07:14:30 | <ski> | @let mamb `jap` ma = join (mamb `ap` ma) |
| 07:14:32 | <lambdabot> | Defined. |
| 07:14:35 | <ski> | @type \f a b c d -> f `liftM` a `ap` b `ap` c `jap` d |
| 07:14:37 | <lambdabot> | forall a1 a a11 a2 (m :: * -> *) a12. (Monad m) => (a1 -> a -> a11 -> a2 -> m a12) -> m a1 -> m a -> m a11 -> m a2 -> m a12 |
| 07:17:45 | <dmwit> | :t ap |
| 07:17:46 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => m (a -> b) -> m a -> m b |
| 07:18:09 | <dmwit> | :t \f a b -> return f `ap` a `ap` b |
| 07:18:10 | <lambdabot> | forall a a1 b (m :: * -> *). (Monad m) => (a -> a1 -> b) -> m a -> m a1 -> m b |
| 07:18:18 | <dmwit> | oh, right |
| 07:18:44 | <dmwit> | :t \f a b -> return f `ap` a `ap` b >>= id -- ;-) |
| 07:18:46 | <lambdabot> | forall a a1 (m :: * -> *) b. (Monad m) => (a -> a1 -> m b) -> m a -> m a1 -> m b |
| 07:19:02 | <Yoric[DT]> | Hi everyone, I have a question regarding beginners. |
| 07:19:02 | <dmwit> | Eridius: How do you feel about expanding the definition of join? ;-) |
| 07:19:25 | <Yoric[DT]> | (that is, I'm currently working on the design of a new language and I'd be interested in a few elements of feedback wrt teaching Haskell) |
| 07:19:26 | <cnwdup> | @pl (\st -> writeIORef stateRef (toDyn st) *> return True) |
| 07:19:26 | <lambdabot> | (*> return True) . writeIORef stateRef . toDyn |
| 07:19:33 | <dmwit> | :t \f a b -> liftM2 f a b >>= id -- ;-) |
| 07:19:34 | <lambdabot> | forall a1 a2 (m :: * -> *) b. (Monad m) => (a1 -> a2 -> m b) -> m a1 -> m a2 -> m b |
| 07:19:54 | <Yoric[DT]> | Does the syntax of parametric polymorphism in Haskell appear clear to newbies who have no experience in FP? |
| 07:20:35 | <dmwit> | Yoric[DT]: It's familiar enough to be confusing. =) (At least, I found it so at first. But not for very long, so I wouldn't worry about this as a sticking point too much.) |
| 07:20:56 | <Yoric[DT]> | :) |
| 07:21:00 | <dmwit> | It's not such a big step for people from "template <typename T> List<T>" to "List a". |
| 07:21:08 | <ski> | ACTION wonders what the syntax of parametric polymorphism is |
| 07:21:26 | <opqdonut> | ski: i thought he referred to lower-case types being variables etc |
| 07:21:30 | <ski> | the `forall foo. ..foo..' ? |
| 07:21:36 | <dmwit> | ski: Presumably, he's talking about type variables and type-constructor application. |
| 07:21:38 | <Yoric[DT]> | Just the lower-case types being variables. |
| 07:21:40 | <Eridius> | dmwit: expanding the definition? I'm not sure I understand what you mean |
| 07:21:44 | <Yoric[DT]> | forall is yet another issue |
| 07:21:45 | <Eridius> | that said, I need to go to bed anyway |
| 07:21:48 | <Eridius> | dmwit: thanks for trying |
| 07:21:55 | <dmwit> | Eridius: "liftM2 f a b >>= id" has the right type. |
| 07:22:03 | <Eridius> | ah haha |
| 07:22:07 | <dmwit> | Eridius: But it's just the one-step expansion of "join (liftM2 f a b)". =) |
| 07:22:10 | <Eridius> | of course liftM2 just uses join internally |
| 07:22:10 | <dmwit> | ?src join |
| 07:22:11 | <lambdabot> | join x = x >>= id |
| 07:22:21 | <Eridius> | or its equivalent |
| 07:22:23 | <dmwit> | Eridius: Yes, but that's not relevant to the joke here. =) |
| 07:22:24 | <Eridius> | in any case, sleep time |
| 07:22:26 | <ski> | Eridius : as does : f `liftM` a `jap` b |
| 07:22:39 | <Eridius> | jap? |
| 07:22:46 | <Yoric[DT]> | dmwit: thanks for the element of feedback |
| 07:22:49 | <ski> | <ski> @let mamb `jap` ma = join (mamb `ap` ma) |
| 07:22:54 | <Eridius> | ah |
| 07:23:24 | <ski> | (you said you'd be perfectly happy if something did the `join' for you) |
| 07:23:30 | <Yoric[DT]> | dmwit: in a new language, would you want the new user to always quantify type variables (as in forall / template) or would you have quantification be implicit (as in, well, no forall) |
| 07:23:32 | <Eridius> | haha |
| 07:23:38 | <Eridius> | ok, sleeps for real |
| 07:24:29 | <nimred> | wich cabal-install version would i be able to build with GHC 6.8.3 ? |
| 07:24:34 | <RayNbow> | g'morning #haskell! :) |
| 07:24:50 | <dmwit> | Taking away quantification really limits your extensibility. |
| 07:25:14 | <dmwit> | Haskell has run into this more and more as GHC adds rank-2 types, rank-n types, existential quantification, scoped type variables, ... |
| 07:25:23 | <ski> | Yoric[DT] : are you talking about the concrete syntax of type variables ? or regarding type variables and parameterized types ? |
| 07:25:40 | <Yoric[DT]> | dmwit: sure, the question is mostly about having implicit quantification by default. |
| 07:25:54 | <Yoric[DT]> | ski: I'm talking about concrete syntax. However, I |
| 07:26:12 | <Yoric[DT]> | ski: I'm talking about concrete syntax. However, I'm not sure exactly where you draw the line between the two possibilities you offer me :) |
| 07:27:02 | <cnwdup> | I have a program which seg faults. I this my fault or ghc's? (E.g. should I file a bug report?) |
| 07:27:23 | <ski> | RayNbow : Goede morgen |
| 07:27:57 | <ski> | Yoric[DT] : the first is the concrete syntax, the second is the concept |
| 07:28:08 | <Yoric[DT]> | ski: I'm talking concrete syntax. |
| 07:29:03 | <Yoric[DT]> | (although implicit quantification is borderline between both) |
| 07:29:23 | <dmwit> | cnwdup: The most common cause is rebuilding a library, but not the things using that library. |
| 07:29:26 | <ski> | (.. anyway, how to handle quantification is ortogonal to having type variables (and probably parameterized types)) |
| 07:30:15 | <cnwdup> | dmwit, ah. Okay. Then I guess it's my fault. |
| 07:30:21 | <ski> | (i wouldn't say implicit quantification is borderline .. implicit quantification still turns up (or rather, doesn't turn up) in the AST) |
| 07:31:01 | <RayNbow> | ski: god morgon! (had to look this up :p) |
| 07:31:15 | <ski> | ACTION smiles |
| 07:31:29 | <nimred> | any idea ? |
| 07:31:56 | <RayNbow> | nimred: the latest cabal-install on hackage doesn't build? |
| 07:32:34 | <nimred> | RayNbow no it doesn't because of 'ld: cannot find -lgmp' |
| 07:32:57 | <ski> | Yoric[DT] : for concrete syntax of type variables, e.g. the ML's start type variables with an "'", and Mercury starts with upper case letter (or `_', iirc) |
| 07:33:11 | <ski> | (s/ML's/MLs/) |
| 07:33:27 | <Yoric[DT]> | Ok, I wasn't aware of the Mercury convention. |
| 07:33:36 | <Yoric[DT]> | s/convention/concrete syntax/ |
| 07:34:35 | <ski> | (this is borrowed from using upper case (or `_') to start ordinary variables in both Mercury and Edinburgh syntax of Prolog) |
| 07:35:00 | <RayNbow> | nimred: do you have libgmp on your system? |
| 07:35:02 | <Yoric[DT]> | My first impression is that _a is not quite nice, though. |
| 07:35:11 | <Yoric[DT]> | I prefer 'a . |
| 07:35:31 | <nimred> | RayNbow : |
| 07:35:32 | <nimred> | [~/tmp/APPLICATIONS/xmonad/cabal-install-0.6.0]->> pkg_info | grep gmp 09:31 |
| 07:35:35 | <nimred> | gmp-4.2.4nb1 Library for arbitrary precision arithmetic |
| 07:38:36 | <dmwit> | nimred: Is it in your LD_LIBRARY_PATH? |
| 07:39:24 | <RayNbow> | dmwit, http://jan.varwig.org/archive/getting-cabal-to-run-on-mac-os-x-leopard <-- someone in the comments is getting the same link error |
| 07:39:27 | <RayNbow> | erm |
| 07:39:33 | <RayNbow> | * nimred |
| 07:42:35 | <cnwdup> | When dynamically loading a plugin whats the cause of "unknown symbol `base_GHCziBase_id_closure'" being reported? |
| 07:44:20 | <nimred> | dmwit : |
| 07:44:21 | <nimred> | [~/tmp/APPLICATIONS/xmonad/cabal-install-0.6.2]->> echo $LD_LIBRARY_PATH 09:41 |
| 07:44:24 | <nimred> | /usr/X11R7/lib:/usr/local/lib:/usr/pkg/lib |
| 07:44:50 | <nimred> | and : |
| 07:44:53 | <nimred> | [~/tmp/APPLICATIONS/xmonad/cabal-install-0.6.2]->> ls /usr/pkg/lib/libgmp 09:42 |
| 07:44:56 | <nimred> | files: |
| 07:44:58 | <nimred> | libgmp.a libgmp.la* libgmp.so@ libgmp.so.3@ libgmp.so.3.4.4* libgmpxx.a libgmpxx.la* libgmpxx.so@ libgmpxx.so.4@ libgmpxx.so.4.0.4* |
| 07:45:04 | <nimred> | shouldn't it work ? |
| 07:50:26 | <dmwit> | nimred: It does seem like it should. |
| 07:51:03 | <nimred> | dmwit a moment, i paste you error output on a pastbin web site |
| 07:51:37 | <dmwit> | Aw, man. This is why you don't code late at night. |
| 07:51:47 | <dmwit> | I just rm *.hs instead of *.hi... =/ |
| 07:52:35 | <raimo_> | dmwit: that's why you use vcs |
| 07:53:11 | <RayNbow> | or try recovering it using some undelete tool |
| 07:53:55 | <Gracenotes> | dmwit: reverse engineer the object code! |
| 07:54:45 | <nimred> | dmwit --> http://pastebin.ca/1435979 |
| 07:57:17 | <dmwit> | raimo_: Yes indeedy. |
| 07:57:37 | <dmwit> | But man is it weird to go "ghc --make Main" and have it barf. =P |
| 07:58:33 | <dmwit> | nimred: Can you find a way to verify that ld can see lgmp in some other way? |
| 07:58:41 | <dmwit> | (And try to narrow down what the problem could be?) |
| 08:21:00 | <povman> | Whoa! Linker weirdness! |
| 08:25:15 | <Alpounet> | hi |
| 08:25:46 | <Alpounet> | has anyone encountered such an error : "internal error: task 0x968f678: main thread 1 has been GC'd" when launching a program ? |
| 08:25:48 | <povman> | I have made a cabal library which links to SDL which defines main(). I make another package which uses that library but has its own haskell main. For some reason when my program builds it uses the SDL main!!!!! |
| 08:27:22 | <xenoblitz> | http://www.wisdomandwonder.com/link/3022/why-church-chose-lambda |
| 08:29:23 | <povman> | I never considered that there might be a meaning behind lambda, but reading that means I never have to. |
| 08:30:00 | <cnwdup> | I am trying to dynamically load plugins. Now and then I get it working but after make clean && make I get errors I don't know where they are originating from. I guess something is wrong during linking, but I do not know what is. http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2508#a2510 Help would be appreciated. |
| 08:30:47 | <cnwdup> | Maybe I have to specify a certain directory in the call of load_? |
| 08:33:38 | <quicksilver> | cnwdup: pong |
| 08:34:30 | <bnijk_> | povman: what are you doing in haskell/sdl? |
| 08:34:36 | <cnwdup> | quicksilver, hehe. Thanks to Lemmih I was able to solve my problem now. But I cannot get loading of plugins to work. If you could take a look at the link I posted above that'd be great. |
| 08:35:07 | <quicksilver> | cnwdup: the .o file and the .hi file are normally supposed to be in the same dir |
| 08:35:17 | <quicksilver> | looks like something is running in the wrong directory to me |
| 08:35:57 | <cnwdup> | quicksilver, I am running ./bot pluginA from ./. Is this wrong? |
| 08:35:57 | <quicksilver> | don't understand how/why though. |
| 08:36:03 | <quicksilver> | seems sensible to me. |
| 08:36:12 | <quicksilver> | looks like a HiNT problem (was it hint you were using?) |
| 08:36:14 | <mgee> | hi, please look at http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2511#a2511 |
| 08:36:24 | <mgee> | I get this warning: Warning: Defaulting the following constraint(s) to type `Integer' `Integral t' arising from a use of `^' |
| 08:36:29 | <cnwdup> | quicksilver, I do not know what HiNT is. (: |
| 08:36:39 | <quicksilver> | cnwdup: OK. What are you using to load the plugins then? |
| 08:36:40 | <mgee> | But I don't know how to fix it... |
| 08:36:59 | <cnwdup> | quicksilver, I use make and load_ form hs-plugins. |
| 08:37:03 | <Gracenotes> | hm. I'm thinking I should make a special MVar wrapper for my special monad. It's a MonadIO, so there is a lot of repetitive lifting dealing with MVars... o.o |
| 08:37:09 | <mebbel> | (2^p :: Int) |
| 08:37:22 | <cnwdup> | quicksilver, oh, sorry. The name is just plugins. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/plugins |
| 08:37:27 | <Gracenotes> | on the other hand it's not very flexible dealing with other code that uses mvars |
| 08:37:30 | <Gracenotes> | nvm then |
| 08:38:05 | <mgee> | mebbel: thanks, that worked! |
| 08:38:07 | <quicksilver> | cnwdup: it's some detail about the way plugins invokes ghc and where files go. I'm afraid I've never used it. You could try to ping dons |
| 08:38:25 | <cnwdup> | quicksilver, okay. Thank you. |
| 08:38:35 | <cnwdup> | dons, ping |
| 08:38:53 | <cnwdup> | The weird thing is I now and then get it to work. But after re-compiling some modules its not working anymore. |
| 08:39:03 | <cnwdup> | Unfortunately I cannot reproduce it. |
| 08:40:03 | <LeCamarade> | ?tick ^GOOG |
| 08:40:03 | <lambdabot> | ^GOOG: 0.00 @ N/A N/A |
| 08:40:12 | <LeCamarade> | ?tick ^goog |
| 08:40:12 | <lambdabot> | ^GOOG: 0.00 @ N/A N/A |
| 08:40:13 | <quicksilver> | cnwdup: probably if you compile all the .hs files by hand with ghc |
| 08:40:22 | <LeCamarade> | Who sinned? |
| 08:40:25 | <quicksilver> | cnwdup: then the files wil go in the right place and it will work |
| 08:40:27 | <quicksilver> | (i would guess) |
| 08:40:30 | <LeCamarade> | Who put stock quotes into lambdabot? |
| 08:40:36 | <LeCamarade> | ?tick ^msft |
| 08:40:36 | <lambdabot> | ^MSFT: 0.00 @ N/A N/A |
| 08:40:43 | <LeCamarade> | ?tick ^dji |
| 08:40:43 | <lambdabot> | ^DJI: 8473.49 +196.17 (+2.37%) @ 5/26/2009 4:01pm |
| 08:40:47 | <quicksilver> | whereas if you let plugins compile them it's doing something wrong |
| 08:41:40 | <cnwdup> | quicksilver, how should I compile them? All .hi and .o files should go in the same directory their .hs files are in? |
| 08:42:29 | <nimred> | dmwit : i just add to export good LIBRARY_PATH to get it working :) sorry for noising :/ |
| 08:43:19 | <quicksilver> | cnwdup: that's what ghc normally does, yes. |
| 08:43:30 | <quicksilver> | so PluginA.{hs,o,hi} would all be in Plugin/ |
| 08:43:45 | <cnwdup> | quicksilver, ok. I'll try that. |
| 08:44:12 | <Gracenotes> | @botsnack |
| 08:44:12 | <lunabot> | :) |
| 08:44:12 | <lambdabot> | :) |
| 08:53:18 | <Alpounet> | (&&&) is defined in Control.Arrow right ? |
| 08:53:30 | <opqdonut> | yeh |
| 08:53:41 | <Alpounet> | hmm |
| 08:54:04 | <Alpounet> | I import Control.Arrow, use &&& but I get "Not in scope: `&&&'" |
| 08:54:32 | <Alpounet> | weird, huh ? |
| 08:54:34 | <cnwdup> | Are you importing it qualified? |
| 08:54:39 | <WorkyBob> | Alpounet: show us the import line |
| 08:55:10 | <Alpounet> | import Control.Arrow |
| 08:55:17 | <Alpounet> | rather simple :-p |
| 08:55:20 | <WorkyBob> | pastebin the file |
| 08:55:23 | <Alpounet> | yep |
| 08:58:52 | <Alpounet> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5310#a5310 |
| 09:06:29 | <WorkyBob> | worksforme |
| 09:06:48 | <WorkyBob> | a few not in scopes because of not having some of your libraries - but notably, not &&& |
| 09:07:28 | <Cale> | I'm installing the libraries just to be sure |
| 09:07:53 | <Cale> | I get: |
| 09:08:00 | <Cale> | atom.hs:10:65: |
| 09:08:00 | <Cale> | Couldn't match expected type `([Char], [Char])' |
| 09:08:00 | <Cale> | against inferred type `Attr -> String' |
| 09:08:42 | <Peaker> | mmorrow: I was asleep, seems awesome, will check out in more detail in a bit :) |
| 09:08:44 | <WorkyBob> | Alpounet: what version of ghc? |
| 09:09:10 | <Alpounet> | 6.8.2 |
| 09:09:20 | <Alpounet> | Control.Arrow isn't compatible ? |
| 09:09:25 | <Alpounet> | it would explain the problem, rather fully. |
| 09:09:29 | <WorkyBob> | it should be, but bump up all the same |
| 09:09:56 | <doserj> | Control.Arrow.&&& works fine in ghc-6.8.2 |
| 09:10:12 | <doserj> | Alpounet: can you do ghci -v <File.hs>? |
| 09:10:45 | <Peaker> | mmorrow: why do you need the explicit k arg in testGen? Why not have Coro also be in a reader monad and have yield/done ask for k? |
| 09:11:09 | <Alpounet> | doserj, of course. |
| 09:18:38 | <doserj> | Alpounet: well, what does it say? |
| 09:19:32 | <Alpounet> | doserj, it looks like arrows isn't installed here, because of compatibility issues w.r.t base |
| 09:20:37 | <doserj> | Alpounet: Control.Arrow is in base |
| 09:20:48 | <hatds> | > [10..1] |
| 09:20:50 | <lambdabot> | [] |
| 09:21:09 | <opqdonut> | > [10,9..1] |
| 09:21:10 | <lambdabot> | [10,9,8,7,6,5,4,3,2,1] |
| 09:21:34 | <hatds> | makes sense, but I find it a bit disconcerting when using literals :) |
| 09:22:58 | <RayNbow> | > let desc from to = enumFromThenTo from (pred from) to in desc 10 1 |
| 09:22:59 | <lambdabot> | [10,9,8,7,6,5,4,3,2,1] |
| 09:23:04 | <nimred> | any idea when running 'cabal install xmonad' --> http://pastebin.ca/1436005 ? |
| 09:24:52 | <doserj> | nimred: error: gmp.h: No such file or directory --> did you install the libgmp dev package? |
| 09:25:33 | <nimred> | doserj yes i did and gmp.h is in /usr/pkg/include/ |
| 09:26:21 | <doserj> | well, apparently ghc doesn't find it |
| 09:26:31 | <nimred> | wich can i make compiler find it ? is there any environment variable i have tot set to > |
| 09:26:47 | <nimred> | wich way can i make compiler find it ? is there any environment variable i have tot set to ? |
| 09:27:09 | <RayNbow> | http://www.network-theory.co.uk/docs/gccintro/gccintro_23.html |
| 09:27:24 | <sjanssen> | nimred: how did you install GHC? |
| 09:27:49 | <nimred> | sjanssen from my package system = pkgsrc |
| 09:27:53 | <nimred> | on NetBSD |
| 09:28:21 | <sjanssen> | nimred: I would guess from this situation that NetBSD's GHC package is broken in some subtle way |
| 09:28:39 | <nimred> | http://pkgsrc.se/lang/ghc |
| 09:28:56 | <nimred> | sjanssen Sure ? |
| 09:29:38 | <sjanssen> | nimred: you could try adding /usr/pkg/include/ to CPPFLAGS |
| 09:30:38 | <mgee> | sjanssen: perhabs: CPPFLAGS="-I /usr/pkg/include/ $CPPFLAGS" cabal install xmonad |
| 09:30:56 | <mgee> | as single command in your bash |
| 09:31:33 | <nimred> | mgee didn't find neither |
| 09:32:19 | <mgee> | :-/ |
| 09:38:37 | <nimred> | ok 'export C_INCLUDE_PATH=/usr/pkg/include' worked |
| 09:38:46 | <nimred> | RayNbow thx |
| 09:39:37 | <mmorrow> | Peaker: i was thinking about a Reader monad, but what made me decide against it was that you might want multiple generators, and a Reader would force you into just one |
| 09:39:55 | <mmorrow> | Peaker: (and also, you can have generators of generators, etc) |
| 09:39:57 | <nimred> | RayNbow wich way can i tell C_INCLUDE_PATH to be more than one path ? |
| 09:42:46 | <RayNbow> | nimred: I'm not sure, but probably separating them with : |
| 09:42:47 | <mmorrow> | Peaker: (but if there's only one generator of interest (at any one time) for a particular app, then you could always throw a Reader around it) |
| 09:42:54 | <RayNbow> | so for example... |
| 09:43:01 | <sohum> | ACTION stabs type errors |
| 09:43:05 | <nimred> | RayNbow the same as for $PATH ? |
| 09:43:10 | <RayNbow> | ACTION nodes |
| 09:43:11 | <RayNbow> | *nods |
| 09:44:53 | <sohum> | what should the type of this be? prop_ndivk n k = (n/k) == n `shiftR` (truncate (logBase 2 k)) |
| 09:45:09 | <mebbel> | none |
| 09:45:18 | <mebbel> | that doesn't look valid to me |
| 09:45:22 | <mmorrow> | Peaker: i like how that turned out, i'm definitely going to see if i can't find some real use for this stuff |
| 09:45:52 | <sohum> | hmm, possibly it's not. the compiler infers a type dandily |
| 09:46:11 | <nimred> | RayNbow can you give me an example ? |
| 09:46:26 | <sohum> | > let prop_ndivk n k = (n/k) == n `shiftR` (truncate (logBase 2 k)) |
| 09:46:28 | <lambdabot> | not an expression: `let prop_ndivk n k = (n/k) == n `shiftR` (truncate (log... |
| 09:46:36 | <sohum> | > import Data.Bits |
| 09:46:38 | <lambdabot> | <no location info>: parse error on input `import' |
| 09:46:59 | <mebbel> | :t let prop_ndivk n k = (n/k) == n `shiftR` (truncate (logBase 2 k)) in prop_ndivk |
| 09:47:01 | <lambdabot> | forall a. (Floating a, Bits a, RealFrac a) => a -> a -> Bool |
| 09:47:16 | <mebbel> | yeah, you'd have to find a type that's both RealFrac and Bits |
| 09:47:22 | <mebbel> | kind of unlikely |
| 09:47:49 | <sohum> | ok, so what's my problem here? |
| 09:47:59 | <sohum> | what'm I doing wrong? |
| 09:48:14 | <te> | Hmmm I need some help |
| 09:48:23 | <te> | this particular thing im trying to run relies on hsc3 and hosc |
| 09:48:29 | <te> | http://doc.gold.ac.uk/~ma503am/software/vocable/ |
| 09:48:37 | <nimred> | RayNbow ok found it http://www.network-theory.co.uk/docs/gccintro/gccintro_24.html |
| 09:48:45 | <te> | in Util.lhs it says "import Safe", but Safe is not ofund |
| 09:48:46 | <te> | found |
| 09:48:48 | <te> | any ideas? |
| 09:48:54 | <dmwit> | ?remember jessenoller [On Python:] The closest we get to "type safety" is function annotations, which make me feel funny in sensitive places. |
| 09:48:54 | <lambdabot> | Good to know. |
| 09:48:56 | <mebbel> | sohum: n/k means n and k can't be integers |
| 09:49:27 | <sohum> | mebbel: it does? |
| 09:49:32 | <sohum> | :t (/) |
| 09:49:34 | <lambdabot> | forall a. (Fractional a) => a -> a -> a |
| 09:49:42 | <sohum> | aren't Ints Fractional? |
| 09:49:45 | <dmwit> | sohum: You bet it does. |
| 09:49:45 | <dmwit> | no |
| 09:49:59 | <mebbel> | Ints are Integral, not Fractional |
| 09:50:00 | <EvilTerran> | sohum, Ints are Integral |
| 09:50:10 | <sohum> | so what magic's ghci doing when I type 8/4 in it? |
| 09:50:11 | <mmorrow> | > 2 % 3 |
| 09:50:13 | <mebbel> | (that's latin for "whole" and "broken") |
| 09:50:13 | <lambdabot> | 2 % 3 |
| 09:50:21 | <EvilTerran> | ?type 8/4 |
| 09:50:22 | <te> | oops needed the Safe library |
| 09:50:22 | <lambdabot> | forall t. (Fractional t) => t |
| 09:50:23 | <doserj> | > let prop_ndivk n k = (n `div` k) == n `shiftR` (truncate (logBase 2 (fromIntegral k))) in prop_ndivk 10 3 |
| 09:50:23 | <EvilTerran> | ?type 8 |
| 09:50:24 | <opqdonut> | sohum: interpreting them as floats |
| 09:50:25 | <lambdabot> | False |
| 09:50:25 | <lambdabot> | forall t. (Num t) => t |
| 09:50:27 | <te> | here's the error i get now: Couldn't match expected type `UGen' against inferred type `[a]' |
| 09:50:31 | <opqdonut> | gah, or rather Fractionals |
| 09:50:34 | <opqdonut> | :t 4 |
| 09:50:35 | <lambdabot> | forall t. (Num t) => t |
| 09:50:40 | <opqdonut> | see, number literals are overloaded |
| 09:50:40 | <mmorrow> | @type 5 / 8 :: Double |
| 09:50:43 | <lambdabot> | Double |
| 09:50:46 | <mmorrow> | @type 5 / 8 :: Float |
| 09:50:48 | <lambdabot> | Float |
| 09:50:49 | <sohum> | hmmmm. |
| 09:50:49 | <dmwit> | :t fromInteger |
| 09:50:51 | <lambdabot> | forall a. (Num a) => Integer -> a |
| 09:50:51 | <EvilTerran> | sohum, 8, 4 :: Num t => t |
| 09:51:01 | <mmorrow> | @type 5 / 8 :: Rational |
| 09:51:03 | <lambdabot> | Rational |
| 09:51:07 | <mmorrow> | > 5 / 8 :: Rational |
| 09:51:09 | <lambdabot> | 5 % 8 |
| 09:51:11 | <EvilTerran> | sohum, so 8 and 4 can be Int, or Float, or any of a variety of other things |
| 09:51:15 | <dmwit> | sohum: Any number literal without a . or an e in it actually stands for an application of fromInteger. |
| 09:51:24 | <sohum> | Isee |
| 09:51:37 | <mmorrow> | > toRational pi |
| 09:51:40 | <lambdabot> | 884279719003555 % 281474976710656 |
| 09:51:44 | <mmorrow> | i knew it! |
| 09:51:44 | <dmwit> | And even some literals that do have an e in them. =) |
| 09:51:50 | <dmwit> | > 0x3e / 0x4e |
| 09:51:51 | <lambdabot> | 0.7948717948717948 |
| 09:51:52 | <Baughn> | @tell conal One gotcha is that isHNF registers fully-evaluated Integers as Thunks. I'm looking into it, but it's safe as such and every other type I've tried works fine - in particular, all the ones reactive uses. |
| 09:51:52 | <lambdabot> | Consider it noted. |
| 09:52:03 | <EvilTerran> | > (8 :: Int, 8 :: Float, 8 :: Complex Int, 8 :: Rational) |
| 09:52:04 | <lambdabot> | No instance for (GHC.Float.RealFloat GHC.Types.Int) |
| 09:52:04 | <lambdabot> | arising from the lit... |
| 09:52:10 | <EvilTerran> | > (8 :: Int, 8 :: Float, 8 :: Complex Float, 8 :: Rational) -- bah |
| 09:52:11 | <lambdabot> | (8,8.0,8.0 :+ 0.0,8 % 1) |
| 09:52:31 | <ivanm> | heh |
| 09:53:13 | <dmwit> | sohum: Similarly, all number literals that have a . or an exponent part stand for applications of fromRational. |
| 09:53:16 | <dmwit> | :t fromRational |
| 09:53:17 | <lambdabot> | forall a. (Fractional a) => Rational -> a |
| 09:53:27 | <mmorrow> | Baughn: i just saw a paste by Cale using Strategies with closure stuff, and realized that if vacuumLazy can work at all, it'll be by using varies Strategies combinators (if this doesn't work, then i think we're screwed) |
| 09:53:36 | <mmorrow> | *various |
| 09:53:59 | <dmwit> | > (0.123456789123456789123456789123456789 :: Float {- this one truncates -}, 0.123456789123456789123456789123456789123456789 :: Rational {- this one doesn't -}) |
| 09:54:00 | <lambdabot> | (0.12345679,123456789123456789123456789123456789123456789 % 100000000000000... |
| 09:54:19 | <sohum> | hmmmm. |
| 09:54:30 | <sohum> | so what's the difference between Int and Integer? |
| 09:54:36 | <dmwit> | > maxBound :: Int |
| 09:54:38 | <lambdabot> | 9223372036854775807 |
| 09:54:38 | <EvilTerran> | > let x :: Fractional a => a; x = 2/3 in (x :: Float, x :: Double, x :: Rational, x :: Complex Float, x :: CReal) |
| 09:54:39 | <lambdabot> | (0.6666667,0.6666666666666666,2 % 3,0.6666667 :+ 0.0,0.66666666666666666666... |
| 09:54:40 | <dmwit> | > maxBound :: Integer |
| 09:54:41 | <lambdabot> | No instance for (GHC.Enum.Bounded GHC.Integer.Internals.Integer) |
| 09:54:42 | <lambdabot> | arising... |
| 09:54:43 | <mebbel> | Int is bounded |
| 09:54:49 | <sohum> | right |
| 09:54:53 | <dmwit> | > 9223372036854775807 + 1 :: Integer |
| 09:54:54 | <lambdabot> | 9223372036854775808 |
| 09:54:56 | <dmwit> | > 9223372036854775807 + 1 :: Int |
| 09:54:58 | <lambdabot> | -9223372036854775808 |
| 09:55:14 | <dmwit> | That reminds me. |
| 09:55:16 | <EvilTerran> | > 10^100 :: Integer |
| 09:55:17 | <lambdabot> | 100000000000000000000000000000000000000000000000000000000000000000000000000... |
| 09:55:21 | <sohum> | hahahaha |
| 09:55:24 | <mmorrow> | > let x = 0.123456789123456789123456789123456789 :: Double in (0.123456789123456789123456789123456789 :: Rational) == toRational x |
| 09:55:26 | <sohum> | that's pretty awesome |
| 09:55:26 | <lambdabot> | False |
| 09:55:35 | <mmorrow> | > let x = 0.123456789123456789123456789123456789 :: Double in (0.123456789123456789123456789123456789 :: Rational) - toRational x |
| 09:55:37 | <lambdabot> | 2792815433231892750881857 % 524288000000000000000000000000000000000000 |
| 09:55:39 | <dmwit> | > let x = -9223372036854775808 in negate x == x |
| 09:55:40 | <lambdabot> | False |
| 09:55:44 | <mebbel> | > abs minBound |
| 09:55:45 | <lambdabot> | Add a type signature |
| 09:55:48 | <mmorrow> | > let x = 0.123456789123456789123456789123456789 :: Double in fromRational ((0.123456789123456789123456789123456789 :: Rational) - toRational x) :: Double |
| 09:55:49 | <mebbel> | > abs minBound :: Int |
| 09:55:51 | <lambdabot> | -9223372036854775808 |
| 09:55:51 | <lambdabot> | 5.3268726982725e-18 |
| 09:56:02 | <EvilTerran> | mebbel, uh-oh <.< >.> |
| 09:56:22 | <dmwit> | > let x = -9223372036854775808 in negate x == (x :: Int) |
| 09:56:23 | <lambdabot> | True |
| 09:56:28 | <dmwit> | There we go. =P |
| 09:56:28 | <Baughn> | mmorrow: ..GHC is getting too smart with its strictness analyzer |
| 09:56:30 | <mmorrow> | > let x = 0.1234567891234567891234567891234598798476875987987498787985709884309834565435436789 :: Double in fromRational ((0.1234567891234567891234567891234598798476875987987498787985709884309834565435436789 :: Rational) - toRational x) :: Double |
| 09:56:32 | <lambdabot> | 5.326872698272503e-18 |
| 09:56:45 | <EvilTerran> | > let x = -9223372036854775808 in abs x == (x :: Int) -- dmwit, this is even more jarring, imo |
| 09:56:46 | <lambdabot> | True |
| 09:57:13 | <mmorrow> | no way! i never knew that it'll read floating-formatted nums as rationals |
| 09:57:17 | <EvilTerran> | well, "abs x < 0" is the bit that throws me |
| 09:57:27 | <Gracenotes> | EvilTerran: most signed int implementations have abs like that |
| 09:57:29 | <mmorrow> | Baughn: heh |
| 09:57:32 | <Gracenotes> | in all the languages I know of |
| 09:57:42 | <dmwit> | Gracenotes: Oh, yeah, no argument there. |
| 09:57:45 | <EvilTerran> | Gracenotes, it's still semantically dubious |
| 09:58:06 | <sohum> | :t let f x y = (fromInteger x)/(fromInteger y) in f |
| 09:58:08 | <lambdabot> | forall a. (Fractional a) => Integer -> Integer -> a |
| 09:58:12 | <te> | Could someone please take a look at http://pastie.org/491153 and tell me how to fix the debug message i included in there? |
| 09:58:12 | <dmwit> | Anyway, if we're going to complain about numbers, we really ought to complain about Float and Double. |
| 09:58:24 | <dmwit> | I mean, addition isn't even associative! |
| 09:58:34 | <quicksilver> | mmorrow: there is nothing "floating formatted" about "1.23456" |
| 09:58:38 | <Axman6> | sohum: fromIntegral would be a bit more polymorphic |
| 09:58:44 | <quicksilver> | mmorrow: "1.23456" is decimal notation for a rational number :) |
| 09:58:48 | <Gracenotes> | dmwit: is it commutative for Floats and Doubles? |
| 09:58:52 | <quicksilver> | mmorrow: it would be surprising if that didn't work for Rational. |
| 09:58:59 | <Gracenotes> | I've heard corner cases exist |
| 09:58:59 | <dmwit> | Gracenotes: No, that's my point. |
| 09:59:03 | <opqdonut> | dmwit: well, the faults of Floats and Doubles aren't the language designer's fault |
| 09:59:03 | <Gracenotes> | I'm not sure how sharp they are though |
| 09:59:08 | <mmorrow> | > let x = 0.123456789123456789123456789123459879847687598798749878798570988430983456543543678988888888888888833333333333333333333333333333333333339999999999999999999999999222222222222222222222222222 :: Rational; y = numerator x; z = denominator x in (length (show y), length (show z)) |
| 09:59:08 | <dmwit> | Gracenotes: Oh, commutative. |
| 09:59:10 | <lambdabot> | (185,186) |
| 09:59:12 | <mmorrow> | heh |
| 09:59:16 | <te> | Anyone? |
| 09:59:16 | <opqdonut> | they're best viewed as a numerics "library" |
| 09:59:22 | <mmorrow> | quicksilver: i mean "with a decimal pt" |
| 09:59:27 | <dmwit> | I don't know. I thought they were, but I would be totally unsurprised to find out they weren't. |
| 09:59:31 | <mmorrow> | (however you say that :) |
| 09:59:41 | <mmorrow> | ah, yeah decimal |
| 09:59:57 | <mmorrow> | quicksilver: i'm pleasantly surprised |
| 09:59:59 | <dmwit> | te: Give us a chance, it's a long paste. |
| 10:00:34 | <opqdonut> | te: where's MRG defined? |
| 10:00:46 | <te> | is it not in that file? |
| 10:01:03 | <quicksilver> | mmorrow: well, yes, I know what you meant. I was just challenging your choice of words :) |
| 10:01:19 | <opqdonut> | te: it's in Sound.SC3 it seems |
| 10:01:26 | <opqdonut> | te: you probably meant a lowercase mrg |
| 10:01:30 | <opqdonut> | Sound.SC3.UGen.UGen. mrg :: [ UGen ] -> UGen |
| 10:01:32 | <opqdonut> | that takes a list |
| 10:01:32 | <mmorrow> | i hesitated to use "decimal" since it seems like that's used to mean either "3847563" (base 10) or "123432.432123" (with a pt) in different places and i don't know what it even means anymore |
| 10:01:38 | <Gracenotes> | dmwit: apparently it is commutative, at least according to some website. |
| 10:01:41 | <te> | opqdonut: let me try that, one second |
| 10:01:46 | <mmorrow> | quicksilver: keeping me on my toes |
| 10:01:46 | <quicksilver> | mmorrow: and try ing to point a finger at the fact that there's nothing very floating about "1.23" |
| 10:02:15 | <Axman6> | > 355 / 112 |
| 10:02:16 | <Gracenotes> | but of course not associative due to precision |
| 10:02:16 | <lambdabot> | 3.169642857142857 |
| 10:02:19 | <Axman6> | > 355 / 113 |
| 10:02:21 | <lambdabot> | 3.1415929203539825 |
| 10:02:33 | <Gracenotes> | hrm |
| 10:02:33 | <mmorrow> | what does "floating pt" even refer to (very in particular) anyways? |
| 10:02:57 | <Gracenotes> | I guess IEEE |
| 10:03:08 | <quicksilver> | mmorrow: it's a representation with separate mantissa and exponent |
| 10:03:11 | <opqdonut> | yeah |
| 10:03:12 | <mmorrow> | but i mean, how is the "pt" "floating" |
| 10:03:24 | <quicksilver> | mmorrow: storing the exponent separately means that the point is not always in the same place in the mantissa |
| 10:03:28 | <opqdonut> | the point floats as in the precision isn't fixed |
| 10:03:31 | <mmorrow> | hmm |
| 10:03:33 | <quicksilver> | but it 'floats' around as dictated by the exponent. |
| 10:03:41 | <opqdonut> | or what quicksilver said |
| 10:03:47 | <Axman6> | :t approxRational |
| 10:03:49 | <lambdabot> | forall a. (RealFrac a) => a -> a -> Rational |
| 10:03:52 | <dmwit> | opqdonut: No, it's okay for precision to be fixed. |
| 10:03:57 | <mmorrow> | but what confuses me is that the mantissa and the exponent are of fixed sizes |
| 10:04:00 | <Gracenotes> | http://portal.acm.org/citation.cfm?id=156301.156303 .. damn you, ACM! |
| 10:04:03 | <Axman6> | > approxRational pi 0.00000001 |
| 10:04:04 | <lambdabot> | 100798 % 32085 |
| 10:04:04 | <mebbel> | mmorrow: 1.234 = 0.1234 * 10^1; 12.34 = 0.1234 * 10^2 |
| 10:04:07 | <Axman6> | > approxRational pi 0.00000000001 |
| 10:04:08 | <lambdabot> | 833719 % 265381 |
| 10:04:12 | <Axman6> | > approxRational pi 0.0000000000000001 |
| 10:04:13 | <lambdabot> | 884279719003555 % 281474976710656 |
| 10:04:18 | <mebbel> | mebbel: by incrementing or decrementing the exponent you can move the point around |
| 10:04:18 | <Axman6> | > approxRational pi 0.00000000000000000000001 |
| 10:04:19 | <lambdabot> | 884279719003555 % 281474976710656 |
| 10:04:20 | <mebbel> | er |
| 10:04:26 | <Axman6> | :( |
| 10:04:37 | <mmorrow> | mebbel: that's a good way to say it |
| 10:04:47 | <Axman6> | > 355/113 - pi |
| 10:04:48 | <lambdabot> | 2.667641894049666e-7 |
| 10:04:50 | <mmorrow> | put that way it seems very logical |
| 10:05:21 | <Gracenotes> | and yielding the property that precision seems greater at lower values |
| 10:06:14 | <Gracenotes> | ... seemingly ... |
| 10:06:51 | <opqdonut> | or rather, relative precision staying constant |
| 10:07:04 | <opqdonut> | or almost constant |
| 10:09:58 | <mxc> | is there any advantage to using the functiosn in GHC.Conc over Control.Concurrent? |
| 10:10:27 | <ivanm> | less portability? |
| 10:10:35 | <mebbel> | no, Control.Concurrent is the standard interface |
| 10:10:36 | <Baughn> | It'll ensure your program only works with GHC |
| 10:10:44 | <quicksilver> | yes. the "advantage" that you are using internal APIs which can change without warning, aren't documented, could break at any moment, and aren't portable :) |
| 10:11:13 | <sohum> | is there an equivalent to the unsigned int? |
| 10:11:28 | <Baughn> | sohum: Data.Word |
| 10:11:38 | <wjt> | There's no unsigned Integer :( |
| 10:11:53 | <Baughn> | (Unless you make one) |
| 10:12:01 | <wjt> | insert the word "standard" |
| 10:12:05 | <sohum> | cools, thankee |
| 10:12:12 | <PeakerWork> | mmorrow: hey, you there? |
| 10:12:19 | <mmorrow> | PeakerWork: yes |
| 10:12:50 | <Baughn> | ACTION blesses whoever wrote the GHC Commentary |
| 10:12:55 | <quicksilver> | wjt: I'm not sure "standard" is very interesting. There's no "standard" XML library and no "standard" parser. |
| 10:12:56 | <Baughn> | ghc++ |
| 10:12:59 | <PeakerWork> | mmorrow: well, I would like to try to see that Haskell can emulate almost 1-for-1 the Python generators |
| 10:13:16 | <PeakerWork> | mmorrow: Even giving up a bit of power to do so |
| 10:13:18 | <Baughn> | quicksilver: The one in the Haskell Platform doesn't count? |
| 10:13:19 | <mmorrow> | PeakerWork: i've never used python.. |
| 10:13:21 | <quicksilver> | wjt: Data.Word is a portable and widely distributed lib - isn't that the important thing? |
| 10:13:36 | <PeakerWork> | mmorrow: its a demonstration of power, like augustss implementation of C/BASIC :) |
| 10:13:40 | <mmorrow> | Peaker: (would throwing that in a Reader monad be emulating enough?) |
| 10:13:40 | <wjt> | quicksilver: data.word ships with ghc (doesn't it), so is standard in my eyes :) |
| 10:13:58 | <quicksilver> | wjt: so why did you say there is no standard unsigned integer then? |
| 10:14:00 | <Baughn> | wjt: I believe he was referring to the lack of Natural |
| 10:14:03 | <wjt> | quicksilver: capital I |
| 10:14:04 | <Baughn> | s/wjt/quicksilver/ |
| 10:14:09 | <sohum> | huh, I have to write my own Arbitrary Word instance |
| 10:14:24 | <quicksilver> | oh, I see. |
| 10:14:26 | <quicksilver> | *nod* |
| 10:14:58 | <PeakerWork> | mmorrow: its an assymetrical relationship in Python, between a generator and its caller -- the caller creates the generator like you do, but then he uses "next" on it, and the generator uses "yield" to send a value out and get back in |
| 10:15:02 | <Baughn> | wjt: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/nat <-- See this |
| 10:15:17 | <wjt> | Baughn: yeah, i know there are libraries doing it |
| 10:16:00 | <mmorrow> | PeakerWork: (i initially started out trying to emulate next/yield like you had it, but then i started to see that each side might as well be the same..) |
| 10:16:19 | <mmorrow> | PeakerWork: but if you wanted to simulate next/yield, you could just do: |
| 10:16:23 | <mmorrow> | next = yield |
| 10:16:25 | <mmorrow> | ;) |
| 10:16:26 | <opqdonut> | yeah, coprocesses rather than generators |
| 10:16:44 | <mmorrow> | each side is a generator for the other |
| 10:16:54 | <PeakerWork> | mmorrow: well, in Python, the caller may have multiple generators, but the generator only yields to one place -- so what you call yield is Python's next (taking both a coroutine and a value), and a reader+yield (that is hard-coded for the received coroutine) is Python's yield |
| 10:16:55 | <mmorrow> | entangled particles! |
| 10:17:03 | <mmorrow> | (electrons?) |
| 10:18:06 | <PeakerWork> | mmorrow: so if you rename "yield" to "next" or "feed", and then make a version of Coro that is already tangled with a ReaderT and have yield = feed . ask or so |
| 10:18:56 | <mmorrow> | PeakerWork: totally. i think it'll be pretty easy to dress that up to emulate python (from my limited understanding of what we're trying to emulate) |
| 10:20:46 | <mmorrow> | interesting, this looks like it'll give a good view of exactly what python generators are and aren't http://www.python.org/dev/peps/pep-0342/ |
| 10:26:19 | <PeakerWork> | mmorrow: throwing exceptions into generators is probably possible if you have a Coro that's in EitherT and a throwTo that's like feed but feeds a Left value |
| 10:26:51 | <mmorrow> | PeakerWork: you can just implem exceptions with callCC |
| 10:27:44 | <sohum> | > logBase 2 18446744073709551614 |
| 10:27:46 | <lambdabot> | 64.0 |
| 10:27:48 | <sohum> | > logBase 2 18446744073709551615 |
| 10:27:49 | <lambdabot> | 64.0 |
| 10:27:53 | <sohum> | fun! |
| 10:27:57 | <xci> | lol |
| 10:28:09 | <mmorrow> | (you can even choose whether or not to keep the changes to the state (`s') or rollback to the last checkpoint |
| 10:28:12 | <mmorrow> | ) |
| 10:28:17 | <sohum> | any way to get a more accurate response there? |
| 10:28:17 | <Baughn> | sohum: Well, what did you expect? |
| 10:28:28 | <Baughn> | sohum: ..repeated `div` 2s |
| 10:28:40 | <sohum> | heh. heh. wait, you're not kidding? |
| 10:28:46 | <Baughn> | Mm |
| 10:28:49 | <Gracenotes> | sohum: of course. they're exactly equal :) |
| 10:28:51 | <Baughn> | Actually, that's /less/ accurate |
| 10:29:03 | <Gracenotes> | > 18446744073709551614 == (18446744073709551615 :: Double) |
| 10:29:04 | <lambdabot> | True |
| 10:29:04 | <mmorrow> | (and choose that at the time you actually throw the exception) |
| 10:29:07 | <Baughn> | sohum: Using `div` 2 would give you 65 when the logarithm is actually just barely above 64 |
| 10:29:09 | <Gracenotes> | at least in Double precision |
| 10:29:15 | <Baughn> | sohum: ..but it sounds like you don't actually want the logarithm |
| 10:29:30 | <sohum> | I want to check if it's an exact log |
| 10:29:43 | <Baughn> | There is no such thing as an exact log |
| 10:30:01 | <sohum> | that is, if there exists an integer x such that 2^x = y |
| 10:30:13 | <Gracenotes> | oh, and exact log of 2 |
| 10:30:16 | <Gracenotes> | *an |
| 10:30:17 | <Baughn> | ..well, okay, but that almost never happens |
| 10:30:23 | <sohum> | I know |
| 10:30:47 | <mmorrow> | PeakerWork: (and also, if you're only dealing with a single Gen at once, then the Ref isn't even needed, since you could just use the `s' for current-cont) |
| 10:30:47 | <sohum> | > 18446744073709551614 == (18446744073709551615 :: Data.Word) |
| 10:30:48 | <lambdabot> | Not in scope: type constructor or class `Data.Word' |
| 10:30:51 | <Gracenotes> | sohum: well, there are only a few of them. Maybe have tables? |
| 10:31:34 | <mmorrow> | PeakerWork: (but if you had, say 100 Gens, some of which are forked copies of others at some point in the past, using the state to hold that would be less than ideal) |
| 10:31:38 | <Gracenotes> | and for higher values, just keep on dividing by two while even until you reach something in the table (or miss it) |
| 10:32:00 | <mmorrow> | (and if you're passing Gens to Gens, etc that might get ugly) |
| 10:32:09 | <mebbel> | > (\n -> '1' `notElem` tail (showIntAtBase 2 intToDigit n "")) 18446744073709551614 |
| 10:32:10 | <lambdabot> | False |
| 10:32:23 | <sohum> | > let power2s = 2 : [2*x | x <- power2s] |
| 10:32:25 | <lambdabot> | not an expression: `let power2s = 2 : [2*x | x <- power2s]' |
| 10:32:26 | <mebbel> | > (\n -> '1' `notElem` tail (showIntAtBase 2 intToDigit n "")) 2 |
| 10:32:28 | <lambdabot> | True |
| 10:32:29 | <sohum> | ah well |
| 10:32:33 | <sohum> | it'll work |
| 10:32:50 | <sohum> | ACTION [0,3) infinite lists |
| 10:33:10 | <Gracenotes> | mebbel: cute :) |
| 10:37:15 | <mmorrow> | @unpl ReaderT r (StateT s (Cont o)) a |
| 10:37:16 | <lambdabot> | ReaderT r (StateT s (Cont o)) a |
| 10:37:19 | <mmorrow> | @unmtl ReaderT r (StateT s (Cont o)) a |
| 10:37:20 | <lambdabot> | r -> s -> (a -> s -> o) -> o |
| 10:38:02 | <mmorrow> | @unmtl ReaderT r (StateT s (WriterT w (Cont o))) a |
| 10:38:03 | <lambdabot> | r -> s -> (a -> s -> w -> o) -> o |
| 10:38:20 | <mmorrow> | @unmtl ReaderT r (WriterT w (StateT s (Cont o))) a |
| 10:38:20 | <lambdabot> | r -> s -> (a -> w -> s -> o) -> o |
| 10:39:10 | <thoughtpolice> | mmorrow: what does vacuum 0.0.94 add? (hopefully the ability to easily render graphs to a .svg file or something... :)) |
| 10:41:31 | <sohum> | you know one thing I'd love haskell to do? to load as much of the file as it can on a type error |
| 10:41:43 | <osfameron> | yeah |
| 10:41:48 | <osfameron> | for use in ghci you mean? |
| 10:41:52 | <sohum> | so I can immediately check the types of certain possibly offending things |
| 10:41:53 | <sohum> | yeah |
| 10:42:11 | <osfameron> | I've wanted that lots |
| 10:42:21 | <thoughtpolice> | an incremental typechecker would be useful, but it'd be painful; similar to the problem of e.g. some IDE features for haskell |
| 10:42:35 | <thoughtpolice> | the main issue is that partial programs are completely worthless to the typechecker |
| 10:43:12 | <thoughtpolice> | and i'm not sure (nor am I aware of anyone who is) how you would fix that in the context of Haskell's current type system, especially with the extensions we now have |
| 10:43:41 | <thoughtpolice> | the easiest way is to just to write down type signatures you think work to model your program, and just put 'undefined' as the definition |
| 10:43:51 | <sohum> | why can't it ignore the construct that is causing the error and treat the rest of the file as an input file? |
| 10:45:20 | <quicksilver> | it could. |
| 10:45:27 | <quicksilver> | thoughtpolice is answering a slightly different question, I think. |
| 10:45:47 | <mebbel> | a = length "what"; b = a + c; c = sqrt 3 |
| 10:46:02 | <quicksilver> | simply ignoring all the mutually recursive lumps which don't typecheck is trivial |
| 10:46:07 | <quicksilver> | and it's annoying GHC can't do it :) |
| 10:46:41 | <mmorrow> | thoughtpolice: heh, no. i haven't merged in the stuff from vacuum-gl yet. (that reminds me though. /me makes a note to do so) |
| 10:48:00 | <thoughtpolice> | mmorrow: i might send you a patch for it right fast - something that just calls out to dot |
| 10:48:16 | <PeakerWork> | mmorrow: "forking copies" of coroutines is not usually possible outside of Haskell :) |
| 10:49:02 | <mmorrow> | you could just compute the SCCs of the functions in a module, then run the typechecker over each separately, then finally merge the ones that passed typechecking, et voila the largest subset of the module that typechecks.. |
| 10:49:15 | <Gracenotes> | mebbel: noes! you set my internal type-checker off! |
| 10:49:19 | <mmorrow> | PeakerWork: :) |
| 10:50:00 | <mmorrow> | thoughtpolice: oh, cool. i have a few functions like that as well... that'd be handy to have in-package for sure |
| 10:50:04 | <PeakerWork> | mmorrow: need to resist the temptation to turn this into something more powerful -- but more dissimilar too :) |
| 10:50:28 | <PeakerWork> | mmorrow: I don't understand how you meant you could implement throwTo via callCC -- you're abstracting callCC here, aren't you? |
| 10:51:07 | <quicksilver> | mmorrow: I would have thought it would simpler to proceed greedily from the first function and backtrack on typeerror. |
| 10:51:15 | <quicksilver> | mmorrow: avoids calculating the SCCs explicitly. |
| 10:51:21 | <quicksilver> | but maybe GHC calculates them anyway. |
| 10:51:24 | <thoughtpolice> | mmorrow: grr, can't build anything really depending on template-haskell with GHC HEAD |
| 10:51:37 | <mmorrow> | Peaker: have a runCCWithTheAbilityToThrowAnException m = runCC (callCC (\k -> .. trickery .. >> m >> .. maybe more trickery)) .. |
| 10:51:44 | <thoughtpolice> | (there were API-breaking changes in order to accomodate type families) |
| 10:51:52 | <thoughtpolice> | speaking of |
| 10:52:02 | <thoughtpolice> | ACTION should probably go back to his registered x86_64 build |
| 10:52:27 | <mmorrow> | thoughtpolice: ah yeah, that also reminds me. i've been meaning to start updating all my TH code to handle the switchover |
| 10:53:08 | <thoughtpolice> | yeah, i've got a patch sitting around to fix derive partially with HEAD |
| 10:53:13 | <thoughtpolice> | since it's needed for lhc hacking |
| 10:58:06 | <mmorrow> | thoughtpolice: (looking at the HEAD TH haddocks) not too bad actually. looks like the only things that need changing to get existing code to work are: (1) Name->TyVarBndr in the places where the names were binding tyvars, (2) (Cxt=[Type])->(Cxt=[Pred])==>(Type->Pred) |
| 10:58:32 | <mmorrow> | (+ adding cases for the new cons to *every single function that pattern matches on constructors :(((( |
| 10:59:29 | <mmorrow> | quicksilver: hmm, /me thinks what that means for a second |
| 11:00:58 | <stepnem> | please, what does the '~' mean, e.g. in the definition of unzip? |
| 11:01:02 | <mmorrow> | quicksilver: if you kept track of functions that failed, then bailed upon seeing a previously failed function mentioned in the current function, i think that'd be not too bad |
| 11:01:02 | <stepnem> | @src unzip |
| 11:01:03 | <lambdabot> | unzip = foldr (\(a,b) ~(as,bs) -> (a:as,b:bs)) ([],[]) |
| 11:01:35 | <mmorrow> | quicksilver: (although from what i understand you need to compute SCCs in order to get the most general type for functions in a mutually rec group) |
| 11:01:56 | <quicksilver> | mmorrow: OK, if the calculat is happening anyway you might as well use it. |
| 11:02:40 | <stepnem> | any pointers much appreciated, may I humbly ask -- just an URL or a single word... |
| 11:02:55 | <mebbel> | stepnem: lazy binding |
| 11:03:02 | <stepnem> | mebbel: thank you |
| 11:05:15 | <mmorrow> | quicksilver: hmmm, actually you also have functions dependent on other functions, but not mutually recursive with them, so i guess you'd just have to topsort the SCCs, then start checking each one until the first failure, at which point you're done |
| 11:05:56 | <mmorrow> | err, well no i guess the graph of SCCs is a dag, not a list |
| 11:06:29 | <sohum> | is there a simpler way to write (truncate ((fromIntegral n)/(fromIntegral k))) ? as is, it hurtses my eyeses ;} |
| 11:06:55 | <mebbel> | what's wrong with div? |
| 11:07:02 | <mmorrow> | sohum: whenever i have to use fromIntegral a lot, i write "fi :: ..type of fromIntegral..; fi = fromIntegral" |
| 11:07:19 | <mmorrow> | truncate (fi n / fi k) |
| 11:07:26 | <sohum> | ... mebbel: nothing, except that I didn't know it existed |
| 11:07:38 | <mmorrow> | oh heh, or div.. |
| 11:07:47 | <sohum> | thankee! |
| 11:08:17 | <doserj> | @check \n k -> k == 0 || truncate ((fromIntegral n)/(fromIntegral k)) == n `div` k |
| 11:08:18 | <lambdabot> | "Falsifiable, after 6 tests:\n5\n-2\n" |
| 11:08:22 | <doserj> | @check \n k -> k == 0 || truncate ((fromIntegral n)/(fromIntegral k)) == n `quot` k |
| 11:08:23 | <lambdabot> | "OK, passed 500 tests." |
| 11:09:53 | <sohum> | @check \n k -> k > 0 && n > 0 ==> truncate ((fromIntegral n)/(fromIntegral k)) == n `div` k |
| 11:09:54 | <lambdabot> | Not in scope: `==>'Precedence parsing error |
| 11:09:54 | <lambdabot> | cannot mix `GHC.Classes.>'... |
| 11:10:07 | <sohum> | ...huh. |
| 11:10:17 | <sohum> | @check \n k -> k > 0 || n > 0 || truncate ((fromIntegral n)/(fromIntegral k)) == n `div` k |
| 11:10:18 | <lambdabot> | "* Exception: divide by zero |
| 11:10:26 | <sohum> | .. or, right |
| 11:10:33 | <sohum> | @check \n k -> k <= 0 || n <= 0 || truncate ((fromIntegral n)/(fromIntegral k)) == n `div` k |
| 11:10:35 | <lambdabot> | "OK, passed 500 tests." |
| 11:10:41 | <sohum> | cools |
| 11:11:38 | <Gracenotes> | might not be so for higher values |
| 11:13:42 | <doserj> | > truncate (fromIntegral 10^26) |
| 11:13:43 | <lambdabot> | 100000000000000004764729344 |
| 11:20:53 | <Fred320> | @pl (\x akk -> fun x : akk) |
| 11:20:53 | <lambdabot> | (:) . fun |
| 11:23:57 | <McManiaC> | @src putStrLn |
| 11:23:58 | <lambdabot> | putStrLn s = do putStr s; putChar '\n' |
| 11:24:04 | <McManiaC> | @src putStr |
| 11:24:04 | <lambdabot> | putStr s = hPutStr stdout s |
| 11:24:12 | <McManiaC> | @src hPutStr |
| 11:24:13 | <lambdabot> | Source not found. That's something I cannot allow to happen. |
| 11:24:21 | <Fred320> | @src map |
| 11:24:21 | <lambdabot> | map _ [] = [] |
| 11:24:21 | <lambdabot> | map f (x:xs) = f x : map f xs |
| 11:30:01 | <Fred320> | @src filter |
| 11:30:01 | <lambdabot> | filter _ [] = [] |
| 11:30:01 | <lambdabot> | filter p (x:xs) |
| 11:30:02 | <lambdabot> | | p x = x : filter p xs |
| 11:30:02 | <lambdabot> | | otherwise = filter p xs |
| 11:31:37 | <Fred320> | @pl \fun -> foldr ((:) . fun) [] |
| 11:31:37 | <lambdabot> | flip foldr [] . ((:) .) |
| 11:42:41 | <povman> | I think I've found a bug in cabal: I have a Library which compiles a .c file with a main(). When I include that library in an Executable which has its own main, the .c main() is called when I run the program |
| 11:45:40 | <Fred320> | @pl \x akk -> map (x:) akk ++ akk |
| 11:45:41 | <lambdabot> | join . ((++) .) . map . (:) |
| 11:47:04 | <Fred320> | :t join |
| 11:47:05 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => m (m a) -> m a |
| 11:48:39 | <madhadron> | Does anyone have any idea how to make a newtype wrapping a constructor around CInt storable again? |
| 11:48:52 | <jabbarz0> | no Idea |
| 11:49:09 | <jabbarz0> | Helooo anyone knows how to programme in Prolog |
| 11:49:26 | <madhadron> | A very little |
| 11:49:28 | <whoppix> | jabbarz0, what has that to do with haskell? |
| 11:49:33 | <whoppix> | jabbarz0, try /j #prolog |
| 11:50:40 | <jabbarz0> | well Haskell is similar to Prolog |
| 11:50:58 | <madhadron> | jabbarz0, Not really |
| 11:51:10 | <whoppix> | um.. no. |
| 11:51:10 | <madhadron> | They don't even share an underlying logic |
| 11:51:26 | <whoppix> | however, erlang is somewhat similar to prolog :) |
| 11:52:13 | <jabbarz0> | where is he |
| 11:52:44 | <burp> | prolog.. haskell? o0 |
| 11:53:08 | <jabbarz0> | helloooo |
| 11:53:12 | <jabbarz0> | Prolog Programmer |
| 11:53:27 | <whoppix> | jabbarz0, /j #prolog |
| 11:53:31 | <jabbarz0> | I need to implement Euler's Sieve in Prolog |
| 11:53:38 | <whoppix> | jabbarz0, wrong channel |
| 11:53:41 | <jabbarz0> | no one there to help |
| 11:53:48 | <jabbarz0> | I know this is Haskell |
| 11:53:49 | <Zao> | Too bad. |
| 11:54:00 | <burp> | and they have nothing in common -.- |
| 11:54:14 | <whoppix> | jabbarz0, there are people in #prolog that probably can help you. |
| 11:54:36 | <madhadron> | burp, Well, that's a little strong. They both do both have underlying logics, as opposed to weird mutilations of Turing machines |
| 11:54:41 | <Zao> | "Hello, I'm having this terrible problem with my Fiat." "Now why do you come to my Ferrari dealership to ask?" |
| 11:55:00 | <Zao> | jabbarz0: It may be that you didn't ask the right way. |
| 11:55:02 | <burp> | madhadron, ok |
| 11:55:18 | <Zao> | Those prolog people sure like well-formed propositions :P |
| 11:55:54 | <whoppix> | Zao, he isn't even in that channel, so I assume he didn't even try asking there. |
| 11:56:23 | <madhadron> | Y'know, there's something quite satisfying about shoving a C library's interface inside a nice, functional wrapper. |
| 12:13:44 | <Fred320> | @pl \x rest -> concat (map (place x) rest) |
| 12:13:45 | <lambdabot> | (join .) . map . place |
| 12:14:35 | <Fred320> | @pl concat . map |
| 12:14:36 | <lambdabot> | join . map |
| 12:14:42 | <Fred320> | :t concat |
| 12:14:43 | <lambdabot> | forall a. [[a]] -> [a] |
| 12:14:43 | <Fred320> | :t join |
| 12:14:44 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => m (m a) -> m a |
| 12:15:49 | <McManiaC> | @src (!!) |
| 12:15:49 | <lambdabot> | xs !! n | n < 0 = undefined |
| 12:15:49 | <lambdabot> | [] !! _ = undefined |
| 12:15:49 | <lambdabot> | (x:_) !! 0 = x |
| 12:15:49 | <lambdabot> | (_:xs) !! n = xs !! (n-1) |
| 12:17:20 | <ivanm> | > [] !! 0 |
| 12:17:22 | <lambdabot> | * Exception: Prelude.(!!): index too large |
| 12:17:29 | <ivanm> | the @src is wrong! :o |
| 12:17:33 | <ivanm> | > [] !! -1 |
| 12:17:36 | <lambdabot> | Precedence parsing error |
| 12:17:36 | <lambdabot> | cannot mix `GHC.List.!!' [infixl 9] and prefi... |
| 12:17:44 | <ivanm> | > [] !! (-1) |
| 12:17:46 | <lambdabot> | * Exception: Prelude.(!!): negative index |
| 12:22:30 | <LeCamarade> | How do I get as to generate static binaries? |
| 12:25:08 | <mmorrow> | madhadron: that is nice |
| 12:25:56 | <ivanm> | LeCamarade: ummmm.... ghc produces binaries that are static on their haskell dependencies |
| 12:26:32 | <ivanm> | the only dynamic links (at least on *nix) are for GMP, and probably zlib if you use the haskell zlib library (and other such haskell bindings0 |
| 12:27:13 | <McManiaC> | @pl \i -> w (f i) >> s i |
| 12:27:14 | <lambdabot> | ap ((>>) . w . f) s |
| 12:27:46 | <McManiaC> | @src ap |
| 12:27:46 | <lambdabot> | ap = liftM2 id |
| 12:27:58 | <LeCamarade> | ivanm, No, I'm not using GHC. :o( I'm writing some assembly, and I realised I don't know how to get them static, yet it is what I need. |
| 12:28:10 | <ivanm> | oh... |
| 12:28:32 | <ivanm> | no idea for assembler... probably depends on which compiler you're using (or whatever it is that assembler uses) |
| 12:28:36 | <madhadron> | I just had a horrible thought...are Ptr's allocated with Foreign.Marshal.Alloc.malloc garbage collected? |
| 12:28:42 | <cnwdup> | Is there a way to minimise the memory using during linking? I want to link a binary on a 256 MB RAM system and when linking ld uses over 250 MB. |
| 12:29:00 | <madhadron> | LeCamarade, The Linux documentation project has a nice guide on such things on Linux |
| 12:29:21 | <madhadron> | called the Program Library HOWTO, I think |
| 12:32:00 | <whoppix> | cnwdup, can't you just temporarily set up a swap file/partition? |
| 12:32:54 | <Fred320> | @src append |
| 12:32:54 | <lambdabot> | Source not found. And you call yourself a Rocket Scientist! |
| 12:32:58 | <Fred320> | @src (++) |
| 12:32:59 | <lambdabot> | [] ++ ys = ys |
| 12:32:59 | <lambdabot> | (x:xs) ++ ys = x : (xs ++ ys) |
| 12:32:59 | <lambdabot> | -- OR |
| 12:32:59 | <lambdabot> | xs ++ ys = foldr (:) ys xs |
| 12:32:59 | <cnwdup> | whoppix, I have one but it's taking damn long. I hoped there were ways to reduce the time necessary for that. |
| 12:33:43 | <madhadron> | cnwdup, Well, the classical way is to put pieces of the project in shared libraries... |
| 12:33:49 | <madhadron> | but that's probably not what you want to here. |
| 12:33:50 | <madhadron> | hear |
| 12:37:04 | <cnwdup> | madhadron, my project isn't big. I just seem to use expensive modules (System.Plugins?). I thought ghc couldn't link dynamically. |
| 12:59:02 | <mornfall> | Stupid question (but, weird things are going on)... |
| 12:59:05 | <mornfall> | How is: |
| 12:59:24 | <mornfall> | "foo <- a `catch` b" interpreted? |
| 13:00:03 | <mornfall> | For some weird reason, it seems that it works like (foo <- a) `catch` b, which I don't like the slightest... : - ) |
| 13:00:19 | <quicksilver> | no, it doesn't. |
| 13:00:28 | <quicksilver> | it works like foo <- (a `catch` b) |
| 13:00:31 | <Deewiant> | (foo <- a) `catch` b isn't even legal Haskell |
| 13:00:43 | <mornfall> | Okey, then something else must be going on. |
| 13:00:52 | <quicksilver> | (foo <- a) isn't an expression |
| 13:01:14 | <mornfall> | Deewiant: I have thought so much, but adding parentheses apparently altered behaviour of the program. |
| 13:01:34 | <mornfall> | Okey, let's experiment some more. |
| 13:02:17 | <mornfall> | (My problem is that the exception from 'a' gets thrown when "foo" is used and does not get caught...) |
| 13:03:35 | <int-e> | sounds like unsafeInterleaveIO (perhaps hidden in a readFile or hGetContents) |
| 13:03:36 | <quicksilver> | that's probably because exceptions in pure code are more evil than satan himself |
| 13:03:39 | <mauke> | are you sure 'a' throws an exception? |
| 13:03:40 | <quicksilver> | and you shouldn't use them. |
| 13:04:00 | <mauke> | int-e: but readFile swallows exceptions, I thought |
| 13:04:03 | <mornfall> | How is 'a' pure? |
| 13:04:17 | <quicksilver> | I don't know what monad you're working in, or anything :)_ |
| 13:04:19 | <int-e> | mauke: could be |
| 13:04:30 | <quicksilver> | but the exception you're expecting to catch might be itself hidden in a pure value |
| 13:04:33 | <quicksilver> | I'm only guessing here. |
| 13:04:35 | <mornfall> | Yes, there's unsafeInterleaveIO involved. I played around with !patterns and $! and got it to a working order. But I don't know *why*, so I'm backtracking to figure which is the crucial bit. |
| 13:04:42 | <mauke> | oh, ouch |
| 13:05:18 | <mornfall> | (This is darcs code, and I'll eventually rip those -ing interleaves out, but that'll have to wait a little, since it's not quite... trivial.) |
| 13:05:26 | <McManiaC> | @hoogle [(a -> b)] -> b |
| 13:05:27 | <lambdabot> | Prelude ($) :: (a -> b) -> a -> b |
| 13:05:27 | <lambdabot> | Prelude ($!) :: (a -> b) -> a -> b |
| 13:05:27 | <lambdabot> | Data.Function ($) :: (a -> b) -> a -> b |
| 13:05:34 | <mornfall> | Ok, so you are right that () have no effect. |
| 13:07:12 | <mornfall> | quicksilver: Aye. It's in IO, and the catch comes from Control.Exception. |
| 13:07:27 | <mornfall> | Interestingly, !foo <- a `catch` b in itself doesn't have any effect on the outcome. |
| 13:07:45 | <int-e> | mornfall: sure, because that forces the result of the `catch`. |
| 13:07:51 | <mornfall> | Ah. |
| 13:09:42 | <mornfall> | Ok, so adding $! to 'a' fixes the situation. |
| 13:11:02 | <mornfall> | int-e: (Although. How come that the result of the catch doesn't need to force the result of its left side?) |
| 13:14:51 | <int-e> | mornfall: because the result is just passed through. in a `catch` b, a context is set up for catching the exception, then a is forced, then a is executed. then the context is cleared up and the result of a is returned. If an exception happens, b is executed instead (after cleaning up the context) |
| 13:14:59 | <int-e> | mornfall: but the result of executing a is never touched. |
| 13:15:23 | <Baughn> | mmorrow: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/HeapObjects <-- Did you read this? |
| 13:16:13 | <mornfall> | int-e: I semi-get it. Thanks (I'll have to study that a little bit more ... later.) |
| 13:16:15 | <int-e> | mornfall: in particular, return x `catch` foo === return x, because return can not cause any exceptions. |
| 13:16:28 | <int-e> | @index evaluate |
| 13:16:29 | <lambdabot> | Control.Exception, Test.QuickCheck, Debug.QuickCheck |
| 13:16:42 | <int-e> | :t Control.Exception.evaluate |
| 13:16:45 | <lambdabot> | forall a. a -> IO a |
| 13:20:11 | <Axman6> | ivanm: you around? |
| 13:21:03 | <quicksilver> | mornfall: (in reference to int-e's last comment, but there can be an exception hidden inside the value 'x' which will only be encountered when that part of the value gets forced) |
| 13:21:50 | <Baughn> | mmorrow: Apparently indirections are only created when a thunk is evaluated, so if I get an indirection I don't need to chase it - I already know the value is evaluated. Anyway, that link is incredibly helpful. |
| 13:24:36 | <alar> | greetings |
| 13:24:52 | <alar> | is there a way to negate GHC-flag in cabal? |
| 13:25:24 | <mornfall> | quicksilver: Yes, I have sort of figured it out by now -- unsafeInterleaveIO creates a "pure" value which then gets evaluated, forces the IO and trips the exception. Icky. (And thank to you, too.) |
| 13:26:04 | <quicksilver> | yes. |
| 13:26:37 | <quicksilver> | icky is a kind way of putting it ;) |
| 13:27:07 | <jabbarz5> | Hellloooooooooooo |
| 13:27:11 | <jabbarz5> | Anyone |
| 13:27:15 | <jabbarz5> | PROLOG PROGRAMMER |
| 13:27:17 | <Axman6> | ... |
| 13:27:17 | <jabbarz5> | ]Prolog |
| 13:27:19 | <lunabot> | luna: Not in scope: data constructor `Prolog' |
| 13:27:20 | <jabbarz5> | anyone |
| 13:27:26 | <Axman6> | o.O |
| 13:27:28 | <quicksilver> | jabbarz5: No. This channel is about haskell. |
| 13:27:41 | <ivanm> | Axman6: yup |
| 13:27:42 | <quicksilver> | jabbarz5: which is another programming language, almost but not entirely unrelated to prolog. |
| 13:27:42 | <jabbarz5> | Prolog is similar to Haskell |
| 13:27:47 | <quicksilver> | not very. |
| 13:27:57 | <Axman6> | ivanm: you have anything to do with uzbl? |
| 13:28:02 | <ulfdoz> | lol |
| 13:28:13 | <ivanm> | wtf? |
| 13:28:24 | <jabbarz5> | 555 Haskell Users in this Room |
| 13:28:27 | <Axman6> | jabbarz5: haskell's a functional programming language, prolog is a logic programming language... slightly different thing |
| 13:28:30 | <jabbarz5> | one of them should know prolog |
| 13:28:39 | <Axman6> | jabbarz5: anything wrog with $prolog? |
| 13:28:45 | <ivanm> | Axman6: what's uzbl? |
| 13:28:51 | <jabbarz5> | do u know prolog |
| 13:28:53 | <jabbarz5> | Axman |
| 13:28:57 | <quicksilver> | jabbarz5: I imagine some of us do, but we wont' talk about it in this channel. |
| 13:28:58 | <Axman6> | a webkit based web browser |
| 13:29:02 | <alar> | I see that one can add extra flags in .cabal file |
| 13:29:03 | <quicksilver> | jabbarz5: this channel is for discussion of haskell. |
| 13:29:19 | <alar> | but how can I negate flags that cabal adds by itself? |
| 13:29:28 | <whoppix> | jabbarz5, yes, there *are* several people here that know prolog (I know some prolog as well), but none of them will answer your prolog questions here, because this channel is about haskell :) |
| 13:29:40 | <jabbarz5> | nest(N, L) that only succeeds if L is equal to [0, [1, [2, ... [N] ... ]]]. |
| 13:29:41 | <Axman6> | ivanm: http://www.uzbl.org/wiki/_media/uzbl_webinspector.png?cache= i saw ivanm on that screenshot of it |
| 13:29:46 | <jabbarz5> | I want to define this RULE |
| 13:29:47 | <dcoutts> | alar: you cannot, what is the problem? |
| 13:29:50 | <ivanm> | Axman6: ahhh, yeah, I asked rob| about that |
| 13:29:50 | <jabbarz5> | pleaaaaaaaseeeeeeeeeeeee |
| 13:30:00 | <ivanm> | I must have been pinging him about something on #xmonad |
| 13:30:09 | <Axman6> | ahhhh, i see |
| 13:30:09 | <alar> | dcoutts: it does not build DLL under windows |
| 13:30:32 | <alar> | dcoutts: it adds ghcSharedLinkArgs = |
| 13:30:32 | <alar> | [ "-no-auto-link-packages", |
| 13:30:32 | <alar> | "-shared", |
| 13:30:32 | <alar> | "-dynamic", |
| 13:30:44 | <Axman6> | wow, that guy was a total idiot |
| 13:30:46 | <alar> | only -shared is necessary |
| 13:30:54 | <Axman6> | wonder how he even heard of prolog |
| 13:30:55 | <ivanm> | ACTION missed all that |
| 13:31:05 | <alar> | and -no-auto-link-packages breaks everything |
| 13:31:08 | <quicksilver> | Axman6: he had to complete some coursework for a class in an hour or so. |
| 13:31:28 | <alar> | my GHC doesn't know such flag :) |
| 13:31:29 | <dcoutts> | alar: really? why? cabal will specify -package base etc |
| 13:31:32 | <ivanm> | quicksilver: lol |
| 13:31:42 | <Axman6> | yeah, sounded like that to me too |
| 13:31:45 | <alar> | dcoutts: -package and others are okay |
| 13:32:08 | <dcoutts> | alar: oh, I see, it's just the wrong flag name :-) |
| 13:32:09 | <jabbarz5> | Hellloooo |
| 13:32:14 | <Axman6> | urgh |
| 13:32:22 | <jabbarz5> | I will ask a Haskell question |
| 13:32:24 | <alar> | but -dynamic is unnecessary and -no-auto-link-packages doesn't work |
| 13:32:36 | <Axman6> | jabbarz5: either you're quite stupid, or a really bad troll. either way, you should quit it |
| 13:33:07 | <jabbarz5> | I want to define a Haskell List |
| 13:33:11 | <jabbarz5> | substitute(X, L, Y, M) that only succeeds if M is constructed from the elements of L |
| 13:33:15 | <alar> | dcoutts: and it'll be rather hard to fix with userHooks :)) userHooks interface is very far from GHC.build :) |
| 13:33:17 | <Axman6> | @pl \n l = l <= n && n > 0 |
| 13:33:17 | <lambdabot> | (line 1, column 6): |
| 13:33:17 | <lambdabot> | unexpected "=" |
| 13:33:17 | <lambdabot> | expecting pattern or "->" |
| 13:33:19 | <dcoutts> | alar: ok. I don't think that's the only problem at the moment though. |
| 13:33:27 | <Axman6> | @pl \n l -> l <= n && n > 0 |
| 13:33:27 | <lambdabot> | ap (flip . ((&&) .) . flip (<=)) (> 0) |
| 13:34:13 | <ivanm> | quicksilver: looks like he doesn't get the hint... |
| 13:34:22 | <quicksilver> | apparently not. |
| 13:34:33 | <dcoutts> | alar: see --enable-shared is about building a Haskell package as a dll, linking against other packages as dlls, and that doesn't work on windows yet. What you're trying to do is build a dll exporting a C api and to statically link in all the haskell packages. |
| 13:34:49 | <quicksilver> | Axman6: liftM2 (&&) (l <=) (> 0) |
| 13:34:50 | <alar> | yes |
| 13:35:00 | <quicksilver> | Axman6: I don't think it looks all that nice. |
| 13:35:05 | <Axman6> | yeah |
| 13:35:06 | <alar> | actually I'm building DLL callable from other languages |
| 13:35:11 | <dcoutts> | alar: right |
| 13:35:16 | <Axman6> | i was just curious how it'd come out mainly |
| 13:35:22 | <quicksilver> | perhaps (l <=) <^(&&)^> (> 0) |
| 13:35:25 | <alar> | not every-module-is-separate-DLL program |
| 13:35:27 | <quicksilver> | with InfixApplicative. |
| 13:36:35 | <dcoutts> | alar: right, and those two things are quite different intentions. Cabal only has partial support at the moment for the non-working case :-) (it does actually work on Linux) We do not yet have support for making libs that can be called from other languages in Cabal. There's an open ticket on it. |
| 13:37:43 | <alar> | dcoutts: then what build tool do you recommend for callable-from-FFI stuff? makefiles? |
| 13:37:47 | <opqdonut> | hmm, http://hackage.haskell.org/packages/archive/InfixApplicative/1.0.1/doc/html/Control-Applicative-Infix.html is broken |
| 13:37:53 | <opqdonut> | some < and > signs are missing |
| 13:38:26 | <dcoutts> | alar: at the moment, yes. See http://hackage.haskell.org/trac/hackage/ticket/148 |
| 13:38:32 | <quicksilver> | is <blah> haddock syntax for a link, perhaps? |
| 13:38:45 | <alar> | @karma+ dcoutts |
| 13:38:45 | <lambdabot> | dcoutts's karma raised to 7. |
| 13:38:51 | <opqdonut> | quicksilver: might be |
| 13:39:03 | <alar> | this was my first attempt to make cabal package :( |
| 13:39:09 | <doserj> | and . sequence [(l<=),(>0)] |
| 13:39:11 | <quicksilver> | only 7? we lost LB database again? |
| 13:39:26 | <Axman6> | @karma |
| 13:39:26 | <lambdabot> | You have a karma of 6 |
| 13:39:32 | <Axman6> | doesn't look like it |
| 13:39:48 | <dcoutts> | alar: you could simplify your makefile by using cabal to build and then you do the link step with a script |
| 13:40:51 | <alar> | dcoutts: thanks! and it will be partially portable, because cabal handles some issues |
| 13:42:33 | <alar> | ACTION found very outdated Setup.hs that builds DLL, but it has some hardcoded stuff which cabal normally autodetects |
| 13:49:14 | <Baughn> | @tell conal I moved isHNF (now isEvaluated) into a separate package that should be appearing on hackage right about now, since it seemed useful outside unamb. The interface is the same. Please note, the isHNF code you got earlier is in error; it's chases indirections, which is unnecessary and leads to false negatives. |
| 13:49:15 | <lambdabot> | Consider it noted. |
| 13:49:46 | <hackagebot> | isevaluated 0.1 |
| 13:49:47 | <pastorn> | @paste |
| 13:49:47 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 14:02:49 | <hackagebot> | isevaluated 0.2 |
| 14:04:17 | <mauke> | heh |
| 14:06:15 | <Baughn> | mauke: ..no heh-ing, please. It's a genuine change, not just a bugfix. :P |
| 14:21:53 | <hackagebot> | control-monad-exception 0.2 |
| 14:30:45 | <byorgey> | it seems hackagebot has returned. |
| 14:31:04 | <byorgey> | ACTION bakes lambda-honey-wheat bread |
| 14:35:48 | <yowgi> | @faq can Haskell be used as a lethal poison if its lambdas are mixed with honey and wheat? |
| 14:35:49 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 14:43:38 | <Taejo> | @undo do {c <- cond; if c then yes else no} |
| 14:43:39 | <lambdabot> | cond >>= \ c -> if c then yes else no |
| 14:44:09 | <Taejo> | @pl cond >>= \ c -> if c then yes else no |
| 14:44:11 | <lambdabot> | flip (flip if' yes) no =<< cond |
| 14:44:52 | <McManiaC> | http://sprunge.us/IIgH?hs - i get the following message: |
| 14:45:03 | <McManiaC> | Couldn't match expected type `m a' against inferred type `Int' |
| 14:45:03 | <McManiaC> | In the expression: jump' newField (nr + 1) (x + dx, y + dy) |
| 14:45:03 | <McManiaC> | In the third argument of `foldl'', namely |
| 14:45:39 | <McManiaC> | jump' should take one int and return IO Int |
| 14:46:14 | <doserj> | McManiaC: your type signature is wrong. IO Int instead of IO int |
| 14:46:26 | <McManiaC> | oh |
| 14:46:44 | <McManiaC> | still gets the same msg |
| 14:46:56 | <byorgey> | McManiaC: also, I think perhaps you want foldr (>=>) return instead of foldl' (>>=) return |
| 14:47:17 | <byorgey> | or maybe foldl' (>=>) return, not sure which is better |
| 14:47:21 | <codebliss> | @t fmap |
| 14:47:21 | <lambdabot> | Maybe you meant: tell thank you thanks thx ticker time todo todo-add todo-delete topic-cons topic-init topic-null topic-snoc topic-tail topic-tell type . ? @ ft v |
| 14:47:23 | <byorgey> | the point is it needs to be >=> instead of >>= |
| 14:47:30 | <byorgey> | @type (>=>) |
| 14:47:31 | <codebliss> | > :t fmap |
| 14:47:31 | <lambdabot> | forall a (m :: * -> *) b c. (Monad m) => (a -> m b) -> (b -> m c) -> a -> m c |
| 14:47:32 | <lambdabot> | <no location info>: parse error on input `:' |
| 14:47:35 | <codebliss> | > :t liftM |
| 14:47:35 | <lambdabot> | <no location info>: parse error on input `:' |
| 14:47:49 | <byorgey> | codebliss: use @type |
| 14:47:51 | <codebliss> | What's the real difference? I see once reqs a functor and the other a monad |
| 14:48:05 | <codebliss> | Okie day. I know the types, was just showing up before I talk about them =| |
| 14:48:06 | <byorgey> | codebliss: no difference in practice. |
| 14:48:11 | <codebliss> | Alright. |
| 14:48:15 | <codebliss> | fmap preferred? |
| 14:48:37 | <codebliss> | I just noticed they were the same type sig except different reqs *facepalm* |
| 14:48:38 | <byorgey> | codebliss: every Monad ought to be a Functor, with fmap = liftM |
| 14:48:47 | <byorgey> | it's just an historical accident that this is not required |
| 14:48:48 | <codebliss> | Mkay. |
| 14:49:08 | <codebliss> | Are all monads functors, or all functors monads? |
| 14:49:12 | <codebliss> | The latter? |
| 14:49:16 | <SamB_XP> | yeah, if you ever find a Monad that isn't a Functor, report a bug against the package that defines the Monad instance |
| 14:49:20 | <byorgey> | no, the former. |
| 14:49:28 | <codebliss> | Oh. |
| 14:49:29 | <byorgey> | functor is much more general than monad. |
| 14:49:43 | <codebliss> | Gotcha. |
| 14:49:45 | <codebliss> | Like arrows? |
| 14:49:46 | <jn_> | does anyone know what the status of ghc and the lgpl is due to gmp? i'm curious what the implications of using ghc for commercial development are |
| 14:50:28 | <doserj> | http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes |
| 14:50:29 | <byorgey> | codebliss: well... arrows don't fit quite as nicely into the hierarchy, but I suppose you could say they are more general than monads. |
| 14:50:29 | <SamB_XP> | jn_: the implications are that you shouldn't statically link GMP in |
| 14:50:46 | <byorgey> | codebliss: the exact relationship between monad + arrow is not that simple =) |
| 14:50:48 | <codebliss> | byorgey: Understood, bad example =P |
| 14:50:55 | <byorgey> | no problem =) |
| 14:51:00 | <SamB_XP> | jn_: unless you want to provide the rest of the .o/.a files to allow users to link with modified versions of GMP |
| 14:51:04 | <thoughtpolice> | jn_: currently GHC statically links gmp etc. into binaries since ghc doesn't support dynamic linking (yet) |
| 14:51:17 | <jn_> | ugh |
| 14:51:22 | <thoughtpolice> | jn_: if you distribute a binary version of your app you must also under the lgpl distribute object files so people can link with different versions of gmp |
| 14:51:39 | <thoughtpolice> | jn_: but do not worry, both a) shared libraries and b) the removal of GMP from ghc are very much being worked on |
| 14:51:44 | <byorgey> | codebliss: you might be interested in reading the Typeclassopedia: http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf |
| 14:51:51 | <jn_> | thoughtpolice: is there an ETA on that? |
| 14:51:52 | <SamB_XP> | jn_: if you don't statically link GMP, you're fine, as long as you are willing to provide a copy of the GMP sources for any GMP binaries you give out |
| 14:52:07 | <jn_> | SamB_XP: good to know |
| 14:52:10 | <jmcarthur_work> | thoughtpolice, what is going to replace GMP? pure haskell code or some other library? |
| 14:52:20 | <codebliss> | byorgey: Oh ya, thank you! I had looked at this earlier, but I was much less experienced with monads |
| 14:52:21 | <thoughtpolice> | jn_: no. well-typed is working on it (sponsored by the IHG) |
| 14:52:21 | <SamB_XP> | thoughtpolice: I thought it already linked GMP in as a .so ? |
| 14:52:28 | <codebliss> | byorgey: I should get it now. |
| 14:52:34 | <jn_> | ah alright. thanks all. |
| 14:52:37 | <thoughtpolice> | jn_: you should go to #ghc and talk to Igloo |
| 14:52:45 | <thoughtpolice> | jn_: if you can help i'm sure they would appreciate it |
| 14:52:54 | <thoughtpolice> | hopefully we can see GMP removed before 6.12 is out |
| 14:53:01 | <byorgey> | codebliss: yeah, based on the kinds of questions you are asking I think you are at the perfect place to read it |
| 14:53:16 | <thoughtpolice> | SamB_XP: hm, i might be wrong on that note but i'm not 100% sure |
| 14:53:16 | <codebliss> | byorgey: tyvm =] |
| 14:53:40 | <thoughtpolice> | jmcarthur_work: the plans are first to remove GMP and then have the Integer backends 'swappable' from what I understand |
| 14:54:04 | <thoughtpolice> | jmcarthur_work: e.g. you can use either GMP or openssl's bignum (which has a better license and is of comparable speed) |
| 14:54:18 | <jmcarthur_work> | ah, openssl |
| 14:54:23 | <thoughtpolice> | jmcarthur_work: or you can use just a pure haskell version, for example |
| 14:54:38 | <jmcarthur_work> | oh, i see what you mean |
| 14:54:52 | <jmcarthur_work> | but does this mean no "official" Integer implementation? |
| 14:55:24 | <thoughtpolice> | jmcarthur_work: Igloo has already written a version of Integer in haskell if you're interested in it - http://darcs.haskell.org/packages/integer-simple/ |
| 14:55:37 | <thoughtpolice> | although currently I don't think it's possible to put that in there in place of GMP very easily |
| 14:55:40 | <jmcarthur_work> | thoughtpolice, quite! thank you |
| 14:55:47 | <jn_> | who uses integers anyway |
| 14:55:49 | <codebliss> | Is map a derivation of functors for the list monad? |
| 14:56:03 | <codebliss> | theoretically lol |
| 14:56:10 | <jmcarthur_work> | jn_, a lot of us! |
| 14:56:20 | <thoughtpolice> | jmcarthur_work: in the old version of lhc we also used Isaac Dupree's 'HIntegerByInt' code as a stress tess |
| 14:56:42 | <Botje> | codebliss: map is a specialisation of fmap for lists |
| 14:57:07 | <codebliss> | Botje: Since functors allow you traverse a function to each element of a collection, and list is a collection? |
| 14:57:08 | <thoughtpolice> | jmcarthur_work: which is a version of Integer implemented in pretty much haskell98 |
| 14:57:13 | <thoughtpolice> | that also has decent performance |
| 14:57:16 | <thoughtpolice> | jmcarthur_work: http://isaac.cedarswampstudios.org/2007/HIntegerByInt/ |
| 14:57:55 | <SamB> | thoughtpolice: I thought you were still using that test ? |
| 14:58:14 | <thoughtpolice> | SamB: oh yeah, we're still keeping all the old tests |
| 14:58:16 | <thoughtpolice> | ACTION facepalm |
| 14:58:25 | <SamB> | it's apparantly a really good stress test, since it finds bugs in most Haskell compilers it's tested with |
| 14:58:28 | <thoughtpolice> | SamB: but it works now! |
| 14:58:31 | <thoughtpolice> | :) |
| 15:00:01 | <McManiaC> | byorgey: my problem was simple: foldl' (>>=) (return count) instead of foldl' (>>=) return :) |
| 15:06:21 | <Botje> | codebliss: yep |
| 15:22:48 | <codebliss> | Anyone here read through the monads part of typeclassopedia? |
| 15:22:57 | <Xenox> | Hi everybody. I'm reading through WxHaskell and in the source code I found "evtHandlerOnEventConnect :: EvtHandler a -> Id -> Id -> EventId -> state -> OnEvent". |
| 15:23:09 | <Xenox> | Now the state type is nowhere defined, how is this possible |
| 15:23:30 | <byorgey> | McManiaC: ah, yup, that works too |
| 15:23:31 | <fasta> | Xenox: it is a variable |
| 15:23:32 | <codebliss> | Did you check the imports? |
| 15:23:34 | <eivuokko> | It's a type variable |
| 15:24:30 | <byorgey> | types beginning with lowercase letters are variables, uppercase are type constructors. |
| 15:24:48 | <byorgey> | codebliss: do you have a question about it? |
| 15:24:50 | <Xenox> | so the type is a variable defined @ runtime? |
| 15:25:01 | <fasta> | Xenox: no |
| 15:25:25 | <fasta> | Xenox: you can have a user-defined type there, but all types are known at compile-time. |
| 15:25:34 | <codebliss> | byorgey: I did the example wrong, I'll post again in a minute =P |
| 15:25:36 | <Xenox> | This is the function where it all starts with: evtHandlerOnEvent :: EvtHandler a -> Id -> Id -> EventId -> handler -> OnEvent |
| 15:25:38 | <byorgey> | Xenox: it means that evtHandlerOnEventConnect is polymorphic in the state type. it works no matter what type 'state' actually is. |
| 15:26:00 | <fasta> | Xenox: if you never use the state, you can even put undefined there. |
| 15:26:14 | <Xenox> | ahh ok, so actually state can also be type 'a' for example? |
| 15:26:33 | <fasta> | Xenox: a unifies with state, so yes. |
| 15:26:46 | <byorgey> | sure, or Int, or whatever |
| 15:27:07 | <byorgey> | a variable unifies with anything. |
| 15:27:42 | <monochrom> | "f :: int -> [int]" would be a cool prank :) |
| 15:28:40 | <Xenox> | And if i want to store this 'state' in a data type Such as Closure = Closure state (Bool -> Int), how do i need to define state then? |
| 15:28:59 | <fasta> | monochrom: it would be fun to release all Haskell compilers on April First with a Prelude that had type signatures like that. |
| 15:31:33 | <codebliss> | byorgey: defining (>>=) in terms of join and fmap is kinda tough, couple more minutes =P |
| 15:32:10 | <byorgey> | codebliss: you can do it! =) pay attention to the types. |
| 15:32:21 | <byorgey> | if you can write down something with the right type it will probably be correct. |
| 15:32:52 | <codebliss> | byorgey: I got the idea. Since I have join and not pure, I need to lift them all up to multiple levels of monad then simplify them down. Just got a little bit of a headache taking it all in =P |
| 15:32:55 | <fracture> | if I call length on the same list multiple times in an expression (or whatever similar sort of thing), is it safe to assume GHC -O can figure out to only do it once? |
| 15:33:01 | <codebliss> | Used to thinking with pure, not join =P |
| 15:33:19 | <Baughn> | fracture: No |
| 15:33:26 | <fracture> | ah |
| 15:33:45 | <fracture> | is there a description of what of that sort of optimization it can make somewhere online? |
| 15:33:45 | <Baughn> | fracture: Which is not to say that it won't, but there are severe issues in the general case. To say.. |
| 15:33:54 | <fracture> | ah |
| 15:34:16 | <byorgey> | codebliss: yup. |
| 15:34:26 | <Baughn> | fracture: If you have "let a = makeLargeThing x; b = makeLargeThing x", then obviously a and b are equal, and /could/ be shared without trouble |
| 15:35:42 | <eivuokko> | fracture, Exactly what kind of information you are after with "sort of optimization"? |
| 15:35:52 | <Baughn> | fracture: However, if GHC actually combined them, then.. say a/b are a list, say - a function that goes on to walk a would leak memory, since a would get lazily constructed and you'd /expect/ it to get GCd along the way, but b is holding on to the head of the list so it can't be GC'd |
| 15:36:05 | <Baughn> | fracture: (That's assuming nothing else is holding on to a, of course) |
| 15:36:11 | <Baughn> | fracture: Um. Did that make sense? |
| 15:36:33 | <fracture> | ah yes |
| 15:36:37 | <eivuokko> | fracture, If you are interested to learn in general how to see what ghc does, it's good to learn to read "core." |
| 15:36:37 | <codebliss> | a >>= g = join . ((fmap g) a) |
| 15:36:40 | <Baughn> | fracture: I'm pretty sure GHC will combine them in some cases, but only when it can prove that to be safe, which is less often than /you/ can. |
| 15:36:51 | <codebliss> | byorgey: Does that satisfy it? =P |
| 15:36:52 | <fracture> | but if you had two copies of the result of makeLargeThing, it's just as bad as not being able to GC the one copy, no? |
| 15:37:03 | <fracture> | eivuokko: what's that? |
| 15:37:03 | <Baughn> | Not if they're created lazily |
| 15:37:08 | <fracture> | ohhhhh |
| 15:37:10 | <fracture> | ok now I grok you |
| 15:37:13 | <byorgey> | codebliss: does it typecheck? |
| 15:37:21 | <codebliss> | I'll check, good idea |
| 15:37:21 | <fracture> | for example, makeLargeThing x = [x..] |
| 15:37:25 | <fracture> | no? |
| 15:37:30 | <Baughn> | Right, that's a good example |
| 15:38:00 | <fracture> | eivuokko: by "that type of optimization" I guess I was just thinking something like common subexpression elimination in an imperative language |
| 15:38:05 | <codebliss> | Can you define just type sigs in ghci? |
| 15:38:09 | <codebliss> | Or does join exist somewhere |
| 15:38:17 | <byorgey> | codebliss: join is in Control.Monad |
| 15:38:23 | <codebliss> | Thanks |
| 15:38:23 | <byorgey> | codebliss: you can also use lambdabot |
| 15:38:33 | <codebliss> | Touche. |
| 15:38:44 | <codebliss> | > let foo a g = join . (fmap g) a |
| 15:38:45 | <lambdabot> | not an expression: `let foo a g = join . (fmap g) a' |
| 15:39:15 | <byorgey> | @type \a g -> join . ((fmap g) a) |
| 15:39:16 | <lambdabot> | forall (m :: * -> *) a a1 a2. (Monad m) => (a2 -> a1) -> (a1 -> m (m a)) -> a2 -> m a |
| 15:39:20 | <fracture> | Baughn: that actually answered another thing I was wondering about the other day too (whether lazily created stuff can be GC'd as it is being used) |
| 15:39:27 | <byorgey> | codebliss: that's not quite right, but you are very close |
| 15:39:27 | <Baughn> | fracture: As you can see, laziness complicates CSE quite a bit. :) |
| 15:39:30 | <fracture> | pretty nifty, that is |
| 15:39:30 | <codebliss> | Oh... |
| 15:39:33 | <fracture> | *nod* |
| 15:39:42 | <jn_> | has anything usable come out of the "Static Contract checking for Haskell" paper yet? |
| 15:39:57 | <Baughn> | fracture: Oh, and in "let a = [x..] in doSomethingWith a", a can be GC'd while it's doing Something |
| 15:40:00 | <jn_> | or is there anything similar? |
| 15:40:04 | <eivuokko> | fracture, Ah ok. I thought you wanted to learn some comprehensive way to know what's "fast" in haskell/ghc. |
| 15:40:24 | <Baughn> | fracture: GHC bases GCing on the program's continuation, not what's in lexical scope |
| 15:40:39 | <Baughn> | fracture: (Since a isn't in fact ever referenced again, it can be GC'd) |
| 15:41:11 | <codebliss> | @type \a g -> join ((fmap g) a) |
| 15:41:12 | <lambdabot> | forall a (m :: * -> *) a1. (Functor m, Monad m) => m a -> (a -> m a1) -> m a1 |
| 15:41:13 | <fracture> | got ya; makes sense |
| 15:41:20 | <Baughn> | fracture: (Well, it compiles to something a bit more traditional, but in general you can assume ghc -O2 is a sufficiently smart compiler) |
| 15:41:22 | <codebliss> | I did (.) instead of ($) again =X |
| 15:41:30 | <byorgey> | codebliss: hehe |
| 15:41:37 | <byorgey> | codebliss: that's it! |
| 15:41:47 | <byorgey> | well done |
| 15:41:51 | <fracture> | eivuokko: that seems a bit more general than what I was curious about (although I suppose it's useful to know more anyway) ... but anyway, what's "core"? |
| 15:41:54 | <codebliss> | PS: The engineer's given/prove system is awesome lol |
| 15:42:03 | <codebliss> | Chemistry teacher taught me it once last year. |
| 15:42:18 | <byorgey> | codebliss: what's that? |
| 15:42:38 | <Baughn> | fracture: Core is what GHC compiles Haskell to |
| 15:42:45 | <codebliss> | Make two columns, Given and Prove. On given write what you can use, and on prove do your work with the answer being the last line |
| 15:42:50 | <fracture> | ahh, a sort of intermediate language? |
| 15:42:51 | <Baughn> | fracture: Core is then compiled further, but it's the lowest reasonably readable layer |
| 15:43:01 | <byorgey> | codebliss: ah, right, got it |
| 15:43:02 | <eivuokko> | fracture, It's a representation of you source that ghc can output. It's human readable. It's a sort of functional language, so you can see CSE and such optimisations on it. |
| 15:43:05 | <Baughn> | fracture: More to the point, most optimizations are Core -> Core |
| 15:43:09 | <fracture> | is it the lowest arch-independent layer? |
| 15:43:24 | <quicksilver> | no, there is Cmm below it |
| 15:43:28 | <eivuokko> | In some sense, but no. |
| 15:43:31 | <fracture> | ah k |
| 15:43:36 | <Baughn> | Whether Cmm is arch-independent is.. debatable |
| 15:43:39 | <eivuokko> | Cmm isn't really arch independent, but yeah. |
| 15:43:40 | <codebliss> | @type \a g -> join $ fmap g $ a |
| 15:43:41 | <lambdabot> | forall a a1 (f :: * -> *). (Monad f, Functor f) => f a1 -> (a1 -> f a) -> f a |
| 15:43:44 | <fracture> | is Core part of the haskell language standard, or a GHC-invention? |
| 15:43:49 | <Baughn> | GHC |
| 15:43:54 | <fracture> | ok cool |
| 15:44:23 | <Baughn> | fracture: Anyway, if you want to know what your program is /really/ doing - post-optimization - read the core. It takes some practice, but it's very doable. |
| 15:44:36 | <Baughn> | fracture: Also of use is the --show-iface option to ghc; takes a .hi file |
| 15:44:44 | <byorgey> | @type (join .) . flip fmap |
| 15:44:46 | <lambdabot> | forall a a1 (f :: * -> *). (Monad f, Functor f) => f a1 -> (a1 -> f a) -> f a |
| 15:44:47 | <eivuokko> | It's actuall very easy compared to how to learn *what* compiler does compared to most other compilers/languages. |
| 15:44:51 | <McManiaC> | http://www.haskell.org/haskellwiki/Performance - "Profile, profile, profile - understand who is hanging on to the memory (+RTS -hc) and how it's being used (+RTS -hb)." |
| 15:44:56 | <McManiaC> | what is +RTS -hb ??? |
| 15:45:19 | <Baughn> | McManiaC: Read the GHC User Guide |
| 15:45:25 | <eivuokko> | McManiaC, +RTS foo passes information foo to runtime system that comes with ghc, and each program compiler with ghc. |
| 15:45:32 | <fracture> | cool; thanks guys |
| 15:45:36 | <vininim> | damn t, where is my scratch pad? |
| 15:45:49 | <vininim> | ACTION hates to have to reinit gnome for xmonad reload |
| 15:45:50 | <Baughn> | McManiaC: (Profiling section) |
| 15:45:58 | <Baughn> | vininim: M-q doesn't work? |
| 15:46:19 | <Baughn> | vininim: I've got a wholly gnomeless setup, if you want. Works nicely. |
| 15:46:23 | <vininim> | Baughn: no, seems to be a known problem in fedora 10 |
| 15:47:10 | <vininim> | mine too, except I forgot thescratch pad xD |
| 15:47:30 | <Baughn> | vininim: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5320#a5321 <-- Have one anyway. You might get ideas. ;) |
| 15:48:11 | <codebliss> | @src join |
| 15:48:11 | <lambdabot> | join x = x >>= id |
| 15:49:23 | <codebliss> | That's...sweet. |
| 15:49:34 | <codebliss> | I would have never thought of that lol |
| 15:49:39 | <Baughn> | @src (>>=) |
| 15:49:40 | <lambdabot> | Source not found. This mission is too important for me to allow you to jeopardize it. |
| 15:50:03 | <codebliss> | Lambdabot is just too awesome lol |
| 15:50:07 | <Baughn> | a >>= f = join (fmap f a) |
| 15:50:25 | <Baughn> | Or liftM. Whatever. |
| 15:50:36 | <codebliss> | I figured that out earlier =) |
| 15:50:41 | <codebliss> | I'm doing the second exercise |
| 15:50:47 | <codebliss> | join in terms of (>>=) |
| 15:50:47 | <Baughn> | Ah, typeclassopedia? |
| 15:50:52 | <codebliss> | Yep =) |
| 15:51:01 | <codebliss> | But I didn't know I was allowed to use id, lol dumb me |
| 15:51:04 | <Baughn> | Have fun when you get to the transformers. :P |
| 15:51:09 | <codebliss> | XD |
| 15:53:09 | <codebliss> | This join definition is awesome. I'm still trying to get around the simplicity XD |
| 15:53:40 | <conal> | Baughn: hi. just saw your @tell comments in the #haskell log. |
| 15:53:40 | <lambdabot> | conal: You have 4 new messages. '/msg lambdabot @messages' to read them. |
| 15:54:08 | <Baughn> | conal: Mm. I'd say it works fine now. |
| 15:54:21 | <Baughn> | conal: I've been trying to break unamb/isEvaluated for an hour, to no avail |
| 15:54:42 | <conal> | Baughn: great news! |
| 15:55:12 | <Baughn> | conal: ..but hang on, how did you see the comments when you were offline? |
| 15:55:13 | <conal> | Baughn: are you playing with it stand-alone and in the context of reactive? |
| 15:55:32 | <Baughn> | conal: Both. I've yet to break reactive, too, except for anything that involves join/Monad. |
| 15:55:55 | <conal> | Baughn: http://tunes.org/~nef/logs/haskell/09.05.27 |
| 15:56:07 | <Baughn> | Ah |
| 15:56:21 | <Baughn> | ..you sneak |
| 15:56:37 | <conal> | :) i have an emacs command that pops up the current day's #haskell archive |
| 15:56:48 | <conal> | ACTION <3 s emacs |
| 15:56:59 | <skorpan> | emacs YEAHHHHH |
| 15:58:27 | <codebliss> | byorgey: Baughn: Would it be a good idea to write mapM, sequence, when, etc using bind and return? |
| 15:58:28 | <Baughn> | conal: Anyway - isEvaluated works with int, integer, tuples, strict and unstrict data, mvars (no idea what the dedicated mvar closure tipe is for, then - internal?), etc. etc. |
| 15:58:41 | <Baughn> | @src sequence |
| 15:58:41 | <lambdabot> | sequence [] = return [] |
| 15:58:41 | <lambdabot> | sequence (x:xs) = do v <- x; vs <- sequence xs; return (v:vs) |
| 15:58:41 | <lambdabot> | --OR |
| 15:58:41 | <lambdabot> | sequence xs = foldr (liftM2 (:)) (return []) xs |
| 15:58:45 | <codebliss> | Shhhhh |
| 15:58:49 | <codebliss> | I mean on my own |
| 15:58:50 | <codebliss> | ugh lol |
| 15:58:58 | <Baughn> | ACTION snorts |
| 15:59:06 | <EvilTerran> | codebliss, even more cunning: join = (>>= id) |
| 15:59:48 | <codebliss> | Ya, less readable imo though =P. I used to love points-free but lately I've been liking \_-> |
| 16:00:07 | <conal> | Baughn: something funny going on with isHNF and Integer? |
| 16:00:37 | <Baughn> | conal: That was down to my chasing indirections, which is just a bad idea |
| 16:00:56 | <conal> | Baughn: oh yeah. what's the deal with indirections? |
| 16:01:02 | <Baughn> | conal: As it turns out, the RTS only writes indirections when evaluating a closure, so if I see one I can just assume it's fine |
| 16:01:27 | <rampa_nick> | Newbie question here. How do I create a list of length n populate it with a constant float, say a, except for the first and last values that should be b. For example [b, a, a, a, a, a, b] where n = 7. |
| 16:01:34 | <conal> | Baughn: oh! it might not be in whnf yet but will be soon? |
| 16:01:48 | <quicksilver> | rampa_nick: [b] ++ replicate 7 a ++ [b] |
| 16:01:51 | <Baughn> | conal: No, it writes them /after/ evaluating. :) |
| 16:02:15 | <conal> | Baughn: oh. got it. good thing. |
| 16:02:26 | <Baughn> | conal: Basically, it goes "read thunk closure, start evaluation, write new closure with evaluation result, overwrite thunk with indirection" |
| 16:02:42 | <rampa_nick> | Thanks quicksilver. |
| 16:02:43 | <Baughn> | conal: I think the GC also uses them. Hopefully not in a bad way; I'm working on testing that. |
| 16:03:10 | <mreh> | mmmm smooth linux fonts on xchat |
| 16:03:21 | <Baughn> | @index performGC |
| 16:03:21 | <lambdabot> | System.Mem |
| 16:04:38 | <Baughn> | conal: ..nah, it's fine. |
| 16:05:24 | <mreh> | can I apt-get yi? |
| 16:05:40 | <lilac> | mreh: you can cabal install it iirc |
| 16:06:07 | <codebliss> | @src id |
| 16:06:07 | <mreh> | cool |
| 16:06:07 | <lambdabot> | id x = x |
| 16:06:17 | <codebliss> | Tough definition! |
| 16:07:13 | <lilac> | eta reduces to: id = |
| 16:07:40 | <lilac> | which sadly is not legal haskell :-( |
| 16:07:50 | <osfameron> | hehe |
| 16:11:39 | <LeCamarade> | Does the thread behaviour change between running through runhaskell and running a compiled? |
| 16:12:00 | <LeCamarade> | There is this deadlock that only seems to show up when I run a compiled thingy. |
| 16:13:07 | <Baughn> | LeCamarade: It shouldn't, but it does change between -threaded and not-threaded |
| 16:13:22 | <Baughn> | LeCamarade: (If you're having issues, try adding -threaded first) |
| 16:13:36 | <lilac> | this GHC CAS thingy... it seems to me that thunk evaluation could be changed to (1) overwrite the thunk with a 'do something else and check back later' thunk, (2) execute the thunk, (3) overwrite the thunk with a 'here's the result' one. |
| 16:13:54 | <cadabra> | Can I subRegex with Text.Regex.PCRE? |
| 16:14:06 | <lilac> | it wouldn't eliminate the race but should reduce the rate at which it happens, and it'd allow detecting forcing-X-forces-X hangs |
| 16:14:11 | <conal> | Baughn: do you have a sense for whether the isEvaluated optimization of unamb is worth the overhead? |
| 16:14:27 | <Baughn> | conal: I lack a working reactive program to test it on |
| 16:15:31 | <conal> | Baughn: yeah. sry about that. interested in helping sort out the remaining problems with reactive? |
| 16:16:35 | <Baughn> | conal: Definitely, once I'm done with exams. ;) |
| 16:16:49 | <codebliss> | @src (>=>) |
| 16:16:49 | <lambdabot> | Source not found. |
| 16:17:20 | <conal> | Baughn: sweet. good luck on those exams. what school? |
| 16:17:37 | <Baughn> | conal: University of Tromsø |
| 16:18:09 | <thoughtpolice> | lilac: well, the CAS experiment was just aimed at seeing how high an overhead we get by having the guarantee that 1 thunk isn't evaluated by two processors |
| 16:18:12 | <Baughn> | conal: You've probably never heard of it. It specializes mostly in distributed systems. |
| 16:18:36 | <thoughtpolice> | lilac: and in this case the cost of CAS seems fairly dramatic for parallel programs, especially on i386 machines |
| 16:19:07 | <lilac> | thoughtpolice: right, but what i'm suggesting doesn't require any locked instructions, and /should/ reduce the risk with only one extra memory copy |
| 16:20:07 | <thoughtpolice> | lilac: simon seems to already have done something similar I think in GHC HEAD - eager blackholing |
| 16:20:11 | <thoughtpolice> | http://www.mail-archive.com/cvs-ghc@haskell.org/msg12210.html |
| 16:21:08 | <lilac> | thoughtpolice: i should have known better than to think i'd thought of something which the GHC devs hadn't ;-) |
| 16:21:41 | <thoughtpolice> | lilac: :) |
| 16:21:49 | <conal> | i guess i'll have to decide what to do with the Event "monad", which (a) doesn't satisfy monad laws in some (perhaps edge) cases, and (b) doesn't yet have a compelling & sufficiently lazy implementation. |
| 16:21:55 | <thoughtpolice> | lilac: it might actually be exactly what you are describing from what I see |
| 16:23:00 | <lilac> | thoughtpolice: looks a lot like it, but the patch means very little to me |
| 16:23:03 | <thoughtpolice> | lilac: it would be an interesting benchmark to compare GHC HEAD code with/without -feager-blackholing |
| 16:23:36 | <thoughtpolice> | to see how much of a gain we get/see how much we lose to a thunk being evaluated twice |
| 16:23:56 | <LeCamarade> | Baughn, I have some code that doesn't seem like it should have race conditions. And they only seem to show up when I run it as compiled binary. Am I right when I infer a serious difference in thread behaviour under the two environments? |
| 16:24:04 | <eivuokko> | Does anyone remember details about strictness in continuation monad? I recall there was difference in using case vs. let in (>>=), but I can't see it myself now. |
| 16:24:10 | <conal> | Baughn: i like the conceptual simplicity of Reactive's data-driven, and yet purely functional, implementation style. but some of the laziness/termination issues have been pretty difficult for me to sort out. |
| 16:24:59 | <lilac> | thoughtpolice: i guess in practice it depends quite a lot on (1) how much it happens, and (2) how often the black-hole write makes it to the other CPU before the thunk is evaluated for the second time |
| 16:25:46 | <Baughn> | LeCamarade: Yes. However, if race conditions show up only in one form, chances are they /exist/ in both. :) |
| 16:26:30 | <LeCamarade> | Okay. I hate how so hard this bug seems to debug. I don't even know where to start, since my program has a million threads at any one time! :o) |
| 16:26:33 | <conal> | PeakerWork: ping |
| 16:26:38 | <LeCamarade> | And it's production. |
| 16:26:59 | <conal> | PeakerWork: any thoughts on checkers and QuickCheck 2? |
| 16:27:18 | <Baughn> | LeCamarade: To begin with, your fundamental threading model may be a bad idea |
| 16:27:29 | <lilac> | LeCamarade: how do your threads communicate? |
| 16:27:39 | <Baughn> | LeCamarade: If you're doing mutable-memory style threading.. well, how do you do it? |
| 16:28:32 | <LeCamarade> | I only use Chans and MVars. |
| 16:28:45 | <codebliss> | Baughn: Screw transformers XD |
| 16:28:52 | <LeCamarade> | I only really use the threads to have asynchrony, not to speed things up. |
| 16:28:59 | <thoughtpolice> | lilac: yeah, it'd be very much per-benchmark, but trying it over a few different benchmarks might give an idea |
| 16:29:05 | <Baughn> | LeCamarade: MVars as unit-capacity channels, or as mutable variables? |
| 16:29:10 | <thoughtpolice> | (e.g. all of the parallel shootout code or something) |
| 16:29:15 | <LeCamarade> | I only use Chan, MVar, and SampleVar. |
| 16:29:29 | <LeCamarade> | Baughn, As mutable variables. :-p |
| 16:29:59 | <Baughn> | LeCamarade: Right. If you're touching multiple MVars at once, try using STM instead |
| 16:31:13 | <gwern> | hm. no gitit in the hcar |
| 16:31:22 | <gwern> | and no happstack |
| 16:33:09 | <LeCamarade> | Baughn, Why would touching multiple MVars cause a deadlock hazard? In other words, I'm rather ignorant about the difference therein. |
| 16:33:35 | <Baughn> | LeCamarade: If thread 1 locks mvar a and then b, while thread 2 locks b and then a.. |
| 16:33:50 | <ksf> | hmmmm... what magic words do I need to google for to find a program that automagically generates bindings for glib-based libraries? webkit-gtk, to be precise. |
| 16:33:52 | <Baughn> | LeCamarade: You have to make sure to always lock them in the same order, regardless of thread. It's annoying. |
| 16:33:59 | <Baughn> | LeCamarade: STM takes care of that much more nicely. |
| 16:34:44 | <McManiaC> | ghc -O2 -threaded --make springer.hs |
| 16:34:46 | <McManiaC> | ./springer 5 5 +RTS -N2 -s |
| 16:34:51 | <McManiaC> | why doesnt he use 2 threads? |
| 16:34:52 | <McManiaC> | :o |
| 16:35:12 | <thoughtpolice> | McManiaC: ? |
| 16:35:30 | <McManiaC> | http://haskell.org/ghc/docs/latest/html/users_guide/using-smp.html |
| 16:36:00 | <mreh> | when are they packaging cabal with haskell? |
| 16:36:10 | <Baughn> | mreh: They already have |
| 16:36:15 | <Baughn> | See the haskell platform |
| 16:36:25 | <mreh> | Baughn, with ghc6.10? |
| 16:36:28 | <Baughn> | Yes |
| 16:36:31 | <mreh> | ooo |
| 16:36:39 | <LeCamarade> | Okay, I'll go and turn all cases of MVar into STM. Is that intelligent? I'm going to have to brush up, also. (I wrote this application in 6.4 days, and I just ported it to 6.10 last month.) |
| 16:37:02 | <dcoutts> | mreh: the haskell platform version 2009.2.0 includes ghc 6.10.2, cabal-install and a bunch of other libs and tools |
| 16:37:09 | <Baughn> | LeCamarade: ..well, it might work, but it's a bit of a brute-force solution |
| 16:37:19 | <Baughn> | LeCamarade: Still. Go ahead. |
| 16:37:34 | <Baughn> | LeCamarade: Also, compile with -threaded; that adds deadlock detection |
| 16:38:10 | <mreh> | is there a debian package source for 6.10 yet? |
| 16:38:36 | <McManiaC> | ghc -O2 -parallel --make springer.hs |
| 16:38:39 | <McManiaC> | <command line>: unknown package: concurrent |
| 16:38:40 | <McManiaC> | ? |
| 16:38:44 | <Baughn> | mreh: -threaded |
| 16:38:56 | <McManiaC> | -threaded has no effect =( |
| 16:39:04 | <LeCamarade> | Baughn, I think I have deadlock detection (dynamic). It throws a deadlock exception, but I don't know where to find the deadlock. |
| 16:39:07 | <Baughn> | What effect do you expect it to have? |
| 16:39:19 | <McManiaC> | make use of my dual core? |
| 16:39:22 | <LeCamarade> | It seemed easy to reproduce, until I started using runhaskell, and it stopped showing up. |
| 16:39:25 | <Baughn> | LeCamarade: You can add onError handlers or whatever to figure that out |
| 16:39:35 | <LeCamarade> | Heisenbugs will rule the Earth, |
| 16:41:24 | <dcoutts> | McManiaC: -threaded links your program with the threaded rts, you can tell your program to run on multiple cores using ./prog +RTS -N2 |
| 16:41:46 | <dcoutts> | McManiaC: though obviously you need to have written your program to take advantage of multiple cores, eg using par |
| 16:41:59 | <mreh> | I would rather not learn how to install GHC from source, but I can't find a debian package source for either of those |
| 16:42:12 | <mreh> | ghc6.10 or the haskell platform |
| 16:42:15 | <McManiaC> | dcoutts: is there a wiki about par? |
| 16:42:29 | <mreh> | par!! |
| 16:43:47 | <doserj> | mreh: you probably can install the generic linux binary ghc-6.10 package |
| 16:44:12 | <mreh> | doserj: with the C compiler? |
| 16:44:21 | <mreh> | oh binary |
| 16:44:44 | <dcoutts> | McManiaC: there's not a lot on the wiki on how to use par that I can see. The haddock docs are probably a good place to start. |
| 16:45:07 | <McManiaC> | ok |
| 16:45:09 | <dcoutts> | McManiaC: though see http://haskell.org/haskellwiki/Blog_articles/Parallel |
| 16:45:56 | <dcoutts> | McManiaC: and there's a paper http://www.haskell.org/~simonmar/bib/multicore-ghc-09_abstract.html |
| 16:46:07 | <McManiaC> | :) thx! |
| 16:47:29 | <hackagebot> | pointedlist 0.3.5 |
| 17:19:26 | <McManiaC> | @src (/) |
| 17:19:27 | <lambdabot> | Source not found. There are some things that I just don't know. |
| 17:19:35 | <McManiaC> | @src (+) |
| 17:19:35 | <lambdabot> | Source not found. BOB says: You seem to have forgotten your passwd, enter another! |
| 17:19:39 | <McManiaC> | meh |
| 17:19:54 | <glguy> | (/) and (+) are class methods |
| 17:19:57 | <EvilTerran> | McManiaC, it depends of which instance of Num you're using |
| 17:19:57 | <EvilTerran> | ?src Num |
| 17:19:57 | <lambdabot> | class (Eq a, Show a) => Num a where |
| 17:19:57 | <lambdabot> | (+), (-), (*) :: a -> a -> a |
| 17:19:57 | <lambdabot> | negate, abs, signum :: a -> a |
| 17:19:57 | <lambdabot> | fromInteger :: Integer -> a |
| 17:19:58 | <glguy> | the have no source code in general |
| 17:20:06 | <EvilTerran> | (or Fractional in the case of /) |
| 17:20:15 | <glguy> | unless ther is a default implementation, which seems unlikely |
| 17:21:24 | <lilac> | glguy: a / b = a * recip b? |
| 17:21:44 | <McManiaC> | hm so i need a class |
| 17:21:44 | <McManiaC> | okay |
| 17:23:10 | <lilac> | McManiaC: what are you trying to do? |
| 17:24:18 | <McManiaC> | hmmm |
| 17:24:43 | <McManiaC> | im trieing to represent polynoms as some kind of non-sortable list |
| 17:24:47 | <McManiaC> | trying |
| 17:25:05 | <EvilTerran> | non-sortable? |
| 17:25:08 | <lilac> | McManiaC: you want to define your own (/)? |
| 17:26:17 | <lilac> | might i suggest defining div and mod instead of (/) for polynomials (since they form an integral domain but not a field)? |
| 17:28:04 | <McManiaC> | data Polynoms = Num a => Poly a Polynoms |
| 17:28:09 | <McManiaC> | where is that Num a supposed to be? |
| 17:28:09 | <McManiaC> | ^^ |
| 17:29:03 | <lilac> | McManiaC: looks like an existential, and probably not what you wanted... |
| 17:30:53 | <roconnor> | @wiki Data_declaration_with_constraint |
| 17:30:53 | <lambdabot> | http://www.haskell.org/haskellwiki/Data_declaration_with_constraint |
| 17:30:58 | <roconnor> | McManiaC: ^^ |
| 17:44:10 | <Philonous> | You can use smart constructors to enforce type constraints on data types. i.e. for a data type data Foo a = Foo a you write a function foo :: (MyClass a) => a -> Foo a ; foo = Foo, and only export the function, but not the constructor |
| 17:47:16 | <Philonous> | But I don't know if this is really useful. Why constrain the data type in the first place? Put it in the functions. e.g. bar :: (MyClass a) => Foo a -> Baz |
| 17:47:51 | <Baughn> | I certainly wouldn't call /that/ useful |
| 17:48:19 | <Baughn> | You can stick a constraint on the data statement itself, in which case you don't need to put one on the functions to let you use the classes.. but that's confusing |
| 17:48:40 | <Baughn> | Anyway, a lot of the time you end up writing some functions that need the classes and some that don't |
| 17:58:03 | <ray> | i've had enough of debian ghc packages |
| 17:59:04 | <jiyunatori> | hi. some time ago, I started a program with complex datatypes. to easily modify these datatypes, I had to write something called "functional references". I ended writing a lot of boilerplate code, as I'm not familiar with TH and stuff. Is it still necessary to write functional refs now ? |
| 18:00:19 | <copumpkin> | type families are an alternative that people like more |
| 18:01:34 | <fracture> | ugh... |
| 18:01:44 | <fracture> | pressing uncomment on a block in haskell-mode leaves an extra space in front of everything |
| 18:02:03 | <fracture> | has anyone really used this mode for actual programming... it's got so many little warts :( |
| 18:02:10 | <jmcarthur_work> | yeah i've run into that too. i just don't use haskell-mode's commenting/uncommenting stuff |
| 18:02:19 | <fracture> | (maybe if I stick with haskell I'll work on improving it at some point) |
| 18:02:26 | <ray> | i used it for a bit, but i like manually laying out haskell more |
| 18:02:37 | <jmcarthur_work> | i mostly like haskell-mode |
| 18:02:43 | <jmcarthur_work> | there are definitely warts though |
| 18:02:45 | <Baughn> | I use it a lot, but I haven't noticed comments doing that |
| 18:02:46 | <ray> | plus, i'm not really an emacs user |
| 18:02:58 | <ray> | and when i am, it's xemacs |
| 18:03:16 | <jmcarthur_work> | afaik, most emacs users are xemacs users |
| 18:03:16 | <fracture> | Baughn: mark a block, hit C-c C-c then C-u C-c C-c, and it still has a space in front of it |
| 18:03:33 | <ray> | i meet a lot more gnu emacs users |
| 18:03:37 | <fracture> | I've pretty much always used GNU emacs |
| 18:03:37 | <Baughn> | fracture: C-c C-c is undefined for me |
| 18:03:42 | <fracture> | oh ;) |
| 18:03:43 | <Baughn> | fracture: I use M-;, which is comment-dwim |
| 18:04:02 | <jmcarthur_work> | ray, oh, actually, i got confused. n/m :) |
| 18:04:18 | <fracture> | Baughn: how do you comment out a whole block? kb macro? |
| 18:04:21 | <ray> | oh, did you mean "x11 emacs"? |
| 18:04:24 | <jmcarthur_work> | yeah |
| 18:04:29 | <ray> | yeah, that's common |
| 18:04:35 | <ray> | but both of them have that |
| 18:04:38 | <Baughn> | fracture: Mark, move, M-; |
| 18:04:53 | <fracture> | hmm.. that just puts a -- at the eol for me |
| 18:04:54 | <jmcarthur_work> | right, i simply forgot that xemacs was a different thing |
| 18:05:30 | <Baughn> | fracture: Which version of haskell-mode are you using? The last release was /ages/ ago, but the cvs is somewhat more up to date |
| 18:05:39 | <jn_> | is there a better way to convert a character literal to Word8 than using w2c? |
| 18:05:43 | <jn_> | er.. c2w? |
| 18:05:53 | <fracture> | 2.4 |
| 18:06:01 | <fracture> | probably not cvs version |
| 18:06:14 | <Baughn> | jn_: Character literals are Unicode. Use ord. |
| 18:06:30 | <Baughn> | jn_: Then convert it however you feel like. There are utf-8 libraries around. |
| 18:06:44 | <Zao> | jn_: Feed it through utf8-string or Data.Text |
| 18:06:59 | <Baughn> | ..well, utf8-string is apparently part of GHC in 6.10.3 |
| 18:07:01 | <Zao> | I prefer the Data.Text way, as I can keep strings around in the Text type. |
| 18:09:39 | <glguy> | Baughn, it is? |
| 18:09:45 | <ray> | that was much easier than the debian packages |
| 18:10:05 | <jn_> | is there a way to get the newline string used for the current platform? |
| 18:10:12 | <Baughn> | glguy: Apparently, at least in the full distribution |
| 18:11:24 | <copumpkin> | @seen RyanT5000 |
| 18:11:25 | <lambdabot> | I saw RyanT5000 leaving #haskell-in-depth and #haskell 3h 49m 2s ago, and . |
| 18:17:28 | <jn_> | alternatively, can anyone tell me is Data.ByteString.lines will work properly on windows? the source indicates it's just using elemIndex '\n' as the search function |
| 18:17:36 | <ray> | huh. why did that ghc tarball install every .hi file as mode 600 |
| 18:17:36 | <jn_> | *if |
| 18:17:39 | <ray> | that's no good |
| 18:17:42 | <ray> | who do i complain to? |
| 18:18:53 | <fracture> | is there a set-style difference function for lists? |
| 18:19:12 | <copumpkin> | \\ ? |
| 18:19:23 | <byorgey> | > [1,2,3,4,5] \\ [3,5] |
| 18:19:25 | <lambdabot> | [1,2,4] |
| 18:19:29 | <byorgey> | but note: |
| 18:19:37 | <byorgey> | > [1,1,1,1] \\ [1,1] |
| 18:19:38 | <lambdabot> | [1,1] |
| 18:19:39 | <Zao> | http://haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html#v:\) |
| 18:19:58 | <fracture> | ah, thanks |
| 18:19:59 | <Zao> | It's only setlike if your list is setlike. |
| 18:24:54 | <mib_bgbyadx7> | hi! |
| 18:30:28 | <McManiaC> | @src signum :: Int |
| 18:30:29 | <lambdabot> | Source not found. |
| 18:30:42 | <McManiaC> | what is signum? |
| 18:30:58 | <kpreid> | @help src |
| 18:30:58 | <Baughn> | > signum 3 |
| 18:30:58 | <lambdabot> | src <id>. Display the implementation of a standard function |
| 18:31:00 | <lambdabot> | 1 |
| 18:31:03 | <Baughn> | > signum (-3) |
| 18:31:05 | <lambdabot> | -1 |
| 18:31:06 | <kpreid> | @src signum Int |
| 18:31:06 | <lambdabot> | Source not found. Take a stress pill and think things over. |
| 18:31:09 | <kpreid> | @src Int signum |
| 18:31:09 | <lambdabot> | Source not found. Do you think like you type? |
| 18:31:10 | <Baughn> | > signum 0 |
| 18:31:10 | <McManiaC> | ah okay |
| 18:31:11 | <lambdabot> | 0 |
| 18:31:14 | <kpreid> | I thought there was a way to do it... |
| 18:31:18 | <copumpkin> | @src signum |
| 18:31:18 | <lambdabot> | Source not found. I've seen penguins that can type better than that. |
| 18:31:21 | <Baughn> | @src Num Int |
| 18:31:22 | <lambdabot> | Source not found. You type like i drive. |
| 18:31:24 | <copumpkin> | I guess it doesn't have it :) |
| 18:31:28 | <kpreid> | McManiaC: http://en.wikipedia.org/wiki/Sign_function |
| 18:31:29 | <Baughn> | There is, and that's the way. Except.. |
| 18:31:30 | <Cale> | It's often written sgn in mathematics. |
| 18:31:55 | <davidL> | > map signum [-5,-4..5] |
| 18:31:56 | <lambdabot> | [-1,-1,-1,-1,-1,0,1,1,1,1,1] |
| 18:32:46 | <kpreid> | hmm |
| 18:32:49 | <kpreid> | > "•" |
| 18:32:50 | <lambdabot> | "\8226" |
| 18:32:59 | <kpreid> | @. read run "•" |
| 18:33:01 | <lambdabot> | " |
| 18:33:13 | <kpreid> | is there a way to get lambdabot to emit unicode? |
| 18:33:28 | <skorpan> | > ℵ |
| 18:33:29 | <lambdabot> | Not in scope: `ℵ' |
| 18:33:37 | <skorpan> | > let x = ℵ in x |
| 18:33:37 | <kpreid> | I mean, as computed by a program |
| 18:33:38 | <lambdabot> | Not in scope: `ℵ' |
| 18:33:45 | <skorpan> | > let x = ℵ :: Expr in x |
| 18:33:47 | <lambdabot> | Not in scope: `ℵ' |
| 18:33:51 | <skorpan> | dunno |
| 18:34:03 | <skorpan> | > let x = "ℵ" :: Expr in x |
| 18:34:03 | <kpreid> | @. read run "test" |
| 18:34:04 | <lambdabot> | Couldn't match expected type `SimpleReflect.Expr' |
| 18:34:05 | <lambdabot> | test |
| 18:34:06 | <skorpan> | > let x = "ℵ" in x |
| 18:34:07 | <lambdabot> | "\8501" |
| 18:34:14 | <kpreid> | @. read run "tést" |
| 18:34:15 | <lambdabot> | tést |
| 18:34:20 | <kpreid> | ew, latin1 |
| 18:35:59 | <cayennext> | How to put \ (ASCII lambda) into string? I am trying to write a parser for a language with lambdas and having \ symbol would be nice. |
| 18:36:08 | <kpreid> | "\\" |
| 18:36:21 | <cayennext> | it's just "\\", not "\" |
| 18:36:38 | <kpreid> | no, that's how you escape the backslash |
| 18:36:41 | <kpreid> | > length "\\" |
| 18:36:43 | <lambdabot> | 1 |
| 18:36:57 | <cayennext> | and not only in repl, also while parsing "\\" doesn't work |
| 18:37:05 | <kpreid> | then you're doing something else wrong |
| 18:37:50 | <ray> | > '\\' |
| 18:37:51 | <lambdabot> | '\\' |
| 18:37:56 | <ray> | see, it's a single character |
| 18:38:26 | <cayennext> | okay, so I have something else scewd up |
| 18:40:28 | <cayennext> | fixed. I tested parser in repl too: "\ x -> x + x", I should have used: "\\ x -> x + x" |
| 18:53:42 | <Phyx-> | Good evening, Quick question, if i have a class class La m a where make :: m a |
| 18:53:44 | <Phyx-> | " |
| 18:53:59 | <Phyx-> | how would one go about making an implementation for say Int |
| 18:54:16 | <copumpkin> | Int and what? |
| 18:54:26 | <EvilTerran> | Phyx-, er, that class has two parameters, you can't make an instance for just Int |
| 18:54:48 | <Phyx-> | i thought the same |
| 18:54:52 | <Phyx-> | but |
| 18:55:00 | <Phyx-> | hm |
| 18:55:19 | <Phyx-> | Oic |
| 18:55:27 | <Phyx-> | stupid question |
| 18:55:34 | <Phyx-> | pardon my lack of caffeine |
| 18:59:02 | <hackagebot> | random-fu 0.0.2.0 |
| 19:01:27 | <ksf> | can anyone provide me with links about turing-completeness wrt. frp? |
| 19:02:17 | <Baughn> | ksf: FRP? Reactive programming? |
| 19:02:37 | <ksf> | yeah |
| 19:02:44 | <pejo> | ksf, can't you make a singal function that is a loop to itself, thereby giving non-termination? |
| 19:03:14 | <Baughn> | ksf: I suppose you should ask conal, but.. turing-completeness? Seriously? |
| 19:03:28 | <Zao> | Aren't there latching and whatnot to avoid looping circuits? |
| 19:03:28 | <Baughn> | pejo: That's not turing-completeness, though. ^^; |
| 19:04:17 | <Baughn> | ksf: Considering accumE and whatnot, it wouldn't be very hard at all |
| 19:05:10 | <ksf> | well, ooh you want feedback loops as they make sense, otoh, turing completeness sucks if you're serving content to people who don't trust you, or choose not to. |
| 19:06:27 | <pejo> | ksf, there's a paper by Sculthorpe and Nilsson for ICFP this year about using Agda for some safety properties. |
| 19:06:38 | <ksf> | "non-terminating xml' makes me shudder. |
| 19:07:30 | <te> | so do your quotes |
| 19:09:05 | <Cale> | ksf: Who you don't trust, rather. |
| 19:09:35 | <Cale> | Or, you mean your viewers will be unhappy if one of your programs runs forever? |
| 19:10:12 | <ksf> | I've spend the day looking into web technologies, thinking about guis, but the only reasonable thing that i found is laszlo, and even they don't use their frp stuff for most of the coding. |
| 19:10:32 | <ksf> | Cale, I don't trust myself, by default, so it's fine. |
| 19:12:25 | <ksf> | running forever isn't the problem, user input is codata. |
| 19:13:41 | <Cale> | ksf: There's an interesting FRP language designed to be compiled to Javascript called Flapjax. |
| 19:14:59 | <Cale> | ksf: I'm not sure exactly how practical it is, or if anyone is actually using it, but it seems to work. |
| 19:16:06 | <ksf> | Nah, I just mentioned web 'cos most of the stuff there is declerative, not because I'm particularly focused on web or want to run stuff inside a browser. It's more like guaranteeing well-behavedness of your desktop. |
| 19:16:28 | <ksf> | ...as experience goes, firefox can make focus switches loop endlessly. |
| 19:19:47 | <hatds> | http://www.haskell.org/haskellwiki/Data_declaration_with_constraint is mistaken? |
| 19:20:05 | <hatds> | data Foo a = Class a => Foo a will bake the class constraint into the type |
| 19:20:25 | <mauke> | is that even valid? |
| 19:20:30 | <copumpkin> | I didn't think so |
| 19:20:39 | <hatds> | yes, it is valid |
| 19:20:44 | <hatds> | at least on my ghc :) |
| 19:20:50 | <mauke> | not in H98 |
| 19:21:23 | <Ferdirand> | but it will propagate the type constraint everywhere you use it, not make it implicit, iirc |
| 19:21:25 | <copumpkin> | it seems odd, that would imply only having the constraint on one constructor (if you had more than one)? |
| 19:21:37 | <Saizan_> | in ghc it's similar to an existential type, since the typeclass dictionary will be stored in the constructor |
| 19:21:53 | <hatds> | Ferdirand: no, it will only propagate the constraint to constructors, not functions involving Foo |
| 19:21:54 | <mauke> | copumpkin: that's what it does |
| 19:21:54 | <Saizan_> | Ferdirand: it'll be implicit with that form |
| 19:22:07 | <Ferdirand> | oh ? nice |
| 19:22:28 | <hatds> | yes, I think you have to enable existentials, but note that 'a' is visibile, not existentially qualified |
| 19:22:31 | <Cale> | You can put class constraints on data declarations in H98, but they don't do much. They only restrict the data constructor's type. The typing rule for case/pattern matching doesn't change. |
| 19:22:37 | <ksf> | pejo, thanks, that's exactly the kind of stuff I was looking for |
| 19:22:53 | <Saizan_> | i.e. "data Foo a = Show a => Foo a; foo :: Foo a -> String; foo (Foo a) = show a" will typecheck. |
| 19:22:54 | <Cale> | So there's essentially no point in doing so. |
| 19:23:00 | <hatds> | Cale: It is different than Class a => data Foo a = Foo a |
| 19:23:12 | <Baughn> | @tell conal You should rename makeClock to getClock, or otherwise make it clear that you get the same clock every time |
| 19:23:13 | <lambdabot> | Consider it noted. |
| 19:23:26 | <Cale> | What? |
| 19:23:36 | <Cale> | hatds: That isn't valid syntax... |
| 19:23:46 | <hatds> | Cale: it is on my ghc |
| 19:23:51 | <mauke> | hatds: no |
| 19:23:55 | <Cale> | uhhh... |
| 19:23:58 | <Saizan_> | "data Class a => Foo a = Foo a" |
| 19:24:02 | <hatds> | no |
| 19:24:03 | <Saizan_> | you mean, right? |
| 19:24:03 | <pejo> | ksf, I think the code is available on some webpage. |
| 19:24:08 | <hatds> | "Class a => data Foo a = Foo a" |
| 19:24:14 | <hatds> | that's the H98 way |
| 19:24:18 | <mauke> | hatds: no |
| 19:24:19 | <Cale> | no, it isn't. |
| 19:24:26 | <te> | cant wait to get the haskell school of expression |
| 19:24:31 | <hatds> | the other way is: "data Foo a = Class a => Foo a" |
| 19:24:37 | <mauke> | hatds: HELLO |
| 19:24:40 | <Cale> | That is also invalid. |
| 19:24:52 | <te> | Anyone else here read the Haskell School of Expression? |
| 19:24:54 | <Cale> | Have you tried either of those? |
| 19:24:57 | <hatds> | lemme check my source file where I did this |
| 19:25:29 | <roconnor> | data (Class a) => Foo = Foo a -- This is legal, but doesn't do what you wish it to. |
| 19:25:39 | <mauke> | hatds: you could just look at the wiki page |
| 19:25:47 | <roconnor> | data (Class a) => Foo a = Foo a -- This is legal, but doesn't do what you wish it to. |
| 19:25:56 | <hatds> | roconnor: that's not what I said :) |
| 19:26:01 | <hatds> | one sec, found it |
| 19:26:13 | <Cale> | In recent versions of GHC, you can use the GADT syntax to restrict the data constructor's type, and when you do that it really does change the typing rule for pattern matching |
| 19:26:21 | <Cale> | data Foo a where |
| 19:26:30 | <Cale> | Foo :: (Class a) => a -> Foo a |
| 19:27:05 | <Saizan_> | and data Foo a = Class a => Foo a is the same without gadt syntax |
| 19:27:10 | <Cale> | This will indeed store a class dictionary for Class along with every Foo value. |
| 19:27:19 | <Saizan_> | i've never seen the form with Class a => at the start, though |
| 19:27:26 | <hatds> | @where hpaste |
| 19:27:27 | <lambdabot> | http://hpaste.org/ |
| 19:27:41 | <povman> | If I'm writing a C library, I can declare a symbol as external and get the library user to implement it - is there a haskell version of external? |
| 19:27:50 | <Cale> | Saizan_: errr... are you sure that's valid? |
| 19:28:00 | <Cale> | Saizan_: If it is, I'm pretty sure it needs extensions |
| 19:28:15 | <mmorrow> | Baughn: woo isEvaluated :) |
| 19:28:39 | <hatds> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5322#a5322 |
| 19:28:40 | <Cale> | Yeah, it works with ExistentialQuantification or GADTs turned on |
| 19:28:51 | <mauke> | povman: AFAIK no |
| 19:28:54 | <Saizan_> | Cale: it's an extension to h98, not sure if it needs a flag, we opened a ticket for it some time ago |
| 19:28:57 | <hatds> | yea, GADTs is turned on |
| 19:29:21 | <Cale> | hatds: I don't see any of the syntax you were proposing though... |
| 19:29:45 | <hatds> | lines 30 vs 31 |
| 19:29:47 | <Saizan_> | hatds: right, you have "data Class a => Type a = .." not "Class a => data Type a = .." |
| 19:29:53 | <povman> | mauke: :'( thanks, sob |
| 19:30:07 | <mle> | povman: there may be a better approach, depending on what you are trying to do? |
| 19:30:12 | <Baughn> | mmorrow: Now, if only hello, world wasn't 26MB. :) |
| 19:30:30 | <povman> | mle: I'm trying to write a nice wrapper around libsdl's stupidity |
| 19:30:31 | <mmorrow> | Baughn: if you're into it you might find it interesting to mess around with vacuumLazy. currently (i've only tested in ghci so far) THUNKs don't seem to ever be updated (although this might be ghci reverting CAFs??), and if you follow any of the ptrs in a THUNK a swift segfault awaits :/ |
| 19:30:42 | <mmorrow> | Baughn: :o |
| 19:30:52 | <Saizan_> | hatds: i.e. in no place you've the class right at the start like you said some lines ago |
| 19:30:52 | <byorgey> | povman: you could make a type class with no instances. |
| 19:31:07 | <mmorrow> | Baughn: i did a test of a (trivial helloWorld) and it was around 7MB (unstripped) |
| 19:31:07 | <byorgey> | and then write functions polymorphic over that type class. |
| 19:31:12 | <hatds> | Saizan: does that work? If you have __ data Foo a = ___ Foo a I've only tried putting the class constraint in the underscores (the latter requiring GADTs it seems) |
| 19:31:19 | <nopsledX> | Newbie problem: Getting "Non type-variable argument in the constraint: Data () (Use -XFlexibleContexts to permit this) ... when loading a program with ghci |
| 19:31:29 | <mle> | povman: well, what sort of thing would you normally be referencing with extern? |
| 19:31:39 | <Cale> | hatds: data always has to come at the start of a declaration |
| 19:31:48 | <Cale> | hatds: You can never put something before it. |
| 19:31:54 | <hatds> | I hpasted and it works on my ghc :/ |
| 19:31:55 | <Baughn> | mmorrow: Yes.. hmm, mine shrank too. I wond.. ah, it's because I didn't rebuild reactive earlier. It was still pulling in ghc. |
| 19:32:11 | <byorgey> | nopsledX: can you paste the code somewhere (e.g. hpaste.org)? |
| 19:32:15 | <Cale> | hatds: There's nothing in your file which looks like (Class a) => data ... |
| 19:32:36 | <povman> | mle: I want to define main in the library, and make users of the library define sdlMain which is called by that |
| 19:32:36 | <mmorrow> | Baughn: phew, you scared me for a second there |
| 19:32:40 | <Saizan_> | hatds: (1) data (2) Foo a = (3) Foo a, in your paste you have the class constraint in (2) and (3) and indeed both are valid syntax with extensions, but in no place you've the constraint on (1) and in fact it doesn't parse |
| 19:32:43 | <hatds> | Cale: ah right |
| 19:32:53 | <povman> | byorgey: Hello, what did you mean by that? |
| 19:33:03 | <hatds> | Cale: sorry, I was misrecalling the "useless" way |
| 19:33:17 | <mle> | povman: OpenGL has a different example of that, I think... and even networking on windows has initialization details |
| 19:33:21 | <Saizan_> | you weren't reading what we were writing :P |
| 19:33:25 | <roconnor> | @bab en nl France |
| 19:33:25 | <lambdabot> | Plugin `babel' failed with: Prelude.head: empty list |
| 19:33:36 | <povman> | mle: but libSDL on mac and windows defines its own main() |
| 19:33:37 | <Cale> | But even so, the data Foo a = Class a => Foo a syntax is strange. If you're going to do that, use the GADT syntax. |
| 19:33:44 | <mle> | povman: why not just make a withSDL :: IO () -> IO () ... oh |
| 19:33:47 | <mle> | povman: madness! |
| 19:33:57 | <byorgey> | povman: actually, on second thought, maybe that wouldn't work |
| 19:33:58 | <povman> | it's ridiculous |
| 19:34:07 | <Cale> | (In fact, I prefer the GADT syntax for all existentials) |
| 19:34:10 | <mle> | povman: fork and patch! |
| 19:34:14 | <povman> | I want to cry and then yell at the libsdl maintainers |
| 19:34:25 | <hatds> | Cale: It only bakes in the class constraint without hiding 'a', so yes it doesn't buy you much |
| 19:34:32 | <byorgey> | a library which defines main() is pretty whack |
| 19:34:38 | <Cale> | hatds: No, that one works. |
| 19:34:51 | <hatds> | Cale: what one? |
| 19:34:54 | <Cale> | data Foo a = Class a => Foo a |
| 19:35:04 | <hatds> | yes |
| 19:35:11 | <hatds> | that's the one I was referring to |
| 19:35:12 | <povman> | byorgey: Out of curiosity... what did you mean by the typeclass thing? |
| 19:35:35 | <Cale> | That one will store a dictionary for Class along with each value, which will be unpacked and used when pattern matching. |
| 19:35:43 | <byorgey> | povman: I meant, you could make a typeclass with (say) a single method, representing the function you wanted users of the library to implement |
| 19:35:46 | <hatds> | that's what I've been saying |
| 19:35:48 | <hatds> | :( |
| 19:36:06 | <Cale> | it's the data Class a => Foo a = Foo a one which is Haskell 98, and it's useless. |
| 19:36:18 | <hatds> | yes, as I've been saying |
| 19:36:18 | <mmorrow> | byorgey: like class Main a where main :: IO a -- ??? |
| 19:36:23 | <mmorrow> | ::) |
| 19:36:25 | <Cale> | (sort of) |
| 19:36:27 | <hatds> | I just misrecalled the syntax for the useless/H98 one |
| 19:36:32 | <byorgey> | something like that |
| 19:36:47 | <byorgey> | I no longer think this would actually help, but that's what I meant =) |
| 19:37:03 | <Cale> | But I would never write data Foo a = Class a => Foo a anyway. If you're going to use GADTs, you might as well use the GADT syntax :) |
| 19:37:12 | <mmorrow> | i wonder if ghc would disapprove of a Main class... |
| 19:37:26 | <Cale> | data Foo a where Foo :: Class a => a -> Foo a |
| 19:38:18 | <hatds> | that's the same thing |
| 19:38:23 | <hatds> | ? |
| 19:38:43 | <Cale> | yeah |
| 19:39:09 | <Muzzleflash> | Is there a way to run a :cd command on ghci startup? It's getting pretty tiresome to do it on every start. |
| 19:39:25 | <Muzzleflash> | I've tried looking for the .ghci file, however I can't find it |
| 19:39:26 | <Cale> | Muzzleflash: add it to your .ghci |
| 19:39:29 | <mauke> | put it in ~/.ghci |
| 19:39:32 | <Cale> | Create one then. |
| 19:40:02 | <Muzzleflash> | In ghc-x.xx.x folder right? or bin? |
| 19:40:10 | <mmorrow> | touch ~/.ghci |
| 19:40:13 | <Cale> | In your home directory. |
| 19:40:23 | <Cale> | Uh, on windows, I'm not sure what that is. |
| 19:40:30 | <Muzzleflash> | Vista 64 bit |
| 19:40:41 | <Cale> | ACTION has not used windows since Win 98. |
| 19:41:03 | <te> | i have, to play left for dead and use a keygen |
| 19:41:08 | <te> | other than that, no |
| 19:41:40 | <Peaker> | Windows homedir I think is (Documents And Settings/<user name>) or perhaps another /Application Data sometimes |
| 19:41:52 | <Cale> | Hmm... |
| 19:41:58 | <p_l> | Homedir on windows depends on the user |
| 19:42:07 | <te> | "Documents and Settings" |
| 19:42:10 | <Cale> | ACTION looks in the GHC User's Guide |
| 19:42:12 | <te> | how terrible is that description |
| 19:42:36 | <Cale> | # |
| 19:42:36 | <Cale> | appdata/ghc/ghci.conf, where appdata depends on your system, but is usually something like C:/Documents and Settings/user/Application Data |
| 19:42:36 | <p_l> | default on NT5.x is <systemdisk>:\Documents and Settings\<username> |
| 19:43:24 | <p_l> | on NT <5 the default is <systemdisk>:\<systemdir>\profiles\<username> |
| 19:43:35 | <Muzzleflash> | I've checked there, just assumed ghc made a folder thre |
| 19:43:40 | <p_l> | On NT6.x it's <Systemdisk>:\Users\<username> |
| 19:43:40 | <Saizan_> | you can use the system variable %AppData% to tell. |
| 19:44:24 | <Saizan_> | 6 is vista? |
| 19:45:15 | <Muzzleflash> | Okay. It works using: %AppData%\ghc\ghci.conf |
| 19:45:21 | <Muzzleflash> | The folder had to be created |
| 19:45:47 | <Muzzleflash> | On Vista %appdata% is: C:\Users\THE_USERNAME\AppData\Roaming |
| 19:46:01 | <Muzzleflash> | thanks for the help |
| 19:47:14 | <Baughn> | ACTION strives to create the longest import list known to man |
| 19:50:12 | <Peaker> | Baughn: how's the unamb stuff going? |
| 19:51:09 | <Botje> | Baughn: we totally need a "KitchenSink" meta-pacakge |
| 19:51:17 | <Botje> | that just includes every library on hackage |
| 19:51:38 | <mmorrow> | hehe |
| 19:51:40 | <mmorrow> | ghci> closureType CONSTR_NOCAF_STATIC |
| 19:51:40 | <mmorrow> | CONSTR_NOCAF_STATIC |
| 19:52:24 | <RayNbow> | hmm, SPJ has posted something on a new TH feature |
| 19:52:31 | <RayNbow> | *on -> about |
| 19:52:40 | <mmorrow> | ooh |
| 19:52:44 | <Saizan_> | link? |
| 19:52:58 | <RayNbow> | http://www.haskell.org/pipermail/haskell-cafe/2009-May/061989.html |
| 19:53:34 | <GrayShade> | did anyone recently fix a bug in ghci on windows 7 and, maybe, vista? |
| 19:54:05 | <GrayShade> | nevermind, I'll download a snapshot |
| 19:54:28 | <Botje> | SPJ should create a twitter account |
| 19:54:40 | <mmorrow> | holy crap, type splices! |
| 19:54:40 | <Botje> | "woke up today. had breakfast. revolutionarized functional programming" |
| 19:55:14 | <pejo> | Botje, the big names are really much more down to earth than that. |
| 19:57:28 | <Baughn> | Peaker: Okay, that's /one/ reactive bug down. Just needed a finalizer.. |
| 19:57:50 | <Peaker> | Baughn: so you submitted it all to conal's cabalization? :) |
| 19:57:56 | <Cale> | Sometimes I've thought it would be cool if SPJ was on IRC, but it's probably for the best that he isn't. :) |
| 19:58:16 | <patogen> | Where do I find info on how to use matrices in haskell? |
| 19:58:36 | <Peaker> | I wonder if SPJ will mind if I use his slides "Taste of Haskell" |
| 19:58:41 | <Cale> | patogen: There are some matrix libraries like hmatrix which are reasonably well-documented. |
| 19:59:00 | <Cale> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmatrix |
| 19:59:33 | <patogen> | Cale: thank you |
| 19:59:48 | <Baughn> | Peaker: I'll make sure it works first. :) |
| 20:00:01 | <RayNbow> | Botje: go convince SPJ... right now! :p |
| 20:00:24 | <Peaker> | Baughn: don't make sure it works forever :) |
| 20:01:14 | <Baughn> | Peaker: Heh. Actually, my current headache is Never. |
| 20:01:41 | <Peaker> | Baughn: I mean -- your current version is already better than existing unamb -- just release it, and if you improve it further, release again |
| 20:01:52 | <Baughn> | Peaker: Oh, I've handed Conal the code for unamb |
| 20:02:06 | <Baughn> | And released isEvaluated as a separate package |
| 20:02:18 | <Baughn> | I'm not about to release an update of Unamb, though. :P |
| 20:02:52 | <Baughn> | @index finalizer |
| 20:02:52 | <lambdabot> | bzzt |
| 20:02:57 | <Baughn> | @hoogle finalizer |
| 20:02:57 | <lambdabot> | Foreign.ForeignPtr type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> IO ()) |
| 20:02:58 | <lambdabot> | Foreign.Marshal.Alloc finalizerFree :: FinalizerPtr a |
| 20:02:58 | <lambdabot> | Foreign.ForeignPtr type FinalizerPtr a = FunPtr (Ptr a -> IO ()) |
| 20:03:16 | <Cale> | What would be really funny is if we found out that BONUS was SPJ's alter-ego. |
| 20:03:42 | <RayNbow> | :D |
| 20:04:03 | <Baughn> | "addFinalizer :: key -> IO () -> IO ()" <-- Yay! |
| 20:04:21 | <RayNbow> | @check SPJ == BONUS |
| 20:04:23 | <lambdabot> | Not in scope: data constructor `SPJ'Not in scope: data constructor `BONUS' |
| 20:04:27 | <RayNbow> | aww... |
| 20:04:29 | <malosh> | Hi. I'm confused about how the FFI was intended to be used, especially with marshalling : if I want to marshal a record to a C struct back and forth, do I really have to realloc my C struct each time I want to call a C function on my record type ? |
| 20:04:53 | <mauke> | what do you mean by "realloc"? |
| 20:05:09 | <wunki> | i'm getting this error when trying to install GHC in freebsd: http://haskell.pastebin.com/m4a7103d . Can someone point me in some direction? |
| 20:05:10 | <malosh> | alloca (\ptr->poke etc.) |
| 20:05:38 | <mauke> | well, you can also not use alloca and store the pointer somewhere |
| 20:06:03 | <malosh> | Anything else I've tried seem to make the garbage collector an enemy |
| 20:06:08 | <Zooix> | Hi all |
| 20:06:21 | <eivuokko> | malosh, Huh? What did you try? |
| 20:06:28 | <malosh> | my question was more about what good c binders usually do |
| 20:06:50 | <malosh> | eivuokko : putting a foreignptr as a field |
| 20:06:52 | <mauke> | I'd allocate a new pointer each time |
| 20:06:53 | <malosh> | for instance |
| 20:06:58 | <eivuokko> | malosh, alloca is fine pretty often, caching serialised structures isn't that much of a win usually. |
| 20:06:59 | <Coko|Raptor> | Can someone help me work out what I am doing wrong. I am trying to take a tree that either has a value, or a value with two trees. Then I need a function to find the minimum value in the tree |
| 20:07:03 | <Coko|Raptor> | i did the following |
| 20:07:05 | <Coko|Raptor> | data Tree = Node Int (Tree) (Tree) | Leaf Int |
| 20:07:05 | <Coko|Raptor> | minimum :: Tree -> Int |
| 20:07:05 | <Coko|Raptor> | minimum Node x left right = min x min (minimum (left) minimum (right)) |
| 20:07:06 | <Coko|Raptor> | minimum Leaf x = x |
| 20:07:17 | <eivuokko> | malosh, What do you mean "a field"? |
| 20:07:18 | <Zooix> | I've a problem on this code : http://pastebin.com/d75fc95f4 |
| 20:07:22 | <malosh> | of the record |
| 20:07:25 | <Coko|Raptor> | it moans at me though :s |
| 20:07:26 | <eivuokko> | malosh, Ah. |
| 20:07:28 | <kpreid> | Coko|Raptor: your problem is "min x min", this isn't Logo :) |
| 20:07:32 | <mauke> | Coko|Raptor: missing parens |
| 20:07:35 | <kpreid> | Coko|Raptor: min x (min ...) |
| 20:07:35 | <Coko|Raptor> | ok |
| 20:07:43 | <Botje> | Zooix: what error are you getting? |
| 20:07:53 | <malosh> | cause I like the syntax defaultRecord {field=value, otherOne=otherValue} |
| 20:08:00 | <Zooix> | No sorry wait a second |
| 20:08:06 | <Zooix> | I think it's an indentation error |
| 20:08:22 | <malosh> | mauke, eivuokko : thanks |
| 20:08:47 | <eivuokko> | malosh, Hmm. Well, it's hard to give generic advice what do with c structures that refer to other c structures via pointers. It varies a lot. |
| 20:08:47 | <Botje> | Zooix: a possibility. Try to avoid mixing tabs and spaces in haskell code or even avoid tabs outright |
| 20:09:03 | <Zooix> | yes I know, I don't use them ;) but thnaks |
| 20:09:05 | <Coko|Raptor> | kpreid: changed to min x (min minimum(left) minimum(right)) but it is still complaining :S |
| 20:09:15 | <kpreid> | you can't use parens like that |
| 20:09:26 | <Coko|Raptor> | ok |
| 20:09:30 | <kpreid> | that's applying min to minimum, eft, minimum, right |
| 20:09:35 | <Coko|Raptor> | oh ok |
| 20:09:42 | <kpreid> | min x (min (minimum left) (minimum right)) |
| 20:10:42 | <Zooix> | On this code, I've a parse error at line 10 |
| 20:10:42 | <Zooix> | http://pastebin.com/d41b6987d |
| 20:11:20 | <mauke> | Zooix: needs more indentation |
| 20:11:31 | <Botje> | at least past the case |
| 20:11:34 | <kpreid> | It does? |
| 20:11:35 | <Zooix> | Sorry I'm bad in English |
| 20:11:38 | <Coko|Raptor> | kpreid: Equation gives different arities for "minimum" |
| 20:11:38 | <Coko|Raptor> | :s |
| 20:11:44 | <Zooix> | does it means that I've to add more spaces ? |
| 20:11:48 | <Cale> | yeah |
| 20:11:50 | <Botje> | yes |
| 20:11:53 | <Zooix> | ok thanks |
| 20:11:58 | <Botje> | the '+' has to come past the case |
| 20:11:59 | <kpreid> | Coko|Raptor: Oh. minimum (Node x left right) = ... and so on |
| 20:12:02 | <Cale> | The problem is that the '+' lines up with the other lines in the 'where', so it's a new line in the 'where' clause |
| 20:12:17 | <kpreid> | Coko|Raptor: it's the same rule: to apply something inside of an arg you have to put parens around it |
| 20:12:17 | <Botje> | Zooix: also, you can put the parse input (op a b : stack) on a new line |
| 20:12:18 | <mauke> | Botje: no |
| 20:12:26 | <Botje> | that way you don't need outrageous amounts of indentation :) |
| 20:12:37 | <mauke> | Botje: the '+' just has to be more indented than 'op' |
| 20:12:46 | <Botje> | ah. |
| 20:12:53 | <Zooix> | Thanks it works |
| 20:12:54 | <kpreid> | Coko|Raptor: In Haskell, a b c = (a b) c, not a (b c) |
| 20:13:00 | <Zooix> | I've just another problem |
| 20:13:01 | <mauke> | which is easily done by moving the 'where' all the way left |
| 20:13:03 | <Cale> | The 'where' is part of the 'parseOp' and not the expression 'parse input ...', so it doesn't need to be indented so much |
| 20:13:08 | <Zooix> | CHar.ord is not in scope |
| 20:13:09 | <Coko|Raptor> | oh ok |
| 20:13:26 | <mauke> | Zooix: import Data.Char (and remove the "Char." part) |
| 20:13:59 | <Zooix> | Omg, I've forgotten it :s |
| 20:14:11 | <Baughn> | In a weak-reference finalizer, can I use the key of the reference? How about the value? |
| 20:14:41 | <Coko|Raptor> | kpreid: another problem :S Ambiguous variable occurrence "minimum" |
| 20:15:12 | <Zooix> | Still a proble with "convertToInt x = ord x - ord "0" " |
| 20:15:17 | <mauke> | Coko|Raptor: yeah, we already have a function called "minimum" |
| 20:15:23 | <Coko|Raptor> | mauke: ah! :) |
| 20:15:29 | <mauke> | Zooix: you want '0', not "0" |
| 20:15:35 | <kpreid> | @src minimum |
| 20:15:35 | <lambdabot> | minimum [] = undefined |
| 20:15:35 | <lambdabot> | minimum xs = foldl1 min xs |
| 20:15:38 | <kpreid> | @where minimum |
| 20:15:38 | <lambdabot> | I know nothing about minimum. |
| 20:15:46 | <Twey> | > minimum [] |
| 20:15:46 | <mauke> | actually, we have that function too |
| 20:15:47 | <lambdabot> | * Exception: Prelude.minimum: empty list |
| 20:15:52 | <Twey> | Lies |
| 20:15:57 | <mauke> | > digitToInt '0' |
| 20:15:59 | <lambdabot> | 0 |
| 20:16:02 | <mauke> | > digitToInt '9' |
| 20:16:03 | <lambdabot> | 9 |
| 20:16:48 | <Zooix> | thank tou very much guys |
| 20:17:00 | <Zooix> | you* |
| 20:17:01 | <Zooix> | bye |
| 20:17:35 | <mauke> | parseNumber input stack = case reads input of [(n, xs)] -> parse xs (n : stack); _ -> parse input stack |
| 20:17:42 | <mauke> | enjoy your infinite loops |
| 20:32:25 | <Peaker> | Hmm.. We have Data.Binary.Get for nice binary deserialization of byte strings -- what do we have around reads/et al? |
| 20:32:31 | <Peaker> | only parsec? |
| 20:33:04 | <Peaker> | reads is ambiguous - so I guess an undeterministic parser like parsec is needed :( |
| 20:34:18 | <kniu> | What, exactly, are functors? |
| 20:34:35 | <kniu> | I hear them mentioned all over the place, and yet I still have no clue. |
| 20:34:36 | <seliopou> | BOOM loaded question |
| 20:34:43 | <seliopou> | in the context of Haskell? |
| 20:34:46 | <kniu> | sure |
| 20:34:58 | <seliopou> | Do you know what a type class is? |
| 20:35:05 | <kniu> | yeah |
| 20:35:37 | <kpreid> | @src Functor |
| 20:35:37 | <lambdabot> | class Functor f where |
| 20:35:38 | <lambdabot> | fmap :: (a -> b) -> f a -> f b |
| 20:35:43 | <seliopou> | Functor's just a type class for type constructors that you can "map" over |
| 20:36:01 | <kpreid> | that's every functor |
| 20:36:06 | <kpreid> | > fmap (+1) [1,2,3] |
| 20:36:07 | <lambdabot> | [2,3,4] |
| 20:36:09 | <seliopou> | so for instance "List" ([]) is a Functor, and fmap = map |
| 20:36:10 | <kpreid> | > fmap (+1) (Just 99) |
| 20:36:11 | <lambdabot> | Just 100 |
| 20:36:43 | <kniu> | huh |
| 20:36:47 | <seliopou> | get it? |
| 20:36:48 | <kniu> | I get it now. |
| 20:37:25 | <marcot> | Hello, is there a getArgs function that returns ByteString? |
| 20:37:42 | <byorgey> | @seen dmwit |
| 20:37:43 | <lambdabot> | dmwit is in #xmonad, #haskell-in-depth and #haskell. I last heard dmwit speak 9m 55s ago. |
| 20:37:52 | <Jedai> | marcot: fmap (map pack) getArgs |
| 20:37:55 | <Twey> | marcot: If your args are big enough to require it, they shouldn't be args |
| 20:38:16 | <Jedai> | marcot: given the average size of args, you don't need ByteString for them |
| 20:38:21 | <marcot> | Ok, the problem is not about performance, is just about importing both ByteString and String functions. |
| 20:38:28 | <marcot> | I'd prefer to import Prelude hiding (...) |
| 20:38:47 | <marcot> | But this was a good answer to my question. |
| 20:38:59 | <Twey> | You can, as Jedai said, just use pack |
| 20:39:10 | <Peaker> | conal: no idea about the QuickCheck stuff -- I guess it just needs to be researched what happened to that QC functionality more carefully |
| 20:39:25 | <conal> | Peaker: ok. thx. |
| 20:39:25 | <lambdabot> | conal: You have 1 new message. '/msg lambdabot @messages' to read it. |
| 20:39:31 | <Twey> | import qualified Prelude; import Prelude hiding (getArgs); getArgs = fmap (fmap pack) Prelude.getArgs |
| 20:40:28 | <Jedai> | Twey: getArgs is not in the Prelude |
| 20:40:48 | <Twey> | So it isn't |
| 20:40:53 | <Twey> | System, then |
| 20:41:03 | <conal> | Baughn: is your tweaked Unamb all in one place now? i can play with it and push a new version. |
| 20:41:13 | <conal> | (to hackage) |
| 20:42:01 | <Baughn> | conal: Hm? Yes, the last version I gave you should be fine |
| 20:42:10 | <Baughn> | conal: Eh, I'll paste a new just to be sure. |
| 20:42:30 | <conal> | Baughn: thx. |
| 20:42:33 | <Baughn> | conal: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5323#a5323 |
| 20:42:36 | <conal> | :) |
| 20:43:04 | <Baughn> | conal: I've commented out isEvaluated. It'd probably be safe to leave those in, but I'm leery of doing so without thorough testing - it's another thing that can go wrong. |
| 20:43:16 | <conal> | Baughn: sure. |
| 20:43:35 | <Baughn> | conal: So the plan is to fix reactive (working on makeEvent at the moment), get some neat programs written, and /then/ turn it on for the performance boost and testing |
| 20:43:38 | <vininim> | we can't lift here, this is ap country. |
| 20:43:54 | <Baughn> | vininim: Ah, but applicative is a subclass of functor |
| 20:43:59 | <conal> | Baughn: sounds great to me |
| 20:44:54 | <vininim> | Baughn: fear and loathing in las vegas reference. =P |
| 20:45:55 | <Baughn> | conal: Considering that event sources may /end/, I can't use listSink. Will any other function work to lazily create events? atTimes, perhaps? |
| 20:46:15 | <mmorrow> | vininim: :) |
| 20:46:42 | <Baughn> | conal: (I'm sticking a finalizer on the sink, and additionally intend to add an explicit makeEvent-killing function people can use |
| 20:47:42 | <conal> | Baughn: can't use listSink? |
| 20:47:57 | <conal> | Baughn: glad to hear that you're thinking about finalizers. |
| 20:48:17 | <siki> | Hi! Quick question from a noob: if I have a function that is in the IO monad, e.g. foo :: IO (Int) and a type, e.g. type Blah = Blah Int how do I make this work? foo >>= Blah |
| 20:48:18 | <siki> | ? |
| 20:48:29 | <hackagebot> | explicit-sharing 0.3.1 |
| 20:48:43 | <siki> | basically I want to call "foo" and initialize the type "Blah" with its return value |
| 20:48:53 | <mauke> | type Blah = Blah Int is a syntax error |
| 20:49:03 | <conal> | Baughn: mind if i add your name (from isevaluated.cabal) to the credits for unamb and reactive? |
| 20:49:05 | <Baughn> | conal: Er, make that futureStreamE; I was mixing them up. |
| 20:49:11 | <siki> | sorry, it should've been data Blah = Blah Int |
| 20:49:12 | <Baughn> | conal: Not at all. :) |
| 20:49:28 | <conal> | cool. i appreciate the help, and so will others. :) |
| 20:49:30 | <mauke> | siki: foo >>= \x -> return (Blah x) |
| 20:49:37 | <Baughn> | conal: Specifically, I can't use a /stream/ |
| 20:49:52 | <jmcarthur_work> | siki, the function you are after has type IO Int -> IO Blah. there is a way to create such a function :) |
| 20:49:56 | <conal> | Baughn: oh. |
| 20:49:58 | <Baughn> | conal: Oh, but I guess listEG is what I want |
| 20:50:09 | <mauke> | siki: which is also known as fmap Blah foo |
| 20:50:11 | <jmcarthur_work> | siki, if we look at Blah, we see that it has type Int -> Blah |
| 20:50:18 | <jmcarthur_work> | and if we look at fmap... |
| 20:50:19 | <jmcarthur_work> | :t fmap |
| 20:50:20 | <lambdabot> | forall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b |
| 20:50:25 | <bos31337> | @hoogle Int -> [a] -> [[a]] |
| 20:50:25 | <lambdabot> | Control.Monad replicateM :: Monad m => Int -> m a -> m [a] |
| 20:50:26 | <lambdabot> | Prelude drop :: Int -> [a] -> [a] |
| 20:50:26 | <lambdabot> | Prelude take :: Int -> [a] -> [a] |
| 20:50:37 | <Baughn> | conal: ..priority interrupt. I'll be back. |
| 20:50:44 | <jmcarthur_work> | we see that it can take a function and lift it into a Functor (monads are functors, too) |
| 20:51:02 | <jmcarthur_work> | so fmap Blah :: IO Int -> IO Blah |
| 20:51:11 | <jmcarthur_work> | and fmap Blah foo :: IO Blah |
| 20:51:49 | <jmcarthur_work> | siki, does that make sense? |
| 20:54:42 | <siki> | jmcarthur_work: yes it does....I'm just diggesting it :) |
| 20:55:06 | <siki> | jmcarthur_work: thanks for the help btw |
| 20:55:19 | <chr1s> | conal: ping |
| 20:55:34 | <conal> | chr1s: hi |
| 20:56:16 | <chr1s> | conal: so what kind of things do you want to generate for the iPhone? |
| 20:56:33 | <hackagebot> | explicit-sharing 0.3.1.1 |
| 20:56:34 | <chr1s> | graphical stuff? that should be easy, coregraphics is all low-level c-code. |
| 20:56:43 | <conal> | chr1s: graphics toys, via glsl |
| 20:57:09 | <chr1s> | right |
| 20:57:10 | <conal> | chr1s: i understand glsl will be available on iphone 3.0, though not before |
| 20:57:24 | <conal> | chr1s: i hope i'm right about that bit. |
| 20:57:50 | <dancor_> | trifling style question: http://dzl.no-ip.org/lol/if.hs |
| 20:57:53 | <chr1s> | conal: I don't know too much about that, but I do know OpenGL is available, that's a start. |
| 20:58:37 | <conal> | chr1s: yeah. apparently, iphone 2.x has opengl-es *without* programmable shaders, but iphone 3.0 has with. |
| 20:58:46 | <chr1s> | conal: you should also take a look at sebastiaan visser's FRP-DSL for javascript. |
| 20:58:49 | <sjanssen> | dancor_: I prefer the second |
| 20:58:52 | <Beelsebob> | dancor: the latter |
| 20:58:53 | <dancor_> | ok |
| 20:59:04 | <chr1s> | conal: shouldn't be too hard to use something similar for objective-c |
| 20:59:17 | <glguy> | dancor, I'd prefer guards in that case over if then else |
| 20:59:17 | <chr1s> | err, c. |
| 20:59:39 | <dancor_> | mm |
| 20:59:54 | <conal> | chr1s: i think so also, though the graphics stuff will be very different, as it's glsl. i already have that piece working, though the CSE is too slow as is. |
| 21:00:06 | <chr1s> | conal: ah, nice! |
| 21:00:16 | <conal> | hence the discussion about CSE and "deep" DSELs on haskell-cafe. |
| 21:00:57 | <conal> | chr1s: yeah. the generated code for 2D & 3D graphics is insanely fast on my 2+ year-old laptop. |
| 21:01:37 | <conal> | chr1s: and a genuinely functional interface (no IOish stuff), including continuous space & time. |
| 21:01:49 | <sjanssen> | ACTION prefers print . (:"ay") . ("ny" !!) . fromEnum |
| 21:01:55 | <chr1s> | conal: nice. |
| 21:02:09 | <chr1s> | conal: when will we see a demo? :) |
| 21:02:10 | <conal> | and per-pixel automatically generated exact surface normals. |
| 21:03:02 | <chr1s> | conal: so what kind of interface do you have? is it monadic? arrow-like? |
| 21:03:05 | <conal> | chr1s: i'm puzzling over how to release it. i think it'll be my core technology for some commercial efforts. |
| 21:03:32 | <conal> | chr1s: images and 3D surfaces are functions of continuous infinite 2D space. |
| 21:03:47 | <conal> | chr1s: exactly as in Pan and Vertigo |
| 21:03:48 | <dancor_> | dual license |
| 21:04:08 | <chr1s> | conal: I haven't looked too much into that, I'll do that later. |
| 21:04:30 | <conal> | does anyone know of a non-commercial software license to emulate? |
| 21:04:39 | <chr1s> | conal: also, you should use it commercially. we need more (commercial) visibility for Haskell. |
| 21:04:54 | <conal> | chr1s: thx! :) |
| 21:05:03 | <inimino> | non-commercial license? |
| 21:05:21 | <sjanssen> | ACTION thinks non-commercial open source licenses are lame |
| 21:05:33 | <conal> | ACTION too |
| 21:05:45 | <conal> | and other licenses also |
| 21:05:50 | <sjanssen> | you're free to add value to the product, but not free to make money from it |
| 21:05:53 | <Cale> | Why not just BSD everything? |
| 21:06:10 | <inimino> | yes, BSD or MIT licenses are good |
| 21:06:30 | <conal> | BSD & MIT are good for whom/what? and bad for whom/what? |
| 21:06:37 | <hackagebot> | explicit-sharing 0.3.1.2 |
| 21:06:46 | <smtms> | good for everybody; bad for Stallman :-P |
| 21:06:57 | <Cale> | They're basically the same as putting the thing into the public domain, except with a disclaimer. |
| 21:07:03 | <inimino> | they are actually open-source, free software licenses |
| 21:07:05 | <inimino> | good for everybody including Stallman |
| 21:07:07 | <Cale> | More or less. |
| 21:07:16 | <sjanssen> | conal: BSD means anyone can modify and use, but they aren't forced to share their modifications |
| 21:07:28 | <sjanssen> | ie. no "copyleft" as in the GPL |
| 21:07:31 | <p_l> | Cale: And the old one requiring acknowledgement |
| 21:07:38 | <Cale> | GPL doesn't force people to share their modifications either though. |
| 21:07:52 | <Cale> | It's only if you distribute binaries that you have to share the source along with it. |
| 21:07:54 | <smtms> | it does, in the normal sense |
| 21:07:54 | <p_l> | Cale: It does if they ever release it to anyone else |
| 21:08:03 | <inimino> | a licence that forbids commercial use is not free/open-source either |
| 21:08:14 | <Cale> | You're free to change and use your changes without contributing them. |
| 21:08:15 | <dancor_> | it seems to me that any scenario should be fine with either: bsd3 or gpl+commercial-dual |
| 21:08:15 | <conal> | sjanssen: yep. bsd is what i've been doing so far. i got soured on it. |
| 21:08:23 | <inimino> | which isn't good for anybody |
| 21:08:24 | <Cale> | conal: What's wrong with it? |
| 21:08:29 | <p_l> | as long as you are doing in house, you can do whatever you want (unless license explicitly forbids it, which might be invalid in some countries) |
| 21:08:39 | <gwern> | any gitit fans around? I'm working on a HCAR.tex |
| 21:09:45 | <Cale> | p_l: right, there are some closed source licenses which prohibit reverse engineering even, though it's not clear the extent to which that's valid. |
| 21:09:46 | <dancor_> | what's wrong is that conal can't survive on opensource dreams alone ;) |
| 21:09:55 | <conal> | dancor_: :) |
| 21:10:38 | <FunctorSalad> | does anyone understand what this package has to do with message passing style? :-( http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mps-2009.5.13 |
| 21:10:42 | <gwern> | @seen thoughtpolice Lemmih |
| 21:10:42 | <lambdabot> | thoughtpolice is in #haskell-blah, #haskell-in-depth, #ghc and #haskell. I last heard thoughtpolice speak 2h 21m 12s ago. |
| 21:10:50 | <gwern> | @seen Lemmih |
| 21:10:50 | <lambdabot> | Lemmih is in #haskell. I last heard Lemmih speak 14h 24m 58s ago. |
| 21:10:50 | <FunctorSalad> | (at the risk of looking stupid) |
| 21:10:54 | <conal> | my goal is to be able to keep doing the functional stuff i like without having to get a conventional job. |
| 21:11:22 | <gwern> | how do you make a small fortune using functional programming? (start with a large one) |
| 21:11:30 | <conal> | gwern: hah! |
| 21:11:37 | <Peaker> | conal: what about an academic framework? |
| 21:11:44 | <conal> | Peaker: hm? |
| 21:11:47 | <gwern> | conal: it's an old joke, but I felt it's appropriate for you :) |
| 21:12:10 | <conal> | gwern: maybe so. the market plunge helped also. |
| 21:12:22 | <FunctorSalad> | rob something armed with a large lambda? |
| 21:12:26 | <Peaker> | conal: you can get paid to research stuff as you will in many universities, no? |
| 21:12:33 | <Twey> | FunctorSalad: *shakes head* |
| 21:12:36 | <Twey> | I'm baffled |
| 21:12:50 | <Cale> | "This guy helped me to become a millionaire. Of course, when I met him, I was a billionaire." |
| 21:12:59 | <FunctorSalad> | Twey: I wasn't serious :-( |
| 21:13:00 | <conal> | Peaker: do you mean chase grants? |
| 21:13:32 | <conal> | all licenses are off the mark for what i'm looking for. which is to enable & encourage people to play and pitch in. and to reward everyone according to how their contribution is valued. |
| 21:13:35 | <Peaker> | conal: not sure what's it called, it can be a professor's job title, sometimes you have to lecture students and stuff, sometimes you don't |
| 21:14:00 | <gwern> | so how does one write a normal http link in TeX? I mean something along the lines of [foo](http://bar); all the HCAR examples I have seem to use bare links |
| 21:14:18 | <conal> | gwern: hyperref package |
| 21:14:20 | <gwern> | that is, they're all \url{} stuff |
| 21:14:52 | <jotik_> | Hello! How do I fork n threads and wait for all of them to finish? |
| 21:15:20 | <FunctorSalad> | Twey: or did you refer to my question about the mps package? |
| 21:15:38 | <Baughn> | jotik_: forkIO . putMVar fin (); replicateM n takeMVar fin |
| 21:15:41 | <sjanssen> | jotik_: the usual way is to create an MVar, have each thread write to it as they finish, then read that MVar as many times as there are threads |
| 21:16:16 | <jotik_> | Baughn: care to explain that a bit? |
| 21:16:26 | <FunctorSalad> | jotik_: http://haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent.html#11 |
| 21:16:33 | <FunctorSalad> | (the "terminating the program" section) |
| 21:16:38 | <Baughn> | jotik_: sjanssen just did. :) |
| 21:16:56 | <jotik_> | FunctorSalad: I read that, but thats a lot of code. |
| 21:17:06 | <Baughn> | conal: If the sink is GC'd, I cap the event; that's no issue. But if the program stops processing incoming events, I have to stop adding occurences to the Event somehow, or I have a memory leak. |
| 21:17:07 | <Twey> | FunctorSalad: The MPS package |
| 21:17:16 | <Twey> | It seems completely unrelated to MPS |
| 21:17:24 | <Twey> | It even has a reimplementation of Data.Function.on |
| 21:17:40 | <FunctorSalad> | ugh. the "better method" is the unsafePerformIO hack? =) |
| 21:17:44 | <conal> | Baughn: yeah. tricky. |
| 21:17:48 | <FunctorSalad> | (in that haddock, still) |
| 21:18:05 | <conal> | Baughn: if there are no more references to the event, then we can stop feeding it. |
| 21:18:10 | <Baughn> | No |
| 21:18:15 | <conal> | Baughn: since we know that no one will notice. |
| 21:18:20 | <Baughn> | Hang on |
| 21:18:23 | <FunctorSalad> | Twey: that's whay I thought too |
| 21:18:26 | <FunctorSalad> | *what |
| 21:18:27 | <Baughn> | conal: I can't add a finalizer to the Event, since the program can be working on it while its head is GC'd. The solution I'm currently leaning towards is to write to a bounded channel in the sink, and construct the Event using unsafeInterleaveIO to read from the channel |
| 21:18:50 | <conal> | Baughn: i was working on that optimization a while back. i forget what shape it's in. the Channel abstraction was a problem. |
| 21:18:58 | <Baughn> | conal: Then adding parameters to makeEvent for the size of the channel, as well as whether it should block or discard events |
| 21:19:00 | <FunctorSalad> | Twey: maybe they forgot to expose a module? :) |
| 21:19:10 | <conal> | Baughn: yeah. not to the event. to the channel. |
| 21:19:19 | <FunctorSalad> | or maybe that's what is meant by the "helpers" qualification in the synopsis. |
| 21:19:30 | <conal> | Baughn: which i tried, but it's actually trickier, because the channel evaporates at the start, leaving its two representation halves. |
| 21:19:57 | <Baughn> | conal: Well.. okay, that works |
| 21:20:14 | <Baughn> | conal: I can use unsafeInterleaveIO again and explicitly touch the channel; then it won't evaporate |
| 21:20:37 | <conal> | Baughn: the channel abstraction is kind of broken. i was working on another. then would pitch changing ghc's. |
| 21:20:47 | <FunctorSalad> | related question, *is* there some message-passing-style support package? ;) |
| 21:20:57 | <Baughn> | conal: Still. Hm, let me get this working first; it might be useful. |
| 21:21:07 | <conal> | Baughn: might work. i kept trying and failing. finalization is fragile! |
| 21:21:26 | <Cale> | FunctorSalad: There are a number of them... |
| 21:21:28 | <Baughn> | conal: Fortunately, implementing isEvaluated taught me a lot about how GHC evaluates things. :P |
| 21:21:31 | <FunctorSalad> | (I tried to write a directed graph of threads In The Type System, but it's a bit hard) |
| 21:21:35 | <conal> | Baughn: ! :) |
| 21:21:55 | <Twey> | FunctorSalad: Hum |
| 21:22:01 | <FunctorSalad> | each with custom state type, of course ;) |
| 21:22:20 | <conal> | Baughn: i don't think i'd be happy with having a fairly channel size. arbitrary & hard to predict, especially as it interacts with laziness |
| 21:22:26 | <Cale> | FunctorSalad: I'm guessing that Chan is much simpler than what you're looking for? |
| 21:22:55 | <Baughn> | conal: I'll be using Maybe Int for its size; unbounded is an option |
| 21:23:32 | <conal> | Baughn: still problematic. if unbounded were really okay, we'd use it all the time. |
| 21:23:50 | <Baughn> | conal: No, a combination. :) |
| 21:23:51 | <jmcarthur_work> | Baughn, isEvaluated ?! |
| 21:24:00 | <Baughn> | conal: Unbounded/bounded, plus a finalizer on the channel |
| 21:24:12 | <Baughn> | jmcarthur_work: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/isevaluated |
| 21:24:19 | <Twey> | FunctorSalad: *shakes head* There's nothing else in there |
| 21:24:34 | <conal> | Baughn: i don't know how to choose a bound. |
| 21:24:42 | <Baughn> | conal: Plus a way to explicitly cap an event sink |
| 21:24:57 | <Baughn> | conal: That's application-specific. The default would be unbounded. |
| 21:25:03 | <FunctorSalad> | Cale: I thought it might be possible to factor out the boilerplate and just supply the state type for each thread, and a "MsgType -> CanSendMessagesT (StateT S IO) ()" for each message type :) |
| 21:25:19 | <conal> | Baughn: i don't know how one would make an application-specific choice. |
| 21:25:26 | <Baughn> | conal: However, if the events are something like incoming network connections, you don't want to let them pile up too much |
| 21:25:37 | <FunctorSalad> | but you end up with type-level lists, this is probably unneccesarily contrived |
| 21:25:44 | <Cale> | FunctorSalad: There's also the cml and actor libraries |
| 21:25:53 | <Baughn> | conal: Well, obviously, you need to have written the application in question. |
| 21:25:54 | <conal> | Baughn: that's why i'd like a semantically correct GC-based solution. |
| 21:26:06 | <jmcarthur_work> | Baughn, oh you're using vacuum? i guess this means vacuum is capable of showing unevaluated thunks now? i haven't check up in a while |
| 21:26:19 | <Baughn> | conal: You get the semantically correct one if you pick makeEvent. You get finer control if you pick makeEvent'. makeEvent calls makeEvent'. |
| 21:26:20 | <Cale> | Though to be honest, I find the actor library confusing. |
| 21:26:25 | <conal> | Baughn: i really mean i'm skeptical that there would often be decent choices, even if i wrote the app. |
| 21:26:44 | <jmcarthur_work> | vacuumLazy? |
| 21:26:52 | <conal> | Baughn: so my best guess right now is that makeEvent' is sweeping an important problem under the table. hiding, not addressing. |
| 21:26:56 | <Baughn> | jmcarthur_work: vaccumLazy is a work in progress. mmorrow mentioned it isn't working quite right yet. |
| 21:27:05 | <Baughn> | conal: It isn't |
| 21:27:18 | <Baughn> | conal: Look, give me half an hour and you can read the code. I just need to write it first. |
| 21:27:24 | <conal> | Baughn: k |
| 21:27:30 | <jmcarthur_work> | ah |
| 21:29:36 | <FunctorSalad> | Cale: yeah, it seems very advanced. apparently it is a sort of internal pattern matching on messages |
| 21:29:50 | <FunctorSalad> | ("internal" as opposed to case statement pattern matching) |
| 21:30:08 | <Philippa> | confusing: a bunch of haskell mails, with a mail in the middle with the subject line "Church cursed Madonna" |
| 21:30:11 | <Philippa> | (it's spam) |
| 21:30:37 | <idnar> | hahaha |
| 21:31:56 | <Cale> | cml looks interesting, but I'd have to see some programs written to use it. I don't think I really "get" what the various primitives provided are for. |
| 21:32:19 | <Baughn> | conal: Say. If the event is GC'd, should the sink just ignore calls, or throw an exception? (I vote for the latter) |
| 21:32:55 | <gwern> | Philippa: too bad no haskellers are great classical painters |
| 21:33:14 | <Cale> | But the funny thing is that the cml implementation in terms of MVars on Hackage is apparently something like 30% faster than O'Caml's native implementation. |
| 21:33:19 | <gwern> | we could've had masterpieces like 'Church wept', depicting Alonzo Church despairing before the shadow of a turing machine |
| 21:33:20 | <conal> | Baughn: you prefer the latter because you see the sink call as erroneous? |
| 21:33:32 | <conal> | Baughn: and indication of a client logic error? |
| 21:34:21 | <Baughn> | conal: Yes |
| 21:34:30 | <Baughn> | conal: And if it really isn't, catching the exception is easy enough |
| 21:34:45 | <FunctorSalad> | gwern: or an apalled lolcat "What do you mean it evaluates to itself? :o" |
| 21:35:05 | <conal> | Baughn: what suggests to you that a write is erroneous if no one is reading? |
| 21:35:06 | <Cale> | The paper which describes it claims that CML is 'higher order concurrent programming', but I don't really understand the sense in which it's any higher order than IO + MVars... |
| 21:35:41 | <Heffalump> | usually higher-order concurrency refers to being able to send channels etc across channels |
| 21:35:44 | <gwern> | FunctorSalad: yo cat i heard you lieked fixpoints so i put a fixpoint in yo fixpoint so you can eval a fixpoint while you eval |
| 21:36:06 | <Baughn> | conal: Such a program is inherently buggy, since it leaks memory. Yes, we can paper over that with a finalizer, but those aren't guaranteed to be run in a timely manner |
| 21:36:11 | <Cale> | Heffalump: But of course we can have a Chan (Chan a)... |
| 21:36:18 | <conal> | Baughn: consider an analogous situation: a non-empty list runs out of consumers. |
| 21:36:26 | <Heffalump> | Cale: right |
| 21:36:36 | <Baughn> | conal: More to the point, it is more likely to be an indication of a bug than a desired feature |
| 21:36:36 | <conal> | Baughn: i agree there's a bug. but i'd say in the GC, not the app. |
| 21:36:47 | <mauke> | preflex actually uses that in its restart logic (channel over channel) :-) |
| 21:36:48 | <Baughn> | conal: And we currently have no way of informing the caller of a sink that nobody is listening |
| 21:37:05 | <conal> | Baughn: yeah. |
| 21:37:13 | <Baughn> | conal: If possible, I'd prefer to alter the Sink type to return a Bool - whether the occurence was delivered or not |
| 21:37:24 | <Baughn> | s/delivered/queued/ |
| 21:38:02 | <conal> | Baughn: i think the problem here is that GC has a strong bias toward demand-driven architectures. |
| 21:38:13 | <conal> | GC works backward for data-driven architectures. |
| 21:38:19 | <conal> | so i'd fix GC |
| 21:38:30 | <Baughn> | conal: Not an option. Realistic suggestions? :) |
| 21:38:38 | <conal> | Baughn: yes. |
| 21:38:46 | <Baughn> | conal: (a) Throw exception, (b) Return False, (c) Do nothing |
| 21:38:59 | <conal> | Baughn: d |
| 21:39:00 | <mauke> | retry, abort, cancel? |
| 21:39:15 | <Baughn> | conal: Describe d |
| 21:39:35 | <conal> | Baughn: i'm inviting you to explore other possibilities with me. |
| 21:39:51 | <conal> | Baughn: so d starts with that exploration and then continues from there. |
| 21:40:06 | <Baughn> | conal: I suppose there's no need to be over-eager. I'll sleep on it, then. |
| 21:40:08 | <Cale> | I should maybe extend the CML library with all the obvious instances which it's missing... |
| 21:41:00 | <RayNbow> | ACTION blinks... |
| 21:41:02 | <Cale> | Events form a monad in an obvious way. |
| 21:41:10 | <RayNbow> | Guido... recommending... TAOCP? |
| 21:41:14 | <RayNbow> | ACTION blinks again... |
| 21:42:22 | <gwern> | RayNbow: what do you expect him to recommend, SICP? |
| 21:42:53 | <RayNbow> | gwern: I wasn't :p |
| 21:42:53 | <thoughtpolice> | gwern: you rang? |
| 21:43:04 | <FunctorSalad> | *still looking at the cml package* |
| 21:43:04 | <byorgey> | TAOCP is quite imperative, you know. |
| 21:43:05 | <gwern> | thoughtpolice: I was wondering why there was nothing in HCAR about LHC |
| 21:43:19 | <thoughtpolice> | gwern: didn't think about writing it, unfortunately |
| 21:43:23 | <RayNbow> | byorgey: TAOCP is quite math heavy... (the books are too) |
| 21:43:32 | <thoughtpolice> | gwern: i wasn't even aware of when the submission deadline was |
| 21:43:36 | <byorgey> | is Guido against math too? |
| 21:43:44 | <gwern> | RayNbow: the reason why is left as an exercise for the reader. (easy) |
| 21:44:02 | <gwern> | thoughtpolice: will you guys have an entry for next time? |
| 21:44:17 | <thoughtpolice> | gwern: hopefully. and hopefully it will be more mentionable by then too :) |
| 21:44:34 | <thoughtpolice> | but hey, at least it evaluates stuff and the code is really clean/pretty :) |
| 21:44:37 | <thoughtpolice> | Lemmih++ |
| 21:44:37 | <gwern> | ACTION wonders whether to volunteer to write it |
| 21:44:43 | <RayNbow> | byorgey: don't know :p |
| 21:45:19 | <byorgey> | Wikipedia says he got a masters in mathematics and computer science in 1982... |
| 21:45:25 | <RayNbow> | ACTION has read only a tiny bit of TAOCP... (I wonder if I will ever succeed at reading it all) |
| 21:45:32 | <RayNbow> | ah |
| 21:45:44 | <McManiaC> | @src while |
| 21:45:45 | <lambdabot> | Source not found. Have you considered trying to match wits with a rutabaga? |
| 21:45:56 | <byorgey> | TAOCP is fantastic. Now if only the pseudocode was functional... |
| 21:46:02 | <McManiaC> | @src unless |
| 21:46:03 | <lambdabot> | unless p s = if p then return () else s |
| 21:46:21 | <RayNbow> | byorgey: have you read it all? |
| 21:46:28 | <byorgey> | RayNbow: no |
| 21:46:31 | <byorgey> | just parts |
| 21:48:03 | <thoughtpolice> | gwern: i'll be sure to write something down whenever janis announces the next hcar :) |
| 21:48:22 | <gwern> | thoughtpolice: that's a rather verbose way of saying 'I can't be arsed' :) |
| 21:48:55 | <pumpkin> | :o |
| 21:49:26 | <mux> | the "types are calling convention" is really interesting |
| 21:49:31 | <mux> | +paper |
| 21:50:08 | <pumpkin> | I didn't quite get why a standard tuple couldn't represent that a function didn't ever get called with curried arguments though |
| 21:50:37 | <thoughtpolice> | gwern: heh, like I said, I wasn't even aware of when the HCAR deadlines were. i was fairly busy the last month with studying - I just made my first commit to LHC in a few months just the other day! |
| 21:50:51 | <pumpkin> | large hadron collider! |
| 21:50:55 | <pumpkin> | the end of the universe! |
| 21:51:12 | <idnar> | Large Haskell Collider |
| 21:51:16 | <thoughtpolice> | and the code is *so* much better now. Lemmih++ Lemmih++ :) |
| 21:51:30 | <pumpkin> | I agree, I was glancing over the source and it was quite pretty |
| 21:51:54 | <thoughtpolice> | lemmih has been very keen on keeping the compilation pipeline pure |
| 21:52:34 | <Cale> | Hmm... anyone have a good name for class Foo f where foo :: (a -> b) -> (b -> a) -> (f a -> f b) ? |
| 21:52:46 | <thoughtpolice> | mainly because we were getting bitten by all sort of asinine problems when trying to deal with the old code base |
| 21:53:01 | <Botje> | Cale: what's the use of the b -> a function ? |
| 21:53:05 | <thoughtpolice> | we would fix up a transformation pass with a 1 line change, and boom, the compiler fails approximately 15 miles away from that spot :) |
| 21:53:17 | <thoughtpolice> | with a totally unrelated error |
| 21:53:36 | <FunctorSalad> | Botje: take "data EndoFoo a = EndoFoo (a -> a)" |
| 21:53:44 | <Botje> | ACTION *boom* |
| 21:53:48 | <FunctorSalad> | you need both ways to transform such a thing |
| 21:53:52 | <thoughtpolice> | pumpkin: also, using GHC as a frontend cuts down on the LOC considerably |
| 21:54:05 | <FunctorSalad> | Cale: "Functor*", but sadly that's illegal ;) |
| 21:54:08 | <thoughtpolice> | pumpkin: and basically makes us the 2nd most featureful haskell compiler by default |
| 21:54:08 | <pumpkin> | yeah, and you wouldn't have been changing any of that behavior anyway |
| 21:54:13 | <pumpkin> | the type checking is all solved |
| 21:54:29 | <pumpkin> | I mean, it's a separate direction |
| 21:55:01 | <FunctorSalad> | Cale: "IsoSupportedFunctor"? |
| 21:55:32 | <Cale> | It's almost like a difunctor, except it only has one parameter. |
| 21:55:42 | <Cale> | and you have to do both sides at once |
| 21:56:04 | <thoughtpolice> | pumpkin: yeah, plus jhc's typechecker/parser had some strangeness in it too. using GHC as a frontend and producing external core is much better :) |
| 21:56:27 | <thoughtpolice> | pumpkin: current loc =~ 3200 |
| 21:56:31 | <Cale> | In fact, perhaps it *ought* to be a Difunctor in this case anyway. |
| 21:58:10 | <pumpkin> | :D |
| 22:17:48 | <Cale> | ACTION is astounded by the extent to which ML programmers writing Haskell can make Haskell look like ML code. ;) |
| 22:18:59 | <Berengal> | Cale: In my experience, they're superficially very similar until ALL OF A SUDDEN THE STACK BLOWS UP OMG! |
| 22:19:50 | <Cale> | Well, this guy seems to really like braces and semicolons... |
| 22:20:20 | <Berengal> | So does half the world's programming population... |
| 22:20:21 | <gwern> | thoughtpolice: 2nd most featureful compiler... so you mean you inherit all of ghc's problems and only some of its benefits? |
| 22:21:13 | <Cale> | http://hackage.haskell.org/packages/archive/cml/0.1.1/doc/html/src/Control-Concurrent-CML.html#atsync |
| 22:21:34 | <Berengal> | Oh dear gods |
| 22:21:51 | <periodic> | Bah! my stack exploded. |
| 22:21:57 | <Cale> | MY EYES! THE GOGGLES, THEY DO NOTHING! |
| 22:22:10 | <periodic> | Why would this function be causing a stack overflow? I thought I had TRO. |
| 22:22:13 | <Berengal> | SUDDENLY! BRACES EVERYWHERE |
| 22:22:30 | <periodic> | runSim st = if (simTime st) > 0 then runSim (performAction st) else st |
| 22:22:45 | <gwern> | bam! stacks everywhere! |
| 22:22:52 | <Berengal> | periodic: Tail calls do not always do what you think they do in Haskell |
| 22:23:00 | <periodic> | where runsim :: SimState -> Simstate and performAction :: SimState -> SimState (nonrecursive) |
| 22:23:06 | <kpreid> | Cale: The syntax highlighting distinctly does not help. |
| 22:23:08 | <periodic> | Berengal: Hrm... any tips or rules for that? |
| 22:23:30 | <Berengal> | periodic: Well, lazy evaluation is at fault |
| 22:23:34 | <Berengal> | Two exaples: foldl and map |
| 22:23:36 | <Berengal> | @src foldl |
| 22:23:37 | <lambdabot> | foldl f z [] = z |
| 22:23:37 | <lambdabot> | foldl f z (x:xs) = foldl f (f z x) xs |
| 22:23:39 | <Berengal> | @src map |
| 22:23:39 | <lambdabot> | map _ [] = [] |
| 22:23:39 | <lambdabot> | map f (x:xs) = f x : map f xs |
| 22:23:43 | <periodic> | ah... of course... |
| 22:24:01 | <Berengal> | foldl frequently causes stack blowups, map doesn't |
| 22:24:07 | <periodic> | I |
| 22:24:16 | <periodic> | 've read about foldl vs foldr. |
| 22:24:41 | <periodic> | But I should probably read that again. |
| 22:25:28 | <Berengal> | Hmmm, it does look like your function is strict though... |
| 22:25:34 | <Cale> | periodic: If you'd like I can explain how Haskell evaluation works. The stack does not mean what you probably think it means. |
| 22:25:50 | <periodic> | Cale: Unlearning FTW! |
| 22:25:53 | <Cale> | periodic: (it's used for something entirely different from what it normally is and builds up in a different way) |
| 22:26:18 | <periodic> | Cale: thunks? bigger and bigger thunks? |
| 22:26:21 | <Cale> | As opposed to strict evaluation, which is done innermost-first, Haskell evaluation is outermost first. |
| 22:26:53 | <Cale> | The stack is used when a function or case needs to pattern match on an expression and that expression does not immediately match. |
| 22:27:16 | <Cale> | In that case, it has to be evaluated, and you get a stack entry for the waiting case. |
| 22:27:55 | <Cale> | For example... |
| 22:27:59 | <Cale> | @src foldl |
| 22:28:01 | <lambdabot> | foldl f z [] = z |
| 22:28:01 | <lambdabot> | foldl f z (x:xs) = foldl f (f z x) xs |
| 22:28:15 | <Cale> | Let's evaluate foldl (+) 0 (1:2:3:[]) |
| 22:28:26 | <Cale> | --> foldl (+) (0+1) (2:3:[]) |
| 22:28:31 | <Cale> | --> foldl (+) ((0+1)+2) (3:[]) |
| 22:28:39 | <Cale> | --> foldl (+) (((0+1)+2)+3) [] |
| 22:28:44 | <Cale> | --> ((0+1)+2)+3 |
| 22:28:53 | <Cale> | Up to this point, the stack has gone unused. |
| 22:29:13 | <Cale> | But now, the outermost (+) is (...) + 3 |
| 22:29:32 | <Cale> | unless we know what (...) is, it can't evaluate (you can think of it as pattern matching on the integer) |
| 22:29:45 | <Cale> | So (...) + 3 goes on the stack |
| 22:29:57 | <Cale> | and then we have something which looks like (...) + 2 |
| 22:30:06 | <Cale> | and that goes on the stack for the same reason |
| 22:30:17 | <Cale> | and then (0 + 1), which can evaluate, finally |
| 22:30:30 | <Gracenotes> | I also find it helpful to substitute f, sometimes |
| 22:30:58 | <Cale> | So it's this searching for a subexpression which will reduce that the stack is used for. |
| 22:31:08 | <Gracenotes> | foldlSum z [] = z |
| 22:31:09 | <Gracenotes> | foldlSum z (x:xs) = foldlSum (z+x) xs |
| 22:31:44 | <Cale> | You can think of the stack depth as representing the depth from the expression you're trying to evaluate to the outermost-leftmost reducible subexpression. |
| 22:31:49 | <Gracenotes> | (so it keeps on passing the accumulator, and when there's nothing left in the list that's the final result) |
| 22:31:52 | <periodic> | Cale: Alright, I'm with you. Now that seems to make sense. |
| 22:32:06 | <Berengal> | Cale: I've been wondering, have you stored these lectures as macros or something? |
| 22:32:16 | <Cale> | Berengal: no, I just keep them in my head |
| 22:32:17 | <periodic> | Berengal: I was wondering the same thing |
| 22:32:24 | <periodic> | Good typing practice. |
| 22:33:14 | <Axman6> | Cale: you realy need to blog that schpiel, it's far too valuable to be repeated all the time ;) |
| 22:33:24 | <periodic> | yeah, I was totally expecting a link. |
| 22:33:29 | <Cale> | If only I wasn't so opposed to the notion of a blog. |
| 22:33:34 | <Cale> | hehe |
| 22:33:36 | <Gracenotes> | hm. vs, foldrSum z (x:xs) = x + foldrSum z xs |
| 22:33:37 | <Axman6> | the folding explanatatron |
| 22:33:45 | <Baughn> | @type unsafeInterleaveIO |
| 22:33:46 | <lambdabot> | Not in scope: `unsafeInterleaveIO' |
| 22:33:47 | <Axman6> | well wiki it :P |
| 22:33:50 | <Cale> | hehe |
| 22:34:03 | <Gracenotes> | :ox |
| 22:34:07 | <Berengal> | Cale: Also needs reduction of map |
| 22:34:52 | <Cale> | So it's common for tail recursive functions which don't pattern match on their parameters to build up large expressions in those parameters which require lots of stack when they finally evaluate. |
| 22:34:53 | <Axman6> | > map f [a,b,c,d] |
| 22:34:54 | <lambdabot> | Add a type signature |
| 22:35:02 | <Axman6> | > map f [a,b,c,d] :: [Expr] |
| 22:35:03 | <lambdabot> | [f a,f b,f c,f d] |
| 22:35:24 | <Cale> | In your case, we have... runSim st = if (simTime st) > 0 then runSim (performAction st) else st |
| 22:35:35 | <Cale> | Let's examine what simTime does. |
| 22:36:08 | <periodic> | simTime :: SimState -> Float (It's just an accessor function on the SimState data structure) |
| 22:36:48 | <Berengal> | And performAction? |
| 22:37:10 | <periodic> | performAction :: SimState -> SimState (non-recustive, just changes the state somehow) |
| 22:37:15 | <conal> | continuing the license discussion (if there's interest): my problem with BSD and LGPL is that they don't ask for so little in return from a commercial user; and my problem with GPL is that it makes a specific demand that aren't what I'm after. |
| 22:37:44 | <conal> | nothing i've seen in the way of licenses seems to get to the heart of what i'm after. |
| 22:37:51 | <pejo> | conal, what are you after? |
| 22:37:53 | <Berengal> | periodic: Ah, so performAction could build up thunks in fields other than simTime |
| 22:38:02 | <periodic> | performAction picks an action to perform based on the state and returns a different state. |
| 22:38:06 | <Axman6> | conal: in need of a Commercial Responsibility BSD licence? |
| 22:38:14 | <periodic> | Berengal: Indeed, i believe it would. |
| 22:38:27 | <conal> | pejo: :) i want to enable & encourage people to play and pitch in. and to reward everyone according to how their contribution is valued. |
| 22:38:33 | <dons> | conal: btw, sent you email. |
| 22:38:36 | <conal> | Axman6: something like that. |
| 22:38:39 | <conal> | dons: looking. |
| 22:38:50 | <kig> | is there any use for the expanding version of foldl, apart from blowing up the stack? |
| 22:38:50 | <Berengal> | periodic: Does it look at all the fields of the SimState, or does it modify one without looking at it? |