Sorry, you need to specify which cipher type you are using of course. So: let key :: Key AES key = either (error "bad AES key") id $ makeKey keyBS cipher = cipherInit key etc.