snix/users/glittershark/xanthous/src/Xanthous/Prelude.hs
Griffin Smith beb29128b6 fix(xan): fix compat with new base+ghc
A couple of changes necessary to get things working with both ghc 8.8.3
and the new base:

- Explicitly import fail from Control.Monad.Fail in the prelude, since
  it's there instead of the base prelude now
- GHC no longer allows type family equality constraints in quantified
  constraints - which is a bummer - but is avoidable in the one case
  where it was happening
- Explicitly import a constructor from Data.List.NonEmpty

Change-Id: Ia06fc724ddc2d6a3f9024c047ed55eea40bcf408
Reviewed-on: https://cl.tvl.fyi/c/depot/+/744
Tested-by: BuildkiteCI
Reviewed-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2020-07-03 14:41:36 +00:00

47 lines
1.3 KiB
Haskell

--------------------------------------------------------------------------------
module Xanthous.Prelude
( module ClassyPrelude
, Type
, Constraint
, module GHC.TypeLits
, module Control.Lens
, module Data.Void
, module Control.Comonad
, module Data.Witherable
, fail
, (&!)
-- * Classy-Prelude addons
, ninsertSet
, ndeleteSet
, toVector
) where
--------------------------------------------------------------------------------
import ClassyPrelude hiding
( return, (<|), unsnoc, uncons, cons, snoc, index, (<.>), Index, say
, catMaybes, filter, mapMaybe, hashNub, ordNub
)
import Data.Kind
import GHC.TypeLits hiding (Text)
import Control.Lens hiding (levels, Level)
import Data.Void
import Control.Comonad
import Data.Witherable
import Control.Monad.Fail (fail)
--------------------------------------------------------------------------------
ninsertSet
:: (IsSet set, MonoPointed set)
=> Element set -> NonNull set -> NonNull set
ninsertSet x xs = impureNonNull $ opoint x `union` toNullable xs
ndeleteSet :: IsSet b => Element b -> NonNull b -> b
ndeleteSet x = deleteSet x . toNullable
toVector :: (MonoFoldable (f a), Element (f a) ~ a) => f a -> Vector a
toVector = fromList . toList
infixl 1 &!
(&!) :: a -> (a -> b) -> b
(&!) = flip ($!)