Skip to content

Instantly share code, notes, and snippets.

@exarkun
Created January 21, 2021 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exarkun/bfdf75c677e967cebbf9533d10371a7c to your computer and use it in GitHub Desktop.
Save exarkun/bfdf75c677e967cebbf9533d10371a7c to your computer and use it in GitHub Desktop.
-- 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