Where should the main module be stored in the Haskell idiomatic project?

According to the wikipedia page for the Haskell project structure , srcthe haskell idiomatic project folder is as follows:

src/           -- For keeping the sourcecode
    Main.lhs     -- The main-module
    App/         -- Use hierarchical modules
      ...
      Win32/     -- For system dependent stuff
      Unix/
    cbits/       -- For C code to be linked to the haskell program

Questions:

  • I assume that Main.lhsis the main entry point to the program. By this, I mean that it includes a method mainthat returns a type value IO (a)for some type a. This case?

  • What is the point of expanding .lhson Main.lhs? Why not name him Main.hs?

  • I reviewed some of the other popular Haskell projects on GitHub, and they don't seem to be closely monitoring this structure. Is this really an idiomatic way to organize a Haskell project?

+4
1

1.

. Haskell , .

2.

.lhs , Haskell. Haskell , - " "; Haskell, : , - " ". , " - , ".

3.

Haskell. , :

  • . Main.hs. . . import Foo Foo.hs .

  • . , , . src/ . :

    /
     src/
       • Main.hs
       • Types.hs
       Types/
         • Internal.hs
         • Gadgets.hs
         • Geegaws.hs
     • project.cabal
     • README.md
    

    Types, Types.*, import Types , , import Types.Internal import Types.Gadgets Types a la carte.

  • , Tiny Executable. Cabal Stack, , , . Main.hs , . , , . , , , . :

    /
     lib/
       Types/
         • Internal.hs
         • Gadgets.hs
         • Geegaws.hs
       Types.hs
     src/
       • Main.hs
       • Utils.hs
     • project.cabal
     • README.md
    

. lib/ src/ . , - , C-family ( GNU) . cbits/ , , , Haskell. , , , .

, stack new. ( ). .

+8

All Articles