Skip to content

Instantly share code, notes, and snippets.

@exarkun
Created January 21, 2021 19:45
-- crypto-api
import qualified Crypto.Classes
-- cryptonite
import qualified Crypto.Cipher.Types
-- Implement the crypto-api BlockCipher typeclass for all cryptonite
-- BlockCipher instances.
instance Crypto.Cipher.Types.BlockCipher cipher => Crypto.Classes.BlockCipher cipher where
blockSize = Crypto.Cipher.Types.blockSize (undefined :: cipher)
encryptBlock = Crypto.Cipher.Types.ecbEncrypt
decryptBlock = Crypto.Cipher.Types.ecbDecrypt
/home/exarkun/Work/haskell/tahoe-lafs-immutable-uploader/aesctr/Main.hs:49:10: error:
• The constraint ‘Crypto.Cipher.Types.BlockCipher cipher’
is no smaller than
the instance head ‘Crypto.Classes.BlockCipher cipher’
(Use UndecidableInstances to permit this)
• In the instance declaration for
‘Crypto.Classes.BlockCipher cipher’
|
49 | instance Crypto.Cipher.Types.BlockCipher cipher => Crypto.Classes.BlockCipher cipher where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment