[Haskell-cafe] carry "state" around ....

Bryan Donlan bd at fushizen.net
Mon Jul 28 21:53:37 EDT 2008


On Mon, Jul 28, 2008 at 08:48:23PM -0500, Galchin, Vasili wrote:
> what does a datatype with no constructors mean?
> 
> E.g.
> 
> data RSAStruct
> data EVP_PKEY
> data EVP_CIPHER
> data EVP_CIPHER_CTX
> data EVP_MD_CTX
> data EVP_MD
> data BIGNUM

It's simply a datatype that can never have a value - a so-called
'phantom type'. They're useful when you need a type (eg as the argument
for a ForeignPointer) but no need for an actual value.

You can of course create values of these types using 'undefined',
'error' and friends, but this is perhaps not very useful most of the
time :)


More information about the Haskell-Cafe mailing list