Re: [Haskell-cafe] FunDeps conflict

2006-06-06 Thread Brian Hulley
Brian Hulley wrote: Joel Björnson wrote: Hi. I have a question regarding type classes and FunDeps. Consider the following code : class Class2 a b | a -> b class IsFoo a data Bar a = Bar a instance IsFoo a => Class2 a a instance IsFoo a => Class2 (Bar a) a The last two instantiations wi

[Haskell-cafe] HAppS in production?

2006-06-06 Thread Joel Reymont
Folks, Is anyone using HAppS in production right now? It seems to be the most advanced Haskell web development platform right now but I would like to hear about others as well. Production (heavy) use is what I'm looking for. Thanks, Joel -- http://wagerlabs.com/ _

Re: [Haskell-cafe] Problem in code

2006-06-06 Thread Neil Mitchell
Hi, Haskell is based on indentation for grouping, so your code is fine, you just need to indent the lines marked: f :: (Float,Float) -> Float f (x,y) = (a(x,y) + 4) * (b(x,y) + 3) where a :: (Float,Float) -> Float a(x,y) = (x + y)*2 b :: (Float,Float) -> Float b(x,y) = (y -

[Haskell-cafe] Problem in code

2006-06-06 Thread Jenny678
hello, I can not find the problem, I use WinHugs and shows me(Syntax error in input (unexpected keyword "where"). here is my code: f :: (Float,Float) -> Float f (x,y) = (a(x,y) + 4) * (b(x,y) + 3) where a :: (Float,Float) -> Float a(x,y) = (x + y)*2 b :: (Float,Float) -> Float b(x,y) = (y - x)*5

Re: [Haskell-cafe] Combinations

2006-06-06 Thread Henning Thielemann
On Tue, 6 Jun 2006, Udo Stenzel wrote: [EMAIL PROTECTED] wrote: I need a functions which takes as argument a list of lists like this one: [[1,2],[3],[4]] and gives me a list of list with all the possible combinations like this one: [[1,3,4],[2,3,4]] sequence I see, it is just sequen

Re: [Haskell-cafe] Combinations

2006-06-06 Thread Udo Stenzel
[EMAIL PROTECTED] wrote: > I need a functions which takes as argument a list of lists like this one: > > [[1,2],[3],[4]] > > and gives me a list of list with all the possible combinations like this one: > > [[1,3,4],[2,3,4]] sequence Finding out why it is named that strangely is left as an exc

Re: [Haskell-cafe] Combinations

2006-06-06 Thread Mirko Rahn
Henning Thielemann wrote: > combinations = foldr (Monad.liftM2 (:)) [[]] Lennart Augustsson wrote: combinations [] = [[]] combinations (xs:xss) = liftM2 (:) xs (combinations xss) List comprehension is faster when compiled with ghc-6.4.2 -O: combinations [] = [[]] combinations (xs:xss) = [ x

Re: [Haskell-cafe] Combinations

2006-06-06 Thread Lennart Augustsson
Sounds like cartesian product to me. So you could try combinations [] = [[]] combinations (xs:xss) = liftM2 (:) xs (combinations xss) -- Lennart [EMAIL PROTECTED] wrote: Hi, I need a functions which takes as argument a list of lists like this one: [[1,2],[3],[4]] and gives me a list

Re: [Haskell-cafe] FunDeps conflict

2006-06-06 Thread Joel Björnson
Brian Hulley wrote : > Possibly you meant to write: >  instance IsFoo a => Class2 a a >  instance Class2 (Bar a) a Yes, in principle that illustrates the idea. However I don't see the major difference from constraining the 'a' to the IsFoo class, as in   instance IsFoo a => Class2 (Bar a) a This

Re: [Haskell-cafe] Combinations

2006-06-06 Thread Henning Thielemann
On Tue, 6 Jun 2006 [EMAIL PROTECTED] wrote: > Hi, > > I need a functions which takes as argument a list of lists like this one: > > [[1,2],[3],[4]] > > and gives me a list of list with all the possible combinations like this one: > > [[1,3,4],[2,3,4]] > > In this case there are only 2 combination

Re: [Haskell-cafe] Combinations

2006-06-06 Thread Bernd Holzmüller
This should do: combinations :: [[a]] -> [[a]] combinations [] = [[]] combinations [[x]] = [[x]] combinations ([] : xxs) = combinations xxs combinations ((h : tl) : xxs) = [h : r | r <- combinations xxs] ++ if null tl then [] else combinations (tl : xxs) Bernd [EMAIL PROTECTED] s

[Haskell-cafe] Combinations

2006-06-06 Thread developer
Hi, I need a functions which takes as argument a list of lists like this one: [[1,2],[3],[4]] and gives me a list of list with all the possible combinations like this one: [[1,3,4],[2,3,4]] In this case there are only 2 combinations but if there was more than one element in the other lists the

Re: [Haskell-cafe] FunDeps conflict

2006-06-06 Thread Brian Hulley
Joel Björnson wrote: Hi. I have a question regarding type classes and FunDeps. Consider the following code : class Class2 a b | a -> b class IsFoo a data Bar a = Bar a instance IsFoo a => Class2 a a instance IsFoo a => Class2 (Bar a) a The last two instantiations will yield a 'Functiona

Re: [Haskell-cafe] FunDeps conflict

2006-06-06 Thread Brian Hulley
Joel Björnson wrote: Hi. I have a question regarding type classes and FunDeps. Consider the following code : class Class2 a b | a -> b class IsFoo a data Bar a = Bar a instance IsFoo a => Class2 a a instance IsFoo a => Class2 (Bar a) a The last two instantiations will yield a 'Functiona

[Haskell-cafe] FunDeps conflict

2006-06-06 Thread Joel Björnson
Hi. I have a question regarding type classes and FunDeps. Consider the following code : > class Class2 a b | a -> b > class IsFoo a > data Bar a = Bar a > instance IsFoo a => Class2 a a > instance IsFoo a => Class2 (Bar a) a The last two instantiations will yield a 'Functional dependencies conf