Library and FFI guys (esp Manuel)
| I can see Bool can be an instance of Bit but why does it
| need to be an instance of Num?
We can't remember who made the change or why. The advantage of making
Num a superclass of bits is that (as someone mentioned) it allows us to
give a default implementation of bit and
> testBit:
>
> bit i = 1 `shift` i
> x `testBit` i = (x .&. bit i) /= 0
So the choice is
a) Keep Num as superclass, and offer the default implementations
b) Remove Num and require instances of Bits to supply bit and
testBit
Myself I'd go for (b), but others on the libraries list may want to
weigh in. (The FFI folk should be interested because the Bits library
is part of the FFI spec. Note to Manuel: section 5.2 would be better
with an explicit class declaration for Bits!)
[SimonMar things we could make do with just Eq to implement testBit.]
Simon
| -----Original Message-----
| From: haskell-admin(a)haskell.org [mailto:haskell-admin@haskell.org] On
Behalf Of Dominic Steinitz
| Sent: 06 April 2003 14:08
| To: Glynn Clements
| Cc: haskell(a)haskell.org
|
| Is this a recent change? I've downloaded Ian Lynagh's DES module and
it
| doesn't compile because of this. I assume it used to. I don't see the
| rationale for this. I can see Bool can be an instance of Bit but why
does it
| need to be an instance of Num?
|
| Dominic Steinitz
| ----- Original Message -----
| From: "Glynn Clements" <glynn.clements(a)virgin.net>
| To: "Dominic Steinitz" <dominic.steinitz(a)blueyonder.co.uk>
| Cc: <haskell(a)haskell.org>
| Sent: Sunday, April 06, 2003 2:35 PM
| Subject: Re: Bits Problem
|
|
| >
| > Dominic Steinitz wrote:
| >
| > > Can anyone explain this? Hugs doesn't complain.
| > >
| > > Prelude> :set --version
| > > The Glorious Glasgow Haskell Compilation System, version 5.04.1
| > >
| > > test.hs:5:
| > > No instance for (Num Bool)
| > > arising from the instance declaration at test.hs:5
| > > In the instance declaration for `Bits Bool'
| > >
| > > module Main(main) where
| > >
| > > import Bits
| > >
| > > instance Bits Bool where
| > > complement False = True
| > > complement True = False
| >
| > GHC's definition of Bits requires that instances of Bits are also
| > instances of Num.
| >
| > This constraint is required for the default implementations of bit
and
| > testBit:
| >
| > bit i = 1 `shift` i
| > x `testBit` i = (x .&. bit i) /= 0
| >
| > --
| > Glynn Clements <glynn.clements(a)virgin.net>
|
| _______________________________________________
| Haskell mailing list
| Haskell(a)haskell.org
| http://www.haskell.org/mailman/listinfo/haskell
DIKKAT
VIDEO CD :
Iddia ediyoruz.. Hic bir yerden temin edemeyeceginiz ses ve g�runtu kalitesi ile
yuzlerce porno video CD. arSivimiz yenilenmistir. istemis oldugunuz video CD.ler
bire bir yollanir kesinlikle isteginiz harici alakasiz baSka video CD.ler yollanmaz.
Anal. Oral. Vajinal. Grup. Zenci. FethiS. Ayak fethiS. Gay. Zenci gay. Trans. Transexual.
Lezbiyen ve daha bircok ceSit .... <http://www.erotik.sites.cc/>
ZENGIN URUN CESITLERIMIZ :
Sisme Bebekler ..... (Erkek & Bayan) Kesinlikle size hayir demeyecek.
Vibrat�rler ........ Istediginiz boy ve ebatlarda (Vajinal/Anal/catal.Pilli.Motorlu.TitreSimli)
Suni Vajinalar ..... Asla gerceginden ayirt edemeyeceksiniz (Gercek ten hassasiyetinde)
Reailistik Penisler. Gercek ten hassasiyetinde ve dokusunda (Vantuzlu/Deri kemer kilotlu)
Vakum Pompalari .... Ereksiyonu kolaylastirici ve duzenli kullanimlarda peniste irilesme saglar.
Geciktiriciler ..... Erken boSalmayi dert etmeyin (Sprey ceSitleri/Kremler)
Kremler ............ Anal ve Vajinal iliSkilerde kullanabileceginiz kayganlaStirici krem ceSitleri
Uyandiricilar ...... Cinsel istek uyandirici haplar ve damlalar.
Yapmaniz gereken tek Sey <http://www.erotik.sites.cc/> TIKLAMAK ..
NOT : BU MAIL REKLAM AMAcLI OLUP HIcBIR SEKILDE TARAFIMIZDA KAYDINIZ BULUNMAMAKTADIR.
ILGI ALANINIZIN DISINDA ISE EGER LUTFEN DIKKATE ALMAYINIZ TESEKKURLER..