| 1 | {-# OPTIONS_GHC -fglasgow-exts #-} |
|---|
| 2 | import Control.Monad.ST |
|---|
| 3 | import Data.STRef |
|---|
| 4 | |
|---|
| 5 | data Q s a chain = Node s a chain |
|---|
| 6 | |
|---|
| 7 | data Z a = Z a |
|---|
| 8 | val :: STRef s a -> ST s a |
|---|
| 9 | val = undefined |
|---|
| 10 | |
|---|
| 11 | s :: Q t (Z [Char]) t1 -> [Char] |
|---|
| 12 | s = undefined |
|---|
| 13 | |
|---|
| 14 | r :: a -> STRef s a |
|---|
| 15 | r = undefined |
|---|
| 16 | |
|---|
| 17 | class Zork s a b | a-> b where |
|---|
| 18 | huh:: STRef s (Q s a chain) -> ST s () |
|---|
| 19 | |
|---|
| 20 | foo k = do |
|---|
| 21 | t <- val k |
|---|
| 22 | |
|---|
| 23 | let ref_b = r t |
|---|
| 24 | |
|---|
| 25 | b <- val ref_b |
|---|
| 26 | let abc = s b |
|---|
| 27 | huh ref_b |
|---|
| 28 | -- foo :: (Zork t (Z [Char]) ()) => STRef t (Q t (Z [Char]) t1) -> ST t () when let abc = s b is not commented and foo :: (Zork s a b) => STRef s (Q s a chain) -> ST s () when it is commented. Why? |
|---|