```module Numeric.Rig.Class
( Rig(..)
, fromNaturalNum
, fromWhole
) where

import Numeric.Algebra.Class
import Numeric.Algebra.Unital
import Data.Int
import Data.Word
import Prelude (Integer, Bool, Num(fromInteger),(/=),id,(.))
import Numeric.Natural.Internal

fromNaturalNum :: Num r => Natural -> r
fromNaturalNum (Natural n) = fromInteger n

-- | A Ring without (n)egation
class (Semiring r, Unital r, Monoidal r) => Rig r where
fromNatural :: Natural -> r
fromNatural n = sinnum n one

fromWhole :: (Whole n, Rig r) => n -> r
fromWhole = fromNatural . toNatural
-- TODO: optimize

instance Rig Integer where fromNatural = fromNaturalNum
instance Rig Natural where fromNatural = id
instance Rig Bool where fromNatural = (/=) 0
instance Rig Int where fromNatural = fromNaturalNum
instance Rig Int8 where fromNatural = fromNaturalNum
instance Rig Int16 where fromNatural = fromNaturalNum
instance Rig Int32 where fromNatural = fromNaturalNum
instance Rig Int64 where fromNatural = fromNaturalNum
instance Rig Word where fromNatural = fromNaturalNum
instance Rig Word8 where fromNatural = fromNaturalNum
instance Rig Word16 where fromNatural = fromNaturalNum
instance Rig Word32 where fromNatural = fromNaturalNum
instance Rig Word64 where fromNatural = fromNaturalNum
instance Rig () where fromNatural _ = ()
instance (Rig a, Rig b) => Rig (a, b) where
fromNatural n = (fromNatural n, fromNatural n)
instance (Rig a, Rig b, Rig c) => Rig (a, b, c) where
fromNatural n = (fromNatural n, fromNatural n, fromNatural n)
instance (Rig a, Rig b, Rig c, Rig d) => Rig (a, b, c, d) where
fromNatural n = (fromNatural n, fromNatural n, fromNatural n, fromNatural n)
instance (Rig a, Rig b, Rig c, Rig d, Rig e) => Rig (a, b, c, d, e) where
fromNatural n = (fromNatural n, fromNatural n, fromNatural n, fromNatural n, fromNatural n)
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.7428945,"math_prob":0.99645036,"size":1767,"snap":"2020-34-2020-40","text_gpt3_token_len":487,"char_repetition_ratio":0.39307997,"word_repetition_ratio":0.26666668,"special_character_ratio":0.25014147,"punctuation_ratio":0.19736843,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99641985,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-19T06:52:52Z\",\"WARC-Record-ID\":\"<urn:uuid:8a1e76f2-7ab9-48a9-895e-ca165544f0a3>\",\"Content-Length\":\"15704\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ba6028d5-12ac-484c-bcd7-b3818f46cfeb>\",\"WARC-Concurrent-To\":\"<urn:uuid:2eb650d4-347b-4146-95cb-aabb27ad1e7b>\",\"WARC-IP-Address\":\"199.232.64.68\",\"WARC-Target-URI\":\"https://hackage.haskell.org/package/algebra-2.0.1/docs/src/Numeric-Rig-Class.html\",\"WARC-Payload-Digest\":\"sha1:BEKIXPXYPTJQEPKN2RLVNSYFTGPN3PTK\",\"WARC-Block-Digest\":\"sha1:VN2KW7Q4VOKEMDIE4LGWVJEMA7XNOPC4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600400190270.10_warc_CC-MAIN-20200919044311-20200919074311-00626.warc.gz\"}"}