yesodweb/yesod — Issue #278: Compile error on infix operator in hamlet snippet
Author: akamaus
Created: 2012-02-24 19:24:29+00:00
State: open

The following snippet triggers the error:

data GenTask = GenTask {
gtWords :: [String],
gtNumResults :: Int
}

textListField = Field
{ fieldParse = blank $ Right . map T.unpack . T.words
, fieldView = \theId name theClass val isReq -> addHamlet
[hamlet|\
#{either id (T.pack . unwords) val}
|]
}

src/Web.hs:42:9:
Exception when trying to run compile-time code:
"\
<textarea id="#{theId}" name="#{name}" :not (null theClass):class="#{T.intercalate " " theClass}" type="text" :isReq:required=""> #{either id (T.pack . unwords) val}
" (line 2, column 143):
unexpected "("
expecting "}"
Code: Language.Haskell.TH.Quote.quoteExp
hamlet
"\\\n<textarea id=\"#{theId}\" name=\"#{name}\" :not (null theClass):class=\"#{T.intercalate \" \" theClass}\" type=\"text\" :isReq:required=\"\"> #{either id (T.pack . unwords) val}\n"
Failed, modules loaded: none.