[Haskell-beginners] containers and extensibility, typeclasses vs.
multiple value constructors
stephen.tetley at gmail.com
Mon Sep 6 10:57:07 EDT 2010
Supposing you are working with GnuPlot - one option is to make Plot a
functional type that takes a list of some polymorphic input data and
generates a 'GnuPlot' - where GnuPlot is a type representing output in
the GnuPlot format.
type Plot a = [a] -> GnuPlot
Or if GnuPlot accepts drawing styles...
type Plot a = [a] -> DrawingStyle -> GnuPlot
Plots are just functions, so clearly you can define as many as you
like and they are all the same type.
More information about the Beginners