"listProduct" -- is this a standard function?

Brandon Michael Moore brandon at its.caltech.edu
Fri Oct 17 17:38:30 EDT 2003


Somehow I managed to overlook about five replies. Sorry.

I'll try to say something more useful than "sequence" here, my advice for
finding functions.

>
> I observe this seems to be a recurring problem for me... there are so many
> very generic and useful data handling functions in Haskell, it's difficult
> for a jobbing programmer (as opposed to a language expert) to be on top of
> them all.  And the very generic nature of these function means that it's
> not so easy to index them (e.g. in the way that the Java Developers Almanac
> series does for Java).
>
> Am I overlooking any important developer resources?
>
> #g
>

All I know of is the GHC haddock docs and the libraries page on
haskell.org. Generic functions usually live in Control for generic
combinators, or Data.X for cata/ana/confusomorphisms over X.

I don't think it's that hard to find generic functions if you remember to
look for your operations as generic functions. Try to think of the most
general type the operation you want can sensibly have, and you'll have a
better chance of finding it.

If you look for mapInt::(Int -> Int) -> [Int] -> [Int] you might check
Data.Int and find nothing. If you generalize to (a -> b) -> [a] -> [b] you
can notice the only concrete types are list and arrow constructors and
think this is probably in Data.List somewhere, or maybe in Control.

The suggestion of a "types that specialize to/unify with this type" search
would be really useful.

Brandon



More information about the Haskell-Cafe mailing list