Haskell.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview
newer
ANN, WARNING: new boomerang 1.3.0...

A trouble with hamlet quasiquoter

older
simple-sendfile v0.2.1

Dmitry Vyal

24 Feb 2012 24 Feb '12
4:10 a.m.

Greetings, I'm trying to write a custom Yesod field for displaying a list of words. I copied the code from textareaField and played with it. Unfortunately, I'm getting a rather strange error message from the compiler. What's I'm doing wrong? data GenTask = GenTask { gtWords :: [String], gtNumResults :: Int } blank :: (Monad m, RenderMessage master FormMessage) => (Text -> Either FormMessage a) -> [Text] -> m (Either (SomeMessage master) (Maybe a)) blank _ [] = return $ Right Nothing blank _ ("":_) = return $ Right Nothing blank f (x:_) = return $ either (Left . SomeMessage) (Right . Just) $ f x textListField = Field { fieldParse = blank $ Right . map T.unpack . T.words , fieldView = \theId name theClass val isReq -> addHamlet [hamlet|\