[Haskell-cafe] newtype is superfluous
Simon Marlow
simonmar at microsoft.com
Mon Oct 17 06:36:45 EDT 2005
On 15 October 2005 19:08, Bulat Ziganshin wrote:
> Hello Lennart,
>
> Saturday, October 15, 2005, 5:03:50 PM, you wrote:
>
>> Alas, Haskell is more subtle than that. Which is why newtype exists.
>
>> Try
>> case A _|_ of A _ -> 1
>> with the two versions of A to see the difference.
>
> this have practical usage?? may be for such very special things
> strictness annotation will be enough??
The semantics of newtype are really decided by its implementation. The
basic idea is that a newtype of T can be represented in the same way as
T. Once you know this, it pretty much fixes what semantics you can
expect - the semantics of a newtype of T must be the same as T, because
the runtime cannot distinguish the two.
Cheers,
Simon
More information about the Haskell-Cafe
mailing list