Re: Haskell-98 Quiz

1999-04-23 Thread Christian Sievers
Magnus Carlsson wrote: > Here are some questions for the Haskell-98 enthusiasts. I'm not sure if I'm a Haskell-98 enthusiast, I still call myself a Haskell enthusiast. > 1. Why is the following declaration group illegal? > > f :: String > f = g 1 ++ g True > > g :: Show a => a -> Strin

Re: Type problem with ST monad

1999-04-23 Thread Olaf Chitil
Sigbjorn Finne wrote: > forwarding to the mailing list is restricted to off-hours only at the > moment, but thought I'd suggest a solution to you before then - use a > (universally quantified) pattern matching function rather than a > pattern binding, i.e., > > deTIM :: TIM s a -> ST s a > deTI

Haskell-98 Quiz

1999-04-23 Thread Magnus Carlsson
Here are some questions for the Haskell-98 enthusiasts. 1. Why is the following declaration group illegal? f :: String f = g 1 ++ g True g :: Show a => a -> String g x = fst (show x, show f) 2. Is there a way to modify the signatures to make it legal? /M

Type problem with ST monad

1999-04-23 Thread Olaf Chitil
Hi, I have a problem with defining a new monad based on the state monad ST. The new monad is a combination of ST and the Maybe monad. It is intended for computations that use many states and may fail. If a part of the computation fails the whole computation fails. (I want to use it for type inf

Error messages (was Re: Monad question)

1999-04-23 Thread Malcolm Wallace
Reg writes: > This little problem raises two challenges for compiler developers: > (a) improving diagnostic messages (a perennial issue), and (b) (semi) > automating error correction. In this case the diagnostic message > is pretty good, except that is doesn't indicate where the IO term > is or w