Currently, I have a little fun with the ability to remove the level of indirection from all canceled, but types of type newtype (single constructor with one argument) in Haste ; for example, it Intgets simple numberas a representation at runtime (i.e. 42), and not an array containing the constructor tag, and the number that is currently executing (i.e. [0,42]).
However, the GHC seems to optimize conversions between types that have an identical representation at runtime, which violates this scheme. Consider the following:
data Integer = Small Int
data Int = I
convert :: Int -> Integer
convert (I
Here's how the types Integerand Intare determined by GHC. Now Smallthey I#will have the same constructor tags, which means that for small values Integerthey Intwill have the same representation of the execution time. This way, the function convertcan be reasonably optimized, and it really seems that the GHC does just that, in some cases.
When the runtime representation Intchanges in the same way as the value Int#, this optimization is obviously no longer valid. Since I can remove the level of indirection from all types that are not needed, this will be a pretty big win, I would really like to know:
a) GHC ( , base integer-gmp, );
) , ?