X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FUtil.lhs;h=6b17a2821e43a837dd6afde57f25664202fde8d3;hb=27310213397bb89555bb03585e057ba1b017e895;hp=b08f6fab57294cbf96ef0dd655d2a182951a0830;hpb=b6f9d6f2c56074a3f46dbd8635560af5e2f4d420;p=ghc-hetmet.git diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index b08f6fa..6b17a28 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -801,9 +801,18 @@ fuzzyLookup user_entered possibilites poss_str user_entered , distance <= fuzzy_threshold ] where - -- Work out an approriate match threshold - -- (about a quarter of the # of characters the user entered) - fuzzy_threshold = max (round $ fromInteger (genericLength user_entered) / (4 :: Rational)) 1 + -- Work out an approriate match threshold: + -- We report a candidate if its edit distance is <= the threshold, + -- The threshhold is set to about a quarter of the # of characters the user entered + -- Length Threshold + -- 1 0 -- Don't suggest *any* candidates + -- 2 1 -- for single-char identifiers + -- 3 1 + -- 4 1 + -- 5 1 + -- 6 2 + -- + fuzzy_threshold = truncate $ fromIntegral (length user_entered + 2) / (4 :: Rational) mAX_RESULTS = 3 \end{code}