{-# LANGUAGE QuantifiedConstraints #-}
module Blanks.NatNewtype
( NatNewtype
, natNewtypeFrom
, natNewtypeTo
) where
import Data.Coerce (Coercible, coerce)
import Data.Kind (Type)
class
( forall a. Coercible (m a) (g a)
, forall a. Coercible (g a) (m a)
)=> NatNewtype (m :: Type -> Type) (g :: Type -> Type) | g -> m
natNewtypeTo :: NatNewtype m g => m a -> g a
natNewtypeTo :: m a -> g a
natNewtypeTo = m a -> g a
forall a b. Coercible a b => a -> b
coerce
{-# INLINE natNewtypeTo #-}
natNewtypeFrom :: NatNewtype m g => g a -> m a
natNewtypeFrom :: g a -> m a
natNewtypeFrom = g a -> m a
forall a b. Coercible a b => a -> b
coerce
{-# INLINE natNewtypeFrom #-}