~kaction/cookiecutter-haskell

b061939c84734248f83e7ef7858fbb8a8409af73 — Dmitry Bogatov 1 year, 5 months ago e328071
Move definition of "main" into the library

It increases library size in case library has any use on its own, but makes
development in "ghci" so much more convenient.
M hooks/post_gen_project.py => hooks/post_gen_project.py +2 -2
@@ 2,8 2,8 @@ import os
import sys

REMOVE_PATHS = [
    '{% if cookiecutter.add_executable_section == "no" %} app/Main.hs {% endif %}',
    '{% if cookiecutter.add_executable_section == "no" %} app {% endif %}',
    '{% if cookiecutter.add_executable_section == "no" %} main/Main.hs {% endif %}',
    '{% if cookiecutter.add_executable_section == "no" %} main {% endif %}',
]

for path in REMOVE_PATHS:

D {{cookiecutter.project_name}}/app/Main.hs => {{cookiecutter.project_name}}/app/Main.hs +0 -6
@@ 1,6 0,0 @@
module Main where

import {{cookiecutter.module}}

main =
  print $ "Hello from " ++ do{{cookiecutter.module}} ++ "!"

A {{cookiecutter.project_name}}/main/Main.hs => {{cookiecutter.project_name}}/main/Main.hs +6 -0
@@ 0,0 1,6 @@
module Main where

import qualified {{ cookiecutter.module }} as Main

main :: IO ()
main = Main.main

M {{cookiecutter.project_name}}/package.yaml => {{cookiecutter.project_name}}/package.yaml +1 -1
@@ 15,7 15,7 @@ library:

{% if cookiecutter.add_executable_section == "yes" %}executables:
  {{cookiecutter.project_name}}-exe:
    source-dirs: app
    source-dirs: main
    main: Main.hs
    dependencies:
      - {{cookiecutter.project_name}}

A {{cookiecutter.project_name}}/src/{{cookiecutter.module}}/Main.hs => {{cookiecutter.project_name}}/src/{{cookiecutter.module}}/Main.hs +6 -0
@@ 0,0 1,6 @@
module {{ cookiecutter.module }}.Main (main) where

import {{ cookiecutter.module }} (do{{ cookiecutter.module }})

main :: IO ()
main = print $ "Hello from " ++ do{{cookiecutter.module}} ++ "!"