Problem with $ forall in Hamlet template

I have a weird village problem. I am trying to use $ forall to iterate through a list, but I keep getting the "Not to scale" error. I am running yesod 0.9.2.2 on Win7.

Awful design aside, who has an idea where I am wrong? Removing the interpolation variable "db" allows you to fine.

Matching hamlet:

 !!!
<h1> Database List
<hr>
<table>

  <tr>
       <td> Host
       <td> Status
  $forall db <- dbList
  <tr>
       <td> #{host db}

Relevant handler code:

data Database = Database {dbType :: DBType,
                        host :: String,
                        user :: String,
                        password :: String
                       }


dbList = [Database Oracle "cpalmerws" "system" "***",
          Database Oracle "bdblnx" "system" "***",
          Database Postgres "localhost" "postgres" "***"]

getDBStatusR :: Handler RepHtml
getDBStatusR = do
  mu <- maybeAuth
  defaultLayout $ do
    setTitle "DB Status Page"
    addWidget $(widgetFile "dbstatus")

I get this error when starting yesod devel:

Handler\DBStatus.hs:47:17:
    Not in scope: `db'
    In the result of the splice:
      $(widgetFile "dbstatus")
    To see what the splice expanded to, use -ddump-splices
    In the first argument of `addWidget', namely
      `$(widgetFile "dbstatus")'
    In the expression: addWidget ($(widgetFile "dbstatus"))
Starting development server...

dist\devel.hs:3:1:
    Failed to load interface for `Application':
      it is not a module in the current program, or in any known package.
Exit code: ExitFailure 1
+5
source share
1 answer

Indentation level in the template is incorrect:

$forall db <- dbList
    <tr>
        <td>#{host db}

In your version, the string is outside the scope of $ forall.

+8
source

All Articles