commit 7105cc28d2ebbc06664eacb54da2066a8cef8ebd Author: Artlef Date: Fri Apr 27 00:37:05 2018 +0200 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80fd40f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.hi +*.o +dictfr diff --git a/Download.hs b/Download.hs new file mode 100644 index 0000000..9c021a6 --- /dev/null +++ b/Download.hs @@ -0,0 +1,10 @@ +module Download (downloadHtmlDef) where + +import Network.HTTP + +baseUrl = "http://www.cnrtl.fr/definition/" + +downloadHtmlDef :: String -> IO String +downloadHtmlDef w = + simpleHTTP (req) >>= getResponseBody + where req = getRequest (baseUrl ++ w) diff --git a/Main.hs b/Main.hs new file mode 100644 index 0000000..e60297d --- /dev/null +++ b/Main.hs @@ -0,0 +1,10 @@ +module Main where + +import System.Environment +import Download + +main :: IO () +main = do + args <- getArgs + htmlResult <- downloadHtmlDef (head args) + putStrLn htmlResult diff --git a/README.md b/README.md new file mode 100644 index 0000000..be71583 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +A command line tool to search for french word definition. diff --git a/makefile b/makefile new file mode 100644 index 0000000..f013db0 --- /dev/null +++ b/makefile @@ -0,0 +1,11 @@ +CC=ghc +ARGS=--make -dynamic +FILENAME=dictfr +all: + $(CC) $(ARGS) -o $(FILENAME) Main.hs Download.hs + +clean: + rm -f *.o *.hi + +cleanall: + rm -f *.o *.hi $(FILENAME)