evancz/Elm — pull request #439 by maxsnew (2014-01-03 09:06:23+00:00)
Title: Hack to make imported names safe.

This fixes a bug where imported identifiers with reserved names were
not being changed during codegen:

Define a module exporting something like `int`/`float`/`elm` or the like
```haskell
module Module where
int x = x + 1
```
and import it:
```haskell
module Main where
import open Module
main = asText (int 1)
```
And get a runtime error:
```haskell
Module.int is not a function
Open the developer console for more details.
```

The fix is a bit of a hack, a nicer fix would be to have an identifier type, something like (but probably not exactly):
```haskell
data IdTok = Op String | Alpha String
data Id = DottedId IdTok [IdTok]
```
to represent that an identifier can be a module import/record reference. This would enable the compiler to avoid the string munging that we see in the codegen and now IR transform phases and also prevent future bugs resulting from messing up string munging. I haven't done it yet bc that would touch a lot of code.