blob: 314aa89c56f0d820e55f230440a7f6ea35e696db (
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.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 = wordToNatural 10
-- test basic constant folding for Natural
twoTimesTwo :: Natural
twoTimesTwo = 2 * 2
-- test the overflow warning
minusOne :: Natural
minusOne = -1
|