API for looking-up/retrieving Haddock comments?
Herbert Valerio Riedel
hvr at gnu.org
Sat Aug 4 09:33:12 CEST 2012
Simon Hengel <sol at typeful.net> writes:
> I have the following in my .ghci:
> -- hoogle integration
> :def hoogle \q -> return $ ":! hoogle --color=true --count=15 \"" ++ q ++ "\""
> :def doc \q -> return $ ":! hoogle --color=true --info \"" ++ q ++ "\""
thanks, this already looks very promising; there's just a few minor issues
I'm a bit dissatisfied with the GHCi integration:
1. it doesn't take into account the currently visible module namespaces that GHCi
has currently loaded (as opposed to `:info` and `:type`):
| Prelude> import Data.IntMap
| Prelude Data.IntMap> :info fromList
| fromList :: [(Key, a)] -> IntMap a -- Defined in `Data.IntMap'
| Prelude Data.IntMap> :type fromList
| fromList :: [(Key, a)] -> IntMap a
| Prelude Data.IntMap> :doc fromList
| Searching for: fromList
| Data.HashTable fromList :: Eq key => (key -> Int32) -> [(key, val)] -> IO (HashTable key val)
| Convert a list of key/value pairs into a hash table. Equality on keys
| is taken from the Eq instance for the key type.
| From package base
| fromList :: Eq key => (key -> Int32) -> [(key, val)] -> IO (HashTable key val)
| Prelude Data.IntMap>
2. tab-completion (as it works for `:type` and `:doc`) doesn't extend
I guess both items could be improved upon by extending GHCi to provide
an additional `:def` facility tailored to Haskell symbols allowing to
pass more meta-information (such as package and module information) into
the resulting command string... would something like that have any
chance of being accepted upstream?
More information about the Glasgow-haskell-users