summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T15232.hs
blob: ec7659ac3891dd3edc19beec13be612f9d161883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wredundant-constraints -Wall -Werror #-}
import GHC.TypeLits (TypeError, ErrorMessage(..))

class C a where f :: a -> a
instance {-# OVERLAPPING #-} C Int where f _ = 42
instance {-# OVERLAPPABLE #-} TypeError ( 'Text "Only Int is supported" ) => C a where f = undefined

main :: IO ()
main = print $ f (42::Int)