readDot :: FilePath -> Q Exp
readDot filename = runIO $ do
  dotStr <- readFile filename
  let parsedGraph :: DotGraph Text
      parsedGraph = parseDotGraph (pack dotStr)
  {- verify that the dot graph parses without error -}
  parsedGraph `seq` (return . LitE . StringL) dotStr


{- |
  This function takes a filename that contains a dot graph and produces
  a template haskell expression which defines a function of the type:
  @InstanceConfig -> InstanceConfig@. The purpose of the returned function
  is to insert the content of the dot graph into the appropriate Eureka
  metadata for this instance.

  usage: @$(addCartographerMetadata "cartography.dot") myInstanceConfig@
-}
readDot :: FilePath -> Q Exp
readDot filename = runIO $ do
  dotStr <- readFile filename
  let parsedGraph :: DotGraph Text
      parsedGraph = parseDotGraph (pack dotStr)
  {- verify that the dot graph parses without error -}
  parsedGraph `seq` (return . LitE . StringL) dotStr


{- |
  This function takes a filename that contains a dot graph and produces
  a template haskell expression which defines a function of the type:
  @InstanceConfig -> InstanceConfig@. The purpose of the returned function
  is to insert the content of the dot graph into the appropriate Eureka
  metadata for this instance.

  usage: @$(addCartographerMetadata "cartography.dot") myInstanceConfig@
-}
readDot filename = runIO $ do
  dotStr <- readFile filename
  let parsedGraph :: DotGraph Text
      parsedGraph = parseDotGraph (pack dotStr)
  {- verify that the dot graph parses without error -}
  parsedGraph `seq` (return . LitE . StringL) dotStr


{- |
  This function takes a filename that contains a dot graph and produces
  a template haskell expression which defines a function of the type:
  @InstanceConfig -> InstanceConfig@. The purpose of the returned function
  is to insert the content of the dot graph into the appropriate Eureka
  metadata for this instance.

  usage: @$(addCartographerMetadata "cartography.dot") myInstanceConfig@
-}