You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
instancedecodeLiteralConstructor :: (IsSymbolname) =>DecodeLiteral (Rep.Constructorname (Rep.NoArguments)) where
112
+
decodeLiteral tagNameTransform j = do
113
+
let name = reflectSymbol (SProxy::SProxyname)
114
+
let decodingErr msg = "When decoding a " <> name <> ": " <> msg
115
+
tag <- mFail (decodingErr "could not read string for constructor") (toString j)
116
+
when (tag /= tagNameTransform name) $
117
+
Left $ decodingErr "string literal " <> tag <> " had an incorrect value."
118
+
pure $ Rep.Constructor (Rep.NoArguments)
119
+
120
+
typeFailMessage="""`decodeLiteralSum` can only be used with sum types, where all of the constructors are nullary. This is because a string literal cannot be encoded into a product type."""
121
+
122
+
instancedecodeLiteralConstructorCannotTakeProduct
123
+
:: FailFailMessage
124
+
=>DecodeLiteral (Rep.Productab) where
125
+
decodeLiteral _ _ = unsafeCrashWith "unreachable DecodeLiteral was reached."
typeFailMessage="""`encodeLiteralSum` can only be used with sum types, where all of the constructors are nullary. This is because a string literal cannot be encoded into a product type."""
92
+
93
+
instanceencodeLiteralConstructorCannotBeProduct
94
+
:: FailFailMessage
95
+
=>EncodeLiteral (Rep.Productab) where
96
+
encodeLiteral _ _ = unsafeCrashWith "unreachable encodeLiteral was reached."
0 commit comments