On 09-Mar-2003, Hal Daume III [EMAIL PROTECTED] wrote:
well, yes, but if you export:
mkN :: Int - N
mkD :: Int - D
or something like that, then they'll still bea ble to tell the difference,
right?
Not necessarily. For example mkD could be defined as
mkD x = x `seq` D x
in
Hal Daume III wrote:
| there is a difference between
|
| (N undefined) `seq` ()
|
| and
|
| (D undefined) `seq` ()
The question stated without its constructor. My guess is
no.
/K
___
Haskell mailing list
[EMAIL PROTECTED]
my guess is no too. An informal argument to that: imagine the
datatype is abstract and no functions which act on it are exported
.call it 'Type'. since there are no non-bottom values of this type that
are exported, the only way to create them is with bottom as in:
(undefined :: Type) (or an
On Sun, 9 Mar 2003, Hal Daume III wrote:
well, yes, but if you export:
mkN :: Int - N
mkD :: Int - D
or something like that, then they'll still bea ble to tell the difference,
right?
Well, yes, but I don't. In fact the type in question is an MVar which my
abstraction ensures is always
Dean Herington writes:
:
| My question came up in the context of describing such an abstract type for
| users of the type. Like many others, I like to include actual Haskell
| code where appropriate in the documentation. It didn't seem right to
| commit there to either `data` or `newtype`.
If a type that could be defined either by `data` or `newtype` (i.e., a
single-constructor type) is exported abstractly (without its constructor),
can the user of the type tell how the type was declared?
Dean
___
Haskell mailing list
[EMAIL PROTECTED]
yes.
data D = D Int
newtype N = N Int
there is a difference between
(N undefined) `seq` ()
and
(D undefined) `seq` ()
there has been a lot of discussion about this on the mailing list,
probably under a title of something like difference between data and
newtype.
--
Hal Daume III