# 049: countextorder1.hs [↑up](bunny_notes) - issued: 2020-04-28 - 分類: A サンプルコードが fail - status: Open ## 概要 instance 宣言の context と型に出現する型変数の順番に関するもの。 まず、一致する場合。 $$
{
instance (Show a, Show b) => Show (Pair a b) where
show (Pair x y) = "Pair " ++ show x ++ " " ++ show y
main = print (Pair 1 'x')
$$}
これは正しく動いた。
## 調査ログ
### 2021-10-24
ひさびさなので、状況の確認:
$${
unno@unno-FMVD70GN7G ~/work/bissues/049
$ cat contextorder1.hs
data Pair a b = Pair a b
instance (Show a, Show b) => Show (Pair a b) where
show (Pair x y) = "Pair " ++ show x ++ " " ++ show y
main = print (Pair 1 'x')
unno@unno-FMVD70GN7G ~/work/bissues/049
$ runhaskell contextorder1.hs
Pair 1 'x'
unno@unno-FMVD70GN7G ~/work/bissues/049
$ ~/prj/bunny/compiler/bin/bunny testrun contextorder1.hs
/home/unno/prj/bunny/compiler/bin/bunnyc -d ./jout/contextorder1 --xno-implicit-prelude /home/unno/prj/bunny/compiler/bin/../lib/Prelude.hs
/home/unno/prj/bunny/compiler/bin/bunnyc -d ./jout/contextorder1 --xlibrary-path /home/unno/prj/bunny/compiler/bin/../lib contextorder1.hs
Pair 1 'x'
$$}
じつは、testcases/ ディレクトリを廃止したのを忘れていて、確認のしかたがわかんなくて焦った。