File: Orphans.hs

package info (click to toggle)
haskell-integer-logarithms 1.0.3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 132 kB
  • sloc: haskell: 522; makefile: 3
file content (12 lines) | stat: -rw-r--r-- 445 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Orphans () where

import Numeric.Natural (Natural)
import Test.QuickCheck (Arbitrary (..))

-- | The QuickCheck-2.10 doesn't define the Arbitrary Natural instance
-- We define own instance (and not use quickcheck-instance) to break
-- the cycle in tests.
instance Arbitrary Natural where
    arbitrary = fmap (fromInteger . abs) arbitrary
    shrink = map (fromInteger . abs) . shrink . fromIntegral