Hi,

This is one of those topics everybody else seems to be familiar with,
but which I don't quite understand, and can't seem to find any good
information about.

I have a function declared as:

  anova2 :: (Fractional c, Ord b)
            => [a->b] -> (a->c) -> [a] -> [Anova1 c]

where the first parameter is a list of classifiers.  I could simplify
it, I guess, to something like

  classify :: Eq b => [a->b] -> [a] -> [[[a]]]
  classify cs xs = ...

where for each classifying function in cs, I would get the xs
partitioned accordingly.  E.g.

  classify [fst,snd] [(1,0), (1,2), (2,0)] 

would yield

  [ [(1,0), (1,2)], [(2,0)] -- classified by `fst`
  , [(1,0), (2,0)], [(1,2)]] -- classified by `snd`

Now, obviously, the problem is that fst and snd, being passed in a
list, needs to be of the same type; this complicates classifying a
list of type [(Int,Bool)], for instance¹.

I have a vague notion this is solvable using quantifiers (since I
ever only use Eq operations on the type), but I'm not sure exactly
how, I can't seem to find a good tutorial, and my Monte-Carlo
programming approach doesn't seem to be leading anywhere :-)

Can somebody suggest a solution, or a place to look?

-kzm

¹ I guess I can convert Bool to Int (True->1, False->0), but it's not
very appealing, IMHO.
-- 
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to