You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ sml -Cprint.depth=20
- CM.make "sources.cm";
- open Terms;
opening Terms
val predef : TypeEnv.ty
val identity : ty
val constant : ty
val compose : ty
val counter : ty
val add10 : ty
val isZero : ty
val letTerm : ty
val letPolymorphism : ty
val closureLetPolymorphism : Term.ty
-
- Infer.typeSignature identity predef;
val it = "forall a. a -> a" : string
-
- Infer.typeSignature constant predef;
val it = "forall ab. a -> b -> a" : string
-
- Infer.typeSignature compose predef;
val it = "forall abc. (c -> b) -> (a -> c) -> a -> b" : string
-
- Infer.typeSignature letPolymorphism predef;
val it = "int" : string
Using MLton:
$ mlton -output infer sources.mlb
$ ./infer
forall abc. (c -> b) -> (a -> c) -> a -> b
Corner Case
(* Haskell let x1 = \y -> \z -> (z y) y in let x2 = \z -> x1 (x1 z) in let x3 = \z -> x2 (x2 z) in let x4 = \z -> x3 (x3 z) in x4 (\z -> z)*)letval x1 = fn y => fn z => (z y) y
inletval x2 = fn z => x1 (x1 z)
inletval x3 = fn z => x2 (x2 z)
inletval x4 = fn z => x3 (x3 z)
in
x4 (fn z => z)
endendendend