{-# LANGUAGE CPP #-}
{-# LANGUAGE Trustworthy #-}
module CoerceCompat where

import Data.Coerce (Coercible, coerce)

(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
b -> c
_ #. :: forall b c a. Coercible b c => (b -> c) -> (a -> b) -> a -> c
#. a -> b
x = (a -> b) -> a -> c
forall a b. Coercible a b => a -> b
coerce a -> b
x

(#..) :: Coercible b c => (b -> c) -> (i -> a -> b) -> (i -> a -> c)
b -> c
_ #.. :: forall b c i a.
Coercible b c =>
(b -> c) -> (i -> a -> b) -> i -> a -> c
#.. i -> a -> b
x = (i -> a -> b) -> i -> a -> c
forall a b. Coercible a b => a -> b
coerce i -> a -> b
x

infixr 9 #., #..
{-# INLINE (#.) #-}
{-# INLINE (#..) #-}