summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-07-26 15:05:32 +0200
committertv <tv@krebsco.de>2022-07-26 15:06:26 +0200
commit96a6129b0fe0f47222609bcdfb72f5e8abc750a6 (patch)
tree709b475ffbde204323b063929dbdcb861974da82
parentc1253c39fa49b2f7eae54c0ed143213277d43681 (diff)
manually derive SafeCopy for Cookie and CookieJarHEADmaster
-rw-r--r--Regfish/Types.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/Regfish/Types.hs b/Regfish/Types.hs
index 734c6c3..23a4c30 100644
--- a/Regfish/Types.hs
+++ b/Regfish/Types.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
@@ -10,14 +9,22 @@ import Control.Lens
import Control.Monad.Reader
import Control.Monad.State
import qualified Data.ByteString.Char8 as BS8
-import Data.SafeCopy (base, deriveSafeCopy)
+import Data.SafeCopy (SafeCopy, base, contain, deriveSafeCopy, getCopy, putCopy, safeGet, safePut, version)
import Data.Typeable
import qualified Network.HTTP.Client as C
import qualified Network.Wreq as W
-deriveSafeCopy 0 'base ''C.CookieJar
-deriveSafeCopy 0 'base ''W.Cookie
+instance SafeCopy W.Cookie where
+ version = 1
+ putCopy = contain . safePut . show
+ getCopy = contain $ read <$> safeGet
+
+
+instance SafeCopy C.CookieJar where
+ version = 1
+ putCopy = contain . safePut . show
+ getCopy = contain $ read <$> safeGet
newtype Regfish a = Regfish