summaryrefslogtreecommitdiff
path: root/testsuite/tests/backpack/should_run/T20133.bkp
blob: 304f857ae96c6eafdd2dd14ac29324577fdaaa1e (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
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}

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

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

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