title: Generically write cases of a function
body: <p>Here is a function:</p>
  
  <pre><code>data AnyControlFrame =
     PingFrame_ACF PingFrame
     |SynStream_ACF SynStreamFrame
     |RstStreamFrame_ACF RstStreamFrame
     |SettingsFrame_ACF SettingsFrame
     |WindowUpdateFrame_ACF WindowUpdateFrame
     |Ignored_ACF LB.ByteString
  
  
  writeControlFrame :: AnyControlFrame -&gt; Put 
  writeControlFrame (PingFrame_ACF a)         = put a
  writeControlFrame (RstStreamFrame_ACF a)    = put a
  writeControlFrame (SettingsFrame_ACF a)     = put a
  writeControlFrame (WindowUpdateFrame_ACF a) = put a
  ....
  </code></pre>
  
  <p>and the cases keep coming. Is there a way to write this function "generically", that is, to abstract over all the cases? </p>
  
  <p>EDIT: The constructors are parametrized with concrete, but different types. I reckon that I may have got something wrong with this "design".... if so, please point it out!</p>