I'm trying to implement a subString function which has a conditional part:
"This function can accept negative start and end position. Negative start position can be considered as zero (e.g. substring from the first character) and negative end position should result in an empty string." My current solution looks like this , however something is definitely wrong because ghc not recognizing it with :"Variable not in scope: subString"(the loading part is working maybe indentation error? )
subString :: Int -> Int -> String -> String
subString start end str | (start <= 0) && (end > 0) = take (end +1) str
| (start > 0) && (end <= 0) = []
| otherwise = take ((end +1) - start )(drop start str)
Thanks for the help