From c06edc9591f5cfa66217946d38814139eba7795a Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Wed, 22 Apr 2015 06:25:33 +0100 Subject: [PATCH] add a byteArrayConvert which copy and returns potentially a different output type --- Crypto/Internal/ByteArray.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Crypto/Internal/ByteArray.hs b/Crypto/Internal/ByteArray.hs index 344dd3a..16b86fe 100644 --- a/Crypto/Internal/ByteArray.hs +++ b/Crypto/Internal/ByteArray.hs @@ -23,6 +23,7 @@ module Crypto.Internal.ByteArray , empty , byteArrayZero , byteArrayCopy + , byteArrayConvert , byteArrayCopyRet , byteArrayCopyAndFreeze , byteArraySplit @@ -243,3 +244,6 @@ byteArrayMapAsWord64 f bs = let r = f (fromBE64 w) poke d (toBE64 r) loop (i-1) (d `plusPtr` 8) (s `plusPtr` 8) + +byteArrayConvert :: (ByteArrayAccess bin, ByteArray bout) => bin -> bout +byteArrayConvert = flip byteArrayCopyAndFreeze (\_ -> return ())