Experimental IRC log haskell-2009-06-11

Available formats: content-negotiated html turtle (see SIOC for the vocabulary)

Back to channel and daily index: content-negotiated html turtle

These logs are provided as an experiment in indexing discussions using IRCHub.py, Irc2RDF.hs, and SIOC.

00:00:12<Cale>Once you've fixed how the result will be pattern matched against, then the performance becomes not-a-problem to reason about.
00:00:44<dibblego>I've seen laziness cause a lot of people a lot of problems, but invariably it was because they had already installed bad software in their brain
00:01:08<Cale>For things which produce lists, for example, it's often enough to think of performance in terms of the size of the input, and the number of elements of the resulting list which are inspected.
00:01:17<Nafai>dibblego: Too bad I can't just apt-get remove bad_software
00:01:29<wy_>There are too many bad softwares already. I believe we all still have some of them installed
00:01:44<monochrom>"Just" set up a new virtual machine in your mind. <duck>
00:01:49<Cale>So that's a *little* bit harder than only looking at the size of the input, but not so much worse, when you think of the benefit that it potentially gives you.
00:01:53<dibblego>Nafai, indeed, it is ultimately because their apt-get has bugs
00:02:22<Cale>In strict languages, the performance *can't* depend on the number of elements of the result which are inspected, which means that you always have the worst possible case there
00:02:30<monochrom>Actually these days I tell people "set up a new blank virtual machine in your mind to learn haskell". I am serious about it.
00:02:38<wy_>UNIX is the first bad software installed ;-)
00:02:54<Nafai>monochrom: Sounds hard :)
00:02:59<dibblego>monochrom, I do same, but the problem is that many people don't know how "blank" it really must be
00:03:49<uzytkownik>@hoogle liftA
00:03:51<lambdabot>Control.Applicative liftA :: Applicative f => (a -> b) -> f a -> f b
00:03:51<lambdabot>Control.Applicative liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
00:03:51<lambdabot>Control.Applicative liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
00:03:52<wy_>so let's hope haskell can run on bare hardware :P
00:04:33<wy_>but then you need to get processors other than Intel's
00:04:40<TomMD>dcoutts: Is there a wiki with desired improvements and features for hackage-server? Aside from signing, file serving, and prettier pages people always mention a lot of decent ideas (the most common one being per-package download counters).
00:05:04<dcoutts>TomMD: we use the Cabal/Hackage trac generally
00:05:24<dcoutts>TomMD: but there are many ideas that are just floating about. Quite a few are in my head :-)
00:05:38<wy_>bah... our system is built up with gargage and band-aids
00:05:52<dcoutts>TomMD: yes, stats of various forms, I can tell you more about any of the areas or specific ideas
00:06:10<wy_>s/garbage ...
00:06:30<dcoutts>TomMD: we can certainly try and flesh out more of the ideas as trac tickets
00:07:03<dcoutts>TomMD: up 'til now I've not generally felt it that necessary I guess since it's been reasonably obvious what needs doing, since we're not yet at feature parity
00:07:28<defun>I am on the verge of releasing a medium sized project that is to handle encrypted communication (chat and file transfer) over the internet. What license should I use? Or rather, what licenses do Haskell projects/devs usually use, and why? Thanks. Btw, I don't plan on selling the software.
00:07:46<dcoutts>defun: usually BSD, LGPL or GPL
00:08:02<dcoutts>defun: with the choice depending on your views and goals
00:08:45<defun>dcoutts: compatibility with other haskell-based projects, and apparently freedom, are my goals.
00:09:37<dcoutts>defun: freedom is tricky :-) it depends how you look at it. There are people who say BSD is more free than GPL and others who say the reverse :-)
00:09:43<monochrom>Using a similar license as GHC's may work nicely.
00:10:42<dcoutts>it's pretty much impossible to pick a license that isn't compatible with GHC's
00:10:51<defun>dcoutts: ah. I see.
00:11:02<wy_>In what sense is GPL less free than BSD?
00:11:16<sjanssen>defun: I'd say BSD is the most popular. There are concerns about the GPL and static linking, which is what GHC uses
00:11:29<sjanssen>wy_: you're not free to modify it without sharing the modifications
00:12:00<defun>sjanssen: Wait, is BSD compatible with GPL? If I wanted to link against GHC some-day?
00:12:00<wy_>sjanssen: oh ... that's bad
00:12:11<dcoutts>defun: if your goal is to have your software used as widely as possible then BSD is probably the right answer, if you're trying to encourage contributions and believe that people who make changes to your code should contribute them back, then choose GPL or LGPL
00:12:25<TomMD>dcoutts: Alright then. I'll hack some features into it building on the patches I sent you.
00:12:35<Ycros>defun: GPL can include BSD code, yes, it's compatible
00:12:42<Ycros>defun: the reverse is not true however
00:12:56<dcoutts>TomMD: one of the things I'm interested in, apart from feature parity, is good modular design.
00:13:09<sjanssen>defun: there are various meanings of "compatibility" there
00:13:10<wy_>The laws are bad softwares in our minds
00:13:12<dcoutts>TomMD: which is important to get right at the beginning before we add too many features! :-)
00:13:36<defun>sjanssen: say, dynamic linking?
00:13:50<hackagebot>iteratee 0.2.3 - Iteratee-based I/O (JohnLato)
00:13:55<timmaxw>why can Haskell exceptions only be caught in IO?
00:14:03<sjanssen>defun: the concern with GPL and static linking is that non-free software can't link to GPL software
00:14:24<sjanssen>timmaxw: because they aren't deterministic
00:14:30<dcoutts>TomMD: ideally each feature (I don't mean cross-cutting ones like security) could be enabled or disabled just by not including that module. Eg adding a new bit of saved state and a few new pages should be possible by adding a module and linking it in to the url namespace, so only one change in shared code.
00:14:46<defun>sjanssen: oh, that sucks. But I would be pretty much safe if I licensed under GPL, right?
00:14:53<timmaxw>sjanssen: ignoring exceptions from other threads, why not?
00:14:57<defun>I meant BSD.
00:15:00<defun>Not GPL.
00:15:08<wy_>The laws are strictly static type systems. They don't adapt well to biological systems
00:15:26<dcoutts>defun: BSD means you're saying anyone can do whatever they like with the software you write (more or less)
00:15:27<Ycros>defun: do you ever want to link to non-free software with your GPL code though?
00:15:29<wy_>and written in crappy languages like English ;-)
00:15:43<TomMD>dcoutts: What about modifications to existing pages (such as the download counter)? Would those be forced into separate pages?
00:15:54<sjanssen>defun: the only concern with BSD is that somebody might modify your software and not share the modifications, does that bother you?
00:15:56<eck>i have some multi-threaded code and one thread is going crazy and spinning the cpu and allocating memory until it runs out. does anyone have any tips for how to figure out which thread it is?
00:16:14<dcoutts>TomMD: that's a bit tricky, but I've got some ideas
00:16:14<defun>Ycros: I meant to say BSD, and yes I would like to give ppl as much freedom as possible.
00:16:14<defun>sjanssen: no it does not.
00:16:45<sjanssen>timmaxw: I suggest you read the GHC exceptions paper, with laziness and compiler optimizations exceptions become somewhat tricky
00:16:51<sjanssen>defun: sounds like BSD is for you
00:16:54<timmaxw>sjanssen: thanks
00:17:14<defun>sjanssen: thanks.
00:17:21<Ycros>defun: the way I see it, it comes down to freedom propagation. BSD lets anyone do anything with your code, even to the point of releasing their own closed sourced software based on your code. The GPL merely enforces that anyone further down the line has to also share their code
00:17:37<dcoutts>TomMD: so as Lemmih and I were initially building it, I was learning about the REST style, which seems pretty sane to me
00:18:29<defun>Ycros: what is the point or propagation? It sounds more like a restriction, but that's just me. I'll do more research. I've to go and polish up some code. Bye.
00:18:58<dcoutts>TomMD: in principle one can adding new state, resources etc in a pretty modular way. Things like human readable summary pages that aggregate lots of info are less modular, but hopefully they can also be relatively thin presentation veneers
00:19:11<Ycros>defun: it is a restriction, but which one is the greater freedom? *shrug*
00:20:11<dcoutts>TomMD: so eg if we add some new statistic about a package, that should be available individually eg $root/$pkgid/$stat and also with an internal api to get the data. Then yes the package summary page does depend and aggregate several other bits.
00:20:33<sjanssen>defun: the argument is that the restriction increases everyone else's freedom
00:21:02<dibblego>is there a function to get ';' on Windows and ':' everywhere else for path separator?
00:21:43<dcoutts>TomMD: do you see what I'm getting at? each of the resources are individual identifiable resources with a URL and you can "GET" them in an appropriate machine readable format. Then separately we have nice human readable html pages.
00:21:57<Alpounet>:-)
00:22:37<QtPlaty[HireMe]>dibblego: The path seperator is \ on windows
00:22:55<dcoutts>dibblego: there's splitSearchPath :: String -> [FilePath]
00:22:56<dibblego>QtPlaty[HireMe], no, it is ;
00:23:14<dibblego>dcoutts, I want [FilePath] -> Separator -> String
00:23:22<dcoutts>dibblego: and there's searchPathSeparator :: Char
00:23:37<TomMD>dcoutts: I think I see.
00:23:47<dibblego>ah System.FilePath
00:24:50<TomMD>But what happens to these human readable HTML pages when the module isn't avaliable? Presumably the composing page uses some default?
00:25:21<dcoutts>TomMD: it doesn't need to be that dynamic. Just structured well and sufficiently easily modified.
00:25:38<TomMD>ok
00:25:58<TomMD>ACTION goes for a walk with his wife.
00:26:42<BMeph>ACTION thinks about going for a walk with TomMD's wife, then decides his own wife would be more appropriate.
00:27:19<TomMD>ACTION would be happy to see a Hackathon in his living room when he returns
00:27:52<ski>sjanssen,(defun) : afaiu : you are free to modify GPLed software, as long as you don't make the modification public. if you do, you also need to make the source public under GPL
00:28:20<dcoutts>:-)
00:29:14<sjanssen>ski: I believe the term is "distribute"
00:29:26<ski>that is probably so
00:31:38<Nereid_>ok, it's not pretty, but I extended lists with concatenation to a group
00:31:45<Nereid_>except infinite lists don't behave nicely
00:34:40<centrinia>Maybe they are a subset of the elements of a free group.
00:34:59<centrinia>Free monoid.
00:35:48<Nereid_>well it basically is a free group
00:36:24<centrinia>You don't really have inverse lists. ;)
00:37:02<centrinia>Although that would be very cool. :)
00:37:07<Nereid_>I do have inverse lists. :-)
00:37:13<Nereid_>like I said, I extended them
00:37:20<centrinia>Yay!
00:37:46<Nereid_>that is, I embedded the monoid of (finite) lists with concatenation in a group
00:38:11<Nereid_>I don't know if it's useful at all
00:39:14<monochrom>free groups are useful. the word problem is famous and important.
00:40:01<Taejo>monochrom: isn't the word problem trivial for free groups?
00:40:32<monochrom>I don't know. I have forgotten too many details.
00:40:41<Nereid_>I think it is
00:40:58<centrinia>type FreeGroup a = [(Bool,a)] -- Is this isomorphic to a free group?
00:41:02<monochrom>free software and the license wording problem. :)
00:41:34<centrinia>Oh.
00:41:45<Taejo>centrinia: depends on your operations
00:42:11<Nereid_>centrinia: restricted to finite lists, yes
00:42:23<Nereid_>that's basically what I have.
00:42:32<Nereid_>except what I have is more like [Either a a]
00:42:40<Nereid_>same thing
00:43:17<Taejo>really, you need to take an equivalence relation on [Either a a] or [(Bool, a)] (if you mean them as I think)
00:43:43<Taejo>since [Left x, Right x] == [] as a free-group element
00:44:01<Nereid_>that's what I did
00:44:11<Taejo>ok
00:44:14<centrinia>Oh, the equivalence relation is that any sublist [(True,a),(False,a)] or [(False,a),(True,a)] is equivalent to [] ?
00:44:20<Nereid_>yes
00:44:51<Nereid_>no standard typeclass for groups I take it
00:45:00<Taejo>Nereid_: no
00:45:19<Taejo>they're not nearly as useful as monoids
00:45:32<centrinia>class (Monoid a) => Group a where { ginv :: a -> a; }
00:46:02<monochrom>Haskell 2046 will have the Group typeclass.
00:46:32<centrinia>The number 2046 rings a bell somehow.
00:47:21<Taejo>it's the exponent bias in double precision IEEE 754
00:47:24<FunctorSal>Taejo: are there fundamental reasons why groups shouldn't be as useful in computing, or has it just not been really tried?
00:47:37<centrinia>Ah.
00:48:03<centrinia>Groups are useful in cryptography.
00:48:13<Taejo>centrinia: if it that's what rings a bell, then you've been studying IEEE 754 too much
00:48:18<EvilTerran>FunctorSal, i think it's just that there's fewer of them, because the requirements are stricter
00:48:23<flippo>FunctorSal, you have a good inverse for every operation?
00:48:28<FunctorSal>centrinia: sure, but I mean on the level monoids are
00:48:55<Taejo>FunctorSal: I think it's more that "accumulating" algorithms are common, but "unaccumulating" ones are not
00:49:03<EvilTerran>monoids havethe right balance between generality and specificity
00:49:23<EvilTerran>(being able to do more vs being able to work with more types)
00:49:26<centrinia>I think that groups will gain tremendous importance once reversible computing finally takes off!
00:49:31<Nereid_>lol
00:49:33<Nereid_>:-)
00:49:55<Taejo>and when you do unaccumulate, you're not unaccumulating something specific (e.g., you don't do "pop foo" on a stack -- because what if foo is not on the stack? -- you just do "pop")
00:50:49<Nereid_>in conclusion, I pretty much wasted the last hour :)
00:50:51<monochrom>You can have something very useful in computing but no one mentions it explicitly.
00:50:57<centrinia>Instead of having one stack, you might have two stacks that already contain everything that you will ever want to push or pop.
00:51:06<FunctorSal>EvilTerran: of course "right balance" depends on what you're doing with it... there are hardly any theorems about monoids
00:51:21<FunctorSal>(too general)
00:52:30<monochrom>monoid was popularized by the writer monad.
00:53:23<monochrom>someone decided to use existing math vocab "monoid" rather than coin new vocab "logging-like"
00:54:00<FunctorSal>I do see how free monoids/lists terms naturally have just one representation on a storage medium, while in free groups you have a less trivial equivalence relation... (not sure how to formulate this better)
00:54:59<EvilTerran>i think the fact that a list is a monoid, but not so trivially a group, makes a big difference to each's popularity
00:55:00<flippo>Where does the inverse come from?
00:56:42<centrinia>flippo, we defined something like [Either a a] or [(Bool,a)]
00:57:29<Ycros>guys, how do I resolve this compilation error: "Could not find module `Control.Monad.Trans': it was found in multiple packages: transformers-0.1.4.0 mtl-1.1.0.2"
00:57:36<Ycros>is there a way to specify which one I want?
00:57:43<Ycros>(I'm using ghc --make here)
00:57:46<FunctorSal>ghc-pkg hide transformers -- Ycros
00:57:53<Taejo>Some voting-type thing might be an application of groups: if you can vote yes, no, or neutral to x, y and z, then your vote might be [Yes x, No z], and mine [Yes x, No y, Yes z]. Then [Yes x, No z] ++ [Yes x, No y, Yes z] = [Yes x, Yes x, No y] forms the aggregate vote (I'm adding commutativity here)
00:57:54<FunctorSal>(or mtl :))
00:58:09<Ycros>FunctorSal: isn't that a system/user-wide setting though?
00:58:19<Ycros>FunctorSal: would that adversly affect other things?
00:58:20<FunctorSal>Ycros: yes
00:58:32<Ycros>FunctorSal: I've noticed that it doesn't come up when I build things via cabal
00:58:35<flippo>Taejo, sounds as if you only need an abelian monoid, not a group.
00:58:48<EvilTerran>Ycros, i believe you could give an explicit list of package deps on the command line instead of --make, but that's probably tedious
00:58:51<centrinia>Taejo, why not use Integer instead? :p
00:58:59<FunctorSal>Ycros: right, if you use cabal, the visible packages are set to whatever is in the build-depends: field of the .cabal file
00:59:00<Taejo>flippo: no, I want an abelian group
00:59:04<Ycros>EvilTerran: that does sound tedious.
00:59:08<monochrom>integers are a group
00:59:11<Ycros>FunctorSal: aha! on a per-compilation basis?
00:59:13<centrinia>Uh, [Integer]
00:59:14<flippo>Taejo, why do you need an inverse for every operation?
00:59:21<FunctorSal>Ycros: there are probably some ghc flags to do the same, but it would be easier to just make a cabal file I think :)
00:59:29<FunctorSal>Ycros: (there's even a "mkcabal" utility)
00:59:35<FunctorSal>Ycros: yes
00:59:36<Ycros>FunctorSal: can't, I'm compiling/loading plugins at runtime ;)
00:59:49<Taejo>flippo: the whole point is that Yes x and No x are inverses
00:59:50<Ycros>FunctorSal: I'm using makeAll from the plugins package
00:59:56<dcoutts>FunctorSal, Ycros: the ghc flats to expose/hide packages are: -hide-all-packages -package foo -hide-package bar
01:00:09<Ycros>dcoutts: okay, cheers
01:00:20<centrinia>I know! You can keep track of antimatter with a free group!
01:00:36<Taejo>type Vote a = Map a Integer probably would be a sensible representation
01:00:44<centrinia>Your space would be discrete of course. :p
01:00:44<dcoutts>FunctorSal, Ycros: cabal uses "-hide-all-packages -package foo -package bar" etc for all listed build-depends. It actually specifies exact versions like -package foo-1.0
01:01:42<flippo>Taejo, Yes x and No x are two values. What is the operation that needs the inverse?
01:01:59<Nereid_>flippo: he's treating Yes x and No x as inverses
01:02:06<Nereid_>and
01:02:13<Taejo>flippo: in a group *elements* have inverses, not operations
01:02:20<Nereid_>so a Yes vote and a No vote cancel out
01:02:50<FunctorSal>Taejo: I was going to say that about Map a Integer... is there some sense in which lists and free abelian groups have "free" or "syntactic" encodings in data structures, but free groups don't? sorry if I'm not making any sense
01:02:52<Nereid_>but the order of votes doesn't matter so you're just treating two lists as equivalent if they're permutations of each other
01:02:52<flippo>Taejo, really?
01:03:11<Taejo>flippo: yes, really
01:03:50<Taejo>flippo: though you could consider "multiplication-by-inverse" to be the inverse operation of multiplication, that is not the definition
01:04:16<Taejo>FunctorSal: interesting idea
01:04:19<flippo>Taejo, so you are conflating a reciprocal with an inverse
01:04:59<Taejo>you can call it reciprocal if you want, but it's usually called the inverse in group theory
01:05:12<Taejo>see http://en.wikipedia.org/wiki/Inverse_element
01:05:17<mgsloan>reciprocal and inverse are terms I've seen interchanged a lot
01:05:31<Nereid_>reciprocal _is_ inverse if you're dealing with numbers
01:05:37<Nereid_>and multiplication
01:05:40<mgsloan>I'm not that good at math, but it seems like reciprocol is the multiplicative inverse
01:05:41<mgsloan>yeah
01:05:41<Nereid_>anyway, time to eat :-)
01:05:50<mgsloan>you end up with id when you multiply by the inverse
01:06:18<FunctorSal>x is invertible for some operation (*) iff the function (x *) is invertible, so they really are very similar concepts
01:08:10<Taejo>FunctorSal: I think it depends what we consider to be data structures. if we don't allow quotients (i.e., we require (==) to be structural equality), then Map is "unnatural" too
01:08:28<centrinia>mgsloan: Only for a multiplicative group.
01:08:47<centrinia>The real numbers with multiplication isn't a group. ;)
01:08:56<mgsloan>due to 0?
01:08:58<centrinia>You need to remove zero to make it a group. :)
01:08:59<centrinia>Yeah.
01:09:00<FunctorSal>Taejo: yeah but you can encode the free abelian group as an integer array with one position for each generator
01:09:25<FunctorSal>Taejo: good point about structural equality...
01:10:24<centrinia>You could modulo out the structure though. :)
01:10:31<FunctorSal>you could only allow terms in normal form for the free group, but then you waste memory
01:10:39<FunctorSal>at least for naive encodings...
01:10:43<Taejo>FunctorSal: I will put "think about data structures for free algebras" on my todo list, but right now it's 3 AM, and I must sleep
01:10:54<FunctorSal>yes, 3 AM here too :)
01:11:02<Taejo>hehe
01:12:08<Taejo>TODO: apply for continued funding, deal with car insurance, think about data structures for free algebras ... I wonder which I'm going to spend the whole of tomorrow doing
01:12:13<Taejo>or rather today
01:28:53<SamB>did anyone tell Taejo about http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uu-parsinglib-2.1.0 ?
01:41:27<jasondew>anyone know if there's an easy way to parse double or float values of the form ".25" ?
01:42:07<kpreid>> read ".25" :: Float -- since you're asking I suppose this doesn't work
01:42:09<lambdabot> * Exception: Prelude.read: no parse
01:42:43<jasondew>right :)
01:43:46<aavogt>> let pad ('.':x) = "0."++x; pad x = x in read (pad ".25") :: Float
01:43:47<lambdabot> 0.25
01:44:21<jasondew>> let pad ('.':x) = "0."++x; pad x = x in read (pad "0.25") :: Float
01:44:23<lambdabot> 0.25
01:44:23<kpreid>nothing in the Numeric module...
01:44:28<Hunner>Is there a trick to getting haskell to re-evaluate IO functions?
01:44:40<Hunner>mine seems to do it once and ignore any changes after that
01:44:40<jasondew>that works, thanks :)
01:44:45<kpreid>Hunner: you probably don't want what you're asking for
01:45:08<kpreid>are you using unsafePerformIO or something?
01:45:27<Hunner>it's something like this http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5744
01:45:36<Hunner>that's from a while ago, but most of the code is the same
01:46:16<Hunner>Anyway, the first time I call that function it compiles the module and loads it, and won't do it again after that without restarting the program
01:46:53<kpreid>Are you sure the problem isn't that you can only load a module with a given name once?
01:47:35<Hunner>I don't know the problem. I'm somewhat new to haskell and this is one of my first tries at IO beyond putStrLn
01:48:59<Hunner>pasted the current version under that, but it's pretty much unchanged except for adding some abstraction for the types system
01:50:03<Hunner>It knows what to do if the IO throws an exception, so I'm not worried about it being safe pretty much
01:50:30<Hunner>But the whole point is that I don't have to restart the program every time I want to change the external modules
01:50:38<kpreid>you need a ghc expert; this is not a general working-with-IO problem
01:50:52<Cale>Hunner: So this isn't just IO, it's runtime evaluation of Haskell code using the GHC api...
01:51:00<Hunner>Yeah, that :)
01:51:00<kpreid>though it would be useful to say exactly what happens in the failing case
01:51:31<Hunner>If you refresh the hpaste you see it returns (Left String) on a failing case
01:51:32<kpreid>it has got to return something: is it Left "Compilation failed"? Or Right _|_? What?
01:52:19<Hunner>as far as what type Right is, that is determined by the calling function
01:52:24<Cale>What is the purpose of that unsafeCoerce?
01:52:49<Cale>That seems scary to have to do...
01:53:05<Hunner>Because it returns an HValue, and since I should know what type I'm getting I have to coerce it
01:53:16<Hunner>this post explains a lot of it http://www.bluishcoder.co.nz/2008/11/dynamic-compilation-and-loading-of.html
01:53:38<Cale>You might have an easier time with using hint than directly using the GHC API.
01:53:45<Hunner>and it works pretty swimmingly, not having to recompile the main program
01:54:01<roconnor>what is a Net String?
01:54:18<Hunner>the Net monad is from http://www.haskell.org/haskellwiki/Roll_your_own_IRC_bot
01:54:31<Hunner>I'm trying to not have to restart the bot every time :)
01:55:08<kpreid>btw your "force" is flip asTypeOf
01:55:14<Hunner>oh, thanks
01:55:22<kpreid>:t asTypeOf
01:55:23<lambdabot>forall a. a -> a -> a
01:55:25<kpreid>@src asTypeOf
01:55:26<lambdabot>asTypeOf = const
01:55:37<roconnor>that unsafeCoerce seems unsafe to me
01:55:40<kpreid>> [] `asTypeOf` "aardvarks"
01:55:42<lambdabot> ""
01:55:42<roconnor>why not just use return?
01:55:54<Hunner>roconnor: probably, but step gingerly and you won't die :)
01:56:12<roconnor>that unsafeCoerce seems extremely unsafe and will never work to me
01:56:22<roconnor>why not just use return?
01:56:39<Hunner>roconnor: how does returning an HValue keep me from having to coerce it?
01:56:44<roconnor>oops
01:56:46<roconnor>sorry
01:56:51<roconnor>I misread the type annotation
01:57:26<roconnor>ACTION thought it was (unsafeCoerce :: String -> Net String)
01:57:32<Hunner>Yeah, the type coersion is just matching the requested function in the compiled module, so it should be fine
01:57:56<Hunner>no, I changed that. See http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5744#a5753
01:58:32<Cale>hint provides: interpret :: (MonadInterpreter m, Typeable a) => String -> a -> m a which produces a meaningful error if the value you're trying to get is the wrong type.
01:58:58<Cale>er, no, actually that one lets you have a default
01:59:09<Hunner>ACTION pastes an example of use
01:59:40<Cale>Oh, actually, I was right the first time :)
01:59:52<Cale>the parameter of type a is just a witness for the type you want
02:00:04<Hunner>Yeah... I think...
02:00:58<Hunner>is there a way to get the @src thing in ghci?
02:01:58<Cale>No, the @src thing is just a database of strings anyway.
02:02:19<Cale>(it's not necessarily the actual source)
02:02:36<Hunner>kk
02:02:40<Cale>You can however click the source links in the Haddock documentation
02:03:55<Hunner>So, any ideas on getting this function to evaluate the source file more than once? If the compile fails, then it will re-evaluate the file each time until it succeeds, then doesn't look at it again
02:04:17<Hunner>each time it is called*
02:06:53<Hunner>ACTION rides home before the sunlight dies. Will read scrollback after getting home
02:07:31<Nereid_>Hunner: no way to make it forget the compiled code?
02:09:05<Nereid_>also, it seems like writing an irc bot is the popular thing to do in Haskell. I'm doing it :(
02:10:35<dibblego>is there no way to "friend" modules -- export a function visible only to certain modules
02:11:42<Nereid_>what if you write the function in its own module, and import it in each module that you want to share it?
02:11:59<Nereid_>share it in, I mean
02:12:02<Nereid_>or with
02:12:20<Nereid_>ACTION is new, there are probably better ways
02:14:43<SamB>dibblego: lay of the C++, *please*!
02:15:41<Cale>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5744#a5755
02:15:45<dino->dibblego: I was thinking about this earlier too but from the angle of putting testing property function in the module they test so that they have scope to internals without having to export..
02:16:05<dino->But the downside of that seems to be all the cranky unused function compiler warnings that will fly out of that.
02:16:26<pumpkin_>seems like the best option is to put the tests in the same module, but CPP them out for .cabal distribution
02:16:34<pumpkin_>not sure, is there anything better?
02:16:55<monochrom>No.
02:17:02<Cale>oops, missed the module decl line in Command.hs
02:17:40<Cale>(http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5744#a5756)
02:18:02<dibblego>can you export record selectors and type-class instances but no constructors of a type?
02:18:14<SamB>does the _ import rule apply to Haskell, or am I thinking of Python?
02:18:24<Cale>dibblego: yes
02:18:58<Cale>dibblego: In the export list, list the type name, but don't put (..) after it, and list the record selectors manually, I think.
02:19:12<Cale>SamB: _ import rule?
02:19:31<SamB>Cale: where _-prefixed names aren't imported without being explicitly asked for
02:19:42<dibblego>Cale, I tried that to no avail ( the type-class instance was unavailable)
02:20:00<Cale>dibblego: That's odd. It's impossible to prevent typeclass instances from being exported actually.
02:20:01<dino->hm, -fwarn-unused-binds
02:20:09<dibblego>Cale, that's what I thunk
02:20:13<Cale>SamB: I'm pretty sure that's only python.
02:20:26<SamB>it might be neat though
02:20:44<heatsink>Argh. I somehow failed to anticipate the need to write TH Lift instances for my data structures.
02:21:03<dibblego>Cale, my mistake, sorry
02:21:12<dino->there is something about reporting unused pattern matches but suppressed if it begins with _
02:21:15<SamB>heatsink: you could probably write those with TH!
02:21:18<dino->http://www.haskell.org/ghc/docs/latest/html/users_guide/options-sanity.html
02:21:23<SamB>heatsink: tried derive?
02:21:34<dino->At the very end of that page
02:21:34<heatsink>SamB: I can derive lift? Cool!
02:21:59<SamB>heatsink: I expect so
02:22:14<SamB>you might or might not have to write the code yourself, but it shouldn't be that hard ...
02:22:18<heatsink>Hmm, GHC says no.
02:22:29<SamB>heatsink: oh, sorry, I meant the library!
02:22:40<SamB>@hackage derive
02:22:40<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/derive
02:23:53<SamB>hmm, I don't see any modules that look quite right ...
02:24:05<heatsink>SamB: Should I be looking for Data.Derive.Lift?
02:24:21<SamB>... looks like you'll have to make it yourself
02:24:34<SamB>but there's that http://hackage.haskell.org/packages/archive/derive/0.1.4/doc/html/Data-DeriveGuess.html
02:24:38<heatsink>Writing lift instances actually seems to be pretty straightforward as long as your data is finite
02:24:47<heatsink>lift (Foo bar baz) = [| Foo bar baz |]
02:24:51<heatsink>etc.
02:24:58<SamB>heatsink: indeed
02:25:35<SamB>I expect it won't give guess too much trouble, assuming you can nest [| |]
02:26:11<SamB>> [| [| () |] |]
02:26:11<lambdabot> <no location info>: parse error on input `|'
02:26:11<SamB>aww
02:26:12<SamB>, [| [| () |] |]
02:26:13<lunabot> luna: Illegal bracket at level Brack 2
02:26:21<SamB>, [| |]
02:26:22<lunabot> luna: parse error on input `|]'
02:26:27<SamB>, [| () |]
02:26:29<lunabot> ConE ()
02:26:32<SamB>typical
02:26:34<SamB>you CAN'T
02:27:02<Cale>heh, some of the code layout in this derive package is... suboptimal
02:27:03<SamB>... hmm, thinking about it, that makes sense
02:27:07<Cale>makeIs = derivation is' "Is"
02:27:08<Cale>is' dat = ((map (\(ctorInd,ctor) -> (FunD (mkName ("is" ++ ctorName ctor)) [(
02:27:08<Cale> Clause [((flip RecP []) (mkName ("" ++ ctorName ctor)))] (NormalB (ConE (
02:27:08<Cale> mkName "True"))) []),(Clause [WildP] (NormalB (ConE (mkName "False"))) [])]
02:27:08<Cale> )) (id (zip [0..] (dataCtors dat))))++[])
02:27:15<heatsink>TH isn't impredicative I guess
02:27:20<SamB>Cale: that's from Guess
02:27:25<Cale>ah
02:27:33<SamB>Cale: it just spits it out line-wrapped
02:27:59<SamB>if a human had to edit it, it would be much nicer looking
02:28:49<SamB>Cale: the real human-written part is in #ifdef GUESS
02:29:42<heatsink>I'm uncomfortable synthesizing a lift instance when I don't know how the guess module works, so I'll just hack one out.
02:30:13<SamB>ACTION wonders how many MetaML programmers we'd need to kidnap to get that single-stage restriction lifted
02:30:57<mmorrow>heatsink: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5757#a5757
02:30:58<monochrom>I prefer Gauss to Guess.
02:32:00<SamB>mmorrow: what library was that second module from?
02:32:18<SamB>@doc Language.Haskell.Meta.Utils
02:32:18<lambdabot>Language.Haskell.Meta.Utils not available
02:32:27<SamB>lambdabot: look on hackage, you moron!
02:32:37<SamB>@go Language.Haskell.Meta.Utils
02:32:38<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskell-src-meta
02:32:39<lambdabot>Title: HackageDB: haskell-src-meta-0.0.3.1
02:32:40<mmorrow>haskell-src-meta (which is needed for deriveLiftPretty *and* for the ability to lift the resulting `Dec's themselves in order to do that in ghci)
02:32:54<mmorrow>because it include instances of Lift for all of the TH AST
02:33:13<SamB>mmorrow: huh ... you'd think those ought to be in the box!
02:33:35<mmorrow>SamB: hopefully one day
02:34:06<mmorrow>hmm, i wonder what it'd take to add "deriving (Lift)" to ghc..
02:34:22<SamB>mmorrow: I dunno if there's much point
02:34:30<SamB>when you can use a library for that bit
02:34:39<mmorrow>heh, so what are you saying then?
02:34:43<mmorrow>oh, in the TH lib?
02:35:02<SamB>putting it in the TH lib would be sensible, yeah
02:35:10<SamB>but there's no need to add it to GHC proper
02:35:18<mmorrow>ah, yeah that would work too
02:35:47<dino->Closest I could get to don't warn me about unused unit testing props is {-# OPTIONS_GHC -fno-warn-unused-binds #-}
02:35:54<SamB>especially considering that the library approach is more friendly toward a potential second implementation
02:36:02<dino->Which works but will of course prevent warnings about unused other things you may want to have seen.
02:36:14<mmorrow>SamB: yeah, i like the in-the-lib way more than in ghc
02:36:36<mmorrow>SamB: for some reason i just didn't' think of in-the-lib first
02:37:02<SamB>I mean, if you want a Lift instance, you're already using TH, so you might as well use TH to get it, too ;-)
02:37:28<mmorrow>totally. TH is great in this way, it's self-replicating!
02:37:29<SamB>hmm, I need to upgrade GHC :-(
02:38:39<mmorrow>argh, that reminds me i have to update all my TH stuff for the changes to the TH lib coming in 6.12
02:38:56<mmorrow>ACTION doesn't look forward to this
02:39:22<mmorrow>(to the updating-my-code part ;)
02:39:37<SamB>I wonder why they only update that at releases anyway
02:39:57<mmorrow>because it would break a ton of code? :)
02:40:23<SamB>I mean, they could have multiple versions on cabal, as long as the AST types themselves didn't get changed
02:40:46<SamB>though I guess that would be a real pain ...
02:40:48<mmorrow>the AST types themselves are what got changed slightly though
02:40:55<SamB>mmorrow: ah
02:40:59<mmorrow>to accomodate type families
02:41:19<SamB>it's a pity they can't add stuff without breaking the binary interface
02:41:47<SamB>and somehow just soft-fail if you actually try to use it
02:42:06<SamB>but also allow apps to interrogate GHC for what it supports ...
02:42:27<SamB>... or maybe not. I dunno.
02:42:28<mmorrow>hmm
02:43:41<heatsink>No instance for (Lift Double) ???
02:43:55<mmorrow>heatsink: oh that's annoying, there're two ways to do it
02:43:57<mmorrow>i'll paste
02:44:11<mmorrow>(the efficient way requires you to import GHC.Exts into the module with the instance)
02:44:47<mmorrow>ACTION just needed Lift for Double yesterday coincidently
02:45:09<heatsink>thanks
02:46:19<SamB>mmorrow: why can't you just derive it using TH again?
02:48:16<mmorrow>heatsink: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5757#a5759
02:48:45<mmorrow>SamB: the TH Lit type has to place to stick a Double... so you need to go about it by one of the two ways in that paste
02:49:37<mmorrow>(and that lift deriving code would do instance Lift Double where lift (D# d) = ..... lift d .....)
02:49:45<mmorrow>and `d' :: Double#..
02:49:59<SamB>ACTION wonders why they bother having totally uninstallable pakcages in Debian testing
02:50:06<Hunner>Cale: Thanks
02:50:10<SamB>mmorrow: hmm, yeah, point ...
02:50:17<Cale>Hunner: no problem :)
02:50:17<SamB>that's not even well-typed ...
02:50:21<heatsink>Cool, it compiles now. I wonder if it works.
02:50:26<mmorrow>woo
02:50:38<SamB>or well-kinded
02:51:01<mmorrow>yeah
02:51:34<SamB>mmorrow: are they adding that in GHC 6.12 as well?
02:52:03<SamB>have you tried sending in a patch?
02:54:15<SamB>kaol: where do you keep the REAL ghc packages?
02:54:43<SamB>these ones in unstable are all out-of-sync wrt eachother
02:54:44<mmorrow>SamB: i should
03:10:56<heatsink>Cool, my pattern match compiler compiles pattern matches! I'll have to write some more code before I can test whether it works.
03:11:10<heatsink>TH FTW.
03:11:31<heatsink>Thanks SamB, mmorrow
03:13:52<mmorrow>heatsink: nice! no problem
03:15:46<mmorrow>heatsink: fwiw here's list-comprehension desugaring for the TH ast http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2490
03:17:27<mmorrow>it spits out stuff like this http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2260 :)
03:19:05<mmorrow>i had to do a (minimal) pattern match compiler a few days ago, goooh it's epic (left a "XXXXX: probably rewrite this module" note at the top, but it works good enough for now ;)
03:19:31<heatsink>Ah, I see. But why would you want to desugar list comprehensions?
03:20:15<mmorrow>heatsink: as one of the many steps to go from haskell-like lang to lower-level reps
03:20:27<heatsink>what
03:20:32<heatsink>are you writing a compiler in TH or something
03:20:56<mmorrow>heatsink: (but that code i wrote to learn the list-comp desugaring process, and just happened to use TH because it's "right there")
03:21:16<mmorrow>heh, no, but the technique is the same in whatever AST
03:21:28<mmorrow>(i rewrote that code for my ast)
03:21:41<heatsink>Oh I see.
03:21:52<dibblego>dcoutts, if I wish to create a package for hackage, is there a starting point for what is required?
03:21:56<heatsink>Heh, rapid prototyping in GHC
03:22:05<mmorrow>totally! ;)
03:22:55<heatsink>So, it sounds like you're writing a compiler
03:23:38<mmorrow>heatsink: yes, i'm writing an interpreter
03:24:16<heatsink>Is it for a new programming language?
03:25:31<mmorrow>heatsink: it's about 90% done, i'm in the final pass to backpatch all the things i broke (in the translation process) when i finally got the C part all sorted out, so.. one more AST-to-AST translation module to repair, then it'll actually work from top-to-bottom
03:26:05<mmorrow>heatsink: i'm shooting for an interp that any lazy functional language could in principle target
03:26:37<mmorrow>and am just doing the haskell-like input lang for convenience/so i can type stuff into a repl and have it run
03:27:14<mmorrow>but the focus is on the C interp/runtime and ByteCode-ish haskell bits
03:28:27<Berengal>type-level is a completely different language, and requires completely different thinking :/
03:29:20<heatsink>Isn't that more or less what the STG work was about though?

Back to channel and daily index: content-negotiated html turtle