<div dir="ltr">Hello, cafe!<div><br></div><div><div>If we have many constraints then compiling is sometimes too slow. Especially if there are some type calculations.</div><div>And I don't know how to divide this time among different source files because all constraints are checked only when we call a function.</div><div><br></div><div>I tried to add constraint info into argument definition instead of the function signature but this trick is not working (see below).</div></div><div><br></div><div><div>Is it (at least theoretically) possible to infer the constraint inside a function from the type of function's argument?</div></div><div><br></div><div><div>------------------------------------</div><div>$ stack ghci<br></div><div> ---- GHCi, version 8.0.2: <br></div><div>Prelude> import Data.Proxy<br></div><div>Prelude Data.Proxy> import GHC.TypeLits</div><div>Prelude Data.Proxy GHC.TypeLits> :set -XRankNTypes</div><div>Prelude Data.Proxy GHC.TypeLits> let { f :: (KnownSymbol n => Proxy n) -> String; f = symbolVal }</div><div><br></div><div><interactive>:4:54: error:</div><div>    • No instance for (KnownSymbol n) arising from a use of ‘symbolVal’</div><div>      Possible fix:</div><div>        add (KnownSymbol n) to the context of</div><div>          the type signature for:</div><div>            f :: (KnownSymbol n => Proxy n) -> String</div><div>    • In the expression: symbolVal</div><div>      In an equation for ‘f’: f = symbolVal</div></div><div><div>------------------------------------</div></div><div><br></div><div>Best regards,</div><div>Dmitry</div><div><br></div></div>