我用以下命令创建了一个yesod项目:
stack new yeplay yesodweb/simple
,并且我已将一个helloworld.hs
文件添加到应用目录。该应用程序目录包含以下文件:
~/haskell/yeplay/app$ ls
devel.hs DevelMain.hs helloworld.hs main.hs
helloworld.hs
文件包含以下内容:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
import Yesod
data HelloWorld = HelloWorld
mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]
instance Yesod HelloWorld
getHomeR :: Handler Html
getHomeR = defaultLayout [whamlet|Hello World!|]
main :: IO ()
main = warp 3000 HelloWorld
然后我尝试使用以下命令运行文件:
runhaskell helloworld.hs
Command 'runhaskell' not found, but can be installed with:
sudo apt install ghc
如文档中所述。
如何启动应用程序?