<div dir="ltr">Sorry, I didn't copy to cafe...<div><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Dmitry Olshansky</b> <span dir="ltr"><<a href="mailto:olshanskydr@gmail.com">olshanskydr@gmail.com</a>></span><br>Date: 2017-07-07 9:24 GMT+03:00<br>Subject: Re: [Haskell-cafe] constraint inference<br>To: Ivan Lazar Miljenovic <<a href="mailto:ivan.miljenovic@gmail.com">ivan.miljenovic@gmail.com</a>><br><br><br><div dir="ltr"><div><div>I am not sure why but when I didn't set RankNTypes I got an appropriate error. So I specified it.</div></div><div><br></div>But if I write<div>  let { f :: (forall n. KnownSymbol n => Proxy n) -> String; f p = symbolVal p }</div><div>then nothing is changed.</div><div><br></div><div><br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-07-07 9:11 GMT+03:00 Ivan Lazar Miljenovic <span dir="ltr"><<a href="mailto:ivan.miljenovic@gmail.com" target="_blank">ivan.miljenovic@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You've specified RankNTypes but aren't using it; did you mean "(forall<br>
n. KnownSymbol n => Proxy n)" ?<br>
<br>
Typically in these situations you also can't partially apply it, so<br>
you might need to make it "f p = symbolVal p".<br>
<div><div class="m_-4920582913115347583h5"><br>
On 7 July 2017 at 15:50, Dmitry Olshansky <<a href="mailto:olshanskydr@gmail.com" target="_blank">olshanskydr@gmail.com</a>> wrote:<br>
> Hello, cafe!<br>
><br>
> If we have many constraints then compiling is sometimes too slow. Especially<br>
> if there are some type calculations.<br>
> And I don't know how to divide this time among different source files<br>
> because all constraints are checked only when we call a function.<br>
><br>
> I tried to add constraint info into argument definition instead of the<br>
> function signature but this trick is not working (see below).<br>
><br>
> Is it (at least theoretically) possible to infer the constraint inside a<br>
> function from the type of function's argument?<br>
><br>
> ------------------------------<wbr>------<br>
> $ stack ghci<br>
>  ---- GHCi, version 8.0.2:<br>
> Prelude> import Data.Proxy<br>
> Prelude Data.Proxy> import GHC.TypeLits<br>
> Prelude Data.Proxy GHC.TypeLits> :set -XRankNTypes<br>
> Prelude Data.Proxy GHC.TypeLits> let { f :: (KnownSymbol n => Proxy n) -><br>
> String; f = symbolVal }<br>
><br>
> <interactive>:4:54: error:<br>
>     • No instance for (KnownSymbol n) arising from a use of ‘symbolVal’<br>
>       Possible fix:<br>
>         add (KnownSymbol n) to the context of<br>
>           the type signature for:<br>
>             f :: (KnownSymbol n => Proxy n) -> String<br>
>     • In the expression: symbolVal<br>
>       In an equation for ‘f’: f = symbolVal<br>
> ------------------------------<wbr>------<br>
><br>
> Best regards,<br>
> Dmitry<br>
><br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> Haskell-Cafe mailing list<br>
> To (un)subscribe, modify options or view archives go to:<br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/haskell-caf<wbr>e</a><br>
> Only members subscribed via the mailman list are allowed to post.<br>
<span class="m_-4920582913115347583HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Ivan Lazar Miljenovic<br>
<a href="mailto:Ivan.Miljenovic@gmail.com" target="_blank">Ivan.Miljenovic@gmail.com</a><br>
<a href="http://IvanMiljenovic.wordpress.com" rel="noreferrer" target="_blank">http://IvanMiljenovic.wordpres<wbr>s.com</a><br>
</font></span></blockquote></div><br></div>
</div></div></div><br></div></div>