'entryCase' doesn't work with parameter that has only one constructor
Description
Looks like with the new GHC, entryCase
cannot be used with the parameter types that have exactly one constructor
Steps to reproduce
The following sample should have this problem
data Parameter = Parameter ParameterInner
deriving stock (Generic, Show)
deriving anyclass (IsoValue, HasAnnotation)
data ParameterInner = Param1 () | Param2 ()
deriving stock (Generic, Show)
deriving anyclass (IsoValue, HasAnnotation)
instance ParameterHasEntrypoints Parameter where
type ParameterEntrypointsDerivation Parameter = EpdDelegate
instance ParameterHasEntrypoints ParameterInner where
type ParameterEntrypointsDerivation ParameterInner = EpdPlain
data Storage = Storage ()
deriving stock (Generic, Show)
deriving anyclass (IsoValue, HasAnnotation)
sampleContract
:: (HasStorage Storage, HasSideEffects)
=> Var Parameter -> IndigoProcedure
sampleContract param = do
entryCase @Parameter (Proxy @PlainEntrypointsKind) param
( #cParameter #= return ()
)
The following workaround works:
sampleContract param = do
entryCaseRec @Parameter (Proxy @PlainEntrypointsKind) param $
( cParameter #= return ()
) :& RNil
Prerequisites (if needed):
Expected behaviour
entryCase
can be used with single constructor types.
Actual behaviour
It cannot be easily used, looks like GHC assumes that it's GHC.Unit
instead of IsoRecTuple
Environment
Edited by Roman Melnikov