Testsuite: tabs -> spaces [skip ci]
[ghc.git] / testsuite / tests / typecheck / should_compile / T4361.hs
1 {-# OPTIONS_GHC -Wno-redundant-constraints -Wno-simplifiable-class-constraints #-}
2 {-# LANGUAGE FlexibleContexts #-}
3
4 -- This test comes from Sergei Mechveliani's DoCon system
5
6 module Pol3_ (moduloBasisx) where
7
8 class CommutativeRing a
9 class CommutativeRing a => LinSolvRing a
10 class LinSolvRing a => EuclideanRing a
11
12 instance EuclideanRing a => LinSolvRing (Pol a) -- XXXX
13 instance CommutativeRing a => CommutativeRing (Pol a)
14
15 data Pol a = MkPol
16
17 upLinSolvRing :: LinSolvRing a => a -> ()
18 upLinSolvRing = undefined
19
20 moduloBasisx :: (LinSolvRing (Pol a), CommutativeRing a) => Pol a -> ()
21 moduloBasisx p = let x :: ()
22 x = upLinSolvRing p
23 in ()
24
25 -- This is very delicate! The contraint (LinSolvRing (Pol a))
26 -- arises in the RHS of x, and we must be careful *not* to simplify
27 -- it with the instance declaration "XXXX", else we get the
28 -- unsatisfiable constraint (EuclideanRing a). In effect, the
29 -- given constraint in the type sig for moduleBasisx overlaps
30 -- with the top level declaration.
31