From 5b67ca2164b58a24b7bf38757157d9b15a992b20 Mon Sep 17 00:00:00 2001 From: hashirama Date: Tue, 20 Jan 2026 03:24:16 +0000 Subject: [PATCH] use the target function the processDictionary function is the one we need to use for lookups, because it inserts all resources and gives just the full html at the end, ready to be displayed Signed-off-by: hashirama --- cli-example/Main.hs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/cli-example/Main.hs b/cli-example/Main.hs index 99cc0d0..56695f8 100644 --- a/cli-example/Main.hs +++ b/cli-example/Main.hs @@ -3,17 +3,22 @@ import System.Environment (getArgs) import System.Exit (exitFailure) import Control.Monad (when) -import MDict (lookupInCollection) +import MDict main :: IO () main = do - args <- getArgs - when (length args < 2) $ do - putStrLn "Usage: Main " - exitFailure + args <- getArgs + when (length args < 2) $ do + putStrLn "Usage: Main " + exitFailure - let dictDir = args !! 0 - queryKey = args !! 1 + let dict = args !! 0 + queryKey = args !! 1 - -- Process all files - lookupInCollection dictDir queryKey + res <- processDictionary dict queryKey + html <- case res of + Left err -> error err + Right h -> return h + + + putStrLn (html)