我有在Haskell數據類型有點問題,我想我應該先發布一些代碼來幫助理解這個問題 helper :: (MonadMask a, MonadIO a, Functor a) => Expr -> String -> a (Either InterpreterError Int)
helper x y = (getEval (mkCodeString x y))
-- Creates Code
Either應該帶參數化功能嗎? case class FunOrSeq[T1, T2](e: Either[Function1[T1, T2], Iterable[T1]])
def f: Int => Int = x => x
scala> FunOrSeq(Left(f))
<console>:11: error: type mismatch;
found : scala.uti
我有以下方法: firstRightOrLefts :: [Either b a] -> Either [b] a
firstRightOrLefts eithers =
case partitionEithers eithers of
(_, (x : _)) -> Right x
(xs, _) -> Left xs
讓我困擾的是醜陋的模式匹配,我想知