title: How to use fromInteger with no implicit prelude in Haskell?
body: <p>The following program yields an error in ghci:</p>
  
  <pre><code>{-# LANGUAGE NoImplicitPrelude #-}
  
  import Prelude (Integer, Bool)
  import qualified Prelude
  
  class Discrete a where
      (==) :: a -&gt; a -&gt; Bool
  
  instance Discrete Integer where
      (==) = (Prelude.==)
  
  class Monoid a where
      one :: a
      (*) :: a -&gt; a -&gt; a
  
      fromInteger :: Integer -&gt; a
      fromInteger 1 = one
  </code></pre>
  
  <p>Namely:</p>
  
  <blockquote>
    <p>fromInteger.hs:17:16:<br>
       No instance for (Monoid Integer)<br>
         arising from the literal <code>1' at fromInteger.hs:17:16<br>
       Possible fix: add an instance declaration for (Monoid Integer)<br>
       In the pattern: 1<br>
       In the definition of</code>fromInteger': fromInteger 1 = one  </p>
  </blockquote>
  
  <p>How can I fix it so that 1 can be converted to the value <code>one</code> for Monoids? All other integers may (or should) yield <code>Prelude.undefined</code> when being applied to <code>(Monoid a) =&gt; fromInteger</code>.</p>
  
  <p>Please be aware that I am a the opposite of an expert to Haskell so please forgive me in case the answer is obvious.</p>