[Haskell-cafe] Re: Type without a data constructor?

Aaron Denney wnoise at ofb.net
Mon Aug 6 19:52:34 EDT 2007

On 2007-08-06, Rahul Kapoor <rk at trie.org> wrote:
> I by mistake defined a type which did not specify a data constructor :

No, you didn't.  Both types have data constructors.

> data SearchCondition = Term Bool | SearchCondition :||: (Term Bool)
> data Term a = Constant a
> sc :: SearchCondition
> sc = Term True
> is ok, but
> sc :: SearchCondition
> sc = Constant True
> is not (though this is what I intended to capture!).

The problem is that Constant True is of type Term Bool, rather than
SearchCondition.  Constructors and names of data types live in separate

> So the question is what are types with no constructors good for? A
> simple example would be appreciated.

See the phantom types answer that someone else gave.

Aaron Denney

More information about the Haskell-Cafe mailing list