summaryrefslogtreecommitdiff
path: root/testsuite/tests/rep-poly/RepPolyBackpack4.bkp
blob: 8f151278cb3da34802e376ce61c064ea6f9fe989 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE UnboxedTuples #-}

unit number-unknown where
  signature NumberUnknown where
    import GHC.Types
    import GHC.Exts
    data Rep :: RuntimeRep
    data Number :: TYPE Rep
    plus :: Number -> Number -> Number
  module NumberStuff where
    import NumberUnknown
    funcA :: (# Number, Number #) -> (# Number, Number #) -> Number
    funcA (# x1, x2 #) _ = plus x1 x2

unit number-int where
  module NumberUnknown where
    import GHC.Types
    type Rep = 'BoxedRep 'Lifted
    type Number = Int
    plus :: Int -> Int -> Int
    plus = (+)

unit number-unboxed-int where
  module NumberUnknown where
    import GHC.Types
    import GHC.Prim
    type Rep = IntRep
    type Number = Int#
    plus :: Int# -> Int# -> Int#
    plus = (+#)

unit main where
  dependency number-unknown[NumberUnknown=number-unboxed-int:NumberUnknown]
  module Main where
    import NumberStuff
    import GHC.Types
    main = print (I# (funcA (# 2#, 3# #) (# 4#, 5# #)))