From 6c7e14d2dcd3a3b124dc035e8feb8e79534cd66a Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 28 Jun 2020 16:43:20 -0400 Subject: feat(xan): Use Witherable in the prelude Install the witherable library, expose it in the prelude, and update all call sites that are broken by that change. This is a really nice library, and basically the ideal abstraction layer for what it does. Change-Id: I640e099318c1ecce0ad483bc336c379698bdab88 Reviewed-on: https://cl.tvl.fyi/c/depot/+/725 Reviewed-by: glittershark --- users/glittershark/xanthous/src/Xanthous/Data/VectorBag.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'users/glittershark/xanthous/src/Xanthous/Data/VectorBag.hs') diff --git a/users/glittershark/xanthous/src/Xanthous/Data/VectorBag.hs b/users/glittershark/xanthous/src/Xanthous/Data/VectorBag.hs index bd9af369e01c..2e6d48062a45 100644 --- a/users/glittershark/xanthous/src/Xanthous/Data/VectorBag.hs +++ b/users/glittershark/xanthous/src/Xanthous/Data/VectorBag.hs @@ -35,6 +35,7 @@ newtype VectorBag a = VectorBag (Vector a) , Semigroup , Arbitrary , CoArbitrary + , Filterable ) makeWrapped ''VectorBag @@ -59,6 +60,11 @@ instance AsEmpty (VectorBag a) where (VectorBag Empty) -> Just () _ -> Nothing +instance Witherable VectorBag where + wither f (VectorBag v) = VectorBag <$> wither f v + witherM f (VectorBag v) = VectorBag <$> witherM f v + filterA p (VectorBag v) = VectorBag <$> filterA p v + {- TODO: , Ixed -- cgit 1.4.1