Skip to content

Instantly share code, notes, and snippets.

@dorchard
Created August 10, 2016 09:58
Show Gist options
  • Save dorchard/8d726882bb3cdbb5bd44e8ffc14e0ff4 to your computer and use it in GitHub Desktop.
Save dorchard/8d726882bb3cdbb5bd44e8ffc14e0ff4 to your computer and use it in GitHub Desktop.
type families for extra information on pretty printer
class Pretty t where
type ExtraInfo t
pprint :: FortranVersion -> t -> ExtraInfo t -> Doc
instance Pretty (Expression a) where
type ExtraInfo (Expression a) = ()
pprint v e () = ...
instance Pretty (Block a) where
type ExtraInfo (Block a) = Int -- indent level
pprint v e i = ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment