0

I have a do block in my Yesod tests and I want to be test the response with an expected response.

I attempted to create an expected response in this do block

let expectedUser = User [authorized = true, ident = "AdminUser", displayName = Nothing, id = 1, avatar = Nothing]

On this line I get the error

parse error on input ‘=’
Perhaps you need a 'let' in a 'do' block?

on the = after authorized. How would I rewrite this line so that it would work inside a do block?

0

1 Answer 1

6

The advice you're getting in the compile error is mostly irrelevant, because the parser really has no idea what you're trying to do here. Record syntax uses curly braces { and }, not [ and ]. So it should look like:

let expectedUser = User {authorized = true, ident = "AdminUser", displayName = Nothing, id = 1, avatar = Nothing}

and I would suggest some line breaks :)

let expectedUser = User { authorized = true
                        , ident = "AdminUser"
                        , displayName = Nothing
                        , id = 1
                        , avatar = Nothing
                        }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.