{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE TypeFamilies #-}
module Witch.Lift where
import qualified Data.Typeable as Typeable
import qualified Language.Haskell.TH.Syntax as TH
import qualified Witch.Identity as Identity
import qualified Witch.TryCast as TryCast
import qualified Witch.Utility as Utility
liftedCast
:: forall source target m
. ( TryCast.TryCast source target
, TH.Lift target
, Show source
, Typeable.Typeable source
, Typeable.Typeable target
, TH.Quote m
)
=> source
-> TH.Code m target
liftedCast :: forall source target (m :: * -> *).
(TryCast source target, Lift target, Show source, Typeable source,
Typeable target, Quote m) =>
source -> Code m target
liftedCast = target -> Code m target
forall t (m :: * -> *). (Lift t, Quote m) => t -> Code m t
TH.liftTyped (target -> Code m target)
-> (source -> target) -> source -> Code m target
forall b c a. (b -> c) -> (a -> b) -> a -> c
. source -> target
forall source target.
(HasCallStack, TryCast source target, Show source, Typeable source,
Typeable target) =>
source -> target
Utility.unsafeCast
liftedFrom
:: forall s target m source
. ( Identity.Identity s ~ source
, TryCast.TryCast source target
, TH.Lift target
, Show source
, Typeable.Typeable source
, Typeable.Typeable target
, TH.Quote m
)
=> source
-> TH.Code m target
liftedFrom :: forall s target (m :: * -> *) source.
(Identity s ~ source, TryCast source target, Lift target,
Show source, Typeable source, Typeable target, Quote m) =>
source -> Code m target
liftedFrom = source -> Code m target
forall source target (m :: * -> *).
(TryCast source target, Lift target, Show source, Typeable source,
Typeable target, Quote m) =>
source -> Code m target
liftedCast
liftedInto
:: forall t source m target
. ( Identity.Identity t ~ target
, TryCast.TryCast source target
, TH.Lift target
, Show source
, Typeable.Typeable source
, Typeable.Typeable target
, TH.Quote m
)
=> source
-> TH.Code m target
liftedInto :: forall t source (m :: * -> *) target.
(Identity t ~ target, TryCast source target, Lift target,
Show source, Typeable source, Typeable target, Quote m) =>
source -> Code m target
liftedInto = source -> Code m target
forall source target (m :: * -> *).
(TryCast source target, Lift target, Show source, Typeable source,
Typeable target, Quote m) =>
source -> Code m target
liftedCast