Strange GHC Behaviour

I am a beginner to Haskell and I am facing some strange behaviour. Same code sometimes executes and sometimes it doesn’t. It was hard to explain but somehow I managed to create a video to show this behaviour.

Please go through this video and help me if you got any idea.

I suspect that this could be due to some indentation or spacing but really not sure how.
I am using vscode and set space instead of tabs for indentation.

I changed indentation to tabs from spaces and it solved my problem.
Don’t know why though.
:slight_smile:

do notation and other indentation-sensitive syntax can be tricky when mixing spaces and tabs.

I recommend always using the -Wall GHC flag. This enables (among other things) -Wtabs, which will emit a warning when tabs are found in the source file.

1 Like

Thanks. I’ll take care of it. :slight_smile: