0

I have the following code in Haskell and I want to change the line

toNanoStmt (VarDeclStmt _ array)= SeqList (toNanoStmt (map (\(VarDecl _ (Id a x) (Just exp))) array ))

Basically I want to use VarDeclStmt by creating a sequence of assign statements. A SeqList takes a list of statements. I have the list of VarDecls! And I have again use a map to convert the varDeclArr to a list of assignments. But am getting this error:

parse error on input ‘)’

1 Answer 1

2

Your lambda-expression has no body.

After parameters, there has to come a right arrow -> followed by the body, for example:

addTwo = (\x -> x + 2)

So in your case you need to do something like this:

toNanoStmt (VarDeclStmt _ array)= SeqList (toNanoStmt (map (\(VarDecl _ (Id a x) (Just exp)) -> <body goes here>) array ))
Sign up to request clarification or add additional context in comments.

1 Comment

And the lambda probably should handle Nothing as well as Just exp.

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.