replace isJust / fromJust with case