infi :: Maybe Int
infi = infi
stop :: Maybe Int
stop = Nothing
test :: Int
test = case (infi, stop) of
(Nothing, Just _) -> 1
(_, _) -> 2
Here, infi is an action that never ends, and stop a function that ends immediately. I thought that the compiler would see that stop evaluates immediately to Nothing and thus will return 2, but it tries to evaluate infi and get stuck.
I think it happens because I am using a tuple to hold both values (but not really sure about it). Do you know a way to make this arrangement work?
Yotam