Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stderr-stdout #9

Merged
merged 7 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import Data.Maybe
import Prettyprinter.Render.String (renderString)
import Prettyprinter
import Graphics.Svg
import System.IO
import qualified Data.Text.Lazy as T

errorEl :: String -> Element
errorEl msg =
Expand All @@ -38,11 +40,12 @@ errorEl msg =
<> tspan_ [ X_ <<- "200", Dy_ <<- "20", Font_weight_ <<- "lighter" ] (toElement msg))

drawItem :: Either String AABuilder.Item -> IO ()
drawItem (Left err) = renderToFile "rule34_1_err.svg" $ AABuilder.makeSvg $ (500, errorEl err)
drawItem (Right item) = renderToFile "rule34_1.svg" $ AABuilder.makeSvg $ AABuilder.renderItem item
drawItem (Left err) = hPutStr stderr . T.unpack . renderText . AABuilder.makeSvg $ (500, errorEl err)
drawItem (Right item) = putStr . T.unpack . renderText . AABuilder.makeSvg $ AABuilder.renderItem item

main :: IO ()
main = drawItem $ toAA Rule34.rule34_1


mainErr :: IO ()
mainErr = drawItem $ toAA Rule34.rule34_1_Any_err
Expand Down
1 change: 0 additions & 1 deletion jacobtan/Rule34-logic-gates/rule34-haskell/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ extra-deps:
- force-layout-0.4.0.6@sha256:0e3d8887ea2fce3cf3fa6704cc09f93086c70c93dc8732aefb0391e8b41f0b6e,1265
- monoid-extras-0.5.1@sha256:438dbfd7b4dce47d8f0ca577f56caf94bd1e21391afa545cad09fe7cf2e5793d,2333


# Override default flag values for local packages and extra-deps
# flags: {}

Expand Down