Is there a way to use flags when searching with hoogle from ghci?
ghci, haskell, hoogle
Solution
You need to change your ghci.conf in order to do this. Assuming you did the steps described on haskell.org, your ghci.conf contains a line like
:def hoogle \x -> return $ ":!hoogle \"" ++ x ++ "\""
However, that line says that `:hoogle x` will be translated to `hoogle "x"`, which obviously won't work if you want to apply additional flags, such as `--count=5`.
You either need to remove the quotes around the argument, e.g.
:def hoogleP \x -> return $ ":!hoogle " ++ x
and use `:hoogleP --count=5 "Char -> Int"` or split the argument by hand into count and search query:
:def hoogleC \x -> return $ ":!hoogle --count="++(head.words $x)++" \"" ++ (unwords.tail.words $x) ++ "\""
The last version can be used as `:hoogleC 5 Char -> Int`.
Problem
How can I use the hoogle command line flags when using hoogle inside ghci? This obviously doesn't work: ``` ghci> :hoogle --count=5 Char -> Int Could not read as type Int, "5 Char -> Int" ```