Hi
I'm quite new to Yesod myself, so someone will amend this if I'm wrong.
The syntax "[parseRoutes| ... |]" isn't part of the Haskell language,
it's a quasi-quote which is only allowed through an extension called
"Template Haskell" (TH).
You need to activate some compiling options in order to activate TH.
This can be done on the command line, but the simplest way is to add the
following line at the beginning of your file:
~~~~
{-# LANGUAGE TemplateHaskell, QuasiQuotes, OverloadedStrings, MultiParamTypeClasses, TypeFamilies #-}
~~~~
So the complete file becomes:
~~~~
{-# LANGUAGE TemplateHaskell, QuasiQuotes, OverloadedStrings, MultiParamTypeClasses, TypeFamilies #-}
import Yesod
data HelloWorld = HelloWorld
mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]
instance Yesod HelloWorld
getHomeR :: Handler RepHtml
getHomeR = defaultLayout [whamlet|Helloworld!|]
main :: IO ()
main = warpDebug 3000 HelloWorld
~~~~
Hope that helps
--
François
On 2012-08-07, "Sok H. Chang" <
sha...@gmail.com> wrote:
> I'm new to Haskell & Yesod.
> If this question border you, sorry for this...
> How can I fix my error?
>
> I got error message.
> $ runhaskell helloworld.hs
> helloworld.hs:6:23: parse error on input `/'
>
> helloworld.hs
> -----------------------------------------------------------------
> import Yesod
>
> data HelloWorld = HelloWorld
>
> mkYesod "HelloWorld" [parseRoutes|
> / HomeR GET
> |]
>
> instance Yesod HelloWorld
> getHomeR:: Handler RepHtml
> getHomeR = defaultLayout [whamlet|Helloworld!|]
>
> main :: IO ()
> main = warpDebug 3000 HelloWorld