Working in ghci possible?

22 views
Skip to first unread message

Galaxy Being

unread,
Jul 2, 2021, 12:10:11 PM7/2/21
to diagrams-discuss
I'd like to not be restricted to projects and compiling, rather, just get stuff done from the ghci REPL. How could I, for example, alter your mycircle starter example to be done completely at the ghci REPL?

Brent Yorgey

unread,
Jul 3, 2021, 3:17:10 PM7/3/21
to Galaxy Being, diagrams-discuss
Yes, it's possible.  There is a generic function 'renderDia' which can be used to output an image, and many backends provide more specialized such functions, for example the SVG backend provides renderSVG:


So at the ghci prompt you could do something like

>>> myCircle = circle 1 :: Diagram B
>>> renderSVG "foo.svg" (mkWidth 400) myCircle

which would render the diagram to the file "foo.svg" with a width of 400.

-Brent

On Fri, Jul 2, 2021 at 11:10 AM Galaxy Being <bor...@gmail.com> wrote:
I'd like to not be restricted to projects and compiling, rather, just get stuff done from the ghci REPL. How could I, for example, alter your mycircle starter example to be done completely at the ghci REPL?

--
You received this message because you are subscribed to the Google Groups "diagrams-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diagrams-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diagrams-discuss/abd84449-8b5f-44e0-8062-ed144ff1a321n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages