First question here and just want to preface that I did several queries and while I found multiple questions that were worded similarly I found none that were asking, or answering, the question I have (as far as I can tell).
I'm working in SML on an assignment for class so I'm going to leave some details out so I can resolve the issue myself. I have the following type defined in SML:
- type Env = string -> int;
Essentially, the Env type is supposed to be a function that allows mapping from a string to an int - it's a simple environment scheme. It is trivial enough to create a function that does this, i.e.:
- fun foo (s:string) = 10; (*simple example*)
But is there a way to actually declare this function as a "Env type"? The reason is eventually I need to create a function whose return value is an Env type function and I have no idea how to perform this. I'm aware SML allows type aliasing and I think this means that technically any function which has the type string -> int
would be synonymous with the Env type to the program, but I would like something more explicit.
If clarification is needed please ask and I will attempt to be more concise.