Commit bf937f1a authored by Vaibhav Sagar's avatar Vaibhav Sagar

IHaskell.Eval.Hoogle: fix issue with parsing multiple `::`

parent a6d0a651
......@@ -25,7 +25,7 @@ import Data.Vector (toList)
import Network.HTTP.Client
import Network.HTTP.Client.TLS
import StringUtils (replace, split, strip)
import StringUtils (replace, split, splitFirst, strip)
-- | Types of formats to render output to.
data OutputFormat = Plain -- ^ Render to plain text.
......@@ -193,7 +193,7 @@ renderSelf string loc
packageSub package
| otherwise =
let [name, args] = split "::" string
let [name, args] = splitFirst "::" string
package = extractPackageName loc
modname = extractModuleName loc
in span "hoogle-name"
......
......@@ -5,11 +5,13 @@ module StringUtils (
rstrip,
replace,
split,
splitFirst,
) where
import IHaskellPrelude
import qualified Data.Text as T
import Data.List.Split (splitOn)
import qualified Data.List.Split as Split
lstrip :: String -> String
lstrip = dropWhile (`elem` (" \t\r\n" :: String))
......@@ -26,3 +28,8 @@ replace needle replacement haystack =
split :: String -> String -> [String]
split = splitOn
splitFirst :: String -> String -> [String]
splitFirst delim str = let
(head:_:tail) = Split.split (Split.onSublist delim) str
in [head, concat tail]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment