[Haskell-cafe] Type without a data constructor?

Rahul Kapoor rk at trie.org
Mon Aug 6 19:23:43 EDT 2007

Most examples for defining algebraic types include data constructors like so:

data Tree a = Tip | Node a (Tree a) (Tree a)

I by mistake defined a type which did not specify a data constructor :

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!).

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


More information about the Haskell-Cafe mailing list