I have a function that needs to terminate on a certain condition. So for example say we have the following functions:
func :: Int -> [[Int]] -> [[Int]]
func _ [] = []
func x (a:as) = func2 x a:func x as
func2 :: Int -> [Int] -> [Int]
func2 _ [] = []
func2 x (a:as) = x*a:func2 x as
Lets say that I want func one to be called as normal but whenever we get a negative value in the [[Int]] input, we terminate. so we only deal with positive values. so How could you make func2 send some signal to quit the whole process rather than continuing?