Is there a single word that means "non-recursive data type with two constructors"?

Is there a word describing data types that

  • have exactly two constructors; and
  • are not recursive?

i.e. describes these types

data Bool = False | True data Maybe a = Nothing | Just a data Either lr = Left l | Right r 

but excludes these types

 data Ordering = LT | EQ | GT -- too many constructors data () = () -- too few constructors data [a] = a | a : [a] -- recursive definition 
+4
source share
4 answers

I think a feature that has exactly two constructors is completely pointless. Imagine Types:

 data StrictOrdering = LT | GT data Ordering' = EQ | NEQ !StrictOrdering 

Ordering' type is equivalent to the mentioned Ordering , differing only in "2-construction".

On the other hand, Maybe Bool , Either Bool Bool and Bool very different and do not seem to deserve the same name, except that they are called sum types.

Now you can find some similarities between exists a. Maybe a exists a. Maybe a and Bool , but to specify them you need more restrictions than just "2-constructivity".

+3
source

โ€œThe presence of two constructorsโ€ is a property that does not contain information about what can be represented by this type. This means that weak-normal form (WHNF) forcing allows for binary selection in the case statement. Perhaps you could call it "Two Headed Type" to expose a phrase.

This is more useful for the GHC as a way to create an optimized representation in RAM for data, because the GHC uses pointer marking , which helps types up to 4 constructors (or 8 on 64-bit machines).

+2
source

What about the non-recursive two-line type sum?

+1
source

What about the binary type of sum / coprocess (two types)?

0
source

All Articles