Commit 906d5eb0 authored by Adam Vogt's avatar Adam Vogt

a more general IO display instance and explanation

Turns out many examples do benefit from being able to peel away layers
of IO (ihaskell-magic's B.readFile "foo.png" for example), so add that
instance.
parent a00f2f33
......@@ -29,7 +29,17 @@ type Base64 = ByteString
class IHaskellDisplay a where
display :: a -> IO [DisplayData]
-- | Display DisplayData values immediately.
-- | these instances cause the image, html etc. which look like:
--
-- > DisplayData
-- > [DisplayData]
-- > IO [DisplayData]
-- > IO (IO DisplayData)
--
-- be run the IO and get rendered (if the frontend allows it) in the pretty
-- form.
instance IHaskellDisplay a => IHaskellDisplay (IO a) where
display = (display =<<)
instance IHaskellDisplay DisplayData where
display disp = return [disp]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment