How do you show a Data.ByteArray?

Prelude Data.ByteArray> c = Data.ByteArray.zero 20 Prelude Data.ByteArray> :type c c :: ByteArray ba => ba Prelude Data.ByteArray> c <interactive>:38:1: error: • Ambiguous type variable ‘a0’ arising from a use of ‘print’ Uhm... Prelude Data.ByteArray> index c 3 <interactive>:39:1: error: • Ambiguous type variable ‘a0’ arising from a use of ‘index’ I can't print a byte?

You haven't actually decided what c is, just that it is some type that is
an instance of the ByteArray class.
:i ByteArray
should show:
instance ByteArray ByteString
instance ByteArray Bytes
instance ByteArray ScrubbedBytes
try
print (c :: ByteString)
print (c :: ScrubbedBytes)
On Sun, Aug 28, 2016 at 6:56 PM,
Prelude Data.ByteArray> c = Data.ByteArray.zero 20 Prelude Data.ByteArray> :type c c :: ByteArray ba => ba Prelude Data.ByteArray> c
<interactive>:38:1: error: • Ambiguous type variable ‘a0’ arising from a use of ‘print’
Uhm...
Prelude Data.ByteArray> index c 3
<interactive>:39:1: error: • Ambiguous type variable ‘a0’ arising from a use of ‘index’
I can't print a byte? _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

On 08/28/2016 11:08 PM, David McBride wrote:
You haven't actually decided what c is, just that it is some type that is an instance of the ByteArray class. Thank you! I had thought there was a default instance, like it would by default be Bytes, but could also optionally be wrapped around a ByteString or ScrubbedBytes. But you're right, you can create "20 zeroes" of any of those underlying things. Makes a lot more sense now.
participants (2)
-
David McBride
-
haskell@verge.info.tm