[Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Branimir Maksimovic
In C usual way is to set some bit in integer variable by shifting or oring,and than check flag integer variable by anding with particular flag value.What is Haskell way? Thanks. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread mukesh tiwari
The same as C way. You can import Data.Bits and can use the functions. Prelude import Data.Bits Prelude Data.Bits Data.Bits. Data.Bits... Data.Bits.bitDefault Data.Bits.complementBit Data.Bits.rotate Data.Bits.shift Data.Bits.testBitDefault Data.Bits..|.Data.Bits.bitSize

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Donn Cave
Quoth Branimir Maksimovic bm...@hotmail.com, In C usual way is to set some bit in integer variable by shifting or oring, and than check flag integer variable by anding with particular flag value. What is Haskell way? Of course you may do the very same thing, if you like. I think if there's

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Brandon Allbery
On Tue, Feb 19, 2013 at 10:11 AM, Branimir Maksimovic bm...@hotmail.comwrote: In C usual way is to set some bit in integer variable by shifting or oring, and than check flag integer variable by anding with particular flag value. What is Haskell way? You can do that, but a somewhat more

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Ertugrul Söylemez
Brandon Allbery allber...@gmail.com wrote: In C usual way is to set some bit in integer variable by shifting or oring, and than check flag integer variable by anding with particular flag value. What is Haskell way? You can do that, but a somewhat more idiomatic way would be a list (or,