For the below program,   ghc-4  -c -fglasgow-exts Main.hs
                         ghc-4  -o run            Main.o
                         ./run
yields
         `run: fatal error: No threads to run!  Deadlock?'

instead of infinite recursion for the value of `s' - the latter has to
overflow the stack.
Commenting out (the dummy) operation cv in the class C, returns to the
correct behaviour.

Another point.
Some slight changes of this program caused a strange warning,
something near
        ghc123.*  ..closure as static but referred ..in.. as dynamic..

May this present a danger of another bug?
Tell me, if yes, i would recall the program.

--------------------------------------------------------------------
class C a b  where  cvm :: a -> b -> Maybe b
                    cv  :: a -> b -> b

instance C Char Char where  cvm x _ = Just x

instance C a b => C a [b]  where
                   cvm a (b:_) = case cvm a b of  Just c -> Just [c]

main =  let  Just s = cvm ('a') s  :: Maybe [Char]
        in
        putStr (shows s "\n")

Reply via email to