summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T4444.hs
blob: 5f07d5d71daf37d5b43dc2618a712097d28a6cd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

-- #4444: We shouldn't warn about SPECIALISE INLINE pragmas on
--        non-overloaded functions

{-# LANGUAGE GADTs, MagicHash #-}
module Q where

import GHC.Exts

data Arr e where
  ArrInt :: !Int -> ByteArray# -> Arr Int
  ArrPair :: !Int -> Arr e1 -> Arr e2 -> Arr (e1, e2)

(!:) :: Arr e -> Int -> e
{-# SPECIALISE INLINE (!:) :: Arr Int -> Int -> Int #-}
{-# SPECIALISE INLINE (!:) :: Arr (a, b) -> Int -> (a, b) #-}
(ArrInt _ ba)     !: (I# i) = I# (indexIntArray# ba i)
(ArrPair _ a1 a2) !: i      = (a1 !: i, a2 !: i)