In the Data.ByteString.Internal, the ByteString has constructor
PS !!(ForeignPtr Word8) !!Int !!Int
What does these double exclamations mean here? I searched and just got that (!!) can be used to index a list (!!) :: [a] -> Int -> a
.
This is not part of the actual Haskell source but an (undocumented) feature of how Haddock renders unboxed data types. See https://mail.haskell.org/pipermail/haskell-cafe/2009-January/054135.html:
2009/1/21 Stephan Friedrichs <...>:
Hi,
using haddock-2.4.1 and this file:
module Test where data Test = NonStrict Int | Strict !Int | UnpackedStrict {-# UNPACK #-} !Int
The generated documentation looks like this:
data Test Constructors NonStrict Int Strict !Int UnpackedStrict !!Int
Note the double '!' in the last constructor. This is not intended behaviour, is it?
This is the way GHC pretty prints unboxed types, so I thought Haddock should follow the same convention. Hmm, perhaps Haddock should have a chapter about language extensions in its documentation, with a reference to the GHC documentation. That way the language used is at least documented. Not sure if it helps in this case though, since "!!" is probably not documented there.
Perhaps we should not display unbox annotations at all since they are an implementation detail, right? We could display one "!" instead, indicating that the argument is strict.
David
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With