Closed yaxollum closed 1 year ago
For the last question of the Section 15.9 quiz:
[]
Validation
This is what I tested in GHCi:
λ> pure 3 <* pure 4 :: Maybe Int Just 3 λ> pure 3 <|> pure 4 :: Maybe Int Just 3
λ> pure 3 <* pure 4 :: Validation Int Ok 3 λ> pure 3 <|> pure 4 :: Validation Int Ok 3
λ> pure 3 <* pure 4 :: [Int] [3] λ> pure 3 <|> pure 4 :: [Int] [3,4]
For the `[]` Applicative, `pure 3 <* pure 4` produces `[3]`, whereas `pure 3 <|> pure 4` produces `[3,4]`.
thanks!
For the last question of the Section 15.9 quiz:
The correct option should be
[]
, notValidation
.This is what I tested in GHCi:
λ> pure 3 <* pure 4 :: Validation Int Ok 3 λ> pure 3 <|> pure 4 :: Validation Int Ok 3
λ> pure 3 <* pure 4 :: [Int] [3] λ> pure 3 <|> pure 4 :: [Int] [3,4]