feat: hs
This commit is contained in:
@@ -4,6 +4,11 @@ Haskell Language Tests
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ stack helloworld.hs
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
New project:
|
New project:
|
||||||
```shell
|
```shell
|
||||||
$ stack new sample
|
$ stack new sample
|
||||||
@@ -11,4 +16,4 @@ $ cd sample/
|
|||||||
$ stack setup
|
$ stack setup
|
||||||
$ stack build
|
$ stack build
|
||||||
$ stack exec sample-exe
|
$ stack exec sample-exe
|
||||||
```
|
```
|
||||||
|
|||||||
20
explore.hs
Normal file
20
explore.hs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env stack
|
||||||
|
{- stack script
|
||||||
|
--resolver nightly-2019-12-22
|
||||||
|
--install-ghc
|
||||||
|
--package "servant-server warp"
|
||||||
|
--ghc-options -Wall
|
||||||
|
-}
|
||||||
|
{-# LANGUAGE DataKinds, TypeOperators, TypeApplications #-}
|
||||||
|
|
||||||
|
module FileServer where
|
||||||
|
|
||||||
|
import Network.Wai.Handler.Warp( defaultSettings, runSettings, setBeforeMainLoop, setPort)
|
||||||
|
import Servant (Proxy(Proxy), Raw, serve, serveDirectoryWebApp)
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = runSettings settings . serve (Proxy @Raw) $ serveDirectoryWebApp "."
|
||||||
|
where port = 8080
|
||||||
|
msg = "serving on http://localhost:" ++ show port ++ "/{pathToFile}"
|
||||||
|
settings = setPort port $ setBeforeMainLoop (putStrLn msg) defaultSettings
|
||||||
|
|
||||||
5
helloworld.hs
Normal file
5
helloworld.hs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{- stack script
|
||||||
|
--resolver lts-14.18
|
||||||
|
-}
|
||||||
|
main :: IO ()
|
||||||
|
main = putStrLn "Hello World!"
|
||||||
Reference in New Issue
Block a user