Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in code snippet - Chapter Single Digit Math #5

Open
shubhamkumar13 opened this issue Sep 1, 2019 · 0 comments
Open

Error in code snippet - Chapter Single Digit Math #5

shubhamkumar13 opened this issue Sep 1, 2019 · 0 comments

Comments

@shubhamkumar13
Copy link

shubhamkumar13 commented Sep 1, 2019

function created to compute expression :
expression (x:y:z:[]) = (term x) ++ (addOperation y) ++ (term z)

shows a type error

    • Couldn't match expected type ‘[Char]’ with actual type ‘Char’
    • In the second argument of ‘(++)’, namely ‘(term z)’
      In the second argument of ‘(++)’, namely
        ‘(addOperation y) ++ (term z)’
      In the expression: (term x) ++ (addOperation y) ++ (term z)
   |
17 | expression (x:y:z:[]) = (term x) ++ (addOperation y) ++ (term z)
   |                                                          ^^^^^^

Possible but immature(imo) solution(or hack) that I came up with is
expression (x:y:z:[]) = (term x : []) ++ (addOperation y) ++ (term z : [])

@shubhamkumar13 shubhamkumar13 changed the title Error in code snippet - Chapter Error in code snippet - Chapter Single Digit Math Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant