[Haskell-cafe] data Bin = Zero | One

PR Stanley prstanley at ntlworld.com
Thu Oct 18 23:05:59 EDT 2007


>Hi

>data Bin = Zero | One
As suggested by someone on this list. It's a really neat idea 
although I'm wondering how I can apply this to my int to binary 
function. The Zero or One declaration is saying that Bin is a data 
type that can hold either a one or a zero. I tried testing this with 
a very simple Bin -> Bin function and the Integral values 0 and 1 but 
ran into difficulties.
Any ideas what I'm doing wrong here?
Incidentally, does the general syntax above come from the old BNF notation?
Cheers, Paul



More information about the Haskell-Cafe mailing list