Cabal:找不到可执行test1的'Main-Is'字段

NoI*_*his 3 haskell program-entry-point cabal

我试图用cabal运行一个非常简单的"Hello World"项目.

这是我保存项目的文件夹(ubuntu)

mtt@mttPC:~/Documents/Haskell/test1$ ls
dist          Greetings.o  Setup.hs  test1.cabal
Run Code Online (Sandbox Code Playgroud)

Main.hs 包含:

module Greetings where

main :: IO ()
main = print "hello"
Run Code Online (Sandbox Code Playgroud)

Hello world实际上有效:

mtt@mttPC:~/Documents/Haskell/test1$ runhaskell Main.hs configure --ghc
"hello"
Run Code Online (Sandbox Code Playgroud)

test1.cabal文件已生成cabal init:

-- Initial test1.cabal generated by cabal init.  For further documentation,
--  see http://haskell.org/cabal/users-guide/

name:                test1
version:             0.1.0.0
-- synopsis:            
-- description:         
-- license:             
license-file:        LICENSE
author:              mtt
maintainer:           
-- copyright:           
-- category:            
build-type:          Simple
cabal-version:       >=1.8

executable test1
  -- main-is: Main.hs     
  -- other-modules:     
  build-depends:       base ==4.6.*
Run Code Online (Sandbox Code Playgroud)

我不明白为什么:

mtt@mttPC:~/Documents/Haskell/test1$ cabal configure
Resolving dependencies...
Configuring test1-0.1.0.0...

Error: No 'Main-Is' field found for executable test1
Run Code Online (Sandbox Code Playgroud)

Dan*_*zer 5

您忘记取消注释告诉GHC要构建哪个模块作为主要入口点的文件

...
executable test1
  main-is: src/Main.hs -- Or whatever is appropriate
  build-depends: base==4.6.*
Run Code Online (Sandbox Code Playgroud)