Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-18 Thread Ting Lei
Thanks, Brandon, That's a very clear explanation. I remembered that it's low, but forgot that it's this low. Maybe it's because of my mis-understanding that in C, infix operators have lower precedence. Just curious, the following is not allowed in Haskell either for the same reason. applySk

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-18 Thread Brandon Allbery
On Tue, Jul 19, 2011 at 02:16, Ting Lei wrote: > I have a naive question regarding the basic use of the $ operator, and I am > confused why certain times it doesn't seem to work. > e.g. > The following works: > > applySkip i f ls = (take i) ls ++ f (drop i ls) > > But the following doesn't: > > a

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-18 Thread Arlen Cuss
> applySkip i f ls = (take i) ls ++ f (drop i ls) > > But the following doesn't: > > applySkip i f ls = (take i) ls ++ f $ drop i ls The issue is with operator precedence. The above is equivalent to: > applySkip i f ls = ((take i) ls ++ f) (drop i ls) (++) binds more strongly than ($). __

[Haskell-cafe] question regarding the $ apply operator

2011-07-18 Thread Ting Lei
Hi I have a naive question regarding the basic use of the $ operator, and I am confused why certain times it doesn't seem to work. e.g. The following works: applySkip i f ls = (take i) ls ++ f (drop i ls) But the following doesn't: applySkip i f ls = (take i) ls ++ f $ drop i ls which gives

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Donn Cave
Quoth "Richard O'Keefe" , [ ... re Werner Kuhn "An Image-Schematic Account of Spatial Categories" ... ] > class BUILDING building where > > class BUILDING house => HOUSE house where > > any instance of HOUSE *will* have in its interface everything that > any instance of BUILDING will. But .

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Richard O'Keefe
On 19/07/2011, at 11:09 AM, Patrick Browne wrote: > data Emperor = Emperor > data Robin = Robin > > class Bird a where > fly :: a -> a -> a > walk :: a -> a -> a > > instance Bird Robin where > fly x y = y > walk x y = x > > instance Bird Emperor where > -- No fly method > walk x y = y

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Richard O'Keefe
On 19/07/2011, at 5:09 AM, Patrick Browne wrote: > On 18/07/2011 13:52, Ketil Malde wrote: >> I'm not sure the question makes sense, if "fly" is a method of class >> Bird, then it can't also be a member of class Penguin. > > I am actually doing a language comparison and I was checking out a pape

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Maciej Marcin Piechotka
On Tue, 2011-07-19 at 01:13 +0200, Yves Parès wrote: > Oh, I got it: You want to have: > > class Bird b where > > class Penguin p where > > instance (Penguin b) => Bird b where >fly = -- fly method for penguins > I haven't followed the thread carefully but why does the bird have to be a pe

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Felipe Almeida Lessa
On Mon, Jul 18, 2011 at 3:14 PM, Jerzy Karczmarczuk wrote: > That's why I suggested how you might do that: for some datatypes, say the > Emperors, you specify some special flying method (e.g. dummy or bombing), or > you don't specify it at all. And the Emperors won't fly. Instead of flying, they'

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Yves Parès
Oh, I got it: You want to have: class Bird b where class Penguin p where instance (Penguin b) => Bird b where fly = -- fly method for penguins 2011/7/19 Patrick Browne > On 18/07/2011 19:14, Jerzy Karczmarczuk wrote: > > That's why I suggested how you might do that: for some datatypes, say

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Patrick Browne
On 18/07/2011 19:14, Jerzy Karczmarczuk wrote: > That's why I suggested how you might do that: for some datatypes, say > the Emperors, you specify some special flying method (e.g. dummy or > bombing), or you don't specify it at all. And the Emperors won't fly. -- Here is my attempt data Emperor =

Re: [Haskell-cafe] ANN: cabal-dev 0.8

2011-07-18 Thread Bryan O'Sullivan
On Mon, Jul 18, 2011 at 1:10 PM, Rogan Creswick wrote: > We're happy to announce the release of cabal-dev 0.8! This version is > available on hackage now, and contains many bug fixes and improvements, > as outlined in the full release notes below. > Wonderful! This is absolutely one of those ind

Re: [Haskell-cafe] Failure to install Network.CGI

2011-07-18 Thread Jason Dagit
On Mon, Jul 18, 2011 at 11:45 AM, Albert Y. C. Lai wrote: > On 11-07-17 12:29 AM, william murphy wrote: >> >> : cannot satisfy -package-id >> network-2.3.0.2-24fdc6b92867c7236e81708f93cae7d0 > > Look at the output of "ghc -v" and be very horrified. > > The problem is not lacking packages or being

[Haskell-cafe] ANN: cabal-dev 0.8

2011-07-18 Thread Rogan Creswick
We're happy to announce the release of cabal-dev 0.8! This version is available on hackage now, and contains many bug fixes and improvements, as outlined in the full release notes below. --Rogan cabal-dev release 0.8 == The 0.8 release of `cabal-d

Re: [Haskell-cafe] Failure to install Network.CGI

2011-07-18 Thread Albert Y. C. Lai
On 11-07-17 12:29 AM, william murphy wrote: : cannot satisfy -package-id network-2.3.0.2-24fdc6b92867c7236e81708f93cae7d0 Look at the output of "ghc -v" and be very horrified. The problem is not lacking packages or being outdated. The problem is possessing too many packages and upgrading too

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Jerzy Karczmarczuk
Patrick Browne : > I was checking out a paper that said: "Type classes allow for partial inheritance, so that penguins can be birds without flying behavior." > ... as pointed out by Jerzy my question is silly because can penguins can fly ... No, the question is not silly because of that crazy

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Patrick Browne
On 18/07/2011 13:52, Ketil Malde wrote: > I'm not sure the question makes sense, if "fly" is a method of class > Bird, then it can't also be a member of class Penguin. I am actually doing a language comparison and I was checking out a paper that said: "Type classes allow for partial inheritance, s

[Haskell-cafe] How to use Yesod OAuth

2011-07-18 Thread Haisheng Wu
Hello, I'm trying to use Yesod oAuth plugin to a SNS site which is very similar to Twitter. I add oAuth into the authPlugin and I'm able to see the auth URL at login page. I click the URL and it forwards me to a page ask me input that SNS site account. I fill in my account then the browser

Re: [Haskell-cafe] Trying to make a calculator

2011-07-18 Thread Johannes Waldmann
> But now my assignment is a lot tougher than I thought so I'll need some > guidelines. I'm pretty sure your course instructor has already given you the exact guidelines that are required, in her lecture. There's hundreds of ways to "make a calculator", and it really depends on what the teache

Re: [Haskell-cafe] Trying to make a calculator

2011-07-18 Thread Vo Minh Thu
2011/7/18 Emanuil Boyanov : > Hi guys, I'm new to Haskell, I learn it for couple of months now and we've > learned only simple functions like map, zip etc. But now my assignment is a > lot tougher than I thought so I'll need some guidelines. I've googled my > assignment and I saw a person with the

[Haskell-cafe] Trying to make a calculator

2011-07-18 Thread Emanuil Boyanov
Hi guys, I'm new to Haskell, I learn it for couple of months now and we've learned only simple functions like map, zip etc. But now my assignment is a lot tougher than I thought so I'll need some guidelines. I've googled my assignment and I saw a person with the exact assignment so I am gonna copy

[Haskell-cafe] I confused myself with generics, and now I confused ghc too

2011-07-18 Thread Ari Rahikkala
I want to implement generic comparison on top of syb-with-class, and based on looking at syb, it seems I could base it on something like gzipWithQ from syb's Data.Generics.Twins. However, there's no Data.Generics.SYB.WithClass.Twins. So I set out to see if I can write one myself (well, one with jus

Re: [Haskell-cafe] partial inheritance

2011-07-18 Thread Ketil Malde
Patrick Browne writes: > Is it possible to model partial inheritance using Haskell type classes? > For example, if the class Bird has a flying method can we represent > Penguins as a sub-class of Bird without a flying method? I'm not sure the question makes sense, if "fly" is a method of class B

Re: [Haskell-cafe] ANNOUNCE: docidx-1.0.0

2011-07-18 Thread Andy Gimblett
With apologies, I now announce docidx-1.0.1 which fixes a problem kindly pointed out by Jack Henahan. If you tried to install docidx using "cabal install" over the weekend and failed, please try again now. The docidx-1.0.0.tar.gz uploaded to hackage on Friday was missing most of its source cod