blob: 090db8de229cc5fa1bec59fae6502ebd4bd3fe01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
{-# LANGUAGE ConstrainedClassMethods #-}
module Main where
class C a where
op :: (Show a, Show b) => a -> b -> String
-- This class op adds a constraint on 'a'
-- In GHC 7.0 this is fine, and it's a royal
-- pain to reject it when in H98 mode, so
-- I'm just allowing it
instance C Int where
op x y = show x ++ " " ++ show y
main = print (op (1::Int) 2)
|