summaryrefslogtreecommitdiff
path: root/testsuite/tests/backpack/should_run/T13955.bkp
blob: a7d447f1696d3a39c5a6ca8529a392810966f096 (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
41
42
43
44
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}

unit number-unknown where
  signature NumberUnknown where
    import GHC.Types
    data Rep :: RuntimeRep
    data Number :: TYPE Rep
    plus :: Number -> Number -> Number
    multiply :: Number -> Number -> Number
  module NumberStuff where
    import NumberUnknown
    funcA :: Number -> Number -> Number
    funcA x y = plus x (multiply x y)

unit number-int where
  module NumberUnknown where
    import GHC.Types
    type Rep = LiftedRep
    type Number = Int
    plus :: Int -> Int -> Int
    plus = (+)
    multiply :: Int -> Int -> Int
    multiply = (*)

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 = (+#)
    multiply :: Int# -> Int# -> Int#
    multiply = (*#)

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#))