[Haskell-cafe] Irritating Referential Transparency behavior?

Albert Y. C. Lai trebla at vex.net
Sun Aug 10 18:52:21 UTC 2014


On 14-08-10 02:20 PM, martin wrote:
> exProcess2 pState loc = LP {lstep = xxx}
>          where
>              xxx = myStep pState

vs

> exProcess2 pState loc = LP {lstep = myStep pState}
>          where
>              xxx = myStep pState

The monomorphism restriction requires assigning a monomorphic 
(non-polymorphic) type to xxx. The assignment could come from declaring 
xxx's type (which you didn't do) or inferring from use sites (which you 
had in one example but not in another). When both are lacking, a job 
that needs done can't be done, and it is an error.



More information about the Haskell-Cafe mailing list