title: Type safe modular arthmetic no annotation
body: <p>There's a number of Haskell modular arithmetic modules that implement type safe modular arithmetic with type annotations. Is it possible to pass in a <em>variable</em> in the type annotation?</p>
  
  <p>For example in the <em>mod</em> module the following works</p>
  
  <pre><code>let x = 4 :: Mod 7
  let y = 5 :: Mod 7
  print x + y
  </code></pre>
  
  <p>Is there any way to achieve something similar to the following </p>
  
  <pre><code>let base = 7
  let x = 4 :: Mod base
  let y = 5 :: Mod base
  print x + y
  </code></pre>
  
  <p>My problem here is that <code>base</code> is not a type. I'm unsure of the correct way to approach this problem or whether I'm thinking about this in the wrong way for functional languages. Thanks.</p>
  
  <p><strong>Update</strong></p>
  
  <p>In practice base will be the result of some computation I do not know in advance.</p>