5

I am trying to produce two executables from the same haskell stack project named 'trial'. The structure of my stack project is as follows:

$~/trial$ tree
.
├── app
│   ├── First.hs
│   └── Second.hs
├── ChangeLog.md
├── LICENSE
├── package.yaml
├── README.md
├── Setup.hs
├── src
│   └── Lib.hs
├── stack.yaml
├── stack.yaml.lock
├── test
│   └── Spec.hs
└── trial.cabal

I have referred to a similar question: Producing multiple executables from single project And I edited my project's '.cabal' file accordingly...
trial.cabal :


-- This file has been generated from package.yaml by hpack version 0.31.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: ff6e15c6d7d9cfb9abc0b852e25bb43f131a2a80acf4b08356d5c574b951fb8c

name:           trial
version:        0.1.0.0
description:    Please see the README on GitHub at <https://github.com/githubuser/trial#readme>
homepage:       https://github.com/githubuser/trial#readme
bug-reports:    https://github.com/githubuser/trial/issues
author:         Author name here
maintainer:     example@example.com
copyright:      2020 Author name here
license:        BSD3
license-file:   LICENSE
build-type:     Simple
extra-source-files:
    README.md
    ChangeLog.md

source-repository head
  type: git
  location: https://github.com/githubuser/trial

library
  exposed-modules:
      Lib
  other-modules:
      Paths_trial
  hs-source-dirs:
      src
  build-depends:
      base >=4.7 && <5

  default-language: Haskell2010

executable first
  main-is: First.hs
  other-modules:
      Paths_trial

  hs-source-dirs:   app
  ghc-options:      -O2 -threaded -with-rtsopts=-N -main-is First.hs
  build-depends:
      base >=4.7 && <5
    , trial
  default-language: Haskell2010

executable second
  main-is: Second.hs
  other-modules:
      Paths_trial
  hs-source-dirs:   app
  ghc-options: -threaded -rtsopts -with-rtsopts=-N -main-is Second.hs
  build-depends:
      base >=4.7 && <5
    , trial
  default-language: Haskell2010

test-suite trial-test
  type: exitcode-stdio-1.0
  main-is: Spec.hs
  other-modules:
      Paths_trial
  hs-source-dirs:
      test
  ghc-options: -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      base >=4.7 && <5
    , trial
  default-language: Haskell2010

the contents of app/First.hs & app/Second.hs is the same and is as follows:

import Lib
main :: IO()
main = someFunc

and contents of src/Lib.hs is as follows:

module Lib
    ( someFunc
    ) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"

when I build the project it gives the below error:

 error:
    output was redirected with -o, but no output will be generated
because there is no Second module.


--  While building package trial-0.1.0.0 using:

0 Answers0