module IHP.IDE.CodeGen.ApplicationGenerator (buildPlan) where

import IHP.Prelude
import IHP.IDE.CodeGen.Types

buildPlan :: Text -> IO (Either Text [GeneratorAction])
buildPlan :: Text -> IO (Either Text [GeneratorAction])
buildPlan Text
applicationName =
    if (Text -> Bool
forall mono. MonoFoldable mono => mono -> Bool
null Text
applicationName)
        then do
            Either Text [GeneratorAction] -> IO (Either Text [GeneratorAction])
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either Text [GeneratorAction]
 -> IO (Either Text [GeneratorAction]))
-> Either Text [GeneratorAction]
-> IO (Either Text [GeneratorAction])
forall a b. (a -> b) -> a -> b
$ Text -> Either Text [GeneratorAction]
forall a b. a -> Either a b
Left Text
"Application name cannot be empty"
        else do
            let applicationName' :: Text
applicationName' = Text -> Text
ucfirst Text
applicationName
            Either Text [GeneratorAction] -> IO (Either Text [GeneratorAction])
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either Text [GeneratorAction]
 -> IO (Either Text [GeneratorAction]))
-> Either Text [GeneratorAction]
-> IO (Either Text [GeneratorAction])
forall a b. (a -> b) -> a -> b
$ [GeneratorAction] -> Either Text [GeneratorAction]
forall a b. b -> Either a b
Right ([GeneratorAction] -> Either Text [GeneratorAction])
-> [GeneratorAction] -> Either Text [GeneratorAction]
forall a b. (a -> b) -> a -> b
$ Text -> [GeneratorAction]
generateGenericApplication Text
applicationName'

generateGenericApplication :: Text -> [GeneratorAction]
generateGenericApplication :: Text -> [GeneratorAction]
generateGenericApplication Text
applicationName =
        let
            typesHs :: Text
typesHs =
                Text
"module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Types where\n\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import IHP.Prelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import IHP.ModelSupport\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import Generated.Types\n\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"data " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"Application = " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"Application deriving (Eq, Show)\n\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"data StaticController = WelcomeAction deriving (Eq, Show, Data)"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"

            routesHs :: Text
routesHs =
                Text
"module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Routes where\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import IHP.RouterPrelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import Generated.Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Types\n\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"-- Generator Marker\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"instance AutoRoute StaticController"
            frontControllerHs :: Text
frontControllerHs =
                Text
"module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".FrontController where\n\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import IHP.RouterPrelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Controller.Prelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".View.Layout (defaultLayout)\n\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"-- Controller Imports\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Controller.Static\n\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"instance FrontController " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"Application where\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    controllers = \n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        [ startPage WelcomeAction\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        -- Generator Marker\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        ]\n\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"instance InitControllerContext " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"Application where\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    initContext = do\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        setLayout defaultLayout\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        initAutoRefresh\n"
            controllerPreludeHs :: Text
controllerPreludeHs =
                Text
"module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Controller.Prelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"( module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", module Application.Helper.Controller\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", module IHP.ControllerPrelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", module Generated.Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
")\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"where\n\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import Application.Helper.Controller\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import IHP.ControllerPrelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import Generated.Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Routes\n"

            viewLayoutHs :: Text
viewLayoutHs =
                Text
"module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".View.Layout (defaultLayout, Html) where\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import IHP.ViewPrelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import IHP.Environment\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import Generated.Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import IHP.Controller.RequestContext\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Routes\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import Application.Helper.View\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"defaultLayout :: Html -> Html\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"defaultLayout inner = [hsx|\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"<!DOCTYPE html>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"<html lang=\"en\">\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    <head>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        {metaTags}\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        {stylesheets}\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        {scripts}\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <title>{pageTitleOrDefault \"App\"}</title>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    </head>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    <body>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <div class=\"container mt-4\">\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"            {renderFlashMessages}\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"            {inner}\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        </div>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    </body>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"</html>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"|]\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"-- The 'assetPath' function used below appends a `?v=SOME_VERSION` to the static assets in production\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"-- This is useful to avoid users having old CSS and JS files in their browser cache once a new version is deployed\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"-- See https://ihp.digitallyinduced.com/Guide/assets.html for more details\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"stylesheets :: Html\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"stylesheets = [hsx|\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <link rel=\"stylesheet\" href={assetPath \"/vendor/bootstrap-5.2.1/bootstrap.min.css\"}/>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <link rel=\"stylesheet\" href={assetPath \"/vendor/flatpickr.min.css\"}/>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <link rel=\"stylesheet\" href={assetPath \"/app.css\"}/>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    |]\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"scripts :: Html\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"scripts = [hsx|\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        {when isDevelopment devScripts}\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/vendor/jquery-3.6.0.slim.min.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/vendor/timeago.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/vendor/popper-2.11.6.min.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/vendor/bootstrap-5.2.1/bootstrap.min.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/vendor/flatpickr.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/vendor/morphdom-umd.min.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/vendor/turbolinks.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/vendor/turbolinksInstantClick.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/vendor/turbolinksMorphdom.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/helpers.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/ihp-auto-refresh.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script src={assetPath \"/app.js\"}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    |]\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"devScripts :: Html\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"devScripts = [hsx|\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"        <script id=\"livereload-script\" src={assetPath \"/livereload.js\"} data-ws={liveReloadWebsocketUrl}></script>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    |]\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"metaTags :: Html\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"metaTags = [hsx|\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    <meta charset=\"utf-8\"/>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\"/>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    <meta property=\"og:title\" content=\"App\"/>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    <meta property=\"og:type\" content=\"website\"/>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    <meta property=\"og:url\" content=\"TODO\"/>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    <meta property=\"og:description\" content=\"TODO\"/>\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    {autoRefreshMeta}\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"|]\n"

            viewPreludeHs :: Text
viewPreludeHs =
                Text
"module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".View.Prelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"( module IHP.ViewPrelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".View.Layout\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", module Generated.Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", module Application.Helper.View\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
") where\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import IHP.ViewPrelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".View.Layout\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import Generated.Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Types\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Routes ()\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import Application.Helper.View\n"

            welcomeControllerStaticHs :: Text
welcomeControllerStaticHs =
                Text
"module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Controller.Static where\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName  Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
".Controller.Prelude\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName  Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
".View.Static.Welcome\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"instance Controller StaticController where\n"
                Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"    action WelcomeAction = render WelcomeView\n"

            welcomeViewStaticHs :: Text
welcomeViewStaticHs =
              Text
"module " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".View.Static.Welcome where\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".View.Prelude\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"data WelcomeView = WelcomeView\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"instance View WelcomeView where\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"    html WelcomeView = [hsx|\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"         <div style=\"background-color: #657b83; padding: 2rem; color:hsla(196, 13%, 96%, 1); border-radius: 4px\">\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"              <div style=\"max-width: 800px; margin-left: auto; margin-right: auto\">\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                  <h1 style=\"margin-bottom: 2rem; font-size: 2rem; font-weight: 300; border-bottom: 1px solid white; padding-bottom: 0.25rem; border-color: hsla(196, 13%, 60%, 1)\">\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                      IHP\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                  </h1>\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                  <h2 style=\"margin-top: 0; margin-bottom: 0rem; font-weight: 900; font-size: 3rem\">\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                      It's working!\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                  </h2>\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                  <p style=\"margin-top: 1rem; font-size: 1.75rem; font-weight: 600; color:hsla(196, 13%, 80%, 1)\">\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                     Your new application is up and running.\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                  </p>\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                  <p>\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                      <a\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                          href=\"https://ihp.digitallyinduced.com/Slack\"\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                          style=\"margin-top: 2rem; background-color: #268bd2; padding: 1rem; border-radius: 3px; color: hsla(205, 69%, 98%, 1); text-decoration: none; font-weight: bold; display: inline-block; box-shadow: 0 4px 6px hsla(205, 69%, 0%, 0.08); transition: box-shadow 0.2s; transition: transform 0.2s;\"\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                          target=\"_blank\"\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                      >Join our community on Slack!</a>\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                  </p>\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                  <a href=\"https://ihp.digitallyinduced.com/Guide/your-first-project.html\" style=\"margin-top: 2rem; background-color: #268bd2; padding: 1rem; border-radius: 3px; color: hsla(205, 69%, 98%, 1); text-decoration: none; font-weight: bold; display: inline-block; box-shadow: 0 4px 6px hsla(205, 69%, 0%, 0.08);  transition: box-shadow 0.2s; transition: transform 0.2s;\" target=\"_blank\">\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                     Learn the Next Steps in the Documentation\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                  </a>\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"              </div>\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"         </div>\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"         <div style=\"max-width: 800px; margin-left: auto; margin-right: auto; margin-top: 4rem\">\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"              <img src=\"/ihp-welcome-icon.svg\" alt=\"/ihp-welcome-icon\" style=\"width:100%;\">\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"              <p style=\"color: hsla(196, 13%, 50%, 1); margin-top: 4rem\">\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"                 You can modify this start page by making changes to \"./Web/View/Static/Welcome.hs\".\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"              </p>\n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"         </div> \n"
             Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
"|]"

        in
            [ EnsureDirectory { $sel:directory:CreateFile :: Text
directory = Text
applicationName }
            , EnsureDirectory { $sel:directory:CreateFile :: Text
directory = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/Controller" }
            , EnsureDirectory { $sel:directory:CreateFile :: Text
directory = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/View" }
            , EnsureDirectory { $sel:directory:CreateFile :: Text
directory = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/View/Static" }
            , AddImport  { $sel:filePath:CreateFile :: Text
filePath = Text
"Main.hs", $sel:fileContent:CreateFile :: Text
fileContent = Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".FrontController" }
            , AddImport  { $sel:filePath:CreateFile :: Text
filePath = Text
"Main.hs", $sel:fileContent:CreateFile :: Text
fileContent = Text
"import " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".Types" }
            , AddMountToFrontController { $sel:filePath:CreateFile :: Text
filePath = Text
"Main.hs", $sel:applicationName:CreateFile :: Text
applicationName = Text
applicationName }
            , CreateFile { $sel:filePath:CreateFile :: Text
filePath = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/Types.hs", $sel:fileContent:CreateFile :: Text
fileContent = Text
typesHs }
            , CreateFile { $sel:filePath:CreateFile :: Text
filePath = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/Routes.hs", $sel:fileContent:CreateFile :: Text
fileContent = Text
routesHs }
            , CreateFile { $sel:filePath:CreateFile :: Text
filePath = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/FrontController.hs", $sel:fileContent:CreateFile :: Text
fileContent = Text
frontControllerHs }
            , CreateFile { $sel:filePath:CreateFile :: Text
filePath = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/Controller/Prelude.hs", $sel:fileContent:CreateFile :: Text
fileContent = Text
controllerPreludeHs }
            , CreateFile { $sel:filePath:CreateFile :: Text
filePath = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/View/Layout.hs", $sel:fileContent:CreateFile :: Text
fileContent = Text
viewLayoutHs }
            , CreateFile { $sel:filePath:CreateFile :: Text
filePath = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/View/Prelude.hs", $sel:fileContent:CreateFile :: Text
fileContent = Text
viewPreludeHs }
            , CreateFile { $sel:filePath:CreateFile :: Text
filePath = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/Controller/Static.hs", $sel:fileContent:CreateFile :: Text
fileContent = Text
welcomeControllerStaticHs }
            , CreateFile { $sel:filePath:CreateFile :: Text
filePath = Text
applicationName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/View/Static/Welcome.hs", $sel:fileContent:CreateFile :: Text
fileContent = Text
welcomeViewStaticHs }
            ]