title: how to define a class with a type family
body: <p><a href="https://repl.it/MdIP/2" rel="nofollow noreferrer">The following code</a> generates an "Expected a constraint" error :</p>
  
  <pre><code>{-# LANGUAGE TypeFamilies #-}
  {-# LANGUAGE ExistentialQuantification #-}
  
  type family Note a
  type instance Note String = String
  
  data SomeNote = forall a. Note a =&gt; SomeNote a
  
  class HasNote b where
    noteOf :: b -&gt; SomeNote
  </code></pre>
  
  <p>The error is <code>Expected a constraint, but 'Note a' has kind '*', in the definition of SomeNote</code>.  Why ?  How can I fix it ?</p>
  
  <p>The goal is to include an instance of the Note type family in some data structure b, and use noteOf b to extract it, whatever the instance is.</p>