Closed stevana closed 6 years ago
I have a model that uses Fun
from Test.StateMachine.Z
, and in the transition function I'd like to use:
(!) :: (Eq a, Show a, Show b) => Fun a b -> a -> b
f ! x = maybe (error msg) Prelude.id (lookup x f)
where
msg = "!: failed to lookup `" ++ show x ++ "' in `" ++ show f ++ "'"
So that I can see why the function application failed.
Why is it necessary?