patty, what you have written is not a fold. A fold operates over a list. There is no list in your code, only some sort of tree structure.
> foldMusic :: (Pitch -> Octave -> Duration -> a) > -> (Duration -> a) > -> (a -> a -> a) > -> (a -> a -> a) > -> (Ratio Int -> a -> a) > -> Music > -> a > > I understand that when i use the foldMusic function i need to pass it 5 > parameters. given the type signiature, why can i pass (+) as a parameter > for p1 but not for n, what determines what can be passed as a parameter, > because they all have the return type a?? The first argument of your function is of type, (Duration -> a) (+) has the type, a -> a -> a, so it is nothing like the first argument. countNotes :: Music -> Int countNotes Silence _ = 0 countNotes Note_ = 1 countNotes PlayerPar m1 m2 = (countNotes m1) + (countNotes m2) countNotes PlayerSeq m1 m2 = (countNotes m1) + (countNotes m2) countNotes Tempo _ m = countNotes m Tom _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
