[Haskell-cafe] How does one read complicated type signatures?

Brandon Allbery allbery.b at gmail.com
Fri Jan 24 04:12:23 UTC 2014


On Thu, Jan 23, 2014 at 10:54 PM, Jakub Arnold <darthdeus at gmail.com> wrote:

> *Main Network.HTTP.Conduit> :t withManager
> withManager
>   :: (monad-control-0.3.2.2:Control.Monad.Trans.Control.MonadBaseControl
>         IO m,
>       transformers-0.3.0.0:Control.Monad.IO.Class.MonadIO m) =>
>      (Manager
>       -> resourcet-0.4.10:Control.Monad.Trans.Resource.Internal.ResourceT
>            m a)
>      -> m a
>
> The question is … how am I supposed to read these? It seems that they wrap
> around (maybe) 80 characters, which makes them unreadable … and the package
> prefixes also don’t really help.
>

Import the modules named (usually ignoring any "Internal" or "Class" part),
and their names will shorten. Since the names aren't in scope in ghci, it's
being specific about where it found them.

  (MonadBaseControl IO m, MonadIO m) => (Manager ResourceT m a) -> m a

should be what you see with Control.Monad.Trans.Control,
Control.Monad.Trans (because I happen to know the "public" export of
MonadIO is there), and Control.Monad.Trans.Resource in scope.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140123/ee95cc6a/attachment.html>


More information about the Haskell-Cafe mailing list