blob: 038290389effba8f5c7ef45a48bdaaaacfd641ad (
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
27
|
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}
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
|