<div dir="ltr">On Saturday, April 16, 2016 at 10:10:37 PM UTC+2, Roman Cheplyaka wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 04/16/2016 10:22 PM, Alexey Muranov wrote:
<br>> Could you show me, please, how to use scoped type variables to avoid MR
<br>> in this example?
<br>
<br>All MR does is it prevents a binding from being generalized. Another way to achieve
<br>that would be to give that binding a (monomorphic) type signature. Without
<br>scoped t.v., you can't give a signature to 'len' while keeping 'f' polymorphic
<br>in the return type. With scoped t.v., you can:
<br>
<br>  f :: forall a b . Num a => [b] -> (a,a)
<br>  f xs = (len, len)
<br>      where
<br>          len :: a
<br>          len = genericLength xs
<br></blockquote><div><br></div><div>Great, thanks for the explanation (i'll think about it).  If i have understood correctly, having scoped type variables, MR is no longer needed at all then.</div><div><br></div><div>Alexey.</div></div>