[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] semantics of type synonym

Subject: Re: [Haskell-cafe] semantics of type synonym
From: Miguel Mitrofanov
Date: Tue, 29 Dec 2009 18:45:16 +0300
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)
Exactly the same. You can take a term of one of these types and feed it to the 
function expecting another, and visa versa.

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
They are.


pbrowne wrote:
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:
Haskell-Cafe mailing list
[email protected]

Haskell-Cafe mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>