Re: [Haskell-cafe] Comment Syntax
Albert Y. C. Lai tre...@vex.net writes: On 11-06-04 02:20 AM, Roman Cheplyaka wrote: It is, for my taste, a good comment marker, because of its resemblance to a dash. It makes the code look like real text: let y = x + 1 -- increment x COBOL is real text, if that is what you want. MOVE PROGRAMMER TO SARCASM -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] hmatrix-repa: hmatrix and Repa interoperability
Hi, I have uploaded a module to hackage in the package hmatrix-repa. It provides conversion functions between hmatrix vectors/matrices and repa arrays. I don't know whether it will be of much use, but even the Repa documentation suggests using LAPACK for performance critical tasks, such as matrix multiplication. These are reference implementations and might benefit from some optimisations. Cheers, VIvian DISCLAIMER This transmission contains information that may be confidential. It is intended for the named addressee only. Unless you are the named addressee you may not copy or use it or disclose it to anyone else. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Subcategories on Hackage
I think there are two reasons to browse the hackage database. First reason reflects the common need to find a library that suites one's needs. In this case it's very easy to find it with google adding hackage haskell to the submitted word list. Second reason is to have a nice landscape of packages when one enters the site. For the second reason, which is real browsing, categories are a pain, whoever and however they are done. The more they are correct , the more they are difficult to understand. The more they are easy like tags the more it's difficult to put them in a hierarchy. One well known solution is to put tags in a high dimensional space where the tag names and distance between tags is defined by statistics on the tags cloud of each tag holder (packages). In this case browsing is jumping from one tag to another *near* one in the tag space and see the packages *around* , while inserting new packages changes the position of the tags in their space. An easiest , but somewhat wrong, solution is give each tag a dimension and have the packages in the space to browse. Ontologies are more on formalising the meaning (seen as interrelations) of concepts, which tags are not, and I don't think even software categories are. But this is really debatable. my 2 cents paolino 2011/6/5 Evan Laforge qdun...@gmail.com On Sat, Jun 4, 2011 at 7:46 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: tl;dr: I don't think ontologies are suitable for Hackage. I think I agree. For instance, I just uploaded fix-imports and had to decide which categories it is in. It manages imports, which is IDE-like and people looking for IDE-like features might be interested, so IDE. It's concerned with haskell itself, so Haskell. And it's meant to be used with an editor, though it isn't an editor itself, so Editor. It's actually none of those things, but there's no specific category for it, and if there were I think it would be too small to be useful. So I picked things I think people who might be interested in it would be searching for. I don't think a hierarchy would have helped in this case, but tags would be appropriate. Actually, I wound up using the categories like tags. I think we just need better search, e.g. +tag +tag or something. ___ 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] lambda abstraction
Are the following two functions equivalent? (i.e. do they describe the same computation) let add1 a = a + 2 let add2 = \ a - a + 2 :t add1 add1 :: forall a. (Num a) = a - a :t add2 add2 :: forall a. (Num a) = a - a Does Haskell interpreter convert all functions in the form of add1 to the lambda form of add2? Does this lambda form represent the operational semantics of Haskell? How should I translate the type information into English? Thanks Pat This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Subcategories on Hackage
On 05/06/2011 06:55 AM, Evan Laforge wrote: I don't think a hierarchy would have helped in this case, but tags would be appropriate. Actually, I wound up using the categories like tags. I think we just need better search, e.g. +tag +tag or something. +1 to all of the above. Also, I don't think listing every package on all of Hackage in one giant page is very useful any more. (I gather it was only meant to be a temporary interface in the first place...) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lambda abstraction
Well, yes add1 and add2 are equivalent. You can use either one or the other. The type annotation can be read: for all type 'a' such as 'a' is an instance of class Num, there exists a function add1 that takes an 'a' and returns an 'a'. 2011/6/5 Patrick Browne patrick.bro...@dit.ie Are the following two functions equivalent? (i.e. do they describe the same computation) let add1 a = a + 2 let add2 = \ a - a + 2 :t add1 add1 :: forall a. (Num a) = a - a :t add2 add2 :: forall a. (Num a) = a - a Does Haskell interpreter convert all functions in the form of add1 to the lambda form of add2? Does this lambda form represent the operational semantics of Haskell? How should I translate the type information into English? Thanks Pat This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie ___ 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] Fwd: Abnormal behaviors when Using ghci
-- Forwarded message -- From: 吴兴博 wux...@gmail.com Date: 2011/6/5 Subject: Abnormal behaviors when Using ghci To: cvs-...@haskell.org 1) I'm using Haskell platform 2011.2 on windows (7). Every several days, ghci will crash with no messages. even when I'm just typing with text buffer, without an 'enter'. I got nothing after the crash, not even an exception code, don't even mention the core-dump. Should I report bugs with nothing to give, only it crashes.? I think I should be careful with sending messages. 2) do that: open ghci. :set -fbreak-on-exception :trace [undefined] then you catch a _exception :print _exception Then it prints a chaos... that's because the printing of the exception contains too many white-spaces because of indent. I think this can be some kind of malformed features. since It isn't a bug, what 'type' should the problem be? :-) regards! -- 吴兴博 Wu Xingbo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: Abnormal behaviors when Using ghci
On 5/06/2011, at 13:12, 吴兴博 wux...@gmail.com wrote: 1) I'm using Haskell platform 2011.2 on windows (7). Every several days, ghci will crash with no messages. even when I'm just typing with text buffer, without an 'enter'. I got nothing after the crash, not even an exception code, don't even mention the core-dump. Do you have a single sign-on application installed (possibly TAM ESSO)? Weird though it sounds, we have experience of this Windows app randomly killing other processes, such that they just disappear with no apparent cause. Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [GeekUp] Functional Programming Night at GeekUp Liverpool May
On 6 May 2011 15:19, Hakim Cassimally hakim.cassima...@gmail.com wrote: If anyone's in Northwest UK on Tuesday 31st May, why not come to Geekup's first ever Functional Programming Night? http://lanyrd.com/2011/geekup-liverpool-may/ Just to let you know that the Haskell talk now has slides screencast available at: http://lanyrd.com/2011/geekup-liverpool-may/sdykh/ Hakim It'll mostly consist of 3 short talks on Haskell, Lisp, and Clojure: * Haskell in the Real World (Hakim @osfameron) * Implenting a Lisp interpreter in .Net (Simon Johnson) * Clojure: why you should be interested in a 50 year old language (Tom Mortimer-Jones @morty_uk) There will also be beer! The talks are likely to be more general interest than assuming deep knowledge of FP, but it would be great to meet anyone around UK NW to gauge interest in more in-depth sessions sometime in the future! Hakim -- Forwarded message -- From: John McKerrell mck...@gmail.com Date: 6 May 2011 15:10 Subject: [GeekUp] Functional Programming Night at GeekUp Liverpool May To: gee...@googlegroups.com Just wanted to announce May's GeekUp properly. We'll be having a Functional Programming Extravaganza with three (count em', 3!) talks from Hakim Cassimally, Simon Johnson and Tom Mortimer-Jones. Meeting in 3345 on Parr Street as ever, talks starting at 7pm but turn up from 6:30 and we'll be chatting over beer in the bar. Turn-out has been great for the recent events but we're always happy to welcome more people, there's more information on lanyrd: http://lanyrd.com/2011/geekup-liverpool-may/ Let us know you're coming by signing up on that link but feel free to turn up anyway, attendance is free and open to all comers of course. John -- http://geekup.org/ | http://geekup.org/wiki/ | http://jobboard.geekup.org/ To post e-mail: gee...@googlegroups.com Or go online: http://groups.google.com/group/geekup/ To unsubscribe e-mail: geekup+unsubscr...@googlegroups.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [iteratee] how to do nothing .. properly
Yes, this is expected. 'throwErr' is only meant to be used when the error should be non-recoverable, and the stream would often be invalid then, so throwErr doesn't take any steps to preserve it. You could retain the rest of the stream with getChunk and use throwRecoverableErr though. Wrapping an iteratee with ErrorT is fine, and I use this approach often. I typically would use an explicit Either rather than ErrorT, but the two approaches are exactly the same. Note that wrapping the other way, Iteratee s (ErrorT e m), can sometimes cause problems, and is best avoided unless you really know what you're doing. This may change in a future release. John On Thu, Jun 2, 2011 at 4:27 PM, Sergey Mironov ier...@gmail.com wrote: I am glad to help! Looks like upgrading to 0.8.5.0 also fixes initial problem that involved me into testing! I'll take the opportunity and ask another thing about iteratee: Is it expected behavior that throwErr consumes all data in current chunk? I wish it to stop in place and let after-checkErr code to continue the parsing. Well, I already found solution (or workaround?) - I wrap Iteratee with ErrorT monad and use ErrorT's raiseError instead of throwErr. Is it correct? Here is example code instance Exception Int iter4 = do I.dropWhile (/= 3) h-I.head throwErr $ toException $ (-4::Int) -- doesn't meter what exactly to throw return h -- catch the error with checkErr iter5 = do (_,b)-countBytes $ I.checkErr $ iter4 s - I.stream2list return (b,s) print5 = enumPure1Chunk [1..10] (iter5) = run = print Thanks a lot! Sergey 2011/6/2 John Lato jwl...@gmail.com: Hi Sergey, I've got an explanation; quite surprisingly it's a bug in enumPure1Chunk. Even though it is an odd case, I'm surprised that it hasn't come up before now since enumPure1Chunk appears frequently. I've just uploaded 0.8.5.0 which has the fix. There's now an additional Monoid constraint on enumPure1Chunk, unfortunately. Thanks very much for reporting this. John L On Thu, Jun 2, 2011 at 10:02 AM, Sergey Mironov ier...@gmail.com wrote: Ok. I've checked iteratee-0.8.3.0 and 0.8.4.0. Results are same. Sergey 2011/6/2 John Lato jwl...@gmail.com: Hi Sergey, I can't explain this; maybe it's a bug in enumWith? I'll look into it. Thanks, John Message: 20 Date: Thu, 2 Jun 2011 02:46:32 +0400 From: Sergey Mironov ier...@gmail.com Subject: [Haskell-cafe] [iteratee] how to do nothing .. properly To: haskell-cafe@haskell.org Message-ID: BANLkTimMFRWgH9Nopt-eua+L7jQcGq+u=g...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Hi. Would anybody explain a situation with iter6 and iter7 below? Strange thing - first one consumes no intput, while second consumes it all, while all the difference is peek which should do no processing (just copy next item in stream and return to user). What I am trying to do - is to write an iteratee consuing no input, but returning a constant I give to it. I thought (return a) should do it, but it seems I was wrong as return actually consumes all unparsed stream. iter6 experience tells me that (peekreturn a) is what I need, but it's completely confusing and not what I expected. Thanks, Sergey import Data.Iteratee as I import Data.Iteratee.IO import Control.Monad import Control.Exception import Data.ByteString import Data.Char import Data.String -- countBytes :: (..., Num b) = Iteratee s m a - Iteratee s m (a, b) countBytes i = enumWith i I.length iter6 = do h - countBytes $ (peek return 0) s - I.stream2list return (h,s) iter7 = do h - countBytes $ (return 0) s - I.stream2list return (h,s) print6 = enumPure1Chunk [1..10] (iter6) = run = print print7 = enumPure1Chunk [1..10] (iter7) = run = print Here is example ghci session *Main print6 ((0,0),[1,2,3,4,5,6,7,8,9,10]) -- read 0 items, returns 0 *Main print7 ((0,10),[]) -- read 10 items (???) returns 0 *Main -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe End of Haskell-Cafe Digest, Vol 94, Issue 3 *** ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: Abnormal behaviors when Using ghci
Do you have a single sign-on application installed (possibly TAM ESSO)? Weird though it sounds, we have experience of this Windows app randomly killing other processes, such that they just disappear with no apparent cause. No, I never used this app(TAM ESSO), and ghci just kill itself, other processes run well. regards! -- 吴兴博 Wu Xingbo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: mecha-0.0.5
On 04/06/2011 08:25 PM, Tom Hawkins wrote: What is the easiest way to generate polygon meshes from constructive solid geometry? Marching cubes [4] seems pretty involved. As I understand it, this is a Very Hard Problem. This is (one of the reasons) why there are so few converters from POV-Ray to mesh-based formats; it's highly non-trivial to tesselate CSG. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: dtd-text DTD parser, V0.1.0.0
The dtd-text package[1] provides a parser for XML DTDs. It implements most of the parts of the W3C XML specification relating to DTDs, and is compatible with versions 1.0 and 1.1 of the specification.[2] The result of the parse is a Haskell DTD object from the dtd-types[3] package. This first preliminary version of dtd-text, version 0.1.0.0, requires at least version 0.3.0.1 of dtd-types. Synopsis: -- Parse a DTD from a Data.Text.Lazy: dtdParse :: L.Text - DTD That should usually be all you need. -- Or, for advanced users, if the DTD contains external -- parameter entities and you want to supply their values: dtdParseWithExtern :: SymTable - L.Text - DTD -- where type SymTable = M.Map Text L.Text I really should have edited the Cabal description of this package before I uploaded it. It promises an attoparsec-text parser and blaze-builder renderer for DTDs. First of all, the renderer is vaporware - I haven't written it yet. Just the parser was quite a bit of work, so I decided to release it before even starting on the renderer. Second, although dtd-text does use attoparsec-text, and does export parsers for all of the significant components of a DTD, those parsers are of limited usefulness on their own. It turns out that in order to support the full algorithm specified in the spec for parameter entity resolution, which is rather imperative in nature, two layers of parsing are necessary. So the dtd-text package also has some internal plumbing so that it can present a simple interface. This is a very preliminary alpha release. All I can say so far is that it compiles on my machine (GHC 7.0.2 on 64 bit Linux), and that I tested it against a huge, extremely complicated DTD, and it seems to have done the RIght Thing. Since there are likely to be bugs that I will need to fix soon, I will wait until then to fix the package description. More about external parameter entities, for advanced users: As mentioned above, this parser does not attempt to go out and fetch the values of external references for you from files and URLs. If you need to extract information from the DTD before you fetch them yourself, such as system IDs and public IDs, you might be able to get them by applying parseDTD to all or part of the DTD as an initial parse. The parser tries very hard to give partial results when things are missing, while still doing its best to avoid problems like looping references. So if your DTD has many deeply intertwined external parameter entities, this parser may not be very practical for you; on the other hand, I personally have never seen such a DTD in the wild. A final caveat: this version of dtd-text does not yet support conditional sections. Enjoy, Yitz [1] http://hackage.haskell.org/package/dtd-text [2] http://www.w3.org/TR/2008/REC-xml-20081126/ [3] http://hackage.haskell.org/package/dtd-types ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: dtd-types 0.3.0.1
The dtd-types[1] package provides types for processing XML DTDs in Haskell. These types are intended to be compatible with and extend the set of types provided by John Millikin's xml-types package[2]. This version, 0.3.0.1, was released in support of the dtd-text package[3]. It includes some major changes to some of the names, as well as some bug fixes. In particular, all names relating to XML attributes which used to begin with the prefix Attr or attr have been changed to begin with att or Att instead. The EntityContent type has been renamed to EntityValue. These are much more consistent with nomenclature in the XML specs. At this point, the dtd-types package should start becoming a bit more stable, since it is now being used by other packages. Enjoy, Yitz [1] http://hackage.haskell.org/package/dtd-types/ [2] http://hackage.haskell.org/package/xml-types/ [3] http://hackage.haskell.org/package/dtd-text/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: dtd-text DTD parser, V0.1.0.0
On Sun, Jun 5, 2011 at 19:13, Yitzchak Gale g...@sefer.org wrote: I really should have edited the Cabal description of this package before I uploaded it. It promises an attoparsec-text parser and blaze-builder renderer for DTDs. First of all, the renderer is vaporware - I haven't written it yet. Just the parser was quite a bit of work, so I decided to release it before even starting on the renderer. Could you upload a bugfix version with an accurate description? This could be very frustrating to a random hackage-brower who hasn't read the announcement (or me, in a few months, having forgotten this announcement). --Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: mecha-0.0.5
the algorithms in the CGAL library might be a good starting point in terms of looking into other algorithmic approaches http://www.cgal.org/ it has a excellent set of references for its component parts On Sun, Jun 5, 2011 at 11:41 AM, Andrew Coppin andrewcop...@btinternet.comwrote: On 04/06/2011 08:25 PM, Tom Hawkins wrote: What is the easiest way to generate polygon meshes from constructive solid geometry? Marching cubes [4] seems pretty involved. As I understand it, this is a Very Hard Problem. This is (one of the reasons) why there are so few converters from POV-Ray to mesh-based formats; it's highly non-trivial to tesselate CSG. ___ 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] lambda abstraction
On Sun, Jun 5, 2011 at 07:45, Patrick Browne patrick.bro...@dit.ie wrote: Are the following two functions equivalent? (i.e. do they describe the same computation) let add1 a = a + 2 let add2 = \ a - a + 2 Mostly. The monomorphism restriction can cause Haskell to restrict the type of the second to Integer - Integer. Otherwise, conceptually the first is turned into the second; this is the basis of partial application (think let addN = \a - \b - a + b which makes it clear that supplying a results in \b - supplied'a + b being returned). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Subcategories on Hackage
On Sun, Jun 5, 2011 at 07:51, Andrew Coppin andrewcop...@btinternet.com wrote: Also, I don't think listing every package on all of Hackage in one giant page is very useful any more. (I gather it was only meant to be a temporary interface in the first place...) +1 (really +(foldl' (+) (repeat 1))...) — Hackage is *painful* these days. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Attoparsec concatenating combinator
I wrote: I was thinking of even lower level: allocating a moderate chunk of memory and writing the results directly into it consecutively as a special case. Bryan O'Sullivan wrote: Surely that would save only one copy compared to creating a list of results and then concatenating them, no? I'd be a little surprised if it proved worthwhile. If behind the scenes the concat is copying directly from slices of the original input, then no, in principle we're not saving much then. I thought there were *two* copies going on. It might be possible to keep the byte count only in the special case of a concatenating combinator, but that would require some work to implement. Thanks as usual for the fantastic work, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: mecha-0.0.5
On Sun, Jun 5, 2011 at 10:41 AM, Andrew Coppin andrewcop...@btinternet.com wrote: On 04/06/2011 08:25 PM, Tom Hawkins wrote: What is the easiest way to generate polygon meshes from constructive solid geometry? Marching cubes [4] seems pretty involved. As I understand it, this is a Very Hard Problem. This is (one of the reasons) why there are so few converters from POV-Ray to mesh-based formats; it's highly non-trivial to tesselate CSG. POV-Ray is pretty fast. I had contemplated just rendering a bunch of POV-Ray images to emulate a realtime 3D view. Images could be buffered up based on the current camera position. Another goal of the project is to generate 2D prints from 3D models. Any idea how hard is this going to be? Basically it needs to identify features (holes, edges, etc), then project these features to an orthographic plane, alone with associated dimensions. -Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Subcategories on Hackage
On Sun, Jun 5, 2011 at 1:36 PM, Brandon Allbery allber...@gmail.com wrote: On Sun, Jun 5, 2011 at 07:51, Andrew Coppin andrewcop...@btinternet.com wrote: Also, I don't think listing every package on all of Hackage in one giant page is very useful any more. (I gather it was only meant to be a temporary interface in the first place...) +1 (really +(foldl' (+) (repeat 1))...) — Hackage is *painful* these days. http://www.haskell.org/mailman/listinfo/haskell-cafe i havn't a fscking clue how to implement such a beast, but i've seen (somewhere) tags that have their own heirarchy, so you could have (for instance) Image Stuff -2D -3D -Fractal -...etc... and also having multiple tags would help classify things, like a 3D Fractal renderer would be under Image Stuff - 3D Image Stuff - Fractal and probably even under Math Stuff (yeah, i know you *love* my technical names :P ) just my 0.02 cents hex -- Other than the fact Linux has a cool name, could someone explain why I should use Linux over BSD? No. That's it. The cool name, that is. We worked very hard on creating a name that would appeal to the majority of people, and it certainly paid off: thousands of people are using linux just to be able to say OS/2? Hah. I've got Linux. What a cool name. 386BSD made the mistake of putting a lot of numbers and weird abbreviations into the name, and is scaring away a lot of people just because it sounds too technical. -- Linus Torvalds' follow-up to a question about Linux ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: mecha-0.0.5
2011/6/5 Tom Hawkins tomahawk...@gmail.com: On Sun, Jun 5, 2011 at 10:41 AM, Andrew Coppin andrewcop...@btinternet.com wrote: On 04/06/2011 08:25 PM, Tom Hawkins wrote: What is the easiest way to generate polygon meshes from constructive solid geometry? Marching cubes [4] seems pretty involved. As I understand it, this is a Very Hard Problem. This is (one of the reasons) why there are so few converters from POV-Ray to mesh-based formats; it's highly non-trivial to tesselate CSG. POV-Ray is pretty fast. I had contemplated just rendering a bunch of POV-Ray images to emulate a realtime 3D view. Images could be buffered up based on the current camera position. Another goal of the project is to generate 2D prints from 3D models. Any idea how hard is this going to be? Basically it needs to identify features (holes, edges, etc), then project these features to an orthographic plane, alone with associated dimensions. Once the conversion to triangles (or polygons) is handled, you should be able to import the model into some rendering engine. Orthographic projection isn't more difficult to achieve than perspective projection. You would have to chose the renderer so it comes with the kind of effect you want. (The feature detection you mean such that they are for instance rendered as strokes is a rendering effect, so no need I believe to first detect them then render them. I also believe there are such rendering that are done as a post-effect, on the 2d data (possibly with dept or normal information available)). Don't povray provides such a rendering mode? Otherwise, given a mesh model, idetifying the edges (with no respect to the screen) is quite easy in the principle: make any edge that separates two faces whose normals make an angle above some thresold a hard edge. To take the screen into account, you would have probably to compare the surface normal at the edge and the camera direction. One thing that would be neat for you, but I have no idea if it exists, would be to turn directly the CSG models to 2d vector graphics. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to install GhC on a Mac without registering?
But you don't need Xcode 4, do you? The Xcode 3 that comes with the install DVD will work fine! I'm still looking for the install DVD that my wife has carefully put aside for safe keeping. All-in-all, casual use of Haskell seems much easier on Linux and Windows. John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Can it be proven there are no intermediate useful type classes between Applicative Functors Monads?
If new intermediate classes crop up then there would be no point in fixing class (Applicative m) = Monad m where since it would have to be changed if new intermediate classes are found. I realize non-existence proofs are hard. -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to install GhC on a Mac without registering?
$5 for XCode is annoying, but apparently Apple had to start charging for it because of Sarbanes-Oxley and the way they set up their generally accepted accounting principles. G On Sun, Jun 5, 2011 at 9:25 PM, John D. Ramsdell ramsde...@gmail.com wrote: But you don't need Xcode 4, do you? The Xcode 3 that comes with the install DVD will work fine! I'm still looking for the install DVD that my wife has carefully put aside for safe keeping. All-in-all, casual use of Haskell seems much easier on Linux and Windows. John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Gregory Collins g...@gregorycollins.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to install GhC on a Mac without registering?
On Sun, 2011-06-05 at 21:58 +0200, Gregory Collins wrote: $5 for XCode is annoying, but apparently Apple had to start charging for it because of Sarbanes-Oxley and the way they set up their generally accepted accounting principles. That's interesting... whatever the reason, though, I concur that using Haskell seems much easier on Linux and Windows. I had to abandon a plan to introduce Haskell in a class I taught this past semester because of issues with getting it installed on the Macintosh laptops that some of the students had. It's very unfortunate that Haskell on Mac requires software which can neither be bundled in the install kit nor downloaded freely from elsewhere. The part of this that is actually needed is the GCC build system, right? Can't that be bundled on its own in a freely downloadable location? Spoken as a non Mac user... -- Chris Smith ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] I'm trying to install the Haskell Platform on a Mac and ...
I'm trying to install the Haskell Platform on a Mac and I've already installed Xcode 3.2.6 but the platform says that the tools are not installed. Do I need to reboot? -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I'm trying to install the Haskell Platform on a Mac and ...
Never mind. I didn't realize there were two steps: - clicking on the dmg file - then actualling installing the software On Sun, Jun 5, 2011 at 1:20 PM, KC kc1...@gmail.com wrote: I'm trying to install the Haskell Platform on a Mac and I've already installed Xcode 3.2.6 but the platform says that the tools are not installed. Do I need to reboot? -- -- Regards, KC -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: mecha-0.0.5
On 5 June 2011 20:20, Vo Minh Thu not...@gmail.com wrote: One thing that would be neat for you, but I have no idea if it exists, would be to turn directly the CSG models to 2d vector graphics. I don't know if it is CSG, but in the TeX world there is Gene Ressler's 3D modelling program Sketch that generates 2D pictures via PGF. It's a very nice piece of kit... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: mecha-0.0.5
As I understand it, this is a Very Hard Problem. This is (one of the reasons) why there are so few converters from POV-Ray to mesh-based formats; it's highly non-trivial to tesselate CSG. POV-Ray is pretty fast. I had contemplated just rendering a bunch of POV-Ray images to emulate a realtime 3D view. Images could be buffered up based on the current camera position. That's an... interesting way of doing it. It's probably easier to build a simple renderer internal to your program, but I suppose calling POV-Ray gives you lots of functionality without having it to implement it yourself. Another goal of the project is to generate 2D prints from 3D models. Any idea how hard is this going to be? Basically it needs to identify features (holes, edges, etc), then project these features to an orthographic plane, alone with associated dimensions. That ought to be reasonably easy. If you think of each shape's surface as being the set of points satisfying an equation, then the edges of the intersection of those shapes would be the set of points satisfying a set of simultanious equations. (Quite possibly non-linear ones, depending on which kinds of shapes you allow.) The only really tricky part is if you want to represent all of these shapes as simple curves such as lines, ellipses and paraboliods. See, for example, http://mathworld.wolfram.com/SteinmetzSolid.html The curves of intersection of two cylinders of radii a and b, shown above, are given by the parametric equations x(t) = b cos t y(t) = b sin t z(t) = +/- Sqrt(a^2 - b^2 sin^2 t) (Gray 1997, p. 204). A curve like that is not the sort of thing you can easily represent in SVG, unless you turn it into a general spline. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] OK! I have a Mac with Snow Leopard 10.6.7?, Xcode 3.2.6, Haskell Platform 2011.2.0.1; What are 2or 3 ways so far to get a GUI graphics?
-- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OK! I have a Mac with Snow Leopard 10.6.7?, Xcode 3.2.6, Haskell Platform 2011.2.0.1; What are 2or 3 ways so far to get a GUI graphics?
Answers cached on stackoverlow: http://stackoverflow.com/questions/5612201/haskell-library-for-2d-drawing/5613788#5613788 for 2D graphics. http://stackoverflow.com/questions/2860988/haskell-ui-framework for UIs. Cheers, Don On Sun, Jun 5, 2011 at 8:18 PM, KC kc1...@gmail.com wrote: -- -- Regards, KC ___ 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] How to install GhC on a Mac without registering?
Quoth Chris Smith cdsm...@gmail.com, That's interesting... whatever the reason, though, I concur that using Haskell seems much easier on Linux and Windows. I had to abandon a plan to introduce Haskell in a class I taught this past semester because of issues with getting it installed on the Macintosh laptops that some of the students had. It's very unfortunate that Haskell on Mac requires software which can neither be bundled in the install kit nor downloaded freely from elsewhere. The part of this that is actually needed is the GCC build system, right? Can't that be bundled on its own in a freely downloadable location? Spoken as a non Mac user... Exactly. If you don't use MacOS, let alone develop on it, I guess it's possible that this looks like an formidable obstacle, but then wouldn't that pose some limits to how much you're going to be able to enjoy GHC anyway? I might be missing something here, since I have never really gotten into the Darwin ports thing, but it seems to me like the real issues confronting Haskell developers on MacOS have to do with access to the Cocoa etc. APIs, and in view of that it seems possibly sort of suicidal to provide an install option that more or less guarantees that no solution to that problem will work (because the free gcc package won't include Cocoa.) Donn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OK! I have a Mac with Snow Leopard 10.6.7
Quoth KC kc1...@gmail.com, ... Xcode3.2.6, Haskell Platform 2011.2.0.1 What are 2or 3 ways so far to get a GUI graphics? http://www.haskell.org/haskellwiki/Using_Haskell_in_an_Xcode_Cocoa_project ... if you don't mind that there will be some Objective C involved. I have written only a very minor application this way, that connects to my IMAP service, retrieves a message by index and part, and displays it in a text window. The network connection and computation is Haskell, so in this case only the absolute minimal Objective C. Donn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to install GhC on a Mac without registering?
On Sun, 2011-06-05 at 17:35 -0700, Donn Cave wrote: Exactly. If you don't use MacOS, let alone develop on it, I guess it's possible that this looks like an formidable obstacle, but then wouldn't that pose some limits to how much you're going to be able to enjoy GHC anyway? Well, I explained my motivation... my students in this class are 12 to 13 years old, and those who have Macs have very little knowledge of how to install XCode on them. I don't use a Mac, and don't have the install disks... I'm honestly not sure if they do or not. (I certainly don't keep install disks around for *any* other software I use, so it's hard for me to imagine people happening to still have the disks that came with their computers; don't they normally get tossed out with the cardboard boxes? Maybe Mac users are different...) This is a huge issue for me. I suppose if no one has their OS disk and it comes to that, I'll pay a bunch of 5 dollar fees out of pocket to buy those students XCode 4 (hopefully at least *that* is downloadable), but it won't be a pleasant choice to fork over a good chunk of money to Apple for the use of free software that they didn't develop. -- Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] HUnit false-positive stumper
While working on a project of mine recently I realized that a particular HUnit test should have been failing. After paring things down, I came up with this shocker: test_perhaps.hs: module Main where import Test.HUnit main = runTestTT $ TestList [ True ~=? True , False ~=? True , TestCase $ assertEqual both true True True , TestCase $ assertEqual false true False True ] $ cabal-dev install ... $ ./cabal-dev/bin/test_perhaps.hs ### Failure in: 3 false true expected: False but got: True Cases: 4 Tried: 4 Errors: 0 Failures: 1 The shock here is that there was only one failure, whereas the False ~=? True should have failed. Environment: MacOS 10.5.8 (Leopard) GHC 6.12.3 cabal-dev 0.7.4.1 Cabal 1.10.1.0 HUnit 1.2.2.3 I even tried removing the dist and cabal-dev directories and reattempting but got the same results. I tried the same test in a different environment (Linux PC w/GHC 7.0.2, all other elements the same) and got correct results: $ ./cabal-dev/bin/test_perhaps ### Failure in: 1 expected: False but got: True ### Failure in: 3 false true expected: False but got: True Cases: 4 Tried: 4 Errors: 0 Failures: 2 $ I realize it's very difficult to debug someone's setup remotely, but I have to confess I'm really stumped at this point. The input program is pretty straightforward, and I *have* gotten test failures in the past on the Mac. I did do a cabal update the other day after being informed that my hackage file was getting old, but HUnit hasn't changed in months. I even tried unpacking HUnit and reducing the (non-)failing test case by using the definitions of the elements: module Main where import Control.Monad (unless) import Test.HUnit main = runTestTT $ TestList [ True ~=? True , False ~=? True , TestCase $ assertEqual both true True True , TestCase $ assertEqual false true False True , TestCase $ assertEqual fa False True , TestCase $ assertEqual f False True , TestCase $ (False @?= True) , TestCase $ unless (False == True) (assertFailure f) ] The results are very strange: $ ./cabal-dev/bin/test_perhaps ### Failure in: 3 false true expected: False but got: True ### Failure in: 4 fa expected: False but got: True ### Failure in: 7 f Cases: 8 Tried: 8 Errors: 0 Failures: 3 $ The assertEqual form doesn't fail as it should if the label is a single character (test 5), but in its fully expanded form (test 7) it will fail. Huh?! At this point I'm thoroughly confused. I'm using 6.12.3 on the Mac because I don't have the newer MacOS release for which there's a Haskell Platform release and I haven't wanted to build GHC by hand. I wouldn't expect 6.12.3 to have issues like this, but I wouldn't expect issues like this anywhere. If anyone has any suggestions (other than upgrading to GHC 7.x) I'll be most appreciative. -- -KQ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lambda abstraction
On 6/5/11 1:33 PM, Brandon Allbery wrote: On Sun, Jun 5, 2011 at 07:45, Patrick Brownepatrick.bro...@dit.ie wrote: Are the following two functions equivalent? (i.e. do they describe the same computation) let add1 a = a + 2 let add2 = \ a - a + 2 Mostly. The monomorphism restriction can cause Haskell to restrict the type of the second to Integer - Integer. Also, in GHC 7 they may have different behavior with regards to inlining. That is, GHC 7 changed its rules to only inline when the arguments to the left of = have been saturated (I'm not sure how this interacts with the INLINE or INLINEABLE pragma). Whether this operational difference would count as different depends on how fine-grained you want your operational semantics to be. It wouldn't show up in the denotational semantics side of things. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: mecha-0.0.5
On 6/06/2011 3:58 AM, Tom Hawkins wrote: Another goal of the project is to generate 2D prints from 3D models. Any idea how hard is this going to be? Basically it needs to identify features (holes, edges, etc), then project these features to an orthographic plane, alone with associated dimensions. are you familiar with Jan Sabinski's solid modelling in Haskell http://web.archive.org/web/20010605003250/http://www.numeric-quest.com/haskell/ he implements 3D projects onto 2D plane (although no feature selection etc) and is more a proof of principle. if you are interested in industrial strength solutions, I can recommend the openCascade (http://www.opencascade.org/) library. A Haskell binding would be very useful and something that I have thought about doing for some time, but alas had no time for. jvl ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Can it be proven there are no intermediate useful type classes between Applicative Functors Monads?
On 06/06/2011, at 5:51 , KC wrote: If new intermediate classes crop up then there would be no point in fixing class (Applicative m) = Monad m where since it would have to be changed if new intermediate classes are found. I realize non-existence proofs are hard. Not as hard as formalising useful. Ben. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Cons of -XUndecidableInstances
According to the haskell-prime wiki[1], -XUndecidableInstances removes checks on the form of instance declaration, and just impose a depth limit to ensure termination (of compilation, I assume?). The listed Con is that this removes the clear boundary between legal and illegal programs, and behaviour may be implementation-dependent as the edge of that boundary is reached. How can I tell when I'm nearing that boundary? (And where are the sorts of things GHC does with types documented? I can't seem to find any good explanation of these things.) More specifically, I have class Model m a | m - a where ... class Entropy d where ... instance (Model m a) = Entropy m where ... The first line requires MultiParamTypeClasses and FunctionalDependencies (the two seem to go together) - the third requires UndecidableInstances (since the type variable 'a' appears on the left but not the right). Is this likely to cause a problem? My guess is it shouldn't, since it's equivalent to class Model m a | m - a where ... class Entropy d a where ... instance (Model m a) = Entropy m a where ... without bothering to actually use 'a' in Entropy - but one never knows... (Actually, a third type variable has to be introduced to Entropy to remove the UndecidableInstances dependency - Constraint is no smaller than the instance head. This only increases the illogic in my humble eyes. These examples seem simple enough for GHC to handle nicely...) [1] http://hackage.haskell.org/trac/haskell-prime/wiki/UndecidableInstances -- Scott Lawrence ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cons of -XUndecidableInstances
On Mon, Jun 6, 2011 at 00:26, Scott Lawrence byt...@gmail.com wrote: According to the haskell-prime wiki[1], -XUndecidableInstances removes checks on the form of instance declaration, and just impose a depth limit to ensure termination (of compilation, I assume?). The listed Con is that this removes the clear boundary between legal and illegal programs, and behaviour may be implementation-dependent as the edge of that boundary is reached. How can I tell when I'm nearing that boundary? (And where are the sorts of things GHC does with types You can't; that's more or less the definition of that limit. The informal definition of -XUndecidableInstances is allow things which could lead to the typechecker trying to solve the Halting Problem. So yes, it's fairly conservative without that option because the only types allowed are those that it can prove ahead of time will terminate (a much smaller set than that of types that will terminate). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cons of -XUndecidableInstances
Scott Lawrence wrote: More specifically, I have class Model m a | m - a where ... class Entropy d where ... instance (Model m a) = Entropy m where ... The first line requires MultiParamTypeClasses and FunctionalDependencies... the third requires UndecidableInstances... Is this likely to cause a problem? Yes. You almost never want to use UndecidableInstances when writing practical programs in Haskell. When GHC tells you that you need them, it almost always means that your types are poorly designed, usually due to influence from previous experience with OOP. Your best bet is to step back and think again about the problem you are trying to solve. What is the best way to formulate the problem functionally? That will lead you in the right direction. Please feel free to share more details about what you are trying to do. We would be happy to help you work out some good directions. Regards, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe