{-# 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
. ( TryCast.TryCast source target
, TH.Lift target
, Show source
, Typeable.Typeable source
, Typeable.Typeable target
)
=> source
-> TH.Q (TH.TExp target)
liftedCast :: source -> Q (TExp target)
liftedCast = target -> Q (TExp target)
forall t. Lift t => t -> Q (TExp t)
TH.liftTyped (target -> Q (TExp target))
-> (source -> target) -> source -> Q (TExp 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 source
. ( Identity.Identity s ~ source
, TryCast.TryCast source target
, TH.Lift target
, Show source
, Typeable.Typeable source
, Typeable.Typeable target
)
=> source
-> TH.Q (TH.TExp target)
liftedFrom :: source -> Q (TExp target)
liftedFrom = source -> Q (TExp target)
forall source target.
(TryCast source target, Lift target, Show source, Typeable source,
Typeable target) =>
source -> Q (TExp target)
liftedCast
liftedInto
:: forall t source target
. ( Identity.Identity t ~ target
, TryCast.TryCast source target
, TH.Lift target
, Show source
, Typeable.Typeable source
, Typeable.Typeable target
)
=> source
-> TH.Q (TH.TExp target)
liftedInto :: source -> Q (TExp target)
liftedInto = source -> Q (TExp target)
forall source target.
(TryCast source target, Lift target, Show source, Typeable source,
Typeable target) =>
source -> Q (TExp target)
liftedCast