Last active
August 29, 2015 14:07
-
-
Save frankcash/93b4623b4d3d515c0b74 to your computer and use it in GitHub Desktop.
Getting an error for "<- param"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
No instance for (scotty-0.5.0:Web.Scotty.Action.Parsable t0) | |
arising from a use of `param' | |
The type variable `t0' is ambiguous | |
Possible fix: add a type signature that fixes these type variable(s) | |
Note: there are several potential instances: | |
instance scotty-0.5.0:Web.Scotty.Action.Parsable () | |
-- Defined in `scotty-0.5.0:Web.Scotty.Action' | |
instance scotty-0.5.0:Web.Scotty.Action.Parsable Bool | |
-- Defined in `scotty-0.5.0:Web.Scotty.Action' | |
instance scotty-0.5.0:Web.Scotty.Action.Parsable | |
Data.ByteString.Internal.ByteString | |
-- Defined in `scotty-0.5.0:Web.Scotty.Action' | |
...plus 7 others | |
In a stmt of a 'do' block: name <- param "name" | |
In the second argument of `($)', namely | |
`do { name <- param "name"; | |
html $ mconcat ["<p>/create/user/:userId/:name</p>"] }' | |
In the expression: | |
get "/create/user/:userId/:name" | |
$ do { name <- param "name"; | |
html $ mconcat ["<p>/create/user/:userId/:name</p>"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Controllers.Home | |
(home | |
, login | |
, foo | |
, createUser | |
, foor | |
) where | |
import Web.Scotty (ScottyM, ActionM, get, html, param) | |
import Data.Monoid (mconcat) | |
import Views.Home (homeView) | |
import Views.Foor (foorView) | |
home :: ScottyM () | |
home = get "/" homeView | |
login :: ScottyM() | |
login = get "/login" $ html "login" | |
foo :: ScottyM() | |
foo = get "/foo" $ html "Hello, this is foo!" | |
-- createUser :: ScottyM() | |
-- createUser = | |
createUser :: ActionM () | |
createUser = get "/create/user/:userId/:name" $ do | |
name <- param "name" | |
html $ mconcat ["<p>/create/user/:userId/:name</p>"] | |
foor :: ScottyM() | |
foor = get "/404" foorView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment