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:01:39 | <bos> | hm |
| 00:01:47 | <Saizan> | Cabal? |
| 00:02:08 | <Saizan> | there are a lot of easy and medium tickets |
| 00:02:12 | <dcoutts> | lots! |
| 00:02:26 | <mreh> | :D |
| 00:02:41 | <hatds> | why does MArray declare both a getNumElements and a getBounds method? |
| 00:03:01 | <roconnor> | @type getBounds |
| 00:03:02 | <lambdabot> | Not in scope: `getBounds' |
| 00:05:08 | <roconnor> | where is getNumElements? |
| 00:05:52 | <hatds> | http://www.haskell.org/ghc/docs/latest/html/libraries/array/src/Data-Array-Base.html#MArray |
| 00:07:08 | <roconnor> | hatds: is that exported? |
| 00:07:11 | <uzytkownik> | Hello. Is it possible to set encoding for handle? |
| 00:07:45 | <roconnor> | uzytkownik: not yet :( |
| 00:07:47 | <roconnor> | soon |
| 00:10:03 | <hatds> | roconnor: hmm, guess not. And you can't define an instance of MArray without defining it and a few others |
| 00:10:45 | <roconnor> | Can we really export only some methods of a class? |
| 00:11:20 | <hatds> | yea |
| 00:11:22 | <hatds> | http://www.haskell.org/ghc/docs/latest/html/libraries/array/src/Data-Array-MArray.html |
| 00:11:32 | <hatds> | apparently |
| 00:11:38 | <roconnor> | that seems wrong |
| 00:11:59 | <hatds> | MArray feels ugly :/ |
| 00:12:07 | <aavogt> | @hoogle ExitException |
| 00:12:07 | <lambdabot> | Control.Exception ExitException :: ExitCode -> Exception |
| 00:12:14 | <roconnor> | hatds: GHC's MArray |
| 00:12:19 | <hatds> | but the functionality of MArray is fine |
| 00:13:08 | <hatds> | I always get type sig problems when I have functions over MArrays |
| 00:13:16 | <roconnor> | so can you make instances of a class if and only if all the methods are exported? |
| 00:13:27 | <roconnor> | how does this work? |
| 00:13:49 | <hatds> | yea, probably class method defaults come into play in general but not in this case |
| 00:13:53 | <SubStack> | I was playing with DiffArray a bit last night |
| 00:14:03 | <SubStack> | nice interface, but I suspect it's very hackish underneath |
| 00:14:06 | <roconnor> | Haskell's module system is so confusing |
| 00:14:18 | <roconnor> | ACTION checks the haskell report |
| 00:14:46 | <aavogt> | SubStack: slow? |
| 00:14:51 | <hatds> | I really don't mind being stuck in IO in exchange for having an unboxed array.. I just want the typeclass and type sigs to play nicely |
| 00:15:19 | <SubStack> | constant time updates and access, can't complain with that |
| 00:15:19 | <roconnor> | I don't see why you have type sig problems |
| 00:15:41 | <roconnor> | > maxBound :: Word |
| 00:15:42 | <lambdabot> | 18446744073709551615 |
| 00:15:52 | <roconnor> | SubStack: ya but you are limited to 18446744073709551615 entries |
| 00:16:13 | <SubStack> | that's fine for what I want to do |
| 00:16:22 | <roconnor> | it's easy to be constant time when your asymtotic behaviour is to crash |
| 00:16:41 | <roconnor> | 18446744073709551615 is good enough for anyone. |
| 00:17:11 | <SubStack> | except for the programmer that has 18446744073709551616 items |
| 00:17:36 | <olsner> | but since 18446744073709551615 is good enough for anyone, such a programmer doesn't exist :) |
| 00:18:16 | <aavogt> | > succ maxBound :: Word |
| 00:18:17 | <lambdabot> | * Exception: Enum.succ{Word}: tried to take `succ' of maxBound |
| 00:18:29 | <roconnor> | even after looking at the Haskell 98 report, I don't understand how class exports work |
| 00:20:12 | <Berengal> | roconnor: Virally |
| 00:20:26 | <roconnor> | no instances are viral |
| 00:20:32 | <roconnor> | classes are different ... I think |
| 00:21:11 | <Berengal> | You might have to import them directly |
| 00:21:21 | <hatds> | what happens when you import a class from somewhere and it's methods from two other places? |
| 00:21:36 | <roconnor> | can you make instances if and only if all class methods are in scope? |
| 00:21:39 | <hatds> | will it let you declare an instnace? |
| 00:21:45 | <colton> | What are some applications written in haskell? |
| 00:21:54 | <roconnor> | colton: darcs |
| 00:22:18 | <roconnor> | colton: ghc |
| 00:22:26 | <roconnor> | colton: agda 2 |
| 00:22:37 | <colton> | Is haskell amenable to programming windowed applications (such as a qt application)? |
| 00:22:41 | <aavogt> | roconnor: I've written instances without all methods in scope |
| 00:23:05 | <Berengal> | colton: gtk2hs is pretty decent. There's a qt library as well, but I haven't used it |
| 00:23:10 | <roconnor> | aavogt: did you have default methods for the rest? |
| 00:23:22 | <Berengal> | Also, FRP libraries |
| 00:23:30 | <Berengal> | (But I haven't touched them at all yet) |
| 00:23:36 | <roconnor> | aavogt: or were you able to define methods that were not in scope? |
| 00:24:29 | <aavogt> | roconnor: there were some methods left undefined, ghc isn't fully haskell 98 compliant in that respect though |
| 00:24:46 | <hatds> | I guess my problem with type signatures is that you can't say this: type MyMat a = IOUArray (Int,Int) a, modifyMat :: MyMat a -> IO (MyMat a) |
| 00:25:55 | <hatds> | well, you can't if you want to use the MArray interface inside modifyMat |
| 00:26:00 | <roconnor> | hatds: why not? |
| 00:26:29 | <hatds> | it can't deduce the MArray context from the empty context |
| 00:26:52 | <roconnor> | But IOUArray is an instance of MArray, right? |
| 00:27:03 | <roconnor> | granted |
| 00:27:13 | <roconnor> | MArray uses multi-parameter types. |
| 00:27:14 | <hatds> | no |
| 00:27:24 | <hatds> | only some types are instances |
| 00:27:34 | <roconnor> | so I could believe there could be some type inference issues. |
| 00:27:52 | <roconnor> | But you should be able to do some type annotations to solve your problems. |
| 00:28:12 | <roconnor> | Could be tricky without Scoped type variables. |
| 00:28:30 | <roconnor> | should be doable, though annoying |
| 00:28:39 | <roconnor> | might as well turn on scoped type variables |
| 00:29:03 | <roconnor> | ah |
| 00:29:07 | <roconnor> | ``If no binding is given for some class method then the corresponding default class method in the class declaration is used (if present); if such a default does not exist then the class method of this instance is bound to undefined and no compile-time error results. |
| 00:29:49 | <hatds> | not what ghc tells me |
| 00:30:01 | <roconnor> | what does ghc tell you? |
| 00:30:04 | <hatds> | ah wait doh |
| 00:30:19 | <hatds> | it just gave a warning, but compiled |
| 00:30:27 | <roconnor> | what warning? |
| 00:30:46 | <hatds> | No explicit method nor default method for `Data.Array.Base.getNumElements' |
| 00:31:04 | <roconnor> | hatds: what new instance are you making? |
| 00:31:15 | <hatds> | I was testing it out |
| 00:31:18 | <roconnor> | hatds: that strikes me as a serious serious warning. |
| 00:31:20 | <roconnor> | ah okay |
| 00:31:54 | <roconnor> | If I would defining HasCale, I'd be inclined to make that an error |
| 00:31:54 | <hatds> | but I am trying to figure out how I want to create matrices that can be row-extended |
| 00:32:41 | <roconnor> | do you do that the same way you make extendable arrays ? |
| 00:32:58 | <wli> | R trees |
| 00:33:25 | <hatds> | by allocating more than you need at the moment? yea |
| 00:34:51 | <roconnor> | I was thinking by using a BraunSeq |
| 00:34:56 | <roconnor> | j/k |
| 00:35:02 | <roconnor> | I don't really know how I'd do it. |
| 00:38:59 | <hatds> | without being able to declare MArray instances without warnings I guess I can't just wrap an (IORef array) |
| 00:42:14 | <Berengal> | Awesome, I just wrote 'do drawForward; turnLeft; drawForward; turnRight; moveForward; drawForward' and it did as I expected |
| 00:42:43 | <Cale> | Berengal: Now write an L-System expander :) |
| 00:42:53 | <Berengal> | Cale: That's the next step |
| 00:43:13 | <Berengal> | (I already have 'withRestoringState' for the recursive steps) |
| 01:39:56 | <Philippa> | y'know, it amuses me that the lack of extensible records is finally biting me hard and /it's about parsing/ |
| 01:40:31 | <Cale> | Interesting :) |
| 01:40:46 | <Philippa> | so, I have this small-but-growing pile of related languages... |
| 01:40:57 | <Philippa> | which means that often I want to specify one in terms of another |
| 01:41:13 | <Philippa> | "Foo is Bar but with operator syntax and the type annotations look like /this/" |
| 01:41:46 | <Philippa> | so what I want is extensible records + open recursion. Or preferably, a module system that does functors and open recursion |
| 01:41:56 | <Philippa> | but the record encoding's viable enough |
| 01:42:00 | <ivanm> | Philippa: what's the significance of parsing when talking about extensible records? |
| 01:42:23 | <Philippa> | ivanm: that's my use case |
| 01:42:35 | <ivanm> | then why the emphasis? |
| 01:42:35 | <Philippa> | and it's not one where you'd expect the lack of extensible records to be pissing you off |
| 01:42:52 | <jmcarthur> | dang, just when i settled down to play with some statistics, the shootout is down :( |
| 01:43:01 | <Philippa> | ivanm: Cale gets it |
| 01:43:11 | <Philippa> | well, at least the amusement |
| 01:43:15 | <ivanm> | what do you mean by "extensible" records? able to give it more fields? |
| 01:43:23 | <Philippa> | Cale: you see where I'm coming from in terms of why I want it? |
| 01:43:32 | <Cale> | I think so... |
| 01:43:33 | <pumpkin> | 面白い |
| 01:43:34 | <Philippa> | ivanm: plus structural subtyping on them, yeah |
| 01:44:09 | <ivanm> | "structural subtyping"? |
| 01:44:45 | <Philippa> | ivanm: based on the fields and their names. As opposed to nominal subtyping, as practiced by langs like Java |
| 01:45:21 | <ivanm> | I didn't know Java had records... |
| 01:45:21 | <Philippa> | ivanm: seems to me that you're really not at all familiar with the issue or its history here? |
| 01:45:27 | <ivanm> | Philippa: nope ;-) |
| 01:45:36 | <ivanm> | I just use haskell, I"m not a language theoretician :p |
| 01:46:21 | <Philippa> | *nod*. Your tone initially read a little "why should this bother you?", is all |
| 01:46:49 | <ivanm> | more "why should this bother you, in terms of what exactly _is_ this?" :p |
| 01:48:05 | <Philippa> | yeah, well. Start with the latter first and you're less likely to get LARTed :-) It's a fairly infamous issue with Haskell, in that it's something the original committee deliberately ducked the issue on because the research wasn't done and we've been stuck with a system that arguably even langs like C would be embarrassed by |
| 01:53:21 | <ivanm> | Philippa: I know that much (that the current record syntax is a compromise in terms of something that no-one hates too much) |
| 01:53:44 | <Philippa> | no, that's not what it is |
| 01:54:14 | <ivanm> | :o then what _is_ it? |
| 01:54:23 | <Philippa> | it's a legacy system - not just syntax - that's there because there's a lot of options on where to go from there |
| 01:54:30 | <Philippa> | and /then/ nobody's happy they know the right way to go |
| 01:54:35 | <Philippa> | so it's not that nobody hates it |
| 01:54:42 | <Philippa> | it's that there's no agreement on a successor |
| 01:54:57 | <ivanm> | well, s/hate/disagrees with/ |
| 01:54:58 | <SamB> | I still say we should just pick one at random and try it ... |
| 01:55:00 | <Philippa> | tbh, I was pretty POed that someone waded in with some really big stuff against the lexically scoped labels setup |
| 01:55:16 | <Philippa> | ACTION for now wants some agreed sugar in place with user-supplied record systems behind it |
| 01:55:23 | <Philippa> | given that the lang's powerful enough for us to do that |
| 01:55:42 | <Philippa> | mostly that means an agreed-on encoding of record kinds and a few other bits and pieces |
| 01:55:43 | <ivanm> | "lexically scoped labels"? |
| 01:56:01 | <Philippa> | ivanm: there was a paper. If you don't know what extensible records are, this is going to take a lot of explaining... |
| 01:56:12 | <ivanm> | heh, OK, I"ll look up the paper later |
| 02:02:06 | <Cale> | Philippa: I think I would like something like Daan's proposal, but with rather different-looking syntax |
| 02:02:19 | <Cale> | (something more lens-like) |
| 02:02:41 | <Philippa> | I think I've managed to miss the preferred syntax for lenses |
| 02:02:43 | <Philippa> | (which is annoying!) |
| 02:03:12 | <pumpkin> | is there a type for native-word-size signed integers? |
| 02:03:34 | <Cale> | Oh, to be clear, I mean lens-like in the sense of the technique for referring to fields of records, rather than the things that go along with bananas and barbed wire :) |
| 02:04:05 | <Cale> | So field labels would have various operations defined on them to turn them into polymorphic functions for acting on records |
| 02:05:13 | <Cale> | get 'myLabel :: {'myLabel :: t | rho} -> t |
| 02:05:15 | <hatds> | if I have f x y = let n = expensivefunc x in n*y and I partially apply f to one argument, would the resulting function still recompute 'expensivefunc x' for every y? |
| 02:05:34 | <Philippa> | *nod* |
| 02:05:37 | <Cale> | (I'm not sure if that syntax at the type level is really the best thing either) |
| 02:06:00 | <ivanm> | hatds: yup |
| 02:06:10 | <Philippa> | I'm convinced it's not, but hey |
| 02:06:15 | <ivanm> | it's partial application, not partial evaluation |
| 02:06:16 | <Cale> | hatds: You can try it, but I think in GHC even with optimisations the answer is yes. |
| 02:06:19 | <Cale> | However... |
| 02:06:30 | <Cale> | f x = let n = expensivefunc x in \y -> n*y |
| 02:06:34 | <Cale> | Is a different matter |
| 02:06:59 | <Philippa> | (I'd really like something flexible enough to let me define my own row kinds |
| 02:07:03 | <Philippa> | ) |
| 02:07:18 | <Saizan_> | your own row kinds? |
| 02:07:36 | <Cale> | That would be nice. |
| 02:07:37 | <Philippa> | er, row types even |
| 02:07:39 | <Philippa> | but yeah |
| 02:07:53 | <Philippa> | Saizan_: imagine you wanted, say, extensible variants /with introspection/ or something |
| 02:08:55 | <Saizan_> | uhm, i don't really see it |
| 02:08:58 | <Cale> | Wait, row types? |
| 02:09:11 | <Cale> | Or did you really mean kinds after all? :) |
| 02:09:20 | <Philippa> | it's 3am, quite possibly |
| 02:09:20 | <Saizan_> | so like being able to define an ADT and declare it extensible? |
| 02:09:56 | <Philippa> | Saizan_: more like... being able to define extensible record or variants yourself, including with a /different definition to the usual one/ |
| 02:10:22 | <Cale> | I do think there should at least be some kind of support for variants. |
| 02:10:32 | <Saizan_> | ah, i see |
| 02:10:47 | <Cale> | Surely if we're going to do extensible products, not doing extensible sums as well would be a shame. |
| 02:11:02 | <Philippa> | Saizan_: so you could define eg a heap for some abstract machine you're writing with labelled memory locations :-) |
| 02:11:06 | <Philippa> | (or even just a stack...) |
| 02:11:41 | <Philippa> | (Haskell: the world's finest assembler ;-) |
| 02:11:43 | <Cale> | hmm |
| 02:11:51 | <mib_lpabdoxp> | Is there a Haskell syntax for specifying strings containing multiple lines? |
| 02:11:56 | <Cale> | I'm not sure how the polymorphic recursion would work out there :) |
| 02:12:18 | <Saizan_> | i see a problem with how you'd get the values implemented |
| 02:12:19 | <Cale> | mib_lpabdoxp: \n will put a newline into a string explicitly |
| 02:12:45 | <Cale> | PetRat: Usually for the sake of prettiness, I use unlines |
| 02:12:46 | <PetRat> | Cale: I'm thinking of the Python triple quote syntax.. |
| 02:12:47 | <Saizan_> | if you can provide your own definition for extensibility, i mean |
| 02:12:50 | <Philippa> | Cale: so long as you can be polymorphic in what's behind you, you ought to be okay |
| 02:12:57 | <ivanm> | PetRat: or else use "hi\<next line>\bye" |
| 02:13:01 | <mike-burns> | PetRat: http://www.haskell.org/haskellwiki/Poor_Man%27s_Heredoc_in_Haskell |
| 02:13:03 | <Philippa> | Saizan_: yeah? |
| 02:14:28 | <PetRat> | I guess I'll try unlines |
| 02:14:30 | <Cale> | There are a couple quasiquoter library implementations of here-documents on Hackage |
| 02:14:54 | <Saizan_> | Philippa: e.g. with row types you basically extend unification to cope with reordering of labels, and then the implementation has to deal with values accordingly |
| 02:14:54 | <ray> | what are their names? |
| 02:15:07 | <Saizan_> | Philippa: and it's not so easy to make that efficient i gather |
| 02:15:12 | <Cale> | http://hackage.haskell.org/packages/archive/Interpolation/0.2.4/doc/html/Data-String-Interpolation.html |
| 02:15:30 | <mmorrow> | , let x = [0..3] in [$here|[0..3] is $([0..3]) and $(x)|] |
| 02:15:32 | <lunabot> | "[0..3] is [0,1,2,3] and [0,1,2,3]" |
| 02:15:49 | <Saizan_> | Philippa: but if you can define your own criteria for equality of extensible types how does the implementation of values catch up? |
| 02:16:21 | <dancor> | i'm using decodeFile to read a value then encodeFile to write to the same file. there is a 'file busy' error due to laziness, what's the best way to fix |
| 02:16:24 | <Cale> | http://hackage.haskell.org/packages/archive/interpolatedstring-qq/0.1/doc/html/Text-InterpolatedString-QQ.html |
| 02:16:30 | <Philippa> | you'd need a) concrete implementation types somewhere, b) coercions and classes |
| 02:16:46 | <Philippa> | odds are eventually you'd want c) piles of rewrite rules, but that's less immediately a problem |
| 02:17:02 | <Philippa> | my assembler-of-doom can cope, for example |
| 02:17:18 | <mmorrow> | dancor: you might have to close and reopen the file in between? |
| 02:17:26 | <mmorrow> | s/file/Handle/ |
| 02:17:28 | <ray> | looks like it could be useful |
| 02:17:48 | <dancor> | i guess i can't use the wrappers i've been using then |
| 02:17:55 | <mmorrow> | dancor: doing that with shell redirection gets you an empty file.. |
| 02:18:13 | <mmorrow> | cat foo.txt > foo.txt |
| 02:18:28 | <Philippa> | Saizan_: to put it another way, some things we're willing to wait for :-) |
| 02:18:42 | <Saizan_> | Philippa: heh, i see :) |
| 02:19:12 | <mmorrow> | heh, cat is too smart for that.. but this fools it |
| 02:19:15 | <Philippa> | Saizan_: if you can have a typeful assembler, you can put up with it being O(N^2) in the number of known memory locations, no? |
| 02:19:17 | <mmorrow> | cat foo.txt | cat > foo.txt |
| 02:19:19 | <dancor> | A="`cat foo`"; echo lol"$A" > foo |
| 02:19:28 | <dancor> | i'm using a variable in haskell as well you know :) |
| 02:19:28 | <Saizan_> | Philippa: it seems like a way might be for GHC to allow relational extension of the "~" equality constraint |
| 02:20:10 | <Philippa> | Saizan_: I don't think you'd even need that. Just lotsa class/instance stuff |
| 02:20:36 | <Philippa> | I mean, OOHaskell already has to do this stuff, no? |
| 02:20:46 | <Saizan_> | yes |
| 02:21:33 | <luqui> | allowing powerful said extension while maintaining decidable typechecking would be a challenge |
| 02:21:47 | <Saizan_> | but i'd like something less scary than that much of type hackery :) |
| 02:22:17 | <Philippa> | it's probably worth re-encoding in type functions, see how that goes |
| 02:24:02 | <dancor> | my problem here makes me think it would be nice to allow ! in more places |
| 02:24:03 | <Saizan_> | i wonder if that's possible |
| 02:25:05 | <luqui> | dancor, you mean like strict core? |
| 02:25:46 | <dancor> | luqui: idk.. |
| 02:26:05 | <pumpkin_> | mmorrow: do you know if there's a native-sized signed word type? |
| 02:26:15 | <luqui> | dancor, see the recent paper "types are calling conventions" |
| 02:26:21 | <luqui> | it's a nice read |
| 02:26:23 | <dancor> | ok |
| 02:26:57 | <dancor> | i want encodeFile binFilename (!val) to evaluate val before running encodeFile |
| 02:27:03 | <Saizan_> | dancor: i'd read the file in as a strict bytestring probably, or rnf on the result of decodeFile |
| 02:27:15 | <luqui> | dancor, oh, i thought you meant on types |
| 02:27:33 | <luqui> | dancor, like, encodeFile binFilename $! val |
| 02:27:38 | <Saizan_> | dancor: you can write rnf val `seq` encodeFile binFilename val |
| 02:27:44 | <luqui> | > const 4 $! undefined |
| 02:27:45 | <lambdabot> | * Exception: Prelude.undefined |
| 02:30:46 | <roconnor> | Anyone know why functions were part of the Eval class in Haskell 1.4? |
| 02:33:02 | <Saizan_> | so that you could drive topologists mad? |
| 02:33:18 | <roconnor> | that's the only reason I can think of. |
| 02:33:42 | <Cale> | hm? |
| 02:35:53 | <Philippa> | debugging? |
| 02:36:07 | <roconnor> | does it help for debugging? |
| 02:36:08 | <dancor> | odd, reading file strictly works but forcing evaluation with $! or even print doesn't |
| 02:36:27 | <Philippa> | potentially, as it lets you poke inside evaluation order with HOFs a little |
| 02:36:38 | <dancor> | is it possible that decodeFile leaves the file open even after the decoded result is fully evaluated |
| 02:36:38 | <Cale> | Forcing the evaluation of a function is useful |
| 02:36:42 | <Philippa> | think of it as a bit like tracing a join in a monad |
| 02:36:49 | <roconnor> | Cale: explain |
| 02:37:00 | <Saizan_> | dancor: which version of bytestring? there was a bug where it didn't close the handle promptly |
| 02:37:05 | <Cale> | Consider something like... well, we had an example a little while back... |
| 02:37:08 | <Philippa> | right, if you'd want to do it with SOFs then why not HOFs? |
| 02:37:09 | <Cale> | f x = let n = expensivefunc x in \y -> n*y |
| 02:37:25 | <roconnor> | SOFs? |
| 02:37:29 | <dancor> | Saizan_: 0.9.1.4 |
| 02:37:35 | <Philippa> | er, brainfade |
| 02:37:38 | <Philippa> | FOFs |
| 02:37:41 | <Philippa> | (First...) |
| 02:37:49 | <Cale> | hmm... |
| 02:37:56 | <Saizan_> | dancor: ah, ok |
| 02:38:34 | <Cale> | Well, that's not a good example. |
| 02:38:35 | <roconnor> | Philippa: I don't want seq to apply to any functions HOF or FOF. Only to plain data. |
| 02:38:38 | <dancor> | could be Binary's fault as well |
| 02:39:28 | <roconnor> | Cale: do case analysis on n before picking a function to return. |
| 02:39:29 | <Cale> | I would expect that seq puts functions into WHNF. |
| 02:39:45 | <Philippa> | roconnor: POD which can be the result of... |
| 02:40:02 | <roconnor> | a result of anything |
| 02:40:15 | <Cale> | So if you partially apply things, it will actually do the work of substituting parameters into the body. |
| 02:40:52 | <roconnor> | Cale: I don't think that amounts to any work in GHC's implementation. |
| 02:41:06 | <Cale> | It can result in memory being freed, I'm pretty sure. |
| 02:41:23 | <Cale> | Imagine if you have a function which pattern matches on a pair, but only the first component of the pair occurs in the body |
| 02:41:25 | <roconnor> | Cale: I'd like to see an example. |
| 02:41:40 | <Cale> | Or a list, but only the first element of the list is used, and the remainder discarded. |
| 02:41:45 | <Saizan_> | if you had something like f x = case x of .. -> \y -> ..; .. -> \y -> ..; then seq'ing (f x) would reduce that case expression |
| 02:42:01 | <roconnor> | Saizan_: that I buy |
| 02:42:28 | <roconnor> | ACTION sighs |
| 02:42:36 | <roconnor> | I can almost see that as being useful |
| 02:42:47 | <roconnor> | Although I really clear practical example would still be nice. |
| 02:42:53 | <roconnor> | a really clear |
| 02:43:04 | <Cale> | I can only think of clear impractical examples ;) |
| 02:43:36 | <roconnor> | Saizan_: does pattern matching translate into code like that? |
| 02:43:36 | <Saizan_> | i can only imagine you could solve a space leak or something like that |
| 02:43:52 | <Cale> | let f (x,y) z = x^2 + z in Just (f (5, somethingMemoryExpensive)) |
| 02:43:53 | <roconnor> | Saizan_: solving a space leak would make me happy |
| 02:44:21 | <Cale> | cf. let f (x,y) z = x^2 + z in Just $! f (5, somethingMemoryExpensive) |
| 02:44:22 | <roconnor> | Cale: no good. |
| 02:44:31 | <roconnor> | oh |
| 02:44:47 | <roconnor> | has soemthingMemoryExpensive already been evaluated, making it memory expensive? |
| 02:44:52 | <Cale> | yes |
| 02:44:54 | <roconnor> | hmm |
| 02:45:24 | <Saizan_> | ACTION wonders what ghc does there |
| 02:46:10 | <Saizan_> | i'm afraid it'll wait another parameter to do any reduction |
| 02:46:21 | <Cale> | Saizan_: even if seq is applied? |
| 02:46:23 | <Philippa> | it might do :-( |
| 02:46:54 | <Philippa> | though I don't think it would - it'd take a further transformation in the core to enable that, wouldn't it? |
| 02:46:56 | <SamB> | the best way to test would involve somehow sticking a _|_ in there, wouldn't it ...? |
| 02:47:06 | <Saizan_> | Cale: yeah, but i'm just guessing, maybe f (x,y) = \z -> will work |
| 02:47:20 | <Cale> | Saizan_: Yes, if not this, then surely that would have to. |
| 02:47:53 | <roconnor> | you are saying that f (x,y) = \z and f (x,y) z = would behave diffently under seq in GHC? |
| 02:48:31 | <Cale> | I forget what exactly it was, but there's something confusing of that sort. |
| 02:48:45 | <Cale> | But I don't think it's that. |
| 02:49:36 | <Cale> | Certainly, if you have a function RHS which consists of a let/in, then moving a parameter to inside of the 'in' expression can make a difference. |
| 02:50:23 | <roconnor> | > let f (x,y) z = x^2 + z in isJust (Just (f undefined)) |
| 02:50:24 | <lambdabot> | True |
| 02:50:29 | <roconnor> | > let f (x,y) z = x^2 + z in isJust (Just $! (f undefined)) |
| 02:50:31 | <lambdabot> | True |
| 02:50:42 | <roconnor> | :^) |
| 02:50:48 | <Saizan_> | http://haskell.org/haskellwiki/GHC:FAQ#When_can_I_rely_on_full_laziness.3F <- related |
| 02:51:24 | <Cale> | Compare the performance of: |
| 02:51:25 | <Cale> | let f x y = let z = product [1..x] in z + y in map (f 10000) [1,2,3,4,5] |
| 02:51:30 | <Cale> | let f x = let z = product [1..x] in \y -> z + y in map (f 10000) [1,2,3,4,5] |
| 02:51:31 | <Saizan_> | > let f (x,y) = \z -> x^2 + z in isJust (Just $! (f undefined)) |
| 02:51:32 | <lambdabot> | * Exception: Prelude.undefined |
| 02:51:46 | <Cale> | Nice. |
| 02:51:48 | <dancor> | my strictness problem was actually a problem with Just a vs a in the type being read |
| 02:51:51 | <roconnor> | AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!! |
| 02:51:59 | <roconnor> | that's it |
| 02:52:02 | <roconnor> | I'm through with GHC |
| 02:52:02 | <dancor> | very tricky.. |
| 02:52:05 | <Cale> | hehe |
| 02:52:23 | <Cale> | I think Haskell may actually be specified that way. |
| 02:52:34 | <roconnor> | really? |
| 02:52:52 | <roconnor> | in that case I'm through with Haskell |
| 02:52:57 | <Cale> | At least as far as the semantics goes. |
| 02:53:16 | <roconnor> | ACTION sudo aptitude install hugs |
| 02:53:42 | <Saizan_> | the report makes a distinction between \x y -> and \x -> \y -> ? |
| 02:54:00 | <Cale> | Data.Maybe> let f (x,y) = \z -> x^2 + z in isJust (Just $! (f undefined)) |
| 02:54:01 | <Cale> | Program error: Prelude.undefined |
| 02:54:01 | <Cale> | Data.Maybe> let f (x,y) z = x^2 + z in isJust (Just $! (f undefined)) |
| 02:54:01 | <Cale> | True |
| 02:54:09 | <Cale> | It happens in hugs too :) |
| 02:54:26 | <roconnor> | arrrrrrrrrgggggggghhhhhhhhhhhhh!!! |
| 02:54:42 | <dancor> | isn't that what $! means |
| 02:54:58 | <Cale> | dancor: Note that $! occurs in both |
| 02:55:11 | <dancor> | oooooh |
| 02:55:12 | <Cale> | dancor: The only difference is which side of the = the parameter occurs on. |
| 02:55:41 | <Cale> | This is a very old complaint. |
| 02:55:51 | <roconnor> | it is? |
| 02:56:03 | <Cale> | I'm not exactly sure why nothing has been done about it. |
| 02:56:07 | <Cale> | Yeah... |
| 02:56:26 | <SamB> | what #? |
| 02:56:32 | <Saizan_> | the "types are calling conventions" paper deals with this, i think? |
| 02:56:48 | <roconnor> | Now I want to find where it says this in the haskell report |
| 02:57:52 | <ivanm> | roconnor: cya, we'll miss you |
| 02:57:53 | <ivanm> | ;-) |
| 02:58:17 | <hatds> | since the report doesn't specify dynamic semantics, would it talk about seq? |
| 02:58:27 | <Saizan_> | however when compiled functions like f should get inlined, so you won't see the difference |
| 02:58:53 | <Saizan_> | it doesn't have a formal semantics, but it does specify some |
| 02:58:59 | <roconnor> | Saizan_: I thought everyone here was about optimizations not changing semantics! |
| 02:59:42 | <Saizan_> | heh, right :) |
| 02:59:46 | <roconnor> | Cale: are you suggesting this is a bug in both GHC and Hugs? |
| 02:59:59 | <hatds> | no, it's correct right? |
| 03:00:01 | <Cale> | Oh, interesting, it could actually be a bug. The report seems to contradict it. |
| 03:00:08 | <hatds> | where? |
| 03:00:16 | <Cale> | Translation: |
| 03:00:17 | <Cale> | The general binding form for functions is semantically equivalent to the equation (i.e. simple pattern binding): |
| 03:00:17 | <Cale> | x = \ x1 ... xk -> case (x1, ..., xk) of |
| 03:00:17 | <Cale> | (p11, ..., p1k) match1 |
| 03:00:17 | <Cale> | ... |
| 03:00:18 | <Cale> | (pn1, ..., pnk) matchn |
| 03:00:20 | <Cale> | where the xi are new identifiers. |
| 03:00:58 | <Saizan_> | does it also say that \ x1 .. xk -> is the same as \ x1 -> ... \ xk -> ? |
| 03:01:09 | <roconnor> | Cale: ah, I was about to paste that |
| 03:02:25 | <Cale> | Saizan_: oh, good point |
| 03:02:53 | <Cale> | > let f = \(x,y) z -> x^2 + z in isJust (Just $! (f undefined)) |
| 03:02:54 | <lambdabot> | True |
| 03:02:59 | <Cale> | :) |
| 03:03:04 | <Cale> | > let f = \(x,y) -> \z -> x^2 + z in isJust (Just $! (f undefined)) |
| 03:03:05 | <lambdabot> | * Exception: Prelude.undefined |
| 03:04:30 | <Cale> | Translation: |
| 03:04:30 | <Cale> | The following identity holds: |
| 03:04:30 | <Cale> | \ p1 ... pn -> e = \ x1 ... xn -> case (x1, ..., xn) of (p1, ..., pn) -> e |
| 03:04:30 | <Cale> | where the xi are new identifiers. |
| 03:04:35 | <Cale> | aha |
| 03:04:39 | <Cale> | So there you have it |
| 03:05:11 | <roconnor> | Cale: that doesn't say anything about if \x -> \y -> foo is the same as \x y -> foo |
| 03:05:24 | <roconnor> | Cale: that is only talking about patterns in lambda bindings |
| 03:06:01 | <roconnor> | or does this have some bearing on the issue at hand |
| 03:06:05 | <Cale> | roconnor: It means that multiple parameter lambdas of this sort act semantically as if they take one parameter which is a tuple |
| 03:06:30 | <roconnor> | Cale: I think you are misreading that. |
| 03:06:34 | <Cale> | Er, hmm, perhaps |
| 03:06:36 | <Cale> | Yeah. |
| 03:07:57 | <roconnor> | but I see no evidence that \x y -> foo is the same as \x -> \y -> foo |
| 03:08:24 | <roconnor> | It does seem that formally \x y -> foo is *one* lambda expressions |
| 03:08:27 | <roconnor> | It does seem that formally \x y -> foo is *one* lambda expression |
| 03:09:26 | <hatds> | does the report specify the behavior of seq? |
| 03:09:48 | <roconnor> | seq _|_b = _|_ |
| 03:09:49 | <roconnor> | seq a b = b, if a /=_|_ |
| 03:09:56 | <roconnor> | that's all it says |
| 03:10:23 | <roconnor> | now I wish Haskell had formal semantics |
| 03:10:31 | <roconnor> | so I could say GHC and Hugs are wrong. |
| 03:10:37 | <dibblego> | hpaste broek |
| 03:10:45 | <SamB> | roconnor: you don't need those to do that |
| 03:10:52 | <Saizan_> | @hpaste |
| 03:10:52 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 03:10:56 | <roconnor> | I think I'd argue at this point that the Haskell Report is underspecified on this issue. |
| 03:10:59 | <SamB> | you can, in fact, say that hugs, GHC, *and* Haskell 98 are wrong |
| 03:11:04 | <SamB> | all at the same time! |
| 03:11:05 | <Saizan_> | mmorrow: ping, hpaste is broken! |
| 03:11:36 | <roconnor> | SamB: I don't think H'98 actually says what these two programs are supposed to do. |
| 03:12:32 | <SamB> | roconnor: well, that could be a way in which it is wrong |
| 03:12:37 | <SamB> | or then again maybe it isn't! |
| 03:12:38 | <roconnor> | true |
| 03:12:54 | <roconnor> | It talks about _|_ for function types without really saying what the CPO is. |
| 03:13:15 | <roconnor> | and how haskell functions relate to that CPO |
| 03:20:37 | <roconnor> | I guess the question is, are \a b -> foo and \a -> \b -> foo different members of the type (a -> b -> c). |
| 03:20:49 | <roconnor> | I think the report doesn't answer this question. |
| 03:21:01 | <SamB> | I was always under the impression that those were supposed to be identical ... |
| 03:21:42 | <roconnor> | one certainly is told that a lot; however most of what we are told turns out to be false in the presence of seq. |
| 03:23:19 | <roconnor> | actually what is worse is that this means that ((\a b -> foo) 5) and (\b -> let a = 5 in foo) are different in GHC. |
| 03:23:20 | <Cale> | Is it really false? |
| 03:23:31 | <roconnor> | is what false? |
| 03:23:40 | <Cale> | "however most of what we are told turns out to be false in the presence of seq." |
| 03:23:59 | <roconnor> | no it's true. That's why I said that quote. :) |
| 03:24:55 | <roconnor> | Cale: I don't think I understood you |
| 03:25:22 | <roconnor> | we are often told that \a b -> foo and \a -> \b -> foo are the same, and this is false because of seq. |
| 03:25:28 | <Cale> | Perhaps I misunderstood. Did you find an actual mistake in the report? |
| 03:25:29 | <Cale> | ah |
| 03:25:35 | <Saizan_> | well, seq is only a way to see this, you could observe the behaviour by differences in performance |
| 03:25:58 | <roconnor> | ACTION cannot observe preformance :P |
| 03:26:08 | <Cale> | I think that perhaps it's actually for the best, given that we have seq, that (\x y -> ...) and (\x -> \y -> ...) are different |
| 03:26:25 | <Cale> | It gives us the most freedom of expression in that regard. |
| 03:26:49 | <Saizan_> | it also forces us to think which is best to use |
| 03:26:58 | <Saizan_> | fsvo forces |
| 03:27:15 | <dibblego> | what example shows their difference? |
| 03:27:29 | <Cale> | > let f (x,y) z = x^2 + z in isJust (Just $! (f undefined)) |
| 03:27:30 | <lambdabot> | True |
| 03:27:32 | <Cale> | > let f (x,y) = \z -> x^2 + z in isJust (Just $! (f undefined)) |
| 03:27:32 | <lambdabot> | * Exception: Prelude.undefined |
| 03:27:56 | <dibblego> | ah of course |
| 03:28:05 | <Cale> | or... |
| 03:28:12 | <Cale> | > let f = \(x,y) z -> x^2 + z in isJust (Just $! (f undefined)) |
| 03:28:13 | <lambdabot> | True |
| 03:28:17 | <Cale> | > let f = \(x,y) -> \z -> x^2 + z in isJust (Just $! (f undefined)) |
| 03:28:19 | <lambdabot> | * Exception: Prelude.undefined |
| 03:28:27 | <roconnor> | I'd like to see some formal semantics for haskell ... |
| 03:28:34 | <Cale> | roconnor: It used to exist... |
| 03:28:54 | <roconnor> | before seq? |
| 03:28:59 | <Cale> | Probably. |
| 03:29:01 | <Cale> | There's one for a very early Haskell, iirc. |
| 03:29:02 | <roconnor> | :) |
| 03:29:14 | <Cale> | But it went out of date and wasn't maintained. |
| 03:29:29 | <Saizan_> | without typeclasses? |
| 03:29:46 | <Cale> | http://haskell.org/haskellwiki/Language_and_library_specification |
| 03:29:51 | <Cale> | very bottom of that page |
| 03:30:25 | <roconnor> | am I talking about dynamic or static semantics? |
| 03:31:19 | <Saizan_> | dynamic |
| 03:31:30 | <roconnor> | hmm |
| 03:31:36 | <Saizan_> | static is the type system, no? |
| 03:31:45 | <roconnor> | the abstract says the dynamic semantics come after the static semantics. |
| 03:31:50 | <Cale> | Actually, the two cover a lot of the same ground. |
| 03:31:52 | <roconnor> | this could be in either one. |
| 03:32:03 | <roconnor> | but I should start with the static semantics |
| 03:32:20 | <Cale> | seq is not mentioned |
| 03:32:22 | <roconnor> | it might "statically" translate \a b -> into \a -> \b -> |
| 03:32:46 | <Saizan_> | uhm, that's true |
| 03:33:11 | <Saizan_> | considering the target language might not have n-ary lambdas |
| 03:33:55 | <Cale> | Somehow I doubt either will give a clear answer, as seq wasn't around |
| 03:33:58 | <jbauman> | that's generally different from the traditional "static" semantics, isn't it? |
| 03:34:43 | <Cale> | and case expressions can't force the evaluation of functions... |
| 03:34:55 | <Cale> | at least, I don't think they can |
| 03:35:16 | <SamB> | Cale: you can't case over a function, no! |
| 03:35:34 | <Saizan_> | i guess they don't mention strict fields either? |
| 03:35:35 | <Cale> | Well, you can write case foo x of f -> ... |
| 03:35:46 | <SamB> | well, sure |
| 03:35:48 | <SamB> | but it doesn't DO anything |
| 03:35:50 | <Cale> | Where maybe foo has two parameters |
| 03:35:57 | <Cale> | right, well, we hope :) |
| 03:39:31 | <roconnor> | > case const 5 of {_ -> 7} |
| 03:39:32 | <lambdabot> | 7 |
| 03:39:37 | <roconnor> | :) |
| 03:40:06 | <roconnor> | > case const 5 of {f -> 7} |
| 03:40:07 | <lambdabot> | 7 |
| 03:40:10 | <roconnor> | > case const 5 of {f -> f 7} |
| 03:40:11 | <lambdabot> | 5 |
| 03:40:21 | <roconnor> | ACTION shakes his head |
| 03:40:26 | <roconnor> | oh |
| 03:40:37 | <roconnor> | I guess that case expression is translated away |
| 03:41:27 | <roconnor> | > case const 5 of {f -> f 7; g -> g 8} |
| 03:41:28 | <lambdabot> | 5 |
| 03:41:36 | <roconnor> | > case id of {f -> f 7; g -> g 8} |
| 03:41:37 | <lambdabot> | 7 |
| 03:41:49 | <Cale> | > case undefined of f -> 1 |
| 03:41:50 | <lambdabot> | 1 |
| 03:42:01 | <Cale> | > case undefined :: Integer -> Integer of f -> 1 |
| 03:42:02 | <lambdabot> | 1 |
| 03:42:03 | <roconnor> | > case undefined of {f -> f 7; g -> g 8} |
| 03:42:04 | <lambdabot> | * Exception: Prelude.undefined |
| 03:42:07 | <rick_2047> | can i do something like this --> args <- getArgs read (args !! 0) |
| 03:42:31 | <roconnor> | Cale: strange |
| 03:42:42 | <gwern> | rick_2047: a newline between getArgs and read? |
| 03:42:46 | <rick_2047> | ya |
| 03:42:48 | <rick_2047> | gwern, ya |
| 03:42:51 | <gwern> | seems reasonable |
| 03:42:52 | <Cale> | rick_2047: args <- fmap (head . read) getArgs |
| 03:42:59 | <Cale> | er |
| 03:43:04 | <gwern> | as long as your read is being forced to an appropriate type |
| 03:43:14 | <Cale> | not quite reasonable, because you'd have to be reading an IO action |
| 03:43:30 | <rick_2047> | Cale, ya thats what the error says |
| 03:43:31 | <gwern> | Cale: don't confuse beginners with your fmap stuff! |
| 03:43:37 | <rick_2047> | Cale, so how do i fix it?? |
| 03:43:41 | <Cale> | but you can write |
| 03:43:45 | <gwern> | Cale: and he has the right idea, he just needs the right incantation of monad operators |
| 03:43:46 | <ray> | don't confuse beginners with your fmap-free stuff! |
| 03:43:47 | <Cale> | args <- getArgs |
| 03:43:57 | <ray> | haskell is about FUNCTORS |
| 03:43:58 | <Cale> | let firstArg = read (args !! 0) |
| 03:44:03 | <gwern> | every beginner starts with problems getting the monads just right |
| 03:44:07 | <Cale> | ... something which does something with firstArg ... |
| 03:44:17 | <gwern> | lordy how many errors I ran into in the io monad |
| 03:44:31 | <rick_2047> | wait wait i will give u my code |
| 03:44:37 | <rick_2047> | and u tell the fix only then |
| 03:44:41 | <Cale> | rick_2047: Each line of an IO do-block must evaluate to an IO action |
| 03:45:03 | <Cale> | rick_2047: If you want to print the first arg for example, you could write print firstArg after that |
| 03:45:32 | <Cale> | But firstArg itself is not going to be an IO action -- it'll be an integer, or whatever type you want to parse using read. |
| 03:45:46 | <rick_2047> | Cale, my aim is to make a program which accepts two numbers from command line and add them |
| 03:45:49 | <Cale> | (There's no instance of Read for IO actions) |
| 03:45:53 | <Cale> | okay |
| 03:46:04 | <jbauman> | rick_2047, what do you want to do with them once you add them? |
| 03:46:15 | <rick_2047> | jbauman, just display them |
| 03:46:22 | <gwern> | jbauman: oh nothing. so it'll compile down to a really small executable! |
| 03:46:37 | <jbauman> | gwern, it still has to fail if it doesn't have enough args |
| 03:46:42 | <jbauman> | that should bloat it a bit |
| 03:46:43 | <Cale> | main = do [x,y] <- getArgs; print (read x + read y) |
| 03:46:53 | <gwern> | ACTION didn't say it'd compile down to the smallest legal ELF binary |
| 03:47:01 | <rick_2047> | http://pastebin.com/m3992eef4 |
| 03:47:07 | <rick_2047> | this is what i did initially |
| 03:47:24 | <Cale> | rick_2047: right, that last line is a number |
| 03:47:26 | <ray> | hmm i don't have the smallest legal ELF binary in my goodies directory |
| 03:47:31 | <Cale> | rick_2047: which is unacceptable |
| 03:47:35 | <jbauman> | rick_2047, see, that doesn't actually attempt to print anything |
| 03:47:45 | <Cale> | rick_2047: You want to tell it to do something with that number :) |
| 03:47:55 | <Cale> | (like print it) |
| 03:48:03 | <rick_2047> | Cale, ok lemme try |
| 03:48:28 | <roconnor> | > case undefined :: Bool -> Bool of {f -> 7; g -> 8} |
| 03:48:29 | <lambdabot> | 7 |
| 03:48:40 | <roconnor> | > case undefined :: Bool of {f -> 7; g -> 8} |
| 03:48:41 | <lambdabot> | 7 |
| 03:48:48 | <Cale> | roconnor: The first pattern is irrefutable and will always match |
| 03:48:51 | <roconnor> | > case undefined :: () of {f -> 7; g -> 8} |
| 03:48:52 | <lambdabot> | 7 |
| 03:48:57 | <roconnor> | > case undefined of {f -> 7; g -> 8} |
| 03:48:58 | <lambdabot> | 7 |
| 03:49:23 | <roconnor> | ah oops |
| 03:49:33 | <gwern> | rick_2047: one of the amusing things about lazy evaluation is that it forced the great programming language shootout to revise all its benchmarks |
| 03:49:33 | <roconnor> | I misunderstood a previous result |
| 03:49:43 | <rick_2047> | http://pastebin.com/d6bd320ad <-- i changed it to this but still gives errors |
| 03:49:52 | <Cale> | ACTION has a look |
| 03:50:10 | <gwern> | if you ask for only one answer, it computes you only one answer; you ask for nothing, and it does nothing |
| 03:50:19 | <Cale> | rick_2047: Now you're adding print read (args !! 0) to read (args !! 1) |
| 03:50:26 | <Cale> | rick_2047: You need some parens :) |
| 03:50:54 | <Cale> | (or a $ after print) |
| 03:50:58 | <jbauman> | haskell should be able to determine the location of the parens by the types :) |
| 03:51:22 | <jbauman> | (as a plus, when you have bugs, that would cause really exciting bugs) |
| 03:51:52 | <rick_2047> | Cale, whats wrong with adding read (args !! 0 ) to read (args !! 1) both i think are numbers?? |
| 03:51:56 | <SamB> | gwern: if only they'd been content to make it fair :-( |
| 03:51:59 | <gwern> | jbauman: I think that's a little sufficiently smart... |
| 03:52:28 | <Cale> | rick_2047: you're not doing that... it parses as (print read (args !! 0)) + (read (args !! 1)) |
| 03:52:53 | <jbauman> | gwern, it just has to try every possible location and see which one typechecks |
| 03:53:09 | <gwern> | ~_~ sounds exponential |
| 03:53:11 | <jbauman> | avoiding exponential compile times is left as an exercise for the implementer |
| 03:53:28 | <Cale> | There are two things which are wrong with that: print only takes one parameter, and even if it did take two, it produces something which isn't a number, and so can't be added to (read (args !! 1)) |
| 03:53:57 | <Cale> | rick_2047: Is that clear? |
| 03:53:58 | <SamB> | Cale: not to mention it's nothing like what he meant!@ |
| 03:54:03 | <Cale> | SamB: right :) |
| 03:54:10 | <rick_2047> | Cale, ya got it working |
| 03:54:18 | <gwern> | I'd say you haven't shown it'll make code easier to write or more comprehensible; it sounds like as bad an idea as a compiler that works by genetic algorithms, and stops when it has a compiled binary which is 'sufficiently' correct |
| 03:54:21 | <rick_2047> | ACTION blesses community again |
| 03:54:52 | <jbauman> | gwern, it would have made rick_2047's code compile to what he wanted... |
| 03:55:29 | <SamB> | gwern: but would it be as slow ? |
| 03:55:53 | <rick_2047> | ACTION thinks most compilers presume that you know what you are doing which is seldom true for a novice |
| 03:55:53 | <jbauman> | unfortunately, if you had the wrong types in your code it might accidentally compile to something you really didn't want |
| 03:56:04 | <Cale> | melodia: ハスケルに興味があるの? |
| 03:56:20 | <gwern> | SamB: I mean a non-correctness-preserving compiler is just a bad idea :) |
| 03:56:40 | <gwern> | and a compiler that guesses what you wants and goes with the first consistent guess is non-correctness-preserving imo |
| 03:57:36 | <SamB> | note that I'm just kidding around and do not think that either thing is useful |
| 03:58:21 | <jbauman> | same here |
| 03:58:48 | <gwern> | eh. doesn't matter. is bedtime here anyways |
| 04:00:24 | <melodia> | ケール〜(ハ-∀-)、 いや、ちょっと見ようと思ってたんだけなんですよ.しかし、日本語で話していいんですか |
| 04:01:50 | <SamB> | melodia: uh, abhout all I got from that is that you have a pair of parens, a forall, two commas, and a period ... |
| 04:01:59 | <SamB> | er. three commas. |
| 04:02:10 | <monochrom> | I wonder what's forall doing there :) |
| 04:02:19 | <BMeph> | Lazy (LAY-zee) n. The characteristic of doing only one's own work. ;) |
| 04:02:40 | <Cale> | いいと思うよ。 |
| 04:02:58 | <SamB> | melodia: oh, and of course I assume the rest is in japanese |
| 04:03:23 | <SamB> | with a mixture of kanji and hiragana |
| 04:03:28 | <Cale> | The forall is part of a funny Japanese-style smiley :) |
| 04:03:45 | <SamB> | Cale: is that kosher with JIS ? |
| 04:03:58 | <Cale> | This is all in unicode anyway... |
| 04:04:03 | <SamB> | true! |
| 04:04:24 | <SamB> | but I'd expect japanese styles to be based on the JIS characters |
| 04:04:41 | <Cale> | Well, they seem to use it a lot, so I suspect it's fine. |
| 04:05:45 | <SamB> | huh. I don't seem to have decent full-width versions of all of those kana for my terminal ... |
| 04:06:16 | <SamB> | or the dashy things either |
| 04:08:42 | <SamB> | in particular, the glyphs in "ケール〜ハ" all seem to take up only the left cell of a two-cell character ... |
| 04:08:51 | <Cale> | odd |
| 04:09:11 | <SamB> | I guess urxvt couldn't find appropriately-sized glyphs ??? |
| 04:09:29 | <SamB> | at least not in any of the configured fonts |
| 04:10:27 | <Cale> | I use gnome-terminal (and XChat for IRC) |
| 04:10:29 | <SamB> | now, "、." are the same, but that's kind of to be expected ;-) |
| 04:10:33 | <SamB> | I use x-chat too |
| 04:10:48 | <SamB> | I just pasted the characters into urxvt to see what they'd look like |
| 04:11:11 | <SamB> | I think it even has one of the kanji anti-aliased, which looks bad :-( |
| 04:11:31 | <SamB> | this one: 思 |
| 04:13:19 | <SamB> | now, it couldn't very well render those characters at one-cell wide, since it's supposed to match the wcwidth function ... |
| 04:14:08 | <SamB> | (though how that's supposed to work if the terminal and the libc are on opposite sides of an SSH connection, I'm not sure, since I don't think there's any standard about the widths per-se ...) |
| 04:14:34 | <SamB> | (... though with JIS-derived characters there's really only one right way to do it) |
| 04:21:55 | <dancor> | i'm using urxvt with -fn '8x13,xft:Biwidth' |
| 04:22:03 | <dancor> | the characters all look correct to me |
| 04:22:13 | <dancor> | but i wouldn't know for sure :) |
| 04:22:26 | <dancor> | those katakana were biwidth anyway |
| 04:22:40 | <dancor> | SamB: ^^^ |
| 04:23:08 | <SamB> | dancor: well, in my xchat they show up full-width |
| 04:23:35 | <ray> | jis has forall |
| 04:23:48 | <dancor> | i'm using xorg/urxvt/screen/ssh/screen/irssi :) |
| 04:23:50 | <SamB> | and in my urxvt the glyphs might actually extend just *past* the left half-cell |
| 04:24:49 | <SamB> | hmm, I'm using: |
| 04:25:00 | <SamB> | URxvt.font: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1, [codeset=JISX0208]xft:Kochi Gothic:antialias=false |
| 04:25:00 | <SamB> | URxvt.print-pipe: lpr -P pam_old/urxvt |
| 04:25:00 | <SamB> | URxvt.reverseVideo: true |
| 04:26:44 | <dancor> | screen-connecting from a separate -fn '8x13,xft:Kochi Gothic' term looks fine too |
| 04:27:01 | <bos> | why are we obsessing over japanese characters in here? |
| 04:31:22 | <SamB> | bos: someone left a message here which none of us could actually read |
| 04:31:58 | <SamB> | at least, if somone could, they haven't bothered to translate ... |
| 04:32:34 | <bos> | new API for encoding errors in Data.Text: http://pastebin.com/m4177334f |
| 04:33:04 | <bos> | both hpaste.org and paste.lisp.org are hosed |
| 04:33:18 | <bos> | teh internets haz runned outta paste |
| 04:33:46 | <SamB_XP> | bos: codepad.org ? |
| 04:33:55 | <SamB_XP> | that has not only paste, but crash! |
| 05:04:57 | <roconnor> | @src const |
| 05:04:57 | <lambdabot> | const x _ = x |
| 05:11:39 | <roconnor> | > let f a = \z -> case a of {(x,y) -> x} in null (return $! (f undefined)) |
| 05:11:40 | <lambdabot> | False |
| 05:11:48 | <roconnor> | > let f a = case a of {(x,y) -> \z -> x} in null (return $! (f undefined)) |
| 05:11:49 | <lambdabot> | * Exception: Prelude.undefined |
| 05:12:00 | <roconnor> | Cale: this is starting to make sense to me |
| 05:12:45 | <roconnor> | I think \x -> \y -> foo is only distinguishable from \x y -> foo when x and y have patterns. |
| 05:15:40 | <dmwit> | ?where report |
| 05:15:40 | <lambdabot> | http://www.haskell.org/onlinereport/ |
| 05:17:05 | <roconnor> | and they are distinguishable because in one case a case statement is stuck between the lambdas, and in the other case the case statement is put after all the lambdas. |
| 05:17:55 | <roconnor> | ACTION reconciles with Haskell |
| 05:18:22 | <Jebdm> | What do you mean? |
| 05:18:40 | <Jebdm> | roconnor: They should be equal, even with patterns |
| 05:18:46 | <roconnor> | > let f (x,y) z = x in null (return $! (f undefined)) |
| 05:18:47 | <lambdabot> | False |
| 05:18:53 | <roconnor> | > let f (x,y) = \z -> x in null (return $! (f undefined)) |
| 05:18:54 | <lambdabot> | * Exception: Prelude.undefined |
| 05:19:11 | <roconnor> | > let f = \(x,y) z -> x in null (return $! (f undefined)) |
| 05:19:11 | <lambdabot> | False |
| 05:19:17 | <roconnor> | > let f = \(x,y) -> \z -> x in null (return $! (f undefined)) |
| 05:19:19 | <lambdabot> | * Exception: Prelude.undefined |
| 05:19:34 | <akafubu> | is cabal-install not part of the debian package ghc6? |
| 05:19:57 | <Jebdm> | that's strange |
| 05:20:19 | <dmwit> | It's not too strange. |
| 05:20:21 | <akafubu> | is it? i don't know |
| 05:20:22 | <roconnor> | Jebdm: it has to do with how patterns in lambda are transformed into case statements |
| 05:20:29 | <akafubu> | oh, not to me |
| 05:20:36 | <dmwit> | Imagine not having patterns in lambdas, and how you would convert that into a case statement. |
| 05:20:55 | <dmwit> | The naive way is just different for multi-parameter lambdas and multiple single-parameter lambdas, that's all. |
| 05:21:02 | <roconnor> | \(x,y) z -> x becomes \a b -> case (a,b) of {((x,y), z) -> x} |
| 05:21:05 | <roconnor> | while |
| 05:21:05 | <Jebdm> | roconnor: Cleary; I just didn't expect it == I didn't think about it |
| 05:21:28 | <roconnor> | \(x,y) -> \z -> x becomes \a -> case a of {(x,y) -> \z -> x} |
| 05:22:06 | <Jebdm> | I just would've expected Haskell to be extra-careful to preserve the currying semantics |
| 05:22:38 | <roconnor> | haskell's semantics are a little bit strange. |
| 05:23:01 | <roconnor> | > case id of {f -> f 7} |
| 05:23:02 | <lambdabot> | 7 |
| 05:23:35 | <akafubu> | i just got through installing the package parsec47 and still, the cabal-install bootstrap.sh says it needs parsec "but isn't installed" |
| 05:23:35 | <Jebdm> | huh |
| 05:24:21 | <roconnor> | Jebdm: apparently you can do case analysis on functions so long as you don't use patterns in the cases. |
| 05:24:22 | <dmwit> | akafubu: What does ghc-pkg list parsec say? |
| 05:25:08 | <akafubu> | dmwit: /usr/lib/ghc-6.8.2/package.conf: |
| 05:25:13 | <roconnor> | ACTION will remember that for the next Obfuscated Haskell programming contest |
| 05:25:20 | <dmwit> | akafubu: Sounds like you didn't get it installed, then. =P |
| 05:25:25 | <dmwit> | akafubu: How did you install it? |
| 05:25:42 | <akafubu> | dmwit: apt-get install parsec47 |
| 05:25:43 | <dmwit> | akafubu: Also, how did you manage to not have parsec? Isn't it in the base distribution of GHC? |
| 05:26:05 | <akafubu> | dunno, i'm new to this stuff, hoping you guys/gals know |
| 05:26:15 | <dmwit> | akafubu: parsec47 doesn't sound like a Haskell thing... |
| 05:26:22 | <dmwit> | Parsec is up to only version 3.0.0. |
| 05:26:32 | <Jebdm> | dmwit: i don't think it is |
| 05:26:37 | <akafubu> | parsec47 - retromodern hispeed shmup ...ah, a game |
| 05:26:49 | <Jebdm> | it's in the "Haskell Platform", but not GHC |
| 05:27:02 | <Jebdm> | AFAIK |
| 05:27:13 | <akafubu> | is cabal-install going to be part of the ghc package anytime soon? |
| 05:27:42 | <Jebdm> | oh, shit, i was thinking of cabal |
| 05:27:44 | <Jebdm> | d'oh |
| 05:27:50 | <Jebdm> | parsec is |
| 05:28:21 | <Jebdm> | it's just listed in a funny place (not as specified in the Parsec docs themselves) |
| 05:29:24 | <Jebdm> | Text.ParserCombinators.Parsec |
| 05:29:32 | <Jebdm> | http://www.haskell.org/ghc/docs/latest/html/libraries/parsec/Text-ParserCombinators-Parsec.html |
| 05:30:37 | <akafubu> | i can't even find the download site for parsec |
| 05:30:55 | <dmwit> | ?hackage parsec |
| 05:30:55 | <lambdabot> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/parsec |
| 05:31:53 | <akafubu> | just found it |
| 05:32:12 | <akafubu> | dmwit: thanks for the link, that would have saved 2-3 secs |
| 05:33:34 | <akafubu> | to execute the .hs file, i do 'ghc Setup.hs'? |
| 05:35:01 | <dmwit> | akafubu: runhaskell Setup.hs |
| 05:35:19 | <dmwit> | akafubu: You need to pass the arguments "configure", "build", and "install" in three separate invocations. |
| 05:35:30 | <dmwit> | akafubu: But can we make sure that there's no distro-package for this? |
| 05:35:36 | <dmwit> | This *really* ought to be coming with GHC. |
| 05:35:55 | <akafubu> | okay, i'll check if you give me the commands :P |
| 05:36:05 | <akafubu> | btw.. |
| 05:36:07 | <dmwit> | If it's not there, either your installation is broken or your distribution is really weird. |
| 05:36:09 | <akafubu> | $ runhaskell Setup.hs |
| 05:36:10 | <akafubu> | Setup.hs: No command given (try --help) |
| 05:36:17 | <akafubu> | ubuntu jaunty |
| 05:36:24 | <dmwit> | akafubu: Yes, hence my next comment about configure, build, and install. ;-) |
| 05:36:31 | <akafubu> | oh, right |
| 05:36:39 | <akafubu> | ./configure |
| 05:36:41 | <akafubu> | bash: ./configure: No such file or directory |
| 05:36:50 | <dmwit> | akafubu: search for packages with the name ghc |
| 05:36:52 | <akafubu> | /parsec-3.0.0$ ls |
| 05:36:54 | <akafubu> | LICENSE parsec.cabal Setup.hi Setup.hs Setup.o Text |
| 05:37:01 | <dmwit> | akafubu: No, not configure; "runhaskell Setup.hs configure". |
| 05:37:14 | <akafubu> | ah |
| 05:37:20 | <dmwit> | akafubu: But first search for packages with the name ghc in them. |
| 05:37:29 | <akafubu> | right. |
| 05:38:40 | <akafubu> | ACTION is waiting on updatedb.. |
| 05:38:51 | <dmwit> | ... |
| 05:38:58 | <dmwit> | You didn't run updatedb on your own, I hope... |
| 05:39:05 | <dmwit> | (Since updatedb has nothing to do with package management.) |
| 05:40:38 | <Jebdm> | akafubu: just open up ghci and try ":m Text.ParserCombinators.Parsec" |
| 05:41:17 | <dmwit> | We've already checked that the package definitely isn't installed. |
| 05:41:34 | <Jebdm> | GHC includes it by default in a different place than Parsec docs says it should be |
| 05:41:35 | <akafubu> | http://pastebin.com/m45498dbf |
| 05:41:42 | <akafubu> | results from 'locate ghc' |
| 05:41:54 | <dmwit> | akafubu: ? |
| 05:42:05 | <dmwit> | akafubu: How about results from "apt-cache search ghc" instead? |
| 05:42:23 | <akafubu> | Prelude> :m Text.ParserCombinators.Parsec |
| 05:42:25 | <akafubu> | module main:Text.ParserCombinators.Parsec is not loaded |
| 05:42:31 | <akafubu> | lots of results for that... one sec |
| 05:43:35 | <akafubu> | dmwit: http://pastebin.com/m6cf1f785 |
| 05:44:06 | <Jebdm> | Huh--that's a different error message than I get. |
| 05:44:14 | <akafubu> | installing libghc6-parsec-dev atm.. |
| 05:44:20 | <Jebdm> | What's your GHC version? |
| 05:44:29 | <akafubu> | dunno |
| 05:44:41 | <akafubu> | $ ghc --version |
| 05:44:42 | <Jebdm> | it should say on the first line when you start GHCi |
| 05:44:43 | <akafubu> | The Glorious Glasgow Haskell Compilation System, version 6.8.2 |
| 05:45:02 | <akafubu> | i don't recall it being gghc ;) |
| 05:45:02 | <Jebdm> | Prelude Text.ParserCombinators.Parsec> :m Text.ParserCombinators.Parsecaqwe |
| 05:45:02 | <Jebdm> | Could not find module `Text.ParserCombinators.Parsecaqwe': |
| 05:45:02 | <Jebdm> | Use -v to see a list of the files searched for. |
| 05:45:15 | <Jebdm> | why's it different? |
| 05:45:47 | <akafubu> | okay, that took care of the parsec requirement |
| 05:46:02 | <dmwit> | Jebdm: Because he's in the Parsec installation directory. |
| 05:46:19 | <dmwit> | Jebdm: And so it's trying to load Text/ParserCombinators/Parsec.hs |
| 05:46:20 | <Lemmih> | Jebdm: Because he's standing next to the sources. |
| 05:46:34 | <Jebdm> | Ah. |
| 05:47:14 | <akafubu> | ah, bootstrap has all it's dependencies now |
| 05:47:20 | <dmwit> | s/'// |
| 05:47:32 | <akafubu> | sí, its |
| 05:49:14 | <akafubu> | thank you all for your help, my sleep medicine is kicking in, and it looks like the compilation may take awhile |
| 05:49:31 | <dmwit> | of cabal? |
| 05:49:35 | <akafubu> | yeah |
| 05:49:43 | <dmwit> | Compilation shouldn't take longer than 30s or so. |
| 05:49:52 | <akafubu> | so far, 1m+ |
| 05:50:01 | <akafubu> | 2m+ |
| 05:50:05 | <dmwit> | ACTION shrugs |
| 05:50:07 | <dmwit> | okey-doke |
| 05:50:10 | <akafubu> | :) |
| 05:50:13 | <akafubu> | gn, see you all soon |
| 05:50:14 | <Jebdm> | (processor speed variation, perhaps) |
| 05:59:51 | <hatds> | when debugging in single stepping mode, is there a way to step out of the current function? |
| 06:14:16 | <akafubu> | argh, |
| 06:14:18 | <akafubu> | $ runhaskell Setup.hs configure |
| 06:14:19 | <akafubu> | Configuring cabal-install-0.6.2... |
| 06:14:21 | <akafubu> | Setup.hs: At least the following dependencies are missing: |
| 06:14:22 | <akafubu> | Cabal ==1.6.*, HTTP >=4000.0.2 && <4001, zlib >=0.4 && <0.6 |
| 06:14:30 | <akafubu> | now i'm going to bed |
| 06:14:32 | <akafubu> | will ask later |
| 06:14:35 | <akafubu> | too tired atm |
| 06:48:30 | <pumpkin> | ack, I'm confused with how to write a Read instance... I have a String -> MyType function but all this stuff looks complicated :o |
| 06:50:13 | <hatds> | where are the unsafeRead/Write operations for MArrays exported from? |
| 06:51:49 | <sm> | is it possible to turn off warn-incomplete-patterns on a case by case basis ? |
| 06:52:29 | <ski> | pumpkin : you should have a `ReadS MyType', i.e. a `String -> [(MyType,String)]' function |
| 06:52:43 | <sm> | I have a helper function whose pattern is ensured by the parent's patterns.. I don't want to be warned about it |
| 06:52:44 | <Lemmih> | sm: Well, you can complete the patterns... |
| 06:52:56 | <rick_2047> | is Text.ParserCombinators.Parsec library included with ghc?? |
| 06:53:05 | <sm> | adding a couple of useless lines seems.. well let's try |
| 06:53:20 | <rick_2047> | (.text+0x329): undefined reference to `__stginit_parseczm2zi1zi0zi1_TextziParserCombinatorsziParsec_' |
| 06:53:29 | <rick_2047> | i get this error when i try to import it |
| 06:53:32 | <pumpkin> | ski: thanks |
| 06:53:39 | <ski> | there's also |
| 06:53:41 | <pumpkin> | rick_2047: --make |
| 06:53:44 | <ski> | @type ext.ParserCombinators.ReadP.readP_to_S |
| 06:53:45 | <lambdabot> | Couldn't find qualified module. |
| 06:53:47 | <ski> | @type Text.ParserCombinators.ReadP.readP_to_S |
| 06:53:48 | <lambdabot> | forall a. Text.ParserCombinators.ReadP.ReadP a -> String -> [(a, String)] |
| 06:54:03 | <ski> | if you prefer writing the parser in the `ReadP' monad |
| 06:54:12 | <rick_2047> | pumpkin, u mean i append --make with ghc ? |
| 06:54:14 | <pumpkin> | yeah |
| 06:54:19 | <ski> | (probably one could use `Parsec' or other parsing monads, as well) |
| 06:54:29 | <rick_2047> | pumpkin, got it |
| 06:54:39 | <rick_2047> | but why do i have do that |
| 06:54:48 | <rick_2047> | does it have to link it or something? |
| 06:54:52 | <pumpkin> | ski: hmm, this might be hard... I'm binding with ffi to a lib that expects a c string and just returns one thing... I guess I'm going to have to "parse" it twice |
| 06:54:56 | <pumpkin> | although it's pretty simple |
| 06:55:00 | <Lemmih> | sm: Statically proving completeness would be preferable, obviously. |
| 06:55:01 | <pumpkin> | rick_2047: yeah |
| 06:55:07 | <rick_2047> | ok |
| 06:55:27 | <sm> | Lemmih: that works, alright. I've made those cases undefined, is there something better/more readable you'd use ? |
| 06:55:42 | <ski> | pumpkin : what if there's no parse ? what if there's a valid parse, but with extra unused chars left at the end ? |
| 06:55:51 | <sm> | error "shouldn't happen" ? |
| 06:56:24 | <sm> | ACTION grumbles.. a blot on my glorious code |
| 06:56:37 | <ski> | pumpkin : btw, also consider that usually one'd want `read' to read a representation that's valid haskell syntax |
| 06:56:39 | <Lemmih> | sm: Perhaps you could make use of a new data structure to make sure those cases can't happen. |
| 06:56:41 | <pumpkin> | ski: if there's no parse, I get a return value that tells me so |
| 06:56:56 | <pumpkin> | ski: it doesn't let me know if there's anything left over because it just gets a c string |
| 06:57:04 | <pumpkin> | ski: it's just a number :P |
| 06:57:06 | <pumpkin> | but yeah |
| 06:57:30 | <ray> | NUMBERS ARE NOT VALID HASKELL |
| 06:57:35 | <ray> | > 2 |
| 06:57:36 | <lambdabot> | 2 |
| 06:57:43 | <pumpkin> | :( |
| 06:57:46 | <ski> | what if the string to parse contains non-numeral-characters at the end ? |
| 06:57:48 | <ray> | ACTION is defeated |
| 06:58:03 | <pumpkin> | ski: it appears to just ignore them |
| 06:58:10 | <ski> | ok |
| 06:58:17 | <pumpkin> | anyway, I'll just make a pass over the string first |
| 06:58:28 | <pumpkin> | and only hand gmp the numerical part |
| 06:58:29 | <ski> | you still need `reads' or `readsPrec' to return the left-over chars, though |
| 06:58:38 | <pumpkin> | yeah |
| 06:59:08 | <ski> | (prepass with `span' or something ?) |
| 06:59:16 | <pumpkin> | yeah, that seems reasonable |
| 06:59:44 | <ski> | (or maybe even an accurate parser/recognizer .. the only thing it doesn't do is create the C representation .. though that seems slightly wasteful) |
| 07:00:12 | <pumpkin> | well, an accurate parser is just something that checks for isDigit |
| 07:00:17 | <pumpkin> | > isDigit 'a' |
| 07:00:18 | <lambdabot> | False |
| 07:00:21 | <pumpkin> | yeah |
| 07:00:31 | <pumpkin> | since I'm just doing integers :) |
| 07:00:53 | <ski> | so no decimal points, `E'/`e', `+'/`-' maybe even stuff telling the base of the number ? |
| 07:01:09 | <pumpkin> | > read "0x52" :: Integer |
| 07:01:11 | <lambdabot> | 82 |
| 07:01:12 | <pumpkin> | crap |
| 07:01:16 | <ski> | well, you need to check for `-' at the beginning at least, then ? |
| 07:01:17 | <pumpkin> | I guess I can't be as simplistic as I hoped |
| 07:01:19 | <pumpkin> | yeah |
| 07:01:23 | <pumpkin> | > read "052" :: Integer |
| 07:01:24 | <lambdabot> | 52 |
| 07:01:33 | <pumpkin> | I'm glad haskell is sane about that at least |
| 07:01:40 | <ricardolost84> | hello |
| 07:01:46 | <ski> | do you need to allow non-decimal bases for this C-type .. |
| 07:01:56 | <ski> | hm, maybe you do, because of `fromInteger' |
| 07:02:01 | <pumpkin> | ski: I'm just reimplementing Integer for ghc |
| 07:02:05 | <ski> | oh |
| 07:02:13 | <pumpkin> | ski: so I need to support 0x, + and - I guess |
| 07:02:19 | <pumpkin> | > read "+5" :: Integer |
| 07:02:20 | <lambdabot> | * Exception: Prelude.read: no parse |
| 07:02:23 | <pumpkin> | not even + then |
| 07:02:42 | <ski> | > 1.23E45 |
| 07:02:43 | <lambdabot> | 1.23e45 |
| 07:02:44 | <ski> | > 1.23E-45 |
| 07:02:45 | <lambdabot> | 1.23e-45 |
| 07:02:46 | <ski> | > 1.23E+45 |
| 07:02:47 | <lambdabot> | 1.23e45 |
| 07:02:55 | <pumpkin> | > read "1.23E10" :: Integer |
| 07:02:56 | <lambdabot> | * Exception: Prelude.read: no parse |
| 07:02:57 | <ray> | <pumpkin> NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO |
| 07:02:57 | <ski> | (that was the `+' i was thinking of, above) |
| 07:03:02 | <pumpkin> | ray: ? |
| 07:03:14 | <ray> | that's your reaction if you had to implement that |
| 07:03:22 | <pumpkin> | ski: I'm just reproducing current Integer behavior exactly so I don't need that :) |
| 07:03:30 | <ski> | *nod* |
| 07:03:59 | <ski> | > read "0o52" :: Integer |
| 07:04:00 | <lambdabot> | 42 |
| 07:04:03 | <pumpkin> | ew |
| 07:04:07 | <pumpkin> | dammit :P |
| 07:04:14 | <pumpkin> | I was hoping they'd have left octal out |
| 07:04:15 | <ray> | *life ruined* |
| 07:04:24 | <ray> | octal's not any uglier than hex |
| 07:04:30 | <ray> | well, it's uglier, but not to implement |
| 07:04:30 | <pumpkin> | ah well, it's not that hard to implement |
| 07:04:43 | <pumpkin> | GMP allows me to specify the base to read |
| 07:04:46 | <pumpkin> | so it can do it for me |
| 07:04:51 | <pumpkin> | I just need to figure out what to give it |
| 07:04:57 | <pumpkin> | should be straightforward |
| 07:06:19 | <pumpkin> | Lemmih: you did the SDL binding? |
| 07:07:32 | <ski> | > 0x3.243f6a8885 |
| 07:07:32 | <lambdabot> | Not in scope: `f6a8885' |
| 07:07:38 | <pumpkin> | :o |
| 07:07:46 | <pumpkin> | is that pi? |
| 07:08:09 | <pumpkin> | > 2 / 16 + 4 / 256 |
| 07:08:10 | <lambdabot> | 0.140625 |
| 07:08:24 | <pumpkin> | :) |
| 07:08:24 | <ski> | ACTION never understood why there's usually no hexadecimals/binals/et.c support in programming languages |
| 07:08:35 | <pumpkin> | yeah |
| 07:08:42 | <Lemmih> | pumpkin: Guilty as charged. |
| 07:09:04 | <pumpkin> | Lemmih: any idea if there's a way to get a "run once at startup" IO function for a library? |
| 07:09:12 | <pumpkin> | in GHC if not in general |
| 07:09:19 | <ski> | (it might come in handy with the `FixedFoo' types) |
| 07:09:43 | <Lemmih> | pumpkin: Nope, sorry. |
| 07:10:02 | <dmwit> | ski: I never thought about it, but now that you mention it, it is kind of odd that hex and octal are restricted to integer values. |
| 07:10:29 | <dmwit> | ski: Of course, the motivation for them is to represent things close to the actual bit-representation in hardware. |
| 07:10:48 | <ski> | mostly, yes |
| 07:10:50 | <dmwit> | ski: And Floats don't necessarily store similar bit-patterns to what you would type as a hex floating point. |
| 07:10:53 | <dmwit> | so... |
| 07:11:27 | <ski> | but consider a type like `Int32', except 16 of the bits is for binals, and 15 for the intergral part |
| 07:11:55 | <dmwit> | Hah! You can't fool me. |
| 07:11:58 | <dmwit> | oh wait |
| 07:12:00 | <dmwit> | maybe you can |
| 07:12:25 | <dmwit> | Yeah, non-floating point could be reasonably represented that way. |
| 07:12:26 | <ski> | ACTION wonders how he's supposed to fool dmwit |
| 07:12:44 | <dmwit> | I was going to say that adds up to 31 bits, but Int only guarantees 29... but you said Int32. ;-) |
| 07:13:34 | <dmwit> | ski: unsafeCoerce# 0x24242424{-.-}363636 |
| 07:13:35 | <dmwit> | ;-) |
| 07:13:52 | <dmwit> | > 0x3{- does this actually work? -}6 |
| 07:13:53 | <lambdabot> | Add a type signature |
| 07:13:54 | <ski> | > 0x24242424{-.-}363636 |
| 07:13:54 | <lambdabot> | Add a type signature |
| 07:13:57 | <dmwit> | ! |
| 07:13:59 | <ski> | > 0x24242424{-.-}363636 :: Integer |
| 07:13:59 | <dmwit> | > 0x3{- does this actually work? -}6 :: Int |
| 07:14:00 | <lambdabot> | No instance for (GHC.Num.Num (t -> GHC.Integer.Internals.Integer)) |
| 07:14:01 | <lambdabot> | arisi... |
| 07:14:01 | <lambdabot> | No instance for (GHC.Num.Num (t -> GHC.Types.Int)) |
| 07:14:01 | <lambdabot> | arising from the lite... |
| 07:14:04 | <dmwit> | ah |
| 07:14:06 | <dmwit> | heh |
| 07:14:11 | <dmwit> | > 0x3 6 :: Int |
| 07:14:12 | <lambdabot> | No instance for (GHC.Num.Num (t -> GHC.Types.Int)) |
| 07:14:12 | <lambdabot> | arising from the lite... |
| 07:14:14 | <dmwit> | =) |
| 07:14:45 | <ski> | no C-like `foo/*...*/bar' symbol appending, here ! |
| 07:15:04 | <ski> | (i suppose s/symbol/token/) |
| 07:15:27 | <dmwit> | Yeah, it would be nasty for the lexer to be context-free rather than regular, I guess. |
| 07:15:40 | <dmwit> | (due to nested comments being allowed) |
| 07:18:17 | <sm> | I don't get it.. why does ghc think this pattern is incomplete ? http://gist.github.com/124122 |
| 07:18:54 | <pumpkin> | sm: can non-Commodity things be placed into it? |
| 07:19:05 | <pumpkin> | or does Amount have any other data constructors than Amount? |
| 07:19:17 | <sm> | I don't believe so |
| 07:19:33 | <sm> | is it analysing the | cases as well ? |
| 07:19:34 | <ski> | sm : don't use `==' when you can match |
| 07:19:54 | <ski> | (or in case you want to give up, use `otherwise'/`True' in a last guard) |
| 07:20:13 | <sm> | hmm |
| 07:20:15 | <sm> | ha |
| 07:20:27 | <akamaus> | I'm struggling trying to figure out how to catch exceptions in the BrowserAction monad which is defined in Network.Browser. Can someone help me? |
| 07:20:49 | <ski> | sm : it's almost surely not understanding that there is no other choice than `side==L = True' or `side==R = True' |
| 07:21:34 | <dmwit> | akamaus: Network.Browser, eh? |
| 07:21:39 | <dmwit> | akamaus: Which package is that in? |
| 07:21:46 | <akamaus> | http |
| 07:22:01 | <sm> | I see |
| 07:22:06 | <dmwit> | ?hackage http |
| 07:22:06 | <lambdabot> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/http |
| 07:22:20 | <dmwit> | bah |
| 07:22:27 | <dmwit> | You'd think lambdabot could at least check case. |
| 07:22:38 | <ski> | sm : if you want to keep the `where'-clauses, use a `case' (but you can still split the `sym' matches `"AUTO"' case into a separate equation) |
| 07:22:46 | <akamaus> | http://hackage.haskell.org/packages/archive/HTTP/4000.0.6/doc/html/Network-Browser.html |
| 07:22:47 | <ivanm> | dmwit: well, it's just a ++ |
| 07:22:52 | <sm> | and your give up tip is a more readable way to silence the one I was just working on |
| 07:22:56 | <ivanm> | @hackage madeUpPackageName |
| 07:22:56 | <lambdabot> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/madeUpPackageName |
| 07:23:29 | <sm> | ACTION tries |
| 07:23:48 | <dmwit> | akamaus: Looks like you just have to catch things in the IO monad. |
| 07:23:48 | <ski> | @. hackage run text " " |
| 07:23:49 | <lambdabot> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ |
| 07:24:03 | <dmwit> | akamaus: Whoever implemented it did some strange things. |
| 07:24:22 | <akamaus> | dmwit, but I'd like to preserve the state, cookies etc.. |
| 07:24:25 | <dmwit> | For example, BrowserAction conn a ~= StateT (BrowserState conn) IO a |
| 07:24:40 | <akamaus> | dmwit, yeah, looks similar |
| 07:24:44 | <dmwit> | but that's expanded out in a data declaration, and has its own Monad instance. =/ |
| 07:25:41 | <akamaus> | dmwit, what's about modifing it? I like the way it works with cookies |
| 07:25:43 | <dmwit> | akamaus: Well, there's setErrHandler. |
| 07:26:02 | <akamaus> | dmwit, setErrHandler is just for error reporting |
| 07:26:09 | <dmwit> | akamaus: But it's super-odd that it's not just defined as a transformer, as that means there's no liftIO. |
| 07:26:12 | <dmwit> | That seems really annoying. |
| 07:26:24 | <akamaus> | dmwit, I can add it if needed |
| 07:27:04 | <dmwit> | If so, perhaps you can just lift a catch into the BrowserAction monad. |
| 07:27:06 | <dmwit> | :t catch |
| 07:27:07 | <lambdabot> | forall a. IO a -> (IOError -> IO a) -> IO a |
| 07:27:13 | <akamaus> | the problem is that 'try' accepts IO, not BrowserAction |
| 07:27:26 | <akamaus> | and catch.. |
| 07:27:59 | <dmwit> | Yep, it looks like you need access to the BrowserAction constructor to do what you want. |
| 07:27:59 | <akamaus> | dmwit, I cant figure out how to lift it, looks like state will be lost |
| 07:28:06 | <dmwit> | Which may be hidden for a legitimate reason. |
| 07:28:20 | <dmwit> | i.e. if an error occurs, maybe the cookies and browser state are not left in a consistent state or something. |
| 07:29:13 | <akamaus> | dmwit, seems it's not the case, they run action several times and then give up by calling 'fail' |
| 07:29:32 | <sm> | ski: I see..moving it into a case takes it out of the gaze of the pattern checker |
| 07:29:39 | <akamaus> | dmwit, look in request' |
| 07:29:45 | <sm> | thanks |
| 07:30:07 | <dmwit> | akamaus: meh, the design of this library seems a bit... haphazard. |
| 07:30:35 | <akamaus> | dmwit, I become to feel the same ) |
| 07:30:43 | <akamaus> | are there alternatives? |
| 07:30:54 | <dmwit> | curl? |
| 07:31:18 | <ski> | ( sm : rather "takes it *into* the gaze of the pattern checker", i'd say) |
| 07:31:26 | <dmwit> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/curl |
| 07:31:38 | <akamaus> | hm.. should have a look at it |
| 07:32:22 | <sm> | hmm |
| 07:32:37 | <akamaus> | I wish hackage had some kind of rating system for packages or so.. |
| 07:33:09 | <pumpkin> | and a wiki! |
| 07:33:21 | <sm> | well ghc's happy and more warnings await, I must not obsess |
| 07:35:02 | <sm> | akamaus: and showed the package list as front page, and had intuitive urls for packages |
| 07:36:21 | <akamaus> | sm, I think it's to much of them for the front page ;) |
| 07:36:42 | <sm> | why does the front page have to be short ? |
| 07:36:52 | <dmwit> | Yeah! |
| 07:37:00 | <dmwit> | Hackage v2.0, coming right up! |
| 07:37:08 | <sm> | the current front page is just an about page |
| 07:37:31 | <pumpkin> | don't forget the rounded edges, sans serif fonts, and starburst "Beta" logos |
| 07:39:38 | <akamaus> | sm, maybe because one should be prepared before diving into depths of libraries? |
| 07:40:21 | <sm> | I just don't understand that |
| 07:40:43 | <sm> | how often do you go to hackage and don't want to see the... drum roll.. *packages* |
| 07:40:52 | <maltem> | The one issue that I have with Hackage is the URL of the packages list is so long :) |
| 07:41:40 | <maltem> | Really hackage.haskell.org/packages should at least redirect there |
| 07:42:13 | <dmwit> | Really hackage.haskell.org/curl should be the URL for the curl package. |
| 07:42:21 | <dmwit> | And hackage.haskell.org should be the URL for the packages list. |
| 07:42:26 | <dmwit> | This is pretty basic UI stuff. |
| 07:42:46 | <FalconNL> | Hi everyone. A few days ago I started learning Template Haskell and now I've written a library that more or less allows inheriting record fields. If anyone's interested, I'd love to get some feedback before I put it on Hackage, particularly whether there's anything useful I've not yet implemented. The tutorial can be found at http://codepad.org/csslJ7IZ |
| 07:42:47 | <sm> | dmwit: ah! a sane person! |
| 07:43:02 | <sm> | ACTION waves happily |
| 07:43:06 | <dmwit> | o/ |
| 07:45:58 | <maltem> | ACTION was about to ask dmwit what would happen if someone then released a packages package :) |
| 07:47:03 | <Cale> | I just thought of something regarding unamb... |
| 07:47:15 | <pumpkin> | what about it? |
| 07:47:36 | <Cale> | Suppose we have x = unamb a y, and y = unamb b c |
| 07:48:01 | <Cale> | and at some point we evaluate x, and 'a' succeeds in evaluating first. |
| 07:48:33 | <Cale> | Then later, we evaluate y, and suddenly it needs to try evaluating b and c again |
| 07:49:09 | <Cale> | But given the precondition on unamb, it shouldn't really have to. We've succeeded in computing a value, namely, that of 'a', which ought to do. |
| 07:50:09 | <Cale> | So it seems like it would be nice to arrange for all the losers to somehow get information about the value which ended up winning too. |
| 07:50:55 | <pumpkin> | hmm |
| 07:51:00 | <augustss> | Sounds like a multiargument unamb |
| 07:51:06 | <maltem> | Why would you evaluate y if you defined x at the “top”? |
| 07:51:55 | <maltem> | s/would you/would you want to/ |
| 07:52:30 | <Cale> | maltem: Well, I'm not suggesting that the program actually looks like this. Maybe the unamb'd terms are part of some recursive algorithm, and not all of them are in scope at once. |
| 07:52:55 | <Cale> | (I just want for x and y to have those expressions as values) |
| 07:53:13 | <maltem> | ok |
| 07:53:55 | <Cale> | By breaking the precondition, we can observe that the current library doesn't do this: |
| 07:54:05 | <Cale> | Prelude Data.Unamb> let x = unamb 1 2 |
| 07:54:05 | <Cale> | Prelude Data.Unamb> let y = unamb 3 x |
| 07:54:05 | <Cale> | Prelude Data.Unamb> x |
| 07:54:05 | <Cale> | 1 |
| 07:54:05 | <Cale> | Prelude Data.Unamb> y |
| 07:54:05 | <Cale> | 3 |
| 07:54:32 | <augustss> | By breaking the preconding you might lunch missiles for all we know. |
| 07:54:39 | <augustss> | precondition |
| 07:54:52 | <augustss> | launch! |
| 07:55:02 | <augustss> | grrrr, no coffee yet :) |
| 07:55:15 | <Cale> | er, actually, that was the wrong way around anyway |
| 07:55:42 | <Cale> | Prelude Data.Unamb> let x = unamb 1 2 |
| 07:55:42 | <Cale> | Prelude Data.Unamb> let y = unamb 3 x |
| 07:55:42 | <Cale> | Prelude Data.Unamb> y |
| 07:55:42 | <Cale> | 3 |
| 07:55:42 | <Cale> | Prelude Data.Unamb> x |
| 07:55:42 | <Cale> | 1 |
| 07:55:47 | <Cale> | better test :) |
| 07:56:41 | <sm> | mzero inside a parsec parser would mean "this parser failed", is that right ? |
| 07:56:43 | <Cale> | I don't expect smaller completed subcomputations necessarily to be able to inform larger ones they become part of, but that large computations which finish to inform each of their components. |
| 07:56:49 | <Cale> | sm: yes |
| 07:56:53 | <sm> | thx |
| 07:57:06 | <Cale> | sm: It's the parser which doesn't match any string. |
| 07:58:25 | <Cale> | anyway, this unamb thing seems like something to think about |
| 07:58:40 | <Cale> | I fear that it's already complicated enough though ;) |
| 08:04:54 | <maltem> | What monad transformer library do the cool kids use today? mlt, monads? -tf or no -tf? |
| 08:05:28 | <dmwit> | tf? |
| 08:05:54 | <Cale> | maltem: Well, many many things are linked to mtl, but mtl is not very cool. |
| 08:06:00 | <MyCatVerbs> | t and f are close to f and d onna keyboard. |
| 08:06:11 | <MyCatVerbs> | Assuming maltem types QWERTY. |
| 08:06:20 | <maltem> | dmwit, apparently, type families instead of funct. dep. |
| 08:06:31 | <maltem> | Cale, yeah, thus the question |
| 08:06:42 | <MyCatVerbs> | Oh. Huh. |
| 08:07:22 | <dmwit> | All the cool kids use category-extras. ;-) |
| 08:07:53 | <dmwit> | But yeah, mtl is the only monad transformer library I know of, really. |
| 08:08:23 | <Cale> | I think it would be interesting for someone to construct the mtl monads in terms of MonadPrompt. Actually, I should do that myself, as I already have the code for half of them. |
| 08:09:50 | <osfameron> | ACTION idly wonders whether knitting is monadic |
| 08:11:05 | <maltem> | mm MonadPrompt doesn't even look uninteresting |
| 08:11:27 | <Cale> | You need to look at the actual source to understand what's going on though :) |
| 08:11:41 | <Cale> | http://hackage.haskell.org/packages/archive/MonadPrompt/1.0.0.1/doc/html/src/Control-Monad-Prompt.html |
| 08:11:53 | <Cale> | Somehow it's not properly haddocked |
| 08:13:47 | <maltem> | yeah figured that out |
| 08:15:33 | <Twey> | Also, the syntax highlighter fails at LHS :) |
| 08:17:18 | <Cale> | The fact that the monad laws cannot be broken with Prompt/RecPrompt is interesting. |
| 08:17:53 | <maltem> | Twey, also hackage fails at printing slashes |
| 08:18:08 | <Cale> | > liftP :: Prompt p r -> PromptT p m r |
| 08:18:08 | <Cale> | > liftP = runPromptM prompt |
| 08:18:10 | <lambdabot> | Not in scope: type constructor or class `Prompt'Not in scope: type construc... |
| 08:18:10 | <lambdabot> | <no location info>: parse error on input `=' |
| 08:18:13 | <Cale> | ^^ so, so clever :) |
| 08:20:32 | <maltem> | ACTION went back to http://www.mail-archive.com/haskell-cafe@haskell.org/msg33040.html |
| 08:23:01 | <Cale> | It's really a beautiful and underappreciated technique. |
| 08:25:31 | <hatds> | if I want a symmetric difference for Data.Set do I really need to call union, intersection, and difference? Seems like it won't be the most direct way |
| 08:27:16 | <dmwit> | Just Do It |
| 08:27:53 | <dmwit> | :t \a b -> a \\ b `union` b \\ a |
| 08:27:54 | <lambdabot> | Precedence parsing error |
| 08:27:54 | <lambdabot> | cannot mix `\\' [infix 5] and `\\' [infix 5] in the same infix expression |
| 08:28:03 | <dmwit> | :t \a b -> (a \\ b) `union` (b \\ a) |
| 08:28:04 | <lambdabot> | forall a. (Eq a) => [a] -> [a] -> [a] |
| 08:34:56 | <nominolo> | @pl m >>= \c -> f c e |
| 08:34:57 | <lambdabot> | flip f e =<< m |
| 08:35:00 | <WorkyBob> | If anyone has any cunning ideas about this problem, I'd be really interested... http://noordering.wordpress.com/2009/06/05/collecting-non-memory-resources/ |
| 08:36:01 | <nominolo> | WorkyBob: do you know about the paper "lightweight static resources" |
| 08:36:14 | <WorkyBob> | I don't *runs off to look it up* |
| 08:38:05 | <Gracenotes> | D: |
| 08:38:15 | <WorkyBob> | ? |
| 08:38:17 | <pumpkin> | zomg Gracenotes |
| 08:38:35 | <Gracenotes> | O: |
| 08:39:34 | <nominolo> | WorkyBob: don't you actually want the resource management dto be done by the *compiled* program, though? |
| 08:40:01 | <WorkyBob> | nominolo: no, the compiled program *is* the resource |
| 08:40:14 | <WorkyBob> | it's a chunk of memory that gets shoved onto the GPU |
| 08:40:24 | <WorkyBob> | and needs to be deleted when we can no longer run it |
| 08:41:00 | <nominolo> | ah, but running it requires a reference to it, no? |
| 08:41:05 | <WorkyBob> | exactly |
| 08:41:21 | <nominolo> | so you would call it explicitly from within your haskell program |
| 08:41:33 | <WorkyBob> | call what explicitly? |
| 08:41:55 | <nominolo> | the compiled program (the bits in the graphics memory) |
| 08:42:03 | <WorkyBob> | oh, yeh |
| 08:42:28 | <WorkyBob> | the type Shader might be something like VertexArray -> NormalArray -> TexCoordArray -> IndexArray -> IO () |
| 08:42:43 | <WorkyBob> | give it a bunch of objects to render, and it produces an IO action that does the rendering |
| 08:43:21 | <voker57> | how to write type signature for Data.Map? Like :: Map (String, Int) |
| 08:43:43 | <WorkyBob> | voker57: you want a map from strings onto ints? |
| 08:43:49 | <voker57> | WorkyBob: yes |
| 08:43:56 | <WorkyBob> | someMap :: Map String Int |
| 08:44:03 | <nominolo> | WorkyBob: so, how does it happen that your shader code goes out of scope? |
| 08:44:13 | <voker57> | works, thanks |
| 08:44:47 | <pumpkin> | WorkyBob: can you give your compiler a buffer to compile to? if so, just give it a ByteArray# or something and let ghc take care of the rest? |
| 08:44:55 | <WorkyBob> | nominolo: well for example myShader could be a constant defined in a render function, when execution leaves that function, myShader is no longer in scope, we can't run it, and the resources on the GPU should be collected |
| 08:45:09 | <pumpkin> | oh, I see |
| 08:46:10 | <WorkyBob> | pumpkin: unfortunately, no, the act of compiling is a matter of giving a couple of strings to opengl and getting back a single int that can be used as a reference to the GPU resource |
| 08:46:30 | <nominolo> | WorkyBob: you mean a local function / variable? Hm. |
| 08:46:41 | <WorkyBob> | indeed |
| 08:47:32 | <WorkyBob> | or perhaps we get a Chan containing render configurations, we grab items out of it, compile the shader, use it a few times, and then throw it away |
| 08:47:39 | <WorkyBob> | and move onto the next item in the chan |
| 09:05:42 | <Yakov> | hey |
| 09:51:40 | <sm> | hmm.. ghc manual and mail list buzz says to avoid orphan instances, but I have a lot and don't see how to get rid of them |
| 09:52:16 | <sm> | without running into circular dependencies |
| 09:55:51 | <sm> | I think they affect ghc only at compile time, not run time |
| 10:03:08 | <Peaker> | sm: I think the idea is that the author of the class, or the author of the type, and not a 3rd party should be in charge of instances. If its a 3rd party, there's no way to have a policy that prevents instance collisions |
| 10:03:25 | <Peaker> | (if the 3rd parties are not in sync with each other and the class/type authors) |
| 10:03:48 | <sm> | right |
| 10:04:44 | <sm> | in this case I own the type and the instances, but to avoid circular deps I have put types at the bottom in Types.hs and instances, which involve more complex interdependent code, in Type1.hs, Type2.hs .. |
| 10:05:35 | <Peaker> | can't the instances be defined with the type, and just happen to call code that's somewhere else? |
| 10:07:20 | <Baughn> | So I did this tiny little trivial cleanup-style change to reactive.. and ghc is now segfaulting |
| 10:10:04 | <pozic> | Baughn: it's called reactive for a reason. |
| 10:12:30 | <ivanm> | is there a way of removing the newline at the end of a String if there is one? |
| 10:12:53 | <Baughn> | > lines "foo\n" |
| 10:12:54 | <ivanm> | I could init it, but I'm not sure if I can guarantee that there will be a \n there, it just looks like there will be |
| 10:12:54 | <lambdabot> | ["foo"] |
| 10:13:01 | <Baughn> | > lines "foo" |
| 10:13:02 | <lambdabot> | ["foo"] |
| 10:13:17 | <ivanm> | yeah, I could do head . lines ... |
| 10:13:23 | <ivanm> | looks a bit hackish to me... |
| 10:13:26 | <ivanm> | *shrug* oh well |
| 10:13:33 | <MyCatVerbs> | > map (unlines . lines) ["foo\nbar","foo\nbar\n"] |
| 10:13:34 | <lambdabot> | ["foo\nbar\n","foo\nbar\n"] |
| 10:13:44 | <MyCatVerbs> | Oh fun. |
| 10:13:55 | <Twey> | Heh |
| 10:14:12 | <Twey> | > unlines $ lines "foo\r\nbar\r\n" |
| 10:14:13 | <lambdabot> | "foo\r\nbar\r\n" |
| 10:14:41 | <Gracenotes> | it doesn't "see" \r's |
| 10:14:58 | <MyCatVerbs> | > map (fix (\f l -> case l of { ('\n':[]) -> []; x -> x; })) ["foo\nbar\n","foo\nbar"] |
| 10:14:59 | <lambdabot> | ["foo\nbar\n","foo\nbar"] |
| 10:15:08 | <ivanm> | Gracenotes: it could be OS specific |
| 10:15:12 | <MyCatVerbs> | Uhhhh...? |
| 10:15:17 | <MyCatVerbs> | @src lines |
| 10:15:17 | <lambdabot> | Source not found. Sorry about this, I know it's a bit silly. |
| 10:15:20 | <Twey> | ivanm: Nay |
| 10:15:25 | <ivanm> | or else when it's read in from file, all \r\n and \r just become \r ... |
| 10:15:29 | <ivanm> | Twey: hmmm... |
| 10:15:38 | <ivanm> | ACTION had issues with Python because of that.. |
| 10:15:42 | <Twey> | ivanm: The file IO functions have OS-specific behaviours |
| 10:15:48 | <Gracenotes> | ivanm: it isn't |
| 10:15:49 | <ivanm> | no, wait, it was to try and read in a line at a time |
| 10:15:51 | <ivanm> | Twey: yeah |
| 10:15:55 | <MyCatVerbs> | > map (fix (\f l -> case l of { ('\n':[]) -> "underpants"; x -> x; })) ["foo\nbar\n","foo\nbar"] |
| 10:15:56 | <lambdabot> | ["foo\nbar\n","foo\nbar"] |
| 10:15:57 | <Twey> | Such that on Windows, \r\n looks like \n to Haskell |
| 10:15:58 | <lilac> | yeah, newline conversion usually/traditionally happens at the point of IO |
| 10:16:06 | <MyCatVerbs> | Oh, oops. Heh. |
| 10:16:12 | <Twey> | But it doesn't work with sockets |
| 10:16:16 | <Peaker> | ivanm, Twey: That's what text mode files are about? |
| 10:16:22 | <ivanm> | so maybe lines ignores \r because it thinks its been read in properly |
| 10:16:27 | <Twey> | Peaker: Aye |
| 10:16:31 | <ivanm> | Peaker: "text mode files"? |
| 10:16:36 | <Twey> | ivanm: *nod* |
| 10:16:41 | <Gracenotes> | for IO, one should use binary file functions to avoid the OS-specific behavior |
| 10:16:41 | <lilac> | ivanm: the text 'open mode' for files |
| 10:16:45 | <MyCatVerbs> | > map (fix (\f l -> case l of { ('\n':[]) -> []; (a:as) -> a : f as; [] -> []; })) ["foo\nbar\n","foo\nbar"] |
| 10:16:46 | <lambdabot> | ["foo\nbar","foo\nbar"] |
| 10:16:52 | <ivanm> | lilac: as opposed to binary? |
| 10:16:52 | <Peaker> | ivanm: yeah, libc's text mode file open is about adapting retarded old formats kept for compatibility to a simpler format (\n only) |
| 10:16:57 | <fasta> | Is there some generalized Prelude somewhere? Containing all the list functions, but which then also work for a Data.Sequence.Seq. Doing toList conversions all the time seems like a bad idea. |
| 10:17:19 | <fasta> | E.g. instead of gen_sum = sum . toList |
| 10:17:26 | <ivanm> | fasta: what kind of list-specific stuff are you doing on Sequence? |
| 10:17:36 | <ivanm> | use its Foldable instance? |
| 10:17:46 | <lilac> | ivanm: yeah, the lack of the 'b' in the open flags given to fopen(3) |
| 10:18:15 | <fasta> | ivanm: yes, but I was basically asking whether the Prelude had already been ported in this sense. |
| 10:18:27 | <ivanm> | fasta: I doubt it |
| 10:20:18 | <Baughn> | Yeah, okay - I've traced it to Debug.Trace statements. Inserting one causes my programs to crash. |
| 10:20:59 | <fasta> | Baughn: I had that recently too. |
| 10:21:14 | <MyCatVerbs> | Baughn: interesting. unsafePerformIO bugged? Poke GHC's Trac? |
| 10:21:15 | <fasta> | Baughn: but it turned out there was another issue also. |
| 10:21:23 | <Baughn> | MyCatVerbs: Actually. Not quite. |
| 10:21:38 | <Baughn> | MyCatVerbs: It appears that just touching the definition of this merge function /at all/ causes crashes |
| 10:21:41 | <Baughn> | It's not just merge |
| 10:21:43 | <Baughn> | *trace |
| 10:22:25 | <Baughn> | ..seriously, replacing foo `unamb` bar `unamb` baz with foldr1 unamb [foo,bar,baz] makes it crash |
| 10:22:41 | <sm> | Peaker: sorry to disappear.. it seems not, but I'll try again later |
| 10:23:19 | <Peaker> | sm: instance Eq MyType where (==) = implementationIsElsewhere ? |
| 10:23:23 | <ivanm> | Baughn: :o |
| 10:23:37 | <sm> | would anyone know what is the second value returned by unit test runners ? eg runVerboseTests :: Test -> IO (Counts, Int) |
| 10:23:48 | <Baughn> | @tell conal By the way, I'm pretty sure the foldr1 in unambs should be a foldl1 |
| 10:23:48 | <lambdabot> | Consider it noted. |
| 10:24:34 | <sm> | Peaker: to import implementationIsElsewhere is difficult |
| 10:27:56 | <Peaker> | sm: oh - how come your modules have such inter-dependencies? can you draw a little text graph of your types in a paste? |
| 10:32:33 | <Trollinator> | say, i have a tuple that contains only types that are instances of Num, and i have a polymorphic function that works on all num types. |
| 10:32:51 | <Trollinator> | is it possible to write a function that applies the function to every element of the tuple? |
| 10:33:26 | <MyCatVerbs> | There's no induction on tuples, unfortunately. |
| 10:33:27 | <sm> | Peaker: I've lost the one I had.. the types are at http://hledger.org/api-doc/Ledger-Types.html |
| 10:33:29 | <fasta> | Trollinator: only HLists solve that problem. |
| 10:33:37 | <Trollinator> | HList? |
| 10:33:45 | <fasta> | @google HList oleg |
| 10:33:49 | <lambdabot> | http://homepages.cwi.nl/~ralf/HList/ |
| 10:33:49 | <lambdabot> | Title: Strongly typed heterogeneous collections |
| 10:34:07 | <Peaker> | Trollinator: you could hold them in a list of existentials, instead? |
| 10:34:23 | <Peaker> | Trollinator: or apply your function before putting them in the tuple/list? |
| 10:34:45 | <sm> | I will try again. It seems to preclude complex instance methods |
| 10:35:00 | <Trollinator> | i'm not trying to solve any problem, i was just wondering whether it's possible in Haskell. |
| 10:35:06 | <Trollinator> | (it will be in C++1x :p) |
| 10:35:34 | <Axman6> | so it's moved from being called C++0x? |
| 10:35:43 | <fasta> | Trollinator: it depends on what you think of as a tuple. If you think about that rather abstractly, the answer is yes, otherwise no. |
| 10:36:12 | <fasta> | Trollinator: It's certainly not in H98. |
| 10:36:15 | <Axman6> | , everywhere (+5) (1 :: Int, 2 :: Double) |
| 10:36:17 | <Trollinator> | Axman6: it won't be done this year, so 0x doesn't really make sense (assuming you want the x to be decimal). |
| 10:36:17 | <lunabot> | luna: Could not deduce (GHC.Num.Num a) |
| 10:36:23 | <Axman6> | :( |
| 10:36:41 | <Axman6> | bah, it should be C++Ax |
| 10:37:16 | <Peaker> | Trollinator: its possible in various ways, yeah |
| 10:37:52 | <Peaker> | Trollinator: List of existentials, HList. If you want to do something on all elements of a tuple, then you probably want a list instead |
| 10:38:08 | <Trollinator> | what is an existential? |
| 10:39:37 | <fasta> | Trollinator: basically a box with a tag on it saying you can only do this, this and that with this box. |
| 10:39:53 | <fasta> | Trollinator: this and that being methods. |
| 10:40:02 | <Peaker> | Trollinator: forall tiger. not (tiger is black) == all tigers are not black. not (forall tiger. tiger is black) == not all tigers are black == exists tiger. not (tiger is black) |
| 10:40:07 | <fasta> | Trollinator: the longer explanation is in the user manual. |
| 10:40:35 | <Trollinator> | fasta: i'll look it up. |
| 10:40:37 | <Peaker> | Trollinator: so basically, if you have nested forall's on types, then they are existentials, in the context of the outer statement. In Haskell types, it is similar. |
| 10:40:43 | <Trollinator> | Peaker: i've had that in my logic class. |
| 10:41:16 | <fasta> | Trollinator: it's not really intuitive (the mapping from logic to types as in Haskell). |
| 10:41:29 | <Peaker> | Trollinator: if you have a function: forall a. a -> a then the caller gets to choose any a it wants, and the function has to be polymorphic to all a's. If you have a function: exists a. a -> a then the caller needs to specify some specific a and the function need not be polymorphic to all a's |
| 10:41:37 | <Peaker> | fasta: I find it intuitive :) |
| 10:41:56 | <fasta> | Peaker: maybe because I always use forall, instead of exists. |
| 10:42:10 | <Peaker> | fasta: Haskell doesn't have "exists", you can get its effect via nested forall's |
| 10:42:18 | <fasta> | Peaker: right. |
| 10:42:35 | <Trollinator> | ugh |
| 10:42:48 | <fasta> | Peaker: that's what not intuitive about it. |
| 10:42:51 | <Trollinator> | it sounds interesting, maybe i'll look it up later. |
| 10:42:58 | <fasta> | is not* |
| 10:43:52 | <l0g0ut> | Hiya, how do you pass what would be considered commandline arguments while in ghci? |
| 10:44:33 | <Axman6> | you can't afaik |
| 10:44:52 | <l0g0ut> | As in if I run ghci <file.hs>, and then invoke main and wanted it to act as though I compiled it and ran ./program <args... |
| 10:45:01 | <doserj> | :set args ... |
| 10:45:06 | <l0g0ut> | ah |
| 10:45:40 | <l0g0ut> | Thanks, that works. |
| 10:45:48 | <Axman6> | oh how handeh |
| 10:46:14 | <Peaker> | Trollinator: anyway, you can have: data AnyNum = forall a. Num a => AnyNum a -- Now you can put any type in AnyNum as long as its Num, when you take it out of there you get an (exists a.) though |
| 10:49:44 | <Baughn> | @tell conal Could you try out the http://brage.info/~svein/reactive.patch patch? It causes RTS crashes on my computer, for no apparent reason. |
| 10:49:45 | <lambdabot> | Consider it noted. |
| 10:49:54 | <Peaker> | I wish I could define an instance by "redirecting all methods" to some function of the value |
| 10:50:36 | <Baughn> | @tell conal (In fact, doing just about anything with that function causes crashes, which makes debugging hard) |
| 10:50:36 | <lambdabot> | Consider it noted. |
| 10:55:21 | <ivanm> | with kuribas' mode, can it auto-complete a function name like the standard indentation mode does in emacs (after you type in the signature)? |
| 10:56:06 | <quicksilver> | I was unware of that feature but I wouldnt' ahev thought it was rleated to the indentation mode in use. |
| 10:56:40 | <ivanm> | there seems to be a lot of keybindings that are related to the indentation mode (unless I'm not setting the haskell-mode-hook properly), like C-c C-= :s |
| 10:56:56 | <fasta> | ivanm: auto-complete a function name? How?! |
| 10:57:17 | <ivanm> | fasta: auto-insert, I should say |
| 10:57:24 | <opqdonut> | fasta: he means, after you type "f :: something" and press return, it autoinserts "f " |
| 10:57:29 | <opqdonut> | stub for the definition |
| 10:57:36 | <ivanm> | opqdonut: well, and indent possibly |
| 10:57:40 | <opqdonut> | that too |
| 10:57:53 | <fasta> | opqdonut: oh, I wouldn't use that anyway. |
| 11:04:46 | <EvilRanter> | ACTION zerg rushes EvilTerran |
| 11:05:05 | <quicksilver> | ivanm: yeah I'm not sure why C-c C-= got lost. |
| 11:05:13 | <quicksilver> | ivanm: but I just use align-regexp now anyway |
| 11:05:17 | <quicksilver> | so I'm glad I learn about it :) |
| 11:05:24 | <ivanm> | it's in haskell-indent |
| 11:05:51 | <ivanm> | and I use align-regexp as well, but haskell-indent also has C-c C-., which aligns both the :: and = when selected |
| 11:06:03 | <ivanm> | so I don't have to think of the regex for it ;-) |
| 11:07:00 | <ivanm> | I like aspects of kuribas' mode in terms of finding where to indent... but I'm used to the cyclic tab behaviour rather than hitting backspace, and all these code-insertion style behaviours :s |
| 11:09:09 | <Bacta> | @fag can Haskell score me some Ritalin? |
| 11:09:09 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 11:10:40 | <ivanm> | > reverse "nilatir" |
| 11:10:41 | <lambdabot> | "ritalin" |
| 11:10:44 | <ivanm> | ^^ Bacta |
| 11:10:45 | <ivanm> | ;-) |
| 11:11:08 | <Bacta> | ;) |
| 11:12:19 | <sioraiocht> | @src unfoldr |
| 11:12:19 | <lambdabot> | unfoldr f b = case f b of |
| 11:12:19 | <lambdabot> | Just (a,new_b) -> a : unfoldr f new_b |
| 11:12:19 | <lambdabot> | Nothing -> [] |
| 11:32:39 | <bastl> | hi im reinstalling ghc: and get this message when installing network: Could not find module `Data.Generics': it is a member of package base-3.0.3.0, which is hidden. ghc-pkg list shows both 4.0.0 and 3.0.something. What should i do? |
| 11:33:31 | <bastl> | btw it's about ghc-6.10.1 |
| 11:34:07 | <ivanm> | bastl: which version of network |
| 11:34:07 | <quicksilver> | sounds like you're installing an old version of network? |
| 11:34:09 | <ivanm> | ? |
| 11:34:22 | <bastl> | latest from hackage |
| 11:34:32 | <ivanm> | quicksilver: that's what I thought |
| 11:34:38 | <bastl> | 2.2.0.0 |
| 11:34:40 | <ivanm> | bastl: how "latest"? |
| 11:34:54 | <ivanm> | 2.2.1.2 is the latest |
| 11:34:56 | <bastl> | oops |
| 11:35:02 | <HugoDaniel> | hello |
| 11:35:12 | <bastl> | used the top item from hackages (googles) search field ... |
| 11:35:14 | <ivanm> | bastl: and no base hackery required |
| 11:35:21 | <bastl> | not up to date obviously ... |
| 11:37:27 | <ivanm> | hmmm... is it a bad thing that I've gotten so used to cabal-install's upgrade command not doing anything when I just want to find out which packages I _can_ potentially upgrade? |
| 11:37:41 | <ivanm> | bastl: make that 2.2.1.3 |
| 11:37:51 | <ivanm> | .3 must have been released in the last day or two |
| 11:46:02 | <ivanm> | "cond: Illegal token: layout-next" :s |
| 11:46:02 | <ivanm> | why doesn't kuribas' mode like me? :( |
| 11:46:02 | <bastl> | thanks, now i have cabal-install running and everything is ok ... |
| 11:46:08 | <ziman> | i'm having a problem with this program http://codepad.org/U48GfEPK, which is supposed to read a 4G database dump from its input and split it into files, one file per each table. the problem is that it gradually eats all available memory (and does not free it even between files) and I cannot figure out where the leak is; could somebody give me a hint? |
| 11:48:25 | <mreh> | must focus whilst reading documentation |
| 11:50:36 | <mreh> | is there a project looking into standardising haskell again? |
| 11:50:53 | <mreh> | all these different compilers with their own libraries |
| 11:51:24 | <EvilTerran> | there's the "haskell platform" |
| 11:51:29 | <mreh> | haskell98 is like the core standard, am I right in saying that? |
| 11:52:32 | <EvilTerran> | that's a pretty good way of putting it |
| 11:52:51 | <ivanm> | mreh: there's haskell' which is going to define a new standard |
| 11:52:56 | <ivanm> | whenever they get around to it, that is :p |
| 11:53:07 | <EvilTerran> | although the heirarchical module system extension is also considered pretty obligatory in a haskell implementation |
| 11:53:11 | <mreh> | haskell prime? |
| 11:53:18 | <ivanm> | mreh: yes |
| 11:53:30 | <ivanm> | EvilTerran: isn't that an extension to the report? |
| 11:53:36 | <ivanm> | like FFI is? |
| 11:53:41 | <EvilTerran> | i don't recall |
| 11:53:55 | <EvilTerran> | ... i tend to view hs' as more of a list of ideas for people who are designing languages inspired by haskell to take on board |
| 11:54:02 | <ivanm> | heh |
| 11:54:08 | <EvilTerran> | rather than something that's going to become a formal successor to h98 |
| 11:55:06 | <mreh> | which is more relevant, hs98 or the heirachical libraries |
| 11:55:28 | <ivanm> | both |
| 11:55:28 | <EvilTerran> | mreh, er, the heirarchical library extension is a very minimal addition to h98 |
| 11:55:59 | <mreh> | From the Cabal webpage: We also avoid the haskell98 package, preferring the newer hierarchical modules. |
| 11:56:07 | <mreh> | now I'm confused |
| 11:56:32 | <EvilTerran> | mreh, ah, that's referring to the difference between the List, Monad, etc modules defined in the h98 specification |
| 11:56:43 | <EvilTerran> | and Data.List, Control.Monad, etc, as used under heirarchical modules |
| 11:56:46 | <mreh> | EvilTerran, oh |
| 11:57:01 | <Saizan_> | the haskell98 package is one thing, the haskell 98 standard is another |
| 11:57:17 | <mreh> | so when someone says "haskell", they can mean one of several things |
| 11:57:23 | <dcoutts> | mreh: where on the cabal website does it say that? |
| 11:57:25 | <mreh> | just like when someone says java |
| 11:57:26 | <EvilTerran> | List, Monad, etc will be in the haskell98 package, while Data.List, Control.Monad etc will be in, er, base? |
| 11:57:37 | <dcoutts> | EvilTerran: right |
| 11:57:38 | <Saizan_> | they usually mean haskell 98 + non-controversial extensions |
| 11:57:53 | <mreh> | http://hackage.haskell.org/trac/hackage/wiki/SourceGuide, under "Language Features and packages" |
| 11:57:59 | <mreh> | dcoutts: there |
| 11:58:56 | <mreh> | I think it meant to say "certain packages from haskell98" |
| 11:59:10 | <dcoutts> | mreh: no, it means literally the package called "haskell98" |
| 11:59:44 | <EvilTerran> | mreh, in this context (and in general in haskell), "package" means "collection of modules we keep together" |
| 11:59:47 | <mreh> | oh, so haskell98 isn't a language standard also, |
| 12:00:19 | <EvilTerran> | mreh, the language standard is Haskell 98. the modules defined in it are in the cabal package called haskell98. |
| 12:00:19 | <mreh> | I used to use java, forgive me for my ignorance |
| 12:00:32 | <mreh> | EvilTerran: Ohhhhh |
| 12:00:57 | <EvilTerran> | the upgraded versions of those modules, with heirarchical names (like Data.List instead of just List) are in the cabal package called "base" |
| 12:01:08 | <EvilTerran> | (along with some other stuff) |
| 12:01:21 | <mreh> | mmm, unnecessary complexity |
| 12:01:34 | <dcoutts> | ACTION clarifies the page mreh was looking at |
| 12:02:01 | <mreh> | Can I have a note of thanks for pointing out the lack of clarity? |
| 12:02:11 | <dcoutts> | mreh: thanks :-) |
| 12:02:34 | <EvilTerran> | mreh++ |
| 12:02:43 | <mreh> | woop |
| 12:02:45 | <Saizan_> | you should never draw connections to similary named things in CS, unless the connection is explicit :) |
| 12:02:56 | <Saizan_> | s/to/between/ |
| 12:03:22 | <mreh> | You can't function in a world like that |
| 12:04:52 | <dcoutts> | The "Haskell 98" language and the "haskell98" package are clearly closely related |
| 12:05:34 | <mreh> | they are the the same string to most people! |
| 12:05:36 | <dcoutts> | which is why we have to qualify when we mean the haskell98 package |
| 12:05:43 | <mreh> | yes, |
| 12:05:49 | <mreh> | thanks for your help |
| 12:06:58 | <mreh> | is package hierachy in Haskell 98 |
| 12:08:20 | <quicksilver> | packages aren't really part of the langauge at all |
| 12:08:30 | <quicksilver> | there are no languages features which interact with them. |
| 12:08:38 | <quicksilver> | they're a tool issue. |
| 12:08:48 | <mreh> | is it all done by the preprocessor? |
| 12:09:39 | <Saizan_> | no |
| 12:09:40 | <mreh> | that whole business of re-importing packages doesn't sit well with me, it's alright for a computer to keep track of, not a squishy human |
| 12:09:43 | <ray> | we are not barbarians! |
| 12:10:01 | <quicksilver> | mreh: you mean modules, I think. |
| 12:10:06 | <mreh> | yes, modules |
| 12:10:12 | <quicksilver> | packages are different. |
| 12:10:15 | <Saizan_> | re-importing? |
| 12:10:17 | <quicksilver> | modules *are* part of the language. |
| 12:10:22 | <mreh> | oh :D |
| 12:10:27 | <quicksilver> | modules are not really in a hierarchy. |
| 12:10:32 | <quicksilver> | the *names* are hierarchical. |
| 12:10:35 | <mreh> | java-packages, haskell-modules |
| 12:10:35 | <quicksilver> | but that's just naming. |
| 12:10:53 | <quicksilver> | Foo.Bar.Baz is not in any way related to Foo.Bar |
| 12:10:57 | <quicksilver> | they're just two names |
| 12:11:02 | <quicksilver> | (As far as the system is concerned) |
| 12:11:08 | <mreh> | there's no scoping then |
| 12:11:08 | <WorkyBob> | quicksilver: well, that depends on the compiler |
| 12:11:28 | <Saizan_> | exactly, there's no import Foo.Bar.* |
| 12:11:28 | <quicksilver> | mreh: there is plenty of scoping. |
| 12:11:36 | <WorkyBob> | ghc for example expects to find the file for Foo.Bar.Baz one level deeper in the same heirarchy as Foo.Bar |
| 12:11:37 | <quicksilver> | mreh: but not for modules. |
| 12:11:43 | <quicksilver> | WorkyBob: no it doesn't. |
| 12:11:47 | <mreh> | quicksilver, java packages are scoped, but haskell modules are not, that's what i meant |
| 12:11:50 | <quicksilver> | WorkyBob: that's just one place it will look. |
| 12:12:03 | <WorkyBob> | hmm, true that actually |
| 12:12:04 | <quicksilver> | WorkyBob: if the package database tells it otherwise, it will look elsewhere. |
| 12:12:24 | <quicksilver> | anyhow, I'm trying to explain language features to mreh ;) |
| 12:12:32 | <quicksilver> | in *language* terms, the hierarchy is suggestive, that's all. |
| 12:12:35 | <quicksilver> | really they're just names. |
| 12:12:50 | <quicksilver> | similar names act as a "hint" to a human being that you might expect the modules to be related. |
| 12:12:53 | <mreh> | mmhm |
| 12:14:56 | <WorkyBob> | quicksilver: it's a shame really - would have been nice to somehow have a tag based system |
| 12:15:23 | <quicksilver> | there is quite a lot about it that's a shame |
| 12:15:29 | <WorkyBob> | yeh |
| 12:15:31 | <quicksilver> | but, equally, i don't have a better proposal. |
| 12:15:36 | <WorkyBob> | true true |
| 12:15:37 | <quicksilver> | I don't really think re-exporting works very well. |
| 12:15:42 | <WorkyBob> | no, ditto |
| 12:15:43 | <mreh> | it's poo |
| 12:15:46 | <WorkyBob> | especially instances/classes |
| 12:15:48 | <mreh> | that's my take |
| 12:15:51 | <quicksilver> | ...and on the other hand I wish you *could* re-export qualified. |
| 12:16:03 | <quicksilver> | instances are global. |
| 12:16:08 | <quicksilver> | any other suggestion is heresy. |
| 12:16:10 | <quicksilver> | You will be burnt. |
| 12:16:19 | <WorkyBob> | >.> |
| 12:16:31 | <quicksilver> | mreh: nah, it's not poo. |
| 12:16:31 | <WorkyBob> | ACTION - creator of orphan instances everywhere |
| 12:16:33 | <WorkyBob> | <.< |
| 12:16:37 | <quicksilver> | mreh: it works. It's just simplistic. |
| 12:16:52 | <mreh> | I dont appreciate it yet obviously |
| 12:17:07 | <quicksilver> | it does its job OK |
| 12:17:08 | <mreh> | I have so much to learn! |
| 12:17:15 | <quicksilver> | it's just sometimes we wish there was somethign which did more. |
| 12:17:21 | <quicksilver> | we have other jobs which need doing. |
| 12:17:34 | <quicksilver> | If only the module system could do plumbing, and make coffee. |
| 12:17:40 | <mreh> | well i am offering my services, i'm trying to get stuck into cabal |
| 12:17:48 | <quicksilver> | good. |
| 12:17:54 | <quicksilver> | although that's the package system not the module system ;) |
| 12:18:15 | <mreh> | what? |
| 12:18:21 | <Absolute0> | Is there any specialized version of minumum that will give me (value, _) from [(_,_)] where value is smallest? Or must I use fold? |
| 12:18:25 | <mreh> | I thought we had slain that beast |
| 12:18:38 | <opqdonut> | :t minimumBy |
| 12:18:39 | <lambdabot> | forall a. (a -> a -> Ordering) -> [a] -> a |
| 12:18:48 | <Absolute0> | spanks |
| 12:18:50 | <Absolute0> | let me try that |
| 12:18:51 | <Absolute0> | :) |
| 12:18:56 | <mreh> | :t (>) |
| 12:18:57 | <lambdabot> | forall a. (Ord a) => a -> a -> Bool |
| 12:19:02 | <mreh> | Ord, Ordering? |
| 12:19:04 | <opqdonut> | > minimumBy (comparing fst) [(1,"hi"),(2,"hello")] |
| 12:19:05 | <lambdabot> | (1,"hi") |
| 12:19:15 | <opqdonut> | :t compare -- mreh |
| 12:19:16 | <lambdabot> | forall a. (Ord a) => a -> a -> Ordering |
| 12:19:24 | <opqdonut> | ?src Ordering |
| 12:19:24 | <lambdabot> | data Ordering = LT | EQ | GT |
| 12:19:37 | <otulp> | Why does a using a "M.Map I64Coord Thingie" exhaust my RAM, but using "M.Map I64Coord Int and then looking up entries in M.Map Int Thingie" work OK? It seems very strange, having to split up my map into two maps, with the first's values being keys in the second. |
| 12:20:19 | <mreh> | quicksilver: so there are packages in haskell, packages being groups of modules |
| 12:20:24 | <opqdonut> | otulp: have you profiled memory usage? |
| 12:20:26 | <mreh> | but you can only import modules |
| 12:20:31 | <opqdonut> | might be a laziness issue |
| 12:21:03 | <lilac> | otulp: at a complete guess, i'd say that in the first case you're either being too strict or too lazy (probably with forcing Thingie or otherwise) |
| 12:21:32 | <lilac> | either that or, in your split map case, do both maps have the same size, or do you reuse Ints? |
| 12:21:43 | <otulp> | I'm trying to force Thingie as much as possible. |
| 12:22:11 | <otulp> | opqdonut: No, not in this case. I'll do that. (takes forever, though) |
| 12:22:56 | <otulp> | lilac: You mean I'm perhaps adding all Thingies to the same entry in the Int map, by mistake? |
| 12:22:58 | <EvilTerran> | mreh, yes, you only import modules, and packages are groups of modules intended to be used together |
| 12:23:19 | <EvilTerran> | mreh, often, one module in a package will import other modules in the same package |
| 12:23:29 | <lilac> | otulp: well, possibly. are the Ints and Thingies in 1-1 correspondence? |
| 12:23:40 | <otulp> | lilac: They should be. |
| 12:24:06 | <lilac> | is it possible that something is holding onto previous values of your map? |
| 12:24:06 | <mreh> | EvilTerran: Does the hierachy also help to stop name clashes |
| 12:24:15 | <otulp> | I mean, I'm sure. They are assigned in the same function. |
| 12:24:24 | <lilac> | ok, fair enough. |
| 12:24:51 | <EvilTerran> | mreh, yes, i guess that's the point of the heirarchical module system |
| 12:25:21 | <otulp> | The map contents come from a list that is not used for anything else. |
| 12:26:01 | <otulp> | But I'll have a look at the heap. |
| 12:26:28 | <lilac> | otulp: i would guess that you have an unevaluated thunk somewhere (or rather, lots of them), and throwing darts blindly i'd guess it's holding onto partially-built versions of the map |
| 12:26:36 | <EvilTerran> | mreh, note that modules in the same package needn't have any commonality in their module names |
| 12:26:46 | <lilac> | otulp: can you paste the code which builds the map? |
| 12:26:53 | <quicksilver> | mreh: right. but packages aren't part of the language. packages are just a tool to install/remove groups of modules. |
| 12:27:21 | <EvilTerran> | mreh, for instance, Control.Monad.ST, Data.STRef, and Data.Array.ST are all in the same package |
| 12:27:21 | <otulp> | lilac: I could do that. What's the paste URL? |
| 12:27:26 | <lilac> | quicksilver: aren't packages also used to allow multiple modules of the same name to coexist? |
| 12:27:29 | <lilac> | @where hpaste |
| 12:27:29 | <lambdabot> | http://hpaste.org/ |
| 12:27:30 | <quicksilver> | yes. |
| 12:27:41 | <quicksilver> | (does what I said contradict that? ;) |
| 12:27:47 | <mreh> | so package, like a debian software package |
| 12:27:57 | <mreh> | I understand |
| 12:27:57 | <quicksilver> | much like, yes. |
| 12:28:07 | <lilac> | quicksilver: 'packages are just ...' implies to me, 'packages are ... and nothing else' |
| 12:28:16 | <quicksilver> | ;) |
| 12:28:21 | <otulp> | hpaste.org seems to be having trouble. |
| 12:28:55 | <lilac> | http://moonpatio.com:8080/fastcgi/hpaste.fcgi/ |
| 12:29:12 | <Absolute0> | where is comparing defined? |
| 12:29:19 | <lilac> | @index comparing |
| 12:29:19 | <lambdabot> | bzzt |
| 12:29:26 | <Absolute0> | its not in list or prelude |
| 12:29:33 | <doserj> | Data.Ord |
| 12:29:33 | <lilac> | Data.Ord |
| 12:29:42 | <EvilTerran> | ?hoogle comparing |
| 12:29:42 | <lambdabot> | Data.Ord comparing :: Ord a => (b -> a) -> b -> b -> Ordering |
| 12:29:42 | <lambdabot> | Distribution.Simple.Utils comparing :: Ord a => (b -> a) -> b -> b -> Ordering |
| 12:29:42 | <mreh> | quicksilver: but if multiple modules of the same name co-exist, how does the compiler know which modules need to be imported? |
| 12:29:43 | <Absolute0> | thanks :) |
| 12:30:13 | <EvilTerran> | Absolute0, why would it be in List? it's got nothing to do with lists :P |
| 12:30:24 | <Absolute0> | right. |
| 12:30:58 | <EvilTerran> | hoogle's useful for finding out that sort of thing |
| 12:31:37 | <Absolute0> | will do for future reference. thanks |
| 12:32:48 | <Bacta> | "Hi I accidentally my Fleshlight. Is it bad?" |
| 12:33:03 | <Peaker> | @src Rational |
| 12:33:03 | <lambdabot> | type Rational = Ratio Integer |
| 12:33:13 | <Absolute0> | accidentally what? |
| 12:33:14 | <Absolute0> | :) |
| 12:33:20 | <Absolute0> | naughty man |
| 12:33:30 | <Bacta> | I'm talking to their customer service representative as we speak ;) |
| 12:33:34 | <Peaker> | @hoogle Ratio a -> (a, a) |
| 12:33:35 | <lambdabot> | System.Random split :: RandomGen g => g -> (g, g) |
| 12:33:35 | <lambdabot> | Test.QuickCheck two :: Monad m => m a -> m (a, a) |
| 12:33:35 | <lambdabot> | Prelude divMod :: Integral a => a -> a -> (a, a) |
| 12:33:35 | <Bacta> | Maybe they'll be able to give me an answer |
| 12:33:44 | <Peaker> | @src Ratio |
| 12:33:44 | <lambdabot> | data (Integral a) => Ratio a = !a :% !a |
| 12:37:40 | <otulp> | lilac: Found the problem while prepraring code for pasting. The code producing the two maps was stricter than the code producing the single map. |
| 12:39:07 | <otulp> | Thanks. |
| 12:40:09 | <lilac> | @quote gwern optimize |
| 12:40:10 | <lambdabot> | gwern says: the best way to optimize a program is to make it lazier or stricter. |
| 12:42:05 | <MyCatVerbs> | The *real* best way to optimize a program is to tell dons that it's been added to the Shootout. |
| 12:43:18 | <guenni> | hi, how can I get a a key press in the command line, something like getKey up? |
| 12:44:12 | <ivanm> | MyCatVerbs: lol |
| 12:44:30 | <EvilTerran> | guenni, i think that's OS-dependent |
| 12:44:59 | <guenni> | EvilTerran: thx |
| 12:45:02 | <EvilTerran> | guenni, System.Posix.Terminal or System.Win32.Console may have what you want |
| 12:45:20 | <guenni> | EvilTerran: I'll check into that, thx |
| 12:47:48 | <Philonous> | Given a list of MVars is there a way to wait for any of them to be filled? |
| 12:48:22 | <Peaker> | :% is not exported -- how do I get the constructor components? |
| 12:48:36 | <lilac> | @remember MyCatVerbs The *real* best way to optimize a program is to tell dons that it's been added to the Shootout. |
| 12:48:36 | <lambdabot> | I will never forget. |
| 12:48:55 | <doserj> | Peaker: denominator and numerator |
| 12:49:13 | <Peaker> | doserj: no numerator&&&denominator ? |
| 12:49:51 | <doserj> | Peaker: no |
| 12:50:14 | <Peaker> | ok, thanks |
| 13:01:16 | <EvilTerran> | Philonous, not without more concurrency or busy polling, as far as i know |
| 13:01:25 | <quicksilver> | Philonous: yes. |
| 13:01:29 | <quicksilver> | using 'more concurrency' |
| 13:01:34 | <quicksilver> | which doesn't strike me as a bad solution ;) |
| 13:01:56 | <quicksilver> | put a thread to sleep on all of them, and wait for the first wakeup. |
| 13:09:53 | <Berengal> | I have a function I don't know what does... :/ |
| 13:09:54 | <hatds> | phooey, I've been hoisted by too much type inference: I wrote (replicateM 1000) fst <$> action instead of replicateM 1000 $ fst <$> action and it still type checks :) |
| 13:09:57 | <Berengal> | And I just wrote it |
| 13:11:04 | <hatds> | hmm, or maybe it is too much overloading on monads |
| 13:11:10 | <otulp> | Berengal: Try feeding the cat to it. See what happens. |
| 13:11:31 | <Berengal> | otulp: It works as intended, but I have no idea why |
| 13:12:06 | <ivanm> | Berengal: excellent! |
| 13:12:23 | <ivanm> | Haskell: helping you unintentionally write obfuscated code that still works ;-) |
| 13:12:24 | <Berengal> | http://haskell.pastebin.com/m677db849 |
| 13:13:17 | <Berengal> | I wonder if I've reached the point where I can actually create an ugly hack that works in haskell... |
| 13:13:24 | <Berengal> | Does this mean I'm starting to become proficient? |
| 13:14:16 | <idnar> | I think you have to write a compiler or monad transformer library or something for that |
| 13:15:42 | <Berengal> | The worst thing is, it typechecked on my first try... |
| 13:21:00 | <emg-2> | Hi. I'm looking for condensed Haskell tutorial. Any links? |
| 13:21:09 | <Berengal> | @where LYAH |
| 13:21:09 | <lambdabot> | www.learnyouahaskell.com |
| 13:22:50 | <ivanm> | Berengal: that's _condensed_? |
| 13:23:01 | <Berengal> | More so than rwh... |
| 13:23:17 | <Berengal> | Perhaps there's the wikibooks, but I suspect that's because they're incomplete |
| 13:23:43 | <Berengal> | (So's LYAH, so the same might apply there) |
| 13:24:52 | <Saizan_> | Berengal: you tied the recursion in a quite weird way |
| 13:25:21 | <hatds> | emg-2: "A Taste of Haskell" is good, it's a video on haskell.org |
| 13:26:10 | <Berengal> | Saizan_: I know... Not sure if that's a good thing :/ |
| 13:26:12 | <Saizan_> | Berengal: more natural: http://haskell.pastebin.com/m279c0a04 |
| 13:26:23 | <Berengal> | For two seconds I almost wanted to do it in python... |
| 13:27:39 | <Berengal> | Saizan_: Indeed. I blame lack of coffee... |
| 13:27:56 | <Saizan_> | however i think you can rewrite the whole thing with many? |
| 13:28:39 | <Saizan_> | many p = ((:) <$> p <*> many p) <|> return [] in parsec, i think |
| 13:30:43 | <Saizan_> | so like this http://haskell.pastebin.com/m52907485 |
| 13:31:18 | <Saizan_> | and maybe msum [ ... ] instead of .. <|> .. <|> .. but that's debatable |
| 13:31:44 | <opqdonut> | btw, why are you passing moves instead of (move moves) as an argument? |
| 13:33:47 | <Peaker> | Data.Map lets you break its invariants with: |
| 13:33:55 | <Peaker> | @type Data.Map.mapKeysMonotonic |
| 13:33:58 | <lambdabot> | forall k1 k2 a. (k1 -> k2) -> M.Map k1 a -> M.Map k2 a |
| 13:34:01 | <Peaker> | ? |
| 13:34:06 | <Peaker> | No Ord requirement there at all |
| 13:34:08 | <quicksilver> | yup. |
| 13:34:14 | <quicksilver> | and with fromAscList, too |
| 13:34:36 | <Peaker> | does it throw a pure exception or just silently break? |
| 13:34:55 | <quicksilver> | it doesn't check. |
| 13:34:57 | <quicksilver> | that's the whole point. |
| 13:35:06 | <quicksilver> | it's fast because it doesn't check. |
| 13:35:08 | <dcoutts_> | @seen Cale |
| 13:35:08 | <lambdabot> | Cale is in #haskell-in-depth, #ghc, #haskell-overflow and #haskell. I last heard Cale speak 5h 12m 6s ago. |
| 13:35:52 | <Peaker> | silently break it is, thanks :-) |
| 13:36:10 | <Peaker> | maybe it should be called unsafeFromAscList, or unsafeMapKeysMonotonic ? |
| 13:36:43 | <opqdonut> | :t fromAscList |
| 13:36:44 | <lambdabot> | Not in scope: `fromAscList' |
| 13:36:52 | <opqdonut> | :t Data.Map.fromAscList |
| 13:36:53 | <lambdabot> | forall k a. (Eq k) => [(k, a)] -> M.Map k a |
| 13:37:07 | <opqdonut> | ah, only Eq |
| 13:37:11 | <EvilTerran> | ?type Data.Map.fromDistinctAscList |
| 13:37:12 | <lambdabot> | forall k a. [(k, a)] -> M.Map k a |
| 13:37:40 | <Saizan_> | to mark unsafe all functions with a precondition looks a bit extreme |
| 13:37:50 | <Peaker> | Saizan_: if they don't check the precondition, why so? |
| 13:38:04 | <Peaker> | Saizan_: I think they should at least be marked *somehow*, if not unsafe |
| 13:38:12 | <Saizan_> | the point of having a precondition is to not check it, imo |
| 13:43:40 | <Peaker> | Saizan_: that's ok - but then such a function should be distinguished from one you can trust the type-checker to validate for you |
| 13:44:02 | <Peaker> | IMO, I should understand what I'm getting from the type-checker when calling a function, and its name is a good place to indicate as such |
| 13:44:25 | <Peaker> | Maybe "unsafe" is just too broad a term, and various terms should be made up for various kinds of potential breakage, and then the specific potential breakage should be mentioned in the name |
| 13:51:38 | <quicksilver> | Peaker: the point of the word 'Monotonic' is to indicate the precondition. |
| 13:51:48 | <quicksilver> | Peaker: you shouldn't be using functions you haven't read the docs for. |
| 13:52:02 | <quicksilver> | the Monotonic makes it fairly clear to me that the function is reqd to be monotonic. |
| 13:52:12 | <maltem> | Let's see, what are the various kinds of potential breakage? 1) Lost referential transparency, 2) Segfault, 3) wrong answers? |
| 13:52:42 | <Peaker> | quicksilver: sure -- but that still doesn't mean it wouldn't fail to *typecheck* if it weren't monotonic. Stuff that isn't checked by the type-checker should be tagged in name and via pure exceptions, or when performance matters, only the former |
| 13:53:31 | <maltem> | Peaker, I think the "Asc" or "DistinctAsc" qualifies as "tagged in name" |
| 13:54:20 | <Peaker> | maltem: but many functions specify in their name preconditions that *are* checked in the type system. Don't you think those should be distinguished from preconditions that aren't? |
| 13:55:05 | <quicksilver> | (in this particular case the type system did pick it up, as you noticed it from the lack of Ord constraint) |
| 13:55:12 | <quicksilver> | that's a slightly unusual interaction though. |
| 13:55:39 | <maltem> | Peaker, hmmm. what would you call it? |
| 13:56:04 | <maltem> | oh I see, something with unsafe or monotonic |
| 13:57:07 | <maltem> | I'm not sure, actually saying that it takes an ascending list is as good to me as saying, lo and behold, there's a precondition! It takes an ascending list! |
| 13:57:24 | <maltem> | Er, sorry for my sarcasm |
| 13:58:19 | <BONUS> | hmm. is it normal that haskell derived the type GHC.Prim.Any for a piece of code that doesn't even mention the primitives? |
| 13:58:22 | <maltem> | Of course, there may be functions where it's less obvious |
| 13:58:44 | <maltem> | BONUS, is that the same as Data.List.Any? |
| 13:58:58 | <quicksilver> | no. |
| 13:59:03 | <quicksilver> | It's something like exists a . a |
| 13:59:06 | <quicksilver> | it's a GHC internal thing. |
| 13:59:20 | <quicksilver> | there seems to be a bug which exposes it in type inference sometimes. |
| 13:59:21 | <maltem> | I see |
| 13:59:34 | <quicksilver> | mabye it's just something like "a" actually |
| 13:59:37 | <quicksilver> | a free type variable. |
| 13:59:51 | <BONUS> | yeah it's supposed to be if i infer it by hand |
| 13:59:56 | <quicksilver> | BONUS: http://hackage.haskell.org/trac/ghc/ticket/2178 |
| 13:59:58 | <BONUS> | yeah, thought it had to be a bug |
| 14:00:23 | <Athas> | My program appears to crash from stack overflow due to huge thunks somewhere, but I can't figure out how to use GHC's profiling tools to figure out where. Any advice? |
| 14:01:08 | <hatds> | could try hpaste'ing the code |
| 14:01:26 | <voker57_> | @hoogle (a -> b) a |
| 14:01:27 | <lambdabot> | No results found |
| 14:01:31 | <voker57_> | @hoogle (a -> b) -> a |
| 14:01:31 | <lambdabot> | Data.Function fix :: (a -> a) -> a |
| 14:01:31 | <lambdabot> | Control.Monad.Fix fix :: (a -> a) -> a |
| 14:01:31 | <lambdabot> | Data.Generics.Schemes everywhere :: (a -> a) -> a -> a |
| 14:01:42 | <Saizan> | compile with -prof -auto-all -caf-all and run with -hd, you'll see the name of the biggest cost centre |
| 14:02:18 | <Saizan> | err, closure, not cost centre |
| 14:02:29 | <EvilTerran> | voker57_, are you looking for something in particular? that type doesn't have any values in it |
| 14:02:50 | <voker57_> | @hoogle (a -> b) -> a -> b |
| 14:02:50 | <lambdabot> | Prelude ($) :: (a -> b) -> a -> b |
| 14:02:50 | <lambdabot> | Prelude ($!) :: (a -> b) -> a -> b |
| 14:02:50 | <lambdabot> | Data.Function ($) :: (a -> b) -> a -> b |
| 14:03:04 | <Athas> | Saizan: thanks, I will do that. |
| 14:03:07 | <Athas> | Also, hpaste seems to be down. |
| 14:03:10 | <voker57_> | EvilTerran: forgot the last part |
| 14:03:12 | <hatds> | needs to be +RTS -hd |
| 14:04:59 | <lilac> | voker57_: id :: (a -> b) -> (a -> b) ;-) |
| 14:05:17 | <voker57_> | lilac: no, i wanted $ |
| 14:05:34 | <voker57_> | the 'apply' operator |
| 14:07:55 | <hesselink> | voker57_: same thing |
| 14:08:02 | <hesselink> | > (+2) `id` 1 |
| 14:08:03 | <lambdabot> | 3 |
| 14:08:24 | <hesselink> | :) |
| 14:08:54 | <voker57_> | map (id) [(+1)] 3 |
| 14:09:00 | <voker57_> | > map (id) [(+1)] 3 |
| 14:09:01 | <lambdabot> | Couldn't match expected type `t1 -> t' |
| 14:09:17 | <voker57_> | > map (id) [(+1)] $ 3 |
| 14:09:19 | <lambdabot> | Couldn't match expected type `a -> b' |
| 14:09:31 | <voker57_> | > map ($) [(+1)] 3 |
| 14:09:32 | <lambdabot> | Couldn't match expected type `t1 -> t' |
| 14:10:21 | <lilac> | > zipWith id (map id [(+1)]) [3] |
| 14:10:22 | <lambdabot> | [4] |
| 14:10:31 | <voker57_> | > (map (id) [(+1)]) 3 |
| 14:10:32 | <lambdabot> | Couldn't match expected type `t1 -> t' |
| 14:10:34 | <lilac> | > zipWith id [(+1)] [3] |
| 14:10:35 | <lambdabot> | [4] |
| 14:10:59 | <lilac> | voker57_: map id [(+1)] :: Num a => [a -> a] |
| 14:11:07 | <lilac> | voker57_: that's not a function, so can't be applied to 3 |
| 14:11:26 | <Athas> | Um. |
| 14:11:29 | <voker57_> | ah yes |
| 14:11:32 | <lilac> | > map ($3) [(+1)] |
| 14:11:33 | <lambdabot> | [4] |
| 14:11:36 | <voker57_> | > (map (id) [(+1)]) [3] |
| 14:11:37 | <lambdabot> | Couldn't match expected type `t1 -> t' |
| 14:11:37 | <EvilTerran> | f `id` x = id f x = f x -- :) |
| 14:11:49 | <lilac> | > map (flip id 3) [(+1)] |
| 14:11:50 | <lambdabot> | [4] |
| 14:11:55 | <voker57_> | > (map ($) [(+1)]) [3] |
| 14:11:56 | <lambdabot> | Couldn't match expected type `t1 -> t' |
| 14:12:07 | <lilac> | voker57_: it's still not a function, so it can't be applied to [3] either |
| 14:12:39 | <lilac> | voker57_: if you want to apply a list of functions to a list of values, you'd need to use something like <*> or >>= |
| 14:12:49 | <fasta> | What's the best library to use to convert any common image format to a 2d array containing the image data? |
| 14:12:52 | <lilac> | or zipWith ($) |
| 14:13:40 | <byorgey> | fasta: you could use the ImageMagick bindings. |
| 14:13:48 | <Athas> | I can't figure out what http://80.161.87.214/vm.pdf means. I think the ':' near the start is where I read in a big file as a list (then convert it to an array just after), but what's W32#? |
| 14:14:21 | <fasta> | byorgey: what's the name on Hackage? |
| 14:15:42 | <byorgey> | fasta: hsmagick, IIRC |
| 14:15:45 | <EvilTerran> | ,src ''Word32 |
| 14:15:47 | <lunabot> | data Word32 = W32# Word# |
| 14:16:02 | <quicksilver> | Athas: constructor for a Word32 |
| 14:16:08 | <Athas> | Oh, hm. |
| 14:16:11 | <Athas> | Interesting. |
| 14:16:19 | <shapr> | ACTION boings cheerfully |
| 14:16:23 | <quicksilver> | I note the memory usage is constant ish |
| 14:16:31 | <quicksilver> | doesn't look like a big problem there |
| 14:16:40 | <Athas> | It crashes due to a stack overflow. |
| 14:18:59 | <fasta> | byorgey: cabal: The pkg-config package GraphicsMagick version >=1.3.3 is required but |
| 14:18:59 | <fasta> | it could not be found. |
| 14:20:27 | <dcoutts_> | http://hackage.haskell.org/trac/hackage/ticket/331 |
| 14:20:36 | <dcoutts_> | #331 pkg-config error messages could be better |
| 14:20:49 | <dcoutts_> | if anyone feels like improving it ^^^ :-) |
| 14:20:51 | <fasta> | dcoutts_: yes, that's what I thought. |
| 14:21:13 | <Philonous> | quicksilver: I thought about forking a thread for each of the MVars and writing in a common MVar. I just wasn't sure this wouldn't be overkill |
| 14:21:55 | <fasta> | cabal: The pkg-config package GraphicsMagick version >=1.3.3 is required but |
| 14:21:55 | <fasta> | the version installed on the system is version 1.1.11 |
| 14:22:04 | <fasta> | Does Ubuntu lag this much? |
| 14:22:13 | <dcoutts_> | fasta: yes, that would be a better message |
| 14:22:34 | <fasta> | dcoutts_: that is the actual message ;) |
| 14:22:42 | <dcoutts_> | oh :-) |
| 14:23:06 | <Baughn> | Philonous: Threads are /really cheap/. I didn't see the original question, but chances are that's the best way. |
| 14:23:13 | <Philonous> | It seems to be a general idea in haskell: If in doubt, thow more concurrency at it. |
| 14:23:29 | <Philonous> | throw* |
| 14:24:40 | <Baughn> | Sure, but threads such as "forkIO $ forever $ readThingy >>= putMVar m . Thingy" are pretty easy to reason about |
| 14:25:46 | <quicksilver> | Philonous: no, it's the general idea when dealing with MVars ;) |
| 14:25:59 | <WorkyBob> | Philonous: works well in my experience |
| 14:26:02 | <quicksilver> | Philonous: MVars are a handy primitive but to compose them well you need to be happy forking more threads. |
| 14:26:03 | <WorkyBob> | concurrency is cheep in haskell |
| 14:27:55 | <Bacta> | (*)(*) |
| 14:28:16 | <Philonous> | quicksilver: I actually like that. It allows me to think in some sort of net, where MVars are the nodes and thrads the vertices |
| 14:28:21 | <Bacta> | d |
| 14:28:27 | <Bacta> | ()() |
| 14:28:36 | <quicksilver> | Bacta: shush. |
| 14:28:36 | <Bacta> | *|* |
| 14:32:12 | <Baughn> | ACTION figures out a use for Arrow. Huh. |
| 14:34:48 | <J11> | If you don't export everything from a class, what happens to the instances that will always be exported? Will this prevent the not exported methods from being imported(or being unusable until some other module exports the class)? |
| 14:35:42 | <quicksilver> | you can't import functions which have not been exported. |
| 14:35:48 | <quicksilver> | methods are not excepted from that. |
| 14:36:00 | <quicksilver> | so, if the methods have not been exported - you can't import them. |
| 14:36:10 | <quicksilver> | That's a separate issue from the class itself. |
| 14:37:06 | <Berengal> | I like abstractions... |
| 14:38:11 | <J11> | but suppose the class isn't exported at all: (H98 rep)For example, import M() does not bring any new names in scope from module M, but does bring in any instances visible in M |
| 14:38:57 | <Saizan> | yes, it brings in the instances |
| 14:39:05 | <quicksilver> | J11: I don't understand the question you are asking. |
| 14:39:18 | <quicksilver> | J11: instances, classes, and methods are all different. |
| 14:39:29 | <Berengal> | It does bring in the instances, but you can't use them yourself. You can pass them on to something that can though |
| 14:39:38 | <quicksilver> | you can use them. |
| 14:39:42 | <Saizan> | (you might import the class methods from somewhere else, for example, and so make use of the instances defined in M) |
| 14:39:49 | <quicksilver> | you might nto be able to see the methods. |
| 14:39:59 | <quicksilver> | but you can easily use a class without using its methods. |
| 14:40:07 | <Saizan> | that too |
| 14:40:47 | <quicksilver> | mapM isn't a method. |
| 14:40:53 | <quicksilver> | but mapM makes a monad (marginally) useful |
| 14:41:00 | <quicksilver> | even without return and >>= being in scope. |
| 14:41:20 | <WorkyBob> | you mean an applicative? |
| 14:41:20 | <WorkyBob> | >.> |
| 14:41:41 | <quicksilver> | ACTION counts to 10 softly to avoid booting WorkyBob from the channel. <.< |
| 14:41:45 | <Berengal> | quicksilver: You can't define mapM without >>= and return though (or sequence, or something else) |
| 14:41:45 | <WorkyBob> | hehe |
| 14:42:20 | <quicksilver> | Berengal: that's not the point. |
| 14:42:23 | <WorkyBob> | Berengal: sure you can -- mapM = fmap fmap fmap sequenceA fmap where sequenceA = foldr (liftA2 (:)) (pure []) |
| 14:42:24 | <quicksilver> | Berengal: the point is you can USE it. |
| 14:42:36 | <quicksilver> | which is the question being addressed here. |
| 14:42:45 | <J11> | so restricting the export from a class will do nothing if you only import the instances?(if you define the class yourself for example) |
| 14:43:12 | <quicksilver> | J11: I still don't understand what question you're trying to ask. |
| 14:43:21 | <Berengal> | quicksilver: I define that kind of useage "passing it on to something else"... I think we're in agreement appart from terminology |
| 14:43:34 | <quicksilver> | If you a class isn't visible, you can't use it in signatures |
| 14:43:46 | <quicksilver> | if a function isn't visible, you can't use it in expressions. |
| 14:43:51 | <quicksilver> | methods are just functions, really. |
| 14:43:58 | <quicksilver> | (in terms of export/import/visibility) |
| 14:44:14 | <quicksilver> | instances are global and cannot be usefully controlled. |
| 14:45:04 | <Berengal> | Right |
| 14:46:28 | <Philippa> | there are only 10 kinds of people: but pick your own base |
| 14:46:37 | <EvilTerran> | can you instantiate a class if you haven't imported its methods and aren't deriving it? |
| 14:46:51 | <Berengal> | Philippa: All your base are belong to us |
| 14:46:55 | <quicksilver> | Berengal: (the only time the difference between a function and a method matters is when writing instances of your own; otherwise both are just functions. Therefore there is no different between 'using it yourself' and 'passing it to something else'. "mapM f xs" and "f >>= \y -> g y" are both equally "using" a Monad instance" |
| 14:47:19 | <quicksilver> | EvilTerran: you need to have at least enough methods to define an instance visible. |
| 14:47:43 | <quicksilver> | EvilTerran: I suspect if you're happy to omit some methods (perhaps because of defaults) it doesn't matter if those ones are not visible. |
| 14:47:53 | <quicksilver> | although I've never tried that. It would be a strange thing to try ;) |
| 14:48:18 | <Berengal> | quicksilver: Right. When I said "Using it yourself" I mean using the methods directly. From the point of the user though, there really is no difference... |
| 14:48:19 | <J11> | well if you get the class imported from somewhere else, and the module that has the instances exports not all declarations of that class, thus the restriction will have no effect and all instances will be imported and methods will its methods will be usable if the other class defines them. |
| 14:48:55 | <lilac> | Philippa: http://cowbirdsinlove.com/43 |
| 14:49:36 | <Berengal> | J11: Uh... what? |
| 14:49:49 | <quicksilver> | J11: No. |
| 14:49:58 | <quicksilver> | J11: having the instance visible does not make the methods visible. |
| 14:50:07 | <quicksilver> | methods are just functions (as far as visibility is concerned) |
| 14:50:17 | <quicksilver> | if they're not visible, then you can't use them. |
| 14:50:40 | <xdie> | hi |
| 14:50:41 | <xdie> | all |
| 14:51:06 | <xdie> | any can helpme with join lambdabot in channel #culturalibredigital |
| 14:51:14 | <xdie> | @join #culturalibredigital |
| 14:51:14 | <lambdabot> | Not enough privileges |
| 14:51:35 | <quicksilver> | need a LB admin for that. |
| 14:51:39 | <quicksilver> | not sure if any are awake. |
| 14:51:46 | <J11> | module A exports class X entirely, modlu B exports class X partially, method C imports A() and B |
| 14:51:47 | <Baughn> | Or you could build your own |
| 14:51:48 | <NEEDMOAR> | ACTION slaps shapr |
| 14:51:55 | <xdie> | XD |
| 14:52:08 | <quicksilver> | J11: and your point is? |
| 14:52:16 | <J11> | * B() and A |
| 14:52:33 | <quicksilver> | well not it has the whole class, from A ? |
| 14:52:36 | <quicksilver> | now it has. |
| 14:55:50 | <J11> | yes, but does that means every instance method from B of class x is usable? |
| 14:57:02 | <J11> | even if that module does't export them? |
| 14:57:21 | <dmwit> | No, not all instance methods need be exported. |
| 14:57:24 | <dmwit> | Only instances. |
| 14:57:32 | <dmwit> | wait |
| 14:57:39 | <EvilTerran> | instance methods? |
| 14:57:59 | <dmwit> | You can hide instance methods for a whole class, but not for a single data type. |
| 14:58:02 | <Baughn> | "<Imp NoBound 3.2,Segmentation fault" <- Bloody nuisance |
| 14:58:04 | <lilac> | J11: you can only import or export class methods, not methods of a particular instance of that class |
| 14:58:37 | <Baughn> | Is it possible to make ghc print out which haskell code is executing when it segfaults? |
| 14:59:18 | <dmwit> | No program may catch segfaults. |
| 14:59:23 | <dmwit> | It's not allowed. |
| 14:59:47 | <p_l> | dmwit: what? First time I heard of it :D |
| 14:59:48 | <Baughn> | But.. |
| 15:00:01 | <dmwit> | err... I thought? |
| 15:00:07 | <dmwit> | I've been wrong before. =P |
| 15:00:07 | <p_l> | ACTION happily used programs catching segfaults for a long time |
| 15:00:26 | <MyCatVerbs> | > "world " ++ (fix ("atop a turtle "++)) |
| 15:00:26 | <p_l> | dmwit: let's say that catching segfaults is quite common for GC :> |
| 15:00:27 | <lambdabot> | "world atop a turtle atop a turtle atop a turtle atop a turtle atop a turtl... |
| 15:01:50 | <quicksilver> | J11: yes, because A exports them! |
| 15:02:09 | <quicksilver> | J11: this have nothing to do with classes. |
| 15:02:26 | <quicksilver> | J11: it's just about functions. They are visible because A exports them it doesn't matter that B doesn't. |
| 15:02:36 | <quicksilver> | j1what probblem are you trying to solve? |
| 15:02:55 | <dino-> | Baughn: I don't have much experience with it, but I wonder if the debugging facilities in ghci can help with this. |
| 15:03:19 | <Baughn> | dino-: no, ghci just crashes |
| 15:03:28 | <dino-> | ouch |
| 15:03:34 | <Baughn> | Well, I'm trying to build ghc-6.11, just in case.. |
| 15:03:51 | <J11> | just a theoretically question and I have to translate Haskell to a language that allows specific instance exportion |
| 15:03:52 | <p_l> | dmwit: you are not allowed to trap SIGKILL |
| 15:03:54 | <dmwit> | So, segfaulting isn't really that common in Haskell. |
| 15:03:57 | <dmwit> | What have you done? |
| 15:04:11 | <Baughn> | dmwit: Debugging Reactive. |
| 15:04:18 | <dino-> | You may be back down to ugly Debug.Trace logging things to try to get close to the disaster with log messages. |
| 15:04:27 | <dmwit> | mmm |
| 15:04:37 | <Baughn> | dmwit: Though I'm pretty sure unsafePerformIO isn't supposed to do that |
| 15:05:02 | <quicksilver> | J11: instances and methods are entirely separate. |
| 15:05:07 | <xdie> | @join #culturalibredigital |
| 15:05:07 | <lambdabot> | Not enough privileges |
| 15:05:11 | <xdie> | @part #culturalibredigital |
| 15:05:11 | <lambdabot> | Not enough privileges |
| 15:05:21 | <Baughn> | dino-: Near as I can tell, by the time disaster strikes the stack is already smashed |
| 15:05:29 | <Baughn> | It crashes due to trying to return to address 0x0 |
| 15:05:41 | <dmwit> | I wonder why @join requires privileges. |
| 15:05:47 | <dmwit> | That seems like a freebie. |
| 15:05:50 | <J11> | thus invoking a method defined by class x in A will use B's implementation? |
| 15:06:05 | <Baughn> | dmwit: Then @leave would need to be free too |
| 15:06:10 | <dmwit> | Nonsense. |
| 15:06:14 | <Baughn> | dmwit: Also, some channels really dislike bots |
| 15:06:37 | <dmwit> | Those channels also have ops that ban bots. |
| 15:06:38 | <quicksilver> | J11: methods can only have one implementation (per instance) |
| 15:06:42 | <quicksilver> | J11: and instances are global. |
| 15:06:46 | <p_l> | dmwit: btw, from manual: "The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored." (that's on Linux, but it refers to standard signals) |
| 15:06:58 | <Baughn> | p_l: Eh, this is SIGSEGV though |
| 15:07:08 | <dmwit> | p_l: Nice, thanks for looking that up just for my ignorance! =D |
| 15:07:17 | <dmwit> | Baughn: Well, you can install signal handlers. |
| 15:07:21 | <Lemmih> | Baughn: That's his point, I think. |
| 15:07:30 | <dmwit> | Baughn: Maybe you could install a SIGSEGV handler yourself to... do something? |
| 15:07:33 | <J11> | ok, thx |
| 15:07:34 | <dmwit> | not sure what |
| 15:08:50 | <p_l> | Baughn: install SIGSEGV handler then, probably with pre-allocated buffer of emergency memory so it would run outside GC areas. Not sure how to do that in Haskell (it's just my idea for emergency debugging tool ^_-) |
| 15:09:40 | <dmwit> | I wonder how ghci's debugging facilities handle signal handlers. |
| 15:10:00 | <Saizan> | or you could use gdb |
| 15:16:20 | <Baughn> | Well, this is a ge-nu-ine heisenbug |
| 15:16:28 | <Baughn> | If I insert debugging prints in race, it goes away. |
| 15:17:09 | <p_l> | Baughn: Should we look for a heisenwhale? |
| 15:17:35 | <Baughn> | p_l: COuld be. I expect it to be skeletal and capable of flight. |
| 15:18:27 | <p_l> | Baughn: last time I met one it was capable of flight but certainly not skeletal... |
| 15:21:17 | <quicksilver> | Baughn: You should definitely file a trac. |
| 15:21:31 | <quicksilver> | Baughn: I'm pretty sure JaffaCake would be interested in any code which jumps to 0 |
| 15:21:38 | <Baughn> | quicksilver: I can't. I can't seem to narrow it down to below "half of reactive". |
| 15:21:41 | <quicksilver> | unsafePerformIO along should emphaticaly not do that. |
| 15:21:44 | <quicksilver> | alone. |
| 15:21:56 | <quicksilver> | calling an FFI lib which stomps on the stack, sure. |
| 15:22:03 | <Baughn> | Nope, no FFI here |
| 15:22:16 | <quicksilver> | I assume you're not using anything which can stomp straight on memory, like pokePtr and friends? |
| 15:22:27 | <Baughn> | Not to my knowledge |
| 15:22:28 | <quicksilver> | any use on unsafeCoerce# ? |
| 15:22:35 | <Baughn> | Nope |
| 15:22:49 | <quicksilver> | I would file the trac even though you can't provide a minimal counterexample. |
| 15:23:08 | <quicksilver> | for example, they may ask you for a gdb trace or something. |
| 15:23:29 | <Baughn> | Unfortunately, there is none |
| 15:23:39 | <Baughn> | ..well, that's not quite true |
| 15:23:42 | <Philonous> | Is there a fundamental difference between using let a=b and a <- return b in a do block? |
| 15:24:07 | <Philonous> | monad laws ensure they are equivalent, don't say? |
| 15:24:08 | <Baughn> | Philonous: Yes |
| 15:24:13 | <Baughn> | Oh. Wait, return |
| 15:24:15 | <Philonous> | they* |
| 15:24:25 | <quicksilver> | Philonous: if "a" is a non-trivial pattern, there is a difference. |
| 15:24:35 | <Baughn> | Philonous: They are supposed to have the same semantics. There may be differences in performance |
| 15:24:38 | <Baughn> | #0 0x00000000008612ab in stg_sel_ret_0_upd_info () |
| 15:24:38 | <JaffaCake> | Baughn: turn on -debug? |
| 15:24:40 | <Baughn> | #1 0x0000000000000000 in ?? () |
| 15:24:47 | <Baughn> | JaffaCake: Working on it |
| 15:24:50 | <quicksilver> | Philonous: if the expression "b" mentions the name "a", there may be a difference |
| 15:24:55 | <fasta> | I installed GraphicsMagick 1.35, but I still get: cabal: The pkg-config package GraphicsMagick version >=1.3.3 is required but |
| 15:24:55 | <fasta> | the version installed on the system is version 1.1.11 |
| 15:25:04 | <quicksilver> | Philonous: those things aside, they should be the same. |
| 15:25:14 | <fasta> | How does cabal decide that I have 1.1.11? |
| 15:25:26 | <JaffaCake> | Baughn: http://hackage.haskell.org/trac/ghc/wiki/DebuggingGhcCrashes |
| 15:25:55 | <Baughn> | Crashes just the same with 6.11 |
| 15:26:10 | <Baughn> | Okay. SHould I run the debug with 6.10.3 or 6.11? |
| 15:26:27 | <JaffaCake> | 6.11 |
| 15:26:42 | <JaffaCake> | this is non-threaded, right? |
| 15:26:45 | <Philonous> | Thanks |
| 15:27:11 | <quicksilver> | fasta: by calling pkg-config I suspect |
| 15:27:11 | <Baughn> | JaffaCake: Crashes just the same either way |
| 15:28:34 | <fasta> | quicksilver: yes, pkg-config GraphicsMagick --modversion |
| 15:28:58 | <fasta> | Now, I only need to figure out why pkg-config is returning the wrong value. |
| 15:29:30 | <int-e> | fasta: check your PKG_CONFIG_PATH, maybe. |
| 15:29:30 | <Philonous> | quicksilver: In the let a=b case a is in scope in b, wheres in a <- return b it is not? desugaring to return b >>= \a ... would at least sugest that |
| 15:29:47 | <fasta> | int-e: it should be a distro installed package. |
| 15:30:37 | <fasta> | Or maybe there is some cache for pkg-config. |
| 15:31:29 | <quicksilver> | Philonous: right. |
| 15:31:42 | <quicksilver> | Philonous: in the let case, occurrence of an a would indicate a recursive binding. |
| 15:32:03 | <quicksilver> | Philonous: in the <-, occurrence of an 'a' would just be shadowing (i.e. it would be referring to som e'a' from an enclosing scope) |
| 15:32:25 | <Philonous> | Makes sense. Thanks. |
| 15:32:36 | <Baughn> | JaffaCake: For what it's worth, a debugging build triggers no assertions |
| 15:32:37 | <lilac> | Philonous: if a is a nontrivial pattern, they're not the same |
| 15:32:37 | <quicksilver> | Philonous: and if "a" is a non-trival pattern |
| 15:32:49 | <lilac> | Philonous: since the <- case uses fail but the let case will bottom out |
| 15:32:50 | <quicksilver> | Philonous: then the let case will throw a pure exception on pattern match failure |
| 15:32:59 | <quicksilver> | Philonous: while <- will use the monad's fail. |
| 15:33:13 | <JaffaCake> | Baughn: and it's repeatable, every time? |
| 15:33:15 | <quicksilver> | all these things being considered, I find a <- return b to be ugly and I avoid it ;) |
| 15:34:19 | <Baughn> | JaffaCake: Yes |
| 15:34:38 | <Baughn> | JaffaCake: Hm. The output is different every time, though, even with -C0 |
| 15:34:40 | <JaffaCake> | shouldn't be too hard to pin down then |
| 15:34:53 | <JaffaCake> | hmm |
| 15:35:00 | <JaffaCake> | -V0? |
| 15:35:28 | <Philonous> | Why do monads even have fail? It has nothing to do with monads, does it? Isn't that what monadPlus is made for? |
| 15:35:36 | <Baughn> | JaffaCake: Makes no difference. Still different every time. |
| 15:35:46 | <Peaker> | Philonous: because of "do" notation potentially introducing pattern-match failures |
| 15:36:16 | <Philonous> | And why can't we use exceptions in that case? |
| 15:36:23 | <ray> | fail is widely reviled |
| 15:36:33 | <quicksilver> | Philonous: well, the default definition of 'fail' *is* an exception. |
| 15:36:39 | <quicksilver> | so arguably that is what it is. |
| 15:36:45 | <JaffaCake> | Baughn: ok, could you follow through the steps on the DebuggingGhcCrashes page, and see if you can find out any more? |
| 15:36:48 | <ray> | i think do blocks should only be allowed to have irrefutable patterns unless the monad in question is also a MonadZero |
| 15:37:21 | <ray> | i am not sure if this introduces any problems |
| 15:37:40 | <Philonous> | Well, if fail defaults to an exception, why introduce it in the first place? |
| 15:38:06 | <dmwit> | ray: Most of us totally agree. |
| 15:38:50 | <dmwit> | Philonous: Most of us totally agree with that, too. |
| 15:38:52 | <Baughn> | JaffaCake: Working on it. |
| 15:40:24 | <lilac> | quicksilver: it depends what you think Monad means. if you think it means, "customizable domain-specific sublanguages ahoy!" then fail makes sense |
| 15:40:33 | <lilac> | s/quicksilver/Philonous/ |
| 15:40:43 | <dino-> | This reminds me of: http://www.haskell.org/haskellwiki/MonadPlus_reform_proposal |
| 15:41:02 | <lilac> | if you think it means, "here's a neat thing from category theory, maybe it'll be handy" then fail makes no sense |
| 15:41:11 | <dino-> | Speaking of who is this fail person anyway? |
| 15:41:13 | <quicksilver> | lilac: well, moving it slightly into a better named class would not be a bad thing. |
| 15:41:28 | <quicksilver> | call it MonadZero, call it MonadPlus, call it Love, call it Fate. |
| 15:41:29 | <lilac> | the good news is that people who think both things can use the current design |
| 15:41:41 | <lilac> | since the default for fail is exactly as if it weren't there |
| 15:41:56 | <lilac> | the bad news is that Either is royally messed up by it ;-( |
| 15:42:32 | <lilac> | quicksilver: yes, i'm all in favour of putting fail in a different typeclass, and requiring that for refutable patterns |
| 15:43:01 | <lilac> | quicksilver: i'm also in favour of a nice syntactic sugaring for a <- return b, since in practice i do that quite often (in the Maybe monad mostly) |
| 15:43:22 | <Philippa> | let a = b; |
| 15:43:58 | <Philippa> | (it works differently, but the monad laws guarantee it's the same) |
| 15:44:00 | <quicksilver> | lilac: I've thought I need it a couple of times, and always managed to twiddle the code around until I didn't |
| 15:44:02 | <dino-> | I was thinking that too, isn't that just putting b into the monad to take it right back out? Or am I missing something from the above discussion (that I haven't read) |
| 15:44:03 | <quicksilver> | not sure why. |
| 15:44:10 | <lilac> | Philippa: that's not the same |
| 15:44:14 | <Botje> | it's mostly handy for stuff like Just x <- ... |
| 15:44:23 | <Botje> | where you don't want your program to abort :) |
| 15:44:28 | <Philonous> | Well, fail is not a show stopper, so I don't really mind. It just looks like an overgeneralised special case that's dangling around for no real reason. |
| 15:44:43 | <quicksilver> | > (do (x:xs) <- []; return x) :: Maybe Int |
| 15:44:44 | <lambdabot> | Couldn't match expected type `[a]' |
| 15:44:52 | <quicksilver> | ACTION sighs |
| 15:44:57 | <quicksilver> | > (do (x:xs) <- return []; return x) :: Maybe Int |
| 15:44:58 | <lambdabot> | Nothing |
| 15:45:11 | <lilac> | Philippa: and changing it so it is makes let-in-do different from normal let-in, which can only be confusing :-) |
| 15:45:20 | <quicksilver> | > (do let (x:xs) = []; return x) :: Maybe Int |
| 15:45:21 | <lambdabot> | <no location info>: parse error on input `)' |
| 15:45:29 | <quicksilver> | oh ffs. I'm bad at this. |
| 15:45:36 | <quicksilver> | I'm sure you understand what that was supposed to do. |
| 15:45:38 | <Philippa> | lilac: it's the same /given the monad laws/. You don't need return |
| 15:45:39 | <quicksilver> | ACTION crawls back into his cave. |
| 15:46:15 | <EvilRanter> | you can actually separate out fail and >>=/return with recent ghc and -XNoImplicitPrelude |
| 15:46:44 | <ray> | you can do many wonderful things with no implicit prelude |
| 15:46:48 | <lilac> | Philippa: a <- return b calls fail if pattern a doesn't match b. let a = b does not. |
| 15:47:26 | <Philippa> | lilac: ah, your metalanguage was unclear. I was assuming a is a variable pattern |
| 15:47:41 | <quicksilver> | Philippa: something you could have avoided by reading back a few lines. |
| 15:47:49 | <ray> | "in the Maybe monad mostly" |
| 15:47:56 | <Philonous> | Philippa: and as I pointed out earlier with let a=b a is in scope in the expression b, whereas it is not in a <-b, so you can have recursive binds in the let case, but not in the other. |
| 15:48:05 | <dino-> | lilac, quicksilver: Me too, not reading the scrollback. Apologies. |
| 15:48:14 | <ray> | reading is hard |
| 15:48:14 | <EvilRanter> | ACTION tried it recently and managed to have (do return ()) :: Pointed f => f (); (do return (); return ()) :: Applicative f => f (); (do x <- return (); return x) :: Monad f => f (); (do Just x <- return Nothing; return ()) :: MonadFail f => f ()" |
| 15:48:20 | <Philippa> | quicksilver: I had done, it still wasn't clear |
| 15:50:30 | <lilac> | EvilRanter: yes, that's a nice feature. just a pity that GHC's standard prelude doesn't work that way |
| 15:53:51 | <maltem> | ACTION thinks of starting a Let's overwhelm Hackage with alternative packages based on that alternative typing of do-notation, Category, and something akin to NumericPrelude Movement |
| 15:54:29 | <fasta> | ACTION thinks the numeric-prelude stuff is pointless with a GPL license. |
| 15:54:36 | <EvilTerran> | maltem, start a hackage category called NoImplicitPrelude? |
| 15:55:38 | <maltem> | EvilTerran, sounds a bit negative ;), but good otherwise, actually |
| 15:55:57 | <EvilTerran> | maltem, the problem would be that everyone has their own ideas about how the monad heirarchy should be laid out, and likewise for the numeric heirarchy |
| 15:56:08 | <maltem> | point |
| 15:56:40 | <maltem> | So we'd need n new hackage categories. |
| 15:57:00 | <EvilTerran> | we'd need typeclass heirarchy combinators, like Data.List.Split for string splitting, so people could roll their own :P |
| 16:04:38 | <dcoutts_> | ACTION invites people to try the current darcs cabal-install-0.6.x branch |
| 16:04:59 | <dcoutts_> | lemme know if you find wierdities or regressions |
| 16:05:18 | <dons> | url? |
| 16:05:20 | <dcoutts_> | http://darcs.haskell.org/cabal-branches/cabal-install-0.6/ |
| 16:06:00 | <dcoutts_> | main thing is that for packages that say: build-depends: >= 3 && < 5, it now picks base 4 rather than 3 |
| 16:06:14 | <dcoutts_> | for packages that say: build-depends: >= 3, it still picks base 3 |
| 16:06:32 | <dcoutts_> | at least, that's the intention :-) |
| 16:06:33 | <dons> | k. |
| 16:06:43 | <fasta> | dcoutts_: you can also pick a random version in that case for extra fun. |
| 16:06:55 | <dcoutts_> | fasta: that would be fun :-) |
| 16:07:09 | <dcoutts_> | keep people on their toes :-) |
| 16:07:18 | <fasta> | ACTION nods |
| 16:07:30 | <bastl> | can someone have a look at http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2555 ? I try to let ghc derive (Data, Typeable) for types with 8 parameters. But it doesnt work. Im stuck ... :-( |
| 16:07:37 | <fasta> | Add a few terrible error messages and you will have a party! |
| 16:07:44 | <dcoutts_> | @arr! |
| 16:07:45 | <lambdabot> | Drink up, me 'earties |
| 16:07:54 | <dcoutts_> | lambdabot knows how to party |
| 16:08:00 | <roconnor> | "for packages that say: build-depends: >= 3, it still picks base 3" Is this specific for base? |
| 16:08:01 | <doserj> | bastl: deriving Typeable is restricted to 7 paramaters, I think. |
| 16:08:37 | <Igloo> | Data.Typeable only has classes up to Typeable7 |
| 16:08:48 | <bastl> | the report says its straighfoward to write the required stuff yourself. |
| 16:09:35 | <fasta> | Loading package hsmagick-0.3 ... can't load .so/.DLL for: pthread (/usr/lib/libpthread.so: invalid ELF header) <- Is there a solution for this? |
| 16:09:35 | <bastl> | ah, i wrote it myself so i dont need the deriving, right? |
| 16:09:35 | <Baughn> | JaffaCake: http://hackage.haskell.org/trac/ghc/ticket/3279 <-- Well, I've submitted a bug report. |
| 16:09:51 | <doserj> | bastl: yes. but you have to use instance Typeable MyType |
| 16:10:49 | <bastl> | doserj: i dont think so ... |
| 16:11:05 | <fasta> | It seems it is this one: http://hackage.haskell.org/trac/ghc/ticket/2615 |
| 16:11:08 | <sm> | dcoutts_: ah, I've just been poking around there |
| 16:11:14 | <sm> | ACTION will switch |
| 16:11:29 | <xdie> | @join #culturalibredigital |
| 16:11:29 | <lambdabot> | Not enough privileges |
| 16:11:47 | <xdie> | some lambdabot admin? |
| 16:11:52 | <sm> | actually, http://darcs.haskell.org/cabal-install .. is it different ? |
| 16:12:39 | <sm> | this one has New development branch, version 0.7, which sounded biggest |
| 16:12:40 | <dcoutts_> | sm: thanks, it should be totally reliable as your standard cabal, but lemme know if you hit quirks |
| 16:12:57 | <dcoutts_> | sm: right, stick to the 0.6.x branch, that's the one that I'm about to release |
| 16:12:59 | <Baughn> | conal: http://hackage.haskell.org/trac/ghc/ticket/3279 <-- And report submitted. Having fun, I guess.. |
| 16:13:11 | <sm> | oh, right |
| 16:13:13 | <bastl> | @h listify |
| 16:13:13 | <lambdabot> | Maybe you meant: hackage help hitchcock hoogle hoogle+ . ? @ v |
| 16:13:24 | <bastl> | @hoogle listify |
| 16:13:24 | <lambdabot> | Data.Generics.Schemes listify :: Typeable r => (r -> Bool) -> GenericQ [r] |
| 16:13:28 | <dcoutts_> | sm: and so that's the one I want testing and feedback on |
| 16:14:14 | <dcoutts_> | roconnor: more specifically it applies any preferences given by the user on from hackage |
| 16:14:30 | <dcoutts_> | roconnor: and hackage's "preferred-versions" file says to prefer base 3 |
| 16:14:57 | <dcoutts_> | roconnor: see http://hackage.haskell.org/packages/archive/preferred-versions |
| 16:15:41 | <doserj> | bastl, ah right, there is a generic TypeableN -> Typeable instance mechanism |
| 16:15:50 | <thomastc> | hi... I'm trying to generate a list of integers, together with their prime factorizations |
| 16:15:53 | <thomastc> | something like |
| 16:16:15 | <thomastc> | [(1,[]), (2,[2]), (3,[3]), (4,[2,2]), ... |
| 16:16:40 | <thomastc> | I have a feeling that it can be done lazily with a fold, but I don't yet see how |
| 16:17:40 | <thomastc> | it needs to work in reasonable time for numbers up to 500000 |
| 16:18:01 | <BONUS> | well if you have a function Int -> [Int] that gives the prime factors for a certain numbers |
| 16:18:04 | <BONUS> | you just do |
| 16:18:08 | <BONUS> | map primeFactors [1..] |
| 16:18:13 | <thomastc> | jah, of course |
| 16:18:21 | <thomastc> | I have that now, but it's too slow |
| 16:18:39 | <BONUS> | or rather map (\x - (x, primeFactors x)) [1..] |
| 16:18:48 | <thomastc> | so I thought I could do a sieve-like thing, where instead of throwing out multiples, I add the factor to the list |
| 16:18:51 | <BONUS> | then your prime factors function might be slow |
| 16:18:54 | <BONUS> | ah like that |
| 16:19:07 | <thomastc> | because I need it for all the numbers in that range |
| 16:19:09 | <sm> | hm I've been using some version of cabal-install 0.6.0 for quite a while |
| 16:19:24 | <thomastc> | yeah, my prime factors function is also slow :) |
| 16:19:30 | <sm> | but getting the latest. It has been great |
| 16:20:06 | <bastl> | doserj: took me hours to see that ... |
| 16:21:41 | <sm> | ah, 0.6.2. All is clear |
| 16:22:07 | <conal> | Baughn: unamb sure does sniff out GHC RTS bugs! |
| 16:22:07 | <lambdabot> | conal: You have 3 new messages. '/msg lambdabot @messages' to read them. |
| 16:23:48 | <conal> | Baughn: please say more about foldr1 vs foldl1 in unambs. i don't know how to choose one over the other. |
| 16:25:06 | <Baughn> | conal: It just occured to me, I'm not sure either |
| 16:25:27 | <conal> | i forget: what's the default fixity (when no fixity is specified)? |
| 16:25:39 | <doserj> | left |
| 16:25:45 | <Baughn> | conal: I know why strict foldl would be the right then when producing a simple value, but a strict foldl would also not work due to the undefineds |
| 16:25:48 | <conal> | and what precedence? |
| 16:26:13 | <doserj> | infixl 9 |
| 16:26:24 | <conal> | doserj: thx. how do you know? |
| 16:26:51 | <conal> | Baughn: why & why? |
| 16:26:51 | <Baughn> | conal: Also, it occurs to me that with my version of unamb, "foo `unamb` bar `unamb` baz" could throw BothBottom if both foo and bar are bottom, even if baz is not |
| 16:27:03 | <doserj> | conal: http://haskell.org/onlinereport/decls.html#sect4.4.2 |
| 16:27:05 | <Baughn> | ..oh dear |
| 16:27:07 | <conal> | Baughn: really?! |
| 16:27:19 | <Baughn> | conal: No, not really. Hm. |
| 16:27:20 | <conal> | doserj: thx again |
| 16:27:55 | <Baughn> | conal: But the laziness is /very important/ for that "not really" to work |
| 16:28:30 | <Baughn> | conal: If the (unamb foo bar) bit gets evaluated before (unamb baz) is called (eg. strictly), then exactly that could happen |
| 16:28:46 | <conal> | Baughn: wow. brittle! |
| 16:29:05 | <Baughn> | conal: Not really. I'm pretty sure the semantics of haskell disallow that from actually happening |
| 16:29:07 | <conal> | Baughn: haskell does not guarantee laziness. |
| 16:29:36 | <conal> | Baughn: and i expect that speculative will become more & more important in the next few years. |
| 16:29:39 | <Baughn> | conal: Haskell does not guarantee lazy evaluation, you mean. It does guarantee non-strict, right? |
| 16:29:44 | <conal> | Baughn: speculative *evaluation* |
| 16:29:50 | <conal> | Baughn: right. |
| 16:30:04 | <Baughn> | conal: And this'd work fine with non-strict |
| 16:30:14 | <Baughn> | But wow, the strictness analyzer has quite a job to do |
| 16:30:20 | <quicksilver> | if speculative evaluation finds a bottom |
| 16:30:27 | <quicksilver> | that doesn't make the program crash. |
| 16:30:34 | <quicksilver> | (or make the whole expression go to _|_) |
| 16:30:40 | <quicksilver> | it just puts the _|_ there. |
| 16:30:48 | <Baughn> | In any case, I don't think that's the cause of my sigsegv problem. :) |
| 16:30:51 | <quicksilver> | speculative / full laziness don't change the actual semantics |
| 16:30:54 | <quicksilver> | just the evaluation order. |
| 16:31:09 | <Baughn> | Right, but a strict foldl (using seq) would |
| 16:31:13 | <Baughn> | So we can't use that.. |
| 16:31:18 | <quicksilver> | (BothBottom) `unamb` baz |
| 16:31:23 | <quicksilver> | is not necessarily _|_ |
| 16:31:37 | <quicksilver> | in fact, the rules of unamb say that _|_ `unamb` baz is baz |
| 16:31:41 | <quicksilver> | does it not? |
| 16:31:48 | <Baughn> | If there are no bugs. :) |
| 16:31:50 | <conal> | quicksilver: yes |
| 16:32:10 | <quicksilver> | GHC has speculative evluation, by the way |
| 16:32:10 | <Baughn> | quicksilver: What I was trying to figure out is unambs, eg. foldr1 unamb |
| 16:32:16 | <quicksilver> | that's what `par` is. |
| 16:32:17 | <conal> | quicksilver: it does?? |
| 16:32:26 | <conal> | oh -- *explicit* speculation |
| 16:32:28 | <quicksilver> | if `par` discovers a bottom, it doesn't bottom out the whole expression. |
| 16:32:41 | <EvilTerran> | (compare pseq) |
| 16:32:48 | <quicksilver> | conal: sure, but the semantic questions are equally raised with explicit as opposed to implicit. |
| 16:32:51 | <Baughn> | quicksilver: It ought to be tail-recursive for all the usual reasons, but I can't actually /make/ it tail-recursive without using seq, which would make it not work |
| 16:33:01 | <quicksilver> | of `par` discovers a bottom, it just marks it and kills that spark. |
| 16:33:11 | <quicksilver> | whether the actual expression depends on that bottom will be discovered later. |
| 16:33:37 | <quicksilver> | there are some details do with GC'ing sparks, I recall, which make this fiddly to get right. |
| 16:36:43 | <conal> | Baughn: i'm reluctant to apply that crashing reactive patch (http://brage.info/~svein/reactive.patch). could you make a self-contained test module instead? i'd be happy to try it on my machine. |
| 16:37:44 | <Baughn> | conal: Basically, no; I have no idea how that code triggers the bug yet. |
| 16:37:55 | <Baughn> | conal: I'd suggest a darcs get to spare directory. |
| 16:38:32 | <conal> | Baughn: oh yeah. |
| 16:38:52 | <Baughn> | conal: And this is why I prefer git. Speed. :P |
| 16:39:10 | <conal> | Baughn: darcs is particularly painful over satellite |
| 16:39:24 | <Baughn> | Yet you use it |
| 16:39:39 | <conal> | yeah |
| 16:40:34 | <Baughn> | conal: You'll want the crash.hs attached to the bug report, too |
| 16:40:55 | <conal> | Baughn: oh, thx. |
| 16:43:16 | <sm> | is this correct .cabal syntax ? tested-with: GHC==6.8, GHC==6.10 |
| 16:43:28 | <dcoutts_> | sm: yep |
| 16:43:50 | <sm> | thx |
| 16:46:44 | <Igloo> | dcoutts_, sm: Aren't they supposed to be actual version numbers? e.g. 6.10.3 rather than 6.10 |
| 16:47:00 | <sm> | I couldn't find an example |
| 16:47:16 | <sm> | but cabal configure is happy |
| 16:47:20 | <dcoutts_> | Igloo: there's no semantics to the thing anyway, but yes version equality is exact |
| 16:47:39 | <sm> | basically I want it showing both versions on the hackage page |
| 16:47:45 | <dcoutts_> | sm: cabal doesn't care except that it's syntactically correct |
| 16:47:54 | <sm> | great |
| 16:48:15 | <lilac> | thomastc: you want to say something like, for each integer n, find the least factor of n, say k, then add to your list (n, k:factors of k) |
| 16:51:49 | <sm> | dcoutts_: did you get patches from me earlier ? |
| 16:57:32 | <ksf> | maybe unamb should be a primitive? |
| 16:58:16 | <ksf> | ...all that talk about clever hacks and brittle operational semantics seem to imply it. |
| 17:02:24 | <mreh> | Funny, http is not working |
| 17:02:29 | <mreh> | are you reading this? |
| 17:03:20 | <mauke> | mreh: no |
| 17:03:27 | <mreh> | damn |
| 17:03:51 | <mreh> | who maketh the patches for cabal then? |
| 17:11:35 | <mreh> | David Roundy prototyped darcs in C++ and then wrote the whole thing in Haskell, that's the wrong way round. |
| 17:11:39 | <Jedai> | ksf: Conal and some others would like to see unamb as a primitive in some future version of GHC which is why they're trying to make a proof of concept and see if people like it and use it |
| 17:14:06 | <sshc> | how do I convert a float to an int? |
| 17:14:16 | <hatds> | watching how much hackery is involved with unamb every day is making me not so inclined to use it :) |
| 17:14:23 | <sshc> | is there a function similar to the floor() in C? |
| 17:14:30 | <mauke> | :t floor |
| 17:14:31 | <lambdabot> | forall a b. (RealFrac a, Integral b) => a -> b |
| 17:14:31 | <mm_freak_> | sshc: yes |
| 17:14:33 | <mm_freak_> | floor =) |
| 17:14:36 | <mauke> | :t round |
| 17:14:37 | <lambdabot> | forall a b. (RealFrac a, Integral b) => a -> b |
| 17:28:41 | <lilac> | would it be better to make amb primitive and force user code to insert the unsafePerformIO if they're convinced it's safe? |
| 17:29:13 | <lilac> | unless there's something wrong with unamb a b = unsafePerformIO $ amb a b |
| 17:36:42 | <hatds> | let x = unamb x y, y = uamb x y |
| 17:37:10 | <Cale> | conal and Baughn: did you see my comment about unamb? |
| 17:37:17 | <conal> | Cale: no. |
| 17:37:45 | <Cale> | Consider if we have two values x = unamb i y and y = unamb j k |
| 17:38:22 | <Cale> | Due to the precondition on unamb, if we evaluate x, even if it chooses i, we should know the value of y as well. |
| 17:39:06 | <Cale> | It would be interesting to find a way to somehow convey the result of the winning evaluation to all of the losers. |
| 17:39:46 | <dcoutts_> | sm: did you send patches to me personally or to the cabal-devel list? |
| 17:40:13 | <sm> | I did darcs send in the hackage-server repo, and they seemed to be sent to duncan@haskell.org |
| 17:40:15 | <conal> | Cale: yeah -- iswym. |
| 17:40:17 | <Cale> | Since the threads already are being thrown exceptions which wake them up to get them into a reset state, perhaps there. |
| 17:40:28 | <dcoutts_> | sm: oh, right, great |
| 17:40:37 | <sm> | good good |
| 17:40:49 | <dcoutts_> | sm: I avoid email when I'm in my office (trying to be more productive) so I'll check when I get home |
| 17:40:54 | <Baughn> | Cale: Hm. Yes, that's an interesting optimization. |
| 17:40:55 | <dcoutts_> | sm: what are the patches for? |
| 17:40:57 | <sm> | aha, smart |
| 17:41:01 | <Baughn> | Cale: I'll keep it in mind for once all the bugs are out. :) |
| 17:41:16 | <dcoutts_> | sm: well, if I was really smart I'd not be in #haskell ;-) |
| 17:41:21 | <sm> | updating it to happstack 0.2, fixing warnings, making it base 3/4 friendly |
| 17:41:28 | <dcoutts_> | sm: ok, great |
| 17:41:29 | <sm> | yeah, that's what I'm thinking |
| 17:42:00 | <conal> | Cale: oh, wait. couldn't y be be _|_ /= i ? |
| 17:42:16 | <dcoutts_> | sm: btw, I think TomMD said there's a problem with the state in the hackage-server, since we switched from happs to happstack, something that goes wrong during/after importing all the data. |
| 17:42:27 | <sm> | ah, I would not be surprised |
| 17:42:30 | <dcoutts_> | sm: have you tried importing all the old data? |
| 17:42:32 | <Baughn> | conal: It could. The question is, do you ever use it when that might be the case? |
| 17:42:41 | <sm> | I got a hackage server running and tried to talk to it with cabal 0.6.2.. no I didn't import |
| 17:42:56 | <Cale> | conal: Technically it could, but we know that it has a value which if it was defined, ought to be the same as the value of i |
| 17:43:00 | <conal> | Baughn: are you asking whether we ever use unamb when one branch is bottom ? |
| 17:43:23 | <Cale> | conal: Consider the case where we unamb together a list of things |
| 17:43:28 | <dcoutts_> | sm: ok, it's not too hard to try, just need the archive.tar, the 00-index.tar.gz and the upload log from the current hackage. They're all linked from the intro page. |
| 17:43:37 | <conal> | Cale: yeah. we know more than we used to: y == bottom or i . |
| 17:43:40 | <sm> | good to know |
| 17:43:52 | <Baughn> | conal: No, if we're ever using it when the branches have semantically different values but it's okay because one is bottom |
| 17:44:11 | <Baughn> | conal: Eg. when this sort of result distribution would /hurt/ |
| 17:44:22 | <dcoutts_> | sm: btw, if you're thinking of working on this regularly I'll add you to the project commit group on code.h.o |
| 17:44:50 | <conal> | Baughn: yes, the branches could be bottom and non-bottom, and yes that case is useful. |
| 17:45:00 | <mm_freak_> | pointOfDiscussion :: a |
| 17:45:13 | <conal> | Baughn: am i getting your question? |
| 17:45:13 | <Baughn> | conal: That's not what I was asking |
| 17:45:22 | <conal> | okay. confused here. |
| 17:45:24 | <roconnor> | Cale: I think \x y -> expr and \x -> \y -> expr are indistinguishable when there are no patterns. |
| 17:45:34 | <Baughn> | conal: I mean.. the precondition for unamb is that either the two branches are equal, or one is bottom |
| 17:45:44 | <sm> | thanks, right now it's a burst here and there |
| 17:45:53 | <Cale> | roconnor: hmm |
| 17:46:05 | <sm> | it's looking exciting though |
| 17:46:10 | <Baughn> | conal: Cale suggests we could propagate the value from the one that /isn't/ bottom to the others, such that if that unamb is restarted (it'd only be useful for recursive ones) the result would be available instantly |
| 17:46:26 | <Baughn> | conal: I'm not sure that would be aperformance win. But more problematically, would it cause bugs? |
| 17:46:42 | <Baughn> | Eg. in that it could be the wrong result |
| 17:47:20 | <Cale> | Baughn: Not if the precondition was stringently followed. |
| 17:47:25 | <Cale> | At least, I don't think so. |
| 17:47:25 | <conal> | Baughn: yeah. unless i'm still confused. take i == 1, j == _|_, k == _|_ in Cale's example |
| 17:47:45 | <Cale> | Well... |
| 17:47:58 | <Cale> | Okay, yeah, it does change the meaning of the thing somewhat. |
| 17:48:19 | <Baughn> | The performance win would probably be minimal to negative.. probably |
| 17:48:27 | <conal> | Cale: in that 1 `somewhatNotEqual` _|_ ? |
| 17:48:43 | <corcoran> | hello |
| 17:48:55 | <Cale> | If we assume that you're not constructing unambs of multiple things which are always undefined, and then unambing those with semantically different values. |
| 17:49:28 | <corcoran> | Haskell newbie here with question about possible GHC bug. Anybody wanna help? |
| 17:49:36 | <Cale> | corcoran: sure |
| 17:49:39 | <conal> | Cale: what does "always undefined" mean? |
| 17:49:55 | <Cale> | conal: I mean that it will never have a value other than _|_ |
| 17:50:16 | <conal> | Cale: i'm confused about "always" and "never" here. isn't something _|_ or not? |
| 17:50:37 | <conal> | can a value "sometimes" be bottom? |
| 17:50:39 | <Cale> | conal: Well, these are variables and they might be instantiated differently |
| 17:50:54 | <Cale> | (assuming that you call some function with different parameters) |
| 17:51:09 | <conal> | Cale: oh -- you're talking about expressions, not values. |
| 17:51:13 | <Cale> | yes |
| 17:51:21 | <corcoran> | starting a comment with "--|" gives a parse error: ' parse error on input `--|' ' so if you comment out something like | case = result you get a parse error if you do not leave a space between -- and |. Is this a bug? |
| 17:51:48 | <Cale> | corcoran: No, that's intentional |
| 17:51:48 | <SamB> | corcoran: sorta! |
| 17:51:54 | <SamB> | it's actually for haddock |
| 17:51:59 | <corcoran> | ...in ghci 6.10.3 on windows. Oh, why indentional? |
| 17:51:59 | <Cale> | nope! |
| 17:52:06 | <corcoran> | ah ok, thank you! |
| 17:52:14 | <Cale> | It's because --| is a valid infix operator symbol |
| 17:52:21 | <SamB> | oh? |
| 17:52:24 | <SamB> | ACTION confused |
| 17:52:28 | <Cale> | > let x --| y = x^2 - y^2 in 4 --| 5 |
| 17:52:29 | <lambdabot> | -9 |
| 17:52:34 | <SamB> | sorry, wrong info |
| 17:52:43 | <SamB> | I guess -- | is for haddock ... |
| 17:52:45 | <conal> | Cale: i have to reset my whole interpretation. you're talking about *compile-time* optimization of *expressions*? run-time is restricted to accessing *values* |
| 17:53:00 | <SamB> | so how do you comment out a guard without getting haddock errors ? |
| 17:53:30 | <SamB> | conal: wait, there's a difference between an expression and a value now ? |
| 17:53:46 | <Cale> | conal: Well, from the value perspective, there's only one case where it looks like there's a problem, and you found it out earlier... |
| 17:54:12 | <conal> | SamB: joking? |
| 17:54:25 | <Cale> | conal: If i = 1, j = _|_, k = _|_ then with the existing unamb, we have that y = unamb j k = _|_ and x = unamb 1 y = 1 |
| 17:54:37 | <conal> | Cale: right |
| 17:55:47 | <Cale> | Now, consider how this might occur. You might have three expressions i,j,k and you don't know which of them is _|_, but you do know (according to the precondition for unamb) that if they are not _|_, then they ought to all have the same value |
| 17:56:26 | <conal> | Cale: in other words, they're "consistent" |
| 17:56:36 | <conal> | i.e., have a common upper information bound |
| 17:56:42 | <dino-> | --| makes me think of a knocked over _|_ |
| 17:58:18 | <Cale> | So, while there could be a problem for programs which want to later compute unamb 2 y, in order to do this, they would have to know for certain that y really is _|_ beforehand, or else they are willingly breaking the precondition for unamb |
| 17:58:28 | <bavardage> | how do I make Word8s manually? |
| 17:58:39 | <bavardage> | should I just make an integer and coerce it? |
| 17:58:47 | <bavardage> | i.e. I have 8 bits |
| 17:58:54 | <bavardage> | and I want to mush them together into a Word8 |
| 17:58:56 | <Cale> | bavardage: Just write integer literals as usual |
| 17:59:05 | <Cale> | bavardage: oh |
| 17:59:14 | <Cale> | bavardage: Well, Word8 is a proper numeric type |
| 17:59:15 | <medfly> | are there other websites to paste Haskell code and make it all pretty besides hpaste.org? it seems to be having trouble. |
| 17:59:17 | <bavardage> | so I could just calculate the integer value... |
| 17:59:23 | <bavardage> | and do it like that? |
| 17:59:31 | <jmcarthur_work> | bavardage, maybe there is something in Data.Bits to help you? |
| 17:59:33 | <Botje> | medfly: some other pastebins support haskell syntax |
| 17:59:39 | <bavardage> | jmcarthur_work: I'll take a look |
| 17:59:42 | <Botje> | i'd try pastebin.com |
| 17:59:43 | <Cale> | medfly: maybe paste.lisp.org ? |
| 17:59:44 | <conal> | Cale: yep |
| 17:59:48 | <medfly> | thanks |
| 17:59:48 | <Cale> | Or yeah, pastebin.com |
| 18:00:07 | <bavardage> | hmm doesn't mention any word8s there |
| 18:00:17 | <Cale> | bavardage: The only difference should be in your type signature |
| 18:00:18 | <roconnor> | @instances Bit |
| 18:00:19 | <lambdabot> | Couldn't find class `Bit'. Try @instances-importing |
| 18:00:30 | <roconnor> | @instances Data.Bit.Bit |
| 18:00:30 | <lambdabot> | Couldn't find class `Data.Bit.Bit'. Try @instances-importing |
| 18:00:36 | <Cale> | bavardage: Word8 is an instance of Num and that's all you should need |
| 18:00:36 | <bavardage> | Cale: right, and just treat it like a integer? |
| 18:00:38 | <Botje> | @instances Bits |
| 18:00:38 | <lambdabot> | Couldn't find class `Bits'. Try @instances-importing |
| 18:00:42 | <Botje> | boo! |
| 18:00:43 | <roconnor> | @instances Data.Bit.Bits |
| 18:00:44 | <Cale> | > 3 + 2*5 :: Word8 |
| 18:00:44 | <lambdabot> | Couldn't find class `Data.Bit.Bits'. Try @instances-importing |
| 18:00:45 | <lambdabot> | 13 |
| 18:00:48 | <bavardage> | so calculate it manually by raising each bit to 2*..? |
| 18:00:49 | <Cale> | bavardage: yes |
| 18:00:51 | <bavardage> | kk |
| 18:01:00 | <bavardage> | thanks |
| 18:01:03 | <Cale> | bavardage: er, you can do it recursively too |
| 18:01:18 | <bavardage> | yeah |
| 18:01:31 | <Jedai> | bavardage: you can use setBit |
| 18:02:07 | <Cale> | bavardage: If the least significant bit is first, then fromBits (b:bs) = b + 2 * fromBits bs |
| 18:02:19 | <bavardage> | Cale: oh thanks |
| 18:02:41 | <Cale> | er, well, assuming that b is a number. If it's a Bool, then you'll want a fromEnum in there. |
| 18:02:58 | <Cale> | > map fromEnum [False, True] |
| 18:02:59 | <lambdabot> | [0,1] |
| 18:03:02 | <bavardage> | kk |
| 18:03:13 | <Cale> | uh, oh. |
| 18:03:16 | <Cale> | :t fromEnum |
| 18:03:17 | <lambdabot> | forall a. (Enum a) => a -> Int |
| 18:03:25 | <Cale> | Unfortunate monomorphic type |
| 18:03:30 | <jmcarthur_work> | :( |
| 18:03:42 | <Cale> | fromIntegral (fromEnum b) then |
| 18:04:17 | <Cale> | Did I mention how much I hate Int? |
| 18:04:19 | <roconnor> | > (foldr (\(i,x) -> flip (if x then setBit else clearBit) i) 0) (zip [0..] [True,False,False,True,False,True,True]) |
| 18:04:20 | <bavardage> | :D |
| 18:04:20 | <lambdabot> | Add a type signature |
| 18:04:35 | <bavardage> | yeah Int smells |
| 18:04:41 | <conal> | SamB: maybe you were joking, but yes i do like to distinguish syntax (expressions) from semantics (values) |
| 18:05:05 | <roconnor> | > (foldr (\(i,x) -> flip (if x then setBit else clearBit) i) 0) (zip [0..] [True,False,False,True,False,True,True]) :: Word8 |
| 18:05:06 | <lambdabot> | 105 |
| 18:05:57 | <roconnor> | @pl \z -> (foldr (\(i,x) -> flip (if x then setBit else clearBit) i) 0) (zip [0..] z) |
| 18:05:57 | <lambdabot> | foldr (uncurry (flip (flip . flip (flip if' setBit) clearBit))) 0 . zip [0..] |
| 18:07:00 | <Jedai> | > foldl' setBit 0 . getIndices id $ [True,False,False,True,False,True,True]:: Word8 |
| 18:07:01 | <lambdabot> | Not in scope: `getIndices' |
| 18:07:27 | <Jedai> | @hoogle Indices |
| 18:07:27 | <lambdabot> | Data.Array.Base indices :: (IArray a e, Ix i) => a i e -> [i] |
| 18:07:27 | <lambdabot> | Data.Array.IArray indices :: (IArray a e, Ix i) => a i e -> [i] |
| 18:07:27 | <lambdabot> | Data.ByteString elemIndices :: Word8 -> ByteString -> [Int] |
| 18:07:32 | <roconnor> | > foldl' setBit 0 (elemIndices True [True,False,False,True,False,True,True]) |
| 18:07:33 | <lambdabot> | Add a type signature |
| 18:07:37 | <roconnor> | > foldl' setBit 0 (elemIndices True [True,False,False,True,False,True,True]) :: Word8 |
| 18:07:38 | <lambdabot> | 105 |
| 18:07:51 | <Jedai> | roconnor: thanks :) |
| 18:07:58 | <roconnor> | > foldl' setBit 0 (findIndices id [True,False,False,True,False,True,True]) :: Word8 |
| 18:08:00 | <lambdabot> | 105 |
| 18:08:36 | <Jedai> | So "fromBits = foldl' setBit 0 . findIndices id" |
| 18:08:42 | <SubStack> | :o |
| 18:08:53 | <roconnor> | > (foldl' setBit 0 . findIndices id) [True,False,False,True,False,True,True]) :: Word8 |
| 18:08:54 | <lambdabot> | <no location info>: parse error on input `)' |
| 18:08:54 | <Jedai> | bavardage: nice and clean solution ! :P |
| 18:09:04 | <roconnor> | > (foldl' setBit 0 . findIndices id) [True,False,False,True,False,True,True] :: Word8 |
| 18:09:05 | <lambdabot> | 105 |
| 18:09:26 | <roconnor> | least significant bit first |
| 18:09:28 | <bavardage> | hehe |
| 18:09:42 | <bavardage> | thanks |
| 18:10:12 | <roconnor> | I can't tell if which of findIndices id or elemIndices True I like better |
| 18:10:23 | <roconnor> | elemIndices True is probably better |
| 18:10:29 | <roconnor> | findIndices id is more fun |
| 18:14:25 | <Baughn> | @type elemIndices |
| 18:14:26 | <lambdabot> | forall a. (Eq a) => a -> [a] -> [Int] |
| 18:15:59 | <roconnor> | ACTION wonders if findIndices id is more efficent |
| 18:18:59 | <Botje> | @src findIndices |
| 18:18:59 | <lambdabot> | findIndices p xs = [ i | (x,i) <- zip xs [0..], p x] |
| 18:19:08 | <Botje> | @src elemIndices |
| 18:19:08 | <lambdabot> | elemIndices x = findIndices (x==) |
| 18:19:54 | <Botje> | so assuming ghc doesn't eliminate the x== i'd say findIndices id would be marginally more efficient |
| 18:21:02 | <roconnor> | hmm |
| 18:21:23 | <roconnor> | there could be a GHC rule for relacing (True==) with id |
| 18:23:50 | <roconnor> | I don't see one |
| 18:23:58 | <crutex> | @faq |
| 18:23:58 | <lambdabot> | The answer is: Yes! Haskell can do that. |
| 18:24:31 | <roconnor> | @src (==) Bool |
| 18:24:33 | <lambdabot> | Source not found. I've seen penguins that can type better than that. |
| 18:25:58 | <roconnor> | instance Eq Bool where |
| 18:26:00 | <roconnor> | True == True = True |
| 18:26:01 | <roconnor> | False == False = True |
| 18:26:03 | <roconnor> | _ == _ = False |
| 18:26:06 | <roconnor> | If this were instead defined as |
| 18:26:14 | <roconnor> | True == x = x |
| 18:26:22 | <roconnor> | and False == x = not x |
| 18:26:35 | <roconnor> | then (==) could be inline here and simplified. |
| 18:28:44 | <roconnor> | > lazy 5 |
| 18:28:48 | <lambdabot> | Not in scope: `lazy' |
| 18:29:11 | <Botje> | roconnor: if i read this core correctly, it does get compiled away |
| 18:29:17 | <Botje> | Main.lvl5 = Data.List.findIndices @ GHC.Base.Bool Main.lvl Main.lvl4 |
| 18:29:22 | <Botje> | with |
| 18:29:23 | <Botje> | Main.lvl = \ (b_aGt :: GHC.Base.Bool) -> b_aGt |
| 18:29:43 | <Botje> | (source: elemIndices True $ map ... ) |
| 18:29:50 | <roconnor> | oh wow |
| 18:29:54 | <crutex> | @karma Cthulhon |
| 18:29:54 | <lambdabot> | Cthulhon has a karma of -147 |
| 18:29:58 | <roconnor> | I wonder how it does that |
| 18:30:09 | <roconnor> | Botje: can you dump the rules that are fired? |
| 18:30:18 | <Botje> | what flag is that? |
| 18:30:20 | <roconnor> | (although it might not be a rule. |
| 18:30:21 | <Botje> | -ddump-rules is not it :) |
| 18:30:40 | <roconnor> | there is a nice flag to dump all sorts of nice info |
| 18:30:45 | <jmcarthur_work> | woah, how come that karma is so low? |
| 18:30:45 | <roconnor> | letme see |
| 18:31:36 | <MyCatVerbs> | Eh, use ghc-core. |
| 18:31:57 | <Botje> | that seems to be cabal installable |
| 18:32:06 | <roconnor> | Botje: -ddump-simpl-stats ? |
| 18:32:24 | <MyCatVerbs> | Indeed it is. You'll need to have PCRE installed for it. |
| 18:32:32 | <Botje> | doing that now |
| 18:32:34 | <MyCatVerbs> | You get a nice colour highlight and everything. Plus, if you're really interested in just which rules fired, you probably want to see the core that they reduced to, too. |
| 18:32:51 | <Botje> | 9 RuleFired 3 ==#->case |
| 18:33:02 | <Botje> | that ==#->case looks interesting |
| 18:33:37 | <roconnor> | hmm |
| 18:33:50 | <roconnor> | ==# seem to be for comparing Ints |
| 18:33:51 | <roconnor> | however |
| 18:33:58 | <roconnor> | Bools are treated kinda funny in GHC IIRC |
| 18:34:05 | <roconnor> | so they might really be ints |
| 18:34:23 | <SamB> | @src Bool# |
| 18:34:23 | <lambdabot> | Source not found. My pet ferret can type better than you! |
| 18:35:00 | <roconnor> | google searching for ==#->case doesn't work |
| 18:35:20 | <Botje> | MyCatVerbs: cool! |
| 18:35:26 | <SamB> | roconnor: of course not |
| 18:35:30 | <Botje> | the core is a lot more readable now |
| 18:35:38 | <Botje> | but i don't see much extra information |
| 18:35:38 | <SamB> | it's almost entirely punctuation |
| 18:35:53 | <sm> | ACTION wonders if vty is utf8 aware at all |
| 18:36:35 | <MyCatVerbs> | Botje: AFAIK dons wrote it. :) |
| 18:36:44 | <Botje> | in that case, dons++ |
| 18:37:15 | <MyCatVerbs> | Botje: and I can see why, given that AFAIK he was spending a fair length of time looking at output core and trying to improve it at one point. |
| 18:37:22 | <Botje> | yeah |
| 18:37:26 | <Botje> | there's so much cruft there |
| 18:38:20 | <Botje> | ACTION simplifies input code |
| 18:39:16 | <Berengal> | Reading core is like a really really bad trip... |
| 18:39:24 | <Berengal> | ACTION has a headache now |
| 18:39:28 | <Botje> | Berengal: now it's a really really bad trip .. IN COLOR! |
| 18:40:15 | <Botje> | i've reduced it to f = elemIndices True $ [False, False, True] |
| 18:40:16 | <Berengal> | Botje: I still don't know what my 'print $ sum [1..1000000]' program does under the hood... |
| 18:40:34 | <Botje> | Berengal: dark scary voodoo magic. Every compiler has a supply. |
| 18:41:16 | <MyCatVerbs> | ACTION read that as "dark scary compiler voodoo. You need a supply." |
| 18:41:48 | <Berengal> | Botje: Indeed. The assembly looks like it's never looping, and setting the loop conditions at the end :/ |
| 18:41:50 | <Botje> | roconnor: I think it's either a CaseIdentity optimization or a BetaReduction followed by Case |
| 18:41:56 | <Berengal> | Then again, I never was good at reading assembly either |
| 18:42:13 | <roconnor> | Botje: ah |
| 18:42:18 | <Cale> | Berengal: There's a higher level approach to understanding what's going on which is usually sufficient. |
| 18:42:45 | <roconnor> | Botje: I can imagine the patter match turning into nested case statements |
| 18:42:52 | <Berengal> | Cale: I apparantly fail at anything below 'print $ sum [1..1000000]' |
| 18:43:22 | <Cale> | Berengal: Are you referring to the stack overflows? |
| 18:43:56 | <Cale> | I can explain that much at least :) |
| 18:44:17 | <Berengal> | Cale: It doesn't. I restricted it to Int, which the compiler specializes |
| 18:44:43 | <Cale> | Oh, well, strictness analysis also tends to fix that |
| 18:44:55 | <Berengal> | I was a little surprised to see references to 'eftInt' still in the assembly. I was hoping fusion would kick in |
| 18:45:18 | <MyCatVerbs> | Berengal: rather than restricting it, put a SPECIALIZE pragma in? |
| 18:45:59 | <Berengal> | MyCatVerbs: GHC already has a specialize pragma firing for sum :: Int and enumFromTo :: Int |
| 18:46:04 | <Berengal> | Which fires |
| 18:46:58 | <MyCatVerbs> | Oh, but that isn't enough to get you the transformations of things like sum? Darn. |
| 18:47:50 | <Berengal> | MyCatVerbs: sum is transformed into a specialized int sum, but it doesn't look like sum and enumFromTo fuses |
| 18:48:04 | <Berengal> | Which is what I'd hoped to see |
| 18:48:20 | <MyCatVerbs> | enumFromTo will be defined in terms of build, and sum in terms of foldl. |
| 18:48:47 | <MyCatVerbs> | The fusion implemented in GHC AFAIK is build/foldr fusion. |
| 18:48:49 | <Berengal> | I was somewhat hoping it would compile down to four instructions... |
| 18:50:26 | <pumpkin> | Berengal: you should try it on uvector :) |
| 18:50:46 | <pumpkin> | Berengal: I'd be willing to bet it compiles to something pretty tight there |
| 18:52:05 | <Berengal> | pumpkin: Looks much tighter with foldr (+) 0 instead of sum too |
| 18:52:17 | <pumpkin> | well sum isn't even foldl' |
| 18:52:23 | <pumpkin> | have you tried foldl' ? |
| 18:52:27 | <Berengal> | It is for ints |
| 18:52:41 | <jmcarthur_work> | with -O2 it's foldl', isn't it? |
| 18:52:45 | <jmcarthur_work> | well, for strict types |
| 19:02:19 | <mathijs> | Hi all, someone in here once gave me a handy way to calculate the number of times a number is divisable by 2 without iterating. it was a trick with (x `xor` (x-1)) and then some more, which I forgot. does anyone know what it is? |
| 19:03:12 | <ksf> | in general, ln x. |
| 19:04:12 | <mathijs> | I know, but I wanted the smart bitwise trick (it only worked for division by 2) |
| 19:04:39 | <tromp> | x^(x-1) + 1 gives you highest dividing power of 2 |
| 19:05:12 | <tromp> | usually + has lower precedence than ^, so write it as (x^(x-1))+1 |
| 19:05:18 | <tromp> | i meant higher |
| 19:05:24 | <duaneb> | (x `xor` (x-1)) should work fine, I think |
| 19:05:25 | <mathijs> | ^ = and? |
| 19:05:43 | <mathijs> | I remember it was xor I think |
| 19:05:50 | <tromp> | oops, still wrong |
| 19:05:51 | <duaneb> | err |
| 19:05:53 | <Botje> | mathijs: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious |
| 19:06:01 | <duaneb> | you're looking for a log |
| 19:06:05 | <Botje> | that's a short list of possibilities |
| 19:06:25 | <mathijs> | Botje: thanks :) |
| 19:06:34 | <tromp> | shld be ((x^(x-1))+1) >> 1 |
| 19:12:11 | <duaneb> | mathijs: what about 0? |
| 19:12:14 | <duaneb> | what do you want to do for 0? |
| 19:12:21 | <duaneb> | I have a solution here that's pretty simple |
| 19:12:29 | <duaneb> | not fast, but simple :P |
| 19:12:51 | <duaneb> | given a simple hash function, it COULD be simple |
| 19:12:52 | <mathijs> | tell me :) I found "((x `xor` (x-1))+1) `div` 4" to work, but I don't remember the 4 |
| 19:13:46 | <duaneb> | but seriously |
| 19:13:49 | <duaneb> | the 0 thing |
| 19:14:00 | <duaneb> | theoretically, it should be infinite |
| 19:14:44 | <tromp> | no, it shld be 0 |
| 19:15:01 | <duaneb> | > let highest :: Word -> Word; highest 0 = 0; highest n = case (lookup (n `xor` (n-1)) $ map (\n -> (2^n, n)) [0..31]) of {(Just a) -> a}; |
| 19:15:02 | <lambdabot> | not an expression: `let highest :: Word -> Word; highest 0 = 0; highest n =... |
| 19:15:09 | <mathijs> | 0, I don't know... it shouldn't be given as input :) |
| 19:15:12 | <tromp> | this is about divisibility, and 0 is more divisible than any other number |
| 19:15:12 | <duaneb> | goddamn |
| 19:15:27 | <tromp> | it's the infinity of divisibility if you wish |
| 19:15:34 | <duaneb> | I just said 0 :P |
| 19:15:49 | <duaneb> | that won't compile, but you get the idea |
| 19:16:19 | <duaneb> | > let highest :: Word -> Word; highest n = case (lookup (n `xor` (n-1)) $ map (\n -> (2^n, n)) [0..32]) of {(Just a) -> a}; in highest 1 |
| 19:16:20 | <lambdabot> | 0 |
| 19:16:23 | <duaneb> | > let highest :: Word -> Word; highest n = case (lookup (n `xor` (n-1)) $ map (\n -> (2^n, n)) [0..32]) of {(Just a) -> a}; in highest 2 |
| 19:16:24 | <lambdabot> | * Exception: <interactive>:1:198-276: Non-exhaustive patterns in case |
| 19:16:28 | <duaneb> | !$@$! |
| 19:16:34 | <duaneb> | maybe I should test :P |
| 19:16:51 | <duaneb> | oh |
| 19:16:52 | <duaneb> | goddamn |
| 19:16:54 | <bob0> | Hi. I'm not sure what's wrong in these two functions: http://pastebin.com/f1ef55b95 |
| 19:17:16 | <mathijs> | > let fact2 = x = ((x `xor` (x-1))+1) `div` 4 |
| 19:17:17 | <lambdabot> | <no location info>: parse error on input `=' |
| 19:17:23 | <mathijs> | > let fact2 x = ((x `xor` (x-1))+1) `div` 4 |
| 19:17:24 | <lambdabot> | not an expression: `let fact2 x = ((x `xor` (x-1))+1) `div` 4' |
| 19:17:48 | <mathijs> | :( |
| 19:20:18 | <Vulpyne> | bob0: What is the problem? |
| 19:21:23 | <sidewinder128> | Hello, Im searching options for Haskell web programming anyone have suggestions? Webservers, Web frameworks or anything. thanks. |
| 19:21:35 | <Cale> | sidewinder128: There's a lot of choices on Hackage... |
| 19:21:43 | <Cale> | http://hackage.haskell.org/packages/archive/pkg-list.html |
| 19:21:57 | <sm> | happstack is the big one. cgi is the small one. both good |
| 19:21:59 | <Cale> | I don't do much web programming myself though, so perhaps not the best person to ask... |
| 19:22:18 | <sidewinder128> | Cale I checked the list but I read happs is not maintained anymore so Im not sure what could do it |
| 19:22:22 | <Botje> | bob0: replace / by `div` |
| 19:22:36 | <sidewinder128> | sm ok I will check happstack |
| 19:22:42 | <Cale> | Really? Happs isn't being maintained? |
| 19:22:42 | <Botje> | although that will sometimes be an off-by-one error |
| 19:22:52 | <Cale> | Oh, perhaps because it's become happstack |
| 19:22:57 | <sm> | in between you have a bunch of things but all somewhat in of decay or just sprouting |
| 19:23:01 | <bob0> | Vulpyne: http://pastebin.com/fb27b04 |
| 19:23:07 | <sidewinder128> | Well the homepage is static from long time |
| 19:23:11 | <sidewinder128> | ah ok |
| 19:23:13 | <sm> | Cale, right |
| 19:23:16 | <Cale> | http://happstack.com/index.html |
| 19:23:19 | <Cale> | looks nice :) |
| 19:23:27 | <sidewinder128> | Thanks :D |
| 19:23:46 | <Cale> | Oh, that's funny, it's not actually a happs application :P |
| 19:23:52 | <sm> | sidewinder128: also check out turbinado, it might be coming back to life |
| 19:24:02 | <alexsuraci> | I'm a socket n00b, can anyone explain why the " |
| 19:24:11 | <alexsuraci> | cd" packet never gets received here? http://paste.pocoo.org/show/Hf3Ef9V9KQgGPs9naYGp/ |
| 19:24:13 | <bob0> | Botje: why do I need to use `div` if ceiling can return an integer? |
| 19:24:13 | <sidewinder128> | sm yes turbinado looks cool |
| 19:24:17 | <alexsuraci> | I'm also a keyboard n00b apparently... |
| 19:24:37 | <Botje> | bob0: ceiling isn't the problem, unlagged is |
| 19:24:42 | <p_l> | alexsuraci: for a while your question looked awesome (because I have /ignore on leaves/quit) :D |
| 19:24:46 | <Botje> | / requires both its arguments to be Floating |
| 19:24:51 | <Botje> | eh |
| 19:24:52 | <Botje> | fractional |
| 19:25:02 | <bob0> | can I convert them to fractional? |
| 19:25:05 | <Botje> | yes |
| 19:25:18 | <Botje> | ceiling (fromIntegral unlagged / fromIntegral unlagged_marker_max) |
| 19:25:21 | <alexsuraci> | p_l: haha |
| 19:25:24 | <Botje> | or however the variable is named |
| 19:25:28 | <ksf> | alexsuraci, because you don't loop run? |
| 19:25:43 | <alexsuraci> | ksf: it's looped in "wait" |
| 19:26:07 | <ksf> | ...but not for the same connection, but the next one. |
| 19:26:24 | <ksf> | ...in which case it will only read the first two bytes, again. |
| 19:26:26 | <alexsuraci> | oh, duh |
| 19:26:44 | <Cale> | alexsuraci: Oh, seems I was too late, yes, that's it :) |
| 19:26:50 | <alexsuraci> | I confused what the functions should be doing, heh |
| 19:26:59 | <alexsuraci> | That makes much more sense, thanks |
| 19:26:59 | <ksf> | you also might want to stick an forkIO before the run conn |
| 19:27:08 | <alexsuraci> | Yeah I do in my code, I just simplified it here |
| 19:27:33 | <Cale> | alexsuraci: Another thing is that your server will only accept one connection at a time. You'll probably want to forkIO the communication to the client so that you can immediately go back to waiting for new connections. |
| 19:27:49 | <alexsuraci> | Cale: too late again :P |
| 19:27:54 | <Cale> | yes |
| 19:27:56 | <Cale> | heh |
| 19:28:10 | <alexsuraci> | thanks for all the help and for not belittling me for such a dumb mistake :P |
| 19:28:42 | <gwern> | man. I still can't get over how yellow vitamin b supplements make your urine |
| 19:28:58 | <ksf> | if we do, oleg joins the channel and expects us to grok his code, so we usually don't do such things. |
| 19:29:20 | <gwern> | er. mischan |
| 19:29:22 | <alexsuraci> | While I'm here, what's the best way to get colorized output, assuming the shell is Bash? Typing in the usual flags just prints them out directly. |
| 19:29:25 | <Cale> | ACTION intentionally misparses |
| 19:29:29 | <Cale> | gwern: So how do yellow vitamin b supplements make your urine? |
| 19:29:34 | <gwern> | Cale: neon |
| 19:29:44 | <ksf> | there's some vty packages on hackage |
| 19:30:12 | <ksf> | terminal interfacing is generally considered to be advanced black magic. |
| 19:30:29 | <sm> | vty is good, except it doesn't handle multibyte, windows or gnome terminal |
| 19:31:01 | <sm> | yet |
| 19:31:05 | <alexsuraci> | vty looks nice |
| 19:31:27 | <Cale> | Does anyone else think it's really stupid that our terminal emulators are emulating VT100's |
| 19:31:28 | <alexsuraci> | lack of gnome terminal isn't so nice though |
| 19:31:30 | <Cale> | ? |
| 19:31:37 | <idnar> | Cale: yes :P |
| 19:31:42 | <dzlk> | I wonder what the official term is for "vitamin B neon yellow", if there is one. Lab techs have a whole controlled vocabulary for colors of urine -- "goldenrod", "straw", "burgundy", etc. |
| 19:31:50 | <sm> | alexsuraci: that might be something easy to fix.. I don't have one I can debut on |
| 19:31:50 | <dzlk> | Cale: as opposed to? |
| 19:31:52 | <sm> | debug |
| 19:31:53 | <alexsuraci> | I thought gnome-term just used a standard backend? Was it vte? |
| 19:31:56 | <idnar> | Cale: it's the moral equivalent of IP over avian carrier or smoke signals |
| 19:32:34 | <Cale> | dzlk: Essentially every machine now has a beautiful graphical display. |
| 19:32:39 | <bob0> | GHCi is complaining that an in inferred type is not polymorphic when http://pastebin.com/f3bdf11cb is loaded |
| 19:32:52 | <bob0> | the error is http://pastebin.com/f56f49fa9 |
| 19:33:04 | <inetic> | hi, I can use the :t command inside the ghci to chcek the type signature of a function, but can I somehow inspect types in a simmilar way? e.g. I would like to see how is the State type defined (the one inside Control.Monad.State) |
| 19:33:09 | <Cale> | dzlk: The idea of having a window where you can enter commands and get output from programs interactively is great, but why should it be limited to text? |
| 19:33:22 | <dzlk> | I do think it's really kind of stupid that we're emulating glass ttys but I've never made up my mind what to replace it with. |
| 19:33:25 | <ksf> | ...until you log into a solaris box and have vi throw its ed at you because it doesn't know the terminal type "linux" |
| 19:33:30 | <sm> | text is simple |
| 19:34:00 | <sm> | or at least, it should be |
| 19:34:18 | <idnar> | Cale: even if it is limited to text, VT100 is a ridiculously convoluted / arcane / limited way of interacting with a character buffer |
| 19:34:23 | <Cale> | yes |
| 19:34:46 | <idnar> | we don't use PostScript to write graphical applications |
| 19:34:49 | <ksf> | is xterm really vt100? |
| 19:35:20 | <Baughn> | No, it's xterm |
| 19:35:23 | <idnar> | well, I doubt any modern terminal emulators are actually VT100/VT220/whatever compliant |
| 19:35:28 | <idnar> | but that's still the basis for the whole mess |
| 19:35:40 | <Baughn> | ksf: But yeah, xterm understands a superset of vt100 commands |
| 19:35:42 | <dzlk> | Cale: one of the nice things about text, though, is that it's linear so you can deal with it straightforwardly as a stream. I've thought about introducing graphics into the model but I'm stuck on how to do it without having to cope with two dimensions. |
| 19:36:14 | <Cale> | dzlk: Mathematica provides a decent example |
| 19:38:45 | <dzlk> | in any case "curses" is aptly named. |
| 19:39:10 | <Baughn> | Cale: I'd kill for a mathematica worksheet that works like a .hs file |
| 19:40:13 | <Cale> | For example, in Mathematica, the value Button["Click me", Print[10!]] displays as an actual button which when clicked will add a new cell beneath it containing 3628800. |
| 19:41:24 | <sm> | it doesn't get much more concise than that |
| 19:41:25 | <Cale> | There are lots of composable controls of this sort, and they're first class values. |
| 19:42:22 | <Cale> | Button[ContourPlot3D[x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}], Print[10!]] |
| 19:42:23 | <Baughn> | ACTION would probably prefer a spreadsheet with mathematica's power. Call me a luddite, but I like functional programming. |
| 19:42:37 | <Cale> | Displays as a button with a 3D plot of a sphere as its label. |
| 19:43:02 | <Cale> | (not that you'd actually want to do that, just to say that you can) |
| 19:43:41 | <Badger> | ACTION calls Baughn a luddite. |
| 19:44:16 | <Cale> | Manipulate[expr, {var,min,max}] will construct a small interface in which the value of var in expr is controlled by a slider which varies between min and max |
| 19:44:33 | <Cale> | and it's not really a primitive, but something built from the other controls |
| 19:44:51 | <maltem> | What does “cabal test” do, if not run the runTests hook specified in Setup.hs? |
| 19:44:57 | <sm> | this seems like tangible/reactive values |
| 19:45:05 | <Cale> | Yeah, it does :) |
| 19:45:29 | <sm> | it irks me that mathematica has been so far ahead for so long :) |
| 19:45:57 | <bnijk> | good morning |
| 19:46:00 | <bnijk> | http://www.newtechusa.com/PPI/pressroom.asp#higher |
| 19:46:29 | <pumpkin> | uh |
| 19:46:31 | <Cale> | bnijk: heh |
| 19:46:45 | <pumpkin> | that's a pretty hot monkey |
| 19:46:50 | <dzlk> | See also Plan 9, Squeak. |
| 19:47:27 | <bnijk> | they could master VB3, but not java |
| 19:47:54 | <bnijk> | i want to see the monkeys learn haskell |
| 19:48:00 | <dzlk> | Squeak's approach to UI is really interesting, but unfortunately I don't like OO. |
| 19:48:13 | <pumpkin> | OoOoO |
| 19:48:38 | <Cale> | The cool thing about mathematica is that the interface is still very commandline-like, while incorporating graphics and UI widgets as first class values. |
| 19:48:55 | <pumpkin> | zomg Cale is in Wolfram's pocket! |
| 19:49:01 | <Cale> | hehe |
| 19:49:02 | <pumpkin> | he's evangelizing another language in #haskell!! |
| 19:49:04 | <pumpkin> | :) |
| 19:49:09 | <Cale> | I think we should steal the idea. |
| 19:49:12 | <p_l> | "Test subjects with the best results were baboons and bonobo apes. Both primate species demonstrated stressful behaviors when presented with Java tools and utilities." <--- THIS QUOTE |
| 19:49:20 | <pumpkin> | I think so too |
| 19:49:28 | <bnijk> | @quote p_l |
| 19:49:29 | <lambdabot> | <p_l> says: damn, rage caused me to use wrong operator <bremner> is glad he is not in poland, so getting killed by p_l is less likely |
| 19:49:29 | <sm> | I was just thinking that.. it seems you can always express everything in text.. so the graphics appear to the side or something ? |
| 19:49:35 | <bnijk> | uhh |
| 19:49:36 | <luite> | hm, that would make a good gsoc project |
| 19:49:38 | <Cale> | There's no really good reason that this sort of thing should be restricted to a piece of very proprietary software :) |
| 19:50:05 | <p_l> | hmmm... when did I say that? Wasn't that probably some Lisp vs. Haskell flame? xD |
| 19:50:25 | <Cale> | sm: The graphics are displayed in a cell in the notebook. You can copy and paste them into expressions directly, they only display as graphics. |
| 19:50:29 | <sm> | I have assumed mathematica's language has some strengths that make this hard to do in haskell or elsewhere |
| 19:50:45 | <ksf> | Cale, it's copy-protected by wolfram's ego field. there's no way to get past that. |
| 19:50:54 | <bnijk> | ego field?? |
| 19:51:26 | <Cale> | For example, I can evaluate Graphics[Disk[]] to get a black unit disk, which I then resize interactively, copy, and paste into another expression... |
| 19:51:27 | <maltem> | Hmph. Looks like “cabal test” should in mere theory only behave the same as “./setup test”. |
| 19:51:34 | <pumpkin> | it's 1.0 wolframs of ego |
| 19:51:51 | <bnijk> | ACTION jumps out the window into the perilous-pit-o'-spikes |
| 19:52:10 | <kpreid> | Cale: There are other graphics-capable-command-line systems, too. The problem is that AFAIK they're all tightly tied to one platform |
| 19:52:18 | <pumpkin> | the ego field is impenetrable |
| 19:52:23 | <Cale> | http://cale.yi.org/share/Screenshot-Mathematica.png |
| 19:52:26 | <kpreid> | So nobody is going to be writing apps in $OTHERLANGUAGE/STYLE to run in them. |
| 19:52:33 | <Cale> | http://cale.yi.org/share/Screenshot-DynamicPolynomial3D.png |
| 19:52:42 | <kpreid> | Cale: Okay, that's silly and cute. |
| 19:53:03 | <pumpkin> | lol |
| 19:53:11 | <sm> | dr scheme has first-class graphical expressions, and reactive things.. but mathematica has something extra |
| 19:53:18 | <ksf> | so we'd end up with a tex and gtk clone written in haskell? |
| 19:53:31 | <pumpkin> | the point is the nice composable stuff |
| 19:54:52 | <Cale> | I suppose an important primitive in that system is Dynamic[expr] which displays in the frontend as the dynamically updated value of expr |
| 19:55:12 | <Cale> | and there are some options to it to control how often/when it is updated |
| 19:56:15 | <Cale> | And if the interactive value of expr is edited, then an assignment of the form expr = val is done (when possible) |
| 19:56:20 | <Cale> | (mathematica is not pure) |
| 19:56:35 | <tetha> | wow, this university-project does have some cool architecture. component-based code generation modules being interconnected magically according to the goal specification |
| 19:57:08 | <Cale> | tetha: which project? |
| 19:57:33 | <tetha> | Cale: fabric, some system to generate a middleware for varying platforms and languages |
| 19:57:58 | <Botje> | tetha: that sounds suspiciously like javabeans |
| 19:59:35 | <Baughn> | tetha: At runtime or compile-time? |
| 19:59:36 | <tetha> | Botje: well, not entirely, it is capable of generaty very small and efficient c-backends for sensor nodes |
| 20:00:04 | <tetha> | Baughn: the code generation modules are interconnected at compile time and generate some simple static code |
| 20:01:01 | <tetha> | in this case, a sensor node is basically a tiny embedded system with w-lan and less memory and processing power than my mouse |
| 20:02:01 | <p_l> | for wolfram and mathematica... |
| 20:02:03 | <p_l> | http://www65.wolframalpha.com/input/?i=PolarPlot[(1+%2B+0.9+Cos[8+t])+(1+%2B+0.1+Cos[24+t])+(0.9+%2B+0.05+Cos[200+t])+(1+%2B+Sin[t])%2C+{t%2C+-Pi%2C+Pi}] |
| 20:02:06 | <Cale> | {Slider[Dynamic[x], {1, 5}], Dynamic[Plot[Sin[x i], {i, 0, 2 Pi}]]} -- this is a list/pair of two components, the first of which displays as a slider for interactively changing the value x and the second of which is a plot of Sin[x i] for i from 0 to 2 pi. Of course, in this case x is a global mutable variable, so we might want to limit its scope. There's a DynamicModule primitive which binds dynamic variables and lim |
| 20:02:06 | <Cale> | its their scope too. |
| 20:02:57 | <Cale> | Perhaps a binding form of that sort would be better suited to an otherwise pure language. |
| 20:03:20 | <Cale> | p_l: cute :) |
| 20:03:49 | <p_l> | Cale: Found it on another channel :D |
| 20:03:54 | <Cale> | p_l: I can imagine a t-shirt with that formula on it being popular :) |
| 20:04:47 | <ulrivo> | Hi, I am doing my first steps with Gtk2hs. The doc for gtk2hs says that functions like onKeyPress, onExpose are deprecated. Does anybody know how to use widgetAddEvents etc? |
| 20:09:22 | <Cale> | dcoutts would know for sure. I can try to help :) |
| 20:10:37 | <Cale> | Er, widgetAddEvents only adds events to the list of events which the widget will receive in the first place, it doesn't attach handlers |
| 20:11:44 | <akamaus> | hi, why this doesn't work: |
| 20:11:48 | <akamaus> | data Browser a = Browser {unBrowser :: StateT BrowserState IO a} deriving (Monad) |
| 20:11:54 | <akamaus> | even with {-# LANGUAGE GeneralizedNewtypeDeriving #-} |
| 20:11:57 | <akamaus> | ? |
| 20:12:01 | <ulrivo> | Cale...yes, I think so, too. I assume that I have to use something like exposeEvent or buttonPressEvent |
| 20:12:29 | <paolino> | akamaus: newtype maybe |
| 20:13:08 | <Cale> | ulrivo: Normally you bind handlers using widget `on` keyPressEvent $ do ... |
| 20:13:35 | <pumpkin> | I assume that isn't the same on as Data.Function ? |
| 20:13:58 | <Cale> | Right. |
| 20:14:01 | <Cale> | It's different :) |
| 20:14:54 | <Cale> | http://haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Gdk-EventM.html -- this module defines actions for getting information about the event |
| 20:15:33 | <Cale> | http://haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Abstract-Widget.html#7 |
| 20:15:37 | <Cale> | these are the events |
| 20:16:10 | <akamaus> | paolino, thanks |
| 20:16:49 | <ulrivo> | in Abstract.Widget I found the info that the onKeyPress etc are deprecated |
| 20:16:55 | <Cale> | ulrivo: right |
| 20:17:32 | <Cale> | ulrivo: It's the stuff just above that which isn't deprecated |
| 20:17:52 | <Cale> | You use keyPressEvent instead |
| 20:18:33 | <ulrivo> | Cale...probaby, I start my Gtk2hs-efforts with the deprecated functions. For these functions are demos and examples. And as I understand these, there will be examples for the non-deprecated stuff...smile |
| 20:18:53 | <Cale> | You can see that its type is (WidgetClass self) => Signal self (EventM EKey Bool) |
| 20:19:05 | <ulrivo> | Cale...thanks for your help very much. |
| 20:19:09 | <Cale> | that is, it polymorphically applies to different types of widgets |
| 20:19:19 | <Cale> | and it is one of these funny signal things... |
| 20:19:39 | <Cale> | http://haskell.org/gtk2hs/docs/current/System-Glib-Signals.html#v%3Aon |
| 20:19:52 | <Cale> | now, on :: object -> Signal object callback -> callback -> IO (ConnectId object) |
| 20:20:27 | <pumpkin> | I'm not used to seeing full word type variables |
| 20:21:21 | <ulrivo> | Cale...that is a very good hint...I shall investigate in this direction further on. thank you very much indeed |
| 20:21:26 | <Cale> | So if we give on a widget, let's say a Button |
| 20:21:46 | <Cale> | then it will want a Signal Button callback |
| 20:21:58 | <Cale> | we can pass it keyPressEvent then |
| 20:22:10 | <Cale> | and callback is then EventM EKey Bool |
| 20:22:14 | <augustss> | ACTION wishes gtk2hs wasn't such a beast to compile. |
| 20:22:38 | <Cale> | So we then need to give it a value of type EventM EKey Bool |
| 20:23:34 | <Cale> | EventM EKey is a monad in which we have information about key events available to us |
| 20:23:54 | <Cale> | and we can also turn IO actions into EventM EKey actions by applying liftIO to them |
| 20:24:08 | <ulrivo> | Cale...wow...you are really quick |
| 20:25:43 | <Cale> | data EKey |
| 20:25:43 | <Cale> | A tag for key events. |
| 20:25:43 | <Cale> | Instances |
| 20:25:43 | <Cale> | HasModifier EKey |
| 20:25:43 | <Cale> | HasTime EKey |
| 20:25:51 | <Cale> | eventModifier :: HasModifier t => EventM t [Modifier] |
| 20:26:10 | <Cale> | eventKeyVal :: EventM EKey KeyVal |
| 20:26:18 | <Cale> | eventTime :: HasTime t => EventM t TimeStamp |
| 20:26:25 | <Cale> | Some handy actions available in that monad |
| 20:26:53 | <Cale> | eventKeyName :: EventM EKey String |
| 20:26:59 | <Cale> | and there are some others |
| 20:27:04 | <gwern> | man. I'd like to help Vasili but between his english and doing it on -cafe and and lack of experience with cabal, it's looking foreboding |
| 20:27:09 | <Cale> | (look for EKey in http://haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Gdk-EventM.html) |
| 20:27:09 | <Nafai> | I didn't realize I used some deprecated functions in my gtk2hs stuff |
| 20:27:24 | <Nafai> | Looks like I need to clean some things up |
| 20:28:36 | <Cale> | The nice thing about using an EventM monad is that handlers for the same type of event become somewhat composable. |
| 20:28:45 | <duaneb> | is there a convenient function (or idiom) for printin a list of values? |
| 20:28:56 | <Cale> | mapM_ print list |
| 20:29:07 | <Cale> | Or just print list |
| 20:29:13 | <ulrivo> | Cale...EventM seems to have some nice functions but I will need some time to clarify for myself :-) |
| 20:29:17 | <duaneb> | no, I mean |
| 20:29:28 | <duaneb> | e.g. let showList :: (Show a) => [a] -> a; showList [1,2,3,4] = "1, 2, 3, 4" |
| 20:29:57 | <Cale> | intercalate ", " . map show $ [1,2,3,4] |
| 20:29:59 | <Cale> | > intercalate ", " . map show $ [1,2,3,4] |
| 20:30:00 | <lambdabot> | "1, 2, 3, 4" |
| 20:30:04 | <duaneb> | intercalate? |
| 20:30:11 | <duaneb> | how can I memorize this sort of stuff?!! |
| 20:30:23 | <int-e> | idle on #haskell |
| 20:30:28 | <bob0> | what is wrong with http://pastebin.com/f17df9141? |
| 20:30:39 | <bd_> | @hoogle [a] -> a -> [a] |
| 20:30:39 | <lambdabot> | Data.List intersperse :: a -> [a] -> [a] |
| 20:30:39 | <lambdabot> | Data.List insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a] |
| 20:30:39 | <lambdabot> | Data.List deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a] |
| 20:30:44 | <Zao> | For starters, you typed the ? too close to the URL :) |
| 20:30:50 | <bd_> | @hoogle [a] -> [a] -> [a] |
| 20:30:50 | <lambdabot> | Prelude (++) :: [a] -> [a] -> [a] |
| 20:30:50 | <lambdabot> | Data.List (++) :: [a] -> [a] -> [a] |
| 20:30:50 | <lambdabot> | Data.List deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] |
| 20:30:54 | <bd_> | hmmph. |
| 20:31:02 | <duaneb> | @hoogle (Show a) => [a] -> String |
| 20:31:02 | <lambdabot> | Prelude show :: Show a => a -> String |
| 20:31:02 | <lambdabot> | Text.Show show :: Show a => a -> String |
| 20:31:02 | <lambdabot> | Prelude cycle :: [a] -> [a] |
| 20:31:03 | <Zao> | http://www.thefreedictionary.com/intercalate |
| 20:31:04 | <Cale> | hoogle probably would get it, if it returned enough results :) |
| 20:31:16 | <Zao> | In chemistry, intercalate has something to do with inserting molecules between other molecules. |
| 20:31:28 | <Cale> | 'interpose' might have been a nicer word to use |
| 20:31:40 | <bob0> | what is wrong with http://pastebin.com/f17df9141 ? |
| 20:31:51 | <gwern> | bob0: your type is wrong |
| 20:32:18 | <Cale> | bob0: You didn't paste the error message to go with it... |
| 20:32:20 | <gwern> | you've got it used only with Integers, not with anything that is Integral |
| 20:32:30 | <int-e> | bob0: you're being bitten by the (dreaded) monomorphism restriction |
| 20:32:32 | <gwern> | Cale: his sv_fps has too general a type |
| 20:32:49 | <gwern> | bob0: but comment it out and ghci can infer a sig for it |
| 20:32:53 | <int-e> | bob0: give a type signature for max_unlagged_markers: max_unlagged_markers :: Num a => a and it'll work |
| 20:33:06 | <wh1t3> | shouldnt there be () around show ... ? |
| 20:33:09 | <Cale> | ah, yeah, the problem is max_unlagged_markers getting defaulted to Integer |
| 20:33:19 | <Cale> | wh1t3: Not necessary. |
| 20:33:37 | <Cale> | I would use concat rather than multiple ++'s though |
| 20:33:42 | <Zao> | Or Printf. |
| 20:33:57 | <bob0> | max_unlagged_markers is supposed to be an integer |
| 20:34:06 | <bob0> | what is the cancat operater in haskell? |
| 20:34:13 | <Cale> | concat |
| 20:34:45 | <Cale> | > let fps = 60 in concat ["If sv_fps is '", show fps, "', then the maximum ping..."] |
| 20:34:46 | <lambdabot> | "If sv_fps is '60', then the maximum ping..." |
| 20:35:39 | <bob0> | I don't want the function to be called with a float |
| 20:35:45 | <bob0> | doesn't Num include float? |
| 20:36:25 | <int-e> | bob0: oh, then you should use fromIntegral max_unlagged_markers instead of max_unlagged_markers in sv_fps as well. Or perhaps you should use Integer all the way as gwern suggested |
| 20:37:57 | <Baughn> | dcoutts: Have you tried using cabal-install with ghc 6.11's shared library support? |
| 20:38:14 | <Baughn> | dcoutts: By which I mean "would you like to help me debug this problem" |
| 20:38:21 | <Cale> | bob0: If you delete your type signatures, you can see the inferred types in ghci |
| 20:38:32 | <Cale> | bob0: (or just comment them out) |
| 20:40:23 | <bob0> | Cale: the inferred type is (Integral b1, RealFrac b, Integral b) => b -> (b1, [Char]). What is RealFrac? |
| 20:40:33 | <pumpkin> | @src RealFrac |
| 20:40:33 | <lambdabot> | class (Real a, Fractional a) => RealFrac a where |
| 20:40:33 | <lambdabot> | properFraction :: (Integral b) => a -> (b,a) |
| 20:40:33 | <lambdabot> | truncate, round, ceiling, floor :: (Integral b) => a -> b |
| 20:41:19 | <Cale> | bob0: ah, that's a problem because there are no types which are both Integral and RealFrac |
| 20:41:23 | <bob0> | how can something be both a RealFrac and an Integral? |
| 20:41:32 | <Zao> | bob0: Just have instances for both. |
| 20:41:34 | <Cale> | (but the compiler doesn't know that) |
| 20:41:46 | <Zao> | They may not be that horribly sensical, but it's possible. |
| 20:41:57 | <Cale> | The problem is that you're applying ceiling to what ought to already be an Integral |
| 20:42:13 | <Cale> | er... actually |
| 20:42:18 | <Cale> | that's not it :) |
| 20:42:31 | <cj2> | hey people, i got one question about Gridcontrolls in wxhaskell. Don't know how to set the domain in wxhaskell, i want rows from 0 to 100 in stead of 1 to 100. does anyone now please??? |
| 20:42:57 | <pumpkin> | in 1 to 100's stead? |
| 20:43:10 | <Cale> | let's see.. |
| 20:43:16 | <cj2> | i want to change the range./domain |
| 20:43:27 | <bob0> | I removed ceiling, but what's wrong with the type signature of "sv_fps :: (Integral a) => a -> (a, String)"? |
| 20:43:38 | <augustss> | cj2: function composition? |
| 20:44:04 | <cj2> | no it has nothing do do with functin composition... there has to be a simple function for it |
| 20:44:08 | <cj2> | just dont know which one it is |
| 20:44:16 | <Cale> | You're applying fromIntegral to unlagged and max_unlagged_markers, so those both have to be Integral types, then you're dividing them, so they need to be coerced to Fractional types, multiplication by 1000 is fine there, and then you take the ceiling, so you should get back to Integral |
| 20:44:54 | <Baughn> | dcoutts: I figured it out; it needs to provide -shared when linking libraries if shared is true. Let's see if I can write a patch.. |
| 20:45:26 | <Cale> | actually, hang on |
| 20:47:00 | <Cale> | Yes, the problem is the dreaded monomorphism restriction as people mentioned :) |
| 20:47:12 | <pumpkin> | OH NO! |
| 20:47:27 | <pumpkin> | not the dreaded monomorphism restriction! |
| 20:47:45 | <bob0> | Cale: the newest is http://pastebin.com/f21229c16 |
| 20:47:49 | <Cale> | bob0: When you define a constant as you have with max_unlagged_markers, the Haskell 98 spec says that it must have a monomorphic type |
| 20:47:50 | <bob0> | Cale: what is monomorphism? |
| 20:47:56 | <Cale> | That is, not polymorphic |
| 20:48:24 | <Cale> | That is, *unless* it has an explicit type signature |
| 20:48:29 | <Cale> | or a function parameter |
| 20:48:36 | <Cale> | (on the left of the =) |
| 20:48:52 | <Cale> | adding the explicit signature: |
| 20:48:56 | <Cale> | max_unlagged_markers :: (Integral a) => a |
| 20:49:02 | <Cale> | will make the original code work |
| 20:49:11 | <Cale> | also, just turning this stupid restriction off will work |
| 20:49:20 | <Cale> | {-# LANGUAGE NoMonomorphismRestriction #-} |
| 20:49:24 | <Cale> | (at the top of the file) |
| 20:49:34 | <bob0> | that's interesting syntax |
| 20:49:47 | <pumpkin> | it's a pragma |
| 20:49:49 | <bob0> | does that involve a preprocessor? |
| 20:49:52 | <Cale> | It's a sort of pragma which is available in multiple compilers. |
| 20:50:43 | <Cale> | (It works in hugs and GHC at least... I think others might support it too) |
| 20:51:02 | <bob0> | Thanks. I've got it working |
| 20:51:09 | <augustss> | If you run into the MR with non-functions, you have usually made a mistake. |
| 20:51:32 | <Cale> | In this case, just picking a monomorphic type would also work well. |
| 20:51:34 | <SamB_XP> | Cale: I believe the authors at least feel that they ought to get around to it sometime, in most cases |
| 20:51:40 | <Cale> | Like, restricting it to Integer |
| 20:53:20 | <Cale> | augustss: Well, that's not the case here, though it's possible there's another simple way around it. |
| 20:53:53 | <Cale> | ah, yeah, adding another fromIntegral to the occurrence of max_unlagged_markers in sv_fps works |
| 20:54:07 | <Cale> | (instead of any of the other changes) |
| 20:54:32 | <Cale> | Then max_unlagged_markers is an Integer |
| 20:54:45 | <Cale> | (numeric defaulting occurs) |
| 20:54:48 | <augustss> | Cale: I think it should be Integer, not Num a. What are fractional users? |
| 20:55:01 | <alexsuraci> | Followup: I went with ansi-terminal for colored output |
| 20:55:53 | <Cale> | augustss: Well, there are certainly computations in which you might want to divide by it. |
| 20:56:31 | <augustss> | Sure, and then you should convert there, so you know what you're doing. :) |
| 20:56:37 | <Cale> | augustss: In which case, having it be polymorphic is convenient, and Num a => a is essentially isomorphic to Integer anyway. |
| 20:57:41 | <augustss> | Cale: yes, sometimes it is convenient |
| 21:00:34 | <Baughn> | dcoutts: Yep, just need to add -shared to ghcArgsShared in Simple/GHC.hs in cabal. Well, that was easy.. hope it works. |
| 21:01:56 | <Cale> | oh, cj2 left... I was going to try to help... |
| 21:04:47 | <Botje> | phew |
| 21:05:08 | <Botje> | ACTION just wrestled through "clowns to the left of me, jokers to the right: dissecting data structures" by conor mcbride |
| 21:05:18 | <Botje> | now to turn it into a presentation |
| 21:05:46 | <duaneb> | ok |
| 21:05:55 | <duaneb> | I think my program has gotten far enough that it needs error checking |
| 21:06:01 | <duaneb> | err, errors |
| 21:06:08 | <duaneb> | what's a good, non `error' way to do this? |
| 21:06:52 | <Botje> | if there are testable chunks, quickcheck? |
| 21:07:15 | <Cale> | duaneb: Maybe/Either are good for pure code. |
| 21:07:36 | <Cale> | duaneb: For IO code, there's exceptions |
| 21:08:01 | <Cale> | http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html |
| 21:10:52 | <Cale> | heh, it seems that haddock has mangled the example code there |
| 21:11:08 | <Cale> | By clicking view source, at least you can see it properly |
| 21:12:32 | <Cale> | Er, just "Source" rather :) |
| 21:25:14 | <gwern> | > (10.93 - 4.98) |
| 21:25:15 | <lambdabot> | 5.949999999999999 |
| 21:25:21 | <gwern> | hm? |
| 21:25:42 | <gwern> | that seems a little odd... |
| 21:25:50 | <augustss> | does it? |
| 21:26:22 | <pumpkin> | > sum $ replicate 10000 (0.01 :: Float) |
| 21:26:23 | <lambdabot> | 100.00295 |
| 21:26:26 | <gwern> | 93 - 98 is perfectly exact |
| 21:26:31 | <gwern> | no need for the 999... |
| 21:26:43 | <augustss> | gwern: yes, but that's not what you used. |
| 21:27:08 | <augustss> | You used multiple of 0.01, and 0.01 is not represented exactly with binary floating point numbers. |
| 21:27:13 | <pumpkin> | @check \x y z -> (x + y) + z == (x + (y + z) :: Double) |
| 21:27:14 | <lambdabot> | "Falsifiable, after 15 tests:\n1.6\n3.0\n-7.0\n" |
| 21:27:21 | <Cale> | 10.93 isn't exactly representable as a finite binaryfloating point number |
| 21:27:39 | <gwern> | but but it's 4 freaking digits! |
| 21:27:41 | <Cale> | missed a space there ;) |
| 21:27:45 | <pumpkin> | lol |
| 21:27:46 | <gwern> | we have gigs and gigs of ram! |
| 21:27:49 | <Cale> | gwern: Think of its binary representation |
| 21:27:52 | <gwern> | how can we not represent it? |
| 21:27:56 | <Cale> | What is it in binary? |
| 21:27:58 | <pumpkin> | gwern: you can't finitely represent 0.9 either, and that's even fewer digits |
| 21:28:01 | <gwern> | ACTION dunno |
| 21:28:19 | <Cale> | 0.1 also isn't representable as a finite sequence of binary digits |
| 21:28:30 | <augustss> | gwern: only powers of 2 have a chance to be represented exactly |
| 21:28:36 | <Cale> | Let's calculate the binary representation of 0.1 |
| 21:28:39 | <gwern> | Cale: auugh! |
| 21:28:41 | <FunctorSalad> | gwern: it's just like 1/3 in decimal |
| 21:28:51 | <gwern> | ACTION decides math on computers is insane, and will leave it there |
| 21:28:53 | <Cale> | It's less than 1/2, so the first bit after the binary point is 0 |
| 21:28:54 | <pumpkin> | lol |
| 21:29:06 | <pumpkin> | > 0.5 + 0.25 + 0.125 + 0.0625 |
| 21:29:07 | <lambdabot> | 0.9375 |
| 21:29:07 | <Cale> | and it's also less than 1/4, so the second bit is 0 |
| 21:29:23 | <FunctorSalad> | there's only a finite decimal expansion for k/n if every prime factor of n is a prime factor of the base.. |
| 21:29:31 | <FunctorSalad> | err, not decimal expansion |
| 21:29:33 | <Cale> | and it's less than 1/8, so the third bit is 0 |
| 21:29:36 | <augustss> | gwern: floating point is insane, but fast |
| 21:29:47 | <Cale> | but it's larger than 1/16, so the 4th bit is 1 |
| 21:29:54 | <gwern> | augustss: if I wanted fast and wrong, I'd be in #c! |
| 21:30:04 | <Cale> | and then 1/10 - 1/16 = 3/80 |
| 21:30:10 | <pumpkin> | use CReal then |
| 21:30:17 | <augustss> | gwern: if you want slow and correct you can use CReal :) |
| 21:30:38 | <augustss> | > (10.93 - 4.98) :: CReal |
| 21:30:39 | <lambdabot> | 5.95 |
| 21:30:40 | <conal> | "C: for when there isn't time to get it right." |
| 21:30:40 | <gwern> | > ((10.93 :: CReal) - (4.98::CReal)) |
| 21:30:40 | <Cale> | 3/80 is larger than 1/32, so the 5th digit is 1 as well |
| 21:30:41 | <lambdabot> | 5.95 |
| 21:30:54 | <gwern> | phew |
| 21:30:59 | <pumpkin> | Cale's going to get stuck in an infinite loop at this rate |
| 21:31:02 | <gwern> | ACTION feels much better |
| 21:31:03 | <bavardage> | :D |
| 21:31:10 | <Cale> | and the result is 1/160 |
| 21:31:16 | <Cale> | (the remainder) |
| 21:31:28 | <SamB_XP> | conal: strangely enough, CReal has nothing to do with C |
| 21:31:29 | <Cale> | which is 1/16 of what we started with |
| 21:31:51 | <gwern> | SamB_XP: it doesn't? then what is it? |
| 21:31:52 | <Cale> | and so if we keep at this, the pattern will repeat. |
| 21:32:05 | <augustss> | gwern: C=Constructive |
| 21:32:06 | <Cale> | (as 16 is a power of 2) |
| 21:32:08 | <conal> | SamB_XP: i was refering back to gwern's remark about #c |
| 21:32:29 | <SamB_XP> | gwern: Constructive Real, I assume |
| 21:32:37 | <SamB_XP> | er. I probably knew that |
| 21:33:11 | <FunctorSalad> | it's weird, with CString etc... |
| 21:33:28 | <augustss> | The name is not ideal |
| 21:33:43 | <pumpkin> | we should throw it in with Foreign.C.Types to confuse people |
| 21:34:03 | <SamB_XP> | lol |
| 21:34:03 | <pumpkin> | "oh, you meant it was for the language c? I though it was just for types with a C prefix on their name!" |
| 21:34:43 | <SamB_XP> | I would rotfl, but there isn't enough room ... plus the dog is already down there ... |
| 21:36:53 | <FunctorSalad> | @remember <pumpkin> we should throw it [CReal] in with Foreign.C.Types to confuse people |
| 21:36:54 | <lambdabot> | I will never forget. |
| 21:37:42 | <gwern> | @flush |
| 21:37:45 | <FunctorSalad> | noooooo |
| 21:38:08 | <FunctorSalad> | or wait, maybe that just commits to disk |
| 21:38:11 | <FunctorSalad> | ? |
| 21:38:58 | <Cale> | yeah |
| 21:39:05 | <pumpkin> | :P |
| 21:39:08 | <Cale> | in case lambdabot crashes for some reason |
| 21:39:11 | <FunctorSalad> | I always misunderstand that word in computing... |
| 21:40:27 | <gwern> | Cale: update the darcs state/ recently? |
| 21:40:37 | <Cale> | nope |
| 21:40:51 | <gwern> | you should |
| 21:40:56 | <Cale> | If you want, I can copy it over. |
| 21:41:15 | <gwern> | an update would be good |
| 21:41:18 | <gwern> | the last one was ages ago |
| 21:41:25 | <gwern> | makes me antsy |
| 21:41:35 | <PetRat> | http://www.mibbit.com/pb/scHly0 <- Here I've got a parser that parsers strings separated by semicolons. I would also like it to discard anything past the last semicolon without giving an error. What is a simple way to do that? |
| 21:41:36 | <Cale> | It's just state... |
| 21:41:50 | <gwern> | it is the sweat and tears of dozens of haskellers! |
| 21:42:55 | <Berengal> | ACTION has a L-System \o/ |
| 21:44:40 | <Berengal> | Imma render som sierpinsky triangles and dragon curves |
| 21:46:43 | <Cale> | parseTest (do xs <- many (try (manyTill anyChar (char ';'))); many anyChar; return xs) "abc;def;ghi" |
| 21:46:46 | <Cale> | ["abc","def"] |
| 21:47:33 | <Cale> | If you'd rather the parser not eat those characters, you can leave off the many anyChar, which allows you to simplify |
| 21:47:48 | <Cale> | Prelude Text.Parsec> parseTest (many (try (manyTill anyChar (char ';')))) "abc;def;ghi" |
| 21:47:49 | <Cale> | ["abc","def"] |
| 21:48:31 | <Cale> | The 'try' is required because you need to look ahead to determine if there's another ; |
| 21:49:00 | <PetRat> | Cale: thanks, I will study this and get back to you if any questions. |
| 21:49:03 | <Cale> | Without try, parsec parsers always decide what route to take based only on the next character |
| 21:49:24 | <PetRat> | By the way, is this an inefficient parser because you are applying 'try' to what might be a very long string? |
| 21:49:41 | <FunctorSalad> | I found that sort of parsing confusing with parsec... |
| 21:49:50 | <FunctorSalad> | you might consider using a lexer |
| 21:50:00 | <FunctorSalad> | (like alex) |
| 21:50:22 | <PetRat> | I also realized a moment ago that I could use sepBy and then one more step to discard the last item (after checking whether a semicolon follows it.) |
| 21:50:27 | <FunctorSalad> | or just Data.List.Split.splitOn ";" :) |
| 21:50:46 | <PetRat> | FunctorSalad: you are so right. :) |
| 21:51:02 | <PetRat> | Cale: I'm still glad you showed me how one might do it that way. |
| 21:52:08 | <Cale> | Well, it's potentially inefficient, but there's no way around that. |
| 21:52:25 | <Cale> | Since there's no way to check if there's another ; than to look through the remainder of the input. |
| 21:55:44 | <dmwit_> | ?unmtl MaybeT (StateT s m a) |
| 21:55:44 | <lambdabot> | err: `MaybeT (s -> m (a, s))' is not applied to enough arguments. |
| 21:56:02 | <dmwit_> | ?unmtl MaybeT (StateT s m) a |
| 21:56:02 | <lambdabot> | s -> m (Maybe a, s) |
| 21:56:23 | <dmwit_> | ?unmtl StateT s (MaybeT m) a |
| 21:56:24 | <lambdabot> | s -> m (Maybe (a, s)) |
| 21:59:16 | <dmwit_> | ?index MaybeT |
| 21:59:16 | <lambdabot> | bzzt |
| 21:59:58 | <Philonous> | @type liftM ($) |
| 21:59:59 | <lambdabot> | forall a b (m :: * -> *). (Monad m) => m (a -> b) -> m (a -> b) |
| 22:00:46 | <dmwit_> | :t liftM id -- same idea |
| 22:00:47 | <lambdabot> | forall a1 (m :: * -> *). (Monad m) => m a1 -> m a1 |
| 22:01:31 | <Philonous> | @type liftM2 ($) |
| 22:01:33 | <lambdabot> | forall a2 b (m :: * -> *). (Monad m) => m (a2 -> b) -> m a2 -> m b |
| 22:01:40 | <Philonous> | That's more like it :) |
| 22:04:12 | <Philonous> | But I wonder, isn't the (m:: * > *) part redundant ? |
| 22:09:18 | <Berengal> | @type ap |
| 22:09:19 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => m (a -> b) -> m a -> m b |
| 22:13:33 | <Berengal> | Been coding for over a day straight, and all I've got to show for it is 250 lines... |
| 22:13:51 | <pumpkin> | 250 lines can be a lot of logic |
| 22:14:17 | <jmcarthur_work> | 250 lines is a very large amount of code for one day |
| 22:14:21 | <Berengal> | Much of it is simple convenience functions and values for ghci |
| 22:14:39 | <pumpkin> | convenience functions can make it so that your important functions take a line each :) |
| 22:15:23 | <Berengal> | Not test values though |
| 22:15:34 | <jmcarthur_work> | Berengal, Arbitrary :) |
| 22:16:17 | <Berengal> | jmcarthur_work: Test as in foo values, not as in checking for correctness |
| 22:30:15 | <ksf> | has anyone ever wished for reverse dependencies on hackage? |
| 22:30:30 | <ksf> | that is, see which packages depend on some package? |
| 22:33:00 | <Berengal> | I believe ghc-pkg unregister tells you if that breaks some other packages at least... not at all optimal though |
| 22:41:42 | <ksf> | I'd like something for those "what a cool library, I wonder if there are examples"-moments. |
| 22:43:08 | <Botje> | some example uses like perldoc's synopsis |
| 22:43:11 | <Botje> | would be nice too |
| 22:54:20 | <bavardage> | is there a predefined function to split a list into certain sized chunks? |
| 22:54:56 | <Botje> | check Data.List.Split |
| 22:55:02 | <thoughtpolice> | @hackage split |
| 22:55:02 | <lambdabot> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/split |
| 22:55:05 | <thoughtpolice> | ^^ |
| 22:55:31 | <bavardage> | ty |
| 22:55:34 | <bavardage> | :D |
| 23:04:33 | <dcoutts> | Baughn: I'm not so sure about -shared in ghcArgsShared, we use it in ghcSharedLinkArgs because it's a link-time flag. |
| 23:04:39 | <ctran> | [Char] -> Int -> [[Char]] |
| 23:06:43 | <Baughn> | dcoutts: Hm. It wasn't being used, though. |
| 23:07:09 | <Baughn> | dcoutts: I guess it doesn't hurt when I tell cabal to use it /all/ the time, but using cabal install -v I noted a distinct lack of -shared |
| 23:07:12 | <dcoutts> | Baughn: there is a bug with the interpretation of the command line with ghc --make -dynamic (which is my fault and I've got a patch for). It's supposed to be ghc --make -shared that makes it link, not ghc --make -dynamic |
| 23:07:33 | <Baughn> | Ah |
| 23:07:50 | <dcoutts> | Baughn: with the patch for ghc is applied, then what cabal already does just works |
| 23:08:06 | <dcoutts> | -shared is exclusively a link time flag |
| 23:10:01 | <Baughn> | dcoutts: I'll live with it for the moment, then. My ugly hack works. :) |
| 23:10:40 | <dcoutts> | Baughn: or apply this patch for ghc http://haskell.org/~duncan/ghc/link-shared-flag-fix.dpatch |
| 23:12:15 | <int-e> | dcoutts: I have a problem with using 'ar -r -s -c' instead of 'ar q': Cabal relies on being able to put object files with identical names into an .a archive. Now if there are many object files (which happens with --enable-split-objs) and those additions are spread over several command invocations, only one copy of the object file will survive. :-( |
| 23:12:42 | <dcoutts> | int-e: gah! |
| 23:13:29 | <Baughn> | (Solution: Use dynamic linking, don't use split-objs?) |
| 23:13:46 | <dcoutts> | int-e: so there is no portable way of doing it :-( |
| 23:14:10 | <Baughn> | Well, there is the "rename the files" way |
| 23:14:14 | <int-e> | dcoutts: short of renaming all .o files, I guess not. |
| 23:14:26 | <Baughn> | Stick the md5sum of the file in the filename? |
| 23:14:35 | <dcoutts> | int-e: unless we make the archive ourselves and call ranlib :-) |
| 23:14:48 | <Baughn> | That wouldn't be portable. :P |
| 23:14:58 | <dcoutts> | why not? ar is a standard format |
| 23:15:16 | <Baughn> | It used to be, but consider extensions such as what LLVM and ICC like to stick in them |
| 23:15:29 | <int-e> | which we don't need or use. |
| 23:15:40 | <dcoutts> | int-e: you're using gnu ar? |
| 23:15:41 | <dmwit_> | Berengal: Don't feel bad. Last summer, I worked out that I averaged ten lines of code per hour while on the job, and that was in a more verbose language than Haskell. =) |
| 23:15:49 | <int-e> | dcoutts: yes. |
| 23:15:52 | <Baughn> | int-e: And if Clang eventually supercedes gcc? |
| 23:15:58 | <int-e> | Baughn: I think dynamic linking solves a different problem. |
| 23:16:17 | <Baughn> | int-e: It does mean you don't have to use split-objs, at least |
| 23:16:30 | <dcoutts> | int-e: the man page for gnu ar says it implements q as a synonym for r, but obviously it's wrong |
| 23:16:36 | <int-e> | dcoutts: and I found that the documentation is inaccurate; -q and -r do not do the same thing. |
| 23:16:39 | <int-e> | exactly. |
| 23:17:12 | <dcoutts> | int-e: so we need to go look again at what solaris and mac osx ar do/need |
| 23:17:22 | <bavardage> | what would have type (a -> b) -> [a] -> [b] |
| 23:17:24 | <bavardage> | like map |
| 23:17:31 | <bavardage> | but with a change of type |
| 23:17:39 | <bavardage> | oh dammit, that is map |
| 23:17:45 | <ehird> | 00:15 Baughn: int-e: And if Clang eventually supercedes gcc? ← please, don't say "if" |
| 23:17:45 | <bavardage> | ByteString's map isn't like that :( |
| 23:18:20 | <int-e> | dcoutts: can we get away with naming the .o files 1.o, 2.o, 3.o, ...? We build a list of object files to link anyway; renaming them shouldn't be incredibly hard. |
| 23:19:07 | <dcoutts> | int-e: ok, so we only need to worry about split-objs presumably? ar -r a.o a.o adds both? |
| 23:19:37 | <int-e> | dcoutts: yes, that case seems to work. |
| 23:19:46 | <dcoutts> | phew! |
| 23:20:29 | <dcoutts> | int-e: so for the xargs/splitobjs case we can use -q for the initial invocations and -q -s for the last |
| 23:20:45 | <int-e> | dcoutts: ar -q -s also fails. ar -q -c works; ar -r doesn't. |
| 23:21:19 | <dcoutts> | int-e: sorry you've lost me, doing what? |
| 23:22:08 | <dmwit_> | bavardage: If you have to change type, you need to unpack the ByteString into a list. |
| 23:22:48 | <int-e> | dcoutts: I have a test script here (from a Setup build -v log) that I can use to create a .a archive with various ar options. 'ar -r -s -c' is what Cabal now uses; 'ar q' (or 'ar -q') is what it used to use; but I've tried a few other combinations as well. |
| 23:23:06 | <Cale> | ACTION demonstrates the inability to wrap something around the projective plane twice with crude drawings :) http://cale.yi.org/share/projective-world-pull.png |
| 23:24:18 | <int-e> | dcoutts: and when I use 'ar -q -s' on all invokations, I end up with an archive with only one copy of Stream__1.o (this is HTTPbis which has two 'Stream' modules). |
| 23:24:44 | <dcoutts> | int-e: that is pretty strange |
| 23:25:08 | <dcoutts> | int-e: since supposedly -q makes the index anyway |
| 23:25:21 | <int-e> | ar -q and then running ranlib produces a different result, so that part of the ar manpage is wrong, too. binutils version is 2.18 btw. |
| 23:28:51 | <dcoutts> | int-e: so we cannot use -q and -s together, so I guess we must use -q for the whole lot and then run ar -s on it's own at the end (which is equivalent to ranlib) |
| 23:30:40 | <dcoutts> | int-e: and for gnu ar we should use -q -S on the normal ones and either omit -S on the final, or run ar -s / ranlib separately |
| 23:32:04 | <int-e> | -S also hurts. Meh, I don't like this. I'd declare it a GNU ar bug, except that they'll probably say that identical file names of archive members aren't supported. |
| 23:35:13 | <dcoutts> | int-e: how are you using -S exactly? |
| 23:35:40 | <int-e> | dcoutts: AR="/usr/bin/ar -q -S" and then $AR file.a <lots of o files> (3 times) |
| 23:35:55 | <dcoutts> | and it still omits duplicates? |
| 23:36:00 | <int-e> | yep. |
| 23:36:08 | <dcoutts> | so only -q works with gnu ar |
| 23:36:31 | <dcoutts> | int-e: check that running ar -s on the final result doesn't mess things up |
| 23:36:48 | <dcoutts> | just "ar -s libHSfoo.a" on it's own |
| 23:37:35 | <int-e> | dcoutts: that seems to work. odd. |
| 23:38:50 | <dcoutts> | int-e: ok, so we're ok for the normal "all in one go" invocation, and for the multi-step we have to use -q for the normal bits and then a call at the end with ranlib / ar -s |
| 23:39:03 | <dcoutts> | int-e: and in theory that should still be the same on all platforms |
| 23:39:16 | <dcoutts> | though strictly the ar -s is redundant with gnu ar |
| 23:39:28 | <dcoutts> | and possibly with solaris too, maybe only needed with osx |
| 23:40:02 | <dcoutts> | int-e: we should update the ticket with your discoveries http://hackage.haskell.org/trac/hackage/ticket/318 |
| 23:41:53 | <int-e> | I'll add something. |
| 23:48:40 | <travisbrady> | anyone know of a good explanation of Zippers other than the wikibook? |
| 23:49:06 | <skorpan> | i'd like that as well. |
| 23:54:14 | <Berengal> | Huh, random L-Systems can be nifty... |
| 23:54:38 | <Berengal> | I wonder what happens if I change the angle... |
| 23:54:39 | <Saizan_> | http://notvincenz.blogspot.com/2007/07/higher-order-zippers.html <- the first part recaps normal zippers |
| 23:55:07 | <Cale> | Berengal: have you got nondeterminism in your L-System expansion? |
| 23:55:45 | <Berengal> | Cale: Not yet, but it shouldn't be hard to add |
| 23:56:06 | <Berengal> | Just layer on a random-monad and change a few types... |
| 23:56:56 | <Cale> | http://www.haskell.org/gtk2hs/gallery/Cairo-demo/Nymphaea_Drawing |
| 23:57:20 | <Cale> | That's from an L-System generator that Paolo and I wrote a while back :) |
| 23:57:32 | <Cale> | You can still get it from Hackage if you have gtk2hs :) |
| 23:57:36 | <Berengal> | Yeah, I saw those yesterday |
| 23:58:14 | <Berengal> | I'm just doing this because I'm bored |
| 23:59:17 | <Berengal> | Since you've done this already, is there an easy way to center and scale the renderings? |
Back to channel and daily index: content-negotiated html turtle