summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/T2448.hs
blob: 8c3744340efe96fec83281d98dd2a115678545a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# LANGUAGE TypeFamilies, UndecidableInstances #-}

module T2448 where

import Data.Kind (Type)

-- Demonstrates a bug in propagating type equality constraints

class VectorSpace v where
  type Scalar v :: Type

class VectorSpace v => InnerSpace v

instance (VectorSpace u,VectorSpace v, Scalar u ~ Scalar v) => 
  VectorSpace (u,v) 
  where
  type Scalar (u,v) = Scalar u

instance (InnerSpace u,InnerSpace v, Scalar u ~ Scalar v) => InnerSpace (u,v)