[Haskell] Haskell type containing no non-_|_ values?

Janis Voigtlaender voigt at tcs.inf.tu-dresden.de
Fri Mar 26 13:43:25 EST 2004


probably a trivial question: Is there a type in Haskell that contains
only the undefined value _|_?

The polymorphic type (forall a. a) has this property, but it seems it
cannot be used, e.g., in a tuple:

> x :: (Int,(forall a. a))
> x = (3,undefined)

leads to errors both in Hugs and GHC.

I guess I can help myself out using newtype:

> newtype T = T (forall a. a)

> x :: (Int,T)
> x = (3,undefined)

but would like to do without. Is there a way?

Thanks, Janis.

Janis Voigtlaender
mailto:voigt at tcs.inf.tu-dresden.de

More information about the Haskell mailing list