forked from TokTok/hs-toxcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add new group chats savedata support.
- Loading branch information
Showing
19 changed files
with
392 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
\subsection{Bytes} | ||
|
||
Arbitrary byte array. | ||
|
||
\begin{code} | ||
{-# LANGUAGE DeriveGeneric #-} | ||
{-# LANGUAGE StrictData #-} | ||
module Network.Tox.SaveData.Bytes | ||
( Bytes (..) | ||
) where | ||
import Data.Binary (Binary (..)) | ||
import qualified Data.Binary.Get as Get | ||
import qualified Data.Binary.Put as Put | ||
import qualified Data.ByteString.Lazy as LBS | ||
import Data.MessagePack (MessagePack) | ||
import GHC.Generics (Generic) | ||
import Test.QuickCheck.Arbitrary (Arbitrary (..)) | ||
newtype Bytes = Bytes LBS.ByteString | ||
deriving (Eq, Show, Read, Generic) | ||
instance MessagePack Bytes | ||
instance Binary Bytes where | ||
get = Bytes <$> Get.getRemainingLazyByteString | ||
put (Bytes bs) = Put.putLazyByteString bs | ||
instance Arbitrary Bytes where | ||
arbitrary = Bytes . LBS.pack <$> arbitrary | ||
\end{code} |
Oops, something went wrong.