I have a variable of ByteString
type. I want to see which package it belongs to. This could be useful for ByteString types because there are several different implementations in different packages.
For instance, I have following piece of code:
import qualified Data.ByteString.Lazy.Char8 as BSL
json :: String
json = "{\"document\":{\"name\":\"doc1\",\"content\":\"content1\"}}"
I want to get full package when I do ghci> :t BSL.pack json
. What I get is BSL.pack json :: ByteString
while I want something like BSL.pack json :: Data.ByteString.Lazy.Char8
. Is there any way to get this kind of information at the ghci prompt?
GHCi should use the same syntax you can use in your file. That is, if you import Data.ByteString.Lazy.Char8
unqualified you will get ByteString
unqualified, otherwise you should get the qualified type.
Check all your imports in your Haskell file: is something importing the ByteString
type in an unqualified way?
As you can see below, I can not reproduce your issue in a small GHCi session:
> import qualified Data.ByteString.Lazy.Char8 as BSL
> let a :: String ; a = "aa"
> :t BSL.pack a
BSL.pack a :: BSL.ByteString