summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/tc224.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/tc224.hs')
-rw-r--r--testsuite/tests/typecheck/should_compile/tc224.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/tc224.hs b/testsuite/tests/typecheck/should_compile/tc224.hs
new file mode 100644
index 0000000000..34df398e2b
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/tc224.hs
@@ -0,0 +1,26 @@
+{-# OPTIONS_GHC -XOverloadedStrings #-}
+module T where
+
+import Data.String
+
+newtype MyString = MyString String deriving (Eq, Show)
+instance IsString MyString where
+ fromString = MyString
+
+greet1 :: MyString -> MyString
+greet1 "hello" = "world"
+greet1 other = other
+
+greet2 :: String -> String
+greet2 "hello" = "world"
+greet2 other = other
+
+greet3 :: (Eq s, IsString s) => s -> s
+greet3 "hello" = "world"
+greet3 other = other
+
+test = do
+ print $ greet1 "hello"
+ print $ greet2 "fool"
+ print $ greet3 ("foo" :: String)
+ print $ greet3 ("bar" :: MyString)