I am currently writing a programming language in Haskell. This programming language is similar to Factor, being a concatenative stack-based language. However, after getting quite far, I hit a brick wall: I have a Data.Map of type:
Map.Map String ([YodaVal] -> YodaVal, Int)
But I need the functions stored in the map to take the map as a parameter, so I can preserve environment when recursing, and also to possibly allow recursive function definitions, and recursive definitions of Haskell --> Yoda functions. However, the type would then look like:
type Env = Map.Map String ([YodaVal] -> Env -> [YodaVal] -> YodaVal, Int)
Which of course expands to:
Map.Map String ([YodaVal] -> Map.Map String ... -> [YodaVal] -> YodaVal, Int)