我想在我的代码中表示一个上限的概念,所以我创建了一个有区别的联合: data UpperBound a = UpperBound a | DoNotCare deriving (Eq, Read, Showfmap f (UpperBound x) = UpperBound $ f x
pure = UpperBoundDoNotCare <*> _ = DoNotCare
_ &l
这可能是不好的做法,但我尝试接受来自用户的输入,条件如下: lowerBound必须小于upperBound,也不能为零 如果这些条件中的任何一个都不满足,我希望让它们为变量输入新值 int lowerBound; Scanner input = new Scanner(System.in); while(lowerBound = input.nextInt();
System.out.println("Enter an upp