title: List of different types?
body: <pre><code>data Plane = Plane { point :: Point, normal :: Vector Double }
  data Sphere = Sphere { center :: Point, radius :: Double }
  
  class Shape s where
      intersect :: s -&gt; Ray -&gt; Maybe Point
      surfaceNormal :: s -&gt; Point -&gt; Vector Double
  </code></pre>
  
  <p>I have also made both <code>Plane</code> and <code>Sphere</code> instances of <code>Shape</code>.</p>
  
  <p>I'm trying to store spheres and planes in the same list, but it doesn't work.  I understand that it shouldn't work because <code>Sphere</code> and <code>Plane</code> are two different types, but they are both instances of <code>Shape</code>, so shouldn't it work?  How would I store shapes and planes in a list?</p>
  
  <pre><code>shapes :: (Shape t) =&gt; [t]
  shapes = [ Sphere { center = Point [0, 0, 0], radius = 2.0 },
           Plane { point = Point [1, 2, 1], normal = 3 |&gt; [0.5, 0.6, 0.2] }
           ]
  </code></pre>