Hoogle Search
Within LTS Haskell 24.19 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
deriveSafeCopyHappstackDataIndexedType :: Version a -> Name -> Name -> [Name] -> Q [Dec]safecopy Data.SafeCopy.Internal No documentation available.
deriveSafeCopyIndexedType :: Version a -> Name -> Name -> [Name] -> Q [Dec]safecopy Data.SafeCopy.Internal No documentation available.
deriveSafeCopySimple :: Version a -> Name -> Name -> Q [Dec]safecopy Data.SafeCopy.Internal Derive an instance of SafeCopy. The instance derived by this function is simpler than the one derived by deriveSafeCopy in that we always use safePut and safeGet (instead of getSafePut and getSafeGet). When serializing, we put a Word8 describing the constructor (if the data type has more than one constructor) and, for each field of the constructor, we use safePut. For example, given the data type and the declaration below
data T a b = C a a | D b Int deriveSafeCopySimple 1 'base ''T
we generateinstance (SafeCopy a, SafeCopy b) => SafeCopy (T a b) where putCopy (C arg1 arg2) = contain $ do putWord8 0 safePut arg1 safePut arg2 return () putCopy (D arg1 arg2) = contain $ do putWord8 1 safePut arg1 safePut arg2 return () getCopy = contain $ do tag <- getWord8 case tag of 0 -> do return C <*> safeGet <*> safeGet 1 -> do return D <*> safeGet <*> safeGet _ -> fail $ "Could not identify tag \"" ++ show tag ++ "\" for type Main.T " ++ "that has only 2 constructors. " ++ "Maybe your data is corrupted?" version = 1 kind = base
Using this simpler instance means that you may spend more bytes when serializing data. On the other hand, it is more straightforward and may match any other format you used in the past. Note that you may use deriveSafeCopy with one version of your data type and deriveSafeCopySimple in another version without any problems.deriveSafeCopySimpleIndexedType :: Version a -> Name -> Name -> [Name] -> Q [Dec]safecopy Data.SafeCopy.Internal No documentation available.
deriveTextShow :: Name -> Q [Dec]text-show TextShow.TH Generates a TextShow instance declaration for the given data type or data family instance. Since: 2
deriveTextShow1 :: Name -> Q [Dec]text-show TextShow.TH Generates a TextShow1 instance declaration for the given data type or data family instance. Since: 2
deriveTextShow1Options :: Options -> Name -> Q [Dec]text-show TextShow.TH Like deriveTextShow1, but takes an Options argument. Since: 3.4
deriveTextShow2 :: Name -> Q [Dec]text-show TextShow.TH Generates a TextShow2 instance declaration for the given data type or data family instance. Since: 2
deriveTextShow2Options :: Options -> Name -> Q [Dec]text-show TextShow.TH Like deriveTextShow2, but takes an Options argument. Since: 3.4
deriveTextShowOptions :: Options -> Name -> Q [Dec]text-show TextShow.TH Like deriveTextShow, but takes an Options argument. Since: 3.4