<commit_before>
-- Listing of a directory
module Tree (
    Tree ( Tree )
  , Entry ( Entry )
  , Id
  , create
  , createEntry
  , toBlob
) where

import Control.Monad ( forM_ )
import Crypto.Hash.SHA3 ()
import qualified Blob
import qualified Data.Binary as Binary
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L

import qualified ContentIdentifier as CI

type HashDigest = B.ByteString

type Id = CI.Id

type Mode = Int
type Filename = String
data Entry = Entry Mode Filename Blob.Id deriving (Eq, Show)

type Entries = [Entry]

data Tree = Tree Id Entries deriving (Show, Eq)

instance Binary.Binary Tree where
	put (Tree ident entries) = do
		Binary.put ident
		forM_ entries Binary.put
	get = do
		Binary.get

instance Binary.Binary Entry where
	put (Entry mode filename key) = do
		Binary.put mode<commit_msg>Remove unused imports in Tree<commit_after>
-- Listing of a directory
module Tree (
    Tree ( Tree )
  , Entry ( Entry )
  , Id
  , create
  , createEntry
  , toBlob
) where

import Control.Monad ( forM_ )
import Crypto.Hash.SHA3 ()
import qualified Blob
import qualified Data.Binary as Binary
import qualified Data.ByteString.Lazy as L

import qualified ContentIdentifier as CI

type Id = CI.Id

type Mode = Int
type Filename = String
data Entry = Entry Mode Filename Blob.Id deriving (Eq, Show)

type Entries = [Entry]

data Tree = Tree Id Entries deriving (Show, Eq)

instance Binary.Binary Tree where
	put (Tree ident entries) = do
		Binary.put ident
		forM_ entries Binary.put
	get = do
		Binary.get

instance Binary.Binary Entry where
	put (Entry mode filename key) = do
		Binary.put mode
{'fraction_non_alphanumeric': 0.06873479318734793, 'fraction_numerical': 0.0012165450121654502, 'mean_word_length': 3.6338028169014085, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '445223', 'n_tokens_mistral': 525, 'n_tokens_neox': 500, 'n_words': 205}