summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T14732.hs
blob: d0c6a8b4651ec2b0efa6898467725065b4da5459 (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
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# OPTIONS_GHC -fdefer-type-errors -O #-}
-- Oddly this bug was only triggered with -fdefer-type-errors
-- The -O ensures that the RULE is processed

module T14732 where

import Prelude hiding (zip, zipWith)
import Data.Kind (Type)

zipWith :: (a -> b -> c)
        -> Bundle v a
        -> Bundle v b
        -> Bundle v c
zipWith = undefined

class GVector (v :: Type -> Type) a
instance GVector Vector a

data Bundle (v :: Type -> Type) a
data Vector a
class Unbox a

stream :: GVector v a => v a -> Bundle v a
{-# INLINE [1] stream #-}
stream = undefined

zip :: (Unbox a, Unbox b) => Vector a -> Vector b -> Vector (a, b)
{-# INLINE [1] zip #-}
zip = undefined
{-# RULES "stream/zip [Vector.Unboxed]" forall as bs .
  stream (zip as bs) = zipWith (,) (stream as)
                                   (stream bs)   #-}