first commit

This commit is contained in:
Artlef 2018-04-27 00:37:05 +02:00 committed by artlef
commit 7105cc28d2
5 changed files with 35 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.hi
*.o
dictfr

10
Download.hs Normal file
View File

@ -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)

10
Main.hs Normal file
View File

@ -0,0 +1,10 @@
module Main where
import System.Environment
import Download
main :: IO ()
main = do
args <- getArgs
htmlResult <- downloadHtmlDef (head args)
putStrLn htmlResult

1
README.md Normal file
View File

@ -0,0 +1 @@
A command line tool to search for french word definition.

11
makefile Normal file
View File

@ -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)