
I have been trying to write a Crypto library and so far it works with ghc and hugs. Am I right in thinking I am going to struggle with nhc? It uses Word8 and Word64 heavily. For example, cipher block chaining relies on xoring Word64. I attach the library and a test program. I'd be grateful for any suggestions on how to make it work with nhc. Dominic Steinitz

"Dominic Steinitz"
I have been trying to write a Crypto library and so far it works with ghc and hugs.
Am I right in thinking I am going to struggle with nhc? It uses Word8 and Word64 heavily. For example, cipher block chaining relies on xoring Word64.
The things you mention are not a particular problem for nhc98. The only problem I encountered in the Crypto.hs code is that its use of the type class machinery is not Haskell'98 compliant. instance Bits [Bool] where ... is illegal in Haskell'98, because an instance head must be either a simple type name, or a type constructor applied to only type variables. (See the Report section 4.3.2) If ghc and Hugs permit this, then it is a non-standard extension to the language. Unfortunately, I don't immediately see an easy way to convert this construction into something more amenable. Regards, Malcolm

Malcolm,
Thanks for this. I'm restructuring the Crypto libraries so that it will
contain Crypto.Modes, Crypto.DES, Crypto.Blowfish etc. The current Blowfish
should work with nhc. When I get the chance, I'll see if I can restructure
DES but it's not top of my priorities at the moment.
[Dominic Steinitz
----- Original Message -----
From: "Malcolm Wallace"
"Dominic Steinitz"
writes: I have been trying to write a Crypto library and so far it works with ghc and hugs.
Am I right in thinking I am going to struggle with nhc? It uses Word8 and Word64 heavily. For example, cipher block chaining relies on xoring Word64.
The things you mention are not a particular problem for nhc98. The only problem I encountered in the Crypto.hs code is that its use of the type class machinery is not Haskell'98 compliant.
instance Bits [Bool] where ...
is illegal in Haskell'98, because an instance head must be either a simple type name, or a type constructor applied to only type variables. (See the Report section 4.3.2) If ghc and Hugs permit this, then it is a non-standard extension to the language.
Unfortunately, I don't immediately see an easy way to convert this construction into something more amenable.
Regards, Malcolm
participants (2)
-
Dominic Steinitz
-
Malcolm Wallace