Skip to content

Commit

Permalink
fix prettyprint infinite loop lol
Browse files Browse the repository at this point in the history
  • Loading branch information
bristermitten committed Apr 8, 2023
1 parent 97c44b8 commit ace5c19
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Elara/Data/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ class Pretty a where
instance {-# OVERLAPPABLE #-} (PP.Pretty a) => Pretty a where
pretty p = (PP.pretty p)

instance {-# OVERLAPPABLE #-} Pretty a => PP.Pretty a where
pretty = unAnnotate . pretty

-- hack
instance PP.Pretty (Doc AnsiStyle) where
pretty = unAnnotate


escapeChar :: (IsString s) => Char -> s
Expand All @@ -57,6 +59,13 @@ listToText elements =



instance Pretty i => Pretty [i] where
pretty = align . list . map pretty

instance (Pretty a, Pretty b) => Pretty (a, b) where
pretty (a, b) = tupled [pretty a, pretty b]


instance (Pretty k, Pretty v) => Pretty (Map k v) where
pretty m = pretty (Map.toList m)

Expand Down

0 comments on commit ace5c19

Please sign in to comment.