Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

parse error on input `{' in haskell yesod framework

Tags:

haskell

yesod

I could not understand why this error is occurred
I have created yesod-sqlite project using stack command as follow the instruction in yesod quick start after creating It's working fine. but I want to add my page by follow the instruction and example in this example

Echo.hs handler code is as follows:

module Handler.Echo where

import Import
import           Data.Text (Text)
import qualified Data.Text as T
import           Yesod

getEchoR :: Text -> Handler Html
getEchoR theText = defaultLayout [whamlet|<h1>Hello #{theText}!|]

When I run yesod devel in command prompt I got the following error:

E:\haskell\yesod-new\src\Handler\Echo.hs:9:58: error: parse error on input `{' | 9 | getEchoR theText = defaultLayout [whamlet|Hello #{theText}!|] |
^

-- While building custom Setup.hs for package yesod-new-0.0.0 using: C:\Users\RajeshTarle\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\ Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.3.exe --builddir=.stack-work\dist\7d103d30 build lib:yesod-new --ghc-options " -ddump-hi -ddump-to-file" Process exited with code: ExitFailure 1 Type help for available commands. Press enter to force a rebuild.

I am using Windows please help me. Thanks.

like image 492
Rajesh Avatar asked May 17 '26 17:05

Rajesh


1 Answers

Put the following on top of your file:

{-# LANGUAGE QuasiQuotes #-}

See https://wiki.haskell.org/Quasiquotation

like image 131
mb21 Avatar answered May 21 '26 05:05

mb21



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!