cryptol/tests/mono-binds/test01.icry.stdout
Adam C. Foltzer 284338c938 Add the mono-binds flag
When `:set mono-binds=on`, any local definitions lacking type
signatures will not be generalized (i.e., will be monomorphic). This
reduces what is in most cases unnecessary polymorphism that can give
rise to constraints that are difficult to solve. This also improves
the performance of the Cryptol interpreter by lifting many polymorphic
type applications out of the inner loops that are commonly defined as
bindings in `where` clauses.

The flag is on by default in the Cryptol REPL, and in most cases makes
it possible to leave out more type signatures in `where` clauses than
before. However, some programs really do rely on inferring polymorphic
types for local variables; in this case adding an explicit polymorphic
type signature to the local binding in question will make the program
typecheck.
2014-12-15 17:48:25 -08:00

34 lines
854 B
Plaintext

Loading module Cryptol
Loading module Cryptol
Loading module test01
module test01
import Cryptol
/* Not recursive */
test01::a : {a, b} (fin b) => [b]a -> [2 * b]a
test01::a = \{a, b} (fin b) ->
(\ (x : [b]a) ->
f b x
where
/* Not recursive */
f : {c} [c]a -> [b + c]a
f = \{c} (y : [c]a) -> (#) b c a <> x y
) : [b]a -> [2 * b]a
Loading module Cryptol
Loading module test01
module test01
import Cryptol
/* Not recursive */
test01::a : {a, b} (fin a) => [a]b -> [2 * a]b
test01::a = \{a, b} (fin a) ->
(\ (x : [a]b) ->
f x
where
/* Not recursive */
f : [a]b -> [a + a]b
f = \ (y : [a]b) -> (#) a a b <> x y
) : [a]b -> [2 * a]b