
On Sun, Aug 10, 2014 at 2:20 PM, martin
but when I replace xxx by myStep pState as in
exProcess2 pState loc = LP {lstep = myStep pState} where xxx = myStep pState myStep _ = return $ \(E t l _) -> ([E (t+1) l Wakeup], (proc' pState)) proc' state = exProcess2 (trc state) loc
I get
No instance for (Monad m0) arising from a use of `myStep' The type variable `m0' is ambiguous Possible fix: add a type signature that fixes these type variable(s)
It compiles again when I remove the xxx = line. Why is that so?
It has to assign some kind of concrete type to `xxx`. If you are using it as in the example I elided, it has enough information to type it; if you do not have it at all, it obviously does not need to type it; if you define it but do not use it, it doesn't know it should ignore the definition (being an unused local binding, this is safe) and dies trying to infer a type for it anyway. Referential transparency is not involved (except perhaps incidentally). If there is a bug here, it is that it doesn't recognize that it should simply drop/ignore (with a warning) the definition of `xxx` because it's not reachable. Arguably, however, that is programmer error. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net