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
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/
_
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 -
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
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
[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
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
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
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
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
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
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
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
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
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
15 matches
Mail list logo