1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

📝 disamb.

This commit is contained in:
Rob Rix 2017-08-04 09:16:24 -04:00
parent 17102a87b8
commit a778382e85

View File

@ -14,6 +14,9 @@ data Amb l r
| Some (NonEmpty r) -- ^ One or more results.
deriving (Eq, Foldable, Functor, Show, Traversable)
-- | Disambiguate an 'Amb' by case analysis.
--
-- If the value is @'None' l@, apply the first function to @l@; if it is @'Some' rs@, apply the second function to @rs@.
disamb :: (l -> a) -> (NonEmpty r -> a) -> Amb l r -> a
disamb f _ (None l) = f l
disamb _ g (Some r) = g r