On 18 March 2010 05:48, Brandon S. Allbery KF8NH <allb...@ece.cmu.edu> wrote:
> They can be mixed only with significant effort. And you can't really > prevent it once your users know the magic of existential quantification; > *but* those lists won't typecheck when passed to your routines expecting a > Polygon, because you will be expecting a (Point a => Polygon [a]) but they > will be passing a (Polygon [forall a. Point a => a]) or something similar. If you can live without constructors, an ADT view is another possibility... Jeremy Gibbons gives a clear explanation of using an ADT to implement complex numbers with polar and cartesian representations. Both representations share the same type, so can be stored together in lists - figuratively speaking the the existential type has been moved "further down" inside the type. See section 2: http://www.comlab.ox.ac.uk/jeremy.gibbons/publications/adt.pdf Best wishes Stephen _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe