summaryrefslogtreecommitdiff
path: root/libraries/base/tests/isValidNatural.hs
blob: cd2ae4a9fc2911b8af8dae8122c88ceb2a3a64b6 (plain)
1
2
3
4
5
6
7
8
9
10
{-# language MagicHash, UnboxedTuples #-}

import GHC.Num.Natural
import GHC.Num.BigNat
import GHC.Exts

main = print $ map naturalCheck [0, 1, maxWord, maxWord + 1, invalid]
  where
    maxWord = fromIntegral (maxBound :: Word)
    invalid = NB (bigNatOne# (# #)) -- 1 would fit into the NS constructor.