The first question is here and I just want the preface that I made several queries, and although I found several questions that were formulated similarly, I did not find any that would ask or answer the question that I have (as far as I can judge).
I work in SML on assignment for a class, so I'm going to leave some details to solve this problem myself. I have the following type defined in SML:
- type Env = string -> int;
In essence, it is assumed that the Env type is a function that allows mapping from string to int - this is a simple environment diagram. Itβs trivial to create a function that does this, that is:
- fun foo (s:string) = 10; (*simple example*)
But is there a way to declare this function as an "Env type"? The reason is that I need to create a function whose return value is a function of type Env, and I have no idea how to do this. I know that SML allows type smoothing, and I think that means that technically any function that has a type string -> int
will be synonymous with Env type for the program, but I would like something more explicit.
If you need clarification, please ask and I will try to be more concise.
source
share