summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_run/T7126.hs
blob: 184d5df1f077989d01ec2149a486f77d3aa41840 (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, UndecidableInstances #-}

module Main where

main :: IO ()
main =  do
  let k1 = func1 1 :: Int
  print $ show k1
  let k2 = outer :: Int
  print $ show k2

outer :: Class3 a => a
outer = func1 1

class Class1 a where
  func1 :: Int -> a

class Class1 a => Class2 a where
  func2 :: Int -> a

class Class2 a => Class3 a where
  func3 :: Int -> a

instance Class1 Int where
  func1 = id

instance (Class1 a, Class3 a) => Class2 a where
  func2 = func3

instance Class3 Int where
  func3 = id

--
-- "1"
-- tests: <<loop>>