Skip to content

Commit

Permalink
Merge pull request #9 from RyanGlScott/master
Browse files Browse the repository at this point in the history
Backport PrintfArg Natural instance to base-4.7
  • Loading branch information
ekmett committed Jul 16, 2015
2 parents 9eb53dc + 0e95ca1 commit 23ba605
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Numeric/Natural.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ import Data.Data
#ifdef MIN_VERSION_hashable
import Data.Hashable
#endif
#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
import Text.Printf (PrintfArg(..), formatInteger)
#endif

-- | Type representing arbitrary-precision non-negative integers.
--
Expand Down Expand Up @@ -206,3 +209,9 @@ instance Integral Natural where
{-# INLINE quotRem #-}
toInteger = runNatural
{-# INLINE toInteger #-}

#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
instance PrintfArg Natural where
formatArg = formatInteger . toInteger
parseFormat _ = parseFormat (undefined :: Integer)
#endif

0 comments on commit 23ba605

Please sign in to comment.