[Haskell-cafe] semantics of type synonym
pbrowne
Patrick.Browne at comp.dit.ie
Tue Dec 29 10:38:14 EST 2009
Hi,
It seems that I need to distinguish between a theory for Haskell and a
given implementation (GHCi). I have two further queries based on the
replies;
1)
> Obviously I get two different types
> Wrong. You get exactly the same type, it's just that GHCi detected that you have a fancy name for this type, so it gives you that name. It's not type system, it's just GHCi.
Are you saying there is just one type? (not two isomorphic types because
there is only one of them with two names)
2)
>> In the case of the function Haskells type system seems to pick up enough
>> > information to determine that “ww” is a Name.
>
> Nope. "ww" is still a [Char] for the compiler. And you do not even check for
> the type of "ww".
>
> :t snd . (\x -> (getName x, x)) $ "ww"
> ... :: String
Why are the GHCi commands :t "ww" and :t getName("ww") not a valid type
checks?
Pat
pbrowne wrote:
> Hi,
> I am studying the underlying semantics behind Haskell and to what degree
> those semantics are actually implemented. I need to clarify what a *type
> synonym* actual means in relation to Haskell's logic (or formal
> semantics). I used the following type synonym:
More information about the Haskell-Cafe
mailing list