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:24 | <Peaker> | mauke: is that really you? |
| 00:00:32 | <mauke> | heh, no |
| 00:10:42 | <mauke> | haskeline-- # you fail at combining characters |
| 00:15:02 | <flippo> | preflex, be poppavic |
| 00:15:02 | <preflex> | no quotes found for poppavic |
| 00:15:11 | <flippo> | Aww. |
| 00:15:31 | <mauke> | haskeline-- # vi-style custom keybindings, no functionality |
| 00:15:46 | <j4cbo> | does haskell (either directly or through some ghc extension) support higher order polymorphism? |
| 00:16:17 | <clug> | http://en.wikibooks.org/wiki/Haskell/Polymorphism |
| 00:16:32 | <dons> | j4cbo: yeah |
| 00:16:47 | <dons> | j4cbo: look for "Rank N types" |
| 00:17:31 | <dons> | j4cbo: http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extensions.html#universal-quantification |
| 00:17:53 | <j4cbo> | neat. |
| 00:19:19 | <j4cbo> | oh i see, they solved the undecidability thing by requiring annotations when you're doing that sort of thing |
| 00:19:55 | <j4cbo> | ACTION wants Successor ML already :/ |
| 00:23:35 | <pimpkonFollower> | ACTION wants "Successor Haskell, with Batteries Included", already |
| 00:24:06 | <Twey> | A.K.A. Haskell' with haskell-platform? |
| 00:24:22 | <Twey> | Why doesn't haskell-platform get standardised in Haskell'? |
| 00:24:23 | <Cale> | j4cbo: The direction of most of the type system research surrounding Haskell has been how to preserve the quality of type inference while allowing for fancy type features -- only requiring explicit types for the fancily-typed things. |
| 00:24:30 | <Twey> | At least vaguely |
| 00:24:59 | <Twey> | It could be mentioned as a series of optional addenda. |
| 00:25:31 | <j4cbo> | ACTION nod |
| 00:25:41 | <Cale> | It annoys me enough that the Prelude is part of the standard, in some ways. |
| 00:26:06 | <Cale> | Makes it really hard to change things. |
| 00:26:22 | <roconnor> | god, I hope the mtl doesn't get standardized any further. |
| 00:26:41 | <j4cbo> | i like a lot of the ideas in haskell, but i don't think i'll ever want to use a lazy language for real work, myself |
| 00:27:02 | <Cale> | j4cbo: In my experience, laziness makes a good default. |
| 00:27:15 | <roconnor> | laziness makes code modular |
| 00:27:19 | <roconnor> | well |
| 00:27:22 | <roconnor> | allows code to be modular |
| 00:27:31 | <Twey> | I agree |
| 00:27:43 | <j4cbo> | i was under the impression that even some of the authors/inventors of haskell have said that eagerness should have been the default? |
| 00:27:48 | <Twey> | Although it would be nice if Haskell made strictness easier, too |
| 00:27:48 | <Cale> | Yeah, it gives you more ways to break down problems if you have libraries with lots of lazy functions in them. |
| 00:27:56 | <j4cbo> | ACTION remembers this from a talk he went to a while ago |
| 00:28:09 | <Twey> | j4cbo: I don't know, but clearly they were in a minority for a good reason :-P |
| 00:28:12 | <Cale> | j4cbo: I think perhaps it was in order to emphasise how much *more* important purity is. |
| 00:28:28 | <Cale> | But laziness actually is quite useful. |
| 00:28:39 | <j4cbo> | in particular, it was one of the head Jane Street Capital guys talking about why they use ML rather than Haskell :P |
| 00:28:53 | <roconnor> | heh, purity actually *makes* things modular, rather than simply allowing for it. :P |
| 00:28:56 | <j4cbo> | laziness is really useful sometimes, sure |
| 00:29:19 | <j4cbo> | i don't like how it makes it trickier to reason about what the code will *do*, though |
| 00:29:20 | <Cale> | j4cbo: The trouble is that if you don't have it as a default, it's much less useful. |
| 00:29:28 | <Twey> | Laziness is useful often enough that I would rather have it as the default |
| 00:29:33 | <Cale> | Actually, I think it makes reasoning easier. |
| 00:29:38 | <roconnor> | j4cbo: but it makes it easier to forget about what the code *does* |
| 00:29:40 | <Twey> | Default strictness is premature optimisation, I think. |
| 00:29:42 | <roconnor> | one less thing to worry about |
| 00:29:56 | <mauke> | without default laziness Haskell wouldn't even exist |
| 00:29:56 | <Cale> | If there's an order of evaluation which terminates, then lazy evaluation terminates. You can't say that about strict evaluation. |
| 00:29:59 | <roconnor> | focusing on what the code *means* |
| 00:30:18 | <j4cbo> | maybe it has to do with the application |
| 00:30:36 | <j4cbo> | for me, knowing whether my code will use N mb of heap is more important than being able to represent an infinite list |
| 00:30:47 | <mauke> | haskeline-- # it's not even programmable |
| 00:31:08 | <Cale> | haskeline++ # it works the way I want it to by default |
| 00:31:30 | <Twey> | Defaults are a luxury; flexibility is a necessity |
| 00:32:10 | <mauke> | haskeline-- # duplicate history entries |
| 00:32:16 | <Cale> | j4cbo: There are ways, of course, to limit the amount of resources which a computation will require |
| 00:32:22 | <mauke> | what are the ghc developers smoking? |
| 00:33:08 | <Cale> | j4cbo: It's just that "seeing" the resource usage of lazy programs takes some getting used to, and the intuition one has from strict programming doesn't apply. |
| 00:33:25 | <Saizan_> | mauke: have you seen the documentation on the trac page? |
| 00:33:31 | <mauke> | Saizan_: yes |
| 00:34:17 | <Cale> | mauke: It's better than having abc<del>d produce adb |
| 00:34:37 | <Cale> | libedit sucked |
| 00:34:49 | <j4cbo> | Cale: that's like saying that "seeing" the state-mutating effects of impure programs takes some getting used to, and the intuition one has from pure programming doesn't apply :P |
| 00:34:59 | <Cale> | j4cbo: That is true. |
| 00:35:01 | <mauke> | Cale: I know, but at least it pretended to be readline compatible so building ghci with readline support was trivial |
| 00:35:01 | <Cale> | (as well) |
| 00:35:14 | <Cale> | j4cbo: But it's not necessarily the case that it's hard. |
| 00:35:55 | <j4cbo> | actually that reminds me |
| 00:35:57 | <Cale> | j4cbo: When you programmed in your first programming language, you likely had to get a feel for resource usage. |
| 00:36:13 | <Cale> | I'm just saying the experience is somewhat similar to that. |
| 00:36:15 | <mauke> | if I don't find a way to link ghc-6.10.3 with readline, I'm not going to upgrade |
| 00:36:44 | <j4cbo> | i remember seeing that GHC has some fancy optimizations such that a string isn't necessarily a bunch of cons cells of chars, but can be stored unboxed... is that the case? |
| 00:37:02 | <Cale> | j4cbo: Hmm... you can use Data.ByteString |
| 00:37:31 | <j4cbo> | oic |
| 00:38:50 | <dons> | j4cbo: re. laziness, i gave a talk recently about haskell in the workplace, and experiences with laziness, might ease some of your concerns. http://www.galois.com/blog/2009/04/27/engineering-large-projects-in-haskell-a-decade-of-fp-at-galois/ |
| 00:39:00 | <dons> | re. unboxing, the 'adaptive' packages do this via associated type classes |
| 00:39:14 | <dons> | where if you use particular element types, the representation changes to an unboxed form |
| 00:39:36 | <Cale> | Data.ByteString comes in a strict flavour, which just consists internally of a pointer to a counted block of memory, and a lazy flavour, which is internally a lazy list of approximately-cache-sized strict bytestring chunks. |
| 00:39:48 | <j4cbo> | *nod* |
| 00:40:03 | <dons> | yeah, the libraries are full of strict, lazy, and mixed structures |
| 00:40:09 | <dons> | lots of fun exploring that space |
| 00:41:15 | <cypher-> | ACTION alyways misses london hug talks and he's just few miles away |
| 00:41:17 | <cypher-> | :S |
| 00:41:50 | <cypher-> | ACTION used to be at city uni |
| 00:42:14 | <Cale> | j4cbo: The most useful piece of intuition for when you need strictness is that it should only be necessary when you have a large number of separately-evaluable pieces of data, and you're collapsing them down somehow to something which doesn't have a lot of separately-evaluable parts, and it's not simply by searching, but properly combining. |
| 00:43:09 | <cypher-> | dons: is there / will be a video of the talk? |
| 00:43:31 | <Cale> | This is because this is the only opportunity for unevaluated expressions to grow much larger than the data they evaluate to. |
| 00:43:40 | <Cale> | The nice thing about this observation is that most of these cases are in fact folds of one variety or another. |
| 00:44:12 | <Cale> | So you can take the explicit strictness annotations and wrap them up inside a strict fold function, and then just use that. |
| 00:44:40 | <j4cbo> | dons: that's interesting... i find there's generally nowhere near enough information about actually using functional languages in the real world - deployment, FFI, that sort of thing. |
| 00:45:32 | <Cale> | In fact, in my experience, it's almost always foldl' :) |
| 00:45:41 | <j4cbo> | it's something implementers tend to not pay enough attention to either (*COUGH*smlnj*COUGH*) |
| 00:45:59 | <dons> | j4cbo: yeah, that's the stuff I tried to talk about in the talk (e.g. Haskell's FFI removes a /lot/ of risk) |
| 00:46:08 | <dons> | cypher-: there's no video. |
| 00:48:45 | <Adamant> | Haskell and stuff like SPARK/Ada. is there any movement toward using Haskell in high-reliability systems? |
| 00:49:08 | <Adamant> | I mean, for things that REALLY require reliability. |
| 00:49:47 | <dons> | there's a couple of 'systems haskell' languages under development |
| 00:49:52 | <mikm> | Like Telecos? |
| 00:49:54 | <dons> | and a lot more stuff to do with theorem proving. |
| 00:50:07 | <p_l> | mikm: like nuclear reactors, I think ;-) |
| 00:50:41 | <dons> | i.e. galois has used haskell subsets, in conjunction with isabelle, aiming at top end assurance |
| 00:50:55 | <mauke> | I'm tempted to file three bugs against 6.10.3 :-( |
| 00:51:06 | <dons> | are they feature requests? |
| 00:51:18 | <p_l> | I'm pretty sure GHC is good enough for telco-level stuff |
| 00:51:20 | <mauke> | dons: no |
| 00:51:48 | <mikm> | Really? |
| 00:51:49 | <mikm> | Neat |
| 00:52:08 | <j4cbo> | *erlang* is good enough for telcos; GHC had better be. |
| 00:52:19 | <mikm> | Well, erlang was designed for telecos |
| 00:52:22 | <mikm> | Or so I hear |
| 00:52:36 | <Berengal> | It was also designed _by_ a teleco |
| 00:52:42 | <bremner> | j4cbo: erlang does certain things pretty well |
| 00:53:36 | <j4cbo> | duck-typing :( |
| 00:53:48 | <p_l> | Erlang by itself is not enough, afaik the real strength is due to OTP... |
| 00:53:52 | <Berengal> | Erlang is overall a nice language. Better suited to some tasks than others, but still general enough to not be useless outside its targeted areas |
| 00:54:12 | <Twey> | j4cbo: You know what they say |
| 00:54:28 | <dons> | yeah, typical non-life threatening stuff doesn't have a very high burden of evidence in our industry |
| 00:54:31 | <Twey> | If it looks like a duck, and talks like a duck, it's probably a list [100,117,99,107] |
| 00:54:32 | <dons> | a pity |
| 00:55:11 | <Berengal> | > map chr [100,117,99,107] |
| 00:55:12 | <lambdabot> | "duck" |
| 00:55:32 | <j4cbo> | or [110,117,99,107,nil] |
| 00:55:49 | <Berengal> | There's already a nil at the end of [100,117,99,107] |
| 00:56:08 | <Twey> | j4cbo: nuck\0? |
| 00:56:25 | <p_l> | "what are those earth animals, small and go 'quack'?" "Cats?" "I'm nibbled to death by cats!" |
| 00:56:29 | <j4cbo> | nil as in NULL, not the real nil :P |
| 00:56:32 | <mauke> | ok, just two bugs. one of them was already in 6.8 |
| 00:56:57 | <Twey> | j4cbo: Erlang represents strings as lists of ints |
| 00:57:12 | <mmorrow> | so does haskell (essentially) |
| 00:57:12 | <lambdabot> | mmorrow: You have 1 new message. '/msg lambdabot @messages' to read it. |
| 00:57:13 | <Twey> | And guesses how to treat them based on the values of the ints |
| 00:57:41 | <Twey> | I don't think a Char is an int |
| 00:57:46 | <Berengal> | mmorrow: Depends how far down the turtle stack you go. Erlangs duck-typing is what's at issue here |
| 00:57:48 | <j4cbo> | ah, i was attempting to poke fun at the whole anything-might-actually-be-null thing in most languages |
| 00:57:50 | <mmorrow> | it's 4bytes |
| 00:57:51 | <Twey> | Besides, Haskell has the types to tell them apart |
| 00:58:05 | <mmorrow> | (ord,chr) |
| 00:58:09 | <Berengal> | Also, my ints are 8 bytes |
| 00:58:11 | <Twey> | Really? It can't handle UTF-64? :-P |
| 00:58:16 | <Adamant> | Erlang currently holds all the records for uptime levels, so let's not go talking poo just yet. |
| 00:58:33 | <Adamant> | Twey: they HAVE UTF-64 now? |
| 00:58:37 | <mmorrow> | my ints are 4bytes in C, and i'm on x86_64 :) |
| 00:58:39 | <Adamant> | 32 wasn't insane enough? |
| 00:58:47 | <mmorrow> | my longs are 8bytes |
| 00:58:54 | <Twey> | mmorrow: It's one thing to convert to and from ints. It's another to *be* ints. |
| 00:59:15 | <j4cbo> | mmorrow: i think Berengal uses Windows. |
| 00:59:18 | <mmorrow> | hence the "essentially" |
| 00:59:18 | <Berengal> | > chr (maxBound :: Int) |
| 00:59:20 | <lambdabot> | * Exception: Prelude.chr: bad argument |
| 00:59:22 | <Twey> | Adamant: Not yet :-P |
| 00:59:25 | <j4cbo> | wait, no |
| 00:59:37 | <mmorrow> | Berengal: yeah, that's the hitch |
| 00:59:53 | <Adamant> | anyway, instead of hating on Erlang, why not concentrate of stealing the cool Erlang features that Haskell doesn't have yet |
| 00:59:58 | <Adamant> | like OTP |
| 01:00:08 | <mikm> | Isn't UTF-32 just a different implementation of Unicode? |
| 01:00:17 | <mikm> | I mean, it doesn't cover a wider space than UTF-16 |
| 01:00:22 | <Berengal> | I'd like variable unification... |
| 01:00:30 | <Adamant> | mikm: no, it covers more. |
| 01:00:31 | <mikm> | or -8 |
| 01:00:32 | <Twey> | Adamant: haskell-platform |
| 01:00:37 | <mikm> | ah |
| 01:00:39 | <mmorrow> | mikm: utf{32,16,8"} all cover the exact same thing |
| 01:00:46 | <mmorrow> | s/"// |
| 01:00:47 | <mikm> | mmorrow: That's what I thought |
| 01:00:49 | <Twey> | mmorrow: What? No they don't |
| 01:00:50 | <j4cbo> | mikm: it covers a wider space than UCS-2 |
| 01:00:56 | <Twey> | Do they? |
| 01:00:56 | <mauke> | Twey: what |
| 01:01:03 | <mmorrow> | , utf8enc [maxBound::Char] |
| 01:01:09 | <lunabot> | "\244\143\191\191" |
| 01:01:13 | <Twey> | UTF-16 and UTF-32 are both fixed-width |
| 01:01:15 | <Adamant> | mmorrow: is right |
| 01:01:17 | <j4cbo> | Twey: UTF-8 and UTF-16 are both variable length |
| 01:01:21 | <Twey> | Oh |
| 01:01:22 | <Adamant> | UTF can expand to 32 bits |
| 01:01:28 | <Twey> | I thought UTF-16 was fixed |
| 01:01:29 | <Adamant> | UTF-8 |
| 01:01:33 | <Adamant> | me too |
| 01:01:37 | <Adamant> | guess not |
| 01:01:45 | <Twey> | 'kay then |
| 01:01:52 | <j4cbo> | UCS-2 is fixed two-byte |
| 01:01:56 | <p_l> | UTF-16 afaik simply used 16bits as minimal size and had AFAIK slightly different rules... |
| 01:01:59 | <j4cbo> | and can only do the BMP |
| 01:02:01 | <Twey> | Yeah |
| 01:02:09 | <Twey> | http://en.wikipedia.org/wiki/UTF-16 |
| 01:02:11 | <mmorrow> | j4cbo: are ints 8bytes on windows 64bit (C compilers) (or something)? |
| 01:02:16 | <p_l> | j4cbo: UCS2 allows for surrogate pairs, didn't it? |
| 01:02:19 | <Adamant> | you have to be able to use up to 32 bits to get the full Unicode standard |
| 01:02:30 | <mauke> | 21 |
| 01:02:31 | <mmorrow> | j4cbo: (i didn't get your comment) |
| 01:02:44 | <j4cbo> | p_l: UTF-16 does; UCS-2 does not |
| 01:02:46 | <Twey> | Adamant: We could use Bloom filters :-P |
| 01:02:47 | <j4cbo> | they're otherwise the same |
| 01:02:50 | <j4cbo> | (i think...) |
| 01:02:57 | <p_l> | ah, right. Just loaded wikipedia page |
| 01:03:07 | <j4cbo> | mmorrow: it actually doesn't, but i thought it did |
| 01:03:07 | <Twey> | Probabilistic text... |
| 01:03:14 | <mmorrow> | j4cbo: ahh |
| 01:03:21 | <p_l> | urk... UTF-EBCDIC |
| 01:03:30 | <mauke> | UTF-9 |
| 01:03:31 | <Adamant> | Twey: I want to be able to play with the all-singing, all-dancing message passing crap of the world in all it's glory |
| 01:03:48 | <j4cbo> | UTF-16 is hilarious. |
| 01:04:01 | <Twey> | Adamant: You can do pretty much everything you can do in Erlang in Haskell |
| 01:04:05 | <Adamant> | j4cbo: is it basically a compromise because of UCS-2? |
| 01:04:07 | <j4cbo> | it's not "the same as ascii" for low characters, and it's still variable length. |
| 01:04:08 | <Twey> | It's just not implicit |
| 01:04:35 | <Twey> | j4cbo: Yeah, but it encodes a pretty damn big chunk of the BMP in two bytes instead of UTF-8's three |
| 01:04:40 | <Adamant> | Twey: hmm. OTP good. want OTP on Haskell. should write code to that effect. |
| 01:04:51 | <Twey> | Adamant: What about OTP, exactly? |
| 01:05:06 | <j4cbo> | Twey: true |
| 01:05:10 | <Adamant> | Twey: all the nice patterns for dealing with massive message passing network stuff |
| 01:05:27 | <Twey> | I.E. it's more suitable for just about all Asian text |
| 01:05:38 | <Twey> | Adamant: But doesn't Haskell basically do that anyway? |
| 01:05:48 | <Adamant> | Twey: since when? |
| 01:05:53 | <Adamant> | maybe I'm out of date |
| 01:05:56 | <Twey> | Purely by virtue of its execution model(s) and Control.Concurrent |
| 01:06:12 | <Berengal> | Twey: Haskell does not |
| 01:06:19 | <Berengal> | Not yet |
| 01:06:26 | <Berengal> | But it would be nice if it did |
| 01:06:27 | <Twey> | What does OTP have over Haskell? |
| 01:06:52 | <Adamant> | Twey: it's basically a platform for building really big parallel/concurrent systems with message passing |
| 01:07:24 | <Berengal> | Things like links between threads, recovery, various services for distributing processes across nodes (with error recovery) etc. |
| 01:07:42 | <Twey> | Berengal: Like throwTo? :) |
| 01:07:46 | <Berengal> | Basically, map withRecovery [all,things,otp] |
| 01:07:55 | <Twey> | Okay, it doesn't do transparent distribution |
| 01:08:17 | <Twey> | But throwTo and catch implement all the Erlang magic, pretty much |
| 01:08:34 | <Berengal> | Twey: There's also a big lack of node support |
| 01:08:39 | <mmorrow> | but you can't throwTo a thread on another continent |
| 01:08:49 | <Berengal> | ↑ my point |
| 01:08:57 | <Twey> | It should be fairly easily possible |
| 01:09:21 | <Twey> | You'd have a proxy thread on the local machine that serialised everything passed to it and sent it on to the real node |
| 01:09:37 | <mmorrow> | sure, but comparing the erlang rts and the haskell rts (as defined as the minimal rts to implement the language spec) |
| 01:09:39 | <Twey> | Which would have a proxy thread to catch that and convert it into an exception which would then be thrown to the relevant thread |
| 01:09:57 | <Twey> | Basically, all Erlang does is make it implicit |
| 01:10:11 | <mmorrow> | exactly, via the rts |
| 01:10:18 | <j4cbo> | ... which can be pretty powerful, really |
| 01:10:27 | <Twey> | It has hidden network transfers, hidden channels, and hidden exception handlers |
| 01:10:36 | <Adamant> | Twey: right |
| 01:10:44 | <Twey> | It may be neat sometimes, but I don't know it's really Haskelly to hide all that stuff |
| 01:10:46 | <Adamant> | which is why it is nice for what it does |
| 01:10:53 | <Adamant> | Twey: why not? |
| 01:10:59 | <Cale> | Berengal: How does the Erlang server for Haskell compare? |
| 01:11:10 | <Twey> | Because ‘explicit is better than implicit’ |
| 01:11:21 | <mmorrow> | malloc? |
| 01:11:26 | <Twey> | Ha |
| 01:11:29 | <mmorrow> | ;) |
| 01:11:29 | <j4cbo> | laziness? :P |
| 01:11:33 | <Adamant> | Twey: he's got you :P |
| 01:11:38 | <Twey> | No, explicit with regards to what you actually want to do |
| 01:12:05 | <Berengal> | Cale: What? |
| 01:12:06 | <Twey> | Explicit memory management has nothing to do with the task at hand |
| 01:12:08 | <Adamant> | Twey: arguing that at a fine enough level has you coding in ASM :P |
| 01:12:35 | <bremner> | Twey: but explicit laziness surely does |
| 01:12:58 | <Twey> | bremner: Well, since Haskell is lazy by default, it's more a case of explicit strictness |
| 01:13:06 | <Cale> | Oh, perhaps I've misunderstood a bit of the conversation, but you guys know about http://hackage.haskell.org/cgi-bin/hackage-scripts/package/erlang yeah? |
| 01:13:31 | <Twey> | Cale: Cool :-D |
| 01:13:34 | <Adamant> | cool |
| 01:13:42 | <Adamant> | it's a start |
| 01:13:48 | <duaneb> | so |
| 01:13:49 | <Berengal> | Cale: I think I've heard of it in passing only... |
| 01:13:52 | <duaneb> | what's knew in Haskell? |
| 01:13:55 | <Berengal> | Does seem interesting |
| 01:14:09 | <duaneb> | so, why are types boxed by default? |
| 01:14:10 | <Adamant> | maybe I should adopt rebuilding OTP in Haskell as a pet project :P |
| 01:14:19 | <duaneb> | Doesn't strict typing allow for automatic unboxing? |
| 01:14:28 | <Cale> | duaneb: Because polymorphism doesn't work without it. |
| 01:14:28 | <duaneb> | or rather, automatic use of unboxed types? |
| 01:14:43 | <Cale> | Well, polymorphism + separate compilation, anyway |
| 01:14:44 | <mmorrow> | duaneb: ghc does this to the extent that it can |
| 01:14:51 | <duaneb> | ah |
| 01:14:59 | <Cale> | Think about the work that 'map' has to do. |
| 01:15:23 | <Cale> | The only way it can possibly just be one function is if all data is of a single uniform representation. |
| 01:16:10 | <mmorrow> | yeah, ghc can't unbox polymorphic types |
| 01:16:19 | <mmorrow> | but it'll usually unbox an Int |
| 01:16:27 | <Cale> | So if you started randomly unboxing things, you'd need to compile separate versions of map, and all the other polymorphic functions to deal with the difference in representation. |
| 01:16:31 | <duaneb> | well, why not have multiple maps? |
| 01:16:44 | <duaneb> | That's what I would do... |
| 01:16:46 | <Cale> | Well, because map is in the Prelude, and it's already compiled. |
| 01:17:15 | <Cale> | So it would have to have compiled versions of map for future unboxed types of data which it couldn't possibly know about. |
| 01:17:32 | <mmorrow> | i think maps a slightly bad example here because map only deals with pointers any way you cut it |
| 01:17:42 | <Cale> | Well, only because things are boxed. |
| 01:17:48 | <dons> | well, it can, but you have to program the unboxing explicitly (via associated representation types). |
| 01:18:06 | <mmorrow> | Cale: (i mean map over lists) |
| 01:18:14 | <Cale> | If you start unboxing things and storing them directly in the list nodes, I mean. |
| 01:18:21 | <mmorrow> | ah |
| 01:18:44 | <duaneb> | well, ok |
| 01:19:21 | <Cale> | It becomes a problem because the same code won't work, you need to keep compiling new versions of things. Seeing as almost every function we write is polymorphic in one way or another, that begins to get expensive too. |
| 01:19:22 | <dons> | all statically typed FP languages with parametric polymorphism use a uniform representation, afaik. |
| 01:19:45 | <duaneb> | well, consider + |
| 01:19:53 | <duaneb> | (I really hope ghc optimizes the hell out of that) |
| 01:19:56 | <dons> | oh, sure. |
| 01:20:01 | <dons> | if the type is known statically, of course it is. |
| 01:20:07 | <duaneb> | but (+) :: (Num a) => a -> a -> a |
| 01:20:11 | <Cale> | It does *if it knows which type you've selected* |
| 01:20:12 | <dons> | right. |
| 01:20:18 | <dons> | it knows the type you use it at. |
| 01:20:33 | <dons> | so then it replaces (+) with the , e.g. Int version |
| 01:20:39 | <Cale> | But if you write and compile a polymorphic function, then perhaps not. |
| 01:20:53 | <Cale> | (well, certainly not, if (+) is applied polymorphically) |
| 01:20:54 | <duaneb> | isn' |
| 01:20:58 | <dons> | right, then you might use INLINE or SPECIALIZE to ensure that it will propagate to a site where the type is known |
| 01:21:02 | <duaneb> | Cale: ok, fair enough |
| 01:21:08 | <duaneb> | huh |
| 01:21:08 | <duaneb> | ok |
| 01:21:13 | <duaneb> | new way of thinking about it |
| 01:21:15 | <duaneb> | that's cool |
| 01:21:31 | <dons> | ghc will very aggressively inline things, replacing general polymorphic code with specialized instances as it goes |
| 01:21:42 | <duaneb> | ok, now switching gears completely |
| 01:22:12 | <gnuvince_> | dons: I skimmed the GHC May09 report, and it did not mention stream fusion for lists in 6.12. Is that still a go or has it been pushed back? |
| 01:22:32 | <dons> | its not planned afaik. just use the library of stream-based lists. |
| 01:22:58 | <duaneb> | (one second, preparing a paste) |
| 01:23:22 | <eck> | hi all, i'm trying to write a library that uses the ffi, and i'm having difficulty figuring out how to convert an Int to a CSize. can anyone help me out? |
| 01:23:22 | <gnuvince_> | dons: http://hackage.haskell.org/trac/ghc/ticket/915 |
| 01:23:27 | <gnuvince_> | dons: this isn't about that? |
| 01:24:08 | <dons> | gnuvince_: yep |
| 01:24:10 | <duaneb> | http://www.pasteall.org/5510/haskell |
| 01:24:12 | <mmorrow> | hmm, consider: struct cons { struct cons *tail; char data[];}; you could have a polymorphic map over such a rep, *and* store the data in the list nodes |
| 01:24:14 | <dons> | eck: fromIntegral |
| 01:24:23 | <eck> | dons, thanks |
| 01:24:25 | <duaneb> | Why does `(Vector2 1 2) *. 5` not work? |
| 01:24:56 | <hatds> | :t fromIntegral |
| 01:24:57 | <lambdabot> | forall a b. (Num b, Integral a) => a -> b |
| 01:25:04 | <hatds> | does lots of different conversions too :) |
| 01:26:10 | <duaneb> | I feel like I'm not doing the type class correctly or something.... |
| 01:27:07 | <mmorrow> | gc would be painful though with that rep.. |
| 01:27:27 | <mmorrow> | well, not painful per se, you'd just need to store extra info somewhere |
| 01:27:42 | <duaneb> | huh |
| 01:27:42 | <duaneb> | ok |
| 01:28:05 | <mmorrow> | (err, i was talking about "struct cons...") |
| 01:28:14 | <duaneb> | so I have an operator, (*.) :: (Vector a b) => a -> b -> a |
| 01:28:15 | <mmorrow> | (in case that was ambiguous :) |
| 01:28:44 | <duaneb> | it does not, however, allow: (Vector2 1 2) *. 2, because 2's type is unclear |
| 01:28:56 | <duaneb> | how can I tell the compiler that '2' should be interpreted as a Double? |
| 01:29:00 | <duaneb> | will 2::Double work? |
| 01:29:02 | <mauke> | (2 :: Double) |
| 01:29:07 | <duaneb> | > :t (2::Double) |
| 01:29:08 | <lambdabot> | <no location info>: parse error on input `:' |
| 01:29:16 | <duaneb> | oh, damn |
| 01:29:35 | <mmorrow> | @type 2 :: Double |
| 01:29:36 | <lambdabot> | Double |
| 01:29:44 | <duaneb> | used to ghci :/ |
| 01:29:51 | <mauke> | :t (2::Double) |
| 01:29:52 | <lambdabot> | Double |
| 01:29:53 | <mmorrow> | :t 2 :: Double |
| 01:29:54 | <lambdabot> | Double |
| 01:30:06 | <mmorrow> | :!sudo halt |
| 01:30:54 | <Cale> | duaneb: btw, your convention is the opposite of most people's usual one -- it's common to put the . or ^ on the sides of the operator where the vector is :) |
| 01:31:08 | <duaneb> | Cale: whoops |
| 01:31:14 | <duaneb> | what's the reasoning for that? |
| 01:31:32 | <duaneb> | I thought the point (i.e., '.') on the side of the floating *point* would make more sense |
| 01:31:39 | <Cale> | Well, since you can't name vector addition + you have to use something like .+. |
| 01:31:48 | <hatds> | if Vector2 is a Type Constructor that holds two values of the same type then you might consider making it an instance of functor |
| 01:31:54 | <Cale> | and that has vectors on both sides |
| 01:32:03 | <duaneb> | Cale: I just have vector as a number |
| 01:32:09 | <Cale> | ah |
| 01:32:11 | <duaneb> | it is, technically, a single number on multiple planes |
| 01:32:37 | <Cale> | Yeah, you can write a Num instance I suppose, where multiplication is elementwise |
| 01:32:42 | <hatds> | so both components are the same type? |
| 01:32:45 | <Cale> | in that case it's fine :) |
| 01:32:55 | <davidL> | in converting a context-free grammar to CNF, are you allowed to simplifiy the grammar during the step of removing unit rules? |
| 01:33:23 | <duaneb> | ok, one last thing |
| 01:33:32 | <duaneb> | how can I specify extensions in a file?/ |
| 01:33:41 | <Berengal> | {-# LANGUAGE |
| 01:33:43 | <duaneb> | it's like {#MultiParamTypeClasses#} or something |
| 01:33:58 | <jfredett> | I remember there was some way to do this- but how do I dynamically include the current version number / path information of a cabalized package within the program? |
| 01:34:17 | <jfredett> | I think it was some kind of auto-generated import, but I can't find the info online. |
| 01:34:20 | <Saizan_> | jfredett: import Paths_$pkgname |
| 01:34:24 | <hatds> | {-# LANGUAGE ...stuff... #-} |
| 01:34:44 | <jfredett> | awesome, is there a Doc that contains all that stuff, so I can bookmark it? |
| 01:34:57 | <hatds> | format of 'stuff' is remove the "-X" from compiler flags, e.g. -XBangPatterns flag becomes BangPatterns |
| 01:35:13 | <Saizan_> | have you looked at the documentation on haskell.org/cabal ? |
| 01:35:35 | <jfredett> | I've looked through it, but theres a lot... |
| 01:35:50 | <jfredett> | I'll check it again, now thatI know what I'm looking for. |
| 01:36:07 | <Saizan_> | i'm not sure if it's actually there |
| 01:36:27 | <jfredett> | hmm |
| 01:38:08 | <jfredett> | aha! http://haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#paths-module |
| 01:38:29 | <jfredett> | ACTION would have never found that if he hadn't known what to look for. |
| 01:38:32 | <jfredett> | Saizan_++ |
| 01:38:33 | <jfredett> | ! |
| 01:39:57 | <sysadmin> | is anyone using yi? |
| 01:40:03 | <Lemmih> | I am. |
| 01:40:14 | <sysadmin> | what platform? |
| 01:40:38 | <Lemmih> | Linux, x86-64 |
| 01:40:41 | <sysadmin> | Man, it would be so great to have my editor all juiced up on haskell. |
| 01:41:23 | <naxa> | hi |
| 01:42:33 | <naxa> | I've got problems defining func. "multiplicity" in http://pastebin.com/m507ab7b1 how do I do a pattern match on my data? |
| 01:42:39 | <duaneb> | yi have an osx frontend yet? |
| 01:44:13 | <mauke> | naxa: multiplicity (Bag []) _ = 0; multiplicity (Bag ((xn,xp):xs)) szo |
| 01:44:39 | <naxa> | mauke: oh i got it, thanks! :) |
| 01:46:42 | <naxa> | mauke: oh. it says now that couldn't match expected type Bag against inferred type [Pair] :S what am i doing wrong? |
| 01:47:34 | <mauke> | you're calling multiplicity on xs |
| 01:47:37 | <mauke> | which is not a Bag |
| 01:48:50 | <duaneb> | hey, is there any way to get Cabal to automatically add /opt/local/lib to the lib search path |
| 01:50:32 | <Saizan_> | put extra-lib-dirs: /opt/local/lib into your ~/.cabal/config |
| 01:50:41 | <Saizan_> | that'll work for cabal-install |
| 01:51:14 | <duaneb> | ok |
| 01:52:52 | <naxa> | mauke: oh, my, thanks :) |
| 01:53:07 | <tiglionabbit> | does anyone here use facebook? |
| 01:54:09 | <naxa> | mauke: why, now it works. thank you mauke, you've saved my life. :) |
| 01:54:16 | <sysadmin> | I'm cabal installing yi righ tnow. |
| 01:54:49 | <gwern> | and so begins sysadmin's descent into the 6th circle |
| 01:55:05 | <gwern> | (hope he has a poet handy) |
| 01:55:13 | <duaneb> | hah |
| 01:55:22 | <duaneb> | haskell's of the literate type, I see :P |
| 01:55:51 | <gwern> | how many languages support literate files natively, eh? |
| 01:55:56 | <gwern> | (2 kinds to boot) |
| 01:57:08 | <gwern> | sysadmin: but srsly, you'll want to keep the source handy, if only to look at the bundled configs |
| 02:00:20 | <duaneb> | anyone know how functional the cocoa frontend for yi is? |
| 02:03:23 | <duaneb> | hrm. |
| 02:03:51 | <duaneb> | utility-ht-0.0.5 requires QuickCheck < 2, yet yi 0.6.2 requires QuickCheck >= 2 |
| 02:08:42 | <dons> | duaprob. ok... |
| 02:35:31 | <jfredett> | hmm, so- that Paths_$pkgname is fantastic for when you're compiling, but how can I make it work when I have things loaded in the interpreter, and am just hacking on the code? |
| 02:37:35 | <Leo> | Hi!!! |
| 02:39:56 | <sjanssen> | jfredett: use -idist/build/blahblahblah |
| 02:40:35 | <jfredett> | oh- duh, that makes sense. |
| 02:43:15 | <sysadmin> | Hm.. What's alex? |
| 02:43:35 | <sysadmin> | I read about that at http://blog.zacbrown.org/2009/04/03/installing-yi-on-mac-os-x/ |
| 02:43:55 | <sysadmin> | where it said that it wont' find alex if .cabal/bin is not in your path, but it is in my $PATH. |
| 02:47:23 | <Cale> | alex is a lexer generator |
| 02:47:47 | <Cale> | You also have to have alex installed of course... |
| 02:48:04 | <Cale> | (It probably should have installed it on its own...) |
| 02:48:38 | <Cale> | But if you don't have an alex executable in ~/.cabal/bin then you should cabal install alex |
| 02:50:04 | <mmorrow> | does the cabal alex package already have the .x's processed? |
| 02:50:17 | <mmorrow> | because if not, you need alex to build alex.. |
| 02:50:42 | <mmorrow> | (or just process the .x's on another machine or get the reuslting .hs from elsewhere) |
| 02:50:46 | <mmorrow> | *resulting |
| 02:51:15 | <mmorrow> | (same for happy) |
| 02:53:56 | <sysadmin> | Okay. I cabal installed alex. |
| 02:54:02 | <sysadmin> | Now do I have to cabal install yi all over again? |
| 02:55:22 | <Cale> | sysadmin: any work which was done when the previous cabal install of yi failed will have been preserved |
| 02:55:39 | <Cale> | So yeah, just run that command again and it should continue |
| 02:55:42 | <sysadmin> | cabal is great. |
| 02:56:01 | <mmorrow> | this looks interesting http://hackage.haskell.org/cgi-bin/hackage-scripts/package/visual-graphrewrite |
| 02:56:03 | <Berengal> | cabal is indeed awesome |
| 02:57:49 | <psygnisfive> | there are graph rewriting steps in haskell? |
| 02:57:59 | <copumpkin> | yup! |
| 02:58:04 | <psygnisfive> | do tell! |
| 02:58:14 | <copumpkin> | you can even write your own rewrite rules |
| 03:00:27 | <dons> | mmorrow: have you worked out how to use it? |
| 03:01:12 | <mmorrow> | psygnisfive: the "graph" is the graph formed by heap nodes, where edges are pointers (:: Ptr HeapNode) contained in HeapNodes. "Rewriting" is just transformation of the heap done as a result of executing a program's code (some/all of which might also be contained in the heap) |
| 03:01:29 | <mmorrow> | dons: no, i just saw it in the "whatsnew" list |
| 03:01:58 | <mmorrow> | sometimes i wish the whatsnew list was longer and/or searchable by date |
| 03:01:59 | <psygnisfive> | interesting |
| 03:12:10 | <Cale> | Well, in general, the evaluation steps of a functional language are graph rewrites. |
| 03:12:33 | <copumpkin> | but we also have rewrites for the AST |
| 03:12:39 | <copumpkin> | or do those not count? |
| 03:13:38 | <Cale> | In normal order/lazy evaluation, you look at the top of the graph and you match it against the left hand side of a function definition, making a graph transformation according to the corresponding right hand side. |
| 03:15:18 | <Cale> | http://www.cas.mcmaster.ca/~kahl/HOPS/ANIM/index.html |
| 03:15:19 | <Cale> | :) |
| 03:15:39 | <copumpkin> | that is awesome |
| 03:15:52 | <mmorrow> | yeah, the rewriting can be thought of at 3 (my choice of #) different levels: (1) transformations of the AST representing an expression done in the abstract, (2) transformation of either the AST or a rep thereof in some abstract machine done by code which that abstract machine interprets, (3) same as in 2, but s/abstract machine/hardware/ ==> so code and data are the same thing and the line is blurred between what is operating on what |
| 03:15:59 | <Twey> | Why don't we have an OS that uses Cabal for its package management system, already? |
| 03:16:21 | <Cale> | Cabal is a little bit specialised toward Haskell code at the moment, I think. |
| 03:17:01 | <mmorrow> | so in (3) there, the graph can be thought of as acting on itself (if code in also contained in heap nodes) |
| 03:17:32 | <mmorrow> | well, s/thought of/it literally does this/ |
| 03:17:34 | <Saizan_> | Twey: first of all you should write a better dependency resolver for cabal-install :) |
| 03:17:44 | <Twey> | Ah :-P |
| 03:19:25 | <mmorrow> | Cale: whoa, just saw that link. very cool |
| 03:19:52 | <Saizan_> | it commits early to any choice made right now, something based on constraint programming or a SAT solver would be more flexible |
| 03:21:07 | <Twey> | It moves too fast — I can't read it :( |
| 03:21:40 | <mmorrow> | if we can figure out (this might already be possible somehow, e.g. the debugger does this with breakpoints, and hpc with "ticks") to instrument code the run an IO action whenever an heapnode is evaluated, that IO action can be to send info to a viewer which updates the view of the vacuum-like graph ==> you can animate (low-level) evaluation |
| 03:22:13 | <mmorrow> | that would be sweeet |
| 03:22:38 | <Twey> | That would be very sweet |
| 03:22:45 | <Twey> | It would look awesome, and also be a great debugging tool |
| 03:22:52 | <mmorrow> | totally |
| 03:23:16 | <Twey> | I would look into GHC-as-a-library: it sounds like it should be possible |
| 03:23:28 | <tiglionabbit> | what's a good server to develop haskell web applications with? |
| 03:23:40 | <Saizan_> | ACTION 'd like SCC names on that graph |
| 03:23:44 | <mmorrow> | Twey: yeah, i think this can be piggybacked on either the debugger's code or hpc's |
| 03:24:09 | <Twey> | tiglionabbit: lighttpd is popular |
| 03:24:28 | <Twey> | Most web frameworks can use anything that supports FastCGI |
| 03:24:28 | <mmorrow> | (the debugger only works for bytecode though, so it'd have to be piggybacked on hpc i guess (if piggybacking is possible) |
| 03:24:49 | <Saizan_> | tiglionabbit: happstack has also a built-in server |
| 03:24:59 | <Twey> | Yeah |
| 03:25:33 | <Twey> | Frameworks with built-in servers aren't so good for playing nicely with existing setups, though |
| 03:26:22 | <tiglionabbit> | yeah well I just wanted it for experimenting |
| 03:26:30 | <tiglionabbit> | I could try installing lighty on my dev machine though... |
| 03:27:19 | <Twey> | tiglionabbit: Yeah, but it's easier to experiment if you don't have to set up a whole new port for it. IMO. |
| 03:28:14 | <mmorrow> | you can always forward certain requests to another server, but this is painful (for me at least, since i don't know that much about it) |
| 03:28:27 | <andyjgill_> | mmorrow: Have you seen http://movies.unsafeperformio.com/hpctpreview2.mov |
| 03:28:41 | <mmorrow> | andyjgill_: ooh, no |
| 03:28:45 | <mmorrow> | ACTION looks |
| 03:29:16 | <mmorrow> | andyjgill_: whoa, is that the ajax ui? |
| 03:29:28 | <mmorrow> | i just saw that the other day on hackage but haven't checked it out yet |
| 03:29:52 | <andyjgill_> | Yes. on top of hpc. About 18 months ago. |
| 03:29:58 | <mmorrow> | heh |
| 03:30:08 | <DarKoBrA> | hola, alguien habla español¿? |
| 03:30:35 | <mmorrow> | andyjgill_: i've gotta learn more about hpc |
| 03:30:56 | <andyjgill_> | Galois released it, so its public, and I'm rewriting it, piece by piece. I just need time to work on it, or help. |
| 03:31:29 | <andyjgill_> | But if your trying to build something on top of hpc, i've trodden that path a few times now. Lots can be done. |
| 03:31:30 | <mmorrow> | andyjgill_: in particular, do you think that "piggybacking on hpc's integrated code instrumenting by ghc" is possible to run an arbitrary IO action in place of/in addition to a tick? |
| 03:31:39 | <andyjgill_> | Yes. |
| 03:31:50 | <mmorrow> | andyjgill_: nice! exciting. |
| 03:32:03 | <pimpkonFollower> | DarKoBrA: perhaps, try #haskell.es |
| 03:32:04 | <Twey> | DarKoBrA: ¡Españoles son miticos! |
| 03:33:04 | <andyjgill_> | I was running some C code at each tick at one point. Look through the GHC repo about Nov 2006. |
| 03:33:20 | <andyjgill_> | boy time flies. |
| 03:33:22 | <mmorrow> | nice, will do |
| 03:33:23 | <mmorrow> | heh |
| 03:33:26 | <cads> | andyjgill_: that video's nifty, who are those guys? |
| 03:34:21 | <andyjgill_> | cads: ? It was an extension to hpc, a sign of things to come. |
| 03:35:01 | <kerlo> | Qué son "miticos"? |
| 03:36:09 | <kerlo> | Hmm, "mythical". |
| 03:37:11 | <mmorrow> | andyjgill_: also, data-reify is interesting. i just yesterday used that idea (StableNames to break up a piece of data into a graph with sharing explicit) in some code to break up/put back together a rep of a C type so that it can be serialized in the first part of a binary stream, then decoded and reconstructed by the other end in order to figure out how the decode the rest |
| 03:37:46 | <mmorrow> | so you can make circular descriptions of C data, and then be able to serialize them |
| 03:38:03 | <mmorrow> | myRep = Struct [D, Struct [P myRep, I], ...] |
| 03:38:21 | <andyjgill_> | mmorrow: Cool. Glad it was useful. I've got a new version 0.3 uploaded, and a paper written about it on my webpage. |
| 03:38:54 | <mmorrow> | nice, yeah i just downloaded 0.3. didn't know about the paper, will check it out |
| 03:38:55 | <andyjgill_> | mmorrow: There seems to be lots of uses for it, once you have it. |
| 03:39:04 | <mmorrow> | andyjgill_: totally, i think so too |
| 03:42:28 | <mmorrow> | heh, i also needed mdo for the first (non-gratuitous) time in the code to reconstruct the Rep from the RepGraph |
| 03:50:44 | <mmorrow> | andyjgill_: ah yeah, i tried initially to access the paper from data-reify's hackage page, but the link is broken (http://ittc.ku.edu/~andygill/data-reify.php) |
| 03:50:58 | <mmorrow> | (just found it though) |
| 03:52:23 | <andyjgill_> | Yes. I've not written it (yet) it will point to the paper, and give a couple of examples. Perhaps tomorrow. |
| 03:54:54 | <mmorrow> | oh, so you're writing a data-reify-specific one in addition to this http://www.ittc.ku.edu/~andygill/paper.php?label=DSLExtract09 |
| 03:55:48 | <naxa> | hi (it's me again:))! I have a data named Bag here: http://pastebin.com/m804b605 now I would like to write something to insert into Bag and delete into Bag but i can't figure out how to do this. it would also be so nice if I could see somehow what is in an instance of Bag but I didn't get how to do that showy thing yet |
| 03:56:00 | <naxa> | *delete from |
| 03:56:35 | <naxa> | someone has a hint how to do a working insert? |
| 03:56:54 | <andyjgill_> | mmorrow: no, DSLExtract09 is the paper about data-reify. |
| 03:57:26 | <Berengal> | naxa: insert is just (:)' |
| 03:57:34 | <mmorrow> | andyjgill_: ah, gotcha.. |
| 03:57:49 | <Berengal> | > let insert = (:) in insert 5 [4,3,2,1] |
| 03:57:50 | <lambdabot> | [5,4,3,2,1] |
| 03:57:56 | <mmorrow> | andyjgill_: "it will point to the paper, and give a couple of examples" :) |
| 03:58:00 | <mauke> | data ... deriving (Show) |
| 03:58:42 | <Berengal> | delete would be something like deleteBy (comparing fst) |
| 03:59:12 | <Berengal> | > let delete = deleteBy (comparing fst) in delete 5 [5,4,3,2,1] |
| 03:59:13 | <lambdabot> | Couldn't match expected type `Bool' |
| 03:59:23 | <mauke> | :t deleteBy |
| 03:59:24 | <lambdabot> | forall a. (a -> a -> Bool) -> a -> [a] -> [a] |
| 03:59:40 | <mauke> | > delete 5 [5,4,3,2,1] |
| 03:59:41 | <lambdabot> | [4,3,2,1] |
| 03:59:41 | <Berengal> | > let delete = deleteBy ((==) `on` fst) in delete 5 [5,4,3,2,1] |
| 03:59:42 | <lambdabot> | No instance for (Num (a, b)) |
| 03:59:42 | <lambdabot> | arising from the literal `5' at <in... |
| 03:59:56 | <Berengal> | Bleh, I mess up again... |
| 03:59:57 | <naxa> | Berengal: I have something like this ("apple",3) in an instance of bag. I would like to insert an apple. then I should have ("apple",4). I don't see how it is done with (:) |
| 04:00:11 | <Berengal> | > let delete = deleteBy ((==) `on` fst) in delete 5 (join zip [5,4,3,2,1]) |
| 04:00:12 | <lambdabot> | No instance for (Num (a, a)) |
| 04:00:12 | <lambdabot> | arising from the literal `5' at <in... |
| 04:00:22 | <naxa> | Berengal: also, I can do delete on a list but i don't know how to handle my data Bag |
| 04:00:39 | <naxa> | Berengal: you see, i am a noob here and this is my homework. :) |
| 04:00:47 | <Cale> | naxa: deriving (Eq, Show) |
| 04:00:54 | <Berengal> | naxa: Ah, okay |
| 04:01:05 | <naxa> | Cale: thanks, I didn't get show was that simple... :) |
| 04:01:12 | <Berengal> | Hmm, lists don't have insertWith? |
| 04:01:46 | <Cale> | naxa: huh? You already have an insert function... |
| 04:01:52 | <Cale> | Is it broken? |
| 04:01:57 | <naxa> | Cale: wow, and I almos completed my own showBag function what does the same thing... :) |
| 04:02:11 | <naxa> | Cale: this insert is not working for me |
| 04:02:42 | <naxa> | Cale: the test case would be insert surprise "peach" == fromList [("apple",2),("strawberry",3),("peach",2)] ; this should be true, but it's false |
| 04:03:40 | <Cale> | naxa: Ah right, you're not recursing along the list |
| 04:04:38 | <Cale> | naxa: If the first element in the bag is "peach", then you want to increment its count. Otherwise, you want to add that element to the start of another bag which is formed by inserting peach into the remainder. |
| 04:04:54 | <naxa> | Cale: that's right |
| 04:05:16 | <naxa> | Cale: I think the problem is that after insterting peach it shows up as the first pair in the bag |
| 04:05:24 | <naxa> | Cale: but originally it was the last |
| 04:05:26 | <Cale> | yes. |
| 04:05:30 | <naxa> | Cale: thus they're not equal |
| 04:05:35 | <Cale> | So go with my method :) |
| 04:06:12 | <Cale> | There's nowhere in your implementation of insert where you check to see if the thing to insert is equal to the value which is first in the bag. |
| 04:06:48 | <naxa> | Cale: to be honest I am a bit lost with pattern matching and (:). this thing was my best guess. :) |
| 04:07:06 | <naxa> | Cale: may I ask you to pastebin an example code for me with your way, maybe? |
| 04:07:14 | <Cale> | Well, your function will look a lot like multiplicity, but it won't call multiplicity. |
| 04:07:29 | <naxa> | Cale: let me see |
| 04:08:22 | <mauke> | f x [] = [(x,1)]; f x ((k,v) : t) | x == k = (k, v+1) : t | otherwise = (k,v) : f x t |
| 04:08:55 | <naxa> | Cale: hey, your way rocks. (sorry I haven't sleep today (coding various stuff..), so I only understood it now :D) |
| 04:09:16 | <naxa> | Cale: now I try to implement this then |
| 04:10:08 | <mmorrow> | andyjgill_: one thing i've been thinking about is using vacuum's/equivalent method to serialize, with sharing retained, the heapgraph of an arbitrarily-typed piece of data (and then be able to reify it later, but this direction would need rts code), similar to smlnj's ability. |
| 04:10:17 | <Berengal> | Am I wrong it pointing out Data.Map? |
| 04:10:30 | <Cale> | Berengal: Well, this is homework. |
| 04:10:51 | <Berengal> | Cale: Yes, but we don't know the parameters |
| 04:10:59 | <Cale> | Berengal: But normally, that would be a lot better than manipulating lists like this |
| 04:11:04 | <andyjgill_> | mmorrow: I'd be delighted to help get something working. |
| 04:11:07 | <mmorrow> | andyjgill_: unfortunately this has the current problem that ghc coerces unpointed closures to HValue, which it then proceeds to enter causes the prog to crash |
| 04:11:07 | <Cale> | That's true |
| 04:11:25 | <Cale> | If the homework is to implement a bag in any way possible, then Data.Map is the way to go. |
| 04:11:49 | <mmorrow> | andyjgill_: cool. i'm gathering my ideas (for this and also the s/tick/IO ()/ stuff) currently, i'll let you know. |
| 04:11:51 | <Berengal> | I'm a little surprised at the lack of support for assoclists actually... |
| 04:12:20 | <Cale> | Association lists are generally one of the worst things for performance. |
| 04:12:49 | <Cale> | (because people always want to use them to look stuff up) |
| 04:13:09 | <Berengal> | Yeah, a Data.Map is just as easy to use |
| 04:13:21 | <andyjgill_> | mmorrow: cheers! |
| 04:13:27 | <naxa> | Cale, Berengal: well, may homework is to implement the "Bag" data structure what's like this [(string,int)] |
| 04:13:41 | <Berengal> | naxa: Okay, so no Data.Map then :) |
| 04:13:42 | <naxa> | Cale, Berengal and I should write some functions |
| 04:13:43 | <Cale> | naxa: Right, so you don't have a choice :) |
| 04:13:49 | <naxa> | I guess... |
| 04:14:16 | <Cale> | naxa: But if you were allowed to use Map String Int instead, your homework would be super-easy :) |
| 04:14:34 | <naxa> | heehee |
| 04:14:59 | <naxa> | so I hope it's really not just me. :P but the rules seem quite straightforward |
| 04:15:06 | <Cale> | (because all the lookup, insertion, etc. would already be done for you) |
| 04:15:14 | <Berengal> | It's not that hard to port the useful Map functions to assoc lists though... |
| 04:15:23 | <Berengal> | But I guess that's the point of the homework anyway |
| 04:15:37 | <Cale> | My guess is that doing so would not be in the spirit of the homework :) |
| 04:16:01 | <Berengal> | Cale: I'm not talking about toList . foo . fromList functions |
| 04:16:06 | <Cale> | Which is probably to get you comfortable with this sort of recursive idiom. |
| 04:16:09 | <Cale> | oh |
| 04:16:14 | <Saizan_> | Data.List.lookup is still useful |
| 04:16:31 | <Berengal> | Saizan_: It's also about the only one we've got :P |
| 04:18:15 | <naxa> | Cale: well, um. insert must be insert :: Bag -> String -> Bag ; now i don't see how to add the first element to the remainder if it's string part is not equal to the string what i want to insert, since i don't know how to add an element... it shouldn't be done with my insert function since then the int part of the originally first elemment would be lost... uh.. |
| 04:19:10 | <naxa> | but if I simply "repeat" my pattern then it will go nowhere... running forever... |
| 04:19:28 | <Berengal> | naxa: Is insert supposed to insert a single item into the list? |
| 04:19:55 | <naxa> | Berengal: let me say, yes. there is no way to tell it how much of that you want. it should insert only one |
| 04:20:14 | <Berengal> | naxa: And if there is something there already, should it just add one? |
| 04:20:30 | <naxa> | yeah |
| 04:21:03 | <naxa> | yes |
| 04:22:09 | <QtPlaty[HireMe]> | Is there a type function equiverlent to id? |
| 04:22:10 | <naxa> | Cale, Berengal: oh... i think i see again... so sleepless... let me try again. :) |
| 04:22:32 | <mauke> | @kind Identity |
| 04:22:33 | <lambdabot> | * -> * |
| 04:22:49 | <QtPlaty[HireMe]> | mauke: Thanks |
| 04:22:51 | <Berengal> | ACTION thinks an insertWith function for lists would be really handy in this case |
| 04:23:33 | <Berengal> | insertWith :: (b -> b -> b) -> a -> b -> [(a, b)] -> [(a, b)] |
| 04:24:06 | <mauke> | > let f x [] = [(x,1)]; f x ((k,v) : t) | x == k = (k, v+1) : t | otherwise = (k,v) : f x t in f "bar" [("foo",1), ("bar",2), ("baz",3)] |
| 04:24:07 | <lambdabot> | [("foo",1),("bar",3),("baz",3)] |
| 04:24:58 | <Saizan_> | naxa: write an insert' :: Bag -> (String,Int) -> Bag, and then "insert b s = insert' b (s,1)" |
| 04:25:44 | <Berengal> | insertWith f k v [] = [(k,v)]; insertWith f k v ((mk, mv):r) if mk == k then (mk, f mv v):r else (mk,mv):insertWith f k v r |
| 04:25:52 | <Saizan_> | right, disregard my comment :) |
| 04:26:07 | <chromakode> | hey all, what do you use to shuffle lists? |
| 04:26:23 | <mauke> | I use oleg |
| 04:27:09 | <Saizan_> | ?google oleg perfect shuffle |
| 04:27:10 | <lambdabot> | http://okmij.org/ftp/Haskell/perfect-shuffle.txt |
| 04:27:21 | <chromakode> | thanks mauke |
| 04:27:40 | <chromakode> | nothing in the stdlib, I take it? |
| 04:29:52 | <naxa> | Berengal: I'm affraid that's a bit too complex for me in my current state (..no..sleep..:)) but I'll try and, uh, do sg. :) |
| 04:30:10 | <dolio> | @type insertWith |
| 04:30:11 | <lambdabot> | Not in scope: `insertWith' |
| 04:30:28 | <dolio> | @type insertBy |
| 04:30:29 | <lambdabot> | forall a. (a -> a -> Ordering) -> a -> [a] -> [a] |
| 04:30:30 | <Berengal> | naxa: It looks better if you put it in a text editor and format it properly and exchange the if with a guard |
| 04:32:09 | <Berengal> | naxa: Basically: It takes a function (b -> b -> b), a key (a), a value (b) and a list of (a, b) ((key, value)). If the key isn't in the list, the key and value are added last. If the key is in the list already, the function is given the old value and the new value and the old value is replaced by that |
| 04:33:13 | <Berengal> | > let insertWith f k v [] = [(k,v)]; insertWith f k v ((mk, mv):r) = if mk == k then (mk, f mv v):r else (mk,mv):insertWith f k v r in insertWith (+) "apple" 1 [("apple", 6)] |
| 04:33:14 | <lambdabot> | [("apple",7)] |
| 04:33:20 | <Berengal> | > let insertWith f k v [] = [(k,v)]; insertWith f k v ((mk, mv):r) = if mk == k then (mk, f mv v):r else (mk,mv):insertWith f k v r in insertWith (+) "apple" 1 [("orange", 6)] |
| 04:33:21 | <lambdabot> | [("orange",6),("apple",1)] |
| 04:34:03 | <naxa> | wow. how nice. :) |
| 04:34:59 | <wli> | type MultiSet t = Map t Integer |
| 04:36:24 | <Berengal> | I'm sure this could be done as a foldr... |
| 04:37:39 | <Berengal> | As long as there's no duplicate keys at least |
| 04:38:14 | <mmorrow> | @let histo = M.toList . (\m -> let n = (fromIntegral . sum) (M.elems m) in M.map (\x -> fromIntegral x / n) m) . foldl' (\m x -> M.insertWith' (+) x 1 m) mempty |
| 04:38:15 | <lambdabot> | Defined. |
| 04:38:26 | <naxa> | Berengal: hey, now I see. :)) actually, I was just lost with my own try it's line "| otherwise = (Bag [((xn,xp)):(insert (Bag (xs)) szo)])" with some type errors... I'll try and reuse your great function in mine. :) |
| 04:38:33 | <mmorrow> | > histo (take 1000000 . randomRs ('a','d') $ mkStdGen 0928094) |
| 04:38:35 | <lambdabot> | [('a',0.249969),('b',0.250017),('c',0.250311),('d',0.249703)] |
| 04:38:47 | <copumpkin> | mm histo! |
| 04:38:51 | <mmorrow> | weeee |
| 04:39:05 | <naxa> | (if everything fails, I think I may just borrow it, since my time has grown very short lately. :)) |
| 04:39:53 | <mmorrow> | @let collect (<>) f g = foldl' (\m a -> M.insertWith' (<>) (f a) (g b) m) mempty {- imo the most useful Map-related function evar -} |
| 04:39:54 | <lambdabot> | Defined. |
| 04:40:28 | <mmorrow> | @let collect S.union fst (S.singleton . snd) |
| 04:40:29 | <lambdabot> | Parse error |
| 04:40:35 | <mmorrow> | @type collect S.union fst (S.singleton . snd) |
| 04:40:37 | <lambdabot> | Ambiguous occurrence `collect' |
| 04:40:37 | <lambdabot> | It could refer to either `L.collect', defined at <local>:3:0 |
| 04:40:37 | <lambdabot> | or `Test.QuickCheck.collect', imported from Test.QuickCheck |
| 04:40:40 | <mmorrow> | sigh |
| 04:40:51 | <mmorrow> | @let wrangle (<>) f g = foldl' (\m a -> M.insertWith' (<>) (f a) (g b) m) mempty {- imo the most useful Map-related function evar -} |
| 04:40:52 | <lambdabot> | Defined. |
| 04:41:04 | <mmorrow> | @type wrangle S.union fst (S.singleton . snd) |
| 04:41:06 | <lambdabot> | Couldn't match expected type `Expr' against inferred type `(a, b)' |
| 04:41:06 | <lambdabot> | Expected type: Expr -> b1 |
| 04:41:06 | <lambdabot> | Inferred type: (a, b) -> b |
| 04:41:32 | <mmorrow> | crap |
| 04:41:39 | <mmorrow> | @let wrangle' (<>) f g = foldl' (\m a -> M.insertWith' (<>) (f a) (g a) m) mempty {- imo the most useful Map-related function evar -} |
| 04:41:40 | <lambdabot> | Defined. |
| 04:41:43 | <mmorrow> | @type wrangle S.union fst (S.singleton . snd) |
| 04:41:44 | <lambdabot> | Couldn't match expected type `Expr' against inferred type `(a, b)' |
| 04:41:44 | <lambdabot> | Expected type: Expr -> b1 |
| 04:41:44 | <lambdabot> | Inferred type: (a, b) -> b |
| 04:41:46 | <mmorrow> | @type wrangle' S.union fst (S.singleton . snd) |
| 04:41:47 | <lambdabot> | forall a b. (Ord a, Ord b) => [(a, b)] -> M.Map a (S.Set b) |
| 04:41:50 | <mmorrow> | </spam> |
| 04:42:27 | <mmorrow> | @type \f -> wrangle' mappend fst (f . snd) |
| 04:42:28 | <lambdabot> | forall a b c. (Ord a, Monoid c) => (b -> c) -> [(a, b)] -> M.Map a c |
| 04:42:50 | <mmorrow> | @type \f -> wrangle' (+) id (const 1) |
| 04:42:51 | <lambdabot> | forall t a b. (Ord b, Num a) => t -> [b] -> M.Map b a |
| 04:42:53 | <mmorrow> | @type wrangle' (+) id (const 1) |
| 04:42:54 | <lambdabot> | forall a b. (Ord b, Num a) => [b] -> M.Map b a |
| 04:43:01 | <mmorrow> | etc |
| 04:43:39 | <Berengal> | Yeah, map's nice |
| 04:44:16 | <mmorrow> | i'd say i import (Int)Map into 80% of modules i write |
| 04:45:06 | <wli> | Finished watching Memento? What's Memento? |
| 04:45:17 | <mmorrow> | i don't remember |
| 04:45:18 | <copumpkin> | IntMap is awesome |
| 04:45:29 | <mmorrow> | copumpkin: yeah totally |
| 04:45:43 | <wli> | ACTION has had better luck using Integer as a bitmap. |
| 04:45:45 | <mmorrow> | it's nice too because it's actually pretty easy to implement |
| 04:45:55 | <mmorrow> | (IntMaps never have to be balanced) |
| 04:45:56 | <copumpkin> | I think Map should be an associated type, with IntMap just being Map Int |
| 04:45:57 | <wli> | ACTION has mostly dense sets. |
| 04:46:09 | <copumpkin> | well |
| 04:46:12 | <copumpkin> | not "be an associated type" |
| 04:46:14 | <copumpkin> | but you know what I mean |
| 04:46:20 | <mmorrow> | copumpkin: yeah, that would be nice. the only thing that gets in the way is that you can't do: |
| 04:46:28 | <wli> | Or dense enough sets that the bitmap wins. |
| 04:46:36 | <mmorrow> | type family Map k v |
| 04:46:51 | <mmorrow> | type instance Map Int v = IntMap v |
| 04:46:58 | <mmorrow> | type instance Map k v = M.Map k v |
| 04:47:31 | <mmorrow> | which is unfortunate |
| 04:47:40 | <copumpkin> | it seems like the type system should allow that though |
| 04:47:48 | <copumpkin> | even though it currently doesn't |
| 04:48:03 | <mmorrow> | yeah, with classes too there's no concept of "everything except" |
| 04:48:20 | <mmorrow> | instance Foo (everything but (Tree Int)) where ... |
| 04:48:22 | <copumpkin> | yeah, seems like it wouldn't be too hard to tack on? |
| 04:48:27 | <naxa> | Berengal: I have something like this: http://pastebin.com/m42cc0e82 and it's not working becouse either expected type is (String,Int) but inferred is Bag or i do (Bag (xs,xp)):instert... and then expected type is [Pair] but inferred is (String,Int).... uh... i can't see, why is that. why is that? |
| 04:48:37 | <mmorrow> | copumpkin: i dunno, but it seems logical |
| 04:48:51 | <Saizan_> | copumpkin: OverlappingInstances are already problematic, because of separate compilation |
| 04:49:37 | <copumpkin> | yeah... but with type families I didn't think you could add stuff on later? |
| 04:49:48 | <Berengal> | naxa: You need to pull the list out of the Bag, so a toList function is in order |
| 04:50:03 | <Saizan_> | copumpkin: sure you can |
| 04:50:10 | <copumpkin> | oh ok |
| 04:50:49 | <Saizan_> | in fact, there's at least a paper mentioning closed type families, to allow overlapping patterns |
| 04:50:56 | <copumpkin> | ah, interesting |
| 04:51:50 | <Berengal> | naxa: It might be easier to just implement the insert and delete functions and so on on just lists, then wrap them in fromList . foo . toList to make them operate on bags |
| 04:52:48 | <Berengal> | naxa: So make an insertList function, then just let your insert function take the bag, unwrap the list it contains, and call the insertList function |
| 04:53:04 | <Berengal> | Anyway, work... |
| 04:53:44 | <roconnor> | I'm not sure how to deal with my feelings of disdain for the Haskell Platform. |
| 04:54:24 | <mmorrow> | copumpkin, Saizan_ : yeah, personally i would find type function that are more like functions to be more useful (i.e. you can't put a case for a function in another module, that would be crazy!! and also you can try matches in order) |
| 04:54:31 | <wli> | The "Haskell Platform?" |
| 04:54:48 | <roconnor> | wli: http://hackage.haskell.org/platform/ |
| 04:54:55 | <mmorrow> | typef F (Int,_) = Maybe [Double] |
| 04:55:06 | <mmorrow> | typef F (Tree (Maybe _)) = () |
| 04:55:14 | <mmorrow> | typef F _ = [Int] |
| 04:55:30 | <mmorrow> | or something |
| 04:55:35 | <wli> | roconnor: No idea I've never seen it before. |
| 04:55:43 | <inimino> | roconnor: the idea, or the execution? |
| 04:56:08 | <roconnor> | inimino: good question. I don't like the execution, because I don't like the choice of packages. |
| 04:56:18 | <roconnor> | inimino: which makes me think that the whole idea is bad. |
| 04:56:46 | <jfredett> | hmm, does ghci have an associated .ghcirc config thing? something to automatically set options (turn on timing, add default seach locations, etc?) |
| 04:56:49 | <roconnor> | what really is upsetting is that I might not be upset if I liked the choice of packages. |
| 04:57:28 | <mmorrow> | jfredett: .ghci |
| 04:57:40 | <mmorrow> | jfredett: $HOME/.ghci |
| 04:57:43 | <inimino> | roconnor: so perhaps it's too early for something so standardized |
| 04:57:45 | <jfredett> | mmorrow: it will automatically load that on startup? |
| 04:57:50 | <mmorrow> | jfredett: yes |
| 04:57:54 | <jfredett> | awesome |
| 04:58:00 | <roconnor> | inimino: perhaps |
| 04:58:19 | <Saizan_> | roconnor: well, the list of packages is supposed to grow |
| 04:58:22 | <roconnor> | inimino: but I kinda think if cabal gets better, then there is no need for standardization |
| 04:58:29 | <mmorrow> | you can put on each line any valid single-line input to ghci |
| 04:58:43 | <roconnor> | Saizan_: I want the mtl out. ... as is well know around this channel :) |
| 04:58:46 | <mmorrow> | jfredett: so :set's, "let foo = .. "'s, etc |
| 04:58:51 | <roconnor> | well known |
| 04:58:52 | <jfredett> | awesome |
| 04:58:55 | <jfredett> | awesome indeed. |
| 04:59:02 | <inimino> | roconnor: well, I would very much like to see /that/ happen |
| 04:59:14 | <roconnor> | inimino: see what happen? |
| 04:59:29 | <wli> | roconnor: What's wrong with the mtl? |
| 04:59:39 | <roconnor> | wli: I have a list of 3 things |
| 04:59:43 | <inimino> | cabal get better |
| 05:00:02 | <pimpkonFollower> | roconnor: Have you thought about a choice of packages that you wouldn't object to, or is the means used to pick the packages also objectionable to you? :) |
| 05:00:31 | <roconnor> | one sec |
| 05:00:58 | <Saizan_> | inimino: what in particular? |
| 05:01:44 | <Saizan_> | the right question is "how", maybe |
| 05:01:44 | <inimino> | roconnor: though until cabal gets better it would also be nice to have 'apt-get install haskell haskell-dev' and get "batteries included" |
| 05:02:01 | <roconnor> | pimpkonFollower: I haven't thought too much, but I could. However, clearly the platform shouldn't be what *I* want. That woudl be ridiculous. |
| 05:02:44 | <roconnor> | inimino: so by /that/ you meant "cabal becoming better?" |
| 05:03:17 | <roconnor> | wli: 1) one of the cont/state instances that is wrong. |
| 05:03:23 | <BMeph> | roconnor: Why is it ridiculous? It's only a problem if your reasons for your choices are so personal that they wouldn't apply to anyone else. If your objections are objectively valid, then they're relevant (er, by defn). :) |
| 05:03:37 | <wli> | Okay |
| 05:03:44 | <inimino> | Saizan_: mainly it's just frustration with upgrade issues between GHC, base libraries, etc |
| 05:03:46 | <inimino> | roconnor: yes |
| 05:03:48 | <roconnor> | wli: 2) pass shouldn't be in the writer class, and I'm suspicous of other methods too |
| 05:04:30 | <roconnor> | wli: 3) I'm told the state/value pair is backwards. I'm not sure why it is a problem, but lots of reputable people say it is. |
| 05:04:54 | <roconnor> | BMeph: ah good point. |
| 05:05:15 | <mmorrow> | roconnor: re: StateT (Cont), imo choosing/having just one of the two possible cases is wrong, both should be there (callCC1 and callCC2) |
| 05:05:28 | <roconnor> | BMeph: so maybe I should cry out loudly, "replace the mtl with monadlib" to the Platform people? |
| 05:05:42 | <mmorrow> | so both mtl *and* monadLib's instances are wrong, since neither has both :) |
| 05:06:18 | <BMeph> | mmorrow: "Both" being 1) and 3)? |
| 05:06:19 | <roconnor> | mmorrow: the modular monad transformer paper clearly picked out one. |
| 05:06:49 | <mmorrow> | roconnor: picking on is like making an Either type, and then only exporting one of {Left,Right} constructors. |
| 05:06:55 | <mmorrow> | *picking one ... |
| 05:07:43 | <mmorrow> | BMeph: both being two callCC versions, one of which retains the state when the cont is called, and one that rolls it back when the cont is called |
| 05:07:56 | <mmorrow> | mtl does the former, monadLib the latter |
| 05:08:07 | <roconnor> | mmorrow: you can write both functions. there is no problem, but it makes no sense to put two callCCs into the class definition. |
| 05:08:32 | <mmorrow> | well, then the class is broken since it's unable to account for all possibilities :) |
| 05:09:03 | <roconnor> | mmorrow: that's not what the class instance is for. |
| 05:09:13 | <mmorrow> | also, you can't write both versions if you don't have access to the constructors of the newtype, which monadLib doesn't export (?) |
| 05:09:31 | <roconnor> | mmorrow: when you have (MonatContT r m), you have no idea if m has State or not. |
| 05:09:43 | <mmorrow> | roconnor: well, that's a problem here |
| 05:09:51 | <roconnor> | mmorrow: go write your own (MonadContState) class |
| 05:10:02 | <mmorrow> | i have and do whenever i need such a monad :) |
| 05:10:06 | <roconnor> | just depend on monadLib instead of the mtl :) |
| 05:10:13 | <mmorrow> | i depend on neither :) |
| 05:10:18 | <roconnor> | even better |
| 05:10:36 | <roconnor> | mmorrow: heck, you probably don't need classes at all |
| 05:10:48 | <mmorrow> | heh, yeah i don't actually use classes with monads |
| 05:11:16 | <mmorrow> | ACTION has to take a break from irc and actually do what he's been trying to get done.. |
| 05:11:31 | <dancor_> | how do you determine if you want foldl or foldl' |
| 05:11:40 | <roconnor> | mmorrow: what you were talking about had nothing to do with MonadCont |
| 05:11:44 | <naxa> | Berengal: may I ask you to help me create something like this insertWith :: (b -> b-> b) -> a -> b -> (a,b) -> (a,b) ; (dunno how is it called, definition?) what works with my script? I'm sorry for asking such a lame thing but my time is too short and I am too sleepy |
| 05:11:53 | <mmorrow> | roconnor: it does, but indirectly |
| 05:12:04 | <roconnor> | dancor_: if you are producting a primitive type, you want foldl' |
| 05:12:54 | <dancor_> | i have a list of chess moves that i'm folding over to generate the current board state of a chess game |
| 05:13:06 | <roconnor> | mmorrow: the question is, if you have code that operates on a generic MonadCont, how do you want it to behave when applied to a ContT r (State s) monad? |
| 05:13:43 | <roconnor> | and how do you want it to behave when applied to a StateT s (Cont r) monad? |
| 05:14:21 | <mmorrow> | roconnor: so given that for certain values of MonadCont, there isn't one single canonical choice for callCC, my view is that having a MonadCont class at all becomes debatable |
| 05:15:05 | <mmorrow> | (or rather, a MonadCont in its current form, but i can't really think of a solution though, so ...) |
| 05:15:17 | <wli> | I got the right answer for addition chain multiplication but it took 10 hours. |
| 05:15:20 | <roconnor> | mmorrow: there is a canonical choice. See the modular monad transformer paper. |
| 05:15:40 | <mmorrow> | roconnor: there is not a canonical choice for StateT Cont!! :) |
| 05:15:51 | <roconnor> | paper!!! |
| 05:15:55 | <roconnor> | :) |
| 05:16:02 | <mmorrow> | we'll see. |
| 05:16:15 | <roconnor> | we'll see? |
| 05:16:32 | <dolio> | There's a right choice and a wrong choice for StateT Cont. |
| 05:16:49 | <roconnor> | the canonical choice gives you operation that behave in a uniform way, just like all the other monad transformer operations. |
| 05:16:53 | <dolio> | So whether there's a canonical choice is kind of irrelevant in that case. :) |
| 05:17:24 | <roconnor> | and so you can reason about your code in a uniform way |
| 05:17:45 | <roconnor> | things are less surprising and more maintainable |
| 05:18:02 | <Saizan_> | that's a modular monad transformer paper? |
| 05:18:15 | <roconnor> | @where mmtl |
| 05:18:15 | <lambdabot> | I know nothing about mmtl. |
| 05:18:18 | <roconnor> | @where mmt |
| 05:18:18 | <lambdabot> | I know nothing about mmt. |
| 05:18:20 | <roconnor> | hmm |
| 05:18:24 | <Saizan_> | @hackage mmtl |
| 05:18:25 | <lambdabot> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mmtl |
| 05:19:57 | <roconnor> | http://www.cs.nott.ac.uk/~mjj/publications.html#mmt |
| 05:20:32 | <roconnor> | ``in addition to the construction of a monad, the effect-manipulating operations need to be lifted to the resulting monad. The traditional approach for lifting operations is non-modular and ad-hoc. We solve this problem with a principled technique for lifting operations that makes monad transformers truly modular. |
| 05:20:49 | <roconnor> | ACTION <3 principled techniques |
| 05:21:22 | <Saizan_> | thanks |
| 05:22:14 | <naxa> | Berengal: may I ask you to help me create something like this insertWith :: (b -> b-> b) -> a -> b -> (a,b) -> (a,b) ; (dunno how is it called, definition?) what works with my script? I'm sorry for asking such a lame thing but my time is too short and I am too sleepy |
| 05:22:32 | <naxa> | whoops... this wasn't on purpose |
| 05:22:44 | <naxa> | anyway, if Berengal spots it I would be happy :) |
| 05:23:07 | <dolio> | roconnor: Nice. Now I have mathematical weight for that version of callCC, rather than just noting that it's obviously the right one. :) |
| 05:23:13 | <roconnor> | @where+ mmt http://www.cs.nott.ac.uk/~mjj/pubs/mmt/mmt.pdf |
| 05:23:14 | <lambdabot> | It is forever etched in my memory. |
| 05:24:51 | <roconnor> | BMeph: maybe I should air my concerns in a trac ticket. |
| 05:25:48 | <Saizan_> | mmtl needs more advertising |
| 05:26:04 | <copumpkin> | naxa: trying to figure out your type signature there |
| 05:26:19 | <roconnor> | I think I still recommend monadLib over mmtl |
| 05:26:25 | <roconnor> | but I'm not sure |
| 05:26:25 | <copumpkin> | naxa: what does it do with one of the two as ? |
| 05:28:50 | <copumpkin> | naxa: oh, I see, you want (Eq a) => (b -> b -> b) -> a -> b -> [(a, b)] -> [(a, b)] -- ? |
| 05:28:53 | <naxa> | copumpkin: http://pastebin.com/d4c58e667 this is my code |
| 05:29:03 | <naxa> | copumpkin: oh, let me see :) |
| 05:29:03 | <Twey> | naxa: It's called a type |
| 05:29:24 | <naxa> | ah, I didn't know where I put Eq a :) |
| 05:29:30 | <naxa> | Twey: thanks |
| 05:29:40 | <copumpkin> | well there's also the [(a, b)] |
| 05:29:41 | <copumpkin> | right? |
| 05:30:12 | <dolio> | roconnor: mmtl still has the run* functions in the inconvenient order. |
| 05:31:09 | <naxa> | copumpkin: i don't know why it says parse error on => if I use your idea |
| 05:31:16 | <naxa> | ??? |
| 05:31:35 | <copumpkin> | naxa: oh, I was just trying to understand what you were asking |
| 05:31:38 | <copumpkin> | it's not a solution :) |
| 05:32:00 | <BMeph> | roconnor: Have you already discussed it in -cafe? :) |
| 05:32:05 | <naxa> | copumpkin: oh I see. :) well it's something like this but I'm affraid I won't be able to figure out that on my own in time (half an hour) |
| 05:32:27 | <dolio> | copumpkin: I fixed my optimal sorts to be stable, by the way. It wasn't as bad as I had expected. |
| 05:32:45 | <copumpkin> | dolio: oh cool, so your 100% coverage revealed no other bugs? |
| 05:32:48 | <dolio> | copumpkin: I could still compare things in the same order, I just had to change tests for LT to tests for GT. |
| 05:32:51 | <naxa> | copumpkin: with my code shown, my homework is to implement the "Bag" data structure with this insert function... now I use this insertWith function thanks to the help here but I can't tell what it's type actually |
| 05:32:59 | <Twey> | Eq k => (v -> v -> v) -> k -> v -> [(k, v)] -> [(k, v)] |
| 05:33:08 | <copumpkin> | that's a lot more legible :P |
| 05:33:27 | <Twey> | I agree |
| 05:33:41 | <Twey> | Took me a moment and a look at Data.Map.insertWith to work out what that first one was supposed to do :-P |
| 05:33:53 | <naxa> | Twey, copumpkin: well, it gives me the same "parse error on input =>" |
| 05:34:01 | <naxa> | I wonder what this means?? |
| 05:34:10 | <Twey> | It means you did something wrong |
| 05:34:18 | <dolio> | copumpkin: Well, my hpc says that my existing tests result in 100% of the code being run. But, of course, there could be bugs that I don't test for. |
| 05:34:20 | <naxa> | Twey: yeah i guessed that. :) |
| 05:34:33 | <Twey> | Well, maybe if you paste your code we can see what it was. |
| 05:34:34 | <copumpkin> | dolio: makes sense |
| 05:34:43 | <BMeph> | roconnor: Just curious, but have you tried the monatron lib? |
| 05:35:07 | <dolio> | I had 100% code coverage before I figured out that merge sort wasn't stable (by way of the optimal sorts). |
| 05:35:28 | <naxa> | Twey: it's here http://pastebin.com/d7a0f3972 |
| 05:36:05 | <Twey> | naxa: Yeah... you missed out the :: (‘has type’) sign |
| 05:36:17 | <naxa> | oh whoops |
| 05:36:19 | <naxa> | :D |
| 05:36:36 | <naxa> | Twey: hey much better, thanks pal :) |
| 05:37:49 | <copumpkin> | > let insertWith f k v xs = case lookup k xs of Nothing -> insert (k, v) xs; Just v' -> insert (k, f v' v) (deleteBy ((==) `on` fst) (k, undefined) xs) in insertWith (+) 1 5 [(0, 4), (1,3)] |
| 05:37:50 | <copumpkin> | lol |
| 05:37:50 | <lambdabot> | [(0,4),(1,8)] |
| 05:37:58 | <copumpkin> | world's ugliest insertWith |
| 05:38:19 | <copumpkin> | oh, I could've just used a map |
| 05:38:28 | <copumpkin> | ah well |
| 05:38:47 | <Twey> | insertWith f k v old = case lookup k old of Nothing -> (k, v) : old; Just oldval -> (k, f oldval v) : old |
| 05:39:02 | <copumpkin> | you want to maintain it in order though |
| 05:39:19 | <Twey> | Oh, need to remove the old one, I guess |
| 05:39:32 | <copumpkin> | that too |
| 05:39:32 | <Twey> | copumpkin: No, you don't — not with [(k, v)] |
| 05:39:39 | <Twey> | lookup only requires Eq, not Ord |
| 05:39:39 | <copumpkin> | oh |
| 05:39:44 | <copumpkin> | yeah, silly me :) |
| 05:39:49 | <Twey> | :t Prelude.lookup |
| 05:39:50 | <lambdabot> | forall a b. (Eq a) => a -> [(a, b)] -> Maybe b |
| 05:40:00 | <copumpkin> | but yeah, that ugly deleteBy was to get rid of the old one |
| 05:40:14 | <copumpkin> | (k, undefined) ftw |
| 05:41:27 | <copumpkin> | so I understand GADTs... but when people say they bring us closer to dependent types |
| 05:41:38 | <naxa> | copumpkin, Twey: hey, could you help me to tweak this insertWith to leave out a key if it's value is 0? anyway, i have to use sg like this for my homework, cannot use Map |
| 05:42:02 | <Twey> | copumpkin: It's not bad, but did you think of maybe just doing ‘deleteBy ((== k) `on` fst)’? :-P |
| 05:42:09 | <naxa> | also, I'm asking this becouse I'm affraid that I'm running out of time (18 minutes to go:)) and uh well. |
| 05:42:25 | <copumpkin> | Twey: it wants an a, that's what I tried first |
| 05:42:37 | <Twey> | Ah, OK |
| 05:42:43 | <Twey> | :t deleteBy |
| 05:42:44 | <lambdabot> | forall a. (a -> a -> Bool) -> a -> [a] -> [a] |
| 05:42:47 | <copumpkin> | naxa: use filter (/= 0) |
| 05:42:59 | <Twey> | Darn |
| 05:43:23 | <naxa> | copumpkin: the problem is not logical, i am lost with where should i write what in haskell :) |
| 05:43:43 | <copumpkin> | so the insertWith should be filtering the key out? |
| 05:43:59 | <naxa> | copumpkin: yes, basically |
| 05:44:24 | <copumpkin> | at the very simplest, you can do insertWith f k v xs | k == 0 = xs ; | otherwise = <the crap I wrote before> |
| 05:44:34 | <copumpkin> | or even just a pattern match |
| 05:45:00 | <copumpkin> | insertWith _ 0 _ xs = xs; insertWith f k v xs = <the crap from before> |
| 05:45:14 | <Twey> | http://www.haskell.org/pipermail/haskell/2001-May/007382.html |
| 05:45:18 | <Twey> | That's daft |
| 05:45:35 | <copumpkin> | naxa: you should learn this stuff though, and don't leave it to the last minute in future :P it's so fun! |
| 05:46:02 | <dolio> | copumpkin: GADTs are inductive families where the indices are restricted to being types. |
| 05:46:05 | <copumpkin> | Twey: I agree, a lot of h98 seems rather daft |
| 05:46:22 | <naxa> | copumpkin: sure it is, too bad I had to spend 3 days figuring out a perl script as another homework, just to ruin the whole experience in the end |
| 05:46:32 | <naxa> | copumpkin: so basically i am out of time |
| 05:46:39 | <copumpkin> | naxa: I can see that :) |
| 05:47:28 | <naxa> | copumpkin: actually it would be appriciated if you could edit my pastebin since i am so tired that i think I'll hardly manage to do that filtering without knowing how to do it in the first place |
| 05:47:30 | <roconnor> | BMeph: nope |
| 05:47:52 | <roconnor> | BMeph: I have neither looked at that lib nor discussed anything -cafe |
| 05:47:54 | <naxa> | well, at least in 13 minutes |
| 05:47:58 | <copumpkin> | naxa: lol, this is getting a little too much, but if you insist... :P |
| 05:48:10 | <copumpkin> | naxa: but you need to promise to hang out in #haskell more! and learn!! |
| 05:48:11 | <copumpkin> | :P |
| 05:48:16 | <naxa> | copumpkin: i am really sorry, but I'd be grateful if you could help out :) |
| 05:48:23 | <naxa> | ok :) |
| 05:49:02 | <naxa> | I enjoy doing haskell so it's actually a pain to ask such a thing |
| 05:49:54 | <copumpkin> | naxa: http://pastebin.com/d420c56cf |
| 05:50:07 | <copumpkin> | naxa: I haven't tested it, and the code probably doesn't look like you wrote it, with that undefined in there :P |
| 05:50:16 | <roconnor> | dolio: are the ContT State and StateT Cont callCC functions (supposed to be) the two different ways that mmorrow talks about? |
| 05:50:35 | <naxa> | copumpkin: it's just worth to see a working syntax for me. :) |
| 05:50:43 | <Renderwahn> | how can I convert a float to string? |
| 05:50:59 | <copumpkin> | show |
| 05:51:05 | <copumpkin> | > show (0.2 :: Float) |
| 05:51:06 | <lambdabot> | "0.2" |
| 05:51:26 | <copumpkin> | dolio: I'm ruminating on that :P |
| 05:51:28 | <dolio> | roconnor: StateT Cont can either roll back the state or not. ContT State can't roll back the state (I think). |
| 05:51:30 | <Renderwahn> | great \o/ |
| 05:52:18 | <ski> | @unmtl ContT o (State s) a |
| 05:52:18 | <lambdabot> | (a -> s -> (o, s)) -> s -> (o, s) |
| 05:52:26 | <ski> | @unmtl StateT s (Cont o) a |
| 05:52:26 | <lambdabot> | s -> (a -> s -> o) -> o |
| 05:53:25 | <ski> | (roconnor : talks about where ?) |
| 05:53:54 | <mmorrow> | roconnor: yeah, it's w/in StateT Cont that there are the two possibilities |
| 05:54:10 | <roconnor> | talks about on #haskell a little less than 1 hour ago |
| 05:54:12 | <mmorrow> | roconnor: (haven't looked at that paper yet, but will |
| 05:54:19 | <ski> | ok |
| 05:54:55 | <copumpkin> | dolio: okay, I don't really get inductive families, I guess :P |
| 05:55:03 | <copumpkin> | I've seen a couple of agda examples |
| 05:55:16 | <roconnor> | dolio: so the /right/ way makes it so that StateT Cont rolls back state and ContT State doesn't roll back state? |
| 05:55:36 | <dolio> | Yes. |
| 05:55:46 | <roconnor> | that does seem satisfying |
| 05:56:15 | <BMeph> | roconnor: Not that I want to discourage you from Trac posting, but I'd imagine a little -cafe talk to be in order... :) |
| 05:56:25 | <ski> | ACTION is unsure about that .. |
| 05:56:29 | <naxa> | copumpkin: ok. how do i add Eq b to the type signature of insertWith? :)) |
| 05:56:38 | <copumpkin> | it's already there isn't it ? |
| 05:56:46 | <dolio> | That also matches with, for instance, StateT [] rolling back the state, where ListT State doesn't (or LogicT if you prefer). |
| 05:56:46 | <roconnor> | BMeph: I'll think about that. I kinda dislike -cafe a little bit. |
| 05:56:48 | <copumpkin> | insertWith :: Eq k => ... |
| 05:57:03 | <naxa> | copumpkin: insertWith :: (Eq a)=> (b -> b -> b) -> a -> b -> [(a, b)] -> [(a, b)] |
| 05:57:09 | <roconnor> | BMeph: it's kinda a noisy cafe :P |
| 05:57:26 | <copumpkin> | naxa: yup, that should work |
| 05:57:27 | <BMeph> | roconnor: Sure. I don't dislike it, but I do notice that I tend not to follow it. :) |
| 05:57:30 | <roconnor> | But yeah, maybe a -cafe post is a good place to start |
| 05:57:33 | <roconnor> | get some ideas |
| 05:57:51 | <roconnor> | right, maybe dislike was too strong |
| 05:58:09 | <ski> | @unmtl StateT s [] a |
| 05:58:09 | <lambdabot> | s -> [(a, s)] |
| 05:58:11 | <naxa> | copumpkin: it's definietly not working with my somehow very ugly insertWith f k 0 xs = xs :) |
| 05:58:22 | <ski> | how does that roll back the state ? |
| 05:58:30 | <ski> | dolio : ^ |
| 05:58:36 | <copumpkin> | naxa: hmm, you have 0 for your value, not your key |
| 05:58:38 | <naxa> | ay anyway i'm too stupid and sleepy, sorry, what a mess |
| 05:58:55 | <naxa> | ah... :) |
| 05:59:48 | <Saizan_> | > flip runStateT 0 $ (put 4 >> get) `mplus` get |
| 05:59:49 | <lambdabot> | No instance for (Show (m (s, s))) |
| 05:59:50 | <lambdabot> | arising from a use of `show' a... |
| 05:59:59 | <Saizan_> | > flip runStateT 0 $ (put 4 >> get) `mplus` get :: [(Int,Int)] |
| 06:00:00 | <lambdabot> | [(4,4),(0,0)] |
| 06:00:06 | <roconnor> | ACTION sleeps |
| 06:00:41 | <dolio> | ski: Conceptually, when you backtrack, state changes since the branch point are rolled back. |
| 06:01:05 | <ski> | that's one way to *implement* it, in terms of mutable state, yes |
| 06:01:42 | <ski> | similar to one way to *implement* a `local' combinator for environment is by storing old value on stack, and restoring when returning |
| 06:02:00 | <ski> | i don't agree that it's fundamentally rolling back state, though |
| 06:02:24 | <Saizan_> | ski: the point is that each path has its own state, while with LogicT State the same state survives across mplus |
| 06:02:30 | <ski> | i rather view it as splitting (copying) the state, for each nondeterministic choice |
| 06:02:48 | <ski> | *nod* |
| 06:03:00 | <dolio> | callCC isn't "fundamentally" rolling back state, either. It's constructing a closure that passes the old state to a continuation. |
| 06:03:29 | <naxa> | copumpkin: insertWith :: (Eq a, Num b) => ... was what i was searching for! :D |
| 06:03:31 | <ski> | `call-with-current-continuation' in Scheme sure is not rolling back any state at all |
| 06:03:37 | <copumpkin> | naxa: ah, that makes sense |
| 06:03:40 | <Saizan_> | well, considering that we often call [] the backtracking monad, and that the state follows the same pattern as the values.. |
| 06:03:48 | <naxa> | copumpkin: yeah. :D |
| 06:04:07 | <ski> | (when you invoke a continuation captured with that, the state is not rolled back to what it was when the continuation was captured) |
| 06:04:34 | <dolio> | We're not talking about scheme, we're talking about StateT Cont. |
| 06:04:43 | <ski> | yes |
| 06:05:05 | <ski> | i can see how one can implement the Scheme-like semantics with |
| 06:05:07 | <ski> | @unmtl StateT s (Cont o) a |
| 06:05:07 | <lambdabot> | s -> (a -> s -> o) -> o |
| 06:05:16 | <ski> | but not with |
| 06:05:17 | <ski> | @unmtl ContT o (State s) a |
| 06:05:18 | <lambdabot> | (a -> s -> (o, s)) -> s -> (o, s) |
| 06:05:41 | <mmorrow> | roconnor, ski: here's a minimal presentation http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2387#a2387 |
| 06:05:44 | <ski> | so maybe there really is two different useful ways of handling the interaction of state and continuation in the first ? |
| 06:05:48 | <Gracenotes> | hm? it unmtls StateT into continuations? |
| 06:06:30 | <mmorrow> | this is flattened StateT Cont: |
| 06:06:32 | <mmorrow> | newtype M r s a = M {unM :: (a -> s -> r) -> s -> r} |
| 06:06:44 | <ski> | ACTION nods |
| 06:06:48 | <dolio> | > runState (runContT (callCC (\k -> put 2 >> k ())) id) 1 |
| 06:06:49 | <lambdabot> | Couldn't match expected type `State s a' against inferred type `()' |
| 06:07:01 | <dolio> | > runState (runContT (callCC (\k -> put 2 >> k ())) return) 1 |
| 06:07:02 | <lambdabot> | ((),2) |
| 06:10:36 | <mmorrow> | , flip runCont (flip runStateT (callCC (\k -> set 2 >> k ())) 1) id |
| 06:10:37 | <lunabot> | ((),1) |
| 06:10:46 | <mmorrow> | > runCont (runStateT (callCC (\k -> put 2 >> k ())) 1) id |
| 06:10:47 | <lambdabot> | ((),2) |
| 06:13:53 | <naxa> | copumpkin: hey it just worked out. thanks for help! And in the end i didn't need to steal your code. :) What a relief. |
| 06:14:59 | <ski> | hmm |
| 06:15:17 | <naxa> | copumpkin: too bad that I've got a message that the program is not ok in the end... however, since it does what it needs and also works with all the test cases, i don't know, how could this be the cage, I should consult my teacher i guess... |
| 06:15:32 | <naxa> | *case |
| 06:15:33 | <naxa> | :) |
| 06:15:46 | <naxa> | copumpkin: in any case, thank you for your help! |
| 06:15:54 | <mmorrow> | ski: i used the two diff callCCs to make a "transactional state monad" which came out pretty well, i use it all the time now (with a different name than that package though since "TxM" is ugly, gotta change that..) |
| 06:16:01 | <naxa> | I shall lurk around here more from now on. :) |
| 06:16:14 | <mmorrow> | oh, and also needed monadLib's "Label" idea too for that |
| 06:16:35 | <mmorrow> | ski: http://hackage.haskell.org/packages/archive/monad-tx/0.0.1/doc/html/src/Control-Monad-Tx.html |
| 06:18:11 | <copumpkin> | naxa: :) |
| 06:24:47 | <ski> | hm, i think `callCC1 (=<< ma) = ma' fails |
| 06:26:04 | <ski> | (mmorrow : btw, i admit that before i was thinking that the `(o,s)' in `ContT o (State s)' would make the continuations more like nqCPS rather than CPS .. but now i'm not sure) |
| 06:26:22 | <ksf> | main: Prelude.(!!): index too large |
| 06:26:27 | <ksf> | waaaagh |
| 06:26:29 | <ksf> | I hate it. |
| 06:26:37 | <mmorrow> | ACTION googles nqCPS |
| 06:26:44 | <ski> | not-quite-CPS |
| 06:26:54 | <copumpkin> | my efforts to coax dependent types out of GADTs have (unsurprisingly) failed |
| 06:26:55 | <ski> | i.e. things like composable continations |
| 06:27:05 | <ski> | like CPS, but not all calls are tail-calls |
| 06:27:14 | <mmorrow> | hmm, interesting |
| 06:27:54 | <ski> | (there is a "Direct Style" transform that can translate code in nqCPS style to direct style, with a few calls to `shift' and `reset') |
| 06:28:49 | <dolio> | copumpkin: What are you trying exactly? There's a pretty standard way of doing dependent-typing-like stuff with GADTs. |
| 06:29:27 | <dolio> | copumpkin: Namely: 1) Make type-level analogues of your data "data Z ; data S n". |
| 06:29:51 | <copumpkin> | yup, done that, I'm trying to write a meaningful Num instance |
| 06:30:00 | <dolio> | copumpkin: 2) Make a GADT indexed by the type-level "data Nat n where Z :: Nat Z ; S :: Nat n -> Nat (S n)". |
| 06:31:03 | <dolio> | 3 (maybe optional)) Wrap the GADT in an existential "data AnyNat = forall n. AnyNat (Nat n)". |
| 06:31:10 | <copumpkin> | yeah, did that too |
| 06:31:31 | <copumpkin> | I'm probably doing something silly, I'll try to figure it out |
| 06:31:34 | <Twey> | Blargh |
| 06:31:48 | <BMeph> | copumpkin: 3b) ???? |
| 06:32:03 | <BMeph> | copumpkin: ;) |
| 06:32:06 | <Twey> | ‘The programming language that will be our tool for this is Haskell, a member of the Lisp family.’ — The Haskell Road to Logic, Math, and Programming, preface |
| 06:32:08 | <copumpkin> | oh, I knew I was forgetting something |
| 06:32:11 | <copumpkin> | the ???? and profit, silly me |
| 06:32:20 | <copumpkin> | Twey: ! |
| 06:32:27 | <copumpkin> | maybe liskell? |
| 06:32:49 | <BMeph> | ACTION hopes the world will end when the crowd claims "C is a Lisp"... :p |
| 06:32:55 | <Twey> | Ha |
| 06:33:07 | <dolio> | Isn't it? |
| 06:33:20 | <mmorrow> | What's C? |
| 06:33:30 | <mmorrow> | :) |
| 06:33:39 | <mmorrow> | ACTION return to coding in C |
| 06:33:43 | <BMeph> | mmorrow: It's a vitamin, found in chiles and citrus. ;p |
| 06:33:53 | <SubStack> | I hear UNIX was written in c, which would account for a lot. |
| 06:34:01 | <mmorrow> | BMeph: ooh, sounds delicicious |
| 06:34:40 | <BMeph> | mmorrow: I like it, but my wife's allergic. Not to the chiles, though, just the vitamin. :) |
| 06:35:15 | <SubStack> | does she have scurvy yet? |
| 06:35:23 | <mmorrow> | ACTION was just typing that |
| 06:36:10 | <SubStack> | ACTION discredits mmorrow's ideas by having them first |
| 06:36:24 | <mmorrow> | ACTION sulks, goes shopping |
| 06:36:43 | <ski> | callCC1 (=<< ma) |
| 06:36:48 | <ski> | = M (\k s -> unM (ma >>= \a -> M (\_ _ -> k a s)) k s) |
| 06:36:50 | <BMeph> | Oh, no, she has much more to worry about than scurvy. For one thing, she's married to me! =8*O |
| 06:36:51 | <ski> | = M (\k s -> unM ma (\a _ -> k a s) s) |
| 06:37:02 | <ski> | which is generally not the same as `ma' |
| 06:37:36 | <SubStack> | ACTION blinks a few times in rapid succession |
| 06:37:58 | <Twey> | ‘As a functional programming language, Haskell is a member of the Lisp family. Other family members are Scheme, ML, Occam, Clean.’ |
| 06:38:03 | <Twey> | ACTION twitches. |
| 06:38:38 | <dolio> | Occam, eh? |
| 06:38:43 | <Twey> | The ignorance! It burns! |
| 06:38:45 | <BMeph> | ACTION snickers at the concept of Occam being a Lisp |
| 06:40:37 | <BMeph> | ACTION thinks that preface sounds more like the preface to "The Haskell Road to Illogic and Insanity" |
| 06:41:21 | <ski> | (mmorrow : any comment on that law failing ?) |
| 06:42:56 | <mmorrow> | ski: hmm, /me thinks |
| 06:43:11 | <SubStack> | Twey: the code on that site isn't very abstract either |
| 06:43:17 | <SubStack> | lots of numbered variable names >_< |
| 06:45:09 | <SubStack> | Twey: make sure to complain on its amazon page |
| 06:45:26 | <thoughtpolice> | @seen dons |
| 06:45:26 | <lambdabot> | dons is in #happs, #concatenative, #arch-haskell, #ghc, #yi, #xmonad, #darcs, #haskell-in-depth and #haskell. I last heard dons speak 3h 44m 59s ago. |
| 06:45:41 | <mmorrow> | ski: ah, well sure. since callCC1 "rolls back" the state, the state will be unchanged |
| 06:45:53 | <ski> | mmorrow : i don't recall laws that `callCC' would be supposed to satisfy .. but that one is one of the simplest reasonable laws |
| 06:46:13 | <mmorrow> | ski: that doesn't sound reasonable to me actually :) |
| 06:46:26 | <ski> | (of course, one can argue whether it is in fact reasonable in light of wanting things like this) |
| 06:46:32 | <ski> | right |
| 06:46:54 | <mmorrow> | callCC1 (=<< m) ==== do {s <- get; a <- m; set s; return a} |
| 06:47:06 | <ski> | *nod* |
| 06:47:20 | <mmorrow> | i didn't know callCC had any laws, does it? |
| 06:47:39 | <ski> | well, surely we want that `callCC (const ma) = ma', no ? |
| 06:47:51 | <mmorrow> | ah, yeah surely |
| 06:50:09 | <mmorrow> | hmm, now that i think about it, WriterT Cont has two callCCs also, similar to StateT Cont |
| 06:50:15 | <ski> | hm .. maybe also `callCC (\k0 -> callCC (\k1 -> f k0 k1)) = callCC (\k0 -> callCC (\k1 -> f k1 k0))' and similar laws |
| 06:51:11 | <ski> | btw, this reminds me .. i've often wanted a `localState :: MonadState s m => (s -> s) -> (m a -> m a)' |
| 06:52:14 | <mmorrow> | oh, n/m i don't think it does |
| 06:52:40 | <eck> | i'm writing wrapper to a c library that exports some macros that are CPP macros (e.g. the c code is something like #define FLAG_FOO 8); how can I refer to these values in my haskell ffi wrapper? |
| 06:52:41 | <mmorrow> | ski: totally! i literally use this "TxM" all the time |
| 06:53:27 | <mmorrow> | ski: it handles errors (aborting/reporting) gracefully, lets you control what effects the state and how, and gives you a State monad, which subsumes Reader and Writer |
| 06:53:52 | <mmorrow> | it's like a ReaderWriterStateErrorMaybe monad |
| 06:54:02 | <mmorrow> | err, i meant |
| 06:54:06 | <mmorrow> | it's like a ReaderWriterStateErrorMaybeCont monad |
| 06:54:07 | <mmorrow> | ;) |
| 06:54:25 | <ski> | well, `Writer' can function with infinite actions |
| 06:54:37 | <mmorrow> | hmm |
| 06:55:23 | <mmorrow> | true |
| 06:55:47 | <ski> | > execWriter $ fix (tell "!" >>) |
| 06:55:51 | <lambdabot> | "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!... |
| 06:55:52 | <ski> | > (`execState` "") $ fix (modify ('!':) >>) |
| 06:55:58 | <lambdabot> | mueval: Prelude.read: no parse |
| 06:56:00 | <ski> | > (`execState` "") $ fix (modify (++ "!") >>) |
| 06:56:25 | <lambdabot> | thread killed |
| 06:56:39 | <mmorrow> | i wonder if this ability can be worked in somehow |
| 06:56:44 | <ski> | ACTION wonders what the error "Prelude.read: no parse" singifies, there .. |
| 06:57:13 | <mmorrow> | i believe it's a rlimits "killed" that mueval tries to `read' |
| 06:57:28 | <mmorrow> | (or whatever msg rlimits prints out) |
| 06:57:47 | <ski> | ok |
| 06:57:56 | <ski> | (it appears misleading ..) |
| 06:58:02 | <mmorrow> | heh, very |
| 06:58:23 | <mmorrow> | oh, mueval seems to handle "thread killed" ok |
| 06:58:30 | <mmorrow> | it must be *no* output |
| 06:58:37 | <mmorrow> | that mueval tries to `read' |
| 06:58:42 | <mmorrow> | > read "" |
| 06:58:45 | <lambdabot> | * Exception: Prelude.read: no parse |
| 06:58:49 | <mmorrow> | > read "" :: String |
| 06:58:50 | <lambdabot> | "* Exception: Prelude.read: no parse |
| 06:59:57 | <mmorrow> | somone should spend the 8 seconds it'd take to fix that... |
| 07:00:32 | <copumpkin> | what's wrong with that? |
| 07:00:38 | <copumpkin> | > read "\"\"" :: String |
| 07:00:39 | <lambdabot> | "" |
| 07:01:48 | <ksf> | dammit. I manage to get data out of my function iff I leave out the recursive call. It returns an empty list otherwise, that is. |
| 07:02:19 | <mmorrow> | > foldr (.) id (repeat read) (fix show) |
| 07:02:22 | <lambdabot> | "* Exception: stack overflow |
| 07:02:30 | <mmorrow> | , foldr (.) id (repeat read) (fix show) |
| 07:02:34 | <lunabot> | Stack space overflow: current size 8388608 bytes. |
| 07:02:34 | <lunabot> | Use `+RTS -Ksize' to increase it. |
| 07:02:48 | <mmorrow> | > foldl (.) id (repeat read) (fix show) |
| 07:03:01 | <lambdabot> | mueval: Prelude.read: no parse |
| 07:03:17 | <ski> | dolio : i have another way of doing what, which doesn't involve newtypes ? |
| 07:03:35 | <dolio> | What? |
| 07:03:41 | <ski> | (er, s/doesn't involve/involves/) |
| 07:03:51 | <ski> | <dolio> ski has another way that involves newtypes. |
| 07:03:58 | <ski> | from yesterday |
| 07:04:22 | <dolio> | Oh. Writing zip(With) in terms of foldr. |
| 07:04:23 | <ski> | (i can look up the logs .. just wondered if you still recalled what that was regarding) |
| 07:04:52 | <ski> | ok |
| 07:10:29 | <ski> | Apocalisp : if you're interested, here's my way of implementing `zipWith' in terms of `foldr' (not cheating via implementing `null',`head',`tail' (or similar) in terms of `foldr') <http://www.mdstud.chalmers.se/~md9slj/code/FoldrZip.hs> |
| 07:26:05 | <Qork> | why would you ever add GC to C++? isn't the whole point of using C++ that you have manual memeory management? If ou want GC why not just choose a GCed language like Java, Scala or haskell? |
| 07:35:44 | <JuanDaugherty> | Qork, you had to be there. You're confusing C with C++, today they are seen by relative newcomers as the same but originally they were quite distinct. |
| 07:36:35 | <leadnose> | and still are |
| 07:37:13 | <JuanDaugherty> | so while when I wrote that I forgot that C++ doesn't have GC, certainly adding it would be consistent with what C++ is, namely an attempt to get a "better" C. |
| 07:38:02 | <JuanDaugherty> | also memory leaks are probably the single biggest complaint about C and especially C++ programs |
| 07:38:28 | <johnw> | and newbies don't blow stack constantly in Haskell? |
| 07:38:34 | <PetRat> | Anyone know how to define 'init' in terms of foldr? It's question 9.13 in S. Thompson's book and I'm stumped. |
| 07:40:24 | <JuanDaugherty> | C++ really since its an ugly OO developed on C and aggravates memory mgt by not providing GC as part of the language like most OO langs do. |
| 07:40:26 | <opqdonut> | > foldr f [x,y,z,w] |
| 07:40:28 | <lambdabot> | Overlapping instances for Show ([a] -> [Expr]) |
| 07:40:28 | <lambdabot> | arising from a us... |
| 07:40:34 | <opqdonut> | ah |
| 07:40:42 | <opqdonut> | > foldr f nil [x,y,z,w] |
| 07:40:43 | <lambdabot> | Not in scope: `nil' |
| 07:40:45 | <JuanDaugherty> | *it's |
| 07:40:49 | <opqdonut> | > foldr f n [x,y,z,w] |
| 07:40:50 | <lambdabot> | f x (f y (f z (f w n))) |
| 07:40:52 | <opqdonut> | (sorry) |
| 07:41:34 | <opqdonut> | PetRat: so, f needs to be some sort of conditional cons right? |
| 07:41:56 | <opqdonut> | we want every f except the last one to turn into a (:) |
| 07:42:00 | <PetRat> | opqdonut: I assume so. |
| 07:42:09 | <opqdonut> | and the last one should be something like (\_ _ -> []) |
| 07:42:22 | <opqdonut> | so how does the last invocation of f differ? |
| 07:42:32 | <PetRat> | Yes, so how do you "know" that you are at the last one? |
| 07:42:40 | <PetRat> | It is invoked on n. |
| 07:43:26 | <PetRat> | :t init |
| 07:43:28 | <lambdabot> | forall a. [a] -> [a] |
| 07:44:11 | <rwmjones> | ACTION can't subscribe to haskell-cafe |
| 07:44:18 | <PetRat> | The initial value has to have type [a] |
| 07:44:19 | <rwmjones> | when I put email addr etc into http://www.haskell.org/mailman/listinfo/haskell-cafe |
| 07:44:26 | <rwmjones> | it just says "bug in mailman" |
| 07:44:27 | <PetRat> | And be different that the empty list. |
| 07:44:38 | <opqdonut> | PetRat: and n is something you give |
| 07:44:43 | <Qork> | @src init |
| 07:44:43 | <lambdabot> | init [x] = [] |
| 07:44:43 | <lambdabot> | init (x:xs) = x : init xs |
| 07:44:43 | <lambdabot> | init [] = undefined |
| 07:45:05 | <Qork> | how the hell with foldr? |
| 07:45:20 | <dolio> | It doesn't have to have type [a]. You can use foldr to produce something else, and then do a little post-processing. |
| 07:45:30 | <opqdonut> | that too |
| 07:45:48 | <PetRat> | So it could have type (Int, [a]) |
| 07:46:42 | <Qork> | but am i allowed to do length frst? |
| 07:46:56 | <Qork> | i dont get it it seems i nee dmore info than foldr gives |
| 07:46:57 | <PetRat> | Look like init xs = foldr f (0,[]) xs where f a (0,_) = (1,[]) f a (1,as) = (1,a:as) |
| 07:47:28 | <PetRat> | Seems awkward. I wonder why .Thompsom put in this exercise. |
| 07:47:36 | <Qork> | wait i can pop |
| 07:47:53 | <mauke> | > foldr (\x (k,z) -> (True, (if k then (x:) else id) z)) (False,[]) "asdf" |
| 07:47:54 | <lambdabot> | (True,"asd") |
| 07:48:14 | <copumpkin> | can it be done with no post procesing? |
| 07:48:19 | <copumpkin> | *processing |
| 07:48:19 | <dolio> | > foldr (\x (k,z) -> (True, (if k then (x:) else id) z)) (False,[]) [1..] |
| 07:48:21 | <lambdabot> | * Exception: stack overflow |
| 07:48:27 | <shachaf> | > foldr (\a b -> case b of Nothing -> Just []; Just x -> Just (a : x)) Nothing [1,2,3] |
| 07:48:29 | <lambdabot> | Just [1,2] |
| 07:48:33 | <shachaf> | > foldr (\a b -> case b of Nothing -> Just []; Just x -> Just (a : x)) Nothing [] |
| 07:48:34 | <lambdabot> | Nothing |
| 07:49:05 | <PetRat> | Thompson hasn't introduced algebraic types yet, though. |
| 07:50:23 | <dolio> | > snd $ foldr (\e p -> (e:fst p, fst p)) ([], error "init: empty list") [] |
| 07:50:24 | <lambdabot> | * Exception: init: empty list |
| 07:50:30 | <dolio> | > snd $ foldr (\e p -> (e:fst p, fst p)) ([], error "init: empty list") [1,2,3] |
| 07:50:31 | <lambdabot> | [2,3] |
| 07:50:36 | <dolio> | Oops. |
| 07:50:39 | <dolio> | That's tail. |
| 07:51:14 | <copumpkin> | I don't think it can be done without post-processing |
| 07:51:47 | <dolio> | Not all functions 'g' are expressible as 'g l = foldr f z l'. |
| 07:52:12 | <dolio> | But they're all expressible as something like '(g l, something-else) = foldr f z l'. |
| 07:52:26 | <copumpkin> | yeah, makes sense |
| 07:52:39 | <dolio> | Or, primitive recursive functions 'g'. |
| 07:52:41 | <copumpkin> | since you can keep pretty much anything in the something-else |
| 07:52:45 | <dancor_> | i get the error "<command line>: unknown package: gtk-0.10.1" late in the build process of gtk2hs |
| 07:52:48 | <dancor_> | any ideas? |
| 07:53:07 | <copumpkin> | dancor_: I got same error, I just gave up :P |
| 07:53:11 | <copumpkin> | I'm on mac os fwiw |
| 07:53:17 | <dancor_> | i'm on debian |
| 07:53:30 | <blackh> | dancor_: It works for me on Ubuntu using ghc-6.10.2 |
| 07:53:33 | <dolio> | Obviously there are general recursive functions that aren't reasonably expressible using foldr no matter what you do. |
| 07:53:44 | <copumpkin> | yeah |
| 07:53:48 | <dancor_> | hm. i'm using 6.10.1 |
| 07:53:55 | <blackh> | Maybe it worked because I already had it installed! |
| 07:54:07 | <dancor_> | hah possibly |
| 07:54:28 | <copumpkin> | anyway, bedtime |
| 07:54:29 | <blackh> | That is, I was upgrading from 0.10.0 |
| 07:55:37 | <Qork> | damn Thompson! |
| 07:55:56 | <dancor_> | dolio: is it obvious? |
| 07:56:07 | <PetRat> | http://www.mibbit.com/pb/3vf2zx I might have a solution that needs no post-processing. The key is to use the entire list as the initial value and detect it's length as the special condition. |
| 07:56:40 | <dolio> | dancor_: Relatively. I can write foldr in a language without general recursion. |
| 07:58:13 | <dobblego> | you could do it with para |
| 07:58:31 | <PetRat> | Use a list of any length >= the original list as the "special condition". It will never accumulate to that size during the fold so the initial condition is detected only once. |
| 07:58:35 | <dolio> | That too. |
| 08:00:31 | <jelly12g1n> | hi i am trying to sort an list of tuples by using sortBy , i want to compare the second entry wich i have an getter for |
| 08:00:48 | <jelly12g1n> | but using sortBy (compare Getvalue ) list doesnt work |
| 08:00:56 | <mauke> | comparing |
| 08:00:56 | <Botje> | yeah. |
| 08:01:09 | <Botje> | you want compare `on` getValue |
| 08:01:14 | <Botje> | or comparing getValue |
| 08:01:22 | <jelly12g1n> | comparing retunrs the following error not in scope |
| 08:01:32 | <jelly12g1n> | do i need to import something for this ? |
| 08:01:44 | <mauke> | @hoogle comparing |
| 08:01:44 | <lambdabot> | Data.Ord comparing :: Ord a => (b -> a) -> b -> b -> Ordering |
| 08:01:44 | <lambdabot> | Distribution.Simple.Utils comparing :: Ord a => (b -> a) -> b -> b -> Ordering |
| 08:01:48 | <mauke> | Data.Ord |
| 08:01:49 | <Botje> | comparing is in Data.Ord |
| 08:01:56 | <Botje> | and `on` is in Data.Function |
| 08:02:37 | <jelly12g1n> | well thanks , i can fix it from here |
| 08:03:02 | <Botje> | have fun! |
| 08:04:57 | <dancor_> | copumpkin: when i started over and used "./configure --with-hcflags=-O0 --disable-split-objs" from the start, it did work |
| 08:05:06 | <dancor_> | blackh: ^^^ |
| 08:05:16 | <dancor_> | so idk |
| 08:06:42 | <blackh> | Weird - I didn't give any arguments to ./configure |
| 08:07:57 | <dancor_> | oh maybe that would have worked as well :) |
| 08:08:22 | <jelly12g1n> | Botje: mauke thanks i fixed it , i did some IO thing , took some time to understand IO in haskell |
| 08:08:28 | <jelly12g1n> | just so different thinking |
| 08:08:53 | <Botje> | yup :) |
| 08:08:55 | <Botje> | did you like it? |
| 08:09:11 | <jelly12g1n> | well i had to do it for Uni , but i still like it |
| 08:09:25 | <jelly12g1n> | just using a couple of small functions to do big things |
| 08:09:50 | <jelly12g1n> | you also need to look at the types you are dealing with |
| 08:10:51 | <jelly12g1n> | if i would code this in java i would just read an txt file write it in an array and then do stuff with it , in haskell i read it put it in the right form , then sort / do something an put it in an output form |
| 08:11:18 | <Botje> | yup |
| 08:11:32 | <Botje> | but pure code is easier to debug, no? :) |
| 08:11:37 | <jelly12g1n> | do you know any good reference for binary tree's in haskell ? |
| 08:11:38 | <Botje> | no silly off-by-one errors |
| 08:11:53 | <jelly12g1n> | Botje: debuggin is a bit hard , but i only get typ erorrs |
| 08:12:14 | <Botje> | after a while the type errors go away :) |
| 08:12:29 | <jelly12g1n> | wow , that reminds me of java , in java i didn't more none thinking coding , |
| 08:12:46 | <Botje> | that didn't quite make sense :) |
| 08:12:54 | <jelly12g1n> | http://learnyouahaskell.com/chapters |
| 08:12:57 | <jelly12g1n> | i like that site |
| 08:13:03 | <wunki> | ACTION 2 |
| 08:13:08 | <Botje> | thank BONUS for that |
| 08:13:32 | <jelly12g1n> | it's good written , easy to read an enough examples |
| 08:13:49 | <jelly12g1n> | i still need some info about binary tree's in haskell it isnt in that site :( |
| 08:14:18 | <Botje> | you don't really need info to get started |
| 08:14:31 | <Botje> | once you work out the data definition you can fill in the rest |
| 08:14:46 | <jelly12g1n> | ok , i have an haskell book will do some reading :P |
| 08:15:34 | <jelly12g1n> | i also love my WM wich is also written in haskell :P |
| 08:15:39 | <Botje> | :) |
| 08:15:46 | <Botje> | which haskell book are you reading? |
| 08:15:51 | <Botje> | real world haskell? |
| 08:16:07 | <jelly12g1n> | the craft of functional programming |
| 08:16:30 | <Botje> | ah |
| 08:16:36 | <Botje> | haven't read that one :) |
| 08:16:41 | <jelly12g1n> | ok |
| 08:16:49 | <jelly12g1n> | well i am off reading thanks anyway |
| 08:16:55 | <wunki> | gl hf |
| 08:17:15 | <Botje> | have fun |
| 08:22:27 | <QtPlaty[HireMe]> | :info Identity |
| 09:02:45 | <solrize> | some prob with sequence.complete.org? |
| 09:02:58 | <solrize> | @seen byorgey |
| 09:02:58 | <lambdabot> | I saw byorgey leaving #haskell-blah, #haskell-in-depth, #xmonad, #haskell-overflow and #haskell 8h 21m 39s ago, and . |
| 09:03:01 | <solrize> | @seen byorgey_ |
| 09:03:01 | <lambdabot> | byorgey_ is in #haskell-overflow, #haskell-in-depth, #haskell-blah, #xmonad and #haskell. I don't know when byorgey_ last spoke. |
| 09:09:12 | <djsiegel> | Can anyone tell me where Haskell Platform packages for Ubuntu might live? |
| 09:11:17 | <dcoutts> | djsiegel: ask on the haskell debian mailing list |
| 09:11:25 | <djsiegel> | dcoutts: thank you |
| 09:11:35 | <dcoutts> | djsiegel: I'm not sure if they're all done yet |
| 09:11:56 | <djsiegel> | dcoutts: ok, cool, at least I will have a place to check on the progress |
| 09:42:18 | <dobblego> | @users |
| 09:42:18 | <lambdabot> | Maximum users seen in #haskell: 658, currently: 579 (88.0%), active: 6 (1.0%) |
| 09:43:37 | <horms> | thats a lot of people idling |
| 09:43:43 | <tombom> | sorry! |
| 09:43:46 | <tombom> | @users |
| 09:43:46 | <lambdabot> | Maximum users seen in #haskell: 658, currently: 579 (88.0%), active: 7 (1.2%) |
| 09:43:49 | <glguy> | ACTION reduces the numbe |
| 09:44:12 | <Berengal> | I'd think the real idlers were the ones who were active here... |
| 09:44:20 | <horms> | lol |
| 09:44:29 | <horms> | idle is in the eye of the beholder |
| 09:44:50 | <Berengal> | If the beholder is your boss |
| 09:45:23 | <ziman> | ACTION pretends activity |
| 09:45:27 | <ziman> | @users |
| 09:45:27 | <lambdabot> | Maximum users seen in #haskell: 658, currently: 578 (87.8%), active: 8 (1.4%) |
| 09:46:57 | <boegel> | should I be surprised if I run into a "Illegal instruction" error message when running a Haskell app compiled with GHC on a minimac with a PowerPC G4 processor? |
| 09:47:32 | <boegel> | ACTION boings |
| 09:47:34 | <boegel> | @users |
| 09:47:34 | <lambdabot> | Maximum users seen in #haskell: 658, currently: 579 (88.0%), active: 8 (1.4%) |
| 09:48:11 | <Itkovian> | boegel: that would be a mac mini |
| 09:48:35 | <boegel> | Itkovian: err, yeah :) |
| 09:48:39 | <boegel> | Itkovian: whatever :) |
| 09:48:49 | <boegel> | a Mac Mini running Linux, that is, not OS X :) |
| 09:55:28 | <pjolk> | haskell has defineately made a static dude |
| 09:56:12 | <boegel> | pjolk: ? |
| 09:57:18 | <ksf> | I want to generate the same kind of code at both compile as well as runtime, should I use TH? |
| 09:57:30 | <voker57__> | @hoogle a -> a |
| 09:57:30 | <lambdabot> | Prelude id :: a -> a |
| 09:57:31 | <lambdabot> | Data.Function id :: a -> a |
| 09:57:31 | <lambdabot> | Data.Generics.Schemes everywhere :: (a -> a) -> a -> a |
| 09:59:08 | <pjolk> | boegel: i used to love python and lisp but I see their flaws clearly now |
| 09:59:24 | <pjolk> | do you people write unittests? |
| 09:59:30 | <ivanm> | yes, they're not called "haskell" ;-) |
| 09:59:35 | <ivanm> | pjolk: some people do |
| 09:59:39 | <PeakerWork> | what's everywhere? |
| 09:59:40 | <ivanm> | there's also QuickCheck |
| 09:59:51 | <ivanm> | then there's the lazy bastards like myself that don't do any tests! :p |
| 10:00:08 | <pjolk> | I don't generally in any language, I usually write a module, make sure it works, then move on to the next, then I have a small mainprogram that binds it all togethe |
| 10:00:08 | <ivanm> | @hoogle everywhere |
| 10:00:08 | <lambdabot> | Data.Generics.Schemes everywhere :: (a -> a) -> a -> a |
| 10:00:09 | <lambdabot> | Data.Generics.Schemes everywhere' :: (a -> a) -> a -> a |
| 10:00:09 | <lambdabot> | Data.Generics.Schemes everywhereBut :: GenericQ Bool -> GenericT -> GenericT |
| 10:00:15 | <ivanm> | PeakerWork: ^^ you mean this? |
| 10:00:21 | <pjolk> | but i have never coded alrge projects with a big amount of people |
| 10:00:25 | <PeakerWork> | ivanm: yeah |
| 10:00:38 | <ksf> | pjolk, depends on the code. |
| 10:00:39 | <ivanm> | *shrug* I have never used any generics stuff |
| 10:00:55 | <PeakerWork> | ivanm: seems like it could only mean re-apply stuff N times? (a -> a) -> a -> a seems to be equivalent to an Int |
| 10:01:17 | <ivanm> | sure looks like a church numeral |
| 10:01:28 | <dolio> | That type looks suspicious. |
| 10:01:29 | <ivanm> | @src everywhere |
| 10:01:29 | <lambdabot> | Source not found. :( |
| 10:01:41 | <dolio> | @hoogle get |
| 10:01:41 | <lambdabot> | Text.ParserCombinators.ReadP get :: ReadP Char |
| 10:01:42 | <lambdabot> | Text.ParserCombinators.ReadPrec get :: ReadPrec Char |
| 10:01:42 | <lambdabot> | Control.Monad.State.Class get :: MonadState s m => m s |
| 10:02:03 | <ivanm> | PeakerWork: which generics lib is it from? |
| 10:02:15 | <PeakerWork> | ivanm: I donno, I just saw it above when hoogled for a->a |
| 10:02:20 | <PeakerWork> | ivanm: and got curious :) |
| 10:02:25 | <ivanm> | heh |
| 10:02:29 | <dolio> | I think it's from SYB. |
| 10:02:53 | <ivanm> | ahhh, syb |
| 10:03:10 | <ivanm> | "Apply a transformation everywhere in bottom-up manner " |
| 10:03:11 | <dolio> | The real type is: (forall a. Data a => a -> a) -> forall a. Data a => a -> a |
| 10:03:18 | <ivanm> | it's an existential :s |
| 10:03:38 | <ivanm> | everywhere f = f . gmapT (everywhere f) <-- whatever this means... |
| 10:03:50 | <ivanm> | @hoogle gmapT |
| 10:03:50 | <lambdabot> | Data.Generics.Basics gmapT :: Data a => (b -> b) -> a -> a |
| 10:04:24 | <ivanm> | "A generic transformation that maps over the immediate subterms " <-- docs for gmapT |
| 10:04:33 | <ivanm> | and hoogle was wrong, it's in Data.Data in base :s |
| 10:11:18 | <PeakerWork> | dolio: why is the same "a" used in both sides? |
| 10:11:46 | <PeakerWork> | why the same name, that is -- its unnecessarily confusing |
| 10:12:54 | <dolio> | I don't know. |
| 10:12:57 | <ivanm> | PeakerWork: just to confuse you |
| 10:12:58 | <ivanm> | ;-) |
| 10:30:57 | <guinea__> | Anyone have an idea why HOpenGL demos cause the screen to go completely black whenever they have focus, but work normally when they don't have focus? I'm using Ubuntu. Is it some weird window manager interaction? |
| 10:32:05 | <voker57__> | @hoogle a -> b -> a |
| 10:32:05 | <lambdabot> | Prelude const :: a -> b -> a |
| 10:32:06 | <lambdabot> | Data.Function const :: a -> b -> a |
| 10:32:06 | <lambdabot> | Control.Parallel par :: a -> b -> b |
| 10:32:26 | <voker57__> | @src const |
| 10:32:26 | <lambdabot> | const x _ = x |
| 10:38:15 | <guinea__> | I tried running some HOpenGL demos under xmonad and they run fine. So it's something to do with the window manager. |
| 10:39:02 | <voker57__> | @hoogle try |
| 10:39:02 | <lambdabot> | Control.Exception try :: IO a -> IO (Either Exception a) |
| 10:39:02 | <lambdabot> | System.IO.Error try :: IO a -> IO (Either IOError a) |
| 10:39:02 | <lambdabot> | Text.Parsec.Prim try :: Stream s m t => ParsecT s u m a -> ParsecT s u m a |
| 10:39:33 | <quicksilver> | guinea__: something to do with compositing wms I bet |
| 10:39:42 | <quicksilver> | guinea__: compositing wms use opengl themselves |
| 10:42:27 | <pjolk> | so am I right, dependant types are for incorporating sturcture-specific type-safety ? |
| 10:42:51 | <pjolk> | like if I have an array or list and the nbr of elems have to be perfectly divisible with x |
| 10:42:56 | <pjolk> | so i cna write |
| 10:43:49 | <pjolk> | blah :: [a] := div (length) 3 = 0 -> [a] |
| 10:43:53 | <pjolk> | or soemthing like that? |
| 10:43:59 | <quicksilver> | that's an example of the kind of thing you can use dependent types for, yes. |
| 10:46:13 | <pjolk> | and if you have a Matrix type you might want to check thta all rows are the same length and the cols are the same length. but wont that be very innefficient? youd need some sort of scheme to avoid rechecking it every time right? |
| 10:46:53 | <zachk> | pjolk: you can use arrays |
| 10:47:11 | <pjolk> | sure im just taking an example |
| 10:47:26 | <voker57__> | how to catch read's errors? |
| 10:47:39 | <dolio> | In general, types are propositions that the compiler verifies before building your program. So dependent types let you make the compiler prove things about values in your program. |
| 10:47:43 | <pjolk> | actually yeah wouldn't you use arrays normally for things that ned boundschecking? |
| 10:47:48 | <Saizan_> | well, you don't check it everytime, you usually carry around a proof of that property |
| 10:47:54 | <pjolk> | ok |
| 10:47:56 | <Saizan_> | which might be the length number itself |
| 10:49:17 | <quicksilver> | pjolk: hopefully you check it at compile time; that's the idea of types. |
| 10:49:23 | <Saizan_> | then as an optimization proof objects that don't contribute to the computational result can be removed at compile time in some systems |
| 10:49:35 | <liyang> | irrelevant! |
| 10:52:36 | <pjolk> | what is irrelevant? |
| 10:53:03 | <pjolk> | hmm haskell and functional programming really is interesting |
| 10:53:27 | <pjolk> | there is a lot more to it than you think at first. and very practical to, not just academic theory |
| 10:56:02 | <dolio> | pjolk: "Proof irrelevance" is the term for identifying various proofs as unnecessary for the actual computation, and erasing them at compile time (so that your code is just as efficient as code that doesn't bother doing the proofs). |
| 11:01:37 | <liyang> | pjolk: You are. Plus, what dolio said. |
| 11:01:57 | <quicksilver> | 'Amazon.co.uk recommends "Programming in Haskell" and more' |
| 11:02:07 | <EvilTerran> | ACTION is |
| 11:02:20 | <EvilTerran> | > sort "evilterran" == sort "irrelevant" |
| 11:02:21 | <lambdabot> | True |
| 11:02:46 | <dolio> | Is that how you got your nick? |
| 11:03:10 | <EvilTerran> | pretty much, yeah |
| 11:03:10 | <boegel> | heh |
| 11:03:32 | <boegel> | so, evilterran is sort of irrelevant? :) cool |
| 11:03:37 | <pjolk> | liyang: I am irrelevant? why? |
| 11:03:50 | <EvilTerran> | boegel, not only am i irrelevant, but i'm in the wrong order, too :P |
| 11:03:59 | <boegel> | EvilTerran: heh |
| 11:04:15 | <liyang> | pjolk: ignore me. I haven't taken my meds today yet. |
| 11:04:58 | <liyang> | pjolk: but you probably are, in the grand scheme of the Universe. |
| 11:07:49 | <zachk> | does the universe even have a grand scheme liyang(and i just took my meds :-) |
| 11:07:57 | <ivanm> | EvilTerran: not to mention being an evil ranter? |
| 11:09:38 | <pjolk> | liyang: well probably you are too |
| 11:10:33 | <pjolk> | liyang = vixey? |
| 11:11:12 | <liyang> | pjolk: no, liyang == http://liyang.hu/ |
| 11:15:27 | <mpj> | hi, I'm trying to install the Yi editor from Hackage using cabal. I've just built cabal using the instructions on http://hackage.haskell.org/trac/hackage/wiki/CabalInstall , and when running cabal install yi, i get the result:cabal: cannot configure yi-0.6.0. It requires base >=4, base-4.0.0.0 was excluded because of the top level dependency base -any and the same for base-4.1.0.0. I'm a complete noob and am not sure how to proceed, any thoughts? |
| 11:19:47 | <doserj> | mpj: do you have an older ghc? then try to install yi-0.5.2 |
| 11:20:00 | <millz> | lmao, I scored Philip Wadler in 'what kind of informatics student are you?' test |
| 11:20:41 | <mpj> | doserj: I seem to be running ghci 6.8.2. |
| 11:20:55 | <mpj> | Is that old? |
| 11:21:27 | <doserj> | current is 6.10.x |
| 11:21:54 | <mpj> | Ok, thank you very much for taking the time. Seems to be building now |
| 11:27:09 | <liyang> | millz: URL? |
| 11:27:38 | <pjolk> | Turing's statement that programming should never be boring because all the repetitive stuff could be put in the hardware seems to ring truer for functional languages than imperative. Or nowadays it would be "programming should never be boring because all the repetitive stuff could be put in the compiler" |
| 11:27:53 | <pjolk> | or not quite but a little bit like that |
| 11:29:24 | <millz> | liyang, facebook... |
| 11:29:51 | <millz> | pjolk, whether its boring depends on your motivation imo |
| 11:30:03 | <millz> | when i code some, even most boring stuff, for my game, i do it with pleasure |
| 11:30:14 | <millz> | but when i have to code some really boring stuff for uni, its annoying |
| 11:31:05 | <Berengal> | To me boring just means I'm not thinking abstract enough |
| 11:42:28 | <akamaus> | Hi anyone |
| 11:42:37 | <akamaus> | I'm having troubles with installing encoding-0.5.1 package with cabal |
| 11:42:54 | <liyang> | millz: can't find it. D: Nevermind. |
| 11:43:05 | <akamaus> | compilation starts, but after a while seems to run into an infinite loop on [43 of 47] Compiling Data.Encoding.JISX0208 ( Data/Encoding/JISX0208.hs, dist/build/Data/Encoding/JISX0208.o ) |
| 11:43:43 | <akamaus> | I use ghc-6.10.1 gcc-4.2.4 under gentoo |
| 11:51:45 | <akamaus> | I looked into sources, table in JIS0208.TXT seems to be 30x larger than for other encodings. So I guess I just have to wait a little more ) |
| 11:53:49 | <mlesniak> | I can't find the function for determing the number of cores; it was something with "num" and "capabilites", but hoogle did not really help |
| 11:55:07 | <mlesniak> | ...GHC.Conc.numCapabilities :-| |
| 11:59:29 | <mreh> | > [x|x <- [1..5], y <- [1,2]] |
| 11:59:30 | <lambdabot> | [1,1,2,2,3,3,4,4,5,5] |
| 11:59:35 | <mreh> | braaap |
| 12:00:14 | <pjolk> | how does structural sharing work when using FFI? if I use hmatrix, does assigning to the matrix happen in the IO monad? if not, does it create a whole new matrix or does it share structure with the old unmodified one? |
| 12:00:34 | <DrSyzygyIE> | > [y|x <- [1..5], y <- [1,2]] |
| 12:00:35 | <lambdabot> | [1,2,1,2,1,2,1,2,1,2] |
| 12:00:48 | <DrSyzygyIE> | > [x | y <- [1,2], x <- [1..5]] |
| 12:00:49 | <lambdabot> | [1,2,3,4,5,1,2,3,4,5] |
| 12:00:59 | <mauke> | > [1,2] >> [1..5] |
| 12:01:00 | <lambdabot> | [1,2,3,4,5,1,2,3,4,5] |
| 12:01:42 | <Berengal> | > concatMap (\x -> concatMap (\y -> [y]) [1,2]) [1..5] |
| 12:01:43 | <DrSyzygyIE> | > [1..5] >> [1,2] |
| 12:01:43 | <lambdabot> | [1,2,1,2,1,2,1,2,1,2] |
| 12:01:44 | <lambdabot> | [1,2,1,2,1,2,1,2,1,2] |
| 12:02:20 | <mreh> | i've just been reading the definition of the list comprehension |
| 12:02:23 | <mreh> | using map |
| 12:02:40 | <HugoDaniel> | hi |
| 12:02:46 | <mreh> | hello |
| 12:02:47 | <Berengal> | mreh: concatMap would be more correct |
| 12:03:35 | <Berengal> | > do x <- [1..5]; y <- [1,2]; return y |
| 12:03:36 | <lambdabot> | [1,2,1,2,1,2,1,2,1,2] |
| 12:03:53 | <mreh> | so many different ways |
| 12:04:07 | <mreh> | haskell is starting to resemble perl |
| 12:04:07 | <Berengal> | Which all boil down to the same thing |
| 12:04:19 | <mreh> | okay, not like perl |
| 12:04:53 | <ksf> | any tips on how to best implement a code gen that should work at both compile- and runtime? |
| 12:05:43 | <mreh> | DrSyzygyIE: I didn't think the order would matter |
| 12:05:55 | <mreh> | of the definition of the variables, but now i see why |
| 12:06:37 | <mreh> | :t concatMap |
| 12:06:38 | <lambdabot> | forall a b. (a -> [b]) -> [a] -> [b] |
| 12:07:49 | <Berengal> | @src [] (>>=) |
| 12:07:49 | <lambdabot> | xs >>= f = concatMap f xs |
| 12:08:10 | <mreh> | @src >> |
| 12:08:11 | <lambdabot> | m >> k = m >>= \_ -> k |
| 12:08:34 | <mreh> | > [1..5] >> "hello" |
| 12:08:35 | <lambdabot> | "hellohellohellohellohello" |
| 12:08:43 | <mreh> | ?!?! |
| 12:08:51 | <mreh> | shouldnt that be a list of lists |
| 12:08:58 | <Berengal> | @type map |
| 12:08:59 | <lambdabot> | forall a b. (a -> b) -> [a] -> [b] |
| 12:09:00 | <EvilTerran> | mreh, no, >>= is concatMap, not map |
| 12:09:00 | <Berengal> | @type concat |
| 12:09:01 | <lambdabot> | forall a. [[a]] -> [a] |
| 12:09:02 | <Berengal> | @type concatMap |
| 12:09:03 | <lambdabot> | forall a b. (a -> [b]) -> [a] -> [b] |
| 12:09:11 | <mreh> | ACTION brane asplode |
| 12:09:20 | <Berengal> | @src concatMap |
| 12:09:20 | <lambdabot> | concatMap f = foldr ((++) . f) [] |
| 12:09:35 | <Berengal> | (or (concat.).map) |
| 12:09:48 | <Berengal> | aka \f -> concat . map f |
| 12:09:48 | <EvilTerran> | > [1..5] >> [10,20,30] |
| 12:09:50 | <lambdabot> | [10,20,30,10,20,30,10,20,30,10,20,30,10,20,30] |
| 12:10:01 | <EvilTerran> | > concatMap (const [10,20,30]) [1..5] |
| 12:10:02 | <lambdabot> | [10,20,30,10,20,30,10,20,30,10,20,30,10,20,30] |
| 12:10:03 | <mreh> | to think we evolved just to make stone tools, and now all these bloody confusing things |
| 12:10:15 | <mreh> | amazing |
| 12:10:22 | <Berengal> | map (const [10,20,30]) [1..5] |
| 12:10:31 | <Berengal> | > map (const [10,20,30]) [1..5] |
| 12:10:32 | <lambdabot> | [[10,20,30],[10,20,30],[10,20,30],[10,20,30],[10,20,30]] |
| 12:11:18 | <Berengal> | I still have trouble with the list monad from time to time |
| 12:11:22 | <Berengal> | It helps if you know prolog... |
| 12:11:48 | <mreh> | i used to know prolog |
| 12:11:52 | <mreh> | atleast i think i did |
| 12:12:23 | <mreh> | it's hard to know when you only did it for six months when the university just decided to crowbar it in at the last moment |
| 12:12:31 | <zachk> | i know the IO, Maybe, and List monad |
| 12:13:16 | <mreh> | im doing alright |
| 12:13:39 | <ksf> | mreh, the very essence of a monad is to flatten stuff. |
| 12:13:41 | <ksf> | :t join |
| 12:13:42 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => m (m a) -> m a |
| 12:13:50 | <Berengal> | Okay, so the basic thought behind the list monad is that "do x <- xs; ..." runs the "xs" computation, yielding a result "x". That computation may however return more than one result, just like in prolog when it does it's magic backtracking thing |
| 12:13:59 | <zachk> | > [1..3]>>[1..3] |
| 12:14:00 | <lambdabot> | [1,2,3,1,2,3,1,2,3] |
| 12:14:10 | <pastorn> | mreh: when you do >> or >>= in the list monad, think "for every" |
| 12:14:30 | <ksf> | without that flattening, you couldn't sequence things. |
| 12:15:02 | <zachk> | > [1..3]>>=[1..3] |
| 12:15:03 | <lambdabot> | Couldn't match expected type `t -> [b]' against inferred type `[a]' |
| 12:15:44 | <Berengal> | ksf: join is useless without fmap |
| 12:16:27 | <zachk> | :t join |
| 12:16:28 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => m (m a) -> m a |
| 12:16:42 | <zachk> | :t fmap |
| 12:16:43 | <lambdabot> | forall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b |
| 12:16:52 | <PeakerWork> | when a thread has async. exceptions blocked, and someone tries to throw at him, what happens? |
| 12:17:20 | <Berengal> | @type join . fmap ?f |
| 12:17:21 | <lambdabot> | forall a a1 (f :: * -> *). (Functor f, ?f::a1 -> f a, Monad f) => f a1 -> f a |
| 12:17:44 | <mreh_> | i'll worry about all this more when i get to monads, i've only just done list comprehensions |
| 12:17:44 | <mreh_> | but i'm sure i'll have to revist them, like i did foldl and foldr atleast twice |
| 12:18:36 | <Berengal> | mreh_: list comprehensions can actually be a nice gateway to monads. |
| 12:18:57 | <wli> | Monad comprehensions would be nice to have back. |
| 12:19:12 | <wli> | I tried to do it for ghc and failed. |
| 12:20:07 | <wli> | Several times, even. |
| 12:24:27 | <zachk> | if i cabal install something where do the source files go |
| 12:25:33 | <trofi^w> | ~/.cabal/packages/ |
| 12:28:29 | <mxc> | good evening #haskell |
| 12:28:33 | <iesahin> | Hello all, what's the problem that I can't see in this simple program: http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2390#a2391 |
| 12:28:44 | <mxc> | whats the current least awful way of integrating java and haskell code? |
| 12:28:51 | <mxc> | saw some conflicting info on the wiki |
| 12:29:27 | <vegai> | how about a way of the Borg |
| 12:29:38 | <vegai> | first, make the different pieces talk through a simple interface such as a pipe |
| 12:29:44 | <vegai> | and little by little, fade away the Java code |
| 12:29:58 | <vegai> | finally, assimilation will be complete |
| 12:30:27 | <mxc> | vegai - thats my current wort case solution.. there isn't any java code yet, but I have a priject that I'd like to do in a proper language but which requires using java API |
| 12:30:49 | <HugoDaniel> | i just installed python on my windows box, and the installer didn't set the path :/ |
| 12:30:54 | <HugoDaniel> | why didn't it set the path ? |
| 12:31:22 | <Berengal> | HugoDaniel: You might try asking in #python |
| 12:32:22 | <HugoDaniel> | sorry, wrong # |
| 12:32:24 | <HugoDaniel> | :( |
| 12:32:43 | <HugoDaniel> | its my first try out in mirc, sorry there :/ |
| 12:32:50 | <Berengal> | That's okay :) |
| 12:33:12 | <mxc> | iesahin - how do your princeton profs feel about posting raw code here and asking for help? |
| 12:33:17 | <trofi^w> | or might try to install haskell |
| 12:33:27 | <iesahin> | which princeton profs? |
| 12:33:34 | <HugoDaniel> | trofi^w, haskell is already installed :) and working good |
| 12:33:41 | <mxc> | did a google search on cs461 haskell and took a guess :) |
| 12:33:54 | <trofi^w> | ah, ok :] |
| 12:34:08 | <mxc> | :t unfoldr |
| 12:34:09 | <lambdabot> | forall b a. (b -> Maybe (a, b)) -> b -> [a] |
| 12:34:13 | <HugoDaniel> | i miss cabal in python :( |
| 12:34:23 | <iesahin> | mxc: haha, but wrong guess, i'm the ta and try to produce random test data for pruning homework |
| 12:34:36 | <mxc> | haha |
| 12:34:39 | <Berengal> | I miss Haskell in Python... |
| 12:35:01 | <iesahin> | mxc: if you like i can send you homeworks in java to grade |
| 12:35:02 | <iesahin> | :) |
| 12:35:07 | <mxc> | haha |
| 12:35:13 | <mxc> | my TA days are over |
| 12:35:33 | <iesahin> | but that unfoldr should work, doesn't it? |
| 12:36:15 | <HugoDaniel> | when coding in python i realise that haskell really is years ahead of this "generation" of programming languages |
| 12:37:52 | <Berengal> | @type randoms |
| 12:37:53 | <lambdabot> | forall g a. (RandomGen g, Random a) => g -> [a] |
| 12:37:58 | <Berengal> | iesahin: ↑ |
| 12:38:34 | <pjolk> | is it correct to say that Arrow is a family of operators? |
| 12:38:39 | <iesahin> | i want to produce list of random *primes* |
| 12:38:42 | <mxc> | iesahin: brb |
| 12:39:08 | <iesahin> | mxc: ? |
| 12:39:08 | <horms> | iesahin: i think wli is doing some work on primes |
| 12:39:27 | <mxc> | be right back, going to take a look |
| 12:39:33 | <pjolk> | how does structural sharing work when using FFI? if I use hmatrix, does assigning to the matrix happen in the IO monad? if not, does it create a whole new matrix or does it share structure with the old unmodified one? |
| 12:40:02 | <pjolk> | HugoDaniel: yeah I agree |
| 12:40:13 | <pjolk> | OO is a dead end |
| 12:40:19 | <Berengal> | iesahin: Ah, sorry, wasn't paying attention to the code :P |
| 12:40:55 | <iesahin> | Berengal: :) |
| 12:40:58 | <Berengal> | You might try not mapping fst over an int... |
| 12:41:01 | <quicksilver> | pjolk: I've not used hmatrix, but generally the choices are (a) put it in the IO monad (b) treat it immutably and create new copies. |
| 12:41:13 | <Berengal> | Well, list of ints... |
| 12:41:17 | <quicksilver> | pjolk: It's not easy to make C libraries interoperate with clever sharing strategies. |
| 12:41:39 | <pjolk> | quicksilver: but then new copies dont share structure like in a normal haskell-program? |
| 12:42:10 | <pjolk> | because ghc must know something about the representation of the matrices to be able to do that right? |
| 12:42:21 | <quicksilver> | yes. |
| 12:42:27 | <iesahin> | Berengal: You're right |
| 12:42:43 | <iesahin> | That's a silly error |
| 12:42:46 | <mxc> | back, sry |
| 12:42:54 | <iesahin> | Thanks for your attention |
| 12:43:07 | <Berengal> | iesahin: What little of it was there :P |
| 12:43:09 | <mxc> | drop the map fst i think |
| 12:43:16 | <mxc> | oh, oops, someone beat me too it |
| 12:43:39 | <iesahin> | Berengal, mxc: Thanks |
| 12:47:00 | <HugoDaniel> | is there an easy way to check how many packages hackagedb has ? |
| 12:47:54 | <earthy> | 'ask dons' ? :) |
| 12:47:58 | <HugoDaniel> | :D |
| 12:49:25 | <Elly> | that's the answer to a lot of questions in haskell |
| 12:49:28 | <Elly> | "ask $person" |
| 12:50:29 | <HugoDaniel> | seems we are all inside a reader monad :P |
| 12:53:22 | <burp_> | @faq can haskell tell HugoDaniel if there is an easy way to check how many packages hackagedb has? |
| 12:53:22 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 12:54:56 | <benny99> | @faq can haskell do something it's not able to do ? |
| 12:54:56 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 12:55:13 | <Asztal> | cabal list --simple | wc -l, maybe? |
| 12:56:36 | <doserj> | $ cabal list --simple | awk '{print $1}' | uniq | wc -l |
| 12:56:40 | <doserj> | 1280 |
| 12:59:56 | <xter_> | Headache! |
| 13:10:05 | <Berengal> | Is haddock supposed to take forever? |
| 13:11:59 | <tromp> | no, only half that long |
| 13:14:28 | <ksf> | why doesn't :: * -> * syntax work with gadts? |
| 13:14:37 | <vixey> | I think that it does ksf |
| 13:14:51 | <vixey> | (maybe you have to turn on KindSignatures) |
| 13:15:04 | <ksf> | error: parse error on input `*' |
| 13:15:37 | <ksf> | yeah, that's it. |
| 13:16:40 | <ksf> | ACTION thinks binding a type var and never using it is utterly confusing. |
| 13:16:52 | <ksf> | pointless points flying aroud. |
| 13:26:58 | <ivanm> | is it possible to define the actual lambda-calculus Y combinator in Haskell? It fails to typecheck for me when I try :s |
| 13:27:10 | <ivanm> | (wikipedia says that Data.Function.fix is equivalent though..._ |
| 13:27:22 | <ivanm> | @type \ g -> (\ x -> g (x x)) (\ x -> g (x x)) |
| 13:27:23 | <lambdabot> | Occurs check: cannot construct the infinite type: t = t -> t1 |
| 13:27:24 | <lambdabot> | Probable cause: `x' is applied to too many arguments |
| 13:27:24 | <lambdabot> | In the first argument of `g', namely `(x x)' |
| 13:33:12 | <chessguy_work> | ivanm i seem to remember it's not possible |
| 13:33:27 | <chessguy_work> | oh, too late |
| 13:36:39 | <pjolk> | hmm, does Haskell use a lot more memory than Java/Scala? or is thta only if you do it wrong? or maybe I should ask does it takemore effort to keepmemory down? |
| 13:37:00 | <opqdonut> | it sometimes takes quite a bit of effort |
| 13:37:09 | <opqdonut> | but haskell isn't that memory-hungry as such |
| 13:37:32 | <quicksilver> | pjolk: too much of a generalisation to give an easy answer to. |
| 13:37:42 | <quicksilver> | certainly haskell churns more memory than java. |
| 13:37:49 | <quicksilver> | since it creates many small heap objects. |
| 13:37:56 | <quicksilver> | that doesn't necessarily matter, though. |
| 13:39:23 | <pjolk> | churns as in allocates and discards? not holding at the same time? |
| 13:40:41 | <FunctorSalad> | greetings. A basic STM question... does reading an empty TChan cause retry? Can I do a non-blocking read with "(Just <$> readTChan c) `orElse` Nothing"? |
| 13:41:02 | <lenni_-_> | i have a question about miranda which is similar to haskell. i was asked to rewrite the function member using foldr or foldl. I have: fold_member list elm = foldr (((=)1.\/)) False list |
| 13:41:13 | <lenni_-_> | but that gives a type error |
| 13:41:43 | <FunctorSalad> | I guess "non-blocking" isn't quite applicable here... |
| 13:41:53 | <chessguy_work> | @type foldr (((=)1.\/)) False ?list |
| 13:41:56 | <lambdabot> | parse error on input `=' |
| 13:42:02 | <FunctorSalad> | I mean "try to read from the chan, but if there's nothing, continue the transaction anyway" |
| 13:42:03 | <chessguy_work> | @type foldr (((==)1.\/)) False ?list |
| 13:42:04 | <lambdabot> | Not in scope: `.\/' |
| 13:42:38 | <chessguy_work> | @hoogle (\/) |
| 13:42:38 | <lambdabot> | No results found |
| 13:42:55 | <chessguy_work> | @type foldr (((==)1.(||))) False ?list |
| 13:42:56 | <lambdabot> | Couldn't match expected type `b -> b' against inferred type `Bool' |
| 13:42:57 | <lambdabot> | Probable cause: `.' is applied to too many arguments |
| 13:42:57 | <lambdabot> | In the first argument of `foldr', namely `(((==) 1 . (||)))' |
| 13:43:34 | <chessguy_work> | @type (==)1.(||) |
| 13:43:35 | <lambdabot> | No instance for (Num (Bool -> Bool)) |
| 13:43:35 | <lambdabot> | arising from the literal `1' at <interactive>:1:4 |
| 13:43:35 | <lambdabot> | Possible fix: add an instance declaration for (Num (Bool -> Bool)) |
| 13:43:46 | <chessguy_work> | @type ((==)1).(||) |
| 13:43:47 | <lambdabot> | No instance for (Num (Bool -> Bool)) |
| 13:43:47 | <lambdabot> | arising from the literal `1' at <interactive>:1:5 |
| 13:43:47 | <lambdabot> | Possible fix: add an instance declaration for (Num (Bool -> Bool)) |
| 13:44:05 | <quicksilver> | FunctorSalad: I would have thought that reading an empty TChan causes blocking. |
| 13:44:19 | <quicksilver> | FunctorSalad: you then get a retry later if things turn out to be inconsistent. |
| 13:44:22 | <quicksilver> | FunctorSalad: but not if they don't. |
| 13:44:27 | <quicksilver> | FunctorSalad: STM is optimistic. |
| 13:44:43 | <Berengal> | reading an empty TChan causing retry is only logical |
| 13:44:51 | <Berengal> | I've relied on it in the past |
| 13:45:03 | <quicksilver> | why is that more logical than blocking? |
| 13:45:11 | <Berengal> | as in "read this `orElse` read that" |
| 13:45:23 | <Berengal> | quicksilver: It allows you to orElse on it |
| 13:45:25 | <quicksilver> | hmm. |
| 13:45:31 | <quicksilver> | yes, fair enough. |
| 13:45:32 | <lenni_-_> | chessguy_work: thanks for trying; i can't get it working either |
| 13:45:34 | <FunctorSalad> | quicksilver: the readTChan source does mention retry, but I don't know whether the internal stuff blocks anyway |
| 13:45:46 | <FunctorSalad> | http://hackage.haskell.org/packages/archive/stm/2.1.1.2/doc/html/src/Control-Concurrent-STM-TChan.html#readTChan |
| 13:45:47 | <chessguy_work> | @type foldr |
| 13:45:48 | <lambdabot> | forall a b. (a -> b -> b) -> b -> [a] -> b |
| 13:45:48 | <quicksilver> | lenni_-_: your question made absolutely no sense. |
| 13:45:57 | <quicksilver> | lenni_-_: (=) isn't a haskell operator and neither is \/ |
| 13:46:20 | <ivanm> | I asked before (about 20 min ago) about implementing the Y combinator... did anyone answer, as X decided it didn't like me around that time :s |
| 13:46:22 | <lenni_-_> | quicksilver: i'm learning miranda |
| 13:46:29 | <lenni_-_> | quicksilver: which is similar to haskell |
| 13:46:34 | <chessguy_work> | @type \x y -> y || (x == 1) |
| 13:46:35 | <lambdabot> | forall a. (Num a) => a -> Bool -> Bool |
| 13:46:37 | <quicksilver> | oh, I see. |
| 13:46:43 | <quicksilver> | I misread your question. |
| 13:46:46 | <chessguy_work> | @pl \x y -> y || (x == 1) |
| 13:46:46 | <lambdabot> | flip (||) . (1 ==) |
| 13:46:47 | <ivanm> | lenni_-_: I thought miranda was dead :s |
| 13:47:05 | <pjolk> | are ocaml and haskell the only practical functional languages? ML, Miranda, Cayene, etc are research languages? |
| 13:47:07 | <lenni_-_> | ivanm: it is! my prof isn't quite with the time |
| 13:47:09 | <chessguy_work> | @type foldr (flip (||).(1==)) False |
| 13:47:10 | <lambdabot> | forall t. (Num t) => [t] -> Bool |
| 13:47:14 | <opqdonut> | ivanm: yeah it's possible, but you need a newtype |
| 13:47:14 | <ivanm> | lenni_-_: lol |
| 13:47:15 | <FunctorSalad> | actually I'm trying to do a very simple thing, have one-way communication from one thread to another, but with non-blocking reads. so far I did this with a plain Chan and isEmptyChan, but someone on ghc-users said that isEmptyChan has issues |
| 13:47:16 | <chessguy_work> | lenni_-_, there you go |
| 13:47:18 | <opqdonut> | ivanm: to break the infinite type |
| 13:47:21 | <ivanm> | opqdonut: :( |
| 13:47:28 | <ksf> | I thought you had to say that it was trademarked by someone every time you mentioned the m-word. |
| 13:47:37 | <opqdonut> | ivanm: actually, wait a sec |
| 13:48:51 | <chessguy_work> | lenni_-_, did you see my solution? |
| 13:48:55 | <Berengal> | ivanm: untyped lambda calculus is inconsistent. Y relies on this inconsistency (infinite type) |
| 13:48:55 | <lenni_-_> | chessguy_work: so I need to flip the two operators? |
| 13:49:11 | <ivanm> | Berengal: *nod* |
| 13:49:24 | <chessguy_work> | lenni_-_, flip the or operator |
| 13:49:41 | <quicksilver> | pjolk: ML is a family. it has various practical implementations. |
| 13:49:48 | <quicksilver> | pjolk: ocaml and sml are the more famous |
| 13:49:57 | <FunctorSalad> | Berengal: what does "inconsistent" mean in this context? |
| 13:49:59 | <lenni_-_> | chessguy_work: hmm, why is that? |
| 13:50:04 | <opqdonut> | ivanm: there was a way to type Y with some forall-trickery |
| 13:50:07 | <opqdonut> | (higher order types) |
| 13:50:15 | <ksf> | pjolk, instead of cayenne, have a look at agda |
| 13:50:19 | <FunctorSalad> | (curry-howard for untyped lamba calculus?) |
| 13:50:19 | <chessguy_work> | lenni_-_, because of the type of foldr |
| 13:50:29 | <chessguy_work> | @type foldr |
| 13:50:30 | <lambdabot> | forall a b. (a -> b -> b) -> b -> [a] -> b |
| 13:50:31 | <ivanm> | quicksilver: and F#? |
| 13:50:32 | <Berengal> | FunctorSalad: You can make nonsensical statements, such as x = ¬x |
| 13:50:48 | <lenni_-_> | chessguy_work: aha, cheers! |
| 13:50:49 | <quicksilver> | ivanm: I'm not sure if F# is exactly an ML, but yes. |
| 13:50:53 | <ivanm> | Berengal: you mean it doesn't? :o |
| 13:50:55 | <ivanm> | ;-) |
| 13:51:11 | <FunctorSalad> | Berengal: I mean, I don't see how to curry-howard untyped lamba calculus, since it has only a single type, right? |
| 13:51:13 | <Berengal> | ivanm: I know! Math is so unintuitive at times :P |
| 13:51:31 | <FunctorSalad> | so only a single proposition |
| 13:52:20 | <lenni_-_> | chessguy_work: flip takes 3 arguments and returns the 2dn and 3 in reverse order? like swap? |
| 13:52:28 | <bastl> | hi i try to compile haXml 1.19.6, but it complains that some module is missing which is in polyparse-1.1 which is hidden. How can i unhide it ? |
| 13:52:33 | <ksf> | :t flip |
| 13:52:34 | <lambdabot> | forall a b c. (a -> b -> c) -> b -> a -> c |
| 13:52:53 | <Berengal> | FunctorSalad: Eh, I'm not quite up to speed on the theory yet :/ I think the best way to show the inconsistency is to show how it doesn't work in a typed system |
| 13:52:54 | <ksf> | it flips the first two, which are "all". |
| 13:53:41 | <FunctorSalad> | is it any more inconsistent than fix in haskell? (which is false in propositional logic as well) |
| 13:53:42 | <chessguy_work> | lenni_-_, no, flip takes a function of 2 parameters, and returns a new function that takes the two parameters in the opposite order, but does the same thing |
| 13:54:58 | <ivanm> | Berengal: do you know if it's possible to define say the factorial function using church numerals? |
| 13:55:14 | <quicksilver> | ivanm: yes, certainly. |
| 13:55:21 | <Berengal> | ivanm: I can't see why not, though I don't know how |
| 13:55:27 | <quicksilver> | ivanm: untyped lambda calculus is turing complete |
| 13:55:30 | <ivanm> | easily? :p |
| 13:55:33 | <quicksilver> | ivanm: you can do everything with church numerals. |
| 13:55:42 | <ivanm> | quicksilver: even bake a caek? :p |
| 13:55:45 | <sbahra> | everything? |
| 13:55:47 | <sbahra> | ;p |
| 13:55:54 | <ksf> | ivanm, * isn't too hard to do in church. |
| 13:56:03 | <quicksilver> | @faq can a haskell implementation of untyped LC bake a caek? |
| 13:56:03 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 13:56:11 | <quicksilver> | pretty good. I don't even know what a caek is :P |
| 13:56:39 | <malcolmw> | bastl: try installing polyparse-1.2 + HaXml-1.19.7 instead? |
| 13:56:42 | <Berengal> | By the way, since we're on the topic, what does succ look like in SKI combinator calculus? |
| 13:56:57 | <Berengal> | zero = KI, succ = ??? |
| 13:57:09 | <vixey> | Berengal: why is KI zero? |
| 13:57:34 | <Berengal> | zero = flip const |
| 13:57:40 | <vixey> | yeah why |
| 13:58:13 | <Berengal> | it applies its first argument to its second zero times |
| 13:58:45 | <ivanm> | OK, I'll just use the "let's add numbers to lambda calculus" version of factorial as an example then |
| 13:58:52 | <vixey> | so you have the lambda term and you ant to produce the combinator version? |
| 13:58:53 | <ivanm> | if I can make sense of the one on wikipedia |
| 13:59:32 | <ksf> | ivanm, http://homepages.cwi.nl/~tromp/cl/lazy-k.html , go for it. |
| 13:59:47 | <Berengal> | yeah, I believe succ was somethingl like \n f x. f (n f x) |
| 13:59:50 | <FunctorSalad> | so, would this be a reasonable way to read everything available from a TChan without retry? http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4786#a4786 |
| 14:00:21 | <dolio> | vixey: How new is your agda? |
| 14:00:38 | <vixey> | I just installed it yesterday |
| 14:00:41 | <bastl> | malcolmw: good, it compiles |
| 14:00:44 | <vixey> | from darcs |
| 14:01:08 | <vixey> | @pl\n f x -> f (n f x) |
| 14:01:09 | <lambdabot> | (line 1, column 5): |
| 14:01:09 | <lambdabot> | unexpected ">" or "-" |
| 14:01:09 | <lambdabot> | expecting variable, "(", operator or end of input |
| 14:01:14 | <ivanm> | ksf: what's K? |
| 14:01:33 | <ksf> | the k combinator |
| 14:01:38 | <Berengal> | FunctorSalad: Looks okay to me, assuming it works |
| 14:01:47 | <FunctorSalad> | :) |
| 14:02:31 | <Berengal> | K = \x y . x |
| 14:02:35 | <Berengal> | aka const |
| 14:03:24 | <vixey> | dolio, why? |
| 14:03:32 | <dolio> | vixey: Does this work for you: http://hpaste.org:80/fastcgi/hpaste.fcgi/view?id=4787#a4787 |
| 14:03:55 | <quicksilver> | FunctorSalad: putting "atomically" inside your combinators considered harmful. |
| 14:04:06 | <vixey> | yes that works |
| 14:04:46 | <vixey> | nice proof btw |
| 14:05:03 | <dolio> | Nice proof that all functions are injective? |
| 14:05:06 | <vixey> | yes |
| 14:05:11 | <vixey> | your version of agda doesn't typecheck that? |
| 14:05:18 | <dolio> | No, it does. |
| 14:05:33 | <FunctorSalad> | quicksilver: "combinator" as in combining STM actions here? the function is supposed to be called from outside STM, but I guess you mean the atomically should be in the user? |
| 14:06:01 | <dolio> | I thought it shouldn't. |
| 14:06:23 | <dolio> | Maybe that's a bad definition of injectivity, though. |
| 14:06:41 | <bastl> | malcolmw: how should i fix this? http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=4788 |
| 14:07:30 | <bastl> | the <p> tag from xhtml collides with some type from haxml |
| 14:07:52 | <malcolmw> | bastl: import Text.XML.HaXml.XmlContent hiding (P) |
| 14:08:09 | <bastl> | yeah, i expected somethign simple like that. thanks! |
| 14:08:57 | <malcolmw> | bastl: although the fact that a line number is 4522 suggests your module is machine-generated |
| 14:09:36 | <bastl> | im using DtdtoHaskell on xhtml1-strct.dtd |
| 14:10:43 | <vixey> | dolio http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4787#a4789 |
| 14:10:46 | <vixey> | that's why I like your proof |
| 14:10:50 | <malcolmw> | bastl: yeah, so hiding P in the generated module might not work, if other things in it use that P |
| 14:11:21 | <vixey> | so Agda is inconsistent |
| 14:11:24 | <bastl> | it worked anyway .. |
| 14:11:28 | <dolio> | Right. Okay. So it's not just me. |
| 14:11:34 | <vixey> | :D |
| 14:11:35 | <malcolmw> | bastl: but you might be fine - I can't remember whether DtdToHaskell-generated code needs P or not (P is the constructor for parsers) |
| 14:11:38 | <dolio> | I thought I was missing something. |
| 14:12:13 | <quicksilver> | FunctorSalad: yes, that's "the point" of STM, that its composable |
| 14:12:17 | <dolio> | Time to send some mail. |
| 14:12:23 | <quicksilver> | FunctorSalad: so the atomically goes at the outermost level. |
| 14:12:24 | <malcolmw> | bastl: OK, great. maybe I should make DtdToHaskell be more explicit about the imports required in the generated code. |
| 14:12:35 | <quicksilver> | FunctorSalad: you don't know if your user might want ot use that as part of a larger transaction... |
| 14:12:45 | <vixey> | time for a metacircular implementation of Agda that satisfies de bruijn criteria |
| 14:12:58 | <FunctorSalad> | quicksilver: good point :) |
| 14:13:44 | <quicksilver> | FunctorSalad: e.g. they might want to read everything from two chans |
| 14:13:56 | <chessguy_work> | vixey, can i get some fries with that? |
| 14:13:57 | <quicksilver> | FunctorSalad: then, your little combinator would be ideal :) if only it didn't bundle its own atomically. |
| 14:14:16 | <quicksilver> | yuck, fries with de bruijn criteria? |
| 14:14:24 | <quicksilver> | that's like mustard with cake. |
| 14:14:40 | <quicksilver> | de bruijn criteria should be enjoyed with a good whisky. Or doughnuts. |
| 14:15:23 | <EvilTerran> | ... what're de Bruijn criteria? |
| 14:16:08 | <vixey> | EvilTerran: it means don't write a whopping great million line type checker |
| 14:16:39 | <SamB> | vixey: how does it mean that? |
| 14:16:41 | <vixey> | if you have a small typechecker then complicated stuff like pattern matching (which appears to make agda inconsistent) is justified in terms of that |
| 14:17:02 | <vixey> | this is the fundamental design flaw of Agda imo |
| 14:17:29 | <vixey> | SamB: (should it mean something a bit different?) |
| 14:17:40 | <dolio> | Metacircular implementation? Hah. |
| 14:18:05 | <vixey> | dolio, I think that is what James Chapman is going for |
| 14:18:28 | <swiert> | vixey: so why does pattern matching make agda inconsistent? |
| 14:18:43 | <vixey> | sweirt: dolio just pasted this http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4787#a4789 |
| 14:19:02 | <vixey> | I annotated with the obvious proof of false |
| 14:19:52 | <FunctorSalad> | :O |
| 14:22:30 | <FunctorSalad> | vixey, I'm not familiar with Agda... the point is that you can pattern match on (f a)? |
| 14:23:46 | <SamB> | vixey: I did always think they had too nebulous a typechecker ... |
| 14:36:30 | <bastl> | why is Data.Typeable restricted to Typeable7 ? Could i extend that easily ? |
| 14:37:43 | <doserj> | bastl: http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#deriving-typeable |
| 14:37:52 | <dolio> | You really have a type parameterized by 8 or more other types? |
| 14:39:16 | <vixey> | dolio, how did you come by that injectivity stuff though? |
| 14:39:45 | <edwardk> | ACTION waves hello. |
| 14:39:45 | <lambdabot> | edwardk: You have 2 new messages. '/msg lambdabot @messages' to read them. |
| 14:40:11 | <dolio> | vixey: I was looking at SCM's latest blog post, but thought that his defining it in terms of relations was overkill... |
| 14:40:34 | <dolio> | vixey: So I defined it for functions, and started to see if I could prove surjective f -> injective f. |
| 14:40:54 | <dolio> | Then I did C-c C-c on the fx=fy proof, and noticed that I didn't need surjectivity at all. |
| 14:40:57 | <Athas> | How do I calculate 2**n-1, where n is an Integer, as an Integer value? |
| 14:41:08 | <vixey> | ahh |
| 14:41:20 | <vixey> | > 2**3+1 |
| 14:41:21 | <dolio> | And it generalized to non-endomorphisms. |
| 14:41:21 | <lambdabot> | 9.0 |
| 14:41:25 | <vixey> | > 2^3+1 |
| 14:41:26 | <lambdabot> | 9 |
| 14:41:37 | <Athas> | Ah, thanks. |
| 14:41:49 | <EvilTerran> | ?type (^) |
| 14:41:50 | <lambdabot> | forall a b. (Integral b, Num a) => a -> b -> a |
| 14:41:52 | <EvilTerran> | ?type (^^) |
| 14:41:53 | <lambdabot> | forall a b. (Integral b, Fractional a) => a -> b -> a |
| 14:41:55 | <EvilTerran> | ?type (**) |
| 14:41:56 | <lambdabot> | forall a. (Floating a) => a -> a -> a |
| 14:42:26 | <kosmikus> | dolio, vixey: the Agda injectivity thing is fixed or about to be fixed, afaik |
| 14:42:52 | <vixey> | kosmikus: I'm sure it will be, but I'm very curious to see /how/ they fix it |
| 14:42:54 | <dolio> | Oh, this is a known problem? Now I feel less special. |
| 14:43:15 | <vixey> | i.e. do they just change one line of code and go: Right now Agda is working again |
| 14:44:27 | <kosmikus> | dolio: well, we found this today, curiously |
| 14:44:33 | <dolio> | Heh. |
| 14:44:36 | <kosmikus> | dolio: issue 160 on the Agda bug tracker |
| 14:44:45 | <kosmikus> | dolio: marked as fixed now |
| 14:44:53 | <vixey> | kosmikus: oh you are actually one of the implementers? |
| 14:44:57 | <kosmikus> | no, |
| 14:45:04 | <kosmikus> | but I'm visiting Chalmers this week |
| 14:45:07 | <vixey> | oh good I can still complain :p |
| 14:45:29 | <dolio> | I should find the tracker and bookmark it... |
| 14:45:34 | <mattam> | kosmikus: it was treating f as a type constructor? |
| 14:45:49 | <kosmikus> | mattam: yes, more or less |
| 14:46:16 | <mattam> | This injectivity of type constructors always bugged me but maybe it's still sound. |
| 14:46:22 | <kosmikus> | dolio: code.google |
| 14:46:55 | <edwardk> | dolio: heh, i actually had a need for a 'higher order' cofree comonad with three parameters the other day. |
| 14:47:15 | <EvilTerran> | ... how can something be co-free? |
| 14:47:33 | <edwardk> | EvilTerran: its admittedly a pretty bad term |
| 14:47:41 | <EvilTerran> | i've seen the term used a few times in here, but it only just struck me that it makes no intuitive sense |
| 14:48:46 | <edwardk> | EvilTerran: the problem is iirc, there is both a comonad and a monad for the prod-type construction, and the comonad is the construction that is dual to the free monad |
| 14:49:16 | <vixey> | it should be some where on here? http://code.google.com/p/agda/issues/list?can=1&q=&colspec=ID+Type+Status+Priority+Milestone+Owner+Summary&cells=tiles |
| 14:49:35 | <dolio> | Freeness is defined by adjointness to a forgetful functor, right? |
| 14:50:02 | <dolio> | Are cofree things at least adjoint on the opposite side? |
| 14:50:30 | <kosmikus> | vixey: number 160 |
| 14:50:33 | <edwardk> | good question |
| 14:50:43 | <kosmikus> | it's no longer open |
| 14:50:47 | <vixey> | thanks |
| 14:50:57 | <EvilTerran> | ACTION will get back to you in a couple of terms, when he's done CT |
| 14:50:59 | <edwardk> | well, it is a comonad, so the adjunction running the other way makes sense |
| 14:51:30 | <EvilTerran> | s/CT/an introduction to CT/ |
| 14:51:40 | <vixey> | :/ |
| 14:51:46 | <vixey> | it says "status: fixed" but it doesn't show you the fix |
| 14:51:50 | <MyCatVerbs> | EvilTerran: I think I need an introduction to CT introductions. |
| 14:51:56 | <edwardk> | @hpaste |
| 14:51:57 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 14:51:58 | <dolio> | Time to recompile. :) |
| 14:52:48 | <dolio> | I guess that means I no longer have any incentive not to install GHC 6.10.3. |
| 14:53:19 | <EvilTerran> | MyCatVerbs, heh; i'm hoping getting lectured on it will make things easier. |
| 14:53:29 | <edwardk> | dolio: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4794#a4794 |
| 14:53:57 | <edwardk> | dolio: needed a higher order zipper for walking down a grammar which is parameterized on its token type |
| 14:54:46 | <EvilTerran> | ... that URL could really use some rewriting |
| 14:56:06 | <dolio> | edwardk: Anyhow, this is still less than 8 parameters, if that's what this is about. :) |
| 14:56:16 | <edwardk> | the 'punchline' there is the Leaf data type at the bottom which is a zipper through a Grammar with token type t to a leaf parser which recognizes a single character basically when its all sewed up it defines all possible paths |
| 14:56:30 | <edwardk> | dolio: 8 parameters? |
| 14:56:48 | <EvilTerran> | edwardk, someone was bemoaning the lack of Typeable8 earlier |
| 14:56:49 | <dolio> | I guess not. Someone above was asking why Typeable only goes up to Typeable7. |
| 14:56:54 | <edwardk> | hah |
| 14:57:14 | <edwardk> | dolio: nah, this was just that i was suffering internet withdrawal over the weekend, and wanted to show off my shiny new toy ;) |
| 14:57:44 | <dolio> | Well, this looks like something, but I think I'm too sleepy to understand it now. |
| 14:58:15 | <edwardk> | dolio: basically the nifty part is the fact that it zippers into an applicative, which i'd never seen before |
| 14:58:41 | <edwardk> | the worst is yet to come because there is a version that uses all the StableName craziness to regain sharing from cyclic grammars |
| 14:59:12 | <edwardk> | and that lets me build PEGs, TIGs, etc. from a common grammar format, so i can try out different parallel parser types |
| 14:59:49 | <edwardk> | @hpaste |
| 14:59:49 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 15:00:37 | <edwardk> | and the grammars feel very much like parsec/uu-parsinglib/polyparse |
| 15:00:38 | <edwardk> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4795#a4795 |
| 15:01:26 | <edwardk> | for instance that link above replaces this mess: http://hackage.haskell.org/packages/archive/monoids/0.1.36/doc/html/src/Data-Monoid-Lexical-UTF8-Decoder.html |
| 15:02:06 | <edwardk> | and can still be run in parallel and generates the result in an arbitrary Char Reducer, which can include another parser. |
| 15:02:47 | <dolio> | Wow. |
| 15:02:50 | <malcolmw> | edwardk: very beautiful |
| 15:04:03 | <edwardk> | i'm still limited to applicative parsers, so mostly context-free affix/attribute grammars |
| 15:04:18 | <quicksilver> | edwardk: but you can layer it, right? |
| 15:04:22 | <edwardk> | but since i can synthesize higher order attributes, i can deal with inherited attributes |
| 15:04:32 | <edwardk> | quicksilver: yeah |
| 15:04:43 | <quicksilver> | edwardk: and most practical context dependent grammars can be factored as two or three stage context-free ones |
| 15:04:48 | <quicksilver> | at least, that's my informal experience |
| 15:05:16 | <edwardk> | quicksilver: note the generalized signature of utf8Chars, 'many' reduces in an arbitrary Reducer rather than [a] -- the parallel parsers work as reducers. |
| 15:05:25 | <quicksilver> | yes |
| 15:05:31 | <quicksilver> | I did indeed note that :) |
| 15:05:46 | <edwardk> | quicksilver: so yeah, layering is what its all about =) |
| 15:06:34 | <edwardk> | quicksilver: i'm hoping to allow a mixture of packrat, monoidal, lalr, whatever makes sense from the grammar by sharing a grammar format to as large a degree as possible |
| 15:06:53 | <edwardk> | quicksilver: but i want the monoidal parsing because it works really well when i build partial parses in a fingertree. |
| 15:07:08 | <edwardk> | then i can do incremental reparsing fast |
| 15:07:20 | <quicksilver> | incremental reparsing is better than doughnuts! |
| 15:07:54 | <xenoblitz> | hi people got a small problem with IORefs... can someone help please? http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4796#a4796 thanks |
| 15:08:53 | <quicksilver> | xenoblitz: because unsafePerformIO is unsafe. |
| 15:08:56 | <quicksilver> | Don't do what you're doing. |
| 15:08:59 | <vixey> | lol |
| 15:09:13 | <vixey> | yeah the unsafePerformIO stuff might have something to do with |
| 15:09:35 | <quicksilver> | xenoblitz: the 'IORef' at top level hack depends criticially on the compiler not inlining or duplicating the newIORef |
| 15:09:39 | <xenoblitz> | quicksilver, vixey: that module is not mine... its one of the best ways to detect sharing and loops in DSELs... that's why I am trying to fully understand it |
| 15:09:39 | <vixey> | xenoblitz: what are you actually trying to implement? |
| 15:09:43 | <malcolmw> | edwardk: of course the UTF8 grammar is really lexing, not parsing |
| 15:09:48 | <vixey> | oh right sharing stuff |
| 15:10:07 | <vixey> | don't hav emuch to say about that -- some programs that try and make use of it don't even compile |
| 15:10:13 | <swiert> | Aha. ICFP list of accepted papers is up: http://web.cecs.pdx.edu/~apt/icfp09_accepted_papers/accepted.html |
| 15:10:16 | <edwardk> | malcolmw: sure, it was just a toy grammar |
| 15:10:32 | <quicksilver> | xenoblitz: OK. I don't understand GHC semantics well enough to know how I'd expect that code to behave. |
| 15:10:45 | <xenoblitz> | quicksilver, vixey: can you explain a bit why the first one behaves that way in simple for-silly-people english |
| 15:10:51 | <edwardk> | malcolmw: most of the interesting grammars need my horrible stable map machinery to recover sharing information so they can be run bottom up |
| 15:11:03 | <doserj> | well, low is shared because it is named, |
| 15:11:03 | <quicksilver> | xenoblitz: it depends criticall how often the newIORef actually gets called. |
| 15:11:08 | <vixey> | xenoblitz: I don't know why - I don't spend any time thinking about how unsafePerformIO works |
| 15:11:27 | <malcolmw> | edwardk: eek! |
| 15:11:31 | <xenoblitz> | quicksilver: so its a question of when low is called... I guess low is being reused |
| 15:11:52 | <xenoblitz> | vixey: i don't like to work with this stuff either but I have to learn about it for my work unfortunately |
| 15:12:01 | <vixey> | sorry that I can't help |
| 15:12:04 | <edwardk> | malcolmw: the original version had two modules where almost every definition was unsafeCoerce ;) |
| 15:12:07 | <pejo> | swiert, congrats! |
| 15:12:07 | <vixey> | I'm sure there is a better solution that this rubbish btw |
| 15:12:17 | <xenoblitz> | quicksilver, vixey: thanks all the same |
| 15:12:23 | <swiert> | pejo: thanks. |
| 15:12:31 | <edwardk> | malcolmw: i'm a bit nicer to the type checker nowadays at least |
| 15:12:33 | <xenoblitz> | vixey: hehe there are other techniques but they are messy for use in DSELs |
| 15:12:35 | <swiert> | (though the main credit goes to Marcos and Doaitse) |
| 15:12:36 | <vixey> | ACTION is just reading the list for puns |
| 15:13:16 | <vixey> | not as my as I hope :( |
| 15:13:20 | <vixey> | many* |
| 15:13:32 | <xenoblitz> | vixey: like forcing people to use a label each time, or using sequential labels via monads but its ugly for a non-experienced user to use |
| 15:13:44 | <xenoblitz> | if anyone knows of any more recently found solutions pls let me know! |
| 15:13:44 | <edwardk> | malcolmw: i did figure out that i can run my 'recognizing' parsers in an arbitrary right-seminearring though, so you can extract more than just 'did it match' you can extract a parse trie or count of possible parses without doing all of the parse combinations |
| 15:14:16 | <edwardk> | malcolmw: its funny how many ways all the monoids machinery is finding itself useful now that i have a coherent framework for it |
| 15:15:22 | <vixey> | xenoblitz: like low = Wire <$> ref Low rather than low = Wire $ ref Low ? |
| 15:15:37 | <vixey> | it's not /that/ bad |
| 15:15:40 | <edwardk> | swiert: seeing you here reminds me i need to send some uu-parsinglib patches to doaitse |
| 15:16:06 | <xenoblitz> | vixey: what's <$> ? |
| 15:16:09 | <swiert> | edwark: cool. I'm sure he'll be interested. |
| 15:16:16 | <edwardk> | xenoblitz: fmap |
| 15:16:30 | <vixey> | xenoblitz: but 'ref' would be newSTRef or something |
| 15:16:37 | <edwardk> | swiert: mostly patching it up so it can use the standard Control.Applicative, and getting rid of some bad instance heads |
| 15:16:46 | <malcolmw> | edwardk: yes, the new slogan "but you don't need a full monad for that" applies in many new and surprising places :-) |
| 15:18:27 | <xenoblitz> | vixey, edwardk: sorry for this question - its mostly due to my lack of knowledge - how can fmap help me? |
| 15:18:40 | <vixey> | xenoblitz: maybe it can't |
| 15:18:47 | <edwardk> | malcolmw: heh, basically all my 'recognizing parsers' are is just using the right-seminearring that underlies every instance of Alternative, and abusing the fact that there are more redundancies possible there than in the Applicative. |
| 15:19:00 | <edwardk> | xenoblitz: your question was why you returned false when you compared refs right? |
| 15:19:19 | <edwardk> | xenoblitz: thats because each one is a 'different ref', if you set one it doesn't change the other |
| 15:19:28 | <edwardk> | so Eq is doing the right thing and telling you they are different! |
| 15:19:50 | <xenoblitz> | edwardk: yeah i get the second case ... its more the first one i can't understand! |
| 15:20:07 | <jmcarthur> | wait, there's an Eq instance for IORef? |
| 15:20:15 | <jmcarthur> | hmm, actually, i have some deja vu now |
| 15:20:32 | <xenoblitz> | edwardk: since low = Wire $ ref Low shouldn't both cases be the same? |
| 15:20:43 | <vixey> | :t newSTRef |
| 15:20:44 | <lambdabot> | forall a s. a -> ST s (STRef s a) |
| 15:20:50 | <vixey> | :t Just <$> newSTRef 3 |
| 15:20:52 | <lambdabot> | forall t s. (Num t) => ST s (Maybe (STRef s t)) |
| 15:21:03 | <vixey> | :t Just $ newSTRef 3 |
| 15:21:04 | <lambdabot> | forall t s. (Num t) => Maybe (ST s (STRef s t)) |
| 15:21:16 | <vixey> | xenoblitz: (maybe that explains why) |
| 15:21:27 | <edwardk> | xenoblitz: no, because you are looking at the 'same reference' in memory. low is a CAF each 'low' is the same thunk. |
| 15:21:54 | <vixey> | xenoblitz: if you hate monadic style and want to write everything directly you can do this stuff in Scheme |
| 15:22:12 | <edwardk> | this is why its dangerous to play with unsafePerformIO because now sharing which was previously invisible to you becomes visible to your program |
| 15:22:20 | <xenoblitz> | vixey: i don't hate monadic style vixey, it requires many combinators to be introduced for looping which are not user friendly |
| 15:22:35 | <xenoblitz> | edwardk: CAF? |
| 15:22:38 | <vixey> | programming isn't user friendly |
| 15:22:51 | <xenoblitz> | vixey: DSELS are supposed to be :) |
| 15:22:55 | <edwardk> | i'll have to let someone take that, i have to run =) |
| 15:23:07 | <vixey> | I guess that's why they're the new buzzword |
| 15:23:09 | <xenoblitz> | edwardk: thanks all the same |
| 15:23:13 | <edwardk> | xenoblitz: you just need more combinators for your DSEL. |
| 15:23:15 | <xenoblitz> | vixey: not really that new |
| 15:23:23 | <jmcarthur> | i think combinators are perfectly user friendly |
| 15:23:56 | <xenoblitz> | jmcarthur: yeah but you need to introduce a huge number for loops when writing circuits... |
| 15:24:10 | <jmcarthur> | loops? |
| 15:24:17 | <vixey> | xenoblitz: there's a chapter about circuitry in CTM |
| 15:24:21 | <xenoblitz> | xenoblitz: i'm quoting Claessen :) feedback loops like in latches |
| 15:24:28 | <xenoblitz> | lol |
| 15:24:40 | <xenoblitz> | jmcarthur: i'm quoting Claessen :) feedback loops like in latches |
| 15:26:05 | <jmcarthur> | i am unfamiliar with Claessen's papers |
| 15:26:35 | <xenoblitz> | jmcarthur: I'm mostly reading his stuff about his HDL in Haskell called Lava |
| 15:28:25 | <jmcarthur> | eh, getting too domain specific for me to be helpful. generally, i don't think a combinator explosion is really necessary if you are choosing appropriate abstractions, but there could be some corner cases for which i am wrong |
| 15:29:35 | <xenoblitz> | jmcarthur: i just wish to understand how ghc works in the cases shown in the hpaste that's all... why two cases which seem the same to me are now different all of a sudden |
| 15:30:03 | <quicksilver> | xenoblitz: because unsafePerformIO performs a side-effecting operation, and you don't know when. |
| 15:30:17 | <quicksilver> | xenoblitz: you have no way of knowing if GHC will perform it once or twice, in the second case. |
| 15:30:27 | <quicksilver> | in the first case you might have a strong suspicion it will only do it once |
| 15:30:31 | <quicksilver> | but even that is not guaranteed. |
| 15:31:21 | <xenoblitz> | quicksilver: to be honest I understand the second case more than the first... to me there are two separate calls to low but apparently ghc sees the "low" and instead of evaluating it twice it evaluates it only once |
| 15:31:39 | <xenoblitz> | quicksilver: for lack of a better term instead of evaluating |
| 15:32:06 | <quicksilver> | let a = 3+4 |
| 15:32:09 | <quicksilver> | (a == a) |
| 15:32:20 | <quicksilver> | would you expect GHC to do the calculation 3+4 twice? |
| 15:32:49 | <xenoblitz> | quicksilver: no you are right... i guess i have remnants of OOP still running in my head |
| 15:33:25 | <pjolk> | is the Halting problem really much of a problem? |
| 15:33:28 | <xenoblitz> | quicksilver: it does make sense , from what you said :) |
| 15:33:31 | <vixey> | pjolk: lol |
| 15:33:44 | <quicksilver> | of course, your example demonstrates exactly why we hate unsafePerformIO |
| 15:33:55 | <quicksilver> | since what you've shown is a violation of referential transparency |
| 15:34:01 | <pjolk> | I should say , is it of much practical importance for proving programs? |
| 15:34:03 | <quicksilver> | and referential transparency is great. |
| 15:34:14 | <EvilTerran> | pjolk, its ramifications are, yes |
| 15:34:36 | <vixey> | xenoblitz: your approach would work in ocaml |
| 15:34:51 | <pjolk> | I mean that you can't prove ALL programs doesn't matter much if you cna prove 99.99% |
| 15:34:52 | <vixey> | pjolk: no |
| 15:35:12 | <EvilTerran> | pjolk, for instance, it tells us that it's impossible to create a church-turing-complete programming language with infallible proof of termination |
| 15:35:17 | <pjolk> | is there a special set of problems that aren't provable? |
| 15:35:19 | <xenoblitz> | quicksilver: yes i love it... but sometimes I need otherwise |
| 15:35:19 | <xenoblitz> | vixey: ocaml is not referentially transparent then? |
| 15:35:22 | <vixey> | pjolk: 99.99% of correctness proofs about programs -- halting doesn't matter |
| 15:35:32 | <quicksilver> | xenoblitz: actually you are mistaken. |
| 15:35:39 | <quicksilver> | xenoblitz: you never need referential transparency to fail. |
| 15:35:42 | <quicksilver> | you never will, either. |
| 15:35:44 | <quicksilver> | no one needs that :) |
| 15:35:53 | <vixey> | xenoblitz: it's got mutable refs and most importantly it's applicative order -- which is why you can write in direct style with effects |
| 15:35:56 | <xenoblitz> | quicksilver: ehhh try refering to two AND gates in a circuit |
| 15:36:18 | <quicksilver> | You might possibly *want* it. But my own opinion is that actually you would be misguided then. |
| 15:36:34 | <xenoblitz> | vixey: that's a bit off my head but I'll keep a mental note of that :) |
| 15:36:34 | <quicksilver> | (a `AND` b) `XOR` (a `AND` c) |
| 15:36:42 | <quicksilver> | omg! a circuit with two and gates! |
| 15:36:52 | <quicksilver> | your contradiction needs a *lot* more context. |
| 15:36:55 | <vixey> | xenoblitz: just goes with what quicksilver said, haskell being lazy is why your method doesn't work |
| 15:37:17 | <quicksilver> | it's not remotely clear why a circuit having two and gates would require violations of r.t. |
| 15:37:17 | <xenoblitz> | quicksilver: imagine you want to interpret a circuit with a loop to see how many gates it has... in haskell you end up with an infinite tree |
| 15:37:18 | <EvilTerran> | ACTION would be tempted to assign unique identities to wires |
| 15:37:42 | <vixey> | xenoblitz: but if your library has CTM check it out |
| 15:37:45 | <xenoblitz> | evilterran: it has been done by O'Donnell but its a bit messy |
| 15:37:52 | <xenoblitz> | xenoblitz: I will :) |
| 15:37:55 | <vixey> | lol |
| 15:37:57 | <xenoblitz> | vixey: dammit |
| 15:37:58 | <xenoblitz> | lol |
| 15:37:58 | <quicksilver> | xenoblitz: what we are discussing now is *very* messy :P |
| 15:38:02 | <xenoblitz> | i get confused |
| 15:38:03 | <xenoblitz> | lol |
| 15:38:05 | <pozic> | I use runInteractiveProcess and then waitForProcess it, but still the Haskell program terminates while the process I am running never terminates, as a result of the Haskell program dying, the started process also dies. |
| 15:38:06 | <EvilTerran> | xenoblitz, so don't represent your system as a recursive data structure directly |
| 15:38:07 | <quicksilver> | so "a bit" messy sounds better to me. |
| 15:38:55 | <EvilTerran> | xenoblitz, like you can describe a graph in haskell as a Map NodeId (Set NodeId) |
| 15:39:01 | <xenoblitz> | guys i agree with you totally... but it is a bit messy trust me to use a function to give a name every time... imagine you want to compose circuits together... you need a way of generating fresh labels yadayadayada |
| 15:39:23 | <EvilTerran> | that'll be a unique supply monad, then |
| 15:39:39 | <jmcarthur> | (or comonad) |
| 15:39:39 | <xenoblitz> | evilterran: a monad to supply a label? |
| 15:39:40 | <quicksilver> | xenoblitz: that's exactly the kind of thing haskell is good at. |
| 15:39:50 | <quicksilver> | composable abstractions which supply, for example, unique names. |
| 15:39:56 | <quicksilver> | although that's not the only way to do this. |
| 15:40:04 | <EvilTerran> | xenoblitz, the next label to use could be considered a piece of state |
| 15:40:15 | <quicksilver> | you can just shift all the names of the second circuit up by 'n' - the name of names in the first circuit. |
| 15:40:37 | <EvilTerran> | xenoblitz, so you could work in a wrapped State monad to store the name supply |
| 15:40:43 | <quicksilver> | a `alongSide` b = a ++ [b `renameLabelsBy` (highestLabel a)] |
| 15:40:51 | <quicksilver> | there are loads of different solutions to this problem. |
| 15:41:09 | <xenoblitz> | yes yes monads can be used I created a small implementation using the statemonad but then you can't really create circular circuit definitions |
| 15:41:15 | <quicksilver> | you could read some papers on de bruijn indices |
| 15:41:16 | <xenoblitz> | you then need loop combinators and stuch |
| 15:41:17 | <jmcarthur> | why not? |
| 15:41:20 | <pozic> | xenoblitz: there is mdo for that |
| 15:41:26 | <quicksilver> | which solve the related problem - unique variable names for bound terms |
| 15:41:36 | <quicksilver> | in the context of term languages. |
| 15:41:37 | <xenoblitz> | mdo yes :) that's what the looping combinator does |
| 15:41:38 | <pozic> | xenoblitz: which translates to mfix |
| 15:42:36 | <EvilTerran> | MonadFix needn't even be necessary, depending on what the monad does |
| 15:42:48 | <xenoblitz> | hehe look guys if you want to see what i mean best solution is to read: http://www.cs.chalmers.se/~koen/pubs/entry-lic00-thesis.html |
| 15:42:57 | <xenoblitz> | but i know you can't waste your time reading that :P |
| 15:43:24 | <quicksilver> | xenoblitz: but if *you* want to understand it - which is why you came here asking questions |
| 15:43:30 | <quicksilver> | then you better be able to rebut our objections. |
| 15:43:33 | <xenoblitz> | that's why Claessen suggested this solution... its not nice granted... but its A solution... i just wanted to understand how things work a bit more before I write anything down :) |
| 15:43:42 | <quicksilver> | it's not a solution |
| 15:43:44 | <jmcarthur> | it just sounds to me like you are stuck on one particular design strategy |
| 15:43:47 | <quicksilver> | insofar as it doesn't work |
| 15:43:50 | <EvilTerran> | ACTION thinks "andGate, orGate, xorGate {-, ... -} :: M (Wire, Wire, Wire); connect :: Wire -> Wire -> M ()" |
| 15:43:52 | <quicksilver> | because it depends on details of the GHC implementation |
| 15:43:57 | <quicksilver> | which is undocumented |
| 15:44:11 | <quicksilver> | and not even fully understood by the vaunted members of this IRC channel :) |
| 15:44:28 | <jmcarthur> | EvilTerran, i can see an Arrow lurking somewhere |
| 15:44:36 | <xenoblitz> | quicksilver: the solutions being suggested here have all been discussed in that thesis |
| 15:44:37 | <quicksilver> | did you know, for example, that under some rare circumstances, 'low' might get evaluated in two different threads? |
| 15:44:46 | <xenoblitz> | quicksilver: yes |
| 15:44:48 | <quicksilver> | which can give two different refs. |
| 15:45:11 | <Zao> | Great fun. |
| 15:45:13 | <xenoblitz> | quicksilver: Claessen proves something about it in one of the chapters in there |
| 15:45:14 | <xenoblitz> | hehe |
| 15:45:56 | <EvilTerran> | jmcarthur, yeah, ArrowLoop would be another way of doing it |
| 15:46:43 | <pozic> | Why doesn't waitForProcess do what it is supposed to do which would be waiting for the process to end? |
| 15:48:35 | <quicksilver> | pozic: what made your haskell process die? |
| 15:48:37 | <xenoblitz> | anyways people, thanks for the discussion :) at least I can see that I'm not the only one who doesn't like the solution :P |
| 15:48:58 | <pozic> | quicksilver: it seems it just runs off the main thread. |
| 15:49:13 | <quicksilver> | waitForProcess is not in the main thread? |
| 15:49:25 | <pozic> | quicksilver: it is. |
| 15:49:45 | <quicksilver> | so waitForProcess is returning too early? |
| 15:49:48 | <pozic> | quicksilver: yes |
| 15:50:37 | <quicksilver> | what does it return? |
| 15:52:16 | <pozic> | quicksilver: hmm, ExitFailure 1. |
| 15:52:53 | <pozic> | quicksilver: if I run the exact same on the shell, it doesn't exit. |
| 15:53:11 | <quicksilver> | lots of things are different about shells |
| 15:53:14 | <quicksilver> | buffering, ttys, etc |
| 15:53:23 | <EvilTerran> | ... grr. neither of the bots have "instance Show (f (Mu f)) => Show (Mu f)"? =/ |
| 15:53:24 | <quicksilver> | maybe the program behaves differently called non-interactively. |
| 15:54:17 | <pozic> | quicksilver: in ghci it works |
| 15:55:04 | <vixey> | , src 'Fix |
| 15:55:05 | <pozic> | quicksilver: which PATH is runInteractiveProcess using by default? |
| 15:55:05 | <lunabot> | luna: Not in scope: data constructor `Fix' |
| 15:55:06 | <vixey> | , src ''Fix |
| 15:55:09 | <lunabot> | newtype Fix s a = InB {outB :: (s a (Fix s a))} |
| 15:55:19 | <vixey> | , InB Nothing |
| 15:55:20 | <lunabot> | luna: Couldn't match expected type `s a (Control.Functor.Fix.Fix s a)' |
| 15:55:33 | <EvilTerran> | ,src ''FixF -- is lunabot's equivalent to lambdabot's Fix |
| 15:55:34 | <lunabot> | luna: parse error (possibly incorrect indentation) |
| 15:55:43 | <EvilTerran> | ,src ''FixF {- >.< -} |
| 15:55:45 | <lunabot> | newtype FixF f = InF {outF :: (f (FixF f))} |
| 15:55:53 | <vixey> | , InF Nothing |
| 15:55:54 | <lunabot> | luna: No instance for (GHC.Show.Show |
| 15:55:56 | <vixey> | gr |
| 15:55:58 | <EvilTerran> | ?src Fix |
| 15:55:58 | <lambdabot> | Source not found. I can't hear you -- I'm using the scrambler. |
| 15:56:13 | <pozic> | quicksilver: never mind, that's not it either. |
| 15:56:20 | <EvilTerran> | ?? In :: (?type In); out :: (?type out) |
| 15:56:22 | <lambdabot> | In :: forall (f :: * -> *). f (Mu f) -> Mu f; out :: forall (f :: * -> *). Mu f -> f (Mu f) |
| 15:57:25 | <EvilTerran> | anyway, from idle ponderings, i've devised "cata :: Functor f => (f a -> a) -> Mu f -> a; cata f = f . fmap (cata f) . out; ana :: Functor f => (a -> f a) -> a -> Mu f; ana f = In . fmap (ana f) . f" - is that about right? |
| 16:00:24 | <quicksilver> | conal: congrats on icfp acceptance |
| 16:00:57 | <conal> | quicksilver: thx :) |
| 16:09:30 | <pozic> | quicksilver: the semantics depends on whether or not you actually read stdout/stderr. |
| 16:09:44 | <pozic> | quicksilver: in other words, a huge f*ck up :( |
| 16:09:56 | <quicksilver> | that's not very surprising. |
| 16:10:16 | <quicksilver> | please learn how unix programs behave before trying to blame your problems on haskell standard libraries. |
| 16:10:19 | <quicksilver> | kthxbye. |
| 16:10:52 | <Zao> | ACTION hugs his favourite non-unix platform. |
| 16:11:06 | <EvilTerran> | ACTION becomes utterly distracted from what he was meant to be doing by the tricks possible with Functor f => ... Mu f ... |
| 16:12:11 | <chessguy_work> | conal, which paper? |
| 16:12:32 | <quicksilver> | beautiful differentiation |
| 16:12:40 | <quicksilver> | http://web.cecs.pdx.edu/~apt/icfp09_accepted_papers/accepted.html |
| 16:13:16 | <chessguy_work> | nice |
| 16:14:14 | <conal> | i'm pretty happy with how that work came out. the idea took me quite a few passes, each time getting more to the essential simplicity. |
| 16:15:33 | <conal> | (of automatic differentiation) |
| 16:16:04 | <jpcooper> | hello |
| 16:16:32 | <jpcooper> | I've imported Data.IntSet as qualified. How do I use IntSet in type definitions? |
| 16:17:01 | <quicksilver> | Data.IntSet.IntSet |
| 16:20:23 | <jpcooper> | thanks |
| 16:22:15 | <EvilTerran> | jpcooper, i'd suggest "import qualified Data.IntSet as IS" (or some other shorter name); then you could write IS.IntSet etc instead |
| 16:22:21 | <Vq^> | jpcooper: in case you missed it, the module documentation has a recommended way to import it |
| 16:22:39 | <jpcooper> | thanks EvilTerran |
| 16:30:04 | <voker57> | how to delete a file / perform other non-basic operations with filesystem? |
| 16:30:15 | <pjolk> | can you have recursive lambdas? |
| 16:30:46 | <mauke> | @hoogle remove |
| 16:30:47 | <lambdabot> | System.Directory removeDirectory :: FilePath -> IO () |
| 16:30:47 | <lambdabot> | System.Directory removeDirectoryRecursive :: FilePath -> IO () |
| 16:30:47 | <lambdabot> | System.Directory removeFile :: FilePath -> IO () |
| 16:30:47 | <Botje> | pjolk: sure, just give them a name |
| 16:30:58 | <ulfdoz> | pjolk: not directly. fix points are defined therefore, iirc. |
| 16:31:00 | <Botje> | OR use the fix function :) |
| 16:31:15 | <ulfdoz> | fix point operator more precisely. |
| 16:31:24 | <Botje> | myfac = fix (\fac n -> ... fac ... ) |
| 16:31:36 | <pjolk> | > map fac [1..10] |
| 16:31:38 | <lambdabot> | Not in scope: `fac' |
| 16:31:41 | <EvilTerran> | pjolk, i tend to write "(let f ... = ... in f)" instead of (\ ... -> ...) if i want a recursive function inline in an expression |
| 16:32:07 | <EvilTerran> | > map (product . enumFromTo 1) [1..10] |
| 16:32:08 | <lambdabot> | [1,2,6,24,120,720,5040,40320,362880,3628800] |
| 16:32:26 | <EvilTerran> | > scanl (*) 1 [1..10] |
| 16:32:27 | <lambdabot> | [1,1,2,6,24,120,720,5040,40320,362880,3628800] |
| 16:32:59 | <pjolk> | > map (fix (\fac n -> if n < 1 then 1 else n * fac (n-1))) [1..10] |
| 16:33:01 | <lambdabot> | [1,2,6,24,120,720,5040,40320,362880,3628800] |
| 16:33:14 | <pjolk> | > map (fix (\fac n -> if n < 1 then 1 else n * fac (n-1))) [1..5] |
| 16:33:16 | <lambdabot> | [1,2,6,24,120] |
| 16:35:15 | <mm_freak> | > map product . inits $ [2..5] |
| 16:35:16 | <lambdabot> | [1,2,6,24,120] |
| 16:35:34 | <zachk> | how do i get my cabal install of hoogle to return the same results as the web hoogle |
| 16:35:54 | <zachk> | permutations from Data.List is missing in my hoogle |
| 16:35:55 | <Botje> | threaten it wit hviolence |
| 16:36:17 | <zachk> | i tried an electromagnetic, it didnt even shiver |
| 16:36:40 | <Saizan_> | zachk: you need to generate your own index |
| 16:36:55 | <zachk> | Saizan_: how do i do that |
| 16:37:04 | <Saizan_> | zachk: in the hoogle repo there are scripts to help with that |
| 16:37:17 | <zachk> | do i need darcs? |
| 16:37:39 | <mm_freak> | zachk: permutations is quite new |
| 16:37:47 | <Saizan_> | zachk: but in general you use cabal haddock --hoogle on a library to create the .txt database and then hoogle --convert to get the binary one |
| 16:37:48 | <jpcooper> | say I have a list of things which I would like to show. How do I have to do each one separately? |
| 16:37:55 | <jpcooper> | as in, write [show x, show y, show z] |
| 16:38:15 | <Saizan_> | zachk: you can also browse the repo online i guess |
| 16:38:23 | <zachk> | im offline alot |
| 16:38:32 | <zachk> | i find hoogle very helpful |
| 16:38:51 | <Saizan_> | i meant the hoogle repo to get the scripts |
| 16:39:09 | <zachk> | how do i access the repo |
| 16:39:10 | <jmcarthur> | jpcooper, something like (map show [x, y, z])? |
| 16:39:18 | <zmyrgel> | Is there some info available how to organize / design haskell app? I |
| 16:39:18 | <zmyrgel> | mean Java has design patterns, MVC etc. How to convert these to |
| 16:39:18 | <zmyrgel> | Haskell? |
| 16:39:29 | <quicksilver> | jpcooper: also, consider "show [x,y,z]" |
| 16:39:35 | <quicksilver> | depends what you want to do, of course. |
| 16:39:39 | <Saizan_> | zachk: http://community.haskell.org/~ndm/hoogle/ |
| 16:39:42 | <jpcooper> | x, y and z are of different types |
| 16:39:47 | <jmcarthur> | > map show [1,2,3] |
| 16:39:48 | <Berengal> | map show doesn't work for heterogenous lists |
| 16:39:48 | <lambdabot> | ["1","2","3"] |
| 16:39:52 | <jmcarthur> | > show [1,2,3] |
| 16:39:52 | <jpcooper> | I would like a string representation of all of them |
| 16:39:53 | <lambdabot> | "[1,2,3]" |
| 16:40:05 | <Berengal> | > map show [1, "Hello", Just 5] |
| 16:40:06 | <lambdabot> | Couldn't match expected type `[Char]' |
| 16:40:14 | <Zao> | > fmap show [1,2,3] |
| 16:40:15 | <lambdabot> | ["1","2","3"] |
| 16:40:20 | <skorpan> | Berengal: that's interesting, why did it expect [Char]? |
| 16:40:28 | <Zao> | Berengal: Last I checked, lists were homogeneous. |
| 16:40:34 | <Zao> | Otherwise it wouldn't be a list. |
| 16:40:48 | <jpcooper> | but 1 is not a Char |
| 16:40:54 | <doserj> | jpcooper: it could be |
| 16:40:57 | <jmcarthur> | yeah the map show part has nothing to do with that type error |
| 16:41:03 | <jmcarthur> | > [1, "Hello", Just 5] |
| 16:41:04 | <lambdabot> | Couldn't match expected type `[Char]' |
| 16:41:11 | <doserj> | well, it could be a String here |
| 16:41:33 | <Berengal> | skorpan: My guess is [1::Num String => String, "Hello" :: String, Just 5 :: Maybe a] |
| 16:41:49 | <skorpan> | Berengal: Num String? |
| 16:41:53 | <jpcooper> | so there is no other way to show a set of things of different type other than doing it manually? |
| 16:42:01 | <quicksilver> | well there is show (x,y,z) |
| 16:42:06 | <quicksilver> | what are you *actually* trying to do? |
| 16:42:10 | <Zao> | jpcooper: You could probably sneak up some magical instance of something for tuples. |
| 16:42:14 | <Berengal> | skorpan: Yeah, it decides String has to be a member of Num, then bails on Maybe a before it checks membership |
| 16:42:15 | <quicksilver> | your question doesn't contain quite enough context. |
| 16:42:41 | <skorpan> | Berengal: *is* String a Num? |
| 16:42:46 | <Berengal> | quicksilver: I recently ran into this problem doing toSql on a bunch of things |
| 16:42:47 | <quicksilver> | if you can find a context in which the types make sense, there is probably an answer which makes sense. |
| 16:42:58 | <Zao> | A tuple is an ordered sequence of finite length with heterogeneous element types. |
| 16:42:58 | <quicksilver> | Berengal: sure; I'm familiar with that problem. |
| 16:43:11 | <Zao> | A list is an ordered sequence of possibly infinite length with homogeneous element types. |
| 16:43:12 | <quicksilver> | Berengal: I'm just not sure, yet, that that is the problem jpcooper has ;) |
| 16:43:13 | <Berengal> | skorpan: No, it isn't, but it might be as far as the typechecker is concerned. It just doesn't get to the point where it checks if it's true |
| 16:43:23 | <skorpan> | Berengal: interesting thought |
| 16:43:43 | <skorpan> | @src Num |
| 16:43:43 | <lambdabot> | class (Eq a, Show a) => Num a where |
| 16:43:44 | <lambdabot> | (+), (-), (*) :: a -> a -> a |
| 16:43:44 | <lambdabot> | negate, abs, signum :: a -> a |
| 16:43:44 | <lambdabot> | fromInteger :: Integer -> a |
| 16:43:56 | <Berengal> | @type map show [1, "Hello"] |
| 16:43:57 | <lambdabot> | No instance for (Num [Char]) |
| 16:43:57 | <lambdabot> | arising from the literal `1' at <interactive>:1:10 |
| 16:43:57 | <lambdabot> | Possible fix: add an instance declaration for (Num [Char]) |
| 16:44:02 | <quicksilver> | there is an 'abstraction failure' which says that you can't shorten [show x,show y,show z] to map show [x,y,z] |
| 16:44:11 | <quicksilver> | arguably this is because haskell doesn't have first-class existentials |
| 16:44:18 | <Berengal> | Yeah, it first assumes String is a Num, then figures it out later |
| 16:44:19 | <quicksilver> | although thre are other ways of framing the problem. |
| 16:44:20 | <jpcooper> | Zao, I'm trying to write an instance of show for one of my data-types, and I'm lazy |
| 16:44:22 | <jmcarthur> | jpcooper, "a set of things of different type" is where i would like more information |
| 16:44:38 | <quicksilver> | jpcooper: just derive it? ;) |
| 16:45:00 | <jpcooper> | quicksilver, I only want to string representation of its fields |
| 16:45:03 | <jpcooper> | the* |
| 16:45:12 | <jpcooper> | I could derive, do words and drop the first word, actually |
| 16:45:18 | <Berengal> | I assume you could do something with TH and tuples... |
| 16:45:25 | <quicksilver> | jpcooper: you want the wrong thing. |
| 16:45:31 | <quicksilver> | jpcooper: the derived show instance is the correct show instance. |
| 16:45:32 | <EvilTerran> | jpcooper, that sounds like it shouldn't really be a show instance |
| 16:45:36 | <quicksilver> | jpcooper: don't want something else ;) |
| 16:45:42 | <jpcooper> | okay then |
| 16:45:48 | <jpcooper> | I'd like to represent my data-type nicely |
| 16:45:58 | <jpcooper> | I would also like to eat, so I'll be off |
| 16:46:06 | <EvilTerran> | although the same problem stands regardless of whether you call your function "show" or not |
| 16:46:08 | <quicksilver> | eating is good. |
| 16:46:12 | <Berengal> | jpcooper: that's a job for pretty printers. Show's job is to make haskell code |
| 16:46:13 | <zachk> | saizan: <no location info>: module `Array' is a package module |
| 16:46:13 | <zachk> | |
| 16:46:38 | <jpcooper> | Berengal, I'd like an easier way in which to do that, then |
| 16:46:39 | <quicksilver> | jpcooper: show (x,y,z) is a conveniewnt hack for debugging code |
| 16:46:43 | <quicksilver> | I use that quite often. |
| 16:46:50 | <edwardk> | ACTION contemplates building a treap off of hashStableName but feels dirty for even thinking it |
| 16:47:10 | <zachk> | edwardwk: whats a treap? |
| 16:47:11 | <quicksilver> | edwardk: you're already a bad man. Will this really make you any worse? |
| 16:47:19 | <Berengal> | jpcooper: Yeah, I get what you're trying to do. I'd like a good solution as well |
| 16:47:22 | <brian6> | if a program p uses forkpty and gets a fd it can use to communicate with a child process, can i duplicate fd over p's stdin and stdout so someone who calls p can interact with the child process through p's stdin and stdout? or does p have to do bidirectional proxying? |
| 16:47:42 | <EvilTerran> | ACTION tries to work out what CINNI does with free variables |
| 16:47:48 | <edwardk> | treap = hash the node's contents, and maintain the heap property on the hash while maintaining the normal properties of a binary tree on the value. |
| 16:48:09 | <edwardk> | zachk: you get a 'randomized' binary tree without all the shuffling if you have a good hash function |
| 16:48:35 | <edwardk> | quicksilver: probably not =) |
| 16:49:20 | <EvilTerran> | ACTION keeps reading "the name sort" as "the same sort". dammit, i know it's more accurate use of terminology to say "sort", but "type" reads so much less confusingly |
| 16:52:20 | <Taejo> | :t uncurry . uncurry |
| 16:52:22 | <lambdabot> | forall b c a b1. (a -> b1 -> b -> c) -> ((a, b1), b) -> c |
| 16:54:52 | <edwardk> | oh alright, benchmarking it devil's advocate purposes |
| 16:55:52 | <vixey> | EvilTerran: maybe it's different in that context but usually if I have v :: t :: s I say v has type t, v has sort s |
| 17:00:14 | <EvilTerran> | vixey, er, do you mean "t has sort s"? |
| 17:00:20 | <vixey> | no |
| 17:01:08 | <EvilTerran> | so "sort" implies skipping a level of the heirarchy, as it were? |
| 17:01:24 | <vixey> | the way I use it, maybe I am the only one that says this |
| 17:02:36 | <EvilTerran> | here, they're just using "name sort", "term sort", etc to talk about various syntactic categories |
| 17:03:52 | <EvilTerran> | "[_]_ binds argument 0 (of name sort) in argument 1 (of term sort)" |
| 17:04:58 | <endofjelly> | so what's a sort, if it's not a type or a kind? |
| 17:05:03 | <endofjelly> | what kind of type is a sort? %) |
| 17:05:12 | <vixey> | sorts and kind are the same thing basically |
| 17:05:36 | <endofjelly> | so a sort is some sort or kind of kind. |
| 17:05:37 | <EvilTerran> | i've previously heard "sort" use to mean any one of the heirarchy "value :: type :: kind :: ..." |
| 17:07:24 | <marcot> | Good afternoon. |
| 17:07:38 | <marcot> | Is there a way to tell alex that the language I want to parse is not case sensitive? |
| 17:10:48 | <endofjelly> | EvilTerran, so its value lies in specifying some kind of sort for values, sorts and kinds? |
| 17:11:55 | <edwardk> | endofjelly: sorts give you a classification scheme to which everything can belong. have you looked at pure type systems? they define a small set of sorts, a set of axioms, and a set of rules, where the axioms are relationships between sorts and rules define which Pi types you can define |
| 17:12:32 | <endofjelly> | okay so my puns are really horrible and nobody gets them, I got it thanks ;) |
| 17:12:36 | <edwardk> | endofjelly: vixey's definition works pretty well in most PTSs as an intuition for what a sort is |
| 17:14:20 | <EvilTerran> | marcot, it shouldn't matter to the lexer, anyway |
| 17:14:21 | <endofjelly> | thanks for explaining anyway, I really didn't know there were "sorts" and it sounds useful. |
| 17:15:59 | <edwardk> | endofjelly: http://people.cs.uu.nl/johanj/MSc/jwroorda/ has a pretty good overview of the ideas of a pure type system and includes enough detail to get down to how to implement languages with case, etc. in it |
| 17:16:48 | <endofjelly> | edwardk, I think I might like the idea of a pure type system. I'm currently playing with my implementation of a very small functional language, maybe I can play around with that. thanks! |
| 17:17:38 | <edwardk> | endofjelly: lemme know if you have any questions, its a really interesting way to build a type system and a hell of a lot cleaner than say system F. |
| 17:18:25 | <endofjelly> | edwardk, ah. as far as I know my project adviser at uni does a lot with system F. but I will let you know if something comes up |
| 17:19:31 | <endofjelly> | edwardk, is henk 2000 implemented in haskell? |
| 17:20:03 | <endofjelly> | "The concepts of ... `dependent types' arise naturally in functional programming languages based on the systems in this hierarchy." |
| 17:20:06 | <endofjelly> | oh |
| 17:21:12 | <endofjelly> | edwardk, never mind, just read that it's using parsec and JH's pretty printing library |
| 17:22:27 | <skorpan> | @hoogle (a -> b) -> (Maybe a) -> b |
| 17:22:28 | <lambdabot> | Prelude maybe :: b -> (a -> b) -> Maybe a -> b |
| 17:22:28 | <lambdabot> | Data.Maybe maybe :: b -> (a -> b) -> Maybe a -> b |
| 17:22:28 | <lambdabot> | Prelude ($) :: (a -> b) -> a -> b |
| 17:23:12 | <endofjelly> | @t ap |
| 17:23:12 | <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 |
| 17:23:15 | <endofjelly> | :t ap |
| 17:23:16 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => m (a -> b) -> m a -> m b |
| 17:23:25 | <endofjelly> | :t fmap |
| 17:23:26 | <lambdabot> | forall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b |
| 17:23:50 | <endofjelly> | :t lift |
| 17:23:50 | <EvilTerran> | marcot, sorry, reviewing the docs, am i right in thinking the problem is distinguishing case-insensitive keywords? |
| 17:23:51 | <lambdabot> | forall (m :: * -> *) a (t :: (* -> *) -> * -> *). (Monad m, MonadTrans t) => m a -> t m a |
| 17:24:02 | <endofjelly> | :t liftM |
| 17:24:03 | <lambdabot> | forall a1 r (m :: * -> *). (Monad m) => (a1 -> r) -> m a1 -> m r |
| 17:24:11 | <EvilTerran> | oh, he's gone. nvm. =/ |
| 17:34:23 | <lukeo05> | Anyone know a place I can get some good, simple exercises to give me practice doing basic stuff for my Introduction To FP exam? |
| 17:35:25 | <Jaydon_> | hi, I am trying to write a simple haskell code to output latex text, but am a little confused about how haskell handles special characters such as "\" and "&" |
| 17:35:49 | <leadnose> | lukeo05, this might be of interest: http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Problems.html |
| 17:36:13 | <Lemmih> | Jaydon_: '&' is not a special character. |
| 17:36:29 | <lukeo05> | leadnose: thanks a lot. that looks useful :) |
| 17:36:53 | <leadnose> | beware that you can't flatten arbitrary lists in haskell :) |
| 17:37:01 | <leadnose> | arbitrarily nested |
| 17:37:32 | <Jaydon_> | let test = "\ " |
| 17:37:33 | <Jaydon_> | <interactive>:1:15: lexical error in string/character literal at end of input |
| 17:37:48 | <Lemmih> | Jaydon_: "\\ " |
| 17:38:07 | <Jaydon_> | Prelude Char Data.Char> let test = "\\ " |
| 17:38:07 | <Jaydon_> | Prelude Char Data.Char> test |
| 17:38:07 | <Jaydon_> | "\\ " |
| 17:38:11 | <Jaydon_> | I only want one backslash |
| 17:38:21 | <Lemmih> | Jaydon_: You only got one. |
| 17:38:37 | <Jaydon_> | hmm.. |
| 17:38:41 | <Lemmih> | Jaydon_: It's being escaped. Have a look at the length. |
| 17:38:50 | <jmcarthur> | Jaydon_, if you were to putStrLn that string you would have one |
| 17:39:18 | <Jaydon_> | ah! |
| 17:39:22 | <Jaydon_> | thankyou muchly! |
| 17:40:45 | <younder> | Haskel uses the same abbrevs as in C that is \r \n \b etc. so to get a \ you write \\.. |
| 17:41:23 | <younder> | Haskell |
| 17:41:31 | <zachk> | anyone: how do i make a database of package modules (Array) using hoogle |
| 17:44:36 | <C-Keen> | I need to parse a stream of bytes/bits, what should I use to do that? |
| 17:59:59 | <edwardk> | @hpaste |
| 18:00:00 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 18:01:01 | <edwardk> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4798#a4798 has my first cut at a cheesy StableName based treap. |
| 18:01:29 | <edwardk> | now i just need something to benchmark it with |
| 18:01:50 | <edwardk> | ideas? |
| 18:02:08 | <voker57> | @hoogle [a] -> [ [a] -> [a] ] -> [a] |
| 18:02:08 | <lambdabot> | Data.Generics.Aliases ext1T :: (Data d, Typeable1 t) => (d -> d) -> (t d -> t d) -> d -> d |
| 18:02:17 | <voker57> | @hoogle [ [a] -> [a] ] -> [a] -> [a] |
| 18:02:17 | <lambdabot> | Data.Generics.Aliases ext1T :: (Data d, Typeable1 t) => (d -> d) -> (t d -> t d) -> d -> d |
| 18:10:01 | <benbread> | Here be witchcraft |
| 18:13:28 | <Lemmih> | benbread: Hey, long time no see. (: |
| 18:18:56 | <pjolk> | so my teacher told me I'm a Functor in the category of idiots, what did he mean? |
| 18:19:21 | <pjolk> | @type (>>>) |
| 18:19:22 | <lambdabot> | forall (a :: * -> * -> *) b c d. (Arrow a) => a b c -> a c d -> a b d |
| 18:19:36 | <pjolk> | > (***) (+1) (3,4) |
| 18:19:37 | <lambdabot> | Couldn't match expected type `b' -> c'' |
| 18:19:46 | <pjolk> | > (***) (+1) (+4) (3,4) |
| 18:19:47 | <lambdabot> | (4,8) |
| 18:20:01 | <pjolk> | > (+1) *** (+4) (3,4) |
| 18:20:02 | <lambdabot> | Couldn't match expected type `b' -> c'' |
| 18:20:05 | <pjolk> | > (+1) *** (+4) $ (3,4) |
| 18:20:07 | <lambdabot> | (4,8) |
| 18:20:24 | <pjolk> | > (&&&) (+4) $ (3,4) |
| 18:20:25 | <lambdabot> | Couldn't match expected type `b -> c'' |
| 18:20:29 | <pjolk> | > (&&&) (+4) (3,4) |
| 18:20:30 | <lambdabot> | Couldn't match expected type `b -> c'' |
| 18:20:33 | <centrinia> | You map idiot objects to objects of some other category, map mappings between idiot objects to mappings between objects of another category, maintain the associative property, and preserves the identity map from the idiot category to the other category. |
| 18:22:38 | <pjolk> | so in short, I make people stupid? |
| 18:22:52 | <pjolk> | @type (&&&) |
| 18:22:53 | <lambdabot> | forall (a :: * -> * -> *) b c c'. (Arrow a) => a b c -> a b c' -> a b (c, c') |
| 18:23:07 | <pjolk> | i dont get &&& |
| 18:23:37 | <centrinia> | No, that would be what a contravariant functor in the category of idiots is. |
| 18:23:41 | <pjolk> | > (&&&) (+3) (3,4) |
| 18:23:42 | <lambdabot> | Couldn't match expected type `b -> c'' |
| 18:23:55 | <pjolk> | > (+3) (&&&) (3,4) |
| 18:23:56 | <lambdabot> | Overlapping instances for Show ((b, c') -> (b, (c, c'))) |
| 18:23:57 | <lambdabot> | arising... |
| 18:24:54 | <pjolk> | > (+3) &&& (3,4) |
| 18:24:55 | <lambdabot> | Couldn't match expected type `b -> c'' |
| 18:25:11 | <pjolk> | > (&&&) (+) (3,4) |
| 18:25:12 | <lambdabot> | Couldn't match expected type `a -> c'' |
| 18:25:18 | <pjolk> | > (&&&) (+) 1 (3,4) |
| 18:25:19 | <lambdabot> | Overlapping instances for Show ((t, t1) -> (t, t1)) |
| 18:25:20 | <lambdabot> | arising from... |
| 18:25:29 | <centrinia> | @type (&&&) (+) |
| 18:25:30 | <lambdabot> | forall a c'. (Num a) => (a -> c') -> a -> (a -> a, c') |
| 18:25:41 | <centrinia> | @type (&&&) (+) (*) |
| 18:25:42 | <lambdabot> | forall a. (Num a) => a -> (a -> a, a -> a) |
| 18:25:56 | <edwardk> | centrinia: well, he did say in the category of idiots, that would seem to indicate that each idiot is an object, and that since he is a functor _in_ the category of idiots, probably that each idiot is a category unto itself |
| 18:25:57 | <pjolk> | > (&&&) (+) (*) (3,4) |
| 18:25:58 | <lambdabot> | Overlapping instances for Show ((t, t1) -> (t, t1)) |
| 18:25:58 | <lambdabot> | arising from... |
| 18:26:03 | <pjolk> | > (&&&) (+1) (*3) (3,4) |
| 18:26:04 | <lambdabot> | No instance for (Num (t, t1)) |
| 18:26:04 | <lambdabot> | arising from the literal `1' at <i... |
| 18:26:13 | <pjolk> | > (&&&) (+1) (*3) 3 |
| 18:26:14 | <lambdabot> | (4,9) |
| 18:26:17 | <pjolk> | ah! |
| 18:26:26 | <pjolk> | > (+1) &&& (*3) $ 3 |
| 18:26:27 | <lambdabot> | (4,9) |
| 18:26:28 | <centrinia> | edwardk, good point. |
| 18:26:34 | <pjolk> | so arrows are awesome-tuplers |
| 18:27:20 | <centrinia> | Maybe the category of idiots is a category of functors as well. |
| 18:27:33 | <centrinia> | Can you have a category whose objects are sometimes functors? |
| 18:27:45 | <edwardk> | if he was an endofunctor on the category of idiots he'd swap idiots around, as it is, he probably just mixes up while leaving connected diagrams of some idiot when mapping it onto another idiot. |
| 18:28:09 | <edwardk> | centrinia: well, the category of idiots would clearly be some subcategory of Cat. perhaps the category of idiots is Lolcat. |
| 18:28:58 | <voker57> | @sr flip |
| 18:28:58 | <lambdabot> | flip f x y = f y x |
| 18:29:18 | <centrinia> | @sr flip . flip |
| 18:29:18 | <lambdabot> | Source not found. My pet ferret can type better than you! |
| 18:29:39 | <skorpan> | is there anything nice for automagically prettyprinting/treeifying a datastructure? |
| 18:29:45 | <jmcarthur> | :t flip . flip |
| 18:29:46 | <lambdabot> | forall a b c. (a -> b -> c) -> a -> b -> c |
| 18:29:54 | <pjolk> | > fmap (\_-> 1 . flip) [((+) 2)] |
| 18:29:56 | <lambdabot> | Overlapping instances for Show ((a -> b -> c1) -> c) |
| 18:29:56 | <lambdabot> | arising fro... |
| 18:30:05 | <pjolk> | > fmap (1 . flip) [((+) 2)] |
| 18:30:06 | <lambdabot> | No instance for (Num ((b -> (b -> c1) -> c1) -> c)) |
| 18:30:06 | <lambdabot> | arising from... |
| 18:30:16 | <centrinia> | @type 1 . flip |
| 18:30:17 | <lambdabot> | forall c a b c1. (Num ((b -> a -> c1) -> c)) => (a -> b -> c1) -> c |
| 18:30:23 | <centrinia> | Uh, yeah... |
| 18:30:31 | <pjolk> | > fmap ((flip) 1) [((+) 2)] |
| 18:30:32 | <lambdabot> | Overlapping instances for Show (a -> c) |
| 18:30:32 | <lambdabot> | arising from a use of `s... |
| 18:30:41 | <pjolk> | > fmap (\x -> (flip x) 1) [((+) 2)] |
| 18:30:42 | <lambdabot> | Overlapping instances for Show ((b -> c) -> c) |
| 18:30:42 | <edwardk> | skorpan: look up vacuum |
| 18:30:42 | <lambdabot> | arising from a us... |
| 18:30:58 | <juturnas> | How would you load binary data from a file? I have a file of floats written in C that I want to load in haskell. I think I need to use the Foreign module and Storable, but I can't quite put it all together |
| 18:31:11 | <edwardk> | skorpan: it shows you how data is shared in the underlying data structure and can output graphviz or be used as a back end to ubigraph, etc. |
| 18:31:34 | <skorpan> | edwardk: i just want something simple generic thing which prettyprints it to my terminal |
| 18:31:45 | <edwardk> | juturnas: be warned the format of Binary/Storable for floats and doubles isn't an ieee floating point, irc. |
| 18:31:46 | <skorpan> | well, not necessarily printing it, but serializing it |
| 18:32:00 | <bavardage> | deriving Show :P? |
| 18:32:08 | <skorpan> | bavardage: that's not pretty :P |
| 18:32:19 | <bavardage> | yeah, but it serialises :D |
| 18:32:26 | <bavardage> | I didn't realise you were going to be *fussy* |
| 18:32:27 | <bavardage> | ^^ |
| 18:32:30 | <skorpan> | :) |
| 18:32:36 | <juturnas> | edwardk, thanks. I was afraid of something like that |
| 18:32:46 | <athos> | @src (<+>) |
| 18:32:46 | <lambdabot> | Source not found. There are some things that I just don't know. |
| 18:33:01 | <juturnas> | but is there not a way to convert it from Foregin.C.Types CFloat to a haskell value? |
| 18:33:06 | <edwardk> | juturnas: you can do something with Foreign.* to do it, but, blech. |
| 18:33:27 | <edwardk> | juturnas: thats the way to do it, iirc. CFloat/CDouble are just newtype wrappers |
| 18:33:46 | <juturnas> | I'll just check out the sources later then. thanks edwardk |
| 18:34:37 | <mm_freak> | i'm having DNS issues for hackage.haskell.org |
| 18:34:43 | <mm_freak> | anyone else? |
| 18:35:03 | <mm_freak> | % host hackage.haskell.org |
| 18:35:03 | <mm_freak> | ;; connection timed out; no servers could be reached |
| 18:35:17 | <Liskni_si> | juturnas: you can use fromRational . toRational (that's the way to convert between floating types, iirc) |
| 18:35:58 | <Asztal> | mm_freak: works for me: A 69.30.63.197 |
| 18:36:53 | <mm_freak> | ah, now it works |
| 18:36:56 | <mm_freak> | thanks |
| 18:37:36 | <skorpan> | i can't seem to find any *generic* prettyprinting library for showing tree-like datastructures... anyone? |
| 18:40:03 | <tomh> | anyone tested haskell on windows7? |
| 18:40:06 | <Botje> | always used Text.PrettyPrint |
| 18:40:36 | <skorpan> | Botje: it's not generic though, right? |
| 18:55:39 | <duckinator> | hi |
| 19:01:09 | <Botje> | not really :) |
| 19:09:37 | <edwardk> | cute. found a haskell hashlife implementation while hunting for users of stablename: http://dotat.at/prog/life/hslife.hs |
| 19:11:07 | <mm_freak> | haskell's RTS detects when an MVar operation blocks forever and throws an exception |
| 19:11:10 | <mm_freak> | can i rely on this? |
| 19:11:30 | <mm_freak> | or does this fail sometimes? i'd think that it's related to the halting problem |
| 19:12:30 | <edwardk> | mm_freak i think its related to the way ghc finds <<loop>> -- i.e. it only finds easy cases |
| 19:13:24 | <Cale> | hmm, I believe it happens during GC if there are no references to that MVar held by other threads. |
| 19:14:03 | <edwardk> | hence if you have a reference being held but which cannot be reached, it won't save you from yourself |
| 19:14:43 | <mm_freak> | yeah, that makes sense |
| 19:15:51 | <mm_freak> | now suppose i have a reader and a potential writer… how can i kill both safely, such that killing one doesn't throw an exception in the other? |
| 19:16:15 | <ehird> | Are there any XML libraries for Haskell that verify the validity of the generated document in the type system? OCaml has one of thos. |
| 19:16:17 | <ehird> | *those |
| 19:17:25 | <edwardk> | gah simon, simon and elliott's original paper on StableNames mention an Ord instance for StableName that seems to have vanished. =/ and it was flagged as wontfix in the trac. |
| 19:17:33 | <edwardk> | i realize why, but still its irksome |
| 19:17:59 | <edwardk> | er simon simon and conal |
| 19:21:34 | <andyjgill> | You can use the hashStableName, to get Ord, or at least an approximation of it. |
| 19:22:08 | <andyjgill> | IntMap [(StableName a,b)] works, where the Int is the result of the hashStableName. |
| 19:22:49 | <edwardk> | andyjgill: yeah thats what i've been using |
| 19:23:08 | <edwardk> | andyjgill: i understand why, since the Eq isn't really Eq since the Ints might outlive the slot |
| 19:23:31 | <edwardk> | er the equal case |
| 19:23:47 | <andyjgill> | Yes. But they work well, otherwise. |
| 19:23:56 | <wli> | type TreeHash t t' = IntMap (Map t t') where the IntMap index is a hash function of the key? |
| 19:25:22 | <edwardk> | andyjgill: i'm somewhat surprised that 'hashStableName' doesn't really distribute well across the integers though, since they are just consecutive slot #s, so if you carry around the hashes much longer than the names themselves you can accrete a lot of cruft in the same buckets. |
| 19:26:18 | <andyjgill> | It worked fine for my application, observing graphs, and turning them into explicit graphs. |
| 19:26:53 | <wli> | ACTION guesses Array Int (Map t t') might be a better idea. |
| 19:26:56 | <edwardk> | andyjgill: yeah i'm using it for detecting sharing in a set of parser combinators. it works wonderfully there |
| 19:27:57 | <edwardk> | i was just experimenting to see if i could use it, hackishly as a fast(ish) priority for a treap implementation, but the general monotonicity of hashStableName means its too biased to be used for that |
| 19:28:03 | <andyjgill> | Cool. have you a reference or a writeup? |
| 19:28:49 | <edwardk> | andyjgill: i'm still putting the library together. i'd point you to the current docs on comonad.com but my server is apparently offline at the moment. =/ i have some hpasted fragments from today though, one sec |
| 19:28:52 | <wli> | For tree hashing? It's just the usual hashing by separate chaining with balanced binary search trees for collision chains. |
| 19:30:37 | <edwardk> | andyjgill: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4794 has the gist of how i invert an applicative parser using a higher kinded zipper without sharing. |
| 19:31:46 | <andyjgill> | Looks interesting. Have you seen my data-reify library? |
| 19:32:18 | <edwardk> | andyjgill: and then i go through http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4800#a4800 to do the stable map |
| 19:32:31 | <PetRat> | Are the mailing lists down right Now? |
| 19:32:32 | <wli> | Never heard of it. |
| 19:32:32 | <edwardk> | no, have you seen my reflection library? =) |
| 19:32:36 | <edwardk> | checking =) |
| 19:33:01 | <edwardk> | oh nice |
| 19:33:26 | <andyjgill> | Looks related! There is a paper http://www.ittc.ku.edu/~andygill/paper.php?label=DSLExtract09 |
| 19:33:43 | <edwardk> | very nice |
| 19:34:15 | <pumpkin_> | is something wrong with my email or did haskell-cafe go really quiet? |
| 19:34:22 | <andyjgill> | We should compare notes (offline), and see if we can combine. I'm especially pleased with the ability to reify functions in data-reify. |
| 19:34:30 | <PetRat> | pumpkin_ that's what I'm asking too |
| 19:34:37 | <edwardk> | basically what i'm doing is inverting the parser by finding sharing of base parsers and then using a series of bottom up parsers from my monoidal lib |
| 19:34:48 | <pumpkin_> | PetRat: I'd guess that means the traffic just died down :P |
| 19:34:54 | <PetRat> | My post to haskell-beginners did not appear in 12 hours. Another post was rejected. |
| 19:35:05 | <PetRat> | Rejected with the message "disk full" |
| 19:35:09 | <pumpkin_> | PetRat: oh, you think it's the list server that's died? |
| 19:35:13 | <pumpkin_> | ah :/ |
| 19:35:28 | <andyjgill> | edwardk: Ahh. Nice. So you can get LR style parser ideas in there? |
| 19:35:33 | <PetRat> | I suspect the list server has died, yes. |
| 19:36:20 | <edwardk> | andyjgill: yeah, that and i've been looking at various ways to do parsing monoidally, so i can run LR or PEG style grammars by chunking the input and parsing chunks in parallel to recombine |
| 19:36:24 | <PetRat> | Last post I got from haskell-cafe was 17 hours ago. Considering the average traffic is several posts per hour, this is a strong symptom. |
| 19:36:31 | <edwardk> | and for that i really need the bottom up perspective on the grammar |
| 19:36:42 | <pumpkin_> | I wonder who runs it then |
| 19:37:03 | <andyjgill> | which needs observable sharing. I think I understand what you are doing. |
| 19:37:09 | <apostlion> | hai guys! |
| 19:37:18 | <apostlion> | welcome a fresh haskellero in your ranks |
| 19:37:57 | <jmcarthur> | welcome |
| 19:38:07 | <edwardk> | andyjgill: think of it as a 'two finger' version of the usual bottom up kilbury style parser. it parses reasonably efficient left to right or right to left and can merge chunks as needed |
| 19:38:23 | <apostlion> | how's it going? |
| 19:38:26 | <edwardk> | andyjgill: which puts it in the same class as all of the 'Reducers' in my monoids lib |
| 19:39:07 | <andyjgill> | I think observable sharing is about to make a comeback! I've talked to two people in two days about it. |
| 19:39:08 | <thoughtpolice> | pumpkin_: boo! |
| 19:39:26 | <jmcarthur> | observable sharing? |
| 19:39:52 | <apostlion> | A question as to best practices / overall style guidelines |
| 19:40:01 | <apostlion> | —as to latter, are there any in Haskell community? |
| 19:40:04 | <edwardk> | andyjgill: i'm half tempted to allow two forms of construction, one using observable sharing and the other using explicit 'safe' sharing through mfix in a builder monad. |
| 19:40:11 | <edwardk> | ala frisby |
| 19:40:22 | <apostlion> | I see that source mainly uses camelCase, but that's pretty much it |
| 19:40:37 | <apostlion> | say, what is more acceptable — where or let? |
| 19:40:53 | <edwardk> | apostlion: use where when you can let when you must ;) |
| 19:41:13 | <andyjgill> | I'm thinking of two compatible versions of Lava with the same pair of API's, OS, and mfix. |
| 19:41:19 | <edwardk> | apostlion: there is a style guideline doc somewhere but i can never remember where it is |
| 19:41:31 | <andyjgill> | What have you seen from frisby? |
| 19:41:37 | <pumpkin_> | oleg uses underscores for some reason |
| 19:42:02 | <apostlion> | What is worse— |
| 19:42:10 | <edwardk> | andyjgill: meacham used a little builder monad that let you define rules and mfix to use them backwards and forwards through the grammar |
| 19:42:20 | <gwern> | andyjgill: wait, how can you reify functions? doesn't that violate some rule or other? |
| 19:42:21 | <apostlion> | —having a huge routine in a where condition for a tiny algo, or an unneeded “public” function? |
| 19:42:25 | <apostlion> | *top-level |
| 19:42:59 | <edwardk> | andyjgill: all packrat-style memoized recursion had to be done through an explicit invocation of newRule and had to go through mfix |
| 19:43:04 | <edwardk> | its a bit heavy handed for me |
| 19:43:06 | <andyjgill> | gwern I make it IO, and wave a wand. |
| 19:43:23 | <edwardk> | gwern: unsafePerformScary ;) |
| 19:43:48 | <gwern> | andyjgill: how powerful is this reification? could one define some random very complex function in ghci, serialize to disk, start up another ghci and load it in? |
| 19:44:02 | <vixey> | unsafePerformOcaml |
| 19:44:06 | <andyjgill> | Ultimately, I want an observation monad. |
| 19:44:25 | <andyjgill> | No, its can only be done on specific functions, aka the ideas from Pan. |
| 19:44:40 | <edwardk> | andyjgill: what i've been looking for with mmorrow is a way for vacuum to intelligently handle ghc thunks without forcing them. |
| 19:45:04 | <gwern> | andyjgill: hm. I'm not familiar with what functions pan can handle |
| 19:45:12 | <edwardk> | so you can get a more properly indicative graph showing what uses what in memory and how things share environments |
| 19:45:29 | <pumpkin_> | edwardk: what'd be fun would be an interactive view, where clicking on a thunk would "expand" (evaluate) it :P |
| 19:45:31 | <andyjgill> | Its about reifying a (Float,Float) -> Color function. |
| 19:45:37 | <edwardk> | pumpkin_: exactly! |
| 19:45:44 | <cypher-> | what's the best way to do something like: compile some c, load the object code dynamically and execute it from haskell program? |
| 19:45:49 | <pumpkin_> | but then you get into GUI issues |
| 19:45:51 | <jmcarthur> | apostlion, that is really personal preference, but a not on your use of the word "public": you can have top-level functions without exporting them from the module, so there is not really any harm in having more than necessary |
| 19:46:00 | <jmcarthur> | *a note |
| 19:46:06 | <andyjgill> | Hmm, perhaps a thread management system, where you could limit a thread to single stepping? |
| 19:46:08 | <apostlion> | oh, that's actually nice |
| 19:46:08 | <duaneb> | dons: what was that binary i/o library you showed me? |
| 19:46:21 | <apostlion> | I'm working over Real World Haskell now, and didn't got yet to modules and stuff |
| 19:46:22 | <edwardk> | pumpkin_: thats exactly the sort of thing that ubigraph is designed to handle, dynamically updated graphs like that |
| 19:46:36 | <pumpkin_> | edwardk: oh, cool... I've never played with ubigraph |
| 19:46:38 | <apostlion> | so if you can have a top-level function that's not exported, that's really nice |
| 19:46:51 | <apostlion> | One other question — are there any Haskell code analysis tools? |
| 19:46:52 | <jmcarthur> | apostlion, module ModuleName (exportedFunction, ExportedType (ConstructorA, ConstructorB), ExportedTypeWithAllConstructors (..)) where |
| 19:46:53 | <pumpkin_> | oh wow, sounds awesome |
| 19:47:04 | <jmcarthur> | apostlion, look for hlint |
| 19:47:28 | <apostlion> | wow! |
| 19:47:33 | <apostlion> | a lint for Haskell! |
| 19:47:33 | <byorgey_> | @seen solrize |
| 19:47:34 | <lambdabot> | solrize is in #haskell. I last heard solrize speak 10h 44m 32s ago. |
| 19:47:42 | <jmcarthur> | apostlion, it's fairly new, but nice |
| 19:47:46 | <apostlion> | I knew that switching to a compiled language with less metamagic than Ruby will do wonders :) |
| 19:47:49 | <EvilTerran> | apostlion, i only tend to put things in a function's where{} clause if they need the parameters of the function to be in scope |
| 19:47:54 | <gwern> | andyjgill: interesting. so it works only on pure functions? string -> io () wouldn't work? |
| 19:47:55 | <EvilTerran> | otherwise, i tend to make them top-level |
| 19:48:23 | <jmcarthur> | my preference is typically just for the more readable, when i can help it |
| 19:48:46 | <apostlion> | Also, is Darcs kind of a scm standard in the community? |
| 19:49:04 | <jmcarthur> | apostlion, de facto, but git seems to be gaining some traction here as well |
| 19:49:05 | <edwardk> | apostlion: yeah |
| 19:49:15 | <duaneb> | HG ftw! |
| 19:49:17 | <gwern> | eh. some traction, but not a whole lot |
| 19:49:20 | <duaneb> | well, look at gitit |
| 19:49:31 | <gwern> | duaneb: which also uses darcs |
| 19:49:35 | <gwern> | ACTION bows |
| 19:49:49 | <duaneb> | dammit |
| 19:49:51 | <jmcarthur> | apostlion, darcs is very nice though, for the record, and i'm coming from a longer git background |
| 19:50:01 | <duaneb> | ehh, I hate darcs's branching |
| 19:50:08 | <jmcarthur> | i agree with that |
| 19:50:12 | <gwern> | duaneb: we call it 'darcsit' when you use gitit with a darcs backend |
| 19:50:13 | <jmcarthur> | in-place branching is much nicer |
| 19:50:25 | <jmcarthur> | darcs essentially has no "branching" per se, though |
| 19:50:37 | <jmcarthur> | it's not really a part of its model, like it is in git's |
| 19:50:47 | <gwern> | in-place branching confuses me. I don't mind cding to ../ and doing a get |
| 19:51:02 | <pumpkin_> | bbl :) |
| 19:51:11 | <duaneb> | I like mercurial's the best |
| 19:51:24 | <jmcarthur> | darcs is patch management, git is state management. very different ideas, and they can clash if you call darcs repositories "branches" |
| 19:51:43 | <duaneb> | wait, is List linked? |
| 19:51:53 | <duaneb> | i.e. is (!!) constant or linear? |
| 19:51:58 | <jmcarthur> | duaneb, linear |
| 19:52:00 | <EvilTerran> | ?src [] |
| 19:52:01 | <lambdabot> | data [] a = [] | a : [a] |
| 19:52:04 | <duaneb> | ahh |
| 19:52:19 | <EvilTerran> | ^ pseudocode, not real haskell |
| 19:52:25 | <duaneb> | dammit |
| 19:52:33 | <duaneb> | I was just getting ideas of defining new syntax :P |
| 19:52:39 | <EvilTerran> | think "data List a = Nil | a `Cons` List a" |
| 19:52:50 | <Zao> | A rather narrow tree :) |
| 19:52:54 | <duaneb> | @info List |
| 19:52:55 | <lambdabot> | List |
| 19:53:00 | <duaneb> | :/ |
| 19:53:02 | <gwern> | > [0 .. ] !! 10000000000 |
| 19:53:13 | <EvilTerran> | duaneb, @info gets spelling-corrected to @undo |
| 19:53:17 | <lambdabot> | mueval: Prelude.read: no parse |
| 19:53:26 | <EvilTerran> | @info do x <- foo; return (x,x) |
| 19:53:27 | <lambdabot> | foo >>= \ x -> return (x, x) |
| 19:53:28 | <gwern> | hm |
| 19:53:31 | <duaneb> | gwern: though, to be fair, it also has to generate those numbers first |
| 19:53:53 | <EvilTerran> | > repeat () !! 10^9 |
| 19:53:56 | <lambdabot> | No instance for (Num ()) |
| 19:53:57 | <lambdabot> | arising from a use of `^' at <interacti... |
| 19:54:06 | <EvilTerran> | > repeat () !! (10^9) -- ? |
| 19:54:11 | <lambdabot> | () |
| 19:54:12 | <leadnose> | > let x = x in length [x,x,x,x,x] |
| 19:54:13 | <lambdabot> | 5 |
| 19:54:24 | <jmcarthur> | duaneb, it will actually do that simultaneously as it traverses the list, and garbage collect behind it if nothing else holds the head of the list |
| 19:54:33 | <jmcarthur> | so it can theoretically be done in constant space |
| 19:55:08 | <duaneb> | jmcarthur: my point was, even if !! were constant, [1 .. ] !! 1000000000 would still be linear |
| 19:55:16 | <duaneb> | at least |
| 19:55:21 | <jmcarthur> | ah, yes, that is true |
| 19:55:25 | <EvilTerran> | duaneb, but (repeat () !!) would be constant |
| 19:55:36 | <gwern> | constant space, but not time? |
| 19:55:38 | <apostlion> | Meh, it's either Cabal that's lame or me that's dumb |
| 19:55:38 | <duaneb> | EvilTerran: yes, that's true. |
| 19:55:44 | <duaneb> | gwern: indeed |
| 19:55:49 | <duaneb> | assuming garbage collection |
| 19:55:50 | <apostlion> | cabal: happy version >=1.17 is required but it could not be found. |
| 19:55:50 | <apostlion> | cabal: Error: some packages failed to install: |
| 19:55:50 | <apostlion> | haskell-src-exts-0.4.8 failed during the configure step. The exception was: |
| 19:55:50 | <apostlion> | exit: ExitFailure 1 |
| 19:56:02 | <dcoutts> | apostlion: cabal install happy |
| 19:56:08 | <apostlion> | well, I just did :) |
| 19:56:14 | <apostlion> | Moreover, it even managed to install after all |
| 19:56:17 | <dcoutts> | then it's not on the $PATH |
| 19:56:24 | <gwern> | yah |
| 19:56:25 | <apostlion> | happy or cabal? |
| 19:56:28 | <dcoutts> | happy |
| 19:56:56 | <gwern> | dcoutts: maybe we could hardcode a check into cabal to look in ~/.cabal/bin and print out a message 'hey happy's there, but not in your $path; maybe you should fix this man' |
| 19:57:23 | <dcoutts> | gwern: aye, put the target bindir on the program search path |
| 19:57:31 | <apostlion> | woo, works this way! |
| 19:57:33 | <apostlion> | yay yay ya |
| 19:57:44 | <dcoutts> | gwern: unfortunately it's a bit tricky to do, given the current code structure |
| 19:57:54 | <gwern> | dcoutts: hm. that's different though; that would let users install and build with tools that they can't access |
| 19:58:02 | <gwern> | a message could help them fix the problem at the root |
| 19:58:18 | <duaneb> | cabal: cannot configure utility-ht-0.0.5. It requires QuickCheck >=1.1 && <2 |
| 19:58:22 | <dcoutts> | gwern: I don't see that's a problem |
| 19:58:22 | <duaneb> | gah |
| 19:58:45 | <gwern> | 'where's happy? you say I should have it because of yi, but yi built and I don't have happy? wtf' |
| 19:58:47 | <vixey> | happy and alex are so so horrible I wish people wouldn't use them |
| 19:59:01 | <duaneb> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4801#a4801 |
| 19:59:15 | <duaneb> | could someone resolve that dependency problem? :P |
| 19:59:28 | <dcoutts> | gwern: the time to warn is during configure or install when we notice that the proposed bindir is not on the path |
| 19:59:28 | <gwern> | vixey: I'd put more weight on that comment if I hadn't heard some haskeller or other hate on each and every feature of haskell and every thing written in haskell |
| 20:00:48 | <dcoutts> | duaneb: the package you're trying to install depends on other packages and they depend on different versions of QC |
| 20:01:14 | <duaneb> | dcoutts: yes, I see that |
| 20:01:17 | <duaneb> | but how do I friggin fix it?! |
| 20:01:22 | <dcoutts> | duaneb: that or you're installing several things in one go |
| 20:01:30 | <duaneb> | `cabal install yi` |
| 20:01:36 | <dcoutts> | ah |
| 20:01:41 | <gwern> | (call in st. dogbert to expel the minions of phil, prince of insufficient light?) |
| 20:02:09 | <mm_freak> | how does hGetLine decide, where a line ends? |
| 20:02:22 | <dcoutts> | duaneb: look for the package that requires <2, it'll probably be listed earlier in that -v output log |
| 20:03:02 | <dcoutts> | duaneb: or ask the yi devs, someone must be able to install it |
| 20:05:18 | <vegai> | whoa |
| 20:05:18 | <gwern> | or first, get from darcs, try, and then ask us |
| 20:05:26 | <gwern> | vegai: it's full of stars! |
| 20:05:31 | <vegai> | :) |
| 20:05:41 | <vegai> | I was just amazed about haskeline in ghci-6.10.3 |
| 20:06:05 | <vegai> | everything is instantenous |
| 20:06:47 | <vegai> | yes, I'm impressed easily sometimes. |
| 20:07:30 | <Gracenotes> | :;o |
| 20:07:42 | <Gracenotes> | . . . . . . > > >> > > >>>>>>:3 |
| 20:12:15 | <mreh> | > [ x | x <- [1..2], y <- [1..5]] |
| 20:12:16 | <lambdabot> | [1,1,1,1,1,2,2,2,2,2] |
| 20:13:16 | <mm_freak> | hmm… i'm in a StateT s IO monad and i'd like to catch an exception there… is this somehow possible? |
| 20:13:24 | <mm_freak> | reason is: if i catch it in IO, i lose the state |
| 20:14:26 | <jmcarthur> | liftIO? |
| 20:15:04 | <mm_freak> | jmcarthur: a liftIO'ed computation can't modify the state |
| 20:15:16 | <mreh> | how come computer science doesn't have it's own radical branch of intellectuals who think all things can be explained by turing machines? |
| 20:15:19 | <vixey> | @unmtl StateT s IO |
| 20:15:19 | <lambdabot> | err: `StateT s IO' is not applied to enough arguments, giving `/\A. s -> IO (A, s)' |
| 20:15:25 | <mm_freak> | i thought of ContT, but i'm sure that there is a better method |
| 20:15:28 | <vixey> | mreh lol |
| 20:15:32 | <jmcarthur> | but couldn't you just use liftIO to get the value into your StateT? |
| 20:15:43 | <vixey> | @unmtl StateT s IO a |
| 20:15:43 | <lambdabot> | s -> IO (a, s) |
| 20:15:57 | <mm_freak> | mreh: because everything can be explained as a lambda expression |
| 20:16:13 | <mreh> | you haven't read the church turing thesis |
| 20:16:14 | <vixey> | mm_freak: why not write the catch thing in terms of that |
| 20:16:30 | <Botje> | hmm |
| 20:16:34 | <mm_freak> | vixey: is it 'okay' to touch the internals of StateT? |
| 20:16:39 | <vixey> | I'm ok with it :) |
| 20:16:48 | <mreh> | ACTION is a turing machine |
| 20:17:16 | <mm_freak> | in other words: am i going fine with standards when i use StateT constructors? |
| 20:17:23 | <Botje> | i'm looking for the source on a quote re garbage collection : "lisp hackers hacked all day and went home when the garbage collector kicked in, because it usually ran all night" |
| 20:17:36 | <vixey> | It's GHC stds and expect your code to break every 4 months |
| 20:18:24 | <mm_freak> | hmm, ok |
| 20:19:40 | <gwern> | mreh: I think CS needs a branch of intellectuals that thinks computers are powered by imprisoned devils |
| 20:19:54 | <gwern> | so we have an ethical obligation to make as many and as fast computers as we can |
| 20:19:58 | <vixey> | gwern that does explain a lot ... |
| 20:20:12 | <vixey> | like why nothing bloody works |
| 20:20:19 | <koala_man> | suddenly it all makes sense |
| 20:20:33 | <gwern> | they spite us |
| 20:22:35 | <Gracenotes> | ;_; |
| 20:23:26 | <Gracenotes> | > "hello there" >> "?" |
| 20:23:27 | <lambdabot> | "???????????" |
| 20:23:31 | <edwardk> | ok, the treap fails to be useful, stablename is too simple of a hashing function |
| 20:23:45 | <ehird> | Are there any XML libraries for Haskell that verify the validity of the generated document in the type system? OCaml has one of those. |
| 20:24:06 | <jmcarthur> | :t (*>) |
| 20:24:08 | <lambdabot> | forall (f :: * -> *) a b. (Applicative f) => f a -> f b -> f b |
| 20:24:22 | <jmcarthur> | > "hello there" *> "?" |
| 20:24:23 | <lambdabot> | "???????????" |
| 20:24:37 | <vixey> | > "hello there" >>= const "?" |
| 20:24:38 | <lambdabot> | "???????????" |
| 20:24:47 | <vixey> | oh we already had that.. |
| 20:24:56 | <benny99> | gwern, also explains the freebsd logo |
| 20:25:05 | <gwern> | they're the only honest ones |
| 20:26:24 | <benny99> | ACTION better shuts his machine down |
| 20:26:38 | <pjolk> | @type splitAt |
| 20:26:39 | <lambdabot> | forall a. Int -> [a] -> ([a], [a]) |
| 20:26:44 | <Gracenotes> | also, if we define an instance Num (a -> Char), we can have map (ord '?') "hello there" |
| 20:27:02 | <edwardk> | @tell andyjgill you may also want to look at lennart's Debug.Traced writeup from his blog a while back its very similar to your Exp type |
| 20:27:02 | <lambdabot> | Consider it noted. |
| 20:27:10 | <Gracenotes> | er. hmm. no, it'd have to be the literal (ord '?') |
| 20:27:27 | <pk> | can >>= be implemented from >> ? |
| 20:27:30 | <pjolk> | @type (>>=) |
| 20:27:31 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => m a -> (a -> m b) -> m b |
| 20:27:37 | <opqdonut> | pk: no |
| 20:27:38 | <pjolk> | @type (=<<) |
| 20:27:39 | <lambdabot> | forall a (m :: * -> *) b. (Monad m) => (a -> m b) -> m a -> m b |
| 20:28:04 | <pjolk> | > Just 5 -> \r $ return r + 6 |
| 20:28:05 | <lambdabot> | <no location info>: parse error on input `->' |
| 20:28:10 | <JamesR> | Arg |
| 20:28:16 | <JamesR> | This language really is the bane of my degree |
| 20:28:23 | <pjolk> | > Just 5 >>= \r $ return r + 6 |
| 20:28:24 | <lambdabot> | <no location info>: parse error on input `$' |
| 20:28:27 | <pjolk> | bane? |
| 20:28:29 | <ehird> | JamesR: We do not apologize whatsoever. :-) |
| 20:28:32 | <pk> | opqdnut: Even if we use applicative functors operations ? |
| 20:28:35 | <JamesR> | :> |
| 20:28:46 | <beelsebob> | pjolk: (+6) <$> (Just 5) -- this? |
| 20:28:50 | <pjolk> | > Just 5 >>= \r -> return $ r + 6 |
| 20:28:51 | <opqdonut> | pk: yes, even then |
| 20:28:52 | <lambdabot> | Just 11 |
| 20:29:01 | <agib> | does aynone have any recommendations for interacting with mysql on os x? |
| 20:29:02 | <beelsebob> | > (+6) <$> (Just 5) |
| 20:29:04 | <lambdabot> | Just 11 |
| 20:29:11 | <jmcarthur> | :t ($>) |
| 20:29:12 | <Gracenotes> | hm..................................... |
| 20:29:13 | <lambdabot> | Not in scope: `$>' |
| 20:29:17 | <jmcarthur> | :t (<$) |
| 20:29:18 | <lambdabot> | forall a (f :: * -> *) b. (Functor f) => a -> f b -> f a |
| 20:29:28 | <jmcarthur> | > '?' <$ "hello there" |
| 20:29:30 | <lambdabot> | "???????????" |
| 20:29:30 | <pjolk> | > (<$>) (6+) Nothing |
| 20:29:31 | <lambdabot> | Nothing |
| 20:29:37 | <pjolk> | > (<$>) (6+) (Just 2) |
| 20:29:38 | <lambdabot> | Just 8 |
| 20:29:41 | <beelsebob> | pjolk: aka fmap |
| 20:30:05 | <opqdonut> | pk: >> is the same as Applicative's *> |
| 20:30:11 | <monadic_kid> | > (+) <$> Just 6 <*> Just 2 |
| 20:30:12 | <pjolk> | > fmap (+6) (Just 5) |
| 20:30:13 | <lambdabot> | Just 8 |
| 20:30:13 | <lambdabot> | Just 11 |
| 20:30:27 | <pk> | @src *> |
| 20:30:27 | <lambdabot> | (*>) = liftA2 (const id) |
| 20:30:30 | <pjolk> | > (Just 7) `fmap` (+6) `fmap`(Just 5) |
| 20:30:31 | <lambdabot> | Couldn't match expected type `a -> b' |
| 20:30:37 | <pjolk> | > (Just 7) `fmap` (+6) `fmap`(Just 5) |
| 20:30:38 | <lambdabot> | Couldn't match expected type `a -> b' |
| 20:30:41 | <beelsebob> | pjolk: you need to use <*> for that |
| 20:30:45 | <monadic_kid> | > (+) <$> Just 6 <*> Just 2 |
| 20:30:46 | <lambdabot> | Just 8 |
| 20:30:57 | <pjolk> | > (Just 7) `fmap` (+6) `fmap` (Just 5) |
| 20:30:58 | <lambdabot> | Couldn't match expected type `a -> b' |
| 20:31:01 | <beelsebob> | (Just (+)) <*> (Just 2) <*> (Just 6) |
| 20:31:07 | <beelsebob> | > (Just (+)) <*> (Just 2) <*> (Just 6) |
| 20:31:08 | <lambdabot> | Just 8 |
| 20:31:16 | <pk> | opqdonut: thx |
| 20:31:21 | <pjolk> | > fmap (7+) (fmap (6+) (Just 5)) |
| 20:31:23 | <lambdabot> | Just 18 |
| 20:31:41 | <JamesR> | Ahhh, that's why I'm having so many issues! I forgot to enable replace tab w/ spaces in Notepad++ ;p |
| 20:31:47 | <jmcarthur> | > (+) <$> pure 2 <*> pure 6 :: Maybe Int |
| 20:31:48 | <lambdabot> | Ambiguous occurrence `pure' |
| 20:31:48 | <lambdabot> | It could refer to either `Control.Appl... |
| 20:32:03 | <jmcarthur> | > (+) <$> Just 2 <*> Just 6 |
| 20:32:04 | <lambdabot> | Just 8 |
| 20:32:10 | <monadic_kid> | > (\x y z ->x + y + z) <$> Just 6 <*> Just 2 <*> Just 6 |
| 20:32:11 | <lambdabot> | Just 14 |
| 20:32:29 | <monadic_kid> | > (\x y z w ->x + y + z + w) <$> Just 6 <*> Just 2 <*> Just 6 <*> Just 12 |
| 20:32:31 | <lambdabot> | Just 26 |
| 20:32:50 | <vixey> | > liftM sum [ Just 6, Just 2, Just 6 ] |
| 20:32:51 | <lambdabot> | Couldn't match expected type `[a]' against inferred type `Maybe t' |
| 20:33:00 | <vixey> | > sum <*> [ Just 6, Just 2, Just 6 ] |
| 20:33:01 | <lambdabot> | Couldn't match expected type `[a -> b] -> a' |
| 20:33:10 | <vixey> | > sum . sequence $ [ Just 6, Just 2, Just 6 ] |
| 20:33:11 | <lambdabot> | Couldn't match expected type `[]' against inferred type `Maybe' |
| 20:33:16 | <vixey> | > fmp sum . sequence $ [ Just 6, Just 2, Just 6 ] |
| 20:33:17 | <lambdabot> | Not in scope: `fmp' |
| 20:33:53 | <jmcarthur> | sum <$> sequence [Just 6, Just 2, Just 6] |
| 20:33:59 | <jmcarthur> | > sum <$> sequence [Just 6, Just 2, Just 6] |
| 20:34:00 | <lambdabot> | Just 14 |
| 20:34:14 | <jmcarthur> | ACTION feels kind of bad for stealing all of vixey's work there ;) |
| 20:34:32 | <JamesR> | ACTION wishes he hadn't left this till the last minute |
| 20:34:42 | <pjolk> | > map (1+) [1..10] |
| 20:34:46 | <pjolk> | > map (+1) [1..10] |
| 20:34:55 | <beelsebob> | @botsnack |
| 20:34:55 | <lambdabot> | :) |
| 20:34:55 | <lunabot> | :) |
| 20:34:58 | <beelsebob> | odd |
| 20:35:00 | <jmcarthur> | pjb3, no spaces before > |
| 20:35:06 | <pjolk> | > map (+1) [1..10] |
| 20:35:07 | <jmcarthur> | err, pjolk ^^ |
| 20:35:07 | <lambdabot> | [2,3,4,5,6,7,8,9,10,11] |
| 20:35:11 | <apostlion> | Oh, and btw |
| 20:35:11 | <pjolk> | > map (11) [1..10] |
| 20:35:12 | <lambdabot> | No instance for (Num (a -> b)) |
| 20:35:12 | <lambdabot> | arising from the literal `11' at ... |
| 20:35:16 | <pjolk> | > map (1+) [1..10] |
| 20:35:17 | <lambdabot> | [2,3,4,5,6,7,8,9,10,11] |
| 20:35:25 | <apostlion> | Do non-lame Haskell IDEs exist? |
| 20:35:33 | <apostlion> | Or, is it all vim, emacs and TextMate? |
| 20:35:41 | <beelsebob> | apostlion: depends on your definition of lame |
| 20:35:41 | <vixey> | apostlion: still not sure what IDE means |
| 20:35:47 | <jmcarthur> | apostlion, there is one in development called leksah |
| 20:35:48 | <beelsebob> | but given TextMate in that list, I'd say no |
| 20:35:56 | <pjolk> | apostlion: leksah |
| 20:35:59 | <beelsebob> | leksah is lame... if you're an a mac |
| 20:36:05 | <jmcarthur> | apostlion, we mostly just use text editors and shells, though, i think |
| 20:36:06 | <beelsebob> | :( |
| 20:36:09 | <pjolk> | but i dont think it is ready yet |
| 20:36:16 | <monadic_kid> | apostlion: Leksah (haven't tried it), Eclipse with EclipseFP plugin |
| 20:36:20 | <cypher-> | apostlion: there's a plugin for vs2005 |
| 20:36:22 | <apostlion> | well, static nature would yield nicely for an IDE |
| 20:36:25 | <jmcarthur> | beelsebob, leksah is pretty lame regardless, so far, in my opinion. getting better though |
| 20:36:30 | <cypher-> | apostlion: but sadly does not work with vs2008 AFAIK |
| 20:36:30 | <apostlion> | but TextMate is niceish for me yet |
| 20:36:36 | <beelsebob> | apostlion: I use SEE |
| 20:36:40 | <cypher-> | also there used to be a plugin for XCode |
| 20:36:43 | <apostlion> | SEE? |
| 20:36:44 | <beelsebob> | it's haskell mode is much better than TM's |
| 20:36:44 | <jmcarthur> | there was a haskell plugin for xcode at some point, don't know what its status is |
| 20:36:48 | <beelsebob> | SubEthaEdit apostlion |
| 20:36:49 | <cypher-> | and TextMate is very good |
| 20:36:52 | <pjolk> | Eclipse is a perfect example of Java software. Bloated,slow,memoryhog |
| 20:36:57 | <apostlion> | oh yes |
| 20:37:03 | <apostlion> | SEE is nice |
| 20:37:07 | <cypher-> | ACTION wishes someone fixed xcode plugin |
| 20:37:08 | <apostlion> | And Eclipse is an abomination |
| 20:37:18 | <cypher-> | SEE? |
| 20:37:18 | <jmcarthur> | i think the haskell-mode for emacs is the nicest haskell mode of any text editor, personally |
| 20:37:23 | <jmcarthur> | if only for the smart tabs |
| 20:37:25 | <opqdonut> | same here |
| 20:37:25 | <beelsebob> | apostlion: try it for Haskell then, it's Haskell mode is *much* better than TextMate's |
| 20:37:35 | <apostlion> | I will |
| 20:37:37 | <beelsebob> | cypher-: SubEthaEdit |
| 20:37:40 | <p_l> | ACTION uses NetBeans (and lately ViM) for java. quite nice, Emacs still pwns :P |
| 20:37:46 | <cypher-> | jmcarthur: maybe that's true, but emacs is an abomination ;-) |
| 20:37:59 | <skorpan> | ViM? |
| 20:38:12 | <apostlion> | Emacs have broken me once, but after being brainswitched by Haskell, I think I'll be able to manage |
| 20:38:15 | <jmcarthur> | cypher-, emacs is a bloated piece of crap with a few awesome modes, which are enough to sway me into using it as my main editor |
| 20:38:19 | <jmcarthur> | for coding, anyway |
| 20:38:31 | <monadic_kid> | gedit has sexy monospace fonts and haskell highlighting |
| 20:38:31 | <pjolk> | it is great |
| 20:38:47 | <cypher-> | SEE looks weird |
| 20:38:50 | <vixey> | jmcarthur: emacs is a bloated piece of crap -- btw does it's being 'bloated' ever cause a problem for you? |
| 20:39:01 | <cypher-> | collaborative text editing hmm.. |
| 20:39:17 | <jmcarthur> | vixey, never, and that's why i only bother to acknowledge it, because otherwise people will assume that i am somehow fooling myself |
| 20:39:19 | <beelsebob> | cypher-: it's an excellent Text Editor just on it's own |
| 20:39:27 | <beelsebob> | and the collaborative thing makes it... complete win |
| 20:39:29 | <cypher-> | beelsebob: better than textmate? |
| 20:39:32 | <beelsebob> | yes, and no |
| 20:39:34 | <pjolk> | in emacs you can runa repl |
| 20:39:36 | <beelsebob> | depends on the language |
| 20:39:40 | <beelsebob> | for Haskell, yes, easily |
| 20:39:46 | <vixey> | jmcarthur: I think some programs are huge and it doesn't matter, but other programs are huge and it just makes them useless |
| 20:39:53 | <jmcarthur> | vixey, agreed |
| 20:39:57 | <araujo> | http://www.haskell.org/~luisfaraujo/compota.png |
| 20:39:58 | <araujo> | :P |
| 20:40:00 | <vixey> | hard to say what reasons are -- it just kind of happens |
| 20:40:02 | <cypher-> | beelsebob: I like textmate because it's one of the most universal editors I've seen |
| 20:40:10 | <cypher-> | except vim, which I use most of the time |
| 20:40:11 | <jmcarthur> | i don't think emacs is among the ones that are crippled due to sheer bloat |
| 20:40:12 | <beelsebob> | cypher-: yep, SEE has more modes than TM |
| 20:40:20 | <beelsebob> | but TM has the killer tab-completion feature |
| 20:40:24 | <vixey> | araujo but you didn't write HTML rendering yourself? |
| 20:40:29 | <beelsebob> | I did talk with the TM devs about trying to write a Haskell mode for it |
| 20:40:30 | <jmcarthur> | emacs has other warts (hence the "piece of crap" remark), but the size is not the reason |
| 20:40:41 | <beelsebob> | but it's text system just doesn't support Haskell's layout rules in any sane way |
| 20:40:48 | <araujo> | vixey, right, it is just a front-end for gecko |
| 20:40:56 | <apostlion> | well |
| 20:41:00 | <apostlion> | TM -has- a Haskell mode |
| 20:41:04 | <cypher-> | O_o that looks nice |
| 20:41:04 | <apostlion> | it's in the repository |
| 20:41:07 | <apostlion> | I'm using it |
| 20:41:09 | <beelsebob> | apostlion: yeh, but it's not good |
| 20:41:10 | <apostlion> | Smart tabs |
| 20:41:13 | <apostlion> | highlighting |
| 20:41:14 | <apostlion> | yeah |
| 20:41:19 | <apostlion> | compared to, say, Ruby, it's lame |
| 20:41:23 | <beelsebob> | the smart tabs fail |
| 20:41:23 | <jmcarthur> | TM's haskell mode is pretty much just highlighting |
| 20:41:26 | <apostlion> | but better than nothing, obviously |
| 20:41:28 | <beelsebob> | because they get indentation wrong |
| 20:41:39 | <beelsebob> | they actually generate invalid Haskell most of the time |
| 20:42:03 | <beelsebob> | admitedly though ... SEE just doesn't have that feature |
| 20:42:05 | <apostlion> | well, I manually indent even Ruby code, so don't really stumble over it |
| 20:42:09 | <beelsebob> | but the highlighting is better |
| 20:42:10 | <apostlion> | but… still :) |
| 20:42:24 | <brian6> | did you just put some crazy ... character in my irc? |
| 20:42:32 | <beelsebob> | – ? |
| 20:42:37 | <jmcarthur> | brian6, an ellipsis? |
| 20:42:45 | <apostlion> | Yeah |
| 20:42:46 | <apostlion> | … |
| 20:42:48 | <apostlion> | ellipsis |
| 20:42:48 | <cypher-> | beelsebob: I'll check it out at some point |
| 20:42:49 | <apostlion> | “ |
| 20:42:52 | <apostlion> | Opening quote |
| 20:42:53 | <beelsebob> | oh... *wonders if OS X converted . . . into an ellipsis* |
| 20:42:53 | <jmcarthur> | on macs, option-; |
| 20:42:53 | <apostlion> | ” |
| 20:42:56 | <apostlion> | closing quote |
| 20:42:57 | <apostlion> | — |
| 20:42:58 | <brian6> | more like bloody lipses. |
| 20:43:00 | <apostlion> | proper dash |
| 20:43:01 | <JamesR> | Arg, I don't even know where to start ¬¬ |
| 20:43:10 | <beelsebob> | æ≤≥π¥ƒ©ç®¬÷≠+ here? |
| 20:43:12 | <apostlion> | I love my typography to be proper, y'know |
| 20:43:16 | <jmcarthur> | one of the things i miss from os x having switched mostly to linux |
| 20:43:21 | <apostlion> | œ∑´®†¥ˆøπ“‘ |
| 20:43:37 | <beelsebob> | jmcarthur: interesting... how come? |
| 20:44:05 | <jmcarthur> | beelsebob, linux has just been far more friendly to my usual tasks, is all |
| 20:44:15 | <cads> | have you guys seen http://math.andrej.com/2008/11/21/a-haskell-monad-for-infinite-search-in-finite-time/ ? |
| 20:44:15 | <beelsebob> | which tasks? |
| 20:44:19 | <mm_freak> | hmm… i type unicode stuff all the time… |
| 20:44:20 | <beelsebob> | (just asking) |
| 20:44:51 | <jmcarthur> | programming of all forms |
| 20:44:58 | <apostlion> | holy shit, I switched from Linux to Mac and never ever looked back |
| 20:45:08 | <apostlion> | Reverse converting sends shivers down my spine |
| 20:45:10 | <jmcarthur> | i use mac for my photography mainly |
| 20:45:13 | <apostlion> | body's aching all the time |
| 20:45:20 | <apostlion> | sorry, drifting off in random lyrics |
| 20:45:20 | <beelsebob> | apostlion: ditto |
| 20:45:29 | <beelsebob> | programming of all forms is actually what I found OS X great for |
| 20:45:32 | <beelsebob> | way way way better than linux |
| 20:45:44 | <duaneb> | Nothing really matters... |
| 20:45:51 | <mm_freak> | however… what's the preferred way to parse Word8-based ByteStrings? how is the performance of just extracting a [Word8] and passing it to a GenParser Word8? |
| 20:46:11 | <jmcarthur> | i found that on os x i kept switching to tools that were ported over from linux, gradually finding myself trying to turn my os x box into a linux box anyway, so i just went ahead and switched |
| 20:46:12 | <beelsebob> | mm_freak: that'll be *slow* |
| 20:46:14 | <cypher-> | ACTION really likes os x |
| 20:46:18 | <jmcarthur> | been far easier from that point on |
| 20:46:31 | <mm_freak> | beelsebob: alternatives? |
| 20:46:31 | <duaneb> | I love osx, however, the cocoa bindings (i.e. HOC) are awkward |
| 20:46:36 | <cypher-> | I used lots of stuff so far, from various flavours of linux to z/os at times and os x kicks ass ;-) |
| 20:46:43 | <beelsebob> | mm_freak: Data.Binary and manual parsing :( |
| 20:46:52 | <mm_freak> | hmm, ok |
| 20:46:52 | <beelsebob> | mm_freak: lists are slow... parsec is *really* slow |
| 20:46:52 | <cypher-> | +prefix portage fills some gaps |
| 20:47:01 | <apostlion> | well, what are the tools ported from -linux-? |
| 20:47:06 | <ehird> | Are there any XML libraries for Haskell that verify the validity of the generated document in the type system? OCaml has one of those. I suppose not |
| 20:47:07 | <apostlion> | There is a lot of *nix stuff |
| 20:47:13 | <apostlion> | well, OS X -is- a *nix machine |
| 20:47:18 | <apostlion> | with a weird GUI |
| 20:47:22 | <monochrom> | I build a shell (a layer of abstraction) in my mind so that all you Windows, Linux, Mac make no difference to my core mind. |
| 20:47:36 | <jeffersonheard> | so... I just did a cabal install and a cabal install --global, and then runhaskell Setup.lhs configure still fails saying that dependencies are missing |
| 20:47:39 | <jeffersonheard> | anybody know why? |
| 20:47:40 | <cypher-> | monochrom: that's only partially possible |
| 20:47:54 | <cypher-> | monochrom: some of the tools that I'm used to are a pain to use in windows |
| 20:48:00 | <dcoutts> | jeffersonheard: use cabal instead of runhaskell Setup.lhs |
| 20:48:03 | <jmcarthur> | i found myself using tons and tons of command line tools, plus aquamacs, and that was about it. i rarely used anything specific to os x. plus i was sick of aqua since i had already tasted tiling window managers, and i wanted to use something like xmonad |
| 20:48:11 | <cypher-> | well.. at the end of the day os does not matter, but surely some are more comfortable than others |
| 20:48:12 | <dcoutts> | jeffersonheard: or if you must use runhaskell Setup.lhs then you need configure --user |
| 20:48:12 | <jeffersonheard> | dcoutts, I would, but this is leksah |
| 20:48:14 | <jeffersonheard> | not me |
| 20:48:39 | <dcoutts> | jeffersonheard: ok, then it has to use configure --user |
| 20:48:43 | <apostlion> | guys |
| 20:48:51 | <apostlion> | I want to do a specific substraction |
| 20:48:56 | <duaneb> | what's the best way to have a mutable array?/ |
| 20:48:57 | <apostlion> | Want to do an infix operator |
| 20:48:59 | <duaneb> | that is, with constant access |
| 20:49:06 | <apostlion> | what are the characters I can safely use? |
| 20:49:10 | <jmcarthur> | i would make a full switch if linux had some decent photo editing software, RAW workflow, etc., but that not being the case i have kept my imac around for aperture and photoshop |
| 20:49:12 | <___> | > (subtract 2) 5 |
| 20:49:14 | <lambdabot> | 3 |
| 20:49:15 | <dcoutts> | duaneb: see the MArray instances |
| 20:49:20 | <jmcarthur> | plus i do like using cocoa sometimes |
| 20:49:28 | <apostlion> | wanted to do `&-`, but since TextMate highlighted it weirdly, I somehow doubt it's a good idea |
| 20:49:49 | <jmcarthur> | i think &- should be fine. textmate is just freaking out |
| 20:49:56 | <duaneb> | ok, I guess: MArray vs STArray? |
| 20:50:03 | <dcoutts> | apostlion: textmate probably doesn't grok Haskell operator lexical syntax |
| 20:50:06 | <duaneb> | err, IO vs State |
| 20:50:07 | <jmcarthur> | > let a &- b = a - b in 5 &- 3 |
| 20:50:08 | <lambdabot> | 2 |
| 20:50:14 | <monochrom> | Yes of course, there are "abstraction leaks" in my mind shell, too. |
| 20:50:17 | <duaneb> | IOArray vs STArray |
| 20:50:26 | <apostlion> | dcoutts: woo cool! |
| 20:50:34 | <dcoutts> | duaneb: right, ST(U)Array and IO(U)Array are instances of the MArray class |
| 20:51:01 | <___> | > let x @^#$#& y = x - y in 5 @^#$#& 3 |
| 20:51:02 | <lambdabot> | 2 |
| 20:51:16 | <jmcarthur> | that coming from somebody whose nick is ___ |
| 20:51:24 | <___> | :) |
| 20:51:46 | <burp_> | .oO( perl ) |
| 20:52:17 | <burp_> | perl emulation ;) |
| 20:52:35 | <apostlion> | Once Larry Wall fell asleep on a keyboard |
| 20:52:48 | <jmcarthur> | > let (~!@#$%^&*) = (+) in 10 ~!@#$%^&* 5 |
| 20:52:49 | <lambdabot> | 15 |
| 20:52:51 | <apostlion> | Woken up, he realized that random characters in his editor are not just random characters |
| 20:53:00 | <___> | gotta love a language that lets you define names that look like swearwords. |
| 20:53:12 | <apostlion> | but a sample in a programming language God has planned his prophet Larry to design |
| 20:53:26 | <burp_> | > let (|========|:::::::>) = (+) in 10 |========|:::::::> 5 |
| 20:53:27 | <lambdabot> | 15 |
| 20:53:33 | <burp_> | anyone can make a better sword? ;) |
| 20:53:34 | <opqdonut> | > let (***) = const 1 in f*** |
| 20:53:35 | <lambdabot> | <no location info>: parse error on input `;' |
| 20:53:49 | <opqdonut> | > let (***) = const 1 in (f***) |
| 20:53:50 | <jmcarthur> | > let f'ck = ("hello " ++) in f'ck "you" |
| 20:53:50 | <lambdabot> | Add a type signature |
| 20:53:51 | <lambdabot> | "hello you" |
| 20:54:33 | <apostlion> | > let (=====) = (++) in "8"====="D" |
| 20:54:34 | <lambdabot> | "8D" |
| 20:54:43 | <duaneb> | HAH |
| 20:54:46 | <apostlion> | anyone can make a better penis? |
| 20:54:49 | <___> | > cycle "lo" |
| 20:54:49 | <duaneb> | that one was great |
| 20:54:50 | <lambdabot> | "lololololololololololololololololololololololololololololololololololololo... |
| 20:55:04 | <apostlion> | > cycle "ckfu" |
| 20:55:05 | <lambdabot> | "ckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuck... |
| 20:55:10 | <jmcarthur> | > let (===========) = (++) in "8"==========="D" -- better penis |
| 20:55:12 | <lambdabot> | "8D" |
| 20:55:14 | <vixey> | lol |
| 20:55:18 | <vixey> | kids |
| 20:55:36 | <vixey> | (this is my one chance to pretend im not immature) |
| 20:55:44 | <duaneb> | heh |
| 20:56:16 | <duaneb> | > show $ "." ++ (cycle "142857") |
| 20:56:17 | <lambdabot> | "\".14285714285714285714285714285714285714285714285714285714285714285714285... |
| 20:56:21 | <Botje> | ack! invasion of the penii! |
| 20:56:26 | <duaneb> | heh |
| 20:56:56 | <duaneb> | Actually, the appropriate plural would be "penes" |
| 20:57:09 | <copumpkin> | omg a latin scholar |
| 20:57:11 | <JamesR> | The night before a deadline == Worst possible time to forget how to work something :D |
| 20:57:16 | <copumpkin> | 3rd declension penis! |
| 20:57:18 | <apostlion> | Lolcats attack! |
| 20:57:34 | <apostlion> | > show $"OM " ++ cycle " NOM" |
| 20:57:34 | <duaneb> | wait a second |
| 20:57:35 | <lambdabot> | "\"OM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM ... |
| 20:57:37 | <duaneb> | ACTION whips out his latin dictionary |
| 20:57:43 | <jmcarthur> | > '8':repeat '='++"D" -- best possible penis |
| 20:57:44 | <lambdabot> | "8=========================================================================... |
| 20:57:49 | <copumpkin> | duaneb: you're right, it is |
| 20:58:12 | <duaneb> | penises |
| 20:58:15 | <duaneb> | there you go |
| 20:58:20 | <duaneb> | vaginae, however, is correct |
| 20:58:22 | <Apocalisp> | > cycle "OM N" |
| 20:58:23 | <lambdabot> | "OM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM... |
| 20:58:47 | <glguy> | ok ok, we get it, you know how to use lambdabot |
| 20:59:21 | <duaneb> | copumpkin: yes, it is penes |
| 20:59:21 | <duaneb> | :D |
| 20:59:28 | <copumpkin> | yup, I wasn't denying it :) |
| 20:59:31 | <duaneb> | I feel like my latin education is actually worth something now |
| 20:59:36 | <apostlion> | #happs is kinda dead |
| 20:59:41 | <duaneb> | all for this one moment.... |
| 20:59:48 | <duaneb> | anyone use turbadino? |
| 20:59:52 | <jmcarthur> | apostlion, depends on the time |
| 20:59:55 | <apostlion> | we need some Danish dork to build some lame PM tool in happstack for it to kick off |
| 20:59:57 | <jmcarthur> | sometimes quite active |
| 21:00:10 | <Apocalisp> | What's the plural of equus? |
| 21:00:21 | <monochrom> | equi |
| 21:00:22 | <apostlion> | eqii? |
| 21:00:26 | <apostlion> | *equii? |
| 21:00:57 | <duaneb> | equi or equūs |
| 21:01:00 | <duaneb> | depending on the declension |
| 21:01:06 | <Adamant> | horses? |
| 21:01:24 | <apostlion> | but you know what's the plural of clitoris? |
| 21:01:28 | <monochrom> | singular/plural is such a scam. |
| 21:02:18 | <skorpan> | apostlion: clitoris? |
| 21:02:27 | <apostlion> | skorpan: clitorides! |
| 21:02:42 | <skorpan> | no way |
| 21:02:47 | <medfly> | clitorises |
| 21:02:52 | <copumpkin> | yeah, clitorides |
| 21:02:56 | <vixey> | Haskell is a terse, elegant lambda calculus that has proper tail recursion, has call/cc with a monad (which lets you look at the mathematical workings), has raw data and polymorphism and pattern matching which lisp hasn't. It scales up to heavy mathematical concepts and down to something like a dynamic language. It's great for studying concurrency. It has a clear path to proof tools like Coq. About the only Schemish thing it lacks is macros. |
| 21:03:17 | <vixey> | So buy now, and I'll throw this best-of-1980s love songs for free! |
| 21:03:17 | <skorpan> | does anyone have a source on that statement? |
| 21:03:19 | <skorpan> | [source needed] |
| 21:03:55 | <vixey> | Haskell can clean off permanent marker stains before you eyes, it's not magic its science! |
| 21:03:58 | <mreh> | This article makes reference to no sources |
| 21:03:58 | <apostlion> | mine or vixey's? |
| 21:04:03 | <apostlion> | :D |
| 21:04:11 | <skorpan> | apostlion: yours |
| 21:04:18 | <mreh> | New Haskell, BANG! And the dirt is gone. |
| 21:04:30 | <apostlion> | http://en.wiktionary.org/wiki/clitorides |
| 21:04:37 | <apostlion> | skorpan: will this do? |
| 21:04:40 | <skorpan> | apostlion: any *real* source? |
| 21:04:41 | <monadic_kid> | mreh: ! <-- is the cilit bang operator |
| 21:04:42 | <skorpan> | :) |
| 21:04:43 | <beelsebob> | yes, but it's rather strict on how you use it mreh |
| 21:04:44 | <___> | If you thought that was cool, you're gonna love my nuts. |
| 21:04:55 | <skorpan> | i only trust wikipedia if the article states *real* sources :) |
| 21:05:01 | <medfly> | http://en.wiktionary.org/wiki/clitorises |
| 21:05:04 | <medfly> | it's more obvious :) |
| 21:05:24 | <apostlion> | I've seen it somewhere |
| 21:05:27 | <apostlion> | Let me fetch it |
| 21:06:07 | <skorpan> | i tried dictionary.com but couldn't find it |
| 21:06:08 | <apostlion> | http://www.yaelf.com/aueFAQ/mifplrlsltngrkwrds.shtml |
| 21:06:31 | <skorpan> | apostlion: so you're saying penes is the correct pluralization of penis? |
| 21:06:37 | <apostlion> | in Latin, yes |
| 21:06:40 | <apostlion> | in English, it's penises |
| 21:06:48 | <monochrom> | pene alfredo |
| 21:06:57 | <skorpan> | so what's the plural of clitoris in *english*? |
| 21:07:10 | <medfly> | clitorises or clitorides |
| 21:07:18 | <copumpkin> | I'd definitely go with clitorides |
| 21:07:20 | <copumpkin> | ;) |
| 21:07:29 | <monochrom> | sodium hypochloride |
| 21:07:33 | <skorpan> | i go for "pussy", easy in both singular and plural |
| 21:07:35 | <___> | this sure is some interesting haskell |
| 21:07:46 | <___> | :P |
| 21:07:48 | <medfly> | it's English, it doesn't have a body regulating it, preferring one form over the other |
| 21:08:09 | <mreh> | we frequently go off topic, we can handle it |
| 21:08:53 | <mreh> | dirt ! Bary Stott |
| 21:09:06 | <mreh> | > dirt ! Barry Stott |
| 21:09:07 | <lambdabot> | Not in scope: `dirt'Not in scope: data constructor `Barry'Not in scope: dat... |
| 21:09:24 | <mreh> | :t ! |
| 21:09:24 | <PetRat> | Remind me how to import data with all its constructors. |
| 21:09:25 | <lambdabot> | parse error (possibly incorrect indentation) |
| 21:09:28 | <mreh> | :t (!) |
| 21:09:29 | <lambdabot> | forall i e. (Ix i) => Array i e -> i -> e |
| 21:09:30 | <mcnster> | @hoogle seq |
| 21:09:30 | <lambdabot> | Data.Sequence data Seq a |
| 21:09:31 | <lambdabot> | Control.Parallel.Strategies seqArr :: Ix b => Strategy a -> Strategy (Array b a) |
| 21:09:31 | <lambdabot> | Control.Parallel.Strategies seqList :: Strategy a -> Strategy [a] |
| 21:09:43 | <byorgey> | PetRat: Foo(..) |
| 21:09:50 | <PetRat> | Thanks |
| 21:10:51 | <mreh> | Peter Serafinowicz's "kitchen gun" is excellent, i think it's worth checking out |
| 21:13:25 | <___> | @quote |
| 21:13:25 | <lambdabot> | wchogg says: We don't say "moan-oid" or "moan-o-morphism" or any other such silliness. |
| 21:13:52 | <opqdonut> | @quote |
| 21:13:53 | <lambdabot> | Excedrin says: the Budweiser-Miller type inference algorithm; I'm drinking beer and inferring that it might be water |
| 21:14:01 | <apostlion> | @quote |
| 21:14:01 | <lambdabot> | Alanna says: Saying that Java is nice because it works on all OS's is like saying that anal sex is nice because it works on all genders. |
| 21:14:03 | <___> | I did think it strange the first time I heard "moan-ad" |
| 21:14:12 | <JamesR> | ACTION fails degree |
| 21:14:16 | <apostlion> | @quote |
| 21:14:17 | <lambdabot> | Duqicnk says: a monad is like a train that runs backwards in time, which is made of tiny chocolate robots |
| 21:14:38 | <apostlion> | All Haskell humor is about monads. I guess someone needs to do a stand-up routine about them |
| 21:14:44 | <mreh> | pm lambdabot if you like |
| 21:17:31 | <walterkronkite> | is haskell pure? |
| 21:17:50 | <monochrom> | Yes |
| 21:18:11 | <walterkronkite> | is f# pure? |
| 21:18:19 | <tromp> | nope |
| 21:18:29 | <walterkronkite> | so haskelll is better? |
| 21:18:33 | <vixey> | yes |
| 21:18:35 | <tromp> | different |
| 21:18:40 | <vixey> | better |
| 21:18:52 | <tromp> | ok, better:) |
| 21:18:53 | <___> | pure gives you some cool things. It's no silver bullet. |
| 21:19:23 | <monochrom> | It is silver platter. |
| 21:19:34 | <JamesR> | Who wants to build me a simple database system? :P I'll pay you in hugs |
| 21:19:35 | <thoughtpolice> | i'd say purity is one of the more critical things, personally. |
| 21:19:37 | <monochrom> | You can serve web pages on a silver platter. |
| 21:19:58 | <mreh> | JamesR, can it use only relation calculus? |
| 21:20:01 | <walterkronkite> | what? |
| 21:20:02 | <mreh> | relational |
| 21:20:05 | <walterkronkite> | pruity is critiacal? |
| 21:20:37 | <___> | important, central to the haskell philosophy. |
| 21:20:45 | <JamesR> | mreh, You just spoke a different language to me :P |
| 21:20:52 | <copumpkin> | walterkronkite: it makes it harder for people who aren't used to it |
| 21:20:53 | <walterkronkite> | i heard haskell is very expressive |
| 21:21:33 | <apostlion> | cursing is very expressive |
| 21:21:46 | <apostlion> | as for programming languages, I think “terse” or “elegant” is the word |
| 21:22:41 | <___> | It is. But you'll definitely need time to unlearn imperative programming prejudices before you can express yourself in it, if that's what you're used to. |
| 21:23:21 | <monochrom> | Don't take mibbit users too seriously. |
| 21:23:38 | <___> | ACTION is a mibbit user :) |
| 21:24:15 | <ray> | don't take people who don't have any alphanumerics in their nicks seriously at all |
| 21:24:29 | <___> | :B |
| 21:24:38 | <apostlion1234> | ray: lol |
| 21:24:58 | <underscores> | aw, this one's registered |
| 21:27:07 | <apostlion> | ___: try 'u':'n':'d':'e':'r':'s':'c':'o':'r':'e':'s':[] |
| 21:27:20 | <monochrom> | hahahah |
| 21:27:28 | <___> | uh, no thanks. :P |
| 21:30:16 | <JamesR> | Im looking to dig up some old snippets I wrote about a year ago, I posted them up on a Haskell Code upload site, anyone have any idea what I mean? :P |
| 21:30:44 | <copumpkin> | hpaste ? |
| 21:30:59 | <JamesR> | Spot on :) Cheers |
| 21:31:05 | <copumpkin> | it's probably gone though |
| 21:31:09 | <copumpkin> | hpaste has changed |
| 21:31:11 | <PetRat> | Does the fact that Python provides some functional concepts (list comprehensions, some maps and folds, higher-order functions) make it possible to "program functionally" in Python? |
| 21:31:20 | <copumpkin> | PetRat: mostly not |
| 21:31:43 | <mm_freak> | is parsec lazy? |
| 21:31:52 | <copumpkin> | mm_freak: don't think so, but there's another one that is |
| 21:32:02 | <mm_freak> | copumpkin: where do i find it? |
| 21:32:08 | <PetRat> | copumpkin: where is Python most lacking, in your opinion? |
| 21:32:17 | <apostlion> | Guys |
| 21:32:24 | <copumpkin> | PetRat: no TCO and limited lambdas |
| 21:32:29 | <apostlion> | Does anybody here -intuitively understand- Church numerals? |
| 21:32:34 | <PetRat> | TCO? |
| 21:32:44 | <copumpkin> | apostlion: what do you mean intuitively? |
| 21:32:47 | <thoughtpolice> | tail-call-optimization |
| 21:32:49 | <copumpkin> | PetRat: tail-call optimization |
| 21:33:07 | <apostlion> | I mean, I just can't wrap my head around them |
| 21:33:09 | <PetRat> | ah... |
| 21:33:12 | <mm_freak> | PetRat: serious functional programming is difficult in python |
| 21:33:20 | <mm_freak> | it's not a functional language after all |
| 21:33:23 | <vixey> | PetRat: Scheme is good |
| 21:33:26 | <thoughtpolice> | mm_freak: you may want 'polyparse' which isn't parsec but it is lazy |
| 21:33:38 | <___> | 1 f = f, 2 f = f . f, 3 f = f . f . f |
| 21:33:41 | <mm_freak> | thoughtpolice: thanks |
| 21:33:48 | <copumpkin> | mm_freak: I think edwardk's new parsing stuff can also be lazy |
| 21:34:10 | <PetRat> | Python has this concept "generators". Is that borrowed from another language? |
| 21:34:12 | <apostlion> | ___: well, that's easy |
| 21:34:25 | <PetRat> | I think that generators provide a type of laziness. |
| 21:34:31 | <apostlion> | when it gets to arithmetic operations and booleans though... |
| 21:34:36 | <mm_freak> | PetRat: generators just emulate laziness |
| 21:34:51 | <jmcarthur> | apostlion, to be honest, i never saw the value in learning church numerals |
| 21:34:52 | <centrinia> | @let (^^) f n = if n == 0 then id else f . (f ^^ (n-1)) |
| 21:34:52 | <lambdabot> | <local>:6:41: |
| 21:34:53 | <lambdabot> | Ambiguous occurrence `^^' |
| 21:34:53 | <lambdabot> | It could refer to either `... |
| 21:35:06 | <centrinia> | @let f ^^^ n = if n == 0 then id else f . (f ^^^ (n-1)) |
| 21:35:07 | <lambdabot> | Defined. |
| 21:35:10 | <jmcarthur> | as it pertains to actually programming with haskell or something, that is |
| 21:35:11 | <mm_freak> | generators are like a VERY simplified variant of MVars |
| 21:35:20 | <centrinia> | > (+1) ^^^ 50 $ 0 |
| 21:35:22 | <lambdabot> | 50 |
| 21:35:22 | <PetRat> | What are MVars? |
| 21:35:24 | <apostlion> | jmcarthur: It just seems to me to be the real foundation of all lambda calculus |
| 21:35:28 | <apostlion> | something raw and real |
| 21:35:38 | <jmcarthur> | apostlion, i never use church numerals in haskell |
| 21:35:46 | <jmcarthur> | peano numerals, maybe |
| 21:35:50 | <apostlion> | jmcarthur: Well, I don't speak of Haskell |
| 21:35:52 | <mm_freak> | PetRat: MVars are thread-synchronized variables, which allow easy inter-thread messaging |
| 21:35:57 | <apostlion> | But of the Higher Truth |
| 21:36:06 | <mm_freak> | PetRat: one thread waits for an MVar to become full, another thread fills it |
| 21:36:22 | <copumpkin> | apostlion: which parts do you specifically not understand? I don't think they're particularly useful as more than an intellectual exercise though |
| 21:36:38 | <jmcarthur> | it seems to me that church numerals are only that useful in the absence of types, and even then "useful" is used loosely |
| 21:37:00 | <mm_freak> | MVars are one concept, which i really miss in all other languages… haskell makes thread synch and messaging incredibly easy |
| 21:37:10 | <apostlion> | K guys |
| 21:37:13 | <apostlion> | I'm off to sleep |
| 21:37:23 | <apostlion> | Trying not to frak up my sleeping patterns again |
| 21:37:31 | <PetRat> | Here is an article about the evilness of threads: http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf Anyone familiar with this, and does Haskell address some of the evils? |
| 21:37:40 | <mm_freak> | PetRat: btw, if you're interested, i've written a church list implementation in python |
| 21:38:01 | <PetRat> | I don't know what a church list is. |
| 21:38:01 | <mm_freak> | http://ertes.de/python/fun/chlists.py |
| 21:38:09 | <mm_freak> | lists in pure lambda calculus |
| 21:38:23 | <blackh> | PetRat: I should be able to answer this question. The short answer is that Haskell definitely addresses many of the evils of threads. |
| 21:38:33 | <monochrom> | A church list is the list of songs you sing during a Sunday service. |
| 21:38:51 | <PetRat> | I guess I don't know enough about lambda calculus to get this concept. |
| 21:39:30 | <mm_freak> | PetRat: that article aims at imperative languages or at least strict languages in general |
| 21:39:42 | <monochrom> | Threads are not evil. Shared variables are. |
| 21:39:44 | <mm_freak> | in haskell threading is as easy as list folding |
| 21:41:05 | <mm_freak> | PetRat: read the first sentence of the conclusion chapter |
| 21:41:26 | <idnar> | you might as well call them processes if there's no mutable shared state |
| 21:41:32 | <thoughtpolice> | PetRat: purity by itself solves a lot of the problem. if you can't update values, then you don't need locks, so a lot of hassle goes away already just with that |
| 21:41:53 | <mm_freak> | PetRat: "However, much of this difficulty is a consequence of the abstractions for concurrency that we have chosen to use." |
| 21:42:06 | <c_wraith> | there is mutable shared state. things like MVars are mutable shared state. They're just abstracted. |
| 21:42:19 | <jmcarthur> | STM tackles shared state fairly well |
| 21:42:20 | <PetRat> | I forget the URL, but I saw another article about how any Haskell program can run on multiple cores through a scheme in which the cores divide up the waiting thunks. they used this system on the GHC compiler and got a significant speed increase---despite the fact GHC was not conceived as a parallel program. |
| 21:42:27 | <idnar> | c_wraith: MVars are "evil" :P |
| 21:43:03 | <idnar> | c_wraith: but okay, at least you have a lot more explicit control over MVars |
| 21:43:17 | <thoughtpolice> | PetRat: that is no longer the case - for a little sliver of time they did have a version of GHC that built stuff in parallel (using multiple cores,) but it turned out to be very fragile |
| 21:43:19 | <gwern> | ok, anyone want to browse test.darcs.net for me? |
| 21:43:36 | <mm_freak> | PetRat: this doesn't work well for practical code, so GHC doesn't do this automatically, but you can designate areas of your code, which should run in parallel |
| 21:43:37 | <jmcarthur> | we do have par, for cases where you only care about the parallelism and not the concurrency |
| 21:43:38 | <gwern> | i'd appreciate going to all pages and clicking on a few dozen pages :) |
| 21:43:46 | <thoughtpolice> | PetRat: but it's still pretty easy to write parallel code |
| 21:43:50 | <jmcarthur> | and nested data parallelism, too |
| 21:43:52 | <mm_freak> | however, that's trivial parallelism |
| 21:43:57 | <thoughtpolice> | PetRat: with parallel strategies, you can get 'almost implicit' parallelism |
| 21:44:05 | <mm_freak> | nontrivial parallelism starts where the threads need to communicate |
| 21:44:18 | <gwern> | http://test.darcs.net/ <-- visit! browse! give me some benchmarking! see a darcsit in action! |
| 21:44:19 | <thoughtpolice> | PetRat: Data parallel haskell essentially aims to give you automagic parallelism |
| 21:44:49 | <jmcarthur> | i still would like to try implementing my parallel annotations idea to GHC some time, but i need to work several other things out first before i can settle down with something like that |
| 21:44:50 | <thoughtpolice> | gwern: seems to work good |
| 21:45:36 | <PetRat> | mm_freak: "Concurrency in software is difficult"? |
| 21:45:49 | <jmcarthur> | basically a parallel annotation is like a strictness annotation, except it has non-strict semantics but sparks a thread upon construction |
| 21:45:52 | <mm_freak> | PetRat: the first and second sentences, sorry =) |
| 21:46:12 | <jmcarthur> | *a computation |
| 21:46:14 | <jmcarthur> | not a thread |
| 21:46:18 | <endofjelly> | @hoogle m a -> m b -> m (a -> b) |
| 21:46:18 | <lambdabot> | No results found |
| 21:46:23 | <thoughtpolice> | jmcarthur: wouldn't that just be syntactic sugar for e.g. parallel strategies? |
| 21:46:28 | <gwern> | thlt |
| 21:46:31 | <gwern> | bleh |
| 21:46:56 | <thoughtpolice> | strategies get you most of the way there fairly implicitly (although there might be a few gotchas) |
| 21:47:01 | <PetRat> | I work for NASA, and someone in another division sent an email out saying they were moving to Haskell for all multiple-core programs. |
| 21:47:11 | <jmcarthur> | no, parallel strategies take the form of functions and such, this is an annotation for the data type definitions themselves, and only would evaluate to weak head normal form |
| 21:47:17 | <vixey> | PetRat I don't believe it |
| 21:47:23 | <mm_freak> | those parallel strategies didn't work well for me… i always got much better performance through explicit threading through concurrency |
| 21:47:34 | <vixey> | PetRat: Is there any news about it on nasa site or what? |
| 21:47:49 | <jmcarthur> | PetRat, if that's true then i shall apply to NASA immediately, but i don't think it's true |
| 21:47:54 | <vixey> | lol |
| 21:47:58 | <PetRat> | vixey: probably not. |
| 21:48:20 | <PetRat> | I would have to find the email... let me look... |
| 21:48:22 | <thoughtpolice> | mm_freak: well, sometimes the cost of sparking stuff with strategies outweights its actual computational price |
| 21:48:29 | <mm_freak> | it would be a big improvement, but NASA is not ready for haskell =) |
| 21:48:49 | <mm_freak> | thoughtpolice: it did even for long-running computations |
| 21:49:13 | <endofjelly> | @hoogle [Maybe a] -> [a] |
| 21:49:14 | <lambdabot> | Data.Maybe catMaybes :: [Maybe a] -> [a] |
| 21:49:14 | <lambdabot> | Data.Maybe maybeToList :: Maybe a -> [a] |
| 21:49:14 | <lambdabot> | Prelude sequence :: Monad m => [m a] -> m [a] |
| 21:49:19 | <thoughtpolice> | what computations are we talking about exactly? |
| 21:49:44 | <ray> | if nasa adopts haskell, haskell will be ruined! ruined! |
| 21:49:48 | <endofjelly> | @hoogle [f (m a)] -> [f a] |
| 21:49:49 | <lambdabot> | Data.List transpose :: [[a]] -> [[a]] |
| 21:49:49 | <lambdabot> | Data.Traversable sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a) |
| 21:49:49 | <lambdabot> | Data.Traversable sequence :: (Traversable t, Monad m) => t (m a) -> m (t a) |
| 21:50:19 | <___> | > catMaybes [Just 1, Nothing, Just 2, Just 3, Nothing] |
| 21:50:20 | <lambdabot> | [1,2,3] |
| 21:50:28 | <thoughtpolice> | mm_freak: on that note it's worth mentioning, GHC HEAD has a bunch of improvements to parallel code that should help e.g. strategies a lot |
| 21:50:33 | <PetRat> | Can't find the email---I guess it's just a rumor. |
| 21:50:38 | <mm_freak> | thoughtpolice: factoring a number using trial division… one thread tried the numbers [2,4..], the other one tried [3,5..] |
| 21:50:45 | <thoughtpolice> | mm_freak: simon m. has been doing this by killing as many RTS bottlenecks as possible |
| 21:51:01 | <thoughtpolice> | including stuff like work-stealing parallelism etc. |
| 21:51:21 | <mm_freak> | i'll give it another try as soon as those improvements make it into a release =) |
| 21:51:26 | <PetRat> | Note that most software in NASA is not "flight software"---we are not talking about stuff that controls spacecraft. Most software processes telemetry data, tracking data, scientific data. |
| 21:51:47 | <PetRat> | Some software is used for requirements tracking for both hardware and software development. |
| 21:51:57 | <jmcarthur> | data ParMaybe a = Nothing | Just @a -- trivial example of a parallel annotation. same semantics as Maybe, but optimistically evaluates the value if it exists |
| 21:52:14 | <alexsuraci> | What's the proper way to import data and its constructors? |
| 21:52:58 | <PetRat> | Mission designers---the people who figure out a good way to get gravity assists for deep-space spacecraft---run huge search spaces on parallel computers. |
| 21:53:08 | <ray> | you mean like import Module(Type(..)) |
| 21:53:11 | <mm_freak> | import Data.Maybe (Maybe(..)) |
| 21:53:12 | <jmcarthur> | data ParStrictList a = Nil | Cons @a !(ParStrictList a) -- list with strict spine and parallel elements (closest to a typical parallel strategy with lists, i think?) |
| 21:53:26 | <alexsuraci> | ray: mm_freak: that must be it, thanks |
| 21:53:32 | <PetRat> | To estimate fuel usage for a deep-space spacecraft, huge Monte Carlo simulations are run. |
| 21:54:13 | <jmcarthur> | that sounds like something more appropriate for distributed computation than parallel computation |
| 21:54:15 | <monadic_kid> | PetRat: http://noordering.wordpress.com/2009/02/01/simulating-n-bodies-and-functional-programmingre/ |
| 21:54:29 | <PetRat> | Most of it is embarassingly parallel. |
| 21:55:32 | <PetRat> | monadic_kid: nice |
| 21:56:07 | <beelsebob> | >.> |
| 21:56:17 | <beelsebob> | didn't expect that one to be popular |
| 21:56:29 | <beelsebob> | shame reactive isn't stable enough to make it actually work |
| 21:56:30 | <beelsebob> | :( |
| 21:56:55 | <monadic_kid> | beelsebob: that's yours? |
| 21:56:58 | <beelsebob> | yep |
| 21:57:09 | <monadic_kid> | beelsebob: i made it popular ;) |
| 21:57:10 | <jmcarthur> | data ParList a = Nil | Cons !a @(ParList a) -- list that is evaluated from head to tail in order in another thread |
| 21:57:15 | <beelsebob> | sweet :) |
| 21:57:35 | <jmcarthur> | in *other threads*, i mean |
| 21:57:59 | <monadic_kid> | beelsebob: http://www.reddit.com/r/haskell/comments/7u0mu/simulating_nbodies_and_functional_programming/ |
| 21:58:33 | <beelsebob> | elsuive_snk_kid: neat |
| 21:59:51 | <beelsebob> | I need to poke work and see if I can post about my guis in haskell stuff |
| 22:02:30 | <endofjelly> | @hoogle (a -> b -> c) -> [(a,b)] -> [c] |
| 22:02:30 | <lambdabot> | Prelude uncurry :: (a -> b -> c) -> (a, b) -> c |
| 22:02:30 | <lambdabot> | Data.Tuple uncurry :: (a -> b -> c) -> (a, b) -> c |
| 22:03:15 | <skorpan> | is there anything in haskell such as: power n f = f . power (n-1) f |
| 22:04:05 | <___> | you could iterate and (!!) |
| 22:04:10 | <jmcarthur> | :t \power n f -> f . power (n-1) f |
| 22:04:12 | <lambdabot> | forall b c a a1. (Num a) => (a -> (b -> c) -> a1 -> b) -> a -> (b -> c) -> a1 -> c |
| 22:04:22 | <jmcarthur> | i don't think that's what you want ;) |
| 22:04:32 | <dafis> | :t curry uncurry |
| 22:04:33 | <lambdabot> | Couldn't match expected type `(a, b)' |
| 22:04:33 | <lambdabot> | against inferred type `a1 -> b1 -> c' |
| 22:04:33 | <lambdabot> | Probable cause: `uncurry' is applied to too few arguments |
| 22:04:52 | <jmcarthur> | :t curry . uncurry |
| 22:04:53 | <lambdabot> | forall a b c. (a -> b -> c) -> a -> b -> c |
| 22:05:16 | <Philonous> | :t curry |
| 22:05:17 | <lambdabot> | forall a b c. ((a, b) -> c) -> a -> b -> c |
| 22:05:32 | <skorpan> | ___: how would i use (!!)? is this Prelude.!!? |
| 22:05:51 | <c_wraith> | > [1..] !! 55 |
| 22:05:52 | <lambdabot> | 56 |
| 22:06:08 | <skorpan> | c_wraith: right, but how would that be used for me? |
| 22:06:16 | <skorpan> | :t (!!) |
| 22:06:17 | <lambdabot> | forall a. [a] -> Int -> a |
| 22:06:22 | <skorpan> | :t iterate |
| 22:06:23 | <lambdabot> | forall a. (a -> a) -> a -> [a] |
| 22:07:07 | <___> | > (iterate ((+1).) id) !! 10 $ 5 |
| 22:07:09 | <lambdabot> | 15 |
| 22:07:30 | <___> | (+1) is your f. |
| 22:07:43 | <skorpan> | i see |
| 22:07:48 | <skorpan> | and this is lazy right? |
| 22:08:06 | <c_wraith> | iterate has to be lazy. otherwise it'd never return. :) |
| 22:08:11 | <___> | ought to be. |
| 22:08:13 | <skorpan> | heh, true :) |
| 22:08:19 | <vixey> | Haskell is lazy |
| 22:08:22 | <jmcarthur> | :t \f -> (iterate (f .) !!) |
| 22:08:23 | <lambdabot> | Couldn't match expected type `[a]' |
| 22:08:23 | <lambdabot> | against inferred type `(a1 -> c) -> [a1 -> c]' |
| 22:08:23 | <lambdabot> | In the first argument of `(!!)', namely `iterate ((f .))' |
| 22:08:25 | <___> | I believe it'll allocate the list spine, though. |
| 22:08:32 | <jmcarthur> | :t \f -> (iterate f !!) |
| 22:08:33 | <lambdabot> | Couldn't match expected type `[a]' |
| 22:08:33 | <lambdabot> | against inferred type `a1 -> [a1]' |
| 22:08:33 | <lambdabot> | In the first argument of `(!!)', namely `iterate f' |
| 22:08:38 | <jmcarthur> | oh i'm dumb |
| 22:08:42 | <jmcarthur> | back to work |
| 22:08:44 | <ray> | haskell is lazy unless it's strict |
| 22:08:54 | <ray> | lazily strict |
| 22:09:01 | <monadic_kid> | ACTION is lazy unless you kick him |
| 22:09:02 | <skorpan> | strictly lazy |
| 22:09:05 | <jmcarthur> | :t \f -> (iterate f id !!) |
| 22:09:05 | <___> | :t \f n -> (iterate (f.) id !! n) |
| 22:09:06 | <lambdabot> | forall a. ((a -> a) -> a -> a) -> Int -> a -> a |
| 22:09:07 | <lambdabot> | forall a. (a -> a) -> Int -> a -> a |
| 22:09:18 | <jmcarthur> | :t \f -> (iterate (f.) id !!) |
| 22:09:19 | <lambdabot> | forall a. (a -> a) -> Int -> a -> a |
| 22:09:32 | <jmcarthur> | @pl \f -> (iterate (f.) id !!) |
| 22:09:32 | <lambdabot> | (!!) . flip iterate id . (.) |
| 22:09:38 | <jmcarthur> | eh, not so good |
| 22:09:41 | <___> | oh right, the (.) is wrong. |
| 22:09:54 | <___> | nvm |
| 22:10:58 | <endofjelly> | @hoogle (a,b,c) -> a -> b -> c |
| 22:10:58 | <lambdabot> | No results found |
| 22:11:10 | <endofjelly> | @hoogle ((a,b,c) -> d) -> a -> b -> c -> d |
| 22:11:10 | <lambdabot> | No results found |
| 22:11:36 | <dobblego> | @pl ((a,b,c) -> d) -> a -> b -> c -> d |
| 22:11:36 | <lambdabot> | (line 1, column 10): |
| 22:11:36 | <lambdabot> | unexpected ">" |
| 22:11:36 | <lambdabot> | expecting variable, "(", operator or ")" |
| 22:11:38 | <___> | whatcha looking for, endofjelly |
| 22:11:47 | <endofjelly> | ___, "uncurry3" 8) |
| 22:12:06 | <endofjelly> | or "curry3", respectively |
| 22:12:13 | <___> | @type (\f (a,b,c) -> f a b c) |
| 22:12:14 | <lambdabot> | forall t t1 t2 t3. (t -> t1 -> t2 -> t3) -> (t, t1, t2) -> t3 |
| 22:12:33 | <endofjelly> | ___, yup, just wanted to see if it's already there |
| 22:12:37 | <endofjelly> | like that one: |
| 22:12:43 | <endofjelly> | @type uncurry |
| 22:12:44 | <lambdabot> | forall a b c. (a -> b -> c) -> (a, b) -> c |
| 22:13:10 | <jmcarthur> | :t curry3 |
| 22:13:11 | <lambdabot> | Not in scope: `curry3' |
| 22:13:44 | <edwardk> | ACTION waves hello. |
| 22:13:56 | <vixey> | hi edwardk |
| 22:14:02 | <jmcarthur> | endofjelly, http://hackage.haskell.org/packages/archive/utility-ht/0.0.5/doc/html/Data-Tuple-HT.html |
| 22:14:23 | <endofjelly> | jmcarthur, nice, thanks |
| 22:14:26 | <edwardk> | i wonder if rephrasing my grammar combinators in terms of grammar algebras might scare too many people off. |
| 22:14:52 | <edwardk> | pros: easy memoization of partial folds of information from the grammar |
| 22:14:58 | <edwardk> | cons: scary names ;) |
| 22:15:16 | <edwardk> | and uglier types |
| 22:16:01 | <jmcarthur> | people are too easily scared by names. i say use scary names all you want. types, on the other hand, get confusing when they get ugly, in my opinion |
| 22:17:03 | <gwern> | @quote scary |
| 22:17:03 | <lambdabot> | swix says: seriously though, this thing is too concise, it's scary, given what it does |
| 22:17:15 | <gwern> | @quote scary |
| 22:17:16 | <lambdabot> | swix says: seriously though, this thing is too concise, it's scary, given what it does |
| 22:17:24 | <vixey> | edwardk: you can searh and replace evyrthing later, just write teh good program :p |
| 22:17:41 | <jmcarthur> | use words like "warm" and "fuzzy" ;) |
| 22:17:45 | <edwardk> | right now constructors for paths through the grammar look like: PathAppR :: Grammar t (a → b) → p t r b → Path p t r a -- where 'p' takes the place of Path p whenever it recurses into itself |
| 22:18:01 | <gwern> | perhaps we could rename monads fuzzads and monoids fuzzoids |
| 22:18:15 | <gwern> | applicative could become 'pettable' |
| 22:18:35 | <edwardk> | the refactoring would change that to something where Grammar t (a -> b) -- becomes g t (a -> b) inside of all of the grammar constructors, and you use smart constructors like i do internally with paths |
| 22:18:53 | <gwern> | (we could rename the foldable type class kissable, because the diagram might look like people kissing) |
| 22:20:04 | <edwardk> | to get them to fit into the same type, i'd probably need to refactor the Path to take a 'PathTraits' data type as its first argument to cut it down to two arguments, the same as the grammar, but this gives an avenue for expansion as well |
| 22:20:28 | <FunctorSalad> | is an mvar lock an acceptable way to share a socket among several threads? |
| 22:20:32 | <FunctorSalad> | (shared writing) |
| 22:20:47 | <FunctorSalad> | (my program deadlocks and I think it's that part) |
| 22:21:41 | <FunctorSalad> | I guess I could make a single writer thread that aggregates stuff from the other threads |
| 22:21:42 | <edwardk> | If a packet hits a pocket on a socket on a port, and the MVar is intercepted before its very last report... |
| 22:21:59 | <cypher-> | guys, how could I generate, compile, load and execute C at runtime from a haskell program? |
| 22:22:06 | <FunctorSalad> | edwardk: a pocket? |
| 22:22:07 | <cypher-> | what would be the best way to attack this? |
| 22:22:15 | <blackh> | FunctorSalad: If you do that with a Chan or something, that would be safe |
| 22:22:17 | <edwardk> | cypher-: erm, use ffi to fire off a connection to perl to use Inline.C? =) |
| 22:22:30 | <c_wraith> | cypher-: nuclear warheads, full spread, simultaneous detonation. |
| 22:22:31 | <edwardk> | FunctorSalad: just an homage to an old dr. seuss programming meme |
| 22:23:10 | <FunctorSalad> | edwardk: hehe. thought it was some weird part under the hood of sockets ;) |
| 22:23:12 | <edwardk> | http://kreiger.linuxgods.com/kiki/?If+a+packet+hits+a+pocket+on+a+socket+on+a+port |
| 22:23:34 | <cypher-> | edwardk: not sure if this is what I would like ;-) |
| 22:24:12 | <edwardk> | cypher-: in general compiling c is a nasty platform specific thing. haskell provides you no additional machinery really to make that any easier |
| 22:24:24 | <FunctorSalad> | hmm, wait! I have seperate locks for reading and writing for the same socket |
| 22:24:29 | <edwardk> | cypher-: you could perhaps use ghc-as-a-library which offers some support for wrapping gcc, iirc. |
| 22:24:37 | <FunctorSalad> | and one thread does a blocking read on the socket |
| 22:24:51 | <FunctorSalad> | I guess that blocks the writers |
| 22:25:22 | <FunctorSalad> | (obviously I know nothing about the low-level underlyings :-( ) |
| 22:26:07 | <cypher-> | edwardk: I'll check it out, thanks |
| 22:26:13 | <edwardk> | vixey: ok, sucking it up, and refactoring into a common abstraction |
| 22:48:29 | <mreh> | Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire, Are they serious? |
| 22:49:04 | <vixey> | yes |
| 22:49:31 | <mreh> | i'm not much one to consider something worth reading by it's grandeous title |
| 22:49:52 | <shapr> | mreh: It's a nifty paper. |
| 22:49:57 | <Apocalisp> | (|Bananas|) |
| 22:50:02 | <monadic_kid> | and lots of cats |
| 22:50:04 | <vixey> | shapr exists!! |
| 22:50:11 | <shapr> | hiya vixey! |
| 22:50:13 | <shapr> | ACTION hugs vixey |
| 22:50:27 | <mreh> | there aren't any women here are there? |
| 22:50:43 | <shapr> | Nope, none... |
| 22:50:49 | <shapr> | There are Haskellers though. |
| 22:50:53 | <shapr> | There aren't any males either. |
| 22:50:57 | <SubStack> | koalas |
| 22:50:57 | <monochrom> | shapr is proof that non-academic, non-CS-grad can appreciate Haskell. |
| 22:51:02 | <SubStack> | lots and lots of koalas |
| 22:51:06 | <SubStack> | lazy and slow |
| 22:51:13 | <shapr> | I am not a koala! |
| 22:51:23 | <shapr> | monochrom: Hey, who says I'm not academic? |
| 22:51:30 | <vixey> | Am I academic? |
| 22:51:32 | <mreh> | @quote 1337 |
| 22:51:33 | <lambdabot> | No quotes match. I've seen penguins that can type better than that. |
| 22:51:34 | <JamesR> | ACTION proves that you can be an academic CS-undergrad and be baffled by Haskell |
| 22:51:42 | <SubStack> | ACTION is one of those! |
| 22:51:43 | <vixey> | haha |
| 22:51:47 | <mreh> | @quote 1337_h4x0r |
| 22:51:47 | <lambdabot> | No quotes match. Have you considered trying to match wits with a rutabaga? |
| 22:51:57 | <mreh> | hrmm |
| 22:52:02 | <monochrom> | I guess you are academic now. |
| 22:52:06 | <shapr> | vixey: I dunno... I just like playing with cool toys, and Haskell is a very cool toy. |
| 22:52:22 | <Adamant> | @quote meh |
| 22:52:22 | <lambdabot> | Cale says: I know I always have trouble explaining what the weather is like without involving foldr somehow. |
| 22:52:50 | <SubStack> | ACTION uses haskell for experimental mathematical models and opengl programming |
| 22:53:00 | <monochrom> | Anyway someone yesterday was mything "haskell looks academic and you need CS PhD" again. |
| 22:53:02 | <SubStack> | plus it's excellent for tackling project euler |
| 22:53:11 | <Cale> | Wait, whaaaat? Did I say that? |
| 22:53:25 | <SubStack> | you need tenure actually |
| 22:53:29 | <Cale> | ACTION has no memory of that quote. |
| 22:53:32 | <SubStack> | phd is insufficient |
| 22:53:49 | <bremner> | tenure might be necessary, but not sufficient |
| 22:54:11 | <Adamant> | if your name is Simon, that helps. |
| 22:54:27 | <mreh> | does he hang here? |
| 22:54:31 | <vixey> | I don't have a CS PhD |
| 22:54:33 | <monochrom> | No. |
| 22:54:40 | <gwern> | Cale: you usually remember each and every thing you say in #haskell? |
| 22:54:55 | <mreh> | I only have Bachellors D: |
| 22:55:26 | <Apocalisp> | I've seen the inside of a university twice. |
| 22:55:33 | <Hunner> | You don't need a bachellors to do haskell either |
| 22:55:34 | <shapr> | @quote Apocalisp |
| 22:55:34 | <lambdabot> | No quotes match. Maybe you made a typo? |
| 22:55:36 | <shapr> | aww |
| 22:55:41 | <monochrom> | I've seen the outside twice. XD |
| 22:56:00 | <mreh> | universities are just people going in and out of rooms |
| 22:56:01 | <Apocalisp> | oh drat, must think of something quoteworthy to say |
| 22:56:11 | <Axman6> | mreh: says you |
| 22:56:13 | <mreh> | i've stoled education |
| 22:56:20 | <mreh> | it's easy |
| 22:56:31 | <JamesR> | mreh: To be fair most students don't even manage that |
| 22:56:32 | <shapr> | mreh: That's what I'm here for too... I'm getting an education! |
| 22:56:44 | <shapr> | Let's see, today someone was filling my head full of treap info... |
| 22:56:44 | <Hunner> | @quote shapr |
| 22:56:44 | <lambdabot> | shapr says: <shapr> Yeah, it does require more than an oleg of type-hackery. <poetix> oleg's now a unit? <autrijus> is oleg an unit now? <shapr> Yup, a rather large unit of type-hackery too. |
| 22:56:49 | <shapr> | and then went on into tripes? |
| 22:56:53 | <vixey> | shapr I wonder who... :p |
| 22:56:54 | <Cale> | gwern: Well, usually I have a sense of the sort of thing I might say, at least. I suppose I could have said that, but... |
| 22:56:56 | <shapr> | hiya Hunner! |
| 22:56:57 | <Botje> | Cale: you said it on Nov 16 2006 |
| 22:57:02 | <shapr> | vixey: Yeah, you know who :-) |
| 22:57:03 | <Cale> | Botje: interesting |
| 22:57:06 | <Botje> | around 22h30 CET :o) |
| 22:57:13 | <shapr> | @quote Botje |
| 22:57:13 | <lambdabot> | Botje says: #haskell: parallellising your homework answers! |
| 22:58:04 | <Botje> | it was in response to Binkley saying "well, I always end up explaining what foldr is in my interviews |
| 22:58:07 | <Botje> | anyway" |
| 22:58:17 | <Botje> | ACTION disengages creepy stalker mode |
| 22:58:20 | <monochrom> | That's evil because the hardest part is serialising all the things you heard from this channel into a coherent submission. |
| 22:58:55 | <Botje> | ACTION is sad the haskell lessons are over |
| 22:59:01 | <Botje> | now i have to pay attention because it's erlang :p |
| 22:59:49 | <shapr> | Has anyone built GHC for the ARM recently? |
| 23:00:00 | <shapr> | I have two ARM linux devices, and I'd like to run GHC on them. |
| 23:00:29 | <bremner> | shapr: did you check debian? |
| 23:00:56 | <shapr> | No, but that's a good idea, thanks. |
| 23:04:02 | <FunctorSalad> | what do you do if a library type lacks some instance decl? I'm afraid that if the library gets updated, my program will fail to build due to overlap... use -XIncoherentInstances? |
| 23:05:26 | <Cale> | FunctorSalad: If the library is open source, you could contribute the instance to it. |
| 23:05:49 | <FunctorSalad> | good point :) |
| 23:06:12 | <JamesR> | Im having a great deal of trouble with something very basic, anyone interested in trouble shooting it for me? |
| 23:06:28 | <FunctorSalad> | though that'd feel a bit silly if it's just a "deriving instance Show" ;) |
| 23:07:15 | <JamesR> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4804#a4804 |
| 23:07:20 | <JamesR> | I'm still in Python mode |
| 23:07:30 | <JamesR> | So don't grab your torches yet :P |
| 23:08:09 | <c_wraith> | JamesR: the last line should be ... = x:xs |
| 23:08:17 | <c_wraith> | :t (:) |
| 23:08:19 | <lambdabot> | forall a. a -> [a] -> [a] |
| 23:08:42 | <c_wraith> | well. It needs more than that |
| 23:08:43 | <monadic_kid> | ffs with the accidently smiley faces |
| 23:08:45 | <c_wraith> | But that's the idea |
| 23:09:00 | <c_wraith> | You'll also need to pattern match to deconstruct the data types |
| 23:09:01 | <monadic_kid> | *accidental |
| 23:09:09 | <JamesR> | Ah, fair enough |
| 23:09:15 | <c_wraith> | and to use data constructors to rebuild them |
| 23:09:28 | <JamesR> | I'm still foolishly trying to inherit ;) |
| 23:13:12 | <JamesR> | Man, I totally don't get Haskell sometimes |
| 23:14:28 | <vixey> | same |
| 23:14:57 | <JamesR> | My algebraic type is a list of another Algebraic type but yet calling it as (xs) gives a type error on the grounds that it doesn't match [a]? O.o |
| 23:15:37 | <c_wraith> | well, it's not a list |
| 23:15:45 | <c_wraith> | it's something that contains a list |
| 23:16:01 | <c_wraith> | You need to pattern match to extract the list from it |
| 23:16:03 | <monochrom> | I don't understand English. |
| 23:17:10 | <lament> | Englisch |
| 23:17:19 | <badtruffle> | 'twas designed to be incomprehensible |
| 23:18:14 | <JamesR> | On the grounds that this assigment doesn't specify the database needs to be a type ... *Removes* |
| 23:18:28 | <JamesR> | Mmmm bypassing problems |
| 23:18:36 | <JamesR> | How very Microsoft of me |
| 23:18:49 | <monochrom> | Anyway, I mean I don't understand the question. But supposedly how you write pattern matching is derived mechanically from how you defined your data type. You don't go through an "English description" first. |
| 23:22:07 | <Cale> | JamesR: Can I see what you've written? Perhaps I can explain what's going on. There's no requirement for a variable named xs to refer to a list. |
| 23:22:30 | <Cale> | JamesR: However if you treat it like a list, it might have to be. |
| 23:22:40 | <Cale> | (like, say, applying map, filter, etc to it) |
| 23:23:03 | <c_wraith> | Cale, it's that case. He was treating it as a list, but it was a Blah [Foo] |
| 23:25:23 | <JamesR> | ;) |
| 23:25:43 | <glguy> | Is this a correct way to use the parallel strategies stuff? case rnf a >|| rnf b of () | sometest on a -> ... | sometest on b ->... |
| 23:25:44 | <glguy> | ? |
| 23:28:57 | <persica> | Whoa, I think reading this chapter on Monads just blew my mind. I wish I'd learned some functional programming earlier. |
| 23:29:28 | <SubStack> | \o/ |
| 23:29:40 | <persica> | It's like "oooh! That's what I was trying to do earlier." |
| 23:29:44 | <SubStack> | mind explosions galore in haskell land |
| 23:29:47 | <JamesR> | I literally just slapped myself in the face for being so stupid... |
| 23:30:04 | <persica> | I like my head asploded sometimes. |
| 23:30:08 | <JamesR> | All along I was assuming that (xs) was inheriting the algebraic type "Just cuz" |
| 23:30:32 | <JamesR> | And only now, have I realised that I needed to put (Dbase xs) |
| 23:30:40 | <JamesR> | ACTION facepalms himself |
| 23:30:45 | <c_wraith> | yes. That's 50% of what you needed |
| 23:30:45 | <persica> | heh. |
| 23:30:49 | <JamesR> | Python spoiled me wrotten |
| 23:31:00 | <c_wraith> | the other 50% is using the Dbase constructor in the right-hand side, too |
| 23:31:01 | <c_wraith> | :) |
| 23:31:02 | <JamesR> | So rotten I can't spell it anymore |
| 23:35:13 | <JamesR> | Arg! |
| 23:35:28 | <JamesR> | Why am I writing things like: (Type a,b,c,d) >_< |
| 23:35:36 | <JamesR> | *Shakes fist at Python* |
| 23:35:48 | <persica> | Unlearning is the hard part. |
| 23:35:54 | <persica> | I'm still a bit mad at "return" |
| 23:36:00 | <JamesR> | :P |
| 23:36:16 | <lament> | whoever came up with that name |
| 23:36:18 | <JamesR> | I spent about 9 hours today working on Python and the weekend on C# ... so this is a lot of work for me :D |
| 23:36:32 | <lament> | ...could have come up with a better name |
| 23:36:45 | <persica> | Oh yeah, I'm sort of lucky I spend most of my day in psudocode and system configuration. |
| 23:36:57 | <persica> | Makes playing with pet languages easier. |
| 23:39:10 | <SubStack> | return is a fine name |
| 23:39:17 | <SubStack> | it's just not for flow control is all |
| 23:39:52 | <persica> | It's just an overloaded word if you use more Haskell and any other language. |
| 23:40:04 | <persica> | And we all know that overloaded functions can be a pain to debug. :P |
| 23:42:05 | <SubStack> | ACTION remembers reading some best practices thing about only putting returns at the end of subroutines in imperative code at some point |
| 23:42:49 | <pumpkin_> | so much snake oil floating around in hardware/OS help IRC channels |
| 23:43:44 | <persica> | I don't know if it's snake oil so much as stylistic differences. |
| 23:43:54 | <persica> | er, wait. |
| 23:43:59 | <persica> | I thought we were talking about programming still. |
| 23:44:06 | <persica> | What do you mean, pumpkin_? Example? |
| 23:44:39 | <pumpkin_> | like the "repair permissions" crap that everyone tells you to do if anything is wrong with mac os, or reset your pram, or defragment, etc. |
| 23:44:51 | <lament> | SubStack: i don't like 'return' as a description of what it does |
| 23:45:14 | <FunctorSalad> | @let devour=return |
| 23:45:15 | <lambdabot> | Defined. |
| 23:45:50 | <persica> | pumpkin_: oh, yeah, I hate that. The first thing a mac person seems to suggest when you have a problem is to repair permissions. I don't think I've ever actually found a problem where that was the solution. |
| 23:45:56 | <Gracenotes> | :o |
| 23:46:06 | <lament> | SubStack: especially since haskell is a functional language, where actual functions actually return stuff all the time |
| 23:46:32 | <SubStack> | haskell is linguistically powerful enough live up to return values as the last statement fortunately |
| 23:46:52 | <vixey> | SubStack :what o_o |
| 23:46:59 | <persica> | Well, since it's a functional language they don't actually return anything. They're much closer to statements of equality and transformations. |
| 23:47:04 | <pumpkin_> | @hackage visual-graphrewrite |
| 23:47:04 | <lambdabot> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/visual-graphrewrite |
| 23:47:05 | <pumpkin_> | ooh |
| 23:47:11 | <vixey> | persica nicely put |
| 23:47:15 | <persica> | (at least that's what I see) |
| 23:47:18 | <pumpkin_> | zsol: that looks cool, any screen shots? |
| 23:47:21 | <SubStack> | vixey: writing that way in langauges like c is icky |
| 23:47:38 | <pumpkin_> | haskell-cafe is still dead :/ |
| 23:47:38 | <SubStack> | of course, so is everything |
| 23:47:50 | <JamesR> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4804#a4805 <--- My slightly less Fubar work :P |
| 23:48:21 | <persica> | JamesR: You're pretty new to Haskell? |
| 23:48:31 | <lament> | persica: function return values. |
| 23:48:39 | <FunctorSalad> | lament: an advantage of "return" over "unit" is less concept clashing... (since the other mathematical senses of "unit" are closer to monadic unit than "return" is to monadic unit) |
| 23:48:41 | <lament> | persica: that's how English works :) |
| 23:48:44 | <JamesR> | Well ... Technically no but realistically yes :P |
| 23:49:01 | <persica> | lament: You mean functions are mappings from one set to another? |
| 23:49:24 | <lament> | persica: no, i mean in English, when talking about a function, you talk about it returning a value. |
| 23:49:52 | <lament> | persica: so using "return" in any other sense is confusing and contradictory. |
| 23:49:54 | <persica> | lament: We only do that because of how we're used to thinking about programming. In mathematics I think you talk more about the result of a function than its return value. |
| 23:50:14 | <lament> | [[Function (mathematics)]] for example says "A function ƒ takes an input, x, and returns an output ƒ(x)." |
| 23:50:32 | <persica> | Okay, got me there. |
| 23:50:37 | <FunctorSalad> | well, that's a wikipedia attempt at accessiblity |
| 23:50:44 | <vixey> | lament: you want to be arguing with the C designers I think |
| 23:50:46 | <EvilTerran> | ACTION would've called "return" something like "embed" |
| 23:50:54 | <FunctorSalad> | I agree that in math it's not so common to talk about return values |
| 23:50:59 | <persica> | I don't remember using "return" in my math classes back in college, but that was a long time ago. |
| 23:51:00 | <skorpan> | EvilTerran: "wrap" |
| 23:51:05 | <vixey> | ACTION would call it eta |
| 23:51:05 | <centrinia> | It is called "pure" |
| 23:51:11 | <Pseudonym> | Or "unit". |
| 23:51:18 | <EvilTerran> | ACTION would happily call it wrap, eta, or pure |
| 23:51:21 | <monadic_kid> | you can also view a function as special kind of set that defines a *mapping* between sets |
| 23:51:37 | <lament> | monadic_kid: i'm not talking about how you view it, only about terminology people use |
| 23:51:41 | <centrinia> | Relations are sets. |
| 23:51:42 | <ErhardtMundt> | lament: how do you type that calligraphic 'f'? |
| 23:51:43 | <EvilTerran> | they're already called Monads, calling it eta wouldn't be making things much worse ;) |
| 23:51:52 | <lament> | ErhardtMundt: no clue :) |
| 23:51:58 | <monadic_kid> | lament: that is also terminology |
| 23:52:20 | <Pseudonym> | Of course, Gofer had "box". |
| 23:52:22 | <lament> | monadic_kid: i'm not sure what your point is. |
| 23:52:25 | <centrinia> | Why doesn't Monad require only pure and join? |
| 23:52:26 | <ErhardtMundt> | lament: :) |
| 23:52:29 | <lament> | Pseudonym: i prefer that by far. |
| 23:52:34 | <lament> | it's even shorter! |
| 23:52:51 | <monadic_kid> | functions, relations, sequences, sets they are all related |
| 23:52:59 | <Pseudonym> | box == robot ninja monkey operator |
| 23:53:06 | <lament> | Pseudonym: did it have something like unsafeUnbox? :) |
| 23:53:09 | <FunctorSalad> | centrinia: you don't get liftM/fmap that way |
| 23:53:17 | <Pseudonym> | lament: Yes. "head" |
| 23:53:23 | <centrinia> | class Monad m where { pure :: a -> m a; join :: m (m a) -> m a; } |
| 23:53:24 | <lament> | what |
| 23:53:26 | <FunctorSalad> | both pure and join ignore the function arrow structure |
| 23:53:42 | <lament> | head :: (Monad m) => m a -> a -- ? |
| 23:53:43 | <centrinia> | class (Functor m) => Monad m where { pure :: a -> m a; join :: m (m a) -> m a; } |
| 23:53:52 | <Pseudonym> | box :: a -> [a] |
| 23:54:00 | <lament> | Pseudonym: oh. |
| 23:54:03 | <centrinia> | return :: a -> [a] |
| 23:54:14 | <skorpan> | @src Functor |
| 23:54:15 | <lambdabot> | class Functor f where |
| 23:54:15 | <lambdabot> | fmap :: (a -> b) -> f a -> f b |
| 23:54:17 | <Pseudonym> | But there's no reason why you couldn't have made it work on any Monad. |
| 23:54:30 | <FunctorSalad> | (nevermind that last part... no real argument) |
| 23:54:31 | <Pseudonym> | I like return, actually. |
| 23:54:42 | <monadic_kid> | :t pure |
| 23:54:43 | <lambdabot> | forall a (f :: * -> *). (Applicative f) => a -> f a |
| 23:54:44 | <lament> | it does confuse people, and has no additional merits |
| 23:54:45 | <skorpan> | i don't get it... how could "pure" and "join" be used to define (>>=)? |
| 23:54:46 | <Pseudonym> | Because I can tell people that return in Haskell is implemented as a user function. |
| 23:54:56 | <lament> | heh. |
| 23:54:59 | <Pseudonym> | skorpan: You also need fmap. |
| 23:55:00 | <monadic_kid> | i prefer pure over return |
| 23:55:06 | <Pseudonym> | m >>= k = join (fmap k m) |
| 23:55:07 | <monadic_kid> | pure makes more sense |
| 23:55:11 | <skorpan> | aha |
| 23:55:20 | <skorpan> | monadic_kid: pure was already taken though |
| 23:55:35 | <FunctorSalad> | isn't applicative younger? |
| 23:55:40 | <centrinia> | @src Applicative |
| 23:55:40 | <lambdabot> | class Functor f => Applicative f where |
| 23:55:40 | <lambdabot> | pure :: a -> f a |
| 23:55:40 | <lambdabot> | (<*>) :: f (a -> b) -> f a -> f b |
| 23:55:41 | <skorpan> | is it? |
| 23:55:50 | <FunctorSalad> | not sure |
| 23:56:00 | <monadic_kid> | :t return |
| 23:56:01 | <shepheb> | Applicative is way newer |
| 23:56:01 | <lambdabot> | forall a (m :: * -> *). (Monad m) => a -> m a |
| 23:56:04 | <monadic_kid> | :t pure |
| 23:56:06 | <lambdabot> | forall a (f :: * -> *). (Applicative f) => a -> f a |
| 23:56:10 | <skorpan> | when was applicative added? |
| 23:56:13 | <skorpan> | and when was monad? |
| 23:56:15 | <FunctorSalad> | but I think if it wasn't younger then it'd be a superclass of monad |
| 23:56:15 | <skorpan> | roughly |
| 23:56:19 | <monadic_kid> | :t (<$>) |
| 23:56:20 | <lambdabot> | forall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b |
| 23:56:20 | <Pseudonym> | Monad was added in about 1992. |
| 23:56:21 | <vixey> | In a programming context it's better to define >>= |
| 23:56:22 | <monadic_kid> | :t fmap |
| 23:56:23 | <lambdabot> | forall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b |
| 23:56:23 | <Pseudonym> | Maybe 1994. |
| 23:56:28 | <vixey> | in general that iss more efficient |
| 23:56:31 | <Pseudonym> | It was borrowed from Gofer, anyway. |
| 23:56:37 | <Pseudonym> | Applicative was about... 2001? |
| 23:57:00 | <skorpan> | so i was way off |
| 23:57:08 | <skorpan> | so which is the "newest" addition? |
| 23:57:30 | <Pseudonym> | skorpan: STM |
| 23:57:37 | <Pseudonym> | No, actually, type families. |
| 23:57:46 | <skorpan> | type families? |
| 23:57:47 | <FunctorSalad> | monads in math are way older still, but I guess they didn't use 'return' |
| 23:57:58 | <Pseudonym> | No, they used eta. |
| 23:58:07 | <centrinia> | And join. |
| 23:58:12 | <Pseudonym> | skorpan: So new you haven't heard of them, apparently. |
| 23:58:12 | <FunctorSalad> | that's mu :) |
| 23:58:24 | <Pseudonym> | Right. |
| 23:58:46 | <skorpan> | Pseudonym: i have heard of them, but thought it was some general concept |
| 23:58:47 | <necroforest> | Hmm.. Looks like bash doesn't do lazy evaluation |
| 23:58:56 | <necroforest> | for i in `yes`; do echo $i; done |
| 23:59:16 | <FunctorSalad> | pipes are more or less lazy I think |
| 23:59:25 | <Pseudonym> | skorpan: Type families are a language extension. |
| 23:59:54 | <FunctorSalad> | yes | cat? ;) |
Back to channel and daily index: content-negotiated html turtle