From 1fedb7f1e73bc56002181775a546e9c2407a8e40 Mon Sep 17 00:00:00 2001 From: Lia Lenckowski Date: Thu, 24 Aug 2023 14:00:11 +0200 Subject: add toEncoding implementations (~15% encoding speedup) --- src/Main.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 0f0146c..626983c 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -42,7 +42,10 @@ instance ToJSON PendingBang where Nothing -> [] Just e -> ["email" .= e] - -- TODO toEncoding. Not sure how much value that holds though + toEncoding (PendingBang b u dp em) = pairs $ case em of + Nothing -> withoutEmail + Just e -> withoutEmail <> "email" .= e + where withoutEmail = "bang" .= b <> "url" .= u <> "name" .= dp instance FromJSON PendingBang where parseJSON = withObject "PendingBang" $ \ob -> -- cgit v1.2.3-70-g09d2