diff options
author | Griffin Smith <grfn@gws.fyi> | 2020-06-28T20·43-0400 |
---|---|---|
committer | glittershark <grfn@gws.fyi> | 2020-06-28T23·38+0000 |
commit | 6c7e14d2dcd3a3b124dc035e8feb8e79534cd66a (patch) | |
tree | f551473902e566c03746a8dd2014634a48a2c434 /users/glittershark/xanthous/src/Xanthous/Data/VectorBag.hs | |
parent | 20bc4aa10dffcbcc42139afafa10aa5f7a5090bb (diff) |
feat(xan): Use Witherable in the prelude r/1110
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 <grfn@gws.fyi>
Diffstat (limited to 'users/glittershark/xanthous/src/Xanthous/Data/VectorBag.hs')
-rw-r--r-- | users/glittershark/xanthous/src/Xanthous/Data/VectorBag.hs | 6 |
1 files changed, 6 insertions, 0 deletions
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 |