[Haskell-cafe] IO monads, stream handles, and type inference
allbery.b at gmail.com
Tue Nov 11 03:41:56 UTC 2014
On Mon, Nov 10, 2014 at 10:09 PM, Jeffrey Brown <jeffbrown.the at gmail.com>
> Until this OSC library, I had never seen the "a" in "IO a" represent a
> pipe; it had always represented data to be passed *through* a pipe.
produces an IO Handle.
File I/O is often done with lazy I/O, which hides the Handle in the
woodwork, but nothing stops you from using Handle-based I/O.
> *Why the long signature?*
> When I ask for it, GHC provides the following additional type signatures:
> > :t pause pause :: Double ->
> transformers-0.3.0.0:Control.Monad.Trans.Reader.ReaderT UDP IO ()
> What's up with that?
You don't have the module that defines the type ReaderT in scope, so it dug
out where the module you *do* have in scope got it from. And it gave full
details, because conceivably you could have multiple versions of the
transformers library installed --- although that usually leads to a lot of
confusion (which ghc is trying to avoid here by giving the full pedigree).
BTW, I am going to guess, given that you later show a SendOSC that is a
ReaderT UDP IO a, that SendOSC is a `type` (type alias) and not a `data` (a
fully-fledged data type) or `newtype` (a wrapper for another type). That
may answer your later questions: ghc will sometimes show the alias name and
sometimes the type it expands to.
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...
More information about the Haskell-Cafe