[Haskell-cafe] carry "state" around ....
Galchin, Vasili
vigalchin at gmail.com
Mon Jul 28 22:14:56 EDT 2008
ok guys .. what is this "phantom type" concept? Is it a type theory thing or
just Haskell type concept?
Vasili
On Mon, Jul 28, 2008 at 8:53 PM, Bryan Donlan <bd at fushizen.net> wrote:
> 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 :)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080728/f4a469c0/attachment.htm
More information about the Haskell-Cafe
mailing list