{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections     #-}

-- | Description: A convenient way to work with the files in a filesystem structure.

module System.Filesystem.FileTree (FileTree) where

import           Data.ListTrie.Map.Ord (TrieMap)
import           System.Filesystem.PathComponent

-- | A representation of the files in a filesystem, ignoring directories.
type FileTree a = TrieMap PathComponent a

-- for debugging purposes only
{-
showTreeWith :: Show a => (FileData -> a) -> FileTree FileData -> String
showTreeWith f t = LT.showTrie (fmap f t) ""

showTree :: FileTree FileData -> String
showTree = showTreeWith go
    where
      go (fd, exec) =
        Prelude.concat ["(", show . BSL.length $ fd, " bytes", if exec then ", *" else "", ")"]
-}