{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
module Plutarch.DataRepr.Internal.FromData (PFromDataable, pmaybeFromAsData) where
import Plutarch.Builtin.Data (PAsData)
import Plutarch.Internal.IsData (PIsData, pfromData)
import Plutarch.Internal.Term (PType, Term)
class PFromDataable (a :: PType) (b :: PType) | b -> a, a -> b where
pmaybeFromAsData :: Term s (PAsData a) -> Term s b
instance {-# OVERLAPPABLE #-} PFromDataable a (PAsData a) where
pmaybeFromAsData :: forall (s :: S). Term s (PAsData a) -> Term s (PAsData a)
pmaybeFromAsData = Term s (PAsData a) -> Term s (PAsData a)
forall a. a -> a
id
instance {-# OVERLAPPABLE #-} (PIsData a, b ~ a) => PFromDataable a b where
pmaybeFromAsData :: forall (s :: S). Term s (PAsData a) -> Term s b
pmaybeFromAsData = Term s (PAsData a) -> Term s a
Term s (PAsData a) -> Term s b
forall (a :: PType) (s :: S).
PIsData a =>
Term s (PAsData a) -> Term s a
pfromData