I am using Visual Studio Code as the text editor of chice and the following Haskell code does not compile. Apperently due to indentation or missing parentheses mistake. Since there are no parenthesies I wonder where the problem is
safeSqrt :: Either String Doubble -> Either String | Doubble
safeSqrt sx =
case sx of
Left str -> Left str
Right x -> if x < 0
then Left "Error"
else Right $ sqrt x
The GHCi throws the following error message:
Main.hs:51:1: error:
parse error (possibly incorrect indentation or mismatched brackets)
|
51 | safeSqrt sx =
| ^
Can enybody help
Thanks
Tom
Either String Double
, not with a pipe in between. – Willem Van Onsem