diff options
Diffstat (limited to 'app/Render.hs')
-rw-r--r-- | app/Render.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/Render.hs b/app/Render.hs index 964581f..6cb0373 100644 --- a/app/Render.hs +++ b/app/Render.hs @@ -35,6 +35,7 @@ import Data.Text qualified as T import Data.Time.Calendar (Day) import Prettyprinter import Prettyprinter.Render.Terminal +import System.IO.Unsafe (unsafePerformIO) -- | The render class is a superclass of `Pretty`. It exists to facilitate -- reporting styles (see below), as well as decomposing aggregate entities into composable parts (for instance `IssueTitle`, `IssueTags` of `Issue`). @@ -55,6 +56,16 @@ instance Render String instance Render Day where render = render . show +-- TODO Resolve `performUnsafeIO` +-- +-- We want `Renderable a => IO a` in our data structures so that we can defer potentially expensive computation until it is actually required to be rendered. +-- +-- We should be able to eliminate `unsafePerformIO` by lifting `render` to `a -> IO (Doc AnsiStyle)`. +-- +-- @backlog +instance Render a => Render (IO a) where + render = render . unsafePerformIO + -- | The `(<<<)` combinator concatenates renderables. It takes care of inserting spaces between non-empty renderables automatically, obsoleting prettyprinter's `(<+>)` and `(<>)`. (<<<) :: (Render a, Render b) => a -> b -> Doc AnsiStyle (<<<) a' b' = |