On 31.07 16:27, Brian Hulley wrote: > None of the above type classes would be compatible with Data.ByteString! > (You mentioned this issue before wrt Data.Edison.Seq but it just clicked > with me now for the above refactoring.) For compatibility, the element type > would need to appear also thus: > > class Foldable f_a a | f_a -> a where > fold :: (a -> b -> b) -> b -> f_a -> b >
With the new System FC (when it is merged) we could make these classes nicer. class ElementType c a | c -> a instance ElementType [a] a instance ElementType ByteString Char instance IArray a e => ElementType (a i e) e class Foldable c where fold :: ElementType c a => (a -> b -> b) -> b -> c -> b This won't work at the moment due to limitations in GHC, but seems like a cleaner solution. - Einar Karttunen _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe