Skip to content

Commit

Permalink
inline existing functions for nonnull
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin committed Nov 20, 2024
1 parent 7723cc2 commit 130e338
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mono-traversable/src/Data/NonNull.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,23 @@ instance GrowingAppend mono => GrowingAppend (NonNull mono)

instance (Semigroup mono, GrowingAppend mono) => Semigroup (NonNull mono) where
(<>) = unsafeMap2 (<>)
{-# INLINE (<>) #-}

instance SemiSequence seq => SemiSequence (NonNull seq) where
type Index (NonNull seq) = Index seq

intersperse e = unsafeMap $ intersperse e
{-# INLINE intersperse #-}
reverse = unsafeMap reverse
{-# INLINE reverse #-}
find f = find f . toNullable
{-# INLINE find #-}
cons x = unsafeMap $ cons x
{-# INLINE cons #-}
snoc xs x = unsafeMap (flip snoc x) xs
{-# INLINE snoc #-}
sortBy f = unsafeMap $ sortBy f
{-# INLINE sortBy #-}

instance SemiSetContainer set => SemiSetContainer (NonNull set) where
type ContainerKey (NonNull set) = ContainerKey set
Expand Down

0 comments on commit 130e338

Please sign in to comment.