Haskell.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview
thread

Re:

Martin Norbäck

25 Jan 2002 25 Jan '02
8:12 a.m.

fre 2002-01-25 klockan 08.27 skrev David Feuer:

...

Martin Said:

...

Those two constructs are not the same

...

Compare

...

newtype T1 = C1 Bool data T2 = C2 !Bool

...

The report says clearly that for a newtype like T1, C1 _|_ = _|_ This is the same as for T2 and C2.

No. C1 _|_ is the same as _|_ representation-wise (not type-wise). C2 _|_ is C2 _|_. If you imagine the computer's memory, when you store the value (C1 True) you just store (True). When you store the value (C2 True) you store (C2 True). So you can't choose whether to match strictly or lazily on C1, because you don't match on C1, because C1 is never stored in memory. It's simply a typing trick. That's why it's more efficient to use newtype than data. You don't need to handle the constructor because the type-checker removes all traces of it. Regards, Martin -- [ http://www.dtek.chalmers.se/~d95mback/ ] [ PGP: 0x453504F1 ] [ UIN: 4439498 ] Opinions expressed above are mine, and not those of my future employees. SIGBORE: Signature boring error, core dumped

0 0
Reply
Sign in to reply online Use email software

Back to the thread

Back to the list

HyperKitty Powered by HyperKitty version 1.3.12.