From cf76a2e33b708dd2bec72a782af214cbd792bb58 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 13 Aug 2022 10:53:23 +0200 Subject: Minor improvements --- src/Helper.hs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Helper.hs') diff --git a/src/Helper.hs b/src/Helper.hs index eb41673..47c106d 100644 --- a/src/Helper.hs +++ b/src/Helper.hs @@ -178,6 +178,15 @@ decodeStdout e = do --- +lookupValues :: (Eq b) => b -> [(a, b)] -> [a] +lookupValues _ [] = [] +lookupValues key ((x, y) : xys) | key == y = x : lookupValues key xys + | otherwise = lookupValues key xys + +matchingFunctions :: Expression -> Environment -> String +matchingFunctions e (Environment env) = + intercalate ", " $ nub $ lookupValues e (map fst env) + -- TODO: Expression -> Maybe Char is missing maybeHumanifyExpression :: Expression -> Maybe String maybeHumanifyExpression e = ternaryToDecimal e <|> decodeStdout e -- cgit v1.2.3