title: Haskell safe-money example
body: <p>This great author thoroughly convinced me to use <code>safe-money</code> via their well written blog post:</p>
  
  <p><a href="https://ren.zone/articles/safe-money" rel="nofollow noreferrer">https://ren.zone/articles/safe-money</a></p>
  
  <p>But trying examples in GHCi and trying various import statements, I cannot get it to work, even re-typing the exact samples from the blog post:</p>
  
  <pre><code>Prelude&gt; :m Data.Ratio
  
  Prelude Data.Ratio&gt; 1 % 5
  1 % 5
  
  ...
  
  Prelude Data.Ratio Data.Text&gt; :m +Money
  
  Prelude Data.Ratio Data.Text Money&gt; :t dense
  dense :: Rational -&gt; Maybe (Dense currency)
  
  Prelude Data.Ratio Data.Text Money&gt; let y = 5 :: Integer
  Prelude Data.Ratio Data.Text Money&gt; :t y
  y :: Integer
  Prelude Data.Ratio Data.Text Money&gt; y % 100
  1 % 20
  Prelude Data.Ratio Data.Text Money&gt; :t it
  it :: Ratio Integer
  Prelude Data.Ratio Data.Text Money&gt; let z = y % 100
  Prelude Data.Ratio Data.Text Money&gt; :t z
  z :: Ratio Integer
  Prelude Data.Ratio Data.Text Money&gt; dense z
  
  &lt;interactive&gt;:30:1: error:
      • No instance for (GHC.TypeLits.KnownSymbol currency0)
          arising from a use of ‘print’
      • In a stmt of an interactive GHCi command: print it
  
  Prelude Data.Ratio Data.Text Money&gt; fromRational z
  5.0e-2
  Prelude Data.Ratio Data.Text Money&gt; :t it
  it :: Fractional a =&gt; a
  
  Prelude Data.Ratio Data.Text Money&gt; fromRational z :: Dense "USD"
  
  &lt;interactive&gt;:35:25: error:
      Illegal type: ‘"USD"’ Perhaps you intended to use DataKinds
  Prelude Data.Ratio Data.Text Money&gt; 'fromRational' z :: Dense "USD"
  
  &lt;interactive&gt;:36:1: error:
      • Syntax error on 'fromRational'
        Perhaps you intended to use TemplateHaskell or TemplateHaskellQuotes
      • In the Template Haskell quotation 'fromRational'
  
  &lt;interactive&gt;:36:27: error:
      Illegal type: ‘"USD"’ Perhaps you intended to use DataKinds
  Prelude Data.Ratio Data.Text Money&gt;  'fromRational' (341 % 100) :: Dense "USD"
  
  &lt;interactive&gt;:37:2: error:
      • Syntax error on 'fromRational'
        Perhaps you intended to use TemplateHaskell or TemplateHaskellQuotes
      • In the Template Haskell quotation 'fromRational'
  
  &lt;interactive&gt;:37:38: error:
      Illegal type: ‘"USD"’ Perhaps you intended to use DataKinds
  
  </code></pre>
  
  <p>I wish intelligent authors like this would be also practical, and include the step zero basics for beginner to intermediate haskellers. </p>
  
  <p>The *ackage pages and github are also bare. Can anyone provide a working example of using <code>safe-money</code> here? I am surely spoiled by full examples in the yesod documentation.</p>
  
  <p>I believe the package is this:
  <a href="https://hackage.haskell.org/package/safe-money" rel="nofollow noreferrer">https://hackage.haskell.org/package/safe-money</a></p>