yav / pretty-show

Tools for working with derived Show instances in Haskell.
MIT License
57 stars 15 forks source link

ppShow doesn't do anything #48

Closed yaitskov closed 1 year ago

yaitskov commented 1 year ago

PathSegmentTrie {unPathSegmentTrie = Trie (fromList [(0x62,(Nothing,Trie (fromList [(0x61,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0x4000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0x8000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0xc000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList [])))]))),(0x4000000000000062,(Nothing,Trie (fromList [(0x61,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0x4000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0x8000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0xc000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList [])))]))),(0x8000000000000062,(Nothing,Trie (fromList [(0x61,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0x4000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0x8000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0xc000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList [])))]))),(0xc000000000000062,(Nothing,Trie (fromList [(0x61,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0x4000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0x8000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList []))),(0xc000000000000061,(Just (PathSegmentTrie {unPathSegmentTrie = Trie (fromList [])}),Trie (fromList [])))])))])}"

type EncodedChar = Word

newtype TrieNodeKey = TrieNodeKeyChar { unTrieNodeKey :: EncodedChar } deriving (Eq, Ord, Hashable)

instance Show TrieNodeKey where
  show (TrieNodeKeyChar c) = "0x" <> showHex c ""

newtype TrieKey = TrieKey [TrieNodeKey] deriving (Show, Eq, Ord)

newtype Trie a = Trie (M.HashMap TrieNodeKey (Maybe a, Trie a))
  deriving (Show, Eq, Ord)

newtype PathSegmentTrie = PathSegmentTrie { unPathSegmentTrie :: Trie PathSegmentTrie } deriving (Show, Eq)

library version 1.10

yav commented 1 year ago

Seems to work OK if you drop the last double quote. Perhaps just a copy-paste issue?

yaitskov commented 1 year ago

Thanks for reply. Today I had a fresh look on my code and noticed that applied ppShow is a String of showed value. ppShow applied to just "a" works well.