-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Labels
bugSomething not working correctlySomething not working correctlyparameterized modulesRelated to Cryptol's parameterized modulesRelated to Cryptol's parameterized modules
Description
parameterized.cry:
module parameterized where
parameter
type A : #
type B : #
f : [A] -> [B]
instantiation.cry:
module instantiation = parameterized where
type A = 2
type B = 2
f x = x
I expected this to make f monomorphic, e.g. as f : [2] -> [2], but it loads as:
$ cryptol-2.7.0-CentOS7-64/bin/cryptol
version 2.7.0
Loading module Cryptol
Cryptol> :l instantiation.cry
Loading module Cryptol
Loading module parameterized
Loading module instantiation
instantiation> :t f
f : {a} a -> a
With other definitions of f appropriate for the A and B set in the instantiation, I get more polymorphic types that seem to be inferred from the function's definition instead of using the type declared in the parameterized module, f : [A] -> [B].
While trying other definitions, I also encountered the following crash.
parameterized.cry: as above
crash.cry: (note the incorrect definitions of A and B)
module crash = parameterized where
A = 2
B = 2
f x = take`{2} x
This will cause the crash:
$ cryptol-2.7.0-CentOS7-64/bin/cryptol
version 2.7.0
Loading module Cryptol
Cryptol> :l crash.cry
Loading module Cryptol
Loading module parameterized
Loading module crash
cryptol: You have encountered a bug in Cryptol's implementation.
*** Please create an issue at https://github.com/GaloisInc/cryptol/issues
%< ---------------------------------------------------
Revision: UNKNOWN
Branch: UNKNOWN
Location: Cryptol.TypeCheck.Monad.extendSubst
Message: Escaped quantified variables:
Substitution: ?crash::f_1`850 := parameterized::A - 2
Vars in scope: []
Escaped: [parameterized::A]
CallStack (from HasCallStack):
panic, called at src/Cryptol/Utils/Panic.hs:21:9 in cryptol-2.7.0-B2fyIqbCot160gS325LyBV:Cryptol.Utils.Panic
panic, called at src/Cryptol/TypeCheck/Monad.hs:559:16 in cryptol-2.7.0-B2fyIqbCot160gS325LyBV:Cryptol.TypeCheck.Monad
%< ---------------------------------------------------
$
However, using other definitions of f sometimes only produces errors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething not working correctlySomething not working correctlyparameterized modulesRelated to Cryptol's parameterized modulesRelated to Cryptol's parameterized modules