ndmitchell:
> Hi
> 
> > > Are there binary constants in Haskell, as
> > > we have, for instance, 0o232 for octal and
> > > 0xD29A for hexadecimal?
> >
> > No, though it is an interesting idea.
> 
> You can get pretty close with existing Haskell though:
> 
> (bin 100010011)
> 
> where bin :: Integer -> Integer, and is left as an exercise for the
> reader. Obviously its not as high performance, as proper binary
> literals, but if you write them as top-level constants, they'll only
> be computed once and shouldn't end up being in the performance
> critical bits.

And the call to `bin' be lifted into the Num class I suspect... leading
to raw binary literals, using overloaded literal syntax.

So I guess we do have binary literals then.

-- Don
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to