私はこの機能を持っています:
isUndefined :: () -> Bool
isUndefined x = case unsafePerformIO $ (try (return $! x) :: IO (Either SomeException ())) of
Left _ -> True
Right _ -> False
それから:
isUndefined () = False
isUndefined undefined = True
停止の問題を解決します。もちろん、これは他のタイプにも拡張できます。
私の質問:これはどのように可能ですか?ここで本当にControl.Exception.try
物事を壊していますか?