summaryrefslogtreecommitdiff
path: root/testsuite/tests/numeric/should_compile/T14465.hs
blob: 93a3b200206665c1e3606a513e5113835b7e4c29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{-# LANGUAGE TypeApplications      #-}
{-# LANGUAGE TypeInType            #-}

module M where

import Numeric.Natural
import GHC.Num.Natural

-- test Natural literals
one :: Natural
one = fromInteger 1

plusOne :: Natural -> Natural
plusOne n = n + 1

-- a built-in rule should convert this unfolding into a Natural literal in Core
ten :: Natural
ten = naturalFromWord 10

-- test basic constant folding for Natural
twoTimesTwo :: Natural
twoTimesTwo = 2 * 2

-- test the overflow warning
minusOne :: Natural
minusOne = -1