Re: [Haskell-cafe] Why is Haskell flagging this?
On Fri, Dec 17, 2010 at 09:04:20AM -0800, michael rice wrote: I don't understand this error message. Haskell appears not to understand that 1 is a Num. Prelude :t 1 1 :: (Num t) = t Prelude :t [1,2,3,4,5] [1,2,3,4,5] :: (Num t) = [t] Prelude Michael === f :: [Int] - IO [Int] f lst = do return lst main = do let lst = f [1,2,3,4,5] fmap (+1) lst 'f' operates on '[Int]', but '(+1)' operates on 'Int'... Does the following do what you want? main = do let lst = f [1,2,3,4,5] in fmap (map (+1)) lst === Prelude :l test [1 of 1] Compiling Main ( test.hs, interpreted ) test.hs:5:17: No instance for (Num [Int]) arising from the literal `1' at test.hs:5:17 Possible fix: add an instance declaration for (Num [Int]) In the second argument of `(+)', namely `1' In the first argument of `fmap', namely `(+ 1)' In the expression: fmap (+ 1) lst Failed, modules loaded: none. Prelude ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- You've been warned. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Offer to mirror Hackage
On Wed, Dec 08, 2010 at 11:41:31AM +0100, Ketil Malde wrote: Vincent Hanquez t...@snarc.org writes: You have to start somewhere with security. Yes. And you should start with assessing how much cost and inconvenience you are willing to suffer for the improvement in security you gain. In this case, my assertion is that the marginal worsening of security by having a mirror of hackage even without signing of packages etc., is less than the marginal improvement in usability. I'm a bit surprised to find that there seems to be a lot of opposition to this view, but perhaps the existing structure is more secure than I thought? Or the benefit of a mirror is exaggerated - I can see how it would be annoying to have hackage down, but it hasn't happened to my, so perhaps those complaining about it just were very unlucky. Having one glaring security problem is not a good reason to introduce another one. It just makes more to fix. As for mirroring, I'm all in favor of any random user doing a mirror. The only place I see a problem is making those official mirrors. If you were to mirror and announce that you had one then I can trust you or not. There are some people I would trust to have valid mirrors. Darrin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Offer to mirror Hackage
On Tue, Dec 07, 2010 at 11:04:04PM +0100, Ketil Malde wrote: It's not obvious to me that adding a mirror makes the infrastructure more more insecure. Any particular concerns? (I hope I qualify as naïve here :-) If you run a mirror people will come to you for software to run on their machines. I see a way to take advantage of that immediately. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Trying out GHC 7
On Mon, Dec 06, 2010 at 10:04:35AM -0800, Don Stewart wrote: Andrew, if you have a bug report, please use the bug tracker: http://hackage.haskell.org/trac/ghc/wiki/ReportABug Or reddit, of course. ;-) -- You've been warned. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] the beginning of the end
On Sun, Dec 05, 2010 at 06:48:20PM +0100, Christopher Done wrote: Of course, their use lies in their popularity. To be popular you have to be (1) well designed/usable and (2) stable/aka never down. This is why e.g. Github is extremely useful. It's well designed so it's easy to use, it's popular so most people are familiar with the interface, and it has near-perfect uptime. I frown a bit when someone provides a link to their Git repository and it's some custom repo viewer or non at all on a domain that may or may not exist next week. Twitter, reddit and blogspot are pretty much ideal for reporting on uptime issues. Twitter and Reddit both have periods of unavailability almost on a daily basis, often several times per day. They always come back, but they are hardly models of availability. Just saying... dwc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haskell Forum
On Tue, Jul 27, 2010 at 07:01:45PM +0100, Andrew Coppin wrote: If you have a forum powered by NNTP, you can casually throw in a hey, nice one time comment as a reply to part of a thread, and only people interested in that thread have to see your message (or download it, for that matter). ... Still, I know from experience that I am the only person here who appreciates these virtues. Everybody else seems quite happy with a crude SMTP system, so... IOW, if people use the proper and well known features of NNTP it would be a better world than the one we have were people do not use proper and well known features of SMTP. As it stands, even with SMTP you get people who post new message topics as replies to existing threads, as well as people who *somehow* reply to a thread but do not include In-Reply-To or References headers so threading is broken. I have no reason to think people would not do the same broken things with NNTP, foiling my plans for following some threads and ignoring others. As long as people are sharing opinions, I'll add mine: * If the mailing lists go away I will probably not switch to whatever replaces it. * A list - forum gateway is fine, as long as the message IQ doesn't drop through the floor as a result. This fear comes from personal, anecdotal evidence. YMMV. * No opinion either way on List - NNTP gateway. -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haskell Forum
On Tue, Jul 27, 2010 at 07:59:40PM +0100, Andrew Coppin wrote: NNTP is ... It's all true. I used nntp extensively in the 90s. I never emo-quit, I just stopped using it over time due to waning ISP support and other reasons made it more of a pain. I have nothing against nntp as a protocol, but I have my reasons for no longer using it. I constantly have trouble with this mailing list. Even gmane can't seem to thread it properly. But I've never had any trouble with threading in any NNTP group, ever. Hmm. I don't see this mailing list as unusual in any way wrt threading, except that most people here actually *do* reply properly, most of the time. * If the mailing lists go away I will probably not switch to whatever replaces it. ...nd this is why no matter how superior it is, this list will never get updated. Pretty much. * A list - forum gateway is fine, as long as the message IQ doesn't drop through the floor as a result. This fear comes from personal, anecdotal evidence. YMMV. Uh, why would that happen? I guess if it went to a web forum there'd by a greater danger of that maybe. But heck, we don't have much trouble on IRC, and that's notorious for the kind of trolls it tends to attract... In my experience, either a web forum is actively maintained and moderated or it becomes a troll magnet. Trolls can live anywhere, but they prefer caves, under bridges, and web forums. People on this list who desire a forum are not the problem, and I certainly don't want to imply that. As for IRC, I think freenode/#haskell has enough quality and quantity to keep the trolls down. I haven't had much troll problems on freenode, though I'm sure others could share some tales. * No opinion either way on List - NNTP gateway. As I say, there already is one. But because 98% of everybody uses this list as an email list, you can't go using it like it's a news group. You'll just get yelled at. I find it surprising that you'd get yelled at, but I don't really know. -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How easy is it to hire Haskell programmers
On Fri, Jul 02, 2010 at 06:03:31PM +0100, Andrew Coppin wrote: Edward Kmett wrote: Knowledge of Haskell means very different things to different people. I'd be somewhat leery of blindly hiring someone based on their ability to answer a couple of pop Haskell quiz questions. A better test might be if they really understood Applicative and Traversable, or if they knew how to use hsc2hs; Talk about unboxing and when to apply strictness annotations, finger trees, stream fusion, purely functional data structures or ways to implement memoization in a purely functional setting, or how to abuse side effects to do so in a less pure way. Those are the kinds of things you get exposed to through actually using Haskell, rather than through reading a monad tutorial. Hmm, interesting. Applicative and Traversable are two classes I've never used and don't really understand the purpose of. I have no idea what hsc2hs is. I keep hearing finger trees mentioned, but only in connection to papers that I can't access. So I guess that means that I don't count as a knowledgable Haskell programmer. :-( On the other hand, I could talk for hours about stream fusion or STM. (Hell, I've even had a go at implementing both of these; the latter made it into The Monad Reader.) All of which conclusively demonstrates... something. One thing it might demonstrate is the inherent deficiency of using litmus tests in evaluating applicants. -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is Haskell unsuitable for?
On Thu, Jun 17, 2010 at 01:38:23PM -0500, aditya siram wrote: Judging by the other thread, getting hired might be a valid answer here... No argument there - I'm even afraid to stick it on my resume. At least Clojure can be snuck into the JVM without people noticing - Haskell, unfortunately, is not that shy. I am sad that I can't use cool languages in the boring, mainstream corporate jobs that are easy to find. If you want to use cool languages, you may have to get a cool job. I know: it's easy to say and harder to accomplish. -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is Haskell unsuitable for?
On Thu, Jun 17, 2010 at 12:01:53PM -0700, David Leimbach wrote: On Thu, Jun 17, 2010 at 11:57 AM, Darrin Chandler dwchand...@stilyagin.comwrote: On Thu, Jun 17, 2010 at 01:38:23PM -0500, aditya siram wrote: Judging by the other thread, getting hired might be a valid answer here... No argument there - I'm even afraid to stick it on my resume. At least Clojure can be snuck into the JVM without people noticing - Haskell, unfortunately, is not that shy. I am sad that I can't use cool languages in the boring, mainstream corporate jobs that are easy to find. If you want to use cool languages, you may have to get a cool job. I know: it's easy to say and harder to accomplish. I would never look at a resume when reviewing people to hire, see an exotic programming language, and draw negative conclusions about that candidate. In fact, I've found that learning to solve problems from different solution spaces in general is a worthwhile mental exercise, and helps one to come up with possibly better solutions in the mainstream languages. Sometimes breadth of experience is a good thing. I agree. On the (employee) flip side, I'd rather go work for someone who has views like you mention, regardless of language in use. -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Literate programming
On Sat, Jun 12, 2010 at 12:34:37PM -0400, aditya siram wrote: It's weird I was just thinking about LP in Haskell this morning. Check out John Milliken's dbus-core [1] written entirely in noweb. It is a pleasure to read and I am seriously considering adopting the technique for my Haskell projects. At my work we've recently started doing something similar to LP. Real LP didn't suite our needs, but we still wanted most of the benefits. Here are some thoughts, in no particular order: * We wanted something really easy, so that non-developers / non-latex people wouldn't be scared off. We decided on textile/markdown with the ability to embed latex math. We needed docs that were readable and nice enough rather than requiring publication quality typesetting. * We wanted source code to be source code, rather than having to preprocess it before compile or script execution. This suites us because the code is the product for us, not a paper about the code. * We wanted something language agnostic. Period. Six different LP tools for six languages is insane. Noweb would have worked nicely but for requirements above. There are a great many LP and LP-like solutions out there, but none of them that we saw meet the above points. We decided to roll our own solution by making a simple utility program to make documents from source code. It simply flips things inside out by extracting comments as the document and putting non-comments in \verbatim blocks. We only see comments as document when there's only whitespace and no code in front, as end of line comments tend to be techy comments and not real documentation. If it weren't for the firm desire that source code be source code we would have went with noweb, despite wanting to keep it simpler than latex. But our solution is a small amount of effort to get working with a front-end for token to EOL style comments like shell or haskell -- comments. Doing front-ends for block comments adds effort, but not so much. Using Pandoc or similar for actual document processing gives you lots of options on the back-end and makes everything but the front end trivial. This isn't for everyone, and depends heavily on the three points above. -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] iPhone/Android and Haskell [Was: Embedded funcional programming?]
On Sat, Apr 17, 2010 at 08:21:06PM -0700, Jeffrey Scofield wrote: As a side comment, I haven't noticed any reaction in the Haskell/iPhone community about Apple's recent policy change. I've seen some reaction in other language communities, and I'm sure you can imagine what it's like. Understandable sentiments, but not very productive. I recently purchased an Android phone and spent a little time looking around to see if Haskellers were doing anything there, but no luck so far. Has anyone here done anything with Android? -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Are there any male haskellers?
On Sun, Mar 28, 2010 at 07:26:58PM +0200, Günther Schmidt wrote: Hi everyone, are there any male haskellers? I hope this question is not considered inappropriate Gender doesn't belong in pure code, but belongs in a Gon^WMonad. -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Are there any female Haskellers?
On Sun, Mar 28, 2010 at 10:35:04PM +0200, Matthias Kilian wrote: On Sun, Mar 28, 2010 at 01:14:44PM -0700, Jason Dagit wrote: And as Luke Palmer suggests, perhaps you can ignore/filter these discussions that you do not enjoy :) Or just unsubscribe, like I did. Tell the truth. You only unsubscribed when you saw me post. ;-) -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Abstraction in data types
Thanks to those who responded. Solutions that didn't work for my specific case still taught me more about expressing things in the Haskell type system. And... this particular response is extremely well written and useful. You've made the issues involved very clear and understandable. I really appreciate it. Thanks! On Thu, Mar 18, 2010 at 02:58:04PM +0100, Tillmann Rendel wrote: Darrin Chandler wrote: data Point = Cartesian (Cartesian_coord, Cartesian_coord) | Spherical (Latitude, Longitude) type Center = Point type Radius = Float data Shape = Circle Center Radius | Polygon [Point] This obviously stinks since a Polygon could contain mixed Cartesian and Spherical points. Polygon needs to be one or the other, but not mixed. The problem is that you cannot distinguish in the type system whether a Point was created by the Cartesian or the Spherical constructor. These constructors have the following types: Cartesian :: (Cartesian_coord, Cartesion_coor) - Point Spherical :: (Latitude, Latitude) - Point The types of both constructors end with the same type, the type Point. If you manage to change your code so that the constructors end in different types, then the difference between them will be visible to the type system, and you will have the static knowledge you want. I know of two strategies to make the constructors end in different types. They could belong to different datatypes, or they could belong to different instances of a family of datatypes. You could split the type Point into two types as follows. data Cartesian = Cartesian Cartesian_coord Cartesian_coord data Spherical = Spherical Latitude Longitude Now the constructors have the following types: Cartesian :: Cartesian_coord - Cartesian_coord - Cartesian Spherical :: Latitude - Longitude - Spherical Since the types of the constructors end in different types, we can distinguish values created with Cartesian from values created with Spherical in the type system. (Note that I dropped the use of tuples from your types to make the example more idiomatic Haskell). However, how are we going to write the Shape datatype now that we have two different types of points? We write a family of Shape datatypes parameterized in the type of points we want to use. data Shape point = Circle point Radius | Polygon [point] Note that point is a type variable, which can be instantiated with whatever type we like, including Cartesian and Spherical. For example, Shape Cartesian is the type of shapes described with cartesian coordinates, and Shape Spherical is the type of shapes described with spherical coordinates. But we could also have a type like Shape Integer, which is the type of shapes described with Integer points, whatever that means. This generality of the Shape family of types has advantages and disadvantages. An advantage is that we can make Shape an instance of the type class Functor as follows. instance Functor Shape where fmap f (Circle p r) = Circle (f p) r fmap f (Polygon ps) = Polygon (map f ps) Note that fmap applies a function to every point in the shape, but does not change the overall shape structure. This could be used, for example, to convert between a spherical and a cartesian shape, given some function to convert between spherical and cartesian points. convertPoint :: Spherical - Cartesian convertPoint = ... convertShape :: Shape Spherical - Shape Cartesian convertShape = fmap convertPoint Another example could be a shape with all the cartesian points stored in same database. Lets assume that we have a function to lookup which point is stored in the database under some key. lookupPoint :: Database - Key - Cartesian lookupPoint = ... We can use fmap to write the function which takes a Shape with keys as points, and looks up all the keys in the database, returning a Shape of cartesian coordinates. lookupShape :: Database - Shape Key - Shape Cartesian lookupShape db = fmap (lookupPoint db) The Functor typeclass is further extended and specialized by typeclasses like Traversable, Foldable, Applicative, Alternative, Monad, etc. Probably some of them are applicable here. So an advantage of this kind of open family Shape is that we can write instances for standard typeclasses, and another advantage is that we may find good uses for types such as (Shape Key). However, a disadvantage may be that we cannot restrict a priori which types of points are useable in our program. That also means that we cannot use pattern matching to discover at runtime which type of point was used in some shape. If we make cartesian and spherical points belong to the same family of types, we relate them somewhat, but keep their distinction visible for the type system. We want to introduce a family of types with two members, one for spherical, and one
[Haskell-cafe] Abstraction in data types
Hi, Trying to get up to speed in Haskell, I'm playing with doing some abstraction in data types. Specifically, I have this: type Cartesian_coord = Float type Latitude = Float type Longitude = Float data Point = Cartesian (Cartesian_coord, Cartesian_coord) | Spherical (Latitude, Longitude) type Center = Point type Radius = Float data Shape = Circle Center Radius | Polygon [Point] This obviously stinks since a Polygon could contain mixed Cartesian and Spherical points. Polygon needs to be one or the other, but not mixed. I could define seperate types for Cartesian and Spherical and seperate CartesianPoly and SphericalPoly, but that doesn't seem very elegant and also increases as I add more coordinate systems and shapes. I read a little on GADTs, et al, but I'm not sure if that's what I want for this or not. Any help appreciated! -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation pgpAUutRRKRWb.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Abstraction in data types
On Wed, Mar 17, 2010 at 09:56:14PM -0700, Alexander Solla wrote: I wrote this to Darrin, but didn't CC cafe: On Mar 17, 2010, at 9:20 PM, Darrin Chandler wrote: type Cartesian_coord = Float type Latitude = Float type Longitude = Float data Point = Cartesian (Cartesian_coord, Cartesian_coord) | Spherical (Latitude, Longitude) type Center = Point type Radius = Float data Shape = Circle Center Radius | Polygon [Point] This obviously stinks since a Polygon could contain mixed Cartesian and Spherical points. Polygon needs to be one or the other, but not mixed. My suggestion would be to use an alternate representation of spherical points in terms of polar coordinates, and then to normalize and mix at will: type Theta = Float type Radius = Float data Point = Cartesian (Cartesian_coord, Cartesian_coord) | Polar (Theta, Radius) normalize_point :: Point - Point normalize_point Cartesian x y = Cartesian x y normalize_point Polar t r = Cartesian x y where x = r * cos t; y = r * sin t; It really depends on what you want to do with your points. If you want to do linear algebra, you might want your points to depend on a basis, for example. But your spherical points don't really form a basis in three-space, or even over all of two-space. I see what you mean, but I don't think that's what I need. I want to have keep Lat/Lon, as I may have large groups of shapes in Lat/Lon and want to do things with them as is. And the same for cartesian coords. Sometimes I will translate betweem lat/lon and cartesian, but many times I will be doing calculations in native coordinates. But it's a nice technique you show, and it will come in handy elsewhere. -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation pgpLOuboWn8Cz.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Abstraction in data types
On Wed, Mar 17, 2010 at 10:20:02PM -0700, Alexander Solla wrote: On Mar 17, 2010, at 9:56 PM, Alexander Solla wrote: But your spherical points don't really form a basis in three- space, or even over all of two-space. I'll take this back. Lattitude and longitude is enough to form a basis on R^2, by taking a basis for the surface of the sphere in terms of latitude and longitude and projecting it stereographically. So if you wanted to use the normalization idea, you could use the stereographic projection formulas to turn a spherical point into a Cartesian point. http://en.wikipedia.org/wiki/Stereographic_projection Yes. I believe other projections can be used as well (orthographic, etc). -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation pgpLUf6kgR3CX.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Abstraction in data types
On Thu, Mar 18, 2010 at 01:06:25PM +0800, Lyndon Maydwell wrote: You could probably also use a typeclass for pointy things rather than a data type, this would then require you to use existential quantification to construct a hetrogenous list. For example: Class Point where getCartesian :: ... getPolar :: ... data Shape = Point p = ... | Polygon [p] Correct me if this is wrong though :-) So in normal use Polygon list would be homogeneous, but could be made heterogeneous with effort? If I have that right it's closer, but I'd love to have the compiler whine if someone tried to mix them. On Thu, Mar 18, 2010 at 12:56 PM, Alexander Solla a...@2piix.com wrote: I wrote this to Darrin, but didn't CC cafe: On Mar 17, 2010, at 9:20 PM, Darrin Chandler wrote: type Cartesian_coord = Float type Latitude = Float type Longitude = Float data Point = Cartesian (Cartesian_coord, Cartesian_coord) | Spherical (Latitude, Longitude) type Center = Point type Radius = Float data Shape = Circle Center Radius | Polygon [Point] This obviously stinks since a Polygon could contain mixed Cartesian and Spherical points. Polygon needs to be one or the other, but not mixed. My suggestion would be to use an alternate representation of spherical points in terms of polar coordinates, and then to normalize and mix at will: type Theta = Float type Radius = Float data Point = Cartesian (Cartesian_coord, Cartesian_coord) | Polar (Theta, Radius) normalize_point :: Point - Point normalize_point Cartesian x y = Cartesian x y normalize_point Polar t r = Cartesian x y where x = r * cos t; y = r * sin t; It really depends on what you want to do with your points. If you want to do linear algebra, you might want your points to depend on a basis, for example. But your spherical points don't really form a basis in three-space, or even over all of two-space. ___ 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 -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation pgpQ23BiUq7Fv.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: GPL answers from the SFLC
On Thu, Mar 04, 2010 at 07:07:31PM -0500, Stefan Monnier wrote: The thing is that the new X' library can provide the same API while not being very useful (bug, performance, whatever). And in this case, it is trivial to make that new X'. So I don't understand why the answer was no in the first place. The law is not a set of mathematical rules. It all needs to be interpreted, compared to the underlying intentions etc... So while you can say that it's pointless if you push the idea to its limit, that doesn't mean that it's meaningless in the context of the law. All it might mean is that in some cases, the interpretation is not clear. It's those cqases where a court needs to decide which interpretation should be favored. I'd like to point out that sometimes requesting that the author switch from GPL to LGPL is all it takes. Some may even be willing to switch to a BSD-style. It doesn't hurt to ask. Of course libraries with many authors increases the headache. -- Darrin Chandler| Phoenix BSD User Group | MetaBUG dwchand...@stilyagin.com | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe