Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ The changelog is available [on GitHub][2].
Remove `ghc-prim` dependency.
- [#488](https://github.com/kowainik/relude/pull/488):
Add missing fixity declarations for `elem` and `notElem`.
- [#493](https://github.com/kowainik/relude/pull/493):
Introduce `(.#)`.

## 1.2.2.2 – Aug 5, 2025

Expand Down
16 changes: 14 additions & 2 deletions src/Relude/Extra/Newtype.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Relude.Extra.Newtype
, under2
, underF2
, (#.)
, (.#)
) where

import Relude
Expand Down Expand Up @@ -100,11 +101,22 @@ underF2 :: forall n a . Coercible a (n a) => (n a -> n a -> n a) -> (a -> a -> a
underF2 = coerce
{-# INLINE underF2 #-}

{- | Coercible composition. This function allows to write more efficient
implementations of function compositions over @newtypes@.
{- | Coercible composition where the first argument is an identity function
up to representational equivalence. This function allows to write more
efficient implementations of function compositions over @newtypes@.

@since 0.3.0
-}
(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
(#.) _f = coerce
{-# INLINE (#.) #-}

{- | Coercible composition where the second argument is an identity function
up to representational equivalence. This function allows to write more
efficient implementations of function compositions over @newtypes@.

@since 1.2.3.0
-}
(.#) :: Coercible a b => (b -> c) -> (a -> b) -> (a -> c)
(.#) f _g = coerce f
{-# INLINE (.#) #-}
Loading