Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
269 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
{-# LANGUAGE NoImplicitPrelude, TypeSynonymInstances, QuasiQuotes #-} | ||
|
||
module IHaskell.Display.Aeson () where | ||
|
||
import ClassyPrelude | ||
import Data.Textual.Encoding | ||
import Data.Aeson | ||
import Data.Aeson.Encode.Pretty | ||
import Data.String.Here | ||
import ClassyPrelude | ||
import Data.Textual.Encoding | ||
import Data.Aeson | ||
import Data.Aeson.Encode.Pretty | ||
import Data.String.Here | ||
|
||
import IHaskell.Display | ||
import IHaskell.Display | ||
|
||
instance IHaskellDisplay Value where | ||
display renderable = return $ Display [plain json, html dom] | ||
where | ||
where | ||
json = unpack $ decodeUtf8 $ encodePretty renderable | ||
dom = [i|<div class="highlight-code" id="javascript">${json}</div>|] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-} | ||
|
||
module IHaskell.Display.Basic () where | ||
|
||
import IHaskell.Display | ||
import IHaskell.Display | ||
|
||
import Text.Printf | ||
import Text.Printf | ||
|
||
instance Show a => IHaskellDisplay (Maybe a) where | ||
display just = return $ Display [stringDisplay, htmlDisplay] | ||
where | ||
where | ||
stringDisplay = plain (show just) | ||
htmlDisplay = html str | ||
str = case just of | ||
Nothing -> "<span style='color: red; font-weight: bold;'>Nothing</span>" | ||
Just x -> printf "<span style='color: green; font-weight: bold;'>Just</span><span style='font-family: monospace;'>%s</span>" (show x) | ||
str = | ||
case just of | ||
Nothing -> "<span style='color: red; font-weight: bold;'>Nothing</span>" | ||
Just x -> printf | ||
"<span style='color: green; font-weight: bold;'>Just</span><span style='font-family: monospace;'>%s</span>" | ||
(show x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-} | ||
|
||
module IHaskell.Display.Blaze () where | ||
|
||
import IHaskell.Display | ||
import IHaskell.Display | ||
|
||
import Text.Printf | ||
import Text.Blaze.Html | ||
import Text.Blaze.Renderer.Pretty | ||
import Text.Blaze.Internal | ||
import Control.Monad | ||
import Text.Printf | ||
import Text.Blaze.Html | ||
import Text.Blaze.Renderer.Pretty | ||
import Text.Blaze.Internal | ||
import Control.Monad | ||
|
||
instance IHaskellDisplay (MarkupM a) where | ||
display val = return $ Display [stringDisplay, htmlDisplay] | ||
where | ||
where | ||
str = renderMarkup (void val) | ||
stringDisplay = plain str | ||
htmlDisplay = html str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
{-# LANGUAGE TypeFamilies #-} | ||
{-# LANGUAGE FlexibleInstances #-} | ||
|
||
-- | Provides 'IHaskellDisplay' instances for 'LaTeX' and 'LaTeXT'. | ||
module IHaskell.Display.Hatex () where | ||
|
||
import IHaskell.Display | ||
import Text.LaTeX | ||
import IHaskell.Display | ||
import Text.LaTeX | ||
import qualified Data.Text as T | ||
|
||
instance IHaskellDisplay LaTeX where | ||
display = display . IHaskell.Display.latex . T.unpack . render | ||
|
||
instance (a ~ (), IO ~ io) => IHaskellDisplay (LaTeXT io a) where | ||
display ma = display =<< execLaTeXT ma | ||
display ma = display =<< execLaTeXT ma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.