Re: [Haskell-cafe] Package documentation complaints -- and a suggestion
On Tue, Oct 25, 2011 at 4:34 AM, wren ng thornton w...@freegeek.org wrote: I'm not so sure about that exemption. The experimental stability level seems to be the norm on Hackage and often means I use this for real projects, but because I use it for real projects I'm not quite willing to hammer the API in stone just yet. ... Before dealing with automatic documentation requirements, perhaps it'd be better to develop a standard consensus on the terms used in the stability field and actively advocating for people to adopt it, as was done with the PVP. I think there's no need to cajole people into it -- if Hackage 2 puts stable packages on a different / better list, there's your social pressure. Right now the stability flag in the .cabal file, as you pointed out, is almost completely content-free. G -- Gregory Collins g...@gregorycollins.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Package documentation complaints -- and a suggestion
On 25 October 2011 18:54, Gregory Collins g...@gregorycollins.net wrote: On Tue, Oct 25, 2011 at 4:34 AM, wren ng thornton w...@freegeek.org wrote: I'm not so sure about that exemption. The experimental stability level seems to be the norm on Hackage and often means I use this for real projects, but because I use it for real projects I'm not quite willing to hammer the API in stone just yet. ... Before dealing with automatic documentation requirements, perhaps it'd be better to develop a standard consensus on the terms used in the stability field and actively advocating for people to adopt it, as was done with the PVP. I think there's no need to cajole people into it -- if Hackage 2 puts stable packages on a different / better list, there's your social pressure. Right now the stability flag in the .cabal file, as you pointed out, is almost completely content-free. Right, but first we need to define what all those terms _mean_... and it's no good saying your package is stable if you change the API in a large-scale fashion every release. Also, by promoting packages that are self-picked as stable, this could stop people from picking a better package just because the maintainer is honest enough to state that they're still working on it... I mean, if base and containers keep changing, what can we _really_ say is a stable package? -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Package documentation complaints -- and a suggestion
Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Right, but first we need to define what all those terms _mean_... and it's no good saying your package is stable if you change the API in a large-scale fashion every release. I think there are better criteria to use, like: - do exported definition have Haddock comments? - does the package have an automated test suite? - is the package used by other packages? - ...by different authors? - has the package been recently updated? I'm sure there are other things as well that could be added. If this could be automatically checked, and displayed alongside the package name on Hackage (perhaps as adding one star per checklist item), it would encourage authors to actually improve their packages, rather than just label them stable. -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Package documentation complaints -- and a suggestion
On Tue, Oct 25, 2011 at 11:17, Ketil Malde ke...@malde.org wrote: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Right, but first we need to define what all those terms _mean_... and it's no good saying your package is stable if you change the API in a large-scale fashion every release. I think there are better criteria to use, like: - do exported definition have Haddock comments? - does the package have an automated test suite? - is the package used by other packages? - ...by different authors? - has the package been recently updated? This is useful information, but to call it stability is not only misleading, but it also prevents the package from using that field to indicate whether or not it is stable! --Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Package documentation complaints -- and a suggestion
On 25 October 2011 20:17, Ketil Malde ke...@malde.org wrote: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Right, but first we need to define what all those terms _mean_... and it's no good saying your package is stable if you change the API in a large-scale fashion every release. I think there are better criteria to use, like: - do exported definition have Haddock comments? - does the package have an automated test suite? What about a test suite that either isn't packaged with the .cabal file or doesn't use Cabal's new test-suite architecture? Does the fact that it _has_ a test suite tell you it's rigorous? -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] blanket license for Haskell Platform?
So I'm combining Haskell software with some non-free/closed source work. I was wondering what sort of effort it would take to organise a blanket license for everything in the Haskell Platform, and whether it would be worthwhile to anybody. Here's my use case: - I am combining my Haskell [:-)] program with some non-free/closed source [:-(] software - My user is concerned that a large number of having a large number of individual licenses even though textually identical modulo author, date, etc would mean a big hassle getting their lawyers and their user's lawyers to sign off on each and every license I feel a bit embarrassed asking this as it's already great and also very convenient that I can just grab this closed source stuff, but suppose we were to decide that putting together some sort of blanket license for the Haskell Platform would be a good idea. How would we go about organising such an effort? I wonder if this is a sort of thing we could tie to the IHG... Thanks, -- Eric Kow http://erickow.com pgp8VHBXNDPT5.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] blanket license for Haskell Platform?
On 25 October 2011 21:37, Eric Y. Kow eric@gmail.com wrote: So I'm combining Haskell software with some non-free/closed source work. I was wondering what sort of effort it would take to organise a blanket license for everything in the Haskell Platform, and whether it would be worthwhile to anybody. Here's my use case: - I am combining my Haskell [:-)] program with some non-free/closed source [:-(] software - My user is concerned that a large number of having a large number of individual licenses even though textually identical modulo author, date, etc would mean a big hassle getting their lawyers and their user's lawyers to sign off on each and every license Why do their lawyers all need to sign off individually for BSD licenses (which if memory serves all platform libraries have to be licensed under, or some variant thereof)? At most it just means they need to lump them all into one big text file somewhere saying which libraries they used... (then again, IANAL, and don't charge by the hour to consider these complex technical questions :p). I feel a bit embarrassed asking this as it's already great and also very convenient that I can just grab this closed source stuff, but suppose we were to decide that putting together some sort of blanket license for the Haskell Platform would be a good idea. How would we go about organising such an effort? Well, it would need copyright attribution/agreement of everyone that's ever committed code to any library/application to the Platform (which is why so many large projects want it) to re-license them AFAIK, which may be difficult. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] blanket license for Haskell Platform?
On Tue, Oct 25, 2011 at 06:37:49AM -0400, Eric Y. Kow wrote: - My user is concerned that a large number of having a large number of individual licenses even though textually identical modulo author, date, etc would mean a big hassle getting their lawyers and their user's lawyers to sign off on each and every license Sounds like you need a single copyright holder, not a blanket license (whatever that means). That means arranging copyright transfers (in the FSF/GNU style) and getting every contributor whose code survives in the Platform to sign off on it. In other words, it's a major undertaking and by no means assured to succeed. -- Antti-Juhani Kaijanaho, Jyväskylä, Finland http://antti-juhani.kaijanaho.fi/newblog/ http://www.flickr.com/photos/antti-juhani/ signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] blanket license for Haskell Platform?
On Tue, Oct 25, 2011 at 21:46:21 +1100, Ivan Lazar Miljenovic wrote: - My user is concerned that a large number of having a large number of individual licenses even though textually identical modulo author, date, etc would mean a big hassle getting their lawyers and their user's lawyers to sign off on each and every license Why do their lawyers all need to sign off individually for BSD licenses (which if memory serves all platform libraries have to be licensed under, or some variant thereof)? At most it just means they need to lump them all into one big text file somewhere saying which libraries they used... (then again, IANAL, and don't charge by the hour to consider these complex technical questions :p). I find the whole thing baffling myself. I'd thought this would be the sensible thing to do, but I guess when it comes to these licensing things it's not the actual pain that counts, but the perceived potential pain. Know what I mean? It's similar to the won't touch with a 10ft pole attitude to the GPL that some entities may take. It's basically a precautionary la la la; I can't hear you or a conservative stance which consists of I don't understand this stuff, so I'm going to do the thing that seems safest to me, which may or may not be a reasonable reaction... Well, it would need copyright attribution/agreement of everyone that's ever committed code to any library/application to the Platform (which is why so many large projects want it) to re-license them AFAIK, which may be difficult. I could just say it'd be unrealistic. Just trying to be thorough. -- Eric Kow http://erickow.com pgpJtBqlfeVqc.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] blanket license for Haskell Platform?
One possible solution (which would avoid a blanket license) would be to have a tool generate SPDX (http://spdx.org/ and http://www.linuxfoundation.org/collaborate/workgroups/spdx) metadata from cabal metadata. SPDX (software package data exchange) is a format for machine-readable descriptions of software licensing, developed by the Linux Foundation. SPDX is intended to solve exactly the problem you're having: providing a summary of all of the licenses required for using a large heterogeneous collection of software with sprawling dependencies. A. On 10/25/2011 05:37 AM, Eric Y. Kow wrote: So I'm combining Haskell software with some non-free/closed source work. I was wondering what sort of effort it would take to organise a blanket license for everything in the Haskell Platform, and whether it would be worthwhile to anybody. Here's my use case: - I am combining my Haskell [:-)] program with some non-free/closed source [:-(] software - My user is concerned that a large number of having a large number of individual licenses even though textually identical modulo author, date, etc would mean a big hassle getting their lawyers and their user's lawyers to sign off on each and every license I feel a bit embarrassed asking this as it's already great and also very convenient that I can just grab this closed source stuff, but suppose we were to decide that putting together some sort of blanket license for the Haskell Platform would be a good idea. How would we go about organising such an effort? I wonder if this is a sort of thing we could tie to the IHG... Thanks, ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Package documentation complaints -- and a suggestion
On Tue, Oct 25, 2011 at 2:17 AM, Ketil Malde ke...@malde.org wrote: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Right, but first we need to define what all those terms _mean_... and it's no good saying your package is stable if you change the API in a large-scale fashion every release. I think there are better criteria to use, like: - do exported definition have Haddock comments? - does the package have an automated test suite? - is the package used by other packages? - ...by different authors? These signals might not apply if the package is primarily a binary. - has the package been recently updated? This one is also tricky. A stable package is a good thing! On the other hand, a package that is broken by a new version of ghc and then takes months to be updated is not so great. What matters is maintainer responsiveness and that's not so easily measurable. I feel like use-derived signals are safer. E.g. number of downloads, user ratings, user reviews, depending packages. But that stuff obviously goes in a separate section, not a .cabal field. With ratings or reviews it's tricky because you want to make sure they apply to specific versions, so obsolete complaints about a fixed bug don't hang around forever. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Package documentation complaints -- and a suggestion
Max Rabkin max.rab...@gmail.com writes: This is useful information, but to call it stability is not only misleading, but it also prevents the package from using that field to indicate whether or not it is stable! Oh, right - I'm not much interested in the stability of a package. What I want to know, is which package to choose for some purpose. By highlighting stuff that is correlated with usefulness, I'll be able to make a quicker, more informed decision. Separating this from stability is a feature, not a bug, since it frees the author to label the package stable or not - instead of encouraging using stable to mean please use. :-) -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] blanket license for Haskell Platform?
IANAL, but I'll bite, since I have needed to live with this for quite some time now. Obviously readers are directed to take independent legal advice before they do anything for themselves, and all of the other standard disclaimers. On 25 October 2011 11:58, Eric Y. Kow eric@gmail.com wrote: On Tue, Oct 25, 2011 at 21:46:21 +1100, Ivan Lazar Miljenovic wrote: - My user is concerned that a large number of having a large number of individual licenses even though textually identical modulo author, date, etc would mean a big hassle getting their lawyers and their user's lawyers to sign off on each and every license Why do their lawyers all need to sign off individually for BSD licenses (which if memory serves all platform libraries have to be licensed under, or some variant thereof)? At most it just means they need to lump them all into one big text file somewhere saying which libraries they used... (then again, IANAL, and don't charge by the hour to consider these complex technical questions :p). The first thing to say is that this is actually a very responsible attitude on the client's part. When legal review is conducted it is not just the license which needs to be checked: 1. What implications does this license carry for my business model. BSD is considered benign in this respect. GPL and LGPL work for some models but not others. 2. Does the purported copyright holder actually have the right to issue the software under the given license. The second is much more time consuming. It is straightforward to do this if the software in question was written by one person, but when contributions come from multiple people it becomes more difficult. For example if a project receives a contribution which the contributor did on company time, they may not even have the right to make that contribution (because the employer paid for, and hence owns it). There have similarly been cases where a developer has taken code from, say, a GPL project and imported it into their own differently licensed project. This second case is particularly difficult, as there *may* be cases when it is acceptable (e.g. under fair use in some jurisdictions) to extract small portions of a work and re-use them, but in most cases the developer simply does not have the right to make the contribution. There are sub-cases of these, for example where one developer has removed the copyright notices placed by the original author, even though licensing has been kept the same. This is legal (if ethically dubious) in some jurisdictions and illegal in others. A related issue: can a project *prove* that contributors have all formally licensed their code contributions under the same license? As far as the law is concerned, you really need this in writing, or something very close to it (e.g. e-mail with full header information). Personally I think we should give praise and recognition to anyone who thoroughly checks and complies with the license attached to a piece of code as they are taking care to respect the wishes of the author. I get much more fired up about those who simply break licenses and hope they don't get caught. I find the whole thing baffling myself. I'd thought this would be the sensible thing to do, but I guess when it comes to these licensing things it's not the actual pain that counts, but the perceived potential pain. Know what I mean? It's similar to the won't touch with a 10ft pole attitude to the GPL that some entities may take. It's basically a precautionary la la la; I can't hear you or a conservative stance which consists of I don't understand this stuff, so I'm going to do the thing that seems safest to me, which may or may not be a reasonable reaction... I am not sure that anyone 'understands' the GPL with real certainty [1]. Key questions: when does a work fall into the category of 'derived' under the GPL and when does it not do so? If I make money from licensing Intellectual Property, what are the consequences of code which grants an implicit patent license? Neither of these clauses of the GPL has been properly tested in a significant legal jurisdiction (and anyway, a Code Napoleon style jurisdiction might take a different stance than under UK/US style Common Law). Well, it would need copyright attribution/agreement of everyone that's ever committed code to any library/application to the Platform (which is why so many large projects want it) to re-license them AFAIK, which may be difficult. I could just say it'd be unrealistic. Just trying to be thorough. It may be unrealistic, but it would actually be a very good idea - although completely unnecessary if we wish to continue to avoid success at all costs :-) [1] This a strength of the GPL. It was developed to achieve a specific political goal, and has been hugely successful in doing so. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org
Re: [Haskell-cafe] ANN: diagrams 0.4
On Tue, Oct 25, 2011 at 10:40 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 25 October 2011 16:02, Rustom Mody rustompm...@gmail.com wrote: On Mon, Oct 24, 2011 at 10:16 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 24 October 2011 13:51, Rustom Mody rustompm...@gmail.com wrote: How does diagrams compare with graphviz? If this is an inappropriate (type-wrong?) question thats ok :-) Its just that when I last looked at graphviz I found the documentation somewhat impenetrable -- like much else in Hackage -- lots of types, no examples. How is it now, better? If not, what kind of more documentation would you like? Without claiming to have looked very hard, I looked up grahhviz in hayoo, gathered I should be looking at Data.GraphViz and tried clicking everything that looked reasonable here but still cant find an example of a graph :-) ie a graphviz graph in haskell. Well, there are indeed examples in there, but not in Data.GraphViz: that module is aimed more at how can I convert my existing data into a Dot representation, not constructing one by hand. As of the latest version (2999.12.*), there are indeed examples for anyone that wants them: * Sample graph in Dot representation used as a base case: http://hackage.haskell.org/packages/archive/graphviz/2999.12.0.3/doc/html/Data-GraphViz-Types.html * Using the canonical representation: http://hackage.haskell.org/packages/archive/graphviz/2999.12.0.3/doc/html/Data-GraphViz-Types-Canonical.html * Using the graph representation: http://hackage.haskell.org/packages/archive/graphviz/2999.12.0.3/doc/html/Data-GraphViz-Types-Generalised.html * Using the Monadic representation (based upon the dotgen package): http://hackage.haskell.org/packages/archive/graphviz/2999.12.0.3/doc/html/Data-GraphViz-Types-Graph.html Thanks. In the Data.GraphViz.Types.Generalised page you have the starting line: It is sometimes useful to be able to manipulate a Dot graph *as* an actual graph. This representation lets you do so... Evidently some other context is needed to understand this line? [Sorry if I am dense] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Two new lectureships (assistant professorships) in Nottingham
Dear all, We are currently seeking two new Lecturers (Assistant Professors) in Computer Science at the University of Nottingham, UK. These posts are available from 1st January 2012 on a fixed-term basis for three years. Applications from within the area of functional programming would be most welcome. For further details, see: http://www.nottingham.ac.uk/jobs/currentvacancies/ref/CE05936S The deadline for applications is 9th November 2011. Best wishes, Graham Hutton -- Prof Graham Hutton Functional Programming Lab School of Computer Science University of Nottingham, UK http://www.cs.nott.ac.uk/~gmh This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: diagrams 0.4
On Mon, Oct 24, 2011 at 11:55:53AM -0700, David Barbour wrote: Thanks. Diagrams package seems it could be promising for a declarative UI model - i.e. integration with functional reactive programming and similar models - so long as I'm willing to sacrifice `native` look and feel, which doesn't seem like a big problem. Yes, I imagine it could. Not one of the use cases I personally had in mind -- but I've been hoping that people will find it useful for things I had not thought of. A couple more questions: 1) Am I right in assuming that Diagrams does very little `occlusion` of its own - i.e. when rendering a soda-straw view of a complex diagram, or masking large areas with a rectangle or sphere? There won't be any competition or redundancy with an external index and backend (e.g. Cairo-GL layer) occlusion? Right, diagrams currently doesn't do any sort of culling, occlusion, etc., that's all up to the backend. 2) Is there support for Cairo-like linear and radial gradients? Not yet, but it's on the todo list. Also, it seems that for Cairo rendering, we cannot currently supply our own Cairo context. renderDia Cairo (CairoOptions foo.png (PNG (100,100))) myDiagram This section of your manual is incomplete, I admit, but from browsing the code it seems you provide a simplified interface that fully encapsulates the Cairo rendering. Is there any way to render a diagram within the Cairo stack? or leverage Cairo's own experimental backends (like OpenGL)? You're right, currently there's no way do these sorts of things. However, there's no fundamental limitation here and adding this sort of functionality should not be hard, and I'd be quite open to extending the cairo backend in this direction. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: diagrams 0.4
On Mon, Oct 24, 2011 at 01:58:33PM -0700, Jason Dagit wrote: On Sun, Oct 23, 2011 at 11:47 AM, Brent Yorgey byor...@seas.upenn.edu wrote: I am pleased to announce the release of version 0.4 of diagrams, a full-featured framework and embedded domain-specific language for declarative drawing. What do you use for text support? I know at one point you were interested in my freetype2 binding (which is still very raw and immature), but you must be using gtk for font loading and rendering? At the moment, text is completely delegated to backends. diagrams itself doesn't do any font loading or rendering at all. However, the obvious downside to this is that the framework itself has no idea how big a given piece of text is and can't position it relative to other things. On the todo list is to use your freetype2 binding (or something like it) to actually do more work within the framework itself, so it can position text correctly, convert text outlines into paths, and so on. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] blanket license for Haskell Platform?
Eric Y. Kow wrote: So I'm combining Haskell software with some non-free/closed source work. I was wondering what sort of effort it would take to organise a blanket license for everything in the Haskell Platform, and whether it would be worthwhile to anybody... - My user is concerned that a large number of having a large number of individual licenses even though textually identical modulo author, date, etc would mean a big hassle getting their lawyers and their user's lawyers to sign off on each and every license I agree that this is an important issue. I think we should focus on the primary requirement that Haskell software written for a commercial environment should not create usability issues from a legal perspective. If we clarify that question carefully, then as an important FOSS community we might be able to send the question to the EFF and get some guidance about how best to proceed. SPDX sounds interesting; I'd like to hear more about it. Besides that, it may not be as impractical as you think to have mass license assignment and/or copyright assignment as a medium-term goal for the platform. There has been talk about the Haskell community joining the Software Freedom Conservancy (as Darcs did). If that happens, it will give us a solid legal foundation for assigning assets such as these to the community as a non-profit organization. (Although I haven't heard anything recently, and Yale U. is still the registrant of the haskell.org domain.) I wonder if this is a sort of thing we could tie to the IHG... It would be great if the IHG could help push this effort. Thanks, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Efficient mutable arrays in STM
I have an application in mind where concurrent access to large arrays (up to millions of elements) of mostly small elements (Int or Double) is common. Typical access patterns would be chunk-wise, i.e. reads or writes from index n up to index m. Imagine stuff like images, scientific data, etc. All this suggests that Control.Concurrent.STM.TArray, in its current implementation, is not appropriate. Quoting the docs: It is currently implemented as Array ix (TVar e), but it may be replaced by a more efficient implementation in the future (the interface will remain the same, however). An array of TVars is certainly *much* too inefficient for what I have in mind w.r.t. both memory and cpu time. In fact I had already decided to use Data.Vector.Unboxed from the vector package. I see that Data.Vector.Unboxed.Mutable provides slice :: Unbox a = Int - Int - MVector s a - MVector s a Yield a part of the mutable vector without copying it. which is almost what I need... Can I use this together with unsafeIOToSTM internally inside a library to provide shared transactional access to an IOArray? The docs warn that using unsafeIOToSTM is (obviously) highly dangerous, but for what I have in mind the listed problems are not an issue: * running the IO code multiple times is ok * aborting is ok, too * inconsistent views are ok, too The main question is: does the STM transaction actually see that I changed part of the underlying array, so that the transaction gets re-tried? Or do I have to implement this manually, and if yes: how? Has anyone done something like that before? (If you tried this and found it doesn't work, please tell me, it would save me a lot of work repeating the effort). Is someone working on providing a more efficient version of TArray? Would it help if I said I'd be a happy user of a better TArray? ;-) If what I sketched above is infeasible (I would not be surprised if it was, I haven't yet spent much effort trying it out), what other options do I have? Is there an internal API for the STM stuff, i.e. a C header file or something which would make it possible to add efficient TArrays? Or should I use a high-level approach, something like a Data.Sequence.Seq of medium sized chunks (TVar (IOVector e))? Any comments are highly appreciated! Cheers Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Efficient mutable arrays in STM
As far as I lnow the function 'unsafeIOToSTM' is not transactional in nature - IO actions will be performed immediately and are not rolled back, and are then re-performed on retry. On Oct 25, 2011 12:49 PM, Ben Franksen ben.frank...@online.de wrote: I have an application in mind where concurrent access to large arrays (up to millions of elements) of mostly small elements (Int or Double) is common. Typical access patterns would be chunk-wise, i.e. reads or writes from index n up to index m. Imagine stuff like images, scientific data, etc. All this suggests that Control.Concurrent.STM.TArray, in its current implementation, is not appropriate. Quoting the docs: It is currently implemented as Array ix (TVar e), but it may be replaced by a more efficient implementation in the future (the interface will remain the same, however). An array of TVars is certainly *much* too inefficient for what I have in mind w.r.t. both memory and cpu time. In fact I had already decided to use Data.Vector.Unboxed from the vector package. I see that Data.Vector.Unboxed.Mutable provides slice :: Unbox a = Int - Int - MVector s a - MVector s a Yield a part of the mutable vector without copying it. which is almost what I need... Can I use this together with unsafeIOToSTM internally inside a library to provide shared transactional access to an IOArray? The docs warn that using unsafeIOToSTM is (obviously) highly dangerous, but for what I have in mind the listed problems are not an issue: * running the IO code multiple times is ok * aborting is ok, too * inconsistent views are ok, too The main question is: does the STM transaction actually see that I changed part of the underlying array, so that the transaction gets re-tried? Or do I have to implement this manually, and if yes: how? Has anyone done something like that before? (If you tried this and found it doesn't work, please tell me, it would save me a lot of work repeating the effort). Is someone working on providing a more efficient version of TArray? Would it help if I said I'd be a happy user of a better TArray? ;-) If what I sketched above is infeasible (I would not be surprised if it was, I haven't yet spent much effort trying it out), what other options do I have? Is there an internal API for the STM stuff, i.e. a C header file or something which would make it possible to add efficient TArrays? Or should I use a high-level approach, something like a Data.Sequence.Seq of medium sized chunks (TVar (IOVector e))? Any comments are highly appreciated! Cheers Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Operator precedence and associativity with Polyparse
Hi, Can someone provide guidance on how handle operator precedence and associativity with Polyparse? Thanks in advance. -Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Efficient mutable arrays in STM
On Tue, Oct 25, 2011 at 10:47 AM, Ben Franksen ben.frank...@online.dewrote: The main question is: does the STM transaction actually see that I changed part of the underlying array, so that the transaction gets re-tried? Or do I have to implement this manually, and if yes: how? Create an extra TVar Int for every `chunk` in the array (e.g every 256 elements, tuned to your update patterns). Read-write it (increment it, be sure to force evaluation) just before every time you write an element or slice it or slice the array element. The IO mutable array is then adjusted unsafely, but there is enough transactional context to restart transactions that see an inconsistent state. You will have extra read/write and write/write conflicts relative to a pure STM solution, but only within each chunk. A cleaner alternative is to create a `chunked` TArray, i.e. that works with fixed-width immutable chunks in a spine. This should have good performance characteristics, and would be a lot safer for general purpose use. Regards, Dave ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: diagrams 0.4
On 26 October 2011 02:17, Rustom Mody rustompm...@gmail.com wrote: In the Data.GraphViz.Types.Generalised page you have the starting line: It is sometimes useful to be able to manipulate a Dot graph as an actual graph. This representation lets you do so... Evidently some other context is needed to understand this line? [Sorry if I am dense] It means that you can treat it as a graph data structure: add/delete nodes/edges, get neighbours of a node, etc. Whereas if you wanted to delete a node from the other representations, you would manually have to traverse the entire data structure explicitly to delete that node and any edge it may be in. The use case is is for manipulating existing Dot code better; generally speaking, if you are converting data _into_ a Dot graph, then you would do any such manipulations before you do the conversions. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Efficient mutable arrays in STM
David Barbour wrote: On Tue, Oct 25, 2011 at 10:47 AM, Ben Franksen ben.frank...@online.dewrote: The main question is: does the STM transaction actually see that I changed part of the underlying array, so that the transaction gets re-tried? Or do I have to implement this manually, and if yes: how? Create an extra TVar Int for every `chunk` in the array (e.g every 256 elements, tuned to your update patterns). Read-write it (increment it, be sure to force evaluation) just before every time you write an element or slice it or slice the array element. The IO mutable array is then adjusted unsafely, but there is enough transactional context to restart transactions that see an inconsistent state. You will have extra read/write and write/write conflicts relative to a pure STM solution, but only within each chunk. Your idea is quite similar to what I had in mind, and it encourages me that you think it should be possible to do it like that. My idea was to use variable-size chunks, based on which slices are currently in use and how they overlap, i.e. calculate the maximal non-overlapping index intervals. Such a solution would automatically adapt to the usage pattern, but is harder to implement efficiently. A cleaner alternative is to create a `chunked` TArray, i.e. that works with fixed-width immutable chunks in a spine. This should have good performance characteristics, and would be a lot safer for general purpose use. This is also an interesting idea, probably much easier to implement, too. Thanks for the feedback Cheers Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Efficient mutable arrays in STM
Ben Franksen ben.frank...@online.de writes: An array of TVars is certainly *much* too inefficient for what I have in mind w.r.t. both memory and cpu time. You must be a lot more confident than I if you say this without benchmarking first. :-) IME, there are (at least) two possible problems here, 1) transactions scale (quadratically, I think) with the number of TVars touched, so if any transaction touch a large part of the array, it's going to cost you, and 2) every element of your array will have a pointer to it, making GC potentially expensive. Perhaps you can get around the latter by tuning GC, e.g. +RTS -A100M might help. Or should I use a high-level approach, something like a Data.Sequence.Seq of medium sized chunks (TVar (IOVector e))? I'm not sure exactly what you mean here, but if you're going to touch contigous segments of the array, why not TArray (Vector e) or similar? -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] List archives searchable?
Are the archives of this list searchable? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Really impossible to reinstall `base' using cabal?
In response to this: dbanas@dbanas-eeepc:~$ cabal install arrows Resolving dependencies... Configuring lazysmallcheck-0.6... Preprocessing library lazysmallcheck-0.6... Building lazysmallcheck-0.6... [1 of 1] Compiling Test.LazySmallCheck ( Test/LazySmallCheck.hs, dist/build/Test/LazySmallCheck.o ) Implicit import declaration: Could not find module `Prelude': Perhaps you haven't installed the dyn libraries for package `base'? Use -v to see a list of the files searched for. cabal: Error: some packages failed to install: Stream-0.4.6 depends on lazysmallcheck-0.6 which failed to install. arrows-0.4.4.0 depends on lazysmallcheck-0.6 which failed to install. lazysmallcheck-0.6 failed during the building phase. The exception was: ExitFailure 1 I did this: dbanas@dbanas-eeepc:~$ cabal install base and got this: Resolving dependencies... cabal: internal error: impossible Is it really impossible to use cabal to reinstall `base'? Thanks, -db ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Efficient mutable arrays in STM
On Tue, Oct 25, 2011 at 1:24 PM, Ketil Malde ke...@malde.org wrote: You must be a lot more confident than I if you say this without benchmarking first. :-) IME, there are (at least) two possible problems here, 1) transactions scale (quadratically, I think) with the number of TVars touched, so if any transaction touch a large part of the array, it's going to cost you, [...] That woud remain true no matter what, but the current quadratic behaviour is I believe easily enough fixed by switching to a better data structure than a list. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] List archives searchable?
Cap'n: http://www.mail-archive.com/haskell-cafe@haskell.org/ But I usually just use a search engine. Tom / amindfv On Tue, Oct 25, 2011 at 4:27 PM, Captain Freako capn.fre...@gmail.comwrote: Are the archives of this list searchable? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Really impossible to reinstall `base' using cabal?
On Tuesday 25 October 2011, 22:32:23, Captain Freako wrote: dbanas@dbanas-eeepc:~$ cabal install base and got this: Resolving dependencies... cabal: internal error: impossible Is it really impossible to use cabal to reinstall `base'? Fortunately, yes. Reinstalling base is impossible (at least with GHC, might be possible with other compilers), so it's good that cabal doesn't even try. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Efficient mutable arrays in STM
Ketil Malde wrote: Ben Franksen ben.frank...@online.de writes: An array of TVars is certainly *much* too inefficient for what I have in mind w.r.t. both memory and cpu time. You must be a lot more confident than I if you say this without benchmarking first. :-) Ok, not science, but an informed guess based on what I read about how STM is implemented in ghc. Cache locality is one of the main reasons why unboxed arrays perform so much better in practice than boxed ones, and TVars are most certainly boxed... IME, there are (at least) two possible problems here, 1) transactions scale (quadratically, I think) with the number of TVars touched, Ouch! What would be the reason for that? I thought it would be linear... I mean what happens is that the transaction log gets built when the transaction runs, which should take a constant time per TVar, and then on commit we have to traverse the log, which is again linear in the number of TVars... so if any transaction touch a large part of the array, it's going to cost you, and 2) every element of your array will have a pointer to it, making GC potentially expensive. Perhaps you can get around the latter by tuning GC, e.g. +RTS -A100M might help. Or should I use a high-level approach, something like a Data.Sequence.Seq of medium sized chunks (TVar (IOVector e))? I'm not sure exactly what you mean here, but if you're going to touch contigous segments of the array, why not TArray (Vector e) or similar? Yes, that was what David suggested, too. Have to think about it. Cheers Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] List archives searchable?
On 10/25/11 1:27 PM, Captain Freako wrote: Are the archives of this list searchable? http://news.gmane.org/group/gmane.comp.lang.haskell.cafe . A newsreader like thunderbird makes searching especially quick. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: Hac Boston from January 21-23rd at MIT
I am very pleased to officially announce Hac Boston, a Haskell hackathon to be held January 21-23, 2012 at MIT in Cambridge, MA. The hackathon will officially kick off at 2:30 Friday afternoon, and go until 5pm on Sunday with the occasional break for sleep. Everyone is welcome -- you do not have to be a Haskell guru to attend! Helping hack on someone else's project could be a great way to increase your Haskell skills. If you plan on coming, please officially registerhttp://haskell.org/haskellwiki/Hac_Boston/Register, even if you already put your name on the wiki. Registration, travel, some information about lodging and many other details can now be found on the Hac Boston wiki http://haskell.org/haskellwiki/Hac_Boston. We have confirmed space for about 30 people, so please register early! Beyond that we'll have to either seek additional space or close registration. We're also looking for a few people interested in giving short (15-20 min.) talks, probably on Saturday afternoon. Anything of interest to the Haskell community is fair game---a project you've been working on, a paper, a quick tutorial. If you'd like to give a talk, add it on goog_145539007the wikihttp://haskell.org/haskellwiki/Hac_Boston/Talks . We look forward to seeing you at MIT! -Edward Kmett ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: Hac Boston from January *20-22* at MIT
Correction: January 20-22nd ;) On Tue, Oct 25, 2011 at 5:45 PM, Edward Kmett ekm...@gmail.com wrote: I am very pleased to officially announce Hac Boston, a Haskell hackathon to be held January 21-23, 2012 at MIT in Cambridge, MA. The hackathon will officially kick off at 2:30 Friday afternoon, and go until 5pm on Sunday with the occasional break for sleep. Everyone is welcome -- you do not have to be a Haskell guru to attend! Helping hack on someone else's project could be a great way to increase your Haskell skills. If you plan on coming, please officially registerhttp://haskell.org/haskellwiki/Hac_Boston/Register, even if you already put your name on the wiki. Registration, travel, some information about lodging and many other details can now be found on the Hac Boston wiki http://haskell.org/haskellwiki/Hac_Boston. We have confirmed space for about 30 people, so please register early! Beyond that we'll have to either seek additional space or close registration. We're also looking for a few people interested in giving short (15-20 min.) talks, probably on Saturday afternoon. Anything of interest to the Haskell community is fair game---a project you've been working on, a paper, a quick tutorial. If you'd like to give a talk, add it on http://goog_145539007the wiki http://haskell.org/haskellwiki/Hac_Boston/Talks. We look forward to seeing you at MIT! -Edward Kmett ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Operator precedence and associativity with Polyparse
On 26 October 2011 06:37, Tom Hawkins tomahawk...@gmail.com wrote: Hi, Can someone provide guidance on how handle operator precedence and associativity with Polyparse? Do you mean parsing something like 1 + 2 * 3 ? I don't think there's any real difference in using Polyparse vs Parsec for this, except for doing p `orElse` q rather than try p | q. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] blanket license for Haskell Platform?
Isn't the question just about packages included in the Haskell Platform, for which The current set of [acceptable] licenses is just the BSD3 license: http://trac.haskell.org/haskell-platform/wiki/AddingPackages#Interimlicensepolicy http://trac.haskell.org/haskell-platform/ticket/85 It might be reassuring to companies that want to depend on the platform if the policy was moved from Interim to Official; at least that would mean there would be community pressure not to relicense anything in the platform from BSD3 to (say) GPL. Conrad. On 25 October 2011 22:42, Jeremy O'Donoghue jeremy.odonog...@gmail.com wrote: IANAL, but I'll bite, since I have needed to live with this for quite some time now. Obviously readers are directed to take independent legal advice before they do anything for themselves, and all of the other standard disclaimers. On 25 October 2011 11:58, Eric Y. Kow eric@gmail.com wrote: On Tue, Oct 25, 2011 at 21:46:21 +1100, Ivan Lazar Miljenovic wrote: - My user is concerned that a large number of having a large number of individual licenses even though textually identical modulo author, date, etc would mean a big hassle getting their lawyers and their user's lawyers to sign off on each and every license Why do their lawyers all need to sign off individually for BSD licenses (which if memory serves all platform libraries have to be licensed under, or some variant thereof)? At most it just means they need to lump them all into one big text file somewhere saying which libraries they used... (then again, IANAL, and don't charge by the hour to consider these complex technical questions :p). The first thing to say is that this is actually a very responsible attitude on the client's part. When legal review is conducted it is not just the license which needs to be checked: What implications does this license carry for my business model. BSD is considered benign in this respect. GPL and LGPL work for some models but not others. Does the purported copyright holder actually have the right to issue the software under the given license. The second is much more time consuming. It is straightforward to do this if the software in question was written by one person, but when contributions come from multiple people it becomes more difficult. For example if a project receives a contribution which the contributor did on company time, they may not even have the right to make that contribution (because the employer paid for, and hence owns it). There have similarly been cases where a developer has taken code from, say, a GPL project and imported it into their own differently licensed project. This second case is particularly difficult, as there *may* be cases when it is acceptable (e.g. under fair use in some jurisdictions) to extract small portions of a work and re-use them, but in most cases the developer simply does not have the right to make the contribution. There are sub-cases of these, for example where one developer has removed the copyright notices placed by the original author, even though licensing has been kept the same. This is legal (if ethically dubious) in some jurisdictions and illegal in others. A related issue: can a project *prove* that contributors have all formally licensed their code contributions under the same license? As far as the law is concerned, you really need this in writing, or something very close to it (e.g. e-mail with full header information). Personally I think we should give praise and recognition to anyone who thoroughly checks and complies with the license attached to a piece of code as they are taking care to respect the wishes of the author. I get much more fired up about those who simply break licenses and hope they don't get caught. I find the whole thing baffling myself. I'd thought this would be the sensible thing to do, but I guess when it comes to these licensing things it's not the actual pain that counts, but the perceived potential pain. Know what I mean? It's similar to the won't touch with a 10ft pole attitude to the GPL that some entities may take. It's basically a precautionary la la la; I can't hear you or a conservative stance which consists of I don't understand this stuff, so I'm going to do the thing that seems safest to me, which may or may not be a reasonable reaction... I am not sure that anyone 'understands' the GPL with real certainty [1]. Key questions: when does a work fall into the category of 'derived' under the GPL and when does it not do so? If I make money from licensing Intellectual Property, what are the consequences of code which grants an implicit patent license? Neither of these clauses of the GPL has been properly tested in a significant legal jurisdiction (and anyway, a Code Napoleon style jurisdiction might take a different stance than under UK/US style Common Law). Well, it would need copyright attribution/agreement of
Re: [Haskell-cafe] Operator precedence and associativity with Polyparse
Can someone provide guidance on how handle operator precedence and associativity with Polyparse? Do you mean parsing something like 1 + 2 * 3 ? I don't think there's any real difference in using Polyparse vs Parsec for this, except for doing p `orElse` q rather than try p | q. Actually, I was looking for something equivalent to Text.ParserCombinators.Parsec.Expr.buildExpressionParser. I suppose I should learn how Parsec implements this under the hood. -Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Operator precedence and associativity with Polyparse
On 26 October 2011 10:49, Tom Hawkins tomahawk...@gmail.com wrote: Can someone provide guidance on how handle operator precedence and associativity with Polyparse? Do you mean parsing something like 1 + 2 * 3 ? I don't think there's any real difference in using Polyparse vs Parsec for this, except for doing p `orElse` q rather than try p | q. Actually, I was looking for something equivalent to Text.ParserCombinators.Parsec.Expr.buildExpressionParser. I suppose I should learn how Parsec implements this under the hood. There's nothing like that for PolyParse: it has a much smaller set of combinators than Parsec, which I for one prefer because I don't have to worry about behaviour of existing combinators being different than what I want/need (as it stands, I already use a custom version of bracket from polyparse). -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Really impossible to reinstall `base' using cabal?
Thanks, Daniel. So, do you have any advice for me, with regard to solving this issue: Implicit import declaration: Could not find module `Prelude': Perhaps you haven't installed the dyn libraries for package `base'? ? That is, how do I get the dynamic versions of the `base' package libraries installed, if not via a `cabal install'? Thanks, -db On Tue, Oct 25, 2011 at 1:45 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Tuesday 25 October 2011, 22:32:23, Captain Freako wrote: dbanas@dbanas-eeepc:~$ cabal install base and got this: Resolving dependencies... cabal: internal error: impossible Is it really impossible to use cabal to reinstall `base'? Fortunately, yes. Reinstalling base is impossible (at least with GHC, might be possible with other compilers), so it's good that cabal doesn't even try. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Really impossible to reinstall `base' using cabal?
On Wednesday 26 October 2011, 02:00:49, Captain Freako wrote: So, do you have any advice for me, with regard to solving this issue: Implicit import declaration: Could not find module `Prelude': Perhaps you haven't installed the dyn libraries for package `base'? ? That is, how do I get the dynamic versions of the `base' package libraries installed, if not via a `cabal install'? How did you get your ghc? If from your distro's package manager, you should be able to get the dyn- libs from that too. If downloaded from the ghc page or built from source, well, then they should already be there, if they aren't, something went wrong. Other methods? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Really impossible to reinstall `base' using cabal?
On 26 October 2011 11:15, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Wednesday 26 October 2011, 02:00:49, Captain Freako wrote: So, do you have any advice for me, with regard to solving this issue: Implicit import declaration: Could not find module `Prelude': Perhaps you haven't installed the dyn libraries for package `base'? ? That is, how do I get the dynamic versions of the `base' package libraries installed, if not via a `cabal install'? How did you get your ghc? If from your distro's package manager, you should be able to get the dyn- libs from that too. Unless you distro hasn't built GHC with dynamic library support. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Working with the code For Typing Haskell In Haskell
Patrick LeBoutillier patrick.leboutillier at gmail.com writes: [...] exprt = Ap (Const mapt) (Const idt) test = runTI $ tiExpr initialEnv [] exprt When I execute the test function above in ghci I get: ([],TVar (Tyvar v3 Star)). I was expecting someting like below for the type part: TAp tList (TGen 0) `fn` TAp tList (TGen 0) [...] Hi Patrick. The short answer is that you need to use a higher-level inference function than tiExpr. Here's the code I ended up with: t4 = (putStrLn . pretty . runTI) (tiImpls initialEnv [mapt, idt] [(map_id, [([], Var map `Ap` Var id)])]) It gets the desired result: *PLB_thih t4 ([], [map_id :: Forall [Star] ([] := (TAp tList (TGen 0) `fn` TAp tList (TGen 0)))]) Var is for referring by name to type assumptions you already have. Const is intended for other things such as data constructors, so I avoided it in this case, even though Const mapt `Ap` Const idt also works. The tiImpls function performs the 'quantify' step, which adds the Forall and converts TVar to TGen, whereas tiExpr doesn't. I can't see offhand why tiExpr doesn't seem to work in isolation - but maybe that part of a Haskell typer wouldn't work in isolation either! Regards, Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe