Skip to content

Commit

Permalink
Disallow deriving for PProxy like types
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Jan 26, 2022
1 parent aa8f133 commit 92993df
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Plutarch/PlutusType.hs
Expand Up @@ -287,8 +287,10 @@ instance PLamL' as b s => PLamL' (a ': as) b s where
-}
type ScottList :: S -> [[PType]] -> PType -> [PType]
type family ScottList s code c where
ScottList _ '[] c = TypeError ( 'Text "Scott encoding: Data type without constructors not accepted")
ScottList _ '[ '[_]] c = TypeError ( 'Text "Scott encoding: Data type with unary constructor not accepted; use newtype!")
-- We disallow certain shapes because Scott encoding is not appropriate for them.
ScottList _ '[] c = TypeError ( 'Text "PlutusType(scott encoding): Data type without constructors not accepted")
ScottList _ '[ '[]] c = TypeError ( 'Text "PlutusType(scott encoding): Data type with single nullary constructor not accepted")
ScottList _ '[ '[_]] c = TypeError ( 'Text "PlutusType(scott encoding): Data type with single unary constructor not accepted; use newtype!")
ScottList s (xs ': xss) c = ScottFn xs c ': ScottList' s xss c

type ScottList' :: S -> [[PType]] -> PType -> [PType]
Expand Down

0 comments on commit 92993df

Please sign in to comment.