yav / pretty-show

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

Using `ppsh` in GHCi #29

Closed CMCDragonkai closed 6 years ago

CMCDragonkai commented 6 years ago

Just wanted to share the ability to use ppsh inside GHCi which is quite useful:

 -- Pretty prints a showable expression or binding
 :def pp (\s -> return $ ":cmd return $ \":! echo '\" ++ show " ++ s ++ " ++ \"' | ppsh\

 -- Pretty prints a string expression or binding
 :def pps (\s -> return $ ":cmd return $ \":! echo '\" ++ " ++ s ++ " ++ \"' | ppsh\"")

This means you don't have to import the pretty-show package for a project just to interactively explore nested structures.

CMCDragonkai commented 6 years ago

Actually I think I have something wrong here.