Skip to content

Instantly share code, notes, and snippets.

@rnagasam
Created June 13, 2018 03:40
Show Gist options
  • Save rnagasam/b147db4c7c9ddbda685d032ed04c319a to your computer and use it in GitHub Desktop.
Save rnagasam/b147db4c7c9ddbda685d032ed04c319a to your computer and use it in GitHub Desktop.
svg-builder example
{-# LANGUAGE OverloadedStrings #-}
import Graphics.Svg
svg :: Element -> Element
svg content = doctype
<> with (svg11_ content) [Version_ <<- "1.1", Width_ <<- "300", Height_ <<- "200"]
contents :: Element
contents =
text_ [ X_ <<- "150", Y_ <<- "125", Font_size_ <<- "60"
, Text_anchor_ <<- "middle", Fill_ <<- "white" ] "SVG"
main :: IO ()
main = do
print $ svg contents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment